/* ==========================================================================
   Moon Explorer — Stylesheet
   Design language: "modern space museum" — dark, premium, calm gradients,
   warm lunar-gold accents, soft glass panels. Built for ages 8-12 but never
   childish: big touch targets, clear type, generous spacing, gentle motion.
   ========================================================================== */

:root {
  --bg-deep: #05070f;
  --bg-mid: #0b0f22;
  --panel-bg: rgba(18, 22, 42, 0.82);
  --panel-bg-solid: #12162a;
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f4f6ff;
  --text-secondary: #aab0cf;
  --text-muted: #7d84a8;
  --accent-gold: #ffc857;
  --accent-gold-deep: #f0a83c;
  --accent-teal: #5eead4;
  --accent-blue: #6ea8ff;
  --accent-coral: #ff8577;
  --success: #6fdc8c;
  --danger: #ff6b6b;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.45);
  --shadow-pop: 0 16px 50px rgba(0, 0, 0, 0.55);
  --font-display: 'Baloo 2', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

button { font-family: inherit; }

#app {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, #131a36 0%, var(--bg-mid) 45%, var(--bg-deep) 100%);
}

.hidden { display: none !important; }

/* ==========================================================================
   Overlays (welcome / unsupported / error)
   ========================================================================== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 30%, #161d3d 0%, #060812 70%);
  animation: fadeIn 0.4s ease;
}

.overlay.fading-out { animation: fadeOut 0.5s ease forwards; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; visibility: hidden; } }

.stars-static {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, #fff, transparent),
    radial-gradient(1px 1px at 70% 60%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 40% 80%, #fff, transparent),
    radial-gradient(1px 1px at 85% 20%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 60% 15%, #fff, transparent),
    radial-gradient(1px 1px at 10% 65%, #fff, transparent),
    radial-gradient(1px 1px at 92% 75%, #fff, transparent);
  background-repeat: repeat;
  background-size: 400px 400px;
  opacity: 0.6;
}

.welcome-card, .overlay-card {
  position: relative;
  max-width: 480px;
  width: 100%;
  text-align: center;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 44px 36px 36px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-pop);
  animation: popIn 0.5s cubic-bezier(.2,.9,.3,1.2);
}

@keyframes popIn {
  from { transform: translateY(18px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.welcome-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 1.6px;
  color: var(--accent-gold);
  background: rgba(255, 200, 87, 0.12);
  border: 1px solid rgba(255, 200, 87, 0.3);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 18px;
}

.welcome-card h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 38px);
  margin: 0 0 14px;
  background: linear-gradient(135deg, #fff 20%, #ffdca0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.welcome-card p {
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.6;
  margin: 0 0 28px;
}

.welcome-hint {
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-muted);
}

.overlay-icon { font-size: 48px; margin-bottom: 12px; }
.overlay-card h2 { font-family: var(--font-display); font-size: 24px; margin: 0 0 12px; }
.overlay-card p { color: var(--text-secondary); line-height: 1.6; margin: 0 0 20px; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  border: none;
  border-radius: 14px;
  padding: 12px 22px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
  user-select: none;
}
.btn:active { transform: scale(0.96); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-gold-deep) 100%);
  color: #241705;
  box-shadow: 0 8px 24px rgba(240, 168, 60, 0.35);
}
.btn-primary:hover { box-shadow: 0 10px 30px rgba(240, 168, 60, 0.5); transform: translateY(-1px); }

.btn-large { padding: 15px 30px; font-size: 17px; border-radius: 16px; }

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--panel-border);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }
.btn-ghost:disabled { opacity: 0.35; cursor: default; }
.btn-ghost:disabled:active { transform: none; }

.icon-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }

/* ==========================================================================
   Top bar
   ========================================================================== */
#top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 16px 24px;
  background: linear-gradient(to bottom, rgba(6, 8, 18, 0.85) 0%, rgba(6, 8, 18, 0) 100%);
  pointer-events: none;
}
#top-bar > * { pointer-events: auto; }
.brand { grid-column: 1; justify-self: start; }
.main-nav { grid-column: 2; justify-self: center; }
#mobile-menu-btn { grid-column: 3; justify-self: end; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-emoji { font-size: 30px; filter: drop-shadow(0 0 12px rgba(255, 200, 87, 0.5)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: 0.3px; }
.brand-subtitle { font-size: 12px; color: var(--text-secondary); }

