/* ═══════════════════════════════════════════════════════════════
   SPEECH CHECK — UNIFIED APP STYLESHEET
   Version: 2.1
   Font stack: Syne (headings, bold) + Plus Jakarta Sans (body)
   Usage: <link href="speechcheck.css" rel="stylesheet">
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ═══════════════════════════════════════
   1. DESIGN TOKENS
   ═══════════════════════════════════════ */
:root {
  /* Fonts */
  --font-display: "Syne", system-ui, , sans-serif;
  --font-body:    "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;

  --text-xs:   11px;
  --text-sm:   13px;
  --text-base: 15px;
  --text-md:   17px;
  --text-lg:   20px;
  --text-xl:   26px;
  --text-2xl:  34px;
  --text-3xl:  44px;

  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;
  --fw-extrabold:800;

  --lh-tight:  1.15;
  --lh-snug:   1.3;
  --lh-base:   1.5;
  --lh-relaxed:1.65;

  /* Core Palette — "Clinical Warmth" */
  --navy:        #163356;   /* deep anchor */
  --navy-mid:    #1e4a7a;
  --teal:        #1b8fa8;   /* primary action */
  --teal-dark:   #156e85;
  --teal-xlight: #e4f5f9;
  --teal-light:  #c2eaf3;

  --amber:       #f0892a;   /* warm accent */
  --amber-soft:  #fef2e0;
  --amber-dark:  #c96f10;

  --sage:        #3aaa7e;   /* success */
  --sage-soft:   #e5f7ef;

  --coral:       #e84f4f;   /* error / record active */
  --coral-soft:  #feeaea;

  --gold:        #d4a629;   /* highlight / best */
  --gold-soft:   #fdf5dc;

  /* Neutrals */
  --white:       #ffffff;
  --bg:          #f3f7fc;
  --bg-alt:      #eaf1f9;
  --surface:     #ffffff;
  --surface-muted: #f7fafd;
  --border:      #c2d4e8;
  --border-strong:#96b4d0;

  --text:        #162033;
  --text-muted:  #4d6480;
  --text-soft:   #8499b0;
  --text-inverse:#ffffff;

  /* Dark-mode overlay (practice screens) */
  --dark-bg:        #0d1b2e;
  --dark-surface:   rgba(255,255,255,0.07);
  --dark-surface-hi:rgba(255,255,255,0.12);
  --dark-border:    rgba(255,255,255,0.16);
  --dark-text:      #eef4fb;
  --dark-muted:     rgba(238,244,251,0.55);
  --dark-soft:      rgba(238,244,251,0.3);

  /* Metric colours (charts) */
  --metric-clarity:    #27c2a5;
  --metric-loudness:   #f0892a;
  --metric-recognition:#4f86f7;
  --metric-rate:       #a47cf3;

  /* Radii */
  --r-xs:  6px;
  --r-sm:  10px;
  --r-md:  16px;
  --r-lg:  22px;
  --r-xl:  28px;
  --r-pill:999px;

  /* Shadows */
  --shadow-xs:  0 2px  6px rgba(14,30,55,0.06);
  --shadow-sm:  0 4px 12px rgba(14,30,55,0.08);
  --shadow-md:  0 8px 24px rgba(14,30,55,0.10);
  --shadow-lg:  0 16px 40px rgba(14,30,55,0.12);
  --shadow-btn: 0 6px 18px rgba(27,143,168,0.26);
  --shadow-btn-amber: 0 6px 18px rgba(240,137,42,0.28);

  /* Spacing scale */
  --s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:20px;
  --s6:24px; --s7:32px; --s8:40px; --s9:56px;

  /* Layout */
  --page-width:  460px;
  --dash-width: 1160px;
  --nav-height:  64px;

  /* Motion */
  --ease-out:   cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring:cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast:   150ms;
  --dur-base:   240ms;
  --dur-slow:   400ms;
}

/* ═══════════════════════════════════════
   2. RESET & BASE
   ═══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--lh-base);
  color: var(--text);
  background:
    radial-gradient(ellipse 900px 500px at 50% -80px, rgba(27,143,168,0.09), transparent 55%),
    linear-gradient(180deg, #f5f8fc 0%, var(--bg) 100%);
  -webkit-font-smoothing: antialiased;
  min-width: 320px;
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

/* ═══════════════════════════════════════
   3. TYPOGRAPHY
   ═══════════════════════════════════════ */
.display {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 800;
  line-height: var(--lh-tight);
  color: var(--navy);
  letter-spacing: -0.03em;
}

.page-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 800;
  line-height: var(--lh-tight);
  color: var(--navy);
  letter-spacing: -0.025em;
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.02em;
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.01em;
}

.eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.body-muted  { color: var(--text-muted); }
.small-text  { font-size: var(--text-sm); color: var(--text-muted); }
.text-center { text-align: center; }

/* ═══════════════════════════════════════
   4. PAGE LAYOUTS
   ═══════════════════════════════════════ */

/* Standard scrollable page (dashboard, settings) */
.page-light {
  min-height: 100vh;
  padding: var(--s5) var(--s5) calc(var(--nav-height) + var(--s7));
  background: inherit;
}

/* Centered card page (max 480px, mobile-app style) */
.page-app {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  padding: var(--s5) var(--s5) calc(var(--nav-height) + var(--s6));
}

/* Full-bleed immersive (practice screens — dark overlay) */
.page-immersive {
  position: relative;
  width: 100%;
  max-width: var(--page-width);
  height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: var(--s5) var(--s5) calc(var(--nav-height) + var(--s6));
  z-index: 1;
}

body.immersive {
  overflow: hidden;
  height: 100%;
  background: var(--dark-bg);
  color: var(--dark-text);
}

html.immersive { height: 100%; }

/* Content stacks */
.page-stack    { display: flex; flex-direction: column; gap: var(--s5); }
.section-stack { display: flex; flex-direction: column; gap: var(--s4); }

/* Wide layout for dashboard */
.page-wide {
  max-width: var(--dash-width);
  margin: 0 auto;
  padding: var(--s5) var(--s5) calc(var(--nav-height) + var(--s7));
}

/* ═══════════════════════════════════════
   5. AMBIENT BACKGROUND (immersive pages)
   ═══════════════════════════════════════ */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0;
  animation: orbDrift 24s ease-in-out infinite;
}

body.immersive .orb { opacity: 0.22; }

.orb-teal   { width: 380px; height: 380px; background: var(--teal);  top: -140px; right: -130px; }
.orb-amber  { width: 280px; height: 280px; background: var(--amber); bottom: -90px; left: -90px; animation-delay: -9s; }
.orb-violet { width: 220px; height: 220px; background: #7c5ce8;       top: 42%; left: 38%; animation-delay: -17s; }

@keyframes orbDrift {
  0%,100% { transform: translate(0,0) scale(1); }
  33%     { transform: translate(38px,-28px) scale(1.08); }
  66%     { transform: translate(-26px,20px) scale(0.93); }
}

/* ═══════════════════════════════════════
   6. PAGE HEADER
   ═══════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s4);
  margin-bottom: var(--s5);
}

.page-header__content { display: flex; flex-direction: column; gap: var(--s2); }
.page-header__sub {
  font-size: var(--text-md);
  color: var(--text-muted);
  font-weight: var(--fw-medium);
}

/* Immersive header bar */
.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s3);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════
   7. APP BAR / SITE HEADER
   ═══════════════════════════════════════ */
.app-header {
  background: linear-gradient(135deg, var(--navy) 0%, #1d4e85 52%, #26709b 100%);
  color: var(--text-inverse);
  padding: var(--s5) var(--s6) var(--s4);
  text-align: center;
  box-shadow: 0 4px 20px rgba(22,51,86,0.22);
  position: relative;
  overflow: hidden;
}

/* Subtle radial highlight in top-right of header */
.app-header::after {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  pointer-events: none;
}

.app-header h1 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  position: relative;
}

