/* =========================================================
   S.Resultant - Engineering Mechanics: Statics Stylesheet
   Author: Shihab Ibrahim (Shahab Sadeghpour)
   ========================================================= */

:root {
  --primary: #3F51B5;
  --primary-dark: #303F9F;
  --primary-light: #C5CAE9;
  --accent: #EE645F;
  --accent-dark: #D74944;
  --bg-color: #F8FAFC;
  --card-bg: #FFFFFF;
  --text-main: #1E293B;
  --text-muted: #64748B;
  --border-color: #E2E8F0;
  
  --color-f1: #2563EB;     /* Blue */
  --color-f2: #059669;     /* Green */
  --color-r: #DC2626;      /* Red */
  --color-para: #9333EA;   /* Purple for construction */
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==================== Top App Bar ==================== */
.top-app-bar {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.app-bar-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.header-logo {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: white;
  padding: 2px;
  box-shadow: var(--shadow-sm);
}

.header-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.header-subtitle {
  font-size: 0.75rem;
  opacity: 0.9;
  font-weight: 500;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* ==================== Main Layout ==================== */
.main-container {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  flex: 1;
}

.app-screen {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.app-screen.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Common Card */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary-dark);
}

.badge-accent {
  background: #FEE2E2;
  color: #DC2626;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(63, 81, 181, 0.35);
}

.btn-secondary {
  background-color: #F1F5F9;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: #E2E8F0;
}

.btn-accent {
  background-color: var(--accent);
  color: white;
}

.btn-accent:hover {
  background-color: var(--accent-dark);
  box-shadow: 0 4px 12px rgba(238, 100, 95, 0.4);
}

.btn-large {
  padding: 14px 28px;
  font-size: 1.05rem;
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.icon-btn-round {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  padding: 0;
  font-size: 1.2rem;
  line-height: 1;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-btn:hover {
  color: var(--primary-dark);
}

/* ==================== SCREEN 1: WELCOME ==================== */
.welcome-card {
  text-align: center;
  padding: 28px 20px;
}

.welcome-hero {
  margin-bottom: 20px;
}

.welcome-logo {
  width: 90px;
  height: 90px;
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  margin-bottom: 12px;
}

.hero-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.03em;
}

.hero-author {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Carousel */
.carousel-container {
  position: relative;
  max-width: 520px;
  margin: 16px auto 24px;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: #000;
  box-shadow: var(--shadow-md);
}

.carousel-track {
  display: flex;
  transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1);
}

.carousel-slide {
  min-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1e293b;
}

.carousel-slide img {
  width: 100%;
  height: auto;
  max-height: 300px;
  object-fit: contain;
  display: block;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.carousel-btn:hover {
  background: rgba(0,0,0,0.8);
}

.carousel-btn.prev { left: 10px; }
.carousel-btn.next { right: 10px; }

.carousel-indicators {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: var(--transition);
}

.dot.active {
  background: white;
  width: 22px;
  border-radius: 5px;
}

.welcome-description {
  max-width: 620px;
  margin: 0 auto 28px;
  text-align: justify;
  font-size: 0.95rem;
  color: #334155;
}

.welcome-description p {
  margin-bottom: 12px;
}

.welcome-description .tagline {
  font-style: italic;
  font-weight: 600;
  color: var(--primary-dark);
  text-align: center;
  margin-top: 16px;
}

.welcome-action {
  max-width: 400px;
  margin: 0 auto;
}

/* ==================== SCREEN 2: TOPICS ==================== */
.topics-header {
  margin-bottom: 20px;
  text-align: center;
}

.topics-header h2 {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-main);
}

.topics-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.topic-group {
  margin-bottom: 20px;
}

.topic-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.topic-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.topic-item-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: #FAFBFD;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.topic-item-card:hover {
  background: white;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.topic-item-img-wrap {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  background: white;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  flex-shrink: 0;
}

.topic-item-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.topic-item-info {
  flex: 1;
}

.topic-item-info h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-main);
}

.topic-item-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.action-tag {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
}

/* ==================== SCREEN 3: INPUT & FORCE DRAWING ==================== */
.screen-header-banner {
  background: linear-gradient(135deg, #FFFFFF 0%, #EEF2FF 100%);
  border-left: 4px solid var(--primary);
}

.banner-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.banner-title-row h2 {
  font-size: 1.4rem;
  font-weight: 700;
}

.banner-hint {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.tutorial-box {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  color: #92400E;
  margin-bottom: 20px;
  font-size: 0.88rem;
}

.tutorial-box h4 {
  font-weight: 700;
  margin-bottom: 6px;
  color: #78350F;
}

.tutorial-box p {
  margin-bottom: 6px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.section-title-row h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.count-badge {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  background: #E2E8F0;
  color: var(--text-main);
}

.count-badge.valid {
  background: #DCFCE7;
  color: #166534;
}

.count-badge.invalid {
  background: #FEE2E2;
  color: #991B1B;
}

/* Custom Checkbox Grid */
.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.col-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.custom-checkbox {
  display: flex;
  align-items: center;
  position: relative;
  padding-left: 32px;
  margin-bottom: 10px;
  cursor: pointer;
  font-size: 0.92rem;
  user-select: none;
}

.custom-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 20px;
  width: 20px;
  background-color: #F1F5F9;
  border: 2px solid #94A3B8;
  border-radius: 4px;
  transition: var(--transition);
}

.custom-checkbox:hover input ~ .checkmark {
  background-color: #E2E8F0;
}

.custom-checkbox input:checked ~ .checkmark {
  background-color: var(--primary);
  border-color: var(--primary);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.custom-checkbox input:checked ~ .checkmark:after {
  display: block;
}

/* Parameter Inputs */
.input-rows-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.param-row {
  display: flex;
  align-items: center;
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  gap: 12px;
  flex-wrap: wrap;
}

.param-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 80px;
  font-size: 0.95rem;
}

.param-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.color-f1 { background-color: var(--color-f1); }
.color-f2 { background-color: var(--color-f2); }
.color-r { background-color: var(--color-r); }

.param-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  flex-wrap: wrap;
}

.input-with-unit {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-unit input {
  width: 110px;
  padding: 8px 36px 8px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 500;
  transition: var(--transition);
  background: white;
}

.input-with-unit input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(63, 81, 181, 0.15);
}

.unit-tag {
  position: absolute;
  right: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
}

.select-field {
  padding: 8px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: white;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
}

.select-field:focus {
  outline: none;
  border-color: var(--primary);
}

.axis-selector {
  display: flex;
  align-items: center;
  gap: 6px;
}

.from-text {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.input-actions-bar {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

/* Canvas Styling */
.canvas-section {
  padding: 16px;
}

.canvas-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.canvas-legend {
  display: flex;
  gap: 14px;
  font-size: 0.85rem;
  font-weight: 600;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.canvas-wrapper {
  position: relative;
  background: white;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.03);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.canvas-wrapper.is-dragging {
  cursor: grabbing;
}

.canvas-wrapper canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Floating Zoom & Pan Canvas Toolbar */
.canvas-toolbar {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  box-shadow: var(--shadow-md);
  z-index: 10;
  user-select: none;
}

.canvas-tool-btn {
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
  line-height: 1;
}

.canvas-tool-btn:hover {
  background: #E2E8F0;
  border-color: var(--primary);
  color: var(--primary);
}

.canvas-tool-btn svg {
  display: block;
  pointer-events: none;
}

.canvas-zoom-text {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-main);
  min-width: 44px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
}

.canvas-hint-overlay {
  position: absolute;
  bottom: 8px;
  left: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #94A3B8;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  pointer-events: none;
  user-select: none;
}

/* ==================== FULLSCREEN CANVAS & CORNER STEP BUTTONS ==================== */
.canvas-wrapper.is-fullscreen,
.canvas-wrapper:fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  margin: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  z-index: 99999 !important;
  background: #FFFFFF !important;
  box-shadow: none !important;
}

.canvas-wrapper.is-fullscreen canvas,
.canvas-wrapper:fullscreen canvas {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain;
}

.canvas-wrapper.is-fullscreen .canvas-toolbar,
.canvas-wrapper:fullscreen .canvas-toolbar {
  top: 18px;
  right: 20px;
  padding: 6px 10px;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  z-index: 30;
}

.canvas-wrapper.is-fullscreen .canvas-tool-btn,
.canvas-wrapper:fullscreen .canvas-tool-btn {
  width: 32px;
  height: 32px;
}

.canvas-wrapper.is-fullscreen .canvas-hint-overlay,
.canvas-wrapper:fullscreen .canvas-hint-overlay {
  bottom: 18px;
  left: 20px;
  font-size: 0.82rem;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 20;
}

/* Corner Step & Action Buttons Overlay */
.canvas-corner-actions {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 25;
  pointer-events: auto;
}

.canvas-wrapper.is-fullscreen .canvas-corner-actions,
.canvas-wrapper:fullscreen .canvas-corner-actions {
  bottom: 24px;
  right: 24px;
  gap: 12px;
}

.canvas-corner-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 700;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0,0,0,0.1);
  user-select: none;
  white-space: nowrap;
}

.canvas-wrapper.is-fullscreen .canvas-corner-btn,
.canvas-wrapper:fullscreen .canvas-corner-btn {
  padding: 12px 24px;
  font-size: 1.05rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.canvas-corner-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

.canvas-corner-btn:active {
  transform: translateY(0) scale(0.98);
}

/* Corner Button Theme Variants */
.btn-show-solution-corner {
  background: linear-gradient(135deg, #D97706, #B45309);
  color: #FFFFFF;
}
.btn-show-solution-corner:hover {
  background: linear-gradient(135deg, #F59E0B, #D97706);
}

.btn-step-action-corner.step-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #FFFFFF;
}
.btn-step-action-corner.step-primary:hover {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
}

.btn-step-action-corner.step-accent {
  background: linear-gradient(135deg, #2563EB, #1D4ED8);
  color: #FFFFFF;
}
.btn-step-action-corner.step-accent:hover {
  background: linear-gradient(135deg, #3B82F6, #2563EB);
}

.btn-step-action-corner.step-repeat {
  background: linear-gradient(135deg, #475569, #334155);
  color: #FFFFFF;
}
.btn-step-action-corner.step-repeat:hover {
  background: linear-gradient(135deg, #64748B, #475569);
}

.canvas-step-badge-pill {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary-dark);
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(6px);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.canvas-wrapper.is-fullscreen .canvas-step-badge-pill,
.canvas-wrapper:fullscreen .canvas-step-badge-pill {
  font-size: 0.92rem;
  padding: 8px 16px;
}

.btn-triangle-toggle-corner {
  background: linear-gradient(135deg, #0284C7, #0369A1);
  color: #FFFFFF;
}
.btn-triangle-toggle-corner:hover {
  background: linear-gradient(135deg, #0EA5E9, #0284C7);
}

/* ==================== SCREEN 4: SOLUTION WALKTHROUGH ==================== */
.problem-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 8px 0;
  color: var(--primary-dark);
}

.problem-statement {
  font-size: 0.95rem;
  background: white;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

/* Hint Cards */
.hint-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
}

.hint-tails {
  background: #FEF2F2;
  border-left: 4px solid #DC2626;
  color: #991B1B;
}

.hint-tails .hint-icon {
  color: #DC2626;
}

.hint-general {
  background: #FFF7ED;
  border-left: 4px solid #EA580C;
  color: #9A3412;
}

.hint-general .hint-icon {
  color: #EA580C;
}

.hint-content h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.hint-content p {
  font-size: 0.88rem;
  line-height: 1.45;
}

/* Parallelogram Construction */
.scale-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.scale-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.scale-value {
  font-size: 0.88rem;
  font-weight: 700;
  min-width: 38px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
}

.step-intro-text, .triangle-intro-text {
  font-size: 0.9rem;
  color: #334155;
  margin-bottom: 14px;
}

.step-card {
  background: #F1F5F9;
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid #CBD5E1;
}

.step-badge {
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.step-buttons-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

/* Math Cards & KaTeX Display */
.math-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 24px;
}

.math-card {
  background: #FAFBFD;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.math-card h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 12px;
  border-bottom: 2px solid #EEF2F6;
  padding-bottom: 8px;
}

.math-body {
  font-family: var(--font-main);
  font-size: 0.94rem;
  line-height: 1.7;
  color: #1E293B;
}

.math-equation {
  background: white;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin: 10px 0;
  overflow-x: auto;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

.math-item {
  margin-bottom: 14px;
}

.math-item:last-child {
  margin-bottom: 0;
}

.math-item-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
}

.math-tex {
  margin: 4px 0;
}

.katex-display {
  margin: 0.4em 0 !important;
  text-align: left !important;
  padding-left: 6px;
  overflow-x: auto;
  overflow-y: hidden;
}

.katex {
  font-size: 1.08em !important;
  text-rendering: geometricPrecision;
}

.final-result-box {
  background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
  color: white;
  border-radius: var(--radius-md);
  padding: 22px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.result-title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #94A3B8;
  margin-bottom: 12px;
}

.result-values {
  font-size: 1.45rem;
  font-weight: 800;
  color: #F8FAFC;
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}

.result-values .katex {
  color: #F8FAFC !important;
}

.result-values .katex .mathbf {
  color: #38BDF8 !important;
}

.result-val-highlight {
  color: #38BDF8;
}

.nav-buttons-cluster {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  flex-wrap: wrap;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.modal-dialog {
  max-width: 440px;
  width: 100%;
  padding: 24px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.close-modal {
  font-size: 1.4rem;
  color: var(--text-muted);
}

.modal-icon-wrap {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
}

.modal-icon-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.coming-soon-notice {
  background: #F8FAFC;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin: 16px 0;
  text-align: center;
}

.coming-soon-notice p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.modal-footer {
  text-align: right;
  margin-top: 16px;
}

/* ==================== RESOLUTION MODULE (X-Y & U-V MODES) ==================== */
.mode-tabs-container {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.mode-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-color);
  background: #F8FAFC;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.mode-tab-btn:hover {
  background: #EDF2F7;
  color: var(--text-main);
  border-color: #CBD5E1;
}

.mode-tab-btn.active {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.mode-tab-btn svg {
  stroke-width: 2.2;
}

.resolve-inputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 12px;
}

.form-select {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--text-main);
  background-color: #FFFFFF;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.presets-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
}

.presets-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.btn-preset {
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-preset:hover {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  transform: translateY(-1px);
}

.step-explanation-box {
  background: #EFF6FF;
  border-left: 4px solid #3B82F6;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: #1E3A8A;
  line-height: 1.5;
}

.legend-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

.math-item-title {
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 4px;
  font-size: 0.92rem;
}

.math-tex {
  margin: 6px 0 12px;
  overflow-x: auto;
}

.resolve-sol-content {
  display: block;
}

/* ==================== COPLANAR FORCES MODULE STYLES ==================== */
.force-count-selector {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.selector-label {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
}

.btn-group-count {
  display: inline-flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1.5px solid var(--border-color);
  background: #F1F5F9;
}

.btn-count {
  padding: 8px 18px;
  font-size: 0.88rem;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-count:not(:last-child) {
  border-right: 1.5px solid var(--border-color);
}

.btn-count:hover {
  background: #E2E8F0;
  color: var(--text-main);
}

.btn-count.active {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
}

.cf-forces-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cf-force-row {
  background: #F8FAFC;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: border-color 0.2s ease;
}

.cf-force-row.force-f1 { border-left: 5px solid #2563EB; }
.cf-force-row.force-f2 { border-left: 5px solid #D97706; }
.cf-force-row.force-f3 { border-left: 5px solid #059669; }
.cf-force-row.force-f4 { border-left: 5px solid #7C3AED; }

.cf-force-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 0.96rem;
  font-weight: 700;
}

.force-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #FFFFFF;
  font-size: 0.8rem;
  font-weight: 800;
}

.badge-f1 { background: #2563EB; }
.badge-f2 { background: #D97706; }
.badge-f3 { background: #059669; }
.badge-f4 { background: #7C3AED; }

.cf-force-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.cf-force-fields .param-inputs {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.cf-force-fields .param-inputs label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.cf-force-fields .param-inputs input,
.cf-force-fields .param-inputs select {
  width: 100%;
}

/* Coplanar Summary Table */
.cf-summary-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 0.9rem;
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.cf-summary-table th {
  background: #F1F5F9;
  padding: 10px 14px;
  font-weight: 700;
  text-align: left;
  border-bottom: 2px solid var(--border-color);
  color: var(--text-main);
}

.cf-summary-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.cf-summary-table tr:last-child td {
  border-bottom: none;
}

.cf-summary-table tr.total-row {
  background: #F8FAFC;
  font-weight: 800;
}

.cf-summary-table tr.total-row td {
  border-top: 2px solid var(--border-color);
  color: var(--primary-dark);
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .cf-force-fields {
    grid-template-columns: 1fr;
  }
}

/* Stage Tags */
.stage-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
}

/* Force Selection Tabs */
.cf-force-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.cf-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
}

.cf-tab-btn:hover {
  background: #F1F5F9;
  border-color: #94A3B8;
}

.cf-tab-btn.active {
  background: #1E293B;
  color: #FFFFFF;
  border-color: #1E293B;
  box-shadow: var(--shadow-sm);
}

/* Step Navigation Toolbar */
.step-nav-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 16px;
  padding: 10px 14px;
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.step-pills-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-step-pill {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: #FFFFFF;
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-step-pill:hover {
  background: #E2E8F0;
  border-color: #94A3B8;
}

.btn-step-pill.active {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.cf-single-math-card {
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

/* Parallel Forces Presets Bar */
.pf-presets-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 16px;
  padding: 10px 14px;
  background: #F8FAFC;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
}

.pf-presets-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-pf-preset {
  background: #FFFFFF;
  border: 1.5px solid #CBD5E1;
  color: #334155;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-pf-preset:hover {
  background: #F1F5F9;
  border-color: #94A3B8;
  color: #0F172A;
  transform: translateY(-1px);
}

.btn-pf-preset.active {
  background: #EFF6FF;
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

/* Step 3 Assumed Resultant Interactive Exploration Box */
.assumed-exploration-card {
  background: #F8FAFC;
  border: 1.5px solid #9333EA;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 12px 0 16px;
  box-shadow: 0 2px 8px rgba(147, 51, 234, 0.08);
}

.assumed-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.assumed-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #6B21A8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.assumed-controls-cluster {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  background: #FFFFFF;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid #E2E8F0;
}

@media (max-width: 768px) {
  .assumed-controls-cluster {
    grid-template-columns: 1fr;
  }
}

.assumed-dir-segmented {
  display: inline-flex;
  background: #E2E8F0;
  padding: 3px;
  border-radius: 6px;
  gap: 2px;
}

.btn-assumed-dir {
  border: none;
  background: transparent;
  color: #475569;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-assumed-dir.active {
  background: #9333EA;
  color: #FFFFFF;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.assumed-slider-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.assumed-slider-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
}

.assumed-range-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #E2E8F0;
  outline: none;
  accent-color: #9333EA;
  cursor: pointer;
}

.assumed-d-val-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.86rem;
  font-weight: 700;
  color: #6B21A8;
  background: #FAF5FF;
  border: 1px solid #E9D5FF;
  padding: 3px 8px;
  border-radius: 4px;
  min-width: 60px;
  text-align: center;
}

.btn-snap-solution {
  background: #FAF5FF;
  border: 1.5px solid #C084FC;
  color: #7E22CE;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-snap-solution:hover {
  background: #9333EA;
  color: #FFFFFF;
  border-color: #9333EA;
}

.assumed-eureka-banner {
  margin-top: 10px;
  padding: 10px 14px;
  background: #FAF5FF;
  border-left: 4px solid #9333EA;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.88rem;
  color: #3B0764;
  line-height: 1.5;
}