.main-nav {
  display: flex;
  gap: 6px;
  background: rgba(18, 22, 42, 0.7);
  border: 1px solid var(--panel-border);
  padding: 5px;
  border-radius: 16px;
  backdrop-filter: blur(14px);
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14.5px;
  padding: 9px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.nav-btn svg { width: 17px; height: 17px; }
.nav-btn:hover { color: var(--text-primary); }
.nav-btn.active {
  background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-gold-deep) 100%);
  color: #241705;
}

.mobile-only { display: none; }

/* ==========================================================================
   Viewport / 3D canvas
   ========================================================================== */
#viewport {
  position: absolute;
  inset: 0;
  z-index: 1;
}
#scene-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }
#label-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }

.scene-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 15px;
  background: var(--bg-deep);
  z-index: 10;
  transition: opacity 0.5s ease;
}
.orbit-spinner {
  width: 46px; height: 46px;
  border: 2px solid rgba(255,255,255,0.12);
  border-top-color: var(--accent-gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  position: relative;
}
.orbit-dot {
  position: absolute; top: -3px; left: 50%;
  width: 6px; height: 6px; margin-left: -3px;
  background: var(--accent-teal); border-radius: 50%;
}
@keyframes spin { to { transform: rotate(360deg); } }

.drag-hint {
  position: absolute;
  bottom: 108px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(12, 15, 30, 0.72);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--text-secondary);
  animation: floatHint 2.6s ease-in-out infinite, fadeIn 0.6s ease;
  z-index: 20;
  pointer-events: none;
  white-space: nowrap;
}
.drag-hint svg { width: 16px; height: 16px; color: var(--accent-gold); }
@keyframes floatHint { 0%,100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -6px); } }

/* Marker labels (created dynamically via CSS2DRenderer) */
.marker-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  background: rgba(10, 13, 26, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-primary);
  backdrop-filter: blur(6px);
  transform: translate(16px, -50%);
  transition: opacity 0.15s ease, transform 0.15s ease;
  cursor: pointer;
  pointer-events: auto;
}
.marker-label.type-apollo { border-color: rgba(94, 234, 212, 0.5); }
.marker-label.type-feature { border-color: rgba(255, 200, 87, 0.5); }
.marker-label .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.marker-label.type-feature .dot { background: var(--accent-gold); box-shadow: 0 0 8px var(--accent-gold); }
.marker-label.type-apollo .dot { background: var(--accent-teal); box-shadow: 0 0 8px var(--accent-teal); }
.marker-label:hover { background: rgba(20, 25, 46, 0.95); transform: translate(16px, -50%) scale(1.05); }
.marker-label.dim { opacity: 0.35; }
.marker-label.selected { background: rgba(255, 200, 87, 0.18); }

/* ==========================================================================
   Legend
   ========================================================================== */
.legend {
  position: absolute;
  top: 88px;
  left: 24px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(12, 15, 30, 0.6);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.legend-item { display: flex; align-items: center; gap: 8px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.dot-feature { background: var(--accent-gold); box-shadow: 0 0 6px var(--accent-gold); }
.dot-apollo { background: var(--accent-teal); box-shadow: 0 0 6px var(--accent-teal); }

/* ==========================================================================
   Control dock (bottom)
   ========================================================================== */
.control-dock {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  gap: 6px;
  background: rgba(14, 17, 34, 0.78);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(18px);
  padding: 8px;
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  max-width: calc(100vw - 24px);
  overflow-x: auto;
}

.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 66px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 9px 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
  flex: none;
}
.dock-btn svg { width: 20px; height: 20px; }
.dock-btn span { font-size: 11px; font-weight: 700; font-family: var(--font-display); white-space: nowrap; }
.dock-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-primary); }
.dock-btn.on, .dock-btn[data-active="true"] { color: var(--accent-gold); background: rgba(255, 200, 87, 0.12); }

/* ==========================================================================
   Info panel (feature / apollo details)
   ========================================================================== */
.info-panel {
  position: fixed;
  top: 88px;
  right: 24px;
  bottom: 100px;
  width: 360px;
  max-width: calc(100vw - 48px);
  z-index: 110;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-pop);
  padding: 24px 22px;
  overflow-y: auto;
  animation: slideIn 0.35s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.panel-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 32px; height: 32px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
}
.panel-close:hover { background: rgba(255,255,255,0.12); color: var(--text-primary); }

.info-content .kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.kicker.type-feature { background: rgba(255, 200, 87, 0.14); color: var(--accent-gold); }
.kicker.type-apollo { background: rgba(94, 234, 212, 0.14); color: var(--accent-teal); }