/* ═══════════════════════════════════════
   8. CARDS
   ═══════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: 0 8px 24px rgba(18,40,78,0.08), 0 1px 3px rgba(18,40,78,0.05);
  padding: var(--s6);
}

.card--soft {
  background: var(--surface-muted);
  border-color: var(--border);
  box-shadow: none;
}

.card--highlight {
  border: 2px solid rgba(27,143,168,0.35);
  background: linear-gradient(160deg, #ffffff 0%, #f0f9fd 100%);
  box-shadow: 0 12px 32px rgba(22,51,86,0.10), 0 1px 3px rgba(18,40,78,0.05);
}

.card--accent {
  border: 2px solid rgba(240,137,42,0.35);
  background: linear-gradient(160deg, #fffcf7 0%, var(--amber-soft) 100%);
  box-shadow: 0 8px 24px rgba(240,137,42,0.08);
}

/* Dark surface variant (for immersive pages) */
.card--dark {
  background: var(--dark-surface);
  border: 1.5px solid var(--dark-border);
  color: var(--dark-text);
  box-shadow: none;
}

.card__header {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  margin-bottom: var(--s5);
}

.card__row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s3);
}

/* ═══════════════════════════════════════
   9. BUTTONS
   ═══════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 56px;
  padding: 0 var(--s6);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-size: var(--text-md);
  font-weight: var(--fw-bold);
  cursor: pointer;
  transition:
    background var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out),
    color var(--dur-base) var(--ease-out),
    transform var(--dur-fast),
    box-shadow var(--dur-base) var(--ease-out);
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0.01em;
}
.btn:active { transform: translateY(1px) scale(0.98); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; transform: none; }

/* Primary — teal */
.btn--primary {
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  color: #fff;
  box-shadow: var(--shadow-btn);
}
.btn--primary:hover:not(:disabled) { filter: brightness(1.06); }

/* Secondary */
.btn--secondary {
  background: var(--surface);
  color: var(--navy);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.btn--secondary:hover:not(:disabled) { background: var(--bg-alt); border-color: var(--border-strong); }

/* Accent — amber */
.btn--accent {
  background: linear-gradient(135deg, var(--amber) 0%, var(--amber-dark) 100%);
  color: #fff;
  box-shadow: var(--shadow-btn-amber);
}
.btn--accent:hover:not(:disabled) { filter: brightness(1.06); }

/* Ghost */
.btn--ghost {
  background: transparent;
  color: var(--teal);
  border-color: var(--teal-light);
}
.btn--ghost:hover:not(:disabled) { background: var(--teal-xlight); }

/* Danger */
.btn--danger {
  background: linear-gradient(135deg, var(--coral) 0%, #c83b3b 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(232,79,79,0.25);
}

/* Full width */
.btn--full { width: 100%; }

/* Large */
.btn--lg { min-height: 60px; font-size: var(--text-lg); padding: 0 var(--s7); }

/* Icon button */
.icon-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--navy);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background var(--dur-fast), transform var(--dur-fast);
}
.icon-btn:hover  { background: var(--bg-alt); }
.icon-btn:active { transform: scale(0.94); }

/* Side action button (practice screens) */
.btn-side {
  width: 68px; height: 68px;
  border-radius: var(--r-md);
  border: none;
  background: var(--dark-surface);
  color: var(--dark-muted);
  font-size: 24px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  cursor: pointer; flex-shrink: 0;
  transition: background var(--dur-fast), color var(--dur-fast), transform var(--dur-fast);
}
.btn-side:active { transform: scale(0.94); background: var(--dark-surface-hi); color: var(--dark-text); }
.btn-side__label { font-size: 10px; font-weight: var(--fw-bold); letter-spacing: 0.04em; }

/* Record button (immersive) */
.btn-record {
  flex: 1;
  min-height: 72px;
  border: none;
  border-radius: var(--r-xl);
  font-size: var(--text-md);
  font-weight: var(--fw-bold);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: var(--s3);
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  color: #fff;
  box-shadow: var(--shadow-btn);
  transition: background var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), transform var(--dur-fast);
  letter-spacing: 0.02em;
}
.btn-record .icon { font-size: 22px; }
.btn-record:active { transform: scale(0.97); }
.btn-record:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-record.recording {
  background: linear-gradient(135deg, var(--coral) 0%, #c83b3b 100%);
  box-shadow: 0 8px 32px rgba(232,79,79,0.4);
  animation: recordPulse 1.4s ease infinite;
}

@keyframes recordPulse {
  0%,100% { box-shadow: 0 8px 32px rgba(232,79,79,0.4); }
  50%     { box-shadow: 0 8px 48px rgba(232,79,79,0.65); }
}

/* Spin / game button */
.btn-spin {
  flex: 1; min-height: 72px;
  border: none; border-radius: var(--r-xl);
  background: linear-gradient(135deg, var(--amber) 0%, var(--amber-dark) 100%);
  color: #fff;
  font-size: var(--text-md); font-weight: var(--fw-bold);
  display: flex; align-items: center; justify-content: center; gap: var(--s3);
  cursor: pointer;
  box-shadow: var(--shadow-btn-amber);
  transition: box-shadow var(--dur-base), transform var(--dur-fast);
  letter-spacing: 0.02em;
}
.btn-spin:active { transform: scale(0.97); }
.btn-spin:disabled { opacity: 0.4; }
.btn-spin.spinning { animation: spinPulse 0.9s ease infinite; }
@keyframes spinPulse {
  0%,100% { box-shadow: var(--shadow-btn-amber); }
  50%     { box-shadow: 0 8px 32px rgba(240,137,42,0.55); }
}

/* ═══════════════════════════════════════
   10. TABS
   ═══════════════════════════════════════ */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  background: var(--surface-muted);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  overflow: hidden;
  margin-bottom: var(--s6);
}

.tab-btn {
  flex: 1;
  padding: var(--s4) var(--s5);
  border: none;
  background: transparent;
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}
.tab-btn:hover:not(.active) { background: var(--bg-alt); }
.tab-btn.active {
  background: var(--white);
  color: var(--teal);
  border-bottom-color: var(--teal);
  font-weight: var(--fw-bold);
}

/* ═══════════════════════════════════════
   11. BADGES / CHIPS / PILLS
   ═══════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  white-space: nowrap;
}

.badge--teal   { background: var(--teal-xlight); border-color: var(--teal-light); color: var(--teal-dark); }
.badge--amber  { background: var(--amber-soft);  border-color: rgba(240,137,42,0.22); color: var(--amber-dark); }
.badge--sage   { background: var(--sage-soft);   border-color: rgba(58,170,126,0.22); color: #1e7d59; }
.badge--coral  { background: var(--coral-soft);  border-color: rgba(232,79,79,0.22);  color: #b83232; }
.badge--gold   { background: var(--gold-soft);   border-color: rgba(212,166,41,0.3);  color: #9a7210; }
.badge--navy   { background: var(--navy); color: #fff; border-color: transparent; }

.badge--dark   { background: var(--dark-surface); border-color: var(--dark-border); color: var(--dark-text); }

/* Pilot badge */
.pilot-badge {
  display: inline-flex; align-items: center; gap: var(--s2);
  padding: 5px 14px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, rgba(27,143,168,0.18), rgba(240,137,42,0.14));
  border: 1px solid rgba(27,143,168,0.28);
  font-size: 11px; font-weight: var(--fw-bold);
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--teal-dark);
}
body.immersive .pilot-badge { color: var(--teal-light); background: rgba(27,143,168,0.15); }

/* Score chips */
.score-chip {
  display: flex; flex-direction: column; align-items: center;
  padding: var(--s2) var(--s4);
  border-radius: var(--r-md);
  background: var(--dark-surface);
  border: 1px solid var(--dark-border);
}
.score-chip__label { font-size: 10px; font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: 0.1em; color: var(--dark-muted); }
.score-chip__value { font-size: 24px; font-weight: var(--fw-extrabold); color: var(--sage); line-height: 1.1; }
.score-chip__value.needs-work { color: var(--amber); }

/* Best score indicator */
.best-score {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s2) var(--s3);
  background: rgba(58,170,126,0.15);
  border: 2px solid var(--sage);
  border-radius: var(--r-md);
  font-size: var(--text-sm); font-weight: var(--fw-bold); color: var(--sage);
}

/* ═══════════════════════════════════════
   12. PROGRESS DOTS
   ═══════════════════════════════════════ */
.progress-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-shrink: 0;
  margin-bottom: var(--s5);
}

.dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--dark-surface);
  border: 1px solid var(--dark-border);
  transition: background var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-spring);
}
.dot.completed { background: var(--sage); border-color: var(--sage); box-shadow: 0 0 10px rgba(58,170,126,0.45); }
.dot.active    { background: var(--teal); border-color: var(--teal); box-shadow: 0 0 14px rgba(27,143,168,0.5); transform: scale(1.45); }

/* Light-mode dots (e.g. settings page) */
.progress-dots--light .dot { background: var(--bg-alt); border-color: var(--border); }
.progress-dots--light .dot.completed { background: var(--sage); }
.progress-dots--light .dot.active    { background: var(--teal); }

/* ═══════════════════════════════════════
   13. VOICE VISUALIZATION
   ═══════════════════════════════════════ */
.voice-visual {
  flex-shrink: 0;
  height: 96px;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  margin-bottom: var(--s4);
}

.voice-bar {
  width: 7px;
  height: 18px;
  background: linear-gradient(180deg, var(--teal) 0%, var(--teal-dark) 100%);
  border-radius: var(--r-pill);
}

.voice-visual:not(.idle):not(.recording) .voice-bar {
  animation: voicePulse 1.3s ease-in-out infinite;
}
.voice-visual.recording .voice-bar { animation: voicePulse 0.42s ease-in-out infinite; }
.voice-visual.idle .voice-bar      { animation: none; height: 18px; opacity: 0.28; }

.voice-bar:nth-child(1) { animation-delay: 0s; }
.voice-bar:nth-child(2) { animation-delay: 0.1s; }
.voice-bar:nth-child(3) { animation-delay: 0.2s; }
.voice-bar:nth-child(4) { animation-delay: 0.3s; }
.voice-bar:nth-child(5) { animation-delay: 0.4s; }
.voice-bar:nth-child(6) { animation-delay: 0.3s; }
.voice-bar:nth-child(7) { animation-delay: 0.2s; }
.voice-bar:nth-child(8) { animation-delay: 0.1s; }
.voice-bar:nth-child(9) { animation-delay: 0s; }

@keyframes voicePulse {
  0%,100% { height: 18px; opacity: 0.35; }
  50%     { height: 58px; opacity: 1; }
}

/* ═══════════════════════════════════════
   14. PROMPT DISPLAY (practice screens)
   ═══════════════════════════════════════ */
.prompt-container {
  flex: 1;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  text-align: center;
  padding: 0 var(--s3);
}

.prompt-text {
  font-family: var(--font-display);
  font-size: clamp(22px, 5.5vw, 34px);
  line-height: var(--lh-snug);
  font-weight: 700;
  color: var(--dark-text);
  max-width: 100%;
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
.prompt-text.exiting  { opacity: 0; transform: translateY(-24px); }
.prompt-text.entering { opacity: 0; transform: translateY(24px); }

.prompt-hint {
  margin-top: var(--s5);
  font-size: var(--text-sm);
  color: var(--dark-muted);
  font-weight: var(--fw-medium);
}
.prompt-hint .accent { color: var(--teal-light); font-weight: var(--fw-semibold); }

/* Loading state */
.loading-dots {
  display: flex; gap: var(--s2); align-items: center;
  margin-bottom: var(--s3);
}
.loading-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--teal);
  animation: ldPulse 1.3s ease infinite;
}
.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes ldPulse {
  0%,100% { opacity: 0.3; transform: scale(0.7); }
  50%     { opacity: 1;   transform: scale(1.1); }
}

/* ═══════════════════════════════════════
   15. SCENARIO DISPLAY (conversation game)
   ═══════════════════════════════════════ */
.scenario-sentence {
  font-family: var(--font-display);
  font-size: clamp(24px, 5.5vw, 34px);
  line-height: 1.6;
  font-weight: 700;
  display: flex; flex-direction: column;
  justify-content: center;
  gap: var(--s2);
  text-align: center;
  color: var(--dark-text);
}

