:root {
  --train-primary: #dc2626;
  --train-secondary: #f59e0b;
  --train-dark: #1e293b;
  --track-metal: #64748b;
  --track-ties: #78350f;
  --nature-green: #10b981;
  --sky-blue: #38bdf8;
  --bg-gradient: linear-gradient(180deg, #e0f2fe 0%, #f0fdf4 100%);
  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --border-radius: 18px;
}

body.talresan-game-page {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  color: #1e293b;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overflow-x: hidden;
}

/* Navbar */
.talresan-navbar {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #0284c7 100%);
  color: #ffffff;
  padding: 12px 0;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.25);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.talresan-brand {
  color: #ffffff;
  text-decoration: none;
  font-size: 1.35rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.talresan-brand:hover {
  color: #e0f2fe;
  text-decoration: none;
}

.talresan-badge {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.hud-pill {
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 6px 14px;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Level Selection Bar */
.level-nav-bar {
  background: #ffffff;
  border-bottom: 2px solid #e2e8f0;
  padding: 10px 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.level-chip-btn {
  border: 2px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  border-radius: 25px;
  padding: 6px 16px;
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.level-chip-btn:hover {
  border-color: #3b82f6;
  color: #1d4ed8;
}

.level-chip-btn.active {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  border-color: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.35);
}

/* SVG Railway Track Scenic Canvas */
.map-canvas-card {
  background: #ffffff;
  border-radius: var(--border-radius);
  border: 3px solid #bfdbfe;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  position: relative;
}

.map-svg-container {
  width: 100%;
  height: auto;
  min-height: 240px;
  max-height: 380px;
  background: linear-gradient(180deg, #bae6fd 0%, #e0f2fe 30%, #bbf7d0 70%, #86efac 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Station Badges & Waypoints */
.station-pin {
  pointer-events: none;
}

.train-group {
  transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.3));
}

.train-wheel {
  transform-origin: center;
}

.train-moving .train-wheel {
  animation: spinWheel 0.6s linear infinite;
}

@keyframes spinWheel {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.smoke-puff {
  opacity: 0;
  animation: puffSmoke 1.8s ease-out infinite;
}

@keyframes puffSmoke {
  0% { transform: translateY(0) scale(0.5); opacity: 0.8; }
  100% { transform: translateY(-40px) scale(1.8); opacity: 0; }
}

/* Challenge & Problem Card */
.challenge-card {
  background: #ffffff;
  border-radius: var(--border-radius);
  border: 3px solid #e2e8f0;
  box-shadow: var(--card-shadow);
  padding: 24px;
  position: relative;
}

.station-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: 20px;
  margin-bottom: 14px;
}

.problem-headline {
  font-size: 1.55rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
}

.problem-subtext {
  font-size: 1.05rem;
  color: #475569;
  margin-bottom: 20px;
}

/* Big Equation Display */
.equation-display-box {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  border-radius: 16px;
  padding: 22px;
  text-align: center;
  font-family: 'Segoe UI', system-ui, sans-serif;
  margin-bottom: 24px;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.4);
  border: 2px solid #334155;
}

.equation-text {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #f8fafc;
}

.equation-unknown {
  display: inline-block;
  background: #f59e0b;
  color: #78350f;
  padding: 2px 16px;
  border-radius: 10px;
  border: 2px dashed #b45309;
  animation: pulseUnknown 1.5s infinite;
}

@keyframes pulseUnknown {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); background: #fbbf24; }
}

/* Number Line Interactive Visualization */
.numberline-container {
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 24px;
  overflow-x: auto;
}

.numberline-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  min-width: 480px;
  padding: 10px 0;
}

.numberline-track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 4px;
  background: #94a3b8;
  z-index: 1;
}

.num-step {
  position: relative;
  z-index: 2;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #64748b;
  color: #1e293b;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.num-step.step-current {
  background: #ef4444;
  color: #ffffff;
  border-color: #b91c1c;
  transform: scale(1.2);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
}

.num-step.step-target {
  background: #10b981;
  color: #ffffff;
  border-color: #047857;
  transform: scale(1.2);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
}

.num-step.step-path {
  background: #fef08a;
  border-color: #f59e0b;
}

/* Multiple Choice Options Grid */
.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

@media (min-width: 768px) {
  .options-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.option-btn {
  background: #ffffff;
  border: 3px solid #cbd5e1;
  border-radius: 16px;
  padding: 18px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.04);
  position: relative;
  outline: none;
}

.option-btn:hover {
  border-color: #3b82f6;
  background: #eff6ff;
  box-shadow: 0 6px 14px rgba(59, 130, 246, 0.15);
}

.option-btn:active {
  transform: translateY(1px);
}

.option-kb-hint {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #94a3b8;
  font-family: monospace;
}

.option-number {
  font-size: 2.2rem;
  font-weight: 900;
  color: #1e293b;
  line-height: 1;
}

.option-btn.correct {
  background: #dcfce7 !important;
  border-color: #16a34a !important;
  color: #15803d !important;
  transform: scale(1.05);
}

.option-btn.wrong {
  background: #fee2e2 !important;
  border-color: #dc2626 !important;
  color: #991b1b !important;
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* Hint & Feedback Banner */
.feedback-box {
  border-radius: 14px;
  padding: 14px 18px;
  font-weight: 700;
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: fadeIn 0.3s ease;
}

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

.feedback-box.feedback-success {
  background: #ecfdf5;
  color: #065f46;
  border: 2px solid #a7f3d0;
}

.feedback-box.feedback-hint {
  background: #fffbeb;
  color: #92400e;
  border: 2px solid #fde68a;
}

/* Sidebar Progress & Stations list */
.station-route-card {
  background: #ffffff;
  border-radius: var(--border-radius);
  border: 2px solid #e2e8f0;
  padding: 18px;
  box-shadow: var(--card-shadow);
}

.route-step-row {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  transition: all 0.2s;
}

.route-step-row.completed {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.route-step-row.active {
  background: #eff6ff;
  border-color: #93c5fd;
  border-width: 2px;
  color: #1e40af;
  font-weight: 800;
}

.route-step-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  margin-right: 12px;
  background: #e2e8f0;
  color: #64748b;
}

.route-step-row.completed .route-step-icon {
  background: #10b981;
  color: #ffffff;
}

.route-step-row.active .route-step-icon {
  background: #3b82f6;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

/* Next Question CTA */
.next-question-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.15rem;
  border-radius: 14px;
  padding: 14px 28px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.15s;
}

.next-question-btn:hover {
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.45);
}

/* Modal finish */
.modal-talresan {
  border-radius: 24px;
  border: 3px solid #3b82f6;
  overflow: hidden;
}

.modal-talresan .modal-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #ffffff;
  border-bottom: none;
}