.info-content .info-icon { font-size: 40px; margin-bottom: 8px; display: block; }
.info-content h2 { font-family: var(--font-display); font-size: 22px; margin: 0 0 12px; line-height: 1.25; padding-right: 20px; }
.info-content .info-body { color: var(--text-secondary); font-size: 15px; line-height: 1.65; margin: 0 0 16px; }

.fact-box {
  background: linear-gradient(135deg, rgba(255, 200, 87, 0.1), rgba(94, 234, 212, 0.07));
  border: 1px solid rgba(255, 200, 87, 0.22);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-primary);
}
.fact-box strong { color: var(--accent-gold); display: block; margin-bottom: 4px; font-family: var(--font-display); font-size: 13.5px; }

.apollo-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.meta-chip {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
}
.meta-chip b { display: block; font-family: var(--font-display); font-size: 14px; color: var(--text-primary); }
.meta-chip span { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ==========================================================================
   Floating panels (day/night, phases)
   ========================================================================== */
.floating-panel {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 105;
  width: 380px;
  max-width: calc(100vw - 32px);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-pop);
  padding: 18px 20px 22px;
  animation: floatUp 0.3s cubic-bezier(.2,.9,.3,1.1);
}
.floating-panel.wide { width: 440px; }
@keyframes floatUp { from { transform: translateX(-50%) translateY(16px); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }
@keyframes slideFadeUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-header h3 { font-family: var(--font-display); font-size: 17px; margin: 0; }
.panel-close-small {
  width: 26px; height: 26px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
}
.panel-close-small:hover { background: rgba(255,255,255,0.12); }

.segmented { display: flex; background: rgba(255,255,255,0.05); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 12px; }
.segment {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 6px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.segment.active { background: linear-gradient(135deg, var(--accent-blue), #4f7de0); color: #fff; }
.panel-note { font-size: 13px; color: var(--text-secondary); line-height: 1.55; margin: 0; }

.phase-display { text-align: center; margin-bottom: 16px; }
.phase-name { font-family: var(--font-display); font-size: 20px; color: var(--accent-gold); margin-bottom: 6px; }
.phase-explanation { font-size: 13.5px; color: var(--text-secondary); line-height: 1.55; margin: 0; min-height: 40px; }

.phase-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right, #1a2040, #3a4270);
  outline: none;
  margin: 10px 0 8px;
}
.phase-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, var(--accent-gold) 70%);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(255, 200, 87, 0.6);
  border: 2px solid #fff2;
}
.phase-slider::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, var(--accent-gold) 70%);
  cursor: pointer;
  border: 2px solid #fff2;
}
.phase-ticks { display: flex; justify-content: space-between; padding: 0 2px; }
.phase-ticks span { font-size: 15px; opacity: 0.55; cursor: pointer; transition: opacity 0.2s; }
.phase-ticks span:hover, .phase-ticks span.active { opacity: 1; }

/* ==========================================================================
   Lesson overlay
   ========================================================================== */
.lesson-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  padding-top: 96px;
  pointer-events: none;
}
/* Anchored to the top (not the bottom) so it never competes for space with
   the bottom control dock or the Day/Night and Phases floating panels —
   important since the lesson can open those panels mid-step. */

.lesson-card {
  pointer-events: auto;
  width: 100%;
  max-width: 620px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow-pop);
  padding: 26px 28px 22px;
  animation: slideFadeUp 0.35s cubic-bezier(.2,.9,.3,1.1);
  margin-bottom: 8px;
}

.lesson-progress { height: 5px; background: rgba(255,255,255,0.08); border-radius: 999px; overflow: hidden; margin-bottom: 16px; }
.lesson-progress-bar { height: 100%; background: linear-gradient(90deg, var(--accent-teal), var(--accent-gold)); border-radius: 999px; transition: width 0.4s ease; }

.lesson-step-tag {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent-teal);
  text-transform: uppercase;
  margin-bottom: 8px;
}
#lesson-title { font-family: var(--font-display); font-size: 24px; margin: 0 0 10px; }
#lesson-body { color: var(--text-secondary); font-size: 15.5px; line-height: 1.65; margin: 0 0 20px; }

.lesson-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lesson-dots { display: flex; gap: 7px; }
.lesson-dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.18); transition: all 0.25s ease; }
.lesson-dots span.active { background: var(--accent-gold); width: 22px; border-radius: 999px; }
.lesson-dots span.done { background: var(--accent-teal); }