.highlight-person { color: #ffb07a; font-style: italic; }
.highlight-place  { color: #7dd3e8; font-style: italic; }
.highlight-topic  { color: #7de8b8; font-style: italic; }

/* Try saying hint */
.example-hint {
  margin-top: var(--s6);
  padding: var(--s4) var(--s5);
  background: var(--dark-surface);
  border-radius: var(--r-md);
  border-left: 3px solid var(--amber);
  text-align: left;
  opacity: 0; transform: translateY(10px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
.example-hint.visible { opacity: 1; transform: translateY(0); }
.example-hint__label {
  font-size: 11px; font-weight: var(--fw-bold);
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--amber); margin-bottom: var(--s2);
}
.example-hint__text {
  font-size: var(--text-base); color: var(--dark-muted); font-style: italic;
}

/* Spin slots */
.spin-slots { display: flex; gap: var(--s4); justify-content: center; }
.spin-slot {
  width: 92px; height: 80px;
  background: var(--dark-surface-hi);
  border-radius: var(--r-md);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  overflow: hidden;
}
.spin-slot__label { font-size: 10px; font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: 0.1em; color: var(--dark-muted); margin-bottom: 4px; }
.spin-slot__value { font-size: 15px; font-weight: var(--fw-bold); animation: slotSpin 0.1s linear infinite; }
.spin-slot__value:nth-child(1) { color: #ffb07a; }
.spin-slot__value:nth-child(2) { color: #7dd3e8; }
.spin-slot__value:nth-child(3) { color: #7de8b8; }
@keyframes slotSpin {
  0%   { transform: translateY(-100%); opacity: 0; }
  50%  { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(100%); opacity: 0; }
}
.spin-slot.stopped .spin-slot__value { animation: none; transform: translateY(0); opacity: 1; }

/* ═══════════════════════════════════════
   16. OVERLAYS (results, processing, success)
   ═══════════════════════════════════════ */

/* Processing */
.overlay-processing {
  position: fixed; inset: 0;
  background: rgba(13,27,46,0.95);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: var(--s6);
  z-index: 250;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out);
}
.overlay-processing.visible { opacity: 1; pointer-events: auto; }

.spinner {
  width: 52px; height: 52px;
  border: 4px solid var(--dark-surface-hi);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.spinner-text { font-size: var(--text-base); color: var(--dark-muted); font-weight: var(--fw-medium); }

/* Results overlay (conversation game) */
.overlay-results {
  position: fixed; inset: 0;
  background: rgba(13,27,46,0.96);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 200;
  padding: var(--s6);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out);
}
.overlay-results.visible { opacity: 1; pointer-events: auto; }

.result-circle {
  width: 176px; height: 176px;
  border-radius: 50%;
  background: conic-gradient(var(--sage) calc(var(--score,0) * 1%), var(--dark-surface) calc(var(--score,0) * 1%));
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--s6);
  position: relative;
}
.result-circle::before {
  content: '';
  position: absolute; inset: 12px;
  background: var(--dark-bg); border-radius: 50%;
}
.result-circle__inner {
  position: relative; z-index: 1; text-align: center;
}
.result-circle__value {
  font-family: var(--font-display);
  font-size: 52px; line-height: 1;
  font-weight: 800;
  color: var(--dark-text);
}
.result-circle__label { font-size: 12px; color: var(--dark-muted); text-transform: uppercase; letter-spacing: 0.08em; }

.result-feedback { font-size: var(--text-xl); font-weight: var(--fw-semibold); text-align: center; margin-bottom: var(--s6); color: var(--dark-text); }
.result-feedback__emoji { font-size: 36px; display: block; margin-bottom: var(--s3); }

.result-metrics { display: flex; gap: var(--s7); margin-bottom: var(--s6); }
.result-metric { text-align: center; }
.result-metric__value {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 700;
  color: var(--dark-text);
}
.result-metric__value.good   { color: var(--sage); }
.result-metric__value.ok     { color: var(--amber); }
.result-metric__value.low    { color: var(--coral); }
.result-metric__label { font-size: 11px; color: var(--dark-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 3px; }
.result-metric__delta { font-size: 12px; font-weight: var(--fw-bold); margin-top: 3px; }
.result-metric__delta.up   { color: var(--sage); }
.result-metric__delta.down { color: var(--coral); }
.result-metric__delta.same { color: var(--dark-muted); }

.result-actions { display: flex; gap: var(--s3); width: 100%; max-width: 320px; }
.btn-result {
  flex: 1; padding: 17px var(--s5);
  border: none; border-radius: var(--r-lg);
  font-size: var(--text-base); font-weight: var(--fw-bold);
  cursor: pointer; transition: transform var(--dur-fast), filter var(--dur-fast);
}
.btn-result:active { transform: scale(0.97); }
.btn-result--secondary { background: var(--dark-surface-hi); color: var(--dark-text); }
.btn-result--primary   { background: var(--amber); color: #fff; }

/* Success overlay (practice complete) */
.overlay-success {
  position: fixed; inset: 0;
  background: rgba(13,27,46,0.94);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 100;
  padding: var(--s6);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out);
}
.overlay-success.visible { opacity: 1; pointer-events: auto; }
.overlay-success__icon { font-size: 68px; margin-bottom: var(--s5); animation: bounceIn 0.5s var(--ease-spring); }
@keyframes bounceIn {
  0% { transform: scale(0); }
  60%{ transform: scale(1.18); }
  100%{ transform: scale(1); }
}
.overlay-success__message {
  font-family: var(--font-display);
  font-size: var(--text-2xl); font-weight: 800; color: var(--dark-text); margin-bottom: var(--s2);
}
.overlay-success__sub { font-size: var(--text-base); color: var(--dark-muted); margin-bottom: var(--s6); text-align: center; }

.stats-row { display: flex; gap: var(--s7); margin-bottom: var(--s7); }
.stat-item { text-align: center; }
.stat-item__value { font-family: var(--font-display); font-size: 30px; font-weight: 800; color: var(--dark-text); }
.stat-item__value.good { color: var(--sage); }
.stat-item__value.ok   { color: var(--amber); }
.stat-item__value.low  { color: var(--coral); }
.stat-item__label { font-size: 11px; color: var(--dark-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 3px; }

.btn-continue {
  padding: 16px 48px; border: none; border-radius: var(--r-pill);
  background: var(--sage); color: #fff;
  font-size: var(--text-md); font-weight: var(--fw-bold);
  cursor: pointer; transition: filter var(--dur-fast), transform var(--dur-fast);
}
.btn-continue:active { transform: scale(0.97); filter: brightness(0.95); }

/* ═══════════════════════════════════════
   17. MODAL (slide-up sheet)
   ═══════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.72);
  display: flex; flex-direction: column; justify-content: flex-end;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out);
}
.modal-overlay.visible { opacity: 1; pointer-events: auto; }

.modal-sheet {
  background: var(--dark-bg);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: var(--s5) var(--s5) 40px;
  max-height: 88vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform var(--dur-slow) var(--ease-out);
}
.modal-overlay.visible .modal-sheet { transform: translateY(0); }

/* Light sheet variant (for dashboard modals) */
.modal-sheet--light {
  background: var(--white);
  color: var(--text);
  border-top: 1px solid var(--border);
}

.modal-handle {
  width: 38px; height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.2);
  margin: 0 auto var(--s5);
}
.modal-sheet--light .modal-handle { background: var(--border); }

.modal-header {
  display: flex;
  justify-content: space-between; align-items: center;
  margin-bottom: var(--s5);
}
.modal-title { font-size: var(--text-xl); font-weight: var(--fw-bold); color: var(--dark-text); }
.modal-sheet--light .modal-title { color: var(--navy); }

.modal-close {
  width: 40px; height: 40px;
  border: none; border-radius: 50%;
  background: var(--dark-surface);
  color: var(--dark-text);
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast);
}
.modal-close:hover { background: var(--dark-surface-hi); }
.modal-sheet--light .modal-close { background: var(--bg-alt); color: var(--text-muted); }

/* Instructions modal */
.instruction-steps { display: flex; flex-direction: column; gap: var(--s4); }
.instruction-step {
  display: flex; gap: var(--s4); align-items: flex-start;
  padding: var(--s4) var(--s4);
  background: var(--dark-surface);
  border-radius: var(--r-md);
}
.step-number {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  background: var(--teal); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-sm); font-weight: var(--fw-bold);
  flex-shrink: 0;
}
.step-text { font-size: var(--text-sm); line-height: var(--lh-relaxed); color: var(--dark-muted); }
.step-text strong { color: var(--dark-text); }

/* ═══════════════════════════════════════
   18. FORMS (event modal)
   ═══════════════════════════════════════ */
.form-row { margin-bottom: var(--s4); }
.form-row label {
  display: block;
  font-size: 11px; font-weight: var(--fw-bold);
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--dark-muted); margin-bottom: var(--s2);
}
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 12px var(--s4);
  border-radius: var(--r-md);
  border: 1px solid var(--dark-border);
  background: var(--dark-surface);
  color: var(--dark-text);
  font-size: var(--text-base);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(27,143,168,0.2);
}
.form-row textarea { resize: none; height: 72px; }
.form-row select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  color-scheme: dark;
}
.form-row input[type="date"] { color-scheme: dark; }
.form-row input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }
.form-row select option { background: #1a2a40; color: var(--dark-text); }
.form-row-double { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }

.form-divider {
  display: flex; align-items: center; gap: var(--s3);
  margin: var(--s5) 0 var(--s4);
  font-size: 11px; font-weight: var(--fw-bold);
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--dark-muted);
}
.form-divider::before, .form-divider::after { content: ''; flex: 1; height: 1px; background: var(--dark-border); }

/* ═══════════════════════════════════════
   19. EVENT CARDS (event practice)
   ═══════════════════════════════════════ */
.event-card {
  background: linear-gradient(135deg, var(--dark-surface-hi), var(--dark-surface));
  border: 1px solid var(--dark-border);
  border-left: 3px solid var(--amber);
  border-radius: var(--r-lg);
  padding: var(--s4) var(--s5);
  margin-bottom: var(--s4);
}
.event-card__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s2); }
.event-card__title { font-size: var(--text-md); font-weight: var(--fw-bold); color: var(--amber); }
.event-card__date  { font-size: 12px; color: var(--teal-light); font-weight: var(--fw-semibold); }
.event-card__detail { font-size: var(--text-sm); color: var(--dark-muted); }
.event-card__detail span { color: var(--dark-text); font-weight: var(--fw-medium); }

.event-list-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--s3) var(--s4); margin-bottom: var(--s2);
  background: var(--dark-surface);
  border-radius: var(--r-md);
  border-left: 3px solid var(--teal);
}
.event-list-item__info { flex: 1; }
.event-list-item__title { font-size: var(--text-base); font-weight: var(--fw-semibold); color: var(--dark-text); margin-bottom: 2px; }
.event-list-item__meta { font-size: 12px; color: var(--dark-muted); }
.event-list-item__meta .days { color: var(--amber); font-weight: var(--fw-semibold); }

.btn-event-delete {
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: rgba(232,79,79,0.14); color: var(--coral);
  font-size: 15px; cursor: pointer; margin-left: var(--s3); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast);
}
.btn-event-delete:hover { background: rgba(232,79,79,0.25); }

.no-events-card {
  text-align: center; padding: var(--s7) var(--s5);
  background: var(--dark-surface);
  border-radius: var(--r-lg);
  margin-bottom: var(--s4);
}
.no-events-card__icon { font-size: 38px; margin-bottom: var(--s3); }
.no-events-card p { color: var(--dark-muted); font-size: var(--text-sm); line-height: var(--lh-relaxed); margin-bottom: var(--s5); }

/* ═══════════════════════════════════════
   20. DASHBOARD CHARTS
   ═══════════════════════════════════════ */
.chart-container {
  background: var(--white);
  padding: var(--s6);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--s6);
  border: 1px solid var(--border);
}

.chart-header {
  display: flex;
  justify-content: space-between; align-items: center;
  margin-bottom: var(--s5);
  padding-bottom: var(--s4);
  border-bottom: 1px solid var(--border);
}

.chart-title { font-size: var(--text-lg); font-weight: var(--fw-bold); color: var(--navy); margin: 0; }

.range-selector { display: flex; align-items: center; gap: var(--s3); }
.range-selector select {
  padding: 8px 12px; border: 2px solid var(--border);
  border-radius: var(--r-sm); font-size: var(--text-sm); font-weight: var(--fw-semibold);
  background: var(--white); color: var(--text-muted);
  transition: border-color var(--dur-fast);
}
.range-selector select:focus { outline: none; border-color: var(--teal); }

.charts-grid { display: grid; grid-template-columns: 1fr; gap: var(--s6); }

/* Trend legend */
.trend-legend {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--s3); margin: var(--s5) 0;
  padding: var(--s5); background: var(--surface-muted);
  border-radius: var(--r-lg); border: 1px solid var(--border);
}
.legend-item {
  display: flex; align-items: center; gap: var(--s3);
  font-size: var(--text-sm); font-weight: var(--fw-medium);
  padding: var(--s2) var(--s3);
  background: var(--white); border-radius: var(--r-sm);
}
.trend-arrow { font-size: 22px; font-weight: bold; }
.increasing { color: var(--sage); }
.decreasing { color: var(--coral); }
.stable     { color: var(--teal); }

/* Sequences */
.sequence-box {
  background: linear-gradient(135deg, var(--teal-xlight), var(--bg-alt));
  padding: var(--s5); border-radius: var(--r-lg);
  margin-bottom: var(--s6); border-left: 4px solid var(--teal);
  box-shadow: var(--shadow-xs);
}
.sequence-list { list-style: none; }
.sequence-item {
  background: var(--white); border-radius: var(--r-md);
  padding: var(--s5); margin-bottom: var(--s4);
  box-shadow: var(--shadow-xs); border: 1px solid var(--border);
  transition: transform var(--dur-fast), box-shadow var(--dur-fast);
}
.sequence-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.sequence-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--s3); padding-bottom: var(--s3); border-bottom: 1px solid var(--border);
}
.sequence-title { font-size: var(--text-lg); font-weight: var(--fw-bold); color: var(--navy); margin: 0; }
.sequence-version {
  background: var(--bg-alt); color: var(--text-muted);
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: var(--fw-bold);
}
.sequence-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--s4); margin-top: var(--s4); }
.stat-box { text-align: center; padding: var(--s3); background: var(--surface-muted); border-radius: var(--r-sm); }
.stat-box__value { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--navy); display: block; }
.stat-box__label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Weekly summary */
.summary-section {
  background: var(--white); padding: var(--s6); border-radius: var(--r-lg);
  margin-top: var(--s6); box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.summary-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--s5); padding-bottom: var(--s4); border-bottom: 1px solid var(--border);
}
.summary-title { font-size: var(--text-xl); font-weight: var(--fw-bold); color: var(--navy); margin: 0; }
.summary-date { font-size: var(--text-sm); color: var(--text-muted); background: var(--surface-muted); padding: 6px 12px; border-radius: var(--r-sm); }

/* Speech summary (AI generated) */
.speech-summary { font-family: var(--font-body); line-height: var(--lh-relaxed); color: var(--text-muted); }
.speech-summary h2 { font-family: var(--font-display); font-size: var(--text-lg); color: var(--navy); margin-top: var(--s6); margin-bottom: var(--s3); padding-bottom: var(--s2); border-bottom: 2px solid var(--border); font-weight: 700; }
.speech-summary h2:first-child { margin-top: 0; color: var(--sage); }
.speech-summary h3 { font-size: var(--text-base); font-weight: var(--fw-bold); color: var(--navy); margin-top: var(--s5); margin-bottom: var(--s3); }
.speech-summary ul { margin: var(--s3) 0; padding-left: var(--s5); }
.speech-summary li { margin-bottom: var(--s2); }
.speech-summary p  { margin: var(--s3) 0; }
.speech-summary strong { color: var(--teal-dark); font-weight: var(--fw-semibold); }

/* No data */
.no-data {
  text-align: center; padding: var(--s9) var(--s5);
  color: var(--text-muted); background: var(--surface-muted);
  border-radius: var(--r-lg); margin: var(--s5) 0;
}
.no-data h3 { font-size: var(--text-lg); font-weight: var(--fw-bold); color: var(--navy); margin-bottom: var(--s3); }
.no-data p  { margin-bottom: var(--s5); line-height: var(--lh-relaxed); }

/* Refresh / try button */
.btn-refresh {
  background: var(--teal); color: #fff;
  border: none; padding: 10px var(--s5);
  border-radius: var(--r-sm); font-size: var(--text-sm);
  font-weight: var(--fw-semibold); cursor: pointer; margin: var(--s2);
  display: inline-flex; align-items: center; gap: var(--s2);
  transition: filter var(--dur-fast);
}
.btn-refresh:hover { filter: brightness(1.08); }

/* Audio player */
.audio-player {
  position: fixed; bottom: calc(var(--nav-height) + 12px); right: var(--s5);
  width: 310px; background: var(--white); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: var(--s5);
  z-index: 1000; border: 1px solid var(--border);
  display: none; animation: slideUp 0.28s var(--ease-out);
}
.audio-player.show { display: block; }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.audio-player__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s4); }
.audio-player__title { font-weight: var(--fw-bold); color: var(--navy); }
.btn-close-player {
  border: none; background: none; font-size: 18px; cursor: pointer;
  color: var(--text-muted); width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast);
}
.btn-close-player:hover { background: var(--bg-alt); color: var(--coral); }
.audio-player audio { width: 100%; margin-bottom: var(--s3); }
.audio-player__info { font-size: 12px; color: var(--text-muted); line-height: var(--lh-relaxed); }

/* ═══════════════════════════════════════
   21. TIMER DISPLAY
   ═══════════════════════════════════════ */
.timer-display {
  position: fixed; top: var(--s5); left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.88);
  padding: 10px var(--s6); border-radius: var(--r-pill);
  font-size: 26px; font-weight: var(--fw-extrabold);
  font-variant-numeric: tabular-nums;
  color: var(--dark-text);
  border: 2px solid var(--coral);
  display: none; z-index: 100;
  animation: timerIn 0.3s var(--ease-spring);
}
.timer-display.show { display: block; }
@keyframes timerIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ═══════════════════════════════════════
   22. TOAST
   ═══════════════════════════════════════ */
.toast {
  position: fixed; top: calc(var(--nav-height) + var(--s4));
  left: 50%; transform: translateX(-50%) translateY(-16px);
  background: linear-gradient(135deg, var(--amber) 0%, var(--amber-dark) 100%);
  color: #fff; padding: 12px var(--s6); border-radius: var(--r-pill);
  font-size: var(--text-base); font-weight: var(--fw-bold);
  display: flex; align-items: center; gap: var(--s3);
  pointer-events: none; opacity: 0; z-index: 150;
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
  box-shadow: var(--shadow-md);
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Celebration burst */
.celebration {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  font-size: 80px;
  animation: celebrate 0.9s var(--ease-spring) forwards;
  pointer-events: none; z-index: 500;
}
@keyframes celebrate {
  0%  { transform: translate(-50%,-50%) scale(0); opacity: 1; }
  50% { transform: translate(-50%,-50%) scale(1.5); }
  100%{ transform: translate(-50%,-50%) scale(1.1); opacity: 0; }
}

/* ═══════════════════════════════════════
   23. TOPIC / LEVEL SELECTORS
   ═══════════════════════════════════════ */
.selector-panel {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; justify-content: flex-end;
  background: rgba(0,0,0,0.6);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out);
}
.selector-panel.visible { opacity: 1; pointer-events: auto; }

.selector-content {
  background: var(--dark-bg);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: var(--s6) var(--s5) 44px;
  transform: translateY(100%);
  transition: transform var(--dur-slow) var(--ease-out);
  max-height: 72vh; overflow-y: auto;
}
.selector-panel.visible .selector-content { transform: translateY(0); }

.selector-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--s6);
}
.selector-title { font-family: var(--font-display); font-size: var(--text-xl); color: var(--dark-text); font-weight: 700; }

.selector-option {
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s5); border-radius: var(--r-lg);
  background: var(--dark-surface); border: 2px solid transparent;
  margin-bottom: var(--s3); cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
}
.selector-option:active { transform: scale(0.98); }
.selector-option.selected { border-color: var(--teal); background: rgba(27,143,168,0.14); }

.option-icon {
  width: 48px; height: 48px; border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--teal), var(--navy));
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.option-info { flex: 1; }
.option-name { font-size: var(--text-md); font-weight: var(--fw-semibold); color: var(--dark-text); margin-bottom: 3px; }
.option-desc { font-size: var(--text-sm); color: var(--dark-muted); }