.lesson-exit {
  pointer-events: auto;
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 210;
  background: rgba(14, 17, 34, 0.78);
  border: 1px solid var(--panel-border);
  color: var(--text-secondary);
  backdrop-filter: blur(14px);
  padding: 9px 16px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.lesson-exit:hover { color: var(--text-primary); background: rgba(255,255,255,0.1); }

/* ==========================================================================
   Quiz overlay
   ========================================================================== */
.quiz-overlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 6, 14, 0.55);
  backdrop-filter: blur(6px);
}

.quiz-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: var(--panel-bg-solid);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 30px 30px 26px;
  animation: popIn 0.4s cubic-bezier(.2,.9,.3,1.15);
  max-height: 86vh;
  overflow-y: auto;
}

.quiz-progress-row { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.quiz-progress-row .lesson-progress { flex: 1; margin-bottom: 0; }
.quiz-counter { font-size: 13px; color: var(--text-muted); font-weight: 700; white-space: nowrap; }

.quiz-question { font-family: var(--font-display); font-size: 21px; line-height: 1.4; margin: 0 0 20px; padding-right: 10px; }

.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-option {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: rgba(255,255,255,0.05);
  border: 1.5px solid var(--panel-border);
  color: var(--text-primary);
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}
.quiz-option:hover:not(:disabled) { background: rgba(255,255,255,0.09); border-color: rgba(255,255,255,0.2); transform: translateY(-1px); }
.quiz-option .opt-letter {
  flex: none;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-family: var(--font-display);
}
.quiz-option:disabled { cursor: default; }
.quiz-option.correct { background: rgba(111, 220, 140, 0.18); border-color: var(--success); }
.quiz-option.correct .opt-letter { background: var(--success); color: #0a1f10; }
.quiz-option.incorrect { background: rgba(255, 107, 107, 0.16); border-color: var(--danger); }
.quiz-option.incorrect .opt-letter { background: var(--danger); color: #2a0a0a; }
.quiz-option.faded { opacity: 0.5; }

.quiz-feedback {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.55;
  animation: slideFadeUp 0.3s ease;
}
.quiz-feedback.correct { background: rgba(111, 220, 140, 0.12); border: 1px solid rgba(111, 220, 140, 0.35); }
.quiz-feedback.incorrect { background: rgba(255, 107, 107, 0.1); border: 1px solid rgba(255, 107, 107, 0.3); }
.quiz-feedback .fb-title { font-family: var(--font-display); font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }

.quiz-continue { margin-top: 18px; width: 100%; }

.quiz-result { text-align: center; padding: 10px 0; }
.quiz-result .result-emoji { font-size: 56px; margin-bottom: 10px; }
.quiz-result h2 { font-family: var(--font-display); font-size: 26px; margin: 0 0 8px; }
.quiz-result .score-line { font-size: 17px; color: var(--text-secondary); margin-bottom: 20px; }
.quiz-result .score-line b { color: var(--accent-gold); font-size: 22px; }
.quiz-result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 880px) {
  .info-panel {
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    top: auto;
    bottom: 0;
    border-radius: 22px 22px 0 0;
    max-height: 56vh;
    padding-top: 20px;
    animation: sheetUp 0.35s cubic-bezier(.2,.9,.3,1.1);
  }
  @keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .sheet-handle {
    position: fixed;
    bottom: calc(56vh - 4px);
    left: 50%;
    transform: translateX(-50%);
    width: 40px; height: 5px;
    border-radius: 999px;
    background: rgba(255,255,255,0.25);
    z-index: 111;
  }
  .legend { display: none !important; }
  .brand-subtitle { display: none; }
  .main-nav { display: none; }
  .mobile-only { display: flex; }
  #top-bar { padding: 12px 16px; }
  .brand-title { font-size: 17px; white-space: nowrap; }
  .brand-emoji { font-size: 24px; }
  .control-dock { bottom: 12px; gap: 2px; padding: 6px; border-radius: 18px; }
  .dock-btn { min-width: 54px; padding: 8px 6px; }
  .dock-btn span { font-size: 9.5px; }
  .floating-panel { bottom: 88px; }
  .drag-hint { bottom: 92px; font-size: 12px; padding: 8px 14px; }
}

@media (max-width: 480px) {
  .welcome-card { padding: 32px 22px 26px; }
  .welcome-card h1 { font-size: 26px; }
  .welcome-card p { font-size: 14.5px; }
  .quiz-card { padding: 22px 18px 20px; }
  .quiz-question { font-size: 18px; }
  .floating-panel.wide { width: calc(100vw - 24px); }
}

@media (max-width: 360px) {
  .dock-btn span { display: none; }
  .dock-btn { min-width: 40px; }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