.profile-link {
  display: block; text-align: center; margin-top: var(--s5);
  padding: var(--s3) var(--s5); background: rgba(27,143,168,0.1);
  border: 1px dashed rgba(27,143,168,0.3); border-radius: var(--r-md);
  color: var(--teal-light); font-size: var(--text-sm); font-weight: var(--fw-medium);
  transition: background var(--dur-fast);
}
.profile-link:hover { background: rgba(27,143,168,0.18); }

/* ═══════════════════════════════════════
   24. BOTTOM NAV
   ═══════════════════════════════════════ */
.bottom-nav {
  position: fixed; left: 50%; bottom: 0;
  transform: translateX(-50%);
  width: 100%; max-width: var(--page-width);
  background: rgba(13,27,46,0.96);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--s2); z-index: 50;
}

/* Light nav variant (full-width pages) */
.bottom-nav--light {
  max-width: 100%;
  background: rgba(255,255,255,0.97);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(14,30,55,0.08);
}

.nav-item {
  min-height: 52px;
  border-radius: var(--r-md);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: var(--fw-bold); letter-spacing: 0.02em;
  color: rgba(238,244,251,0.45);
  cursor: pointer; text-decoration: none;
  transition: color var(--dur-fast), background var(--dur-fast), transform var(--dur-fast);
  -webkit-tap-highlight-color: transparent;
}
.nav-item:active { transform: scale(0.93); }
.nav-item.active {
  background: rgba(27,143,168,0.18);
  color: var(--teal-light);
}
.nav-item svg { margin-bottom: 1px; }

.bottom-nav--light .nav-item { color: var(--text-muted); }
.bottom-nav--light .nav-item.active { background: var(--teal-xlight); color: var(--teal-dark); }

/* Wider nav for dash (all pages except practice) */
.bottom-nav--wide {
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-top: 1px solid rgba(194,212,232,0.9);
  box-shadow: 0 -8px 24px rgba(18,40,78,0.08);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  transform: none;
  left: 0;
}
.bottom-nav--wide .nav-item {
  color: var(--text-soft);
  min-height: 58px;
  border-radius: var(--r-md);
}
.bottom-nav--wide .nav-item.active {
  background: linear-gradient(180deg, var(--teal-xlight) 0%, #daf0f7 100%);
  color: var(--teal-dark);
  box-shadow: inset 0 0 0 1px rgba(27,143,168,0.15);
}
.bottom-nav--wide .nav-item:hover { color: var(--navy); background: var(--bg-alt); }

/* ═══════════════════════════════════════
   25. DASHBOARD WELCOME MODAL
   ═══════════════════════════════════════ */
.modal-dialog {
  display: none; position: fixed; z-index: 1000;
  inset: 0; background: rgba(0,0,0,0.5);
  justify-content: center; align-items: center;
}
.modal-dialog.open { display: flex; }
.modal-dialog__content {
  background: var(--white); padding: var(--s7);
  border-radius: var(--r-xl); width: 90%; max-width: 500px;
  text-align: center; box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s var(--ease-out);
}
.modal-dialog__content h2 { font-family: var(--font-display); color: var(--navy); margin-bottom: var(--s5); font-weight: 800; }
.modal-dialog__close {
  float: right; color: var(--text-muted); font-size: 24px; font-weight: bold;
  cursor: pointer; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: none; background: none;
}
.modal-dialog__close:hover { background: var(--bg-alt); }

/* ═══════════════════════════════════════
   26. LOADING / SPINNER
   ═══════════════════════════════════════ */
.loading-indicator {
  display: flex; align-items: center; gap: var(--s2);
  color: var(--text-muted); font-size: var(--text-sm);
}
.loading-indicator .spinner-sm {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

/* ═══════════════════════════════════════
   27. UTILITIES
   ═══════════════════════════════════════ */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.hidden  { display: none !important; }
.flex    { display: flex; }
.flex-col{ display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--s2); }
.gap-3 { gap: var(--s3); }
.gap-4 { gap: var(--s4); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.text-good   { color: var(--sage); }
.text-ok     { color: var(--amber); }
.text-low    { color: var(--coral); }
.text-teal   { color: var(--teal); }
.text-navy   { color: var(--navy); }
.text-muted  { color: var(--text-muted); }
.text-inverse{ color: var(--text-inverse); }

/* ═══════════════════════════════════════
   28. RESPONSIVE
   ═══════════════════════════════════════ */
@media (max-width: 420px) {
  .page-app, .page-immersive { padding-left: var(--s4); padding-right: var(--s4); }
  .prompt-text { font-size: 22px; }
  .scenario-sentence { font-size: 20px; }
  .spin-slots { gap: var(--s3); }
  .spin-slot  { width: 78px; }
  .result-circle { width: 148px; height: 148px; }
  .result-circle__value { font-size: 44px; }
  .tabs { flex-direction: column; }
  .charts-grid { grid-template-columns: 1fr; }
  .sequence-stats { grid-template-columns: repeat(2, 1fr); }
  .audio-player { right: var(--s3); left: var(--s3); width: auto; }
}

@media (min-width: 640px) {
  .charts-grid { grid-template-columns: 1fr 1fr; }
}

/* ═══════════════════════════════════════
   29. ACCESSIBILITY & FOCUS
   ═══════════════════════════════════════ */
:focus-visible {
  outline: 4px solid rgba(27,143,168,0.55);
  outline-offset: 3px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.1s !important;
    scroll-behavior: auto !important;
  }
}

/* ═══════════════════════════════════════
   30. USER DARK MODE  (data-theme="dark")
   Applied to dashboard + settings pages only.
   Practice screens are always dark via .immersive.
   Toggled by theme-init.js reading localStorage.
   ═══════════════════════════════════════ */
[data-theme="dark"] {
  /* Swap surface & background neutrals */
  --white:         #1a2535;
  --bg:            #0f1923;
  --bg-alt:        #162030;
  --surface:       #1a2535;
  --surface-muted: #162030;
  --border:        #253347;
  --border-strong: #2e4260;

  /* Swap text */
  --text:          #e8f1fb;
  --text-muted:    #7e9ab8;
  --text-soft:     #4d6d8f;
  --text-inverse:  #0f1923;

  /* Teal adjustments — slightly brighter on dark */
  --teal:          #22a8c5;
  --teal-dark:     #1b8fa8;
  --teal-xlight:   #0d2a35;
  --teal-light:    #113344;

  /* Amber stays warm but softened */
  --amber-soft:    #2a1e0a;

  /* Sage stays legible */
  --sage-soft:     #0d261c;

  /* Coral soft */
  --coral-soft:    #281010;

  /* Gold soft */
  --gold-soft:     #251e06;

  /* Shadows — deeper on dark */
  --shadow-xs:  0 2px  6px rgba(0,0,0,0.30);
  --shadow-sm:  0 4px 12px rgba(0,0,0,0.35);
  --shadow-md:  0 8px 24px rgba(0,0,0,0.40);
  --shadow-lg:  0 16px 40px rgba(0,0,0,0.45);
}

/* Body background */
[data-theme="dark"] body {
  background:
    radial-gradient(ellipse 900px 500px at 50% -80px, rgba(27,143,168,0.07), transparent 55%),
    linear-gradient(180deg, #111d2e 0%, var(--bg) 100%);
  color: var(--text);
}

/* App header */
[data-theme="dark"] .app-header {
  background: linear-gradient(135deg, #0d1f36 0%, #0a1828 100%);
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

/* Cards */
[data-theme="dark"] .card {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="dark"] .card--highlight {
  background: linear-gradient(160deg, #1a2535 0%, #0d2232 100%);
  border-color: rgba(34,168,197,0.25);
}
[data-theme="dark"] .card--soft {
  background: var(--surface-muted);
}

/* Tabs */
[data-theme="dark"] .tabs {
  background: var(--surface-muted);
  border-bottom-color: var(--border);
}
[data-theme="dark"] .tab-btn {
  color: var(--text-muted);
}
[data-theme="dark"] .tab-btn.active {
  background: var(--surface);
  color: var(--teal);
  border-bottom-color: var(--teal);
}

/* Buttons — secondary adjusts, primary stays */
[data-theme="dark"] .btn--secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
[data-theme="dark"] .btn--secondary:hover:not(:disabled) {
  background: var(--bg-alt);
  border-color: var(--border-strong);
}
[data-theme="dark"] .btn--ghost {
  border-color: var(--teal-light);
  color: var(--teal);
}
[data-theme="dark"] .btn--ghost:hover:not(:disabled) {
  background: var(--teal-xlight);
}

/* Chart containers */
[data-theme="dark"] .chart-container {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="dark"] .chart-title { color: var(--text); }
[data-theme="dark"] .chart-header { border-bottom-color: var(--border); }
[data-theme="dark"] .range-selector select {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-muted);
  color-scheme: dark;
}

/* Trend legend */
[data-theme="dark"] .trend-legend {
  background: var(--surface-muted);
  border-color: var(--border);
}
[data-theme="dark"] .legend-item {
  background: var(--surface);
}

/* Sequences */
[data-theme="dark"] .sequence-box {
  background: linear-gradient(135deg, #0d2232, var(--bg-alt));
  border-left-color: var(--teal);
}
[data-theme="dark"] .sequence-item {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="dark"] .sequence-title { color: var(--text); }
[data-theme="dark"] .sequence-version {
  background: var(--bg-alt);
  color: var(--text-muted);
}
[data-theme="dark"] .stat-box {
  background: var(--surface-muted);
}
[data-theme="dark"] .stat-box__value { color: var(--text); }
[data-theme="dark"] .stat-box__label { color: var(--text-muted); }

/* Summary section */
[data-theme="dark"] .summary-section {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="dark"] .summary-header { border-bottom-color: var(--border); }
[data-theme="dark"] .summary-title  { color: var(--text); }
[data-theme="dark"] .summary-date   { background: var(--bg-alt); color: var(--text-muted); }
[data-theme="dark"] .speech-summary h2 { color: var(--text); border-bottom-color: var(--border); }
[data-theme="dark"] .speech-summary h3 { color: var(--text); }
[data-theme="dark"] .speech-summary strong { color: var(--teal); }

/* No-data states */
[data-theme="dark"] .no-data {
  background: var(--surface-muted);
  color: var(--text-muted);
}
[data-theme="dark"] .no-data h3 { color: var(--text); }

/* Audio player */
[data-theme="dark"] .audio-player {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}
[data-theme="dark"] .audio-player__title { color: var(--text); }

/* Modal dialog (welcome popup) */
[data-theme="dark"] .modal-dialog__content {
  background: var(--surface);
  color: var(--text);
}
[data-theme="dark"] .modal-dialog__content h2 { color: var(--text); }

/* Page typography */
[data-theme="dark"] .page-title    { color: var(--text); }
[data-theme="dark"] .section-title { color: var(--text); }
[data-theme="dark"] .card-title    { color: var(--text); }
[data-theme="dark"] .body-muted    { color: var(--text-muted); }
[data-theme="dark"] .small-text    { color: var(--text-muted); }

/* Bottom nav — wide (dashboard) */
[data-theme="dark"] .bottom-nav--wide {
  background: rgba(15,25,38,0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(16px);
  box-shadow: 0 -8px 24px rgba(0,0,0,0.35);
}
[data-theme="dark"] .bottom-nav--wide .nav-item { color: rgba(238,244,251,0.4); }
[data-theme="dark"] .bottom-nav--wide .nav-item.active {
  background: rgba(27,143,168,0.18);
  color: var(--teal);
}
[data-theme="dark"] .bottom-nav--wide .nav-item:hover { color: var(--dark-text); background: rgba(255,255,255,0.06); }

/* Settings page cards */
[data-theme="dark"] .user-welcome {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="dark"] .user-welcome h2 { color: var(--text); }
[data-theme="dark"] .user-welcome p  { color: var(--text-muted); }

/* Smooth theme transition on light pages */
body:not(.immersive) {
  transition:
    background-color 220ms ease,
    color 220ms ease;
}
body:not(.immersive) .card,
body:not(.immersive) .chart-container,
body:not(.immersive) .summary-section,
body:not(.immersive) .sequence-item,
body:not(.immersive) .audio-player {
  transition:
    background-color 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease;
}

/* ═══════════════════════════════════════
   31. RESPONSIVE IMPROVEMENTS
   ═══════════════════════════════════════ */

/* Tablet and up */
@media (min-width: 640px) {
  .page-light,
  .page-app,
  .page-wide {
    padding-left: var(--s7);
    padding-right: var(--s7);
  }

  .card,
  .chart-container,
  .summary-section,
  .sequence-item {
    padding: var(--s7);
  }

  .charts-grid { grid-template-columns: 1fr 1fr; }

  .trend-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Small screens */
@media (max-width: 390px) {
  :root {
    --text-base: 16px;
  }

  .page-app,
  .page-light,
  .page-wide {
    padding-left: var(--s4);
    padding-right: var(--s4);
  }

  .page-title   { font-size: 30px; }
  .section-title { font-size: 22px; }

  .btn { min-height: 58px; }

  .bottom-nav--wide .nav-item {
    font-size: 10px;
    min-height: 62px;
  }
}

/* ═══════════════════════════════════════
   32. THEME SYSTEM — 5-STOP LADDER
   light → soft → calm → dusk → dark
   All themes share the same component
   classes. Only tokens change here.
   ═══════════════════════════════════════ */

/* ── SOFT ────────────────────────────────
   Warm off-white. Cream-tinted surfaces,
   amber-warmed borders, slightly reduced
   contrast — gentler than light mode.
   ─────────────────────────────────────── */
[data-theme="soft"] {
  --bg:            #f7f3ee;
  --bg-alt:        #ede7de;
  --surface:       #fffdf9;
  --surface-muted: #f5efe6;
  --border:        #d4c4b0;
  --border-strong: #b8a898;

  --text:          #1e1a14;
  --text-muted:    #5c4e3d;
  --text-soft:     #9c8878;
  --text-inverse:  #fffdf9;

  /* Slightly warmer navy */
  --navy:          #1a3558;
  --navy-mid:      #224570;

  /* Teal stays, slightly warmer */
  --teal:          #1a8fa8;
  --teal-dark:     #14718a;
  --teal-xlight:   #e2f4f8;
  --teal-light:    #bce6f2;

  /* Amber more prominent on warm bg */
  --amber-soft:    #fdecd4;

  --shadow-xs:  0 2px  6px rgba(30,20,10,0.06);
  --shadow-sm:  0 4px 14px rgba(30,20,10,0.08);
  --shadow-md:  0 8px 24px rgba(30,20,10,0.10);
  --shadow-lg:  0 16px 40px rgba(30,20,10,0.12);
}

[data-theme="soft"] body {
  background:
    radial-gradient(ellipse 900px 500px at 50% -80px, rgba(240,137,42,0.07), transparent 55%),
    linear-gradient(180deg, #faf6f0 0%, var(--bg) 100%);
  color: var(--text);
}

[data-theme="soft"] .app-header {
  background: linear-gradient(135deg, #1a3558 0%, #2a5280 52%, #1a8fa8 100%);
  box-shadow: 0 4px 20px rgba(26,53,88,0.2);
}

[data-theme="soft"] .card {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="soft"] .card--highlight {
  background: linear-gradient(160deg, #fffdf9 0%, #eef8fb 100%);
  border-color: rgba(26,143,168,0.3);
}

[data-theme="soft"] .bottom-nav--wide {
  background: rgba(255,253,249,0.95);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(16px);
}
[data-theme="soft"] .bottom-nav--wide .nav-item { color: var(--text-soft); }
[data-theme="soft"] .bottom-nav--wide .nav-item.active {
  background: linear-gradient(180deg, var(--teal-xlight) 0%, #d4eff8 100%);
  color: var(--teal-dark);
}
[data-theme="soft"] .bottom-nav--wide .nav-item:hover {
  background: var(--bg-alt);
  color: var(--navy);
}


/* ── CALM ────────────────────────────────
   Muted cool blue-grey. Surfaces take a
   slight blue tint. Mid-contrast — between
   soft and dusk. Good for evening use.
   ─────────────────────────────────────── */
[data-theme="calm"] {
  --bg:            #e8eef6;
  --bg-alt:        #dde4f0;
  --surface:       #f0f4fa;
  --surface-muted: #e4eaf4;
  --border:        #b8c8de;
  --border-strong: #90a8c8;

  --text:          #172038;
  --text-muted:    #445878;
  --text-soft:     #7890b0;
  --text-inverse:  #f0f4fa;

  --navy:          #163356;
  --navy-mid:      #1e4a7a;

  --teal:          #1b9ab8;
  --teal-dark:     #157898;
  --teal-xlight:   #d8f0f8;
  --teal-light:    #b2e0f0;

  --shadow-xs:  0 2px  6px rgba(20,35,65,0.08);
  --shadow-sm:  0 4px 14px rgba(20,35,65,0.10);
  --shadow-md:  0 8px 24px rgba(20,35,65,0.12);
  --shadow-lg:  0 16px 40px rgba(20,35,65,0.14);
}

[data-theme="calm"] body {
  background:
    radial-gradient(ellipse 900px 500px at 50% -80px, rgba(27,143,168,0.12), transparent 55%),
    linear-gradient(180deg, #ecf2fa 0%, var(--bg) 100%);
  color: var(--text);
}

[data-theme="calm"] .app-header {
  background: linear-gradient(135deg, #12294a 0%, #1b3f6e 52%, #1b9ab8 100%);
  box-shadow: 0 4px 20px rgba(16,35,70,0.24);
}

[data-theme="calm"] .card {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 8px 24px rgba(20,35,65,0.09), 0 1px 3px rgba(20,35,65,0.06);
}
[data-theme="calm"] .card--highlight {
  background: linear-gradient(160deg, #f0f4fa 0%, #e2f4fc 100%);
  border-color: rgba(27,154,184,0.32);
}

[data-theme="calm"] .bottom-nav--wide {
  background: rgba(236,242,250,0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(16px);
  box-shadow: 0 -6px 20px rgba(20,35,65,0.08);
}
[data-theme="calm"] .bottom-nav--wide .nav-item { color: var(--text-soft); }
[data-theme="calm"] .bottom-nav--wide .nav-item.active {
  background: linear-gradient(180deg, var(--teal-xlight) 0%, #c8e8f4 100%);
  color: var(--teal-dark);
  box-shadow: inset 0 0 0 1px rgba(27,154,184,0.18);
}
[data-theme="calm"] .bottom-nav--wide .nav-item:hover {
  background: var(--bg-alt);
  color: var(--navy);
}

/* Chart & dashboard surfaces on calm */
[data-theme="calm"] .chart-container {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="calm"] .chart-title   { color: var(--text); }
[data-theme="calm"] .chart-header  { border-bottom-color: var(--border); }
[data-theme="calm"] .summary-section {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="calm"] .sequence-item {
  background: var(--surface);
  border-color: var(--border);
}


/* ── DUSK ────────────────────────────────
   Deep blue-grey. Surfaces are dark but
   not black — clearly between calm and
   full dark. Teal pops. Good for low light.
   ─────────────────────────────────────── */
[data-theme="dusk"] {
  --bg:            #141e2e;
  --bg-alt:        #1a2640;
  --surface:       #1e2c42;
  --surface-muted: #192236;
  --border:        #2a3a52;
  --border-strong: #38506e;

  --text:          #d8e8f8;
  --text-muted:    #6a8aaa;
  --text-soft:     #445870;
  --text-inverse:  #0f1923;

  /* Navy headers stay recognisable */
  --navy:          #a8c8f0;
  --navy-mid:      #7aaee0;

  /* Teal brighter on dark bg */
  --teal:          #22b8d8;
  --teal-dark:     #1a9ab8;
  --teal-xlight:   #0d2a38;
  --teal-light:    #103444;

  --amber-soft:    #2a1c08;
  --sage-soft:     #0c2018;
  --coral-soft:    #260e0e;
  --gold-soft:     #221a04;

  --shadow-xs:  0 2px  6px rgba(0,0,0,0.28);
  --shadow-sm:  0 4px 14px rgba(0,0,0,0.32);
  --shadow-md:  0 8px 24px rgba(0,0,0,0.38);
  --shadow-lg:  0 16px 40px rgba(0,0,0,0.44);

  --shadow-btn: 0 6px 18px rgba(34,184,216,0.28);
}

[data-theme="dusk"] body {
  background:
    radial-gradient(ellipse 900px 500px at 50% -80px, rgba(34,184,216,0.1), transparent 55%),
    linear-gradient(180deg, #18243a 0%, var(--bg) 100%);
  color: var(--text);
}

[data-theme="dusk"] .app-header {
  background: linear-gradient(135deg, #0d1e34 0%, #142844 52%, #1a3860 100%);
  box-shadow: 0 4px 20px rgba(0,0,0,0.45);
}

[data-theme="dusk"] .card {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.32), 0 1px 3px rgba(0,0,0,0.2);
}
[data-theme="dusk"] .card--highlight {
  background: linear-gradient(160deg, #1e2c42 0%, #0e2232 100%);
  border-color: rgba(34,184,216,0.28);
}
[data-theme="dusk"] .card--soft {
  background: var(--surface-muted);
}

[data-theme="dusk"] .page-title    { color: var(--text); }
[data-theme="dusk"] .section-title { color: var(--text); }
[data-theme="dusk"] .card-title    { color: var(--text); }
[data-theme="dusk"] .body-muted    { color: var(--text-muted); }

[data-theme="dusk"] .bottom-nav--wide {
  background: rgba(14,20,32,0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(16px);
  box-shadow: 0 -6px 20px rgba(0,0,0,0.35);
}
[data-theme="dusk"] .bottom-nav--wide .nav-item { color: rgba(216,232,248,0.4); }
[data-theme="dusk"] .bottom-nav--wide .nav-item.active {
  background: rgba(34,184,216,0.16);
  color: var(--teal);
}
[data-theme="dusk"] .bottom-nav--wide .nav-item:hover {
  color: var(--text);
  background: rgba(255,255,255,0.06);
}

/* Tabs on dusk */
[data-theme="dusk"] .tabs {
  background: var(--surface-muted);
  border-bottom-color: var(--border);
}
[data-theme="dusk"] .tab-btn { color: var(--text-muted); }
[data-theme="dusk"] .tab-btn.active {
  background: var(--surface);
  color: var(--teal);
  border-bottom-color: var(--teal);
}

/* Buttons on dusk */
[data-theme="dusk"] .btn--secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
[data-theme="dusk"] .btn--secondary:hover:not(:disabled) {
  background: var(--bg-alt);
  border-color: var(--border-strong);
}
[data-theme="dusk"] .btn--ghost {
  border-color: var(--teal-light);
  color: var(--teal);
}

/* Chart & dashboard surfaces on dusk */
[data-theme="dusk"] .chart-container {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="dusk"] .chart-title   { color: var(--text); }
[data-theme="dusk"] .chart-header  { border-bottom-color: var(--border); }
[data-theme="dusk"] .range-selector select {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-muted);
  color-scheme: dark;
}
[data-theme="dusk"] .trend-legend {
  background: var(--surface-muted);
  border-color: var(--border);
}
[data-theme="dusk"] .legend-item {
  background: var(--surface);
}
[data-theme="dusk"] .sequence-box {
  background: linear-gradient(135deg, #0d2232, var(--bg-alt));
  border-left-color: var(--teal);
}
[data-theme="dusk"] .sequence-item {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="dusk"] .sequence-title { color: var(--text); }
[data-theme="dusk"] .stat-box       { background: var(--surface-muted); }
[data-theme="dusk"] .stat-box__value { color: var(--text); }
[data-theme="dusk"] .stat-box__label { color: var(--text-muted); }
[data-theme="dusk"] .summary-section {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="dusk"] .summary-header { border-bottom-color: var(--border); }
[data-theme="dusk"] .summary-title  { color: var(--text); }
[data-theme="dusk"] .no-data        { background: var(--surface-muted); color: var(--text-muted); }
[data-theme="dusk"] .no-data h3     { color: var(--text); }
[data-theme="dusk"] .audio-player   { background: var(--surface); border-color: var(--border); }
[data-theme="dusk"] .modal-dialog__content { background: var(--surface); color: var(--text); }
[data-theme="dusk"] .modal-dialog__content h2 { color: var(--text); }