/* ══════════════════════════════════════════════════════════════════════════
   style.css — French AI Speaking Coach
   Architecture: variables → reset → shell → screens → components → utilities
   ══════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────
   Google Fonts (fallback if link tag fails)
   ───────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;1,400&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

/* ─────────────────────────────────────────────
   Design Tokens
   ───────────────────────────────────────────── */
:root {
  /* Brand colours */
  --french:       #0055a4;
  --french-lt:    #1a72cc;
  --french-pale:  #dbeafe;
  --gold:         #c9a84c;
  --gold-lt:      #f0d080;
  --gold-pale:    #fef3c7;
  --red-fr:       #ef4135;
  --red-pale:     #fee2e2;
  --green:        #16a34a;
  --green-pale:   #dcfce7;

  /* Neutrals */
  --navy:         #0d1b2a;
  --ink:          #1a2940;
  --mid:          #3a4f6b;
  --slate:        #7a90aa;
  --silver:       #c8d4e0;
  --cloud:        #eef2f7;
  --fog:          #f5f7fb;
  --white:        #ffffff;

  /* Sidebar */
  --sidebar-bg:   #0f1f35;
  --sidebar-w:    240px;

  /* Spacing */
  --gap-xs:   6px;
  --gap-sm:   12px;
  --gap-md:   20px;
  --gap-lg:   32px;
  --gap-xl:   48px;

  /* Radii */
  --r-sm:  8px;
  --r-md:  14px;
  --r-lg:  20px;
  --r-xl:  28px;
  --r-pill: 999px;

  /* Shadows */
  --shadow-xs: 0 1px 4px rgba(13,27,42,0.06);
  --shadow-sm: 0 2px 10px rgba(13,27,42,0.08);
  --shadow-md: 0 6px 24px rgba(13,27,42,0.11);
  --shadow-lg: 0 16px 48px rgba(13,27,42,0.14);

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur:  0.22s;
}

/* ─────────────────────────────────────────────
   Reset
   ───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--fog);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
ul, ol { list-style: none; }
a { color: inherit; }

/* ─────────────────────────────────────────────
   APP SHELL  (sidebar + content)
   ───────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

/* ─────────────────────────────────────────────
   SIDEBAR
   ───────────────────────────────────────────── */
.sidebar {
  grid-column: 1;
  grid-row: 1 / -1;
  background: var(--sidebar-bg);
  width: var(--sidebar-w);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 0 20px;
  z-index: 100;
  box-shadow: 4px 0 20px rgba(0,0,0,0.2);
}

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 16px;
}

.logo-flag {
  display: flex;
  height: 20px;
  width: 30px;
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.logo-flag span { flex: 1; }
.logo-flag .f1 { background: #0055a4; }
.logo-flag .f2 { background: #ffffff; }
.logo-flag .f3 { background: #ef4135; }

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.logo-main {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--white);
}

.logo-sub {
  font-size: 0.67rem;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Nav list */
.nav-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: none;
  border-radius: var(--r-md);
  background: transparent;
  color: rgba(255,255,255,0.55);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  position: relative;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: var(--white);
}

.nav-item.active {
  background: rgba(0,85,164,0.35);
  color: var(--white);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--french-lt);
  border-radius: 0 3px 3px 0;
}

.nav-icon { font-size: 1.1rem; flex-shrink: 0; }
.nav-label { flex: 1; }

.nav-badge {
  background: var(--red-fr);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sidebar footer / streak */
.sidebar-footer {
  padding: 16px 20px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 16px;
}

.streak-display {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.6);
  font-size: 0.82rem;
}

.streak-flame { font-size: 1rem; }

.streak-count {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold-lt);
}

.streak-label { color: rgba(255,255,255,0.45); }

.mode-selector {
  display: flex;
  gap: 4px;
  margin-top: 14px;
}

.mode-btn {
  flex: 1;
  padding: 5px 0;
  border: none;
  border-radius: var(--r-sm, 6px);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.5);
  transition: background 0.18s, color 0.18s;
}

.mode-btn:hover { background: rgba(255,255,255,0.18); color: rgba(255,255,255,0.8); }
.mode-btn.active { background: var(--french-lt); color: #fff; }

.detailed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.detailed-label {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.5);
}

.detailed-toggle {
  position: relative;
  width: 34px;
  height: 18px;
  border-radius: 9px;
  border: none;
  cursor: pointer;
  background: rgba(255,255,255,0.15);
  transition: background 0.22s;
  flex-shrink: 0;
}

.detailed-toggle[aria-checked="true"] { background: var(--gold); }

.detailed-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.22s;
}

.detailed-toggle[aria-checked="true"] .detailed-knob { transform: translateX(16px); }

.reeval-section {
  margin-top: 14px;
  border-top: 1px solid var(--cloud);
  padding-top: 12px;
}

.reeval-top-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.reeval-label {
  font-size: 0.75rem;
  color: var(--slate);
  flex: 1;
}

.reeval-detailed-label {
  font-size: 0.72rem;
  color: var(--slate);
}

.reeval-detailed-toggle {
  position: relative;
  width: 30px;
  height: 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: rgba(0,0,0,0.12);
  transition: background 0.22s;
  flex-shrink: 0;
}

.reeval-detailed-toggle[aria-checked="true"] { background: var(--gold); }

.reeval-btns {
  display: flex;
  gap: 6px;
}

.reeval-mode-btn {
  flex: 1;
  padding: 7px 0;
  border: 1.5px solid var(--silver);
  border-radius: var(--r-sm, 6px);
  background: transparent;
  color: var(--mid);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s, background 0.18s;
}

.reeval-mode-btn:hover { border-color: var(--french-lt); color: var(--french); background: var(--french-pale); }
.reeval-mode-btn.active { border-color: var(--french); background: var(--french-pale); color: var(--french); }

/* ─────────────────────────────────────────────
   MOBILE TOP BAR  (hidden on desktop)
   ───────────────────────────────────────────── */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--sidebar-bg);
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-md);
}

.mobile-menu-btn {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}

.mobile-menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: var(--dur) var(--ease);
}

.mobile-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 600;
}

.mobile-streak {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--gold-lt);
  font-weight: 700;
  font-size: 0.9rem;
}

/* ─────────────────────────────────────────────
   MAIN CONTENT
   ───────────────────────────────────────────── */
.main-content {
  grid-column: 2;
  padding: 36px 40px 64px;
  min-height: 100vh;
  max-width: 860px;
  width: 100%;
}

/* ─────────────────────────────────────────────
   SCREENS
   ───────────────────────────────────────────── */
.screen { animation: fadeUp 0.35s var(--ease) both; }
.screen.hidden { display: none !important; }

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

/* Screen header */
.screen-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--gap-lg);
  gap: var(--gap-md);
}

.screen-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.screen-subtitle {
  font-size: 0.95rem;
  color: var(--slate);
  margin-top: 4px;
  font-weight: 400;
}

.header-date {
  font-size: 0.8rem;
  color: var(--slate);
  font-weight: 500;
  white-space: nowrap;
  padding-top: 6px;
}

/* Section heading */
.section-heading {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: var(--gap-sm);
  margin-top: var(--gap-lg);
  letter-spacing: -0.01em;
}

/* ─────────────────────────────────────────────
   DASHBOARD — Stats Row
   ───────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap-sm);
  margin-bottom: var(--gap-lg);
}

.stat-card {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 18px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(200,212,224,0.4);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card--highlight { border-color: var(--gold); }

.stat-icon { font-size: 1.4rem; flex-shrink: 0; }

.stat-num {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--slate);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

/* ─────────────────────────────────────────────
   DASHBOARD — Quick Actions
   ───────────────────────────────────────────── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap-sm);
  margin-bottom: var(--gap-lg);
}

.action-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
  border: none;
  border-radius: var(--r-lg);
  text-align: left;
  cursor: pointer;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  box-shadow: var(--shadow-sm);
}

.action-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.action-card:active { transform: translateY(-1px); }

.action-card--primary { background: var(--french); color: var(--white); }
.action-card--gold    { background: var(--gold);   color: var(--navy);  }
.action-card--red     { background: var(--red-fr); color: var(--white); }

.action-icon { font-size: 1.5rem; flex-shrink: 0; }

.action-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.action-text strong { font-size: 0.92rem; font-weight: 700; }
.action-text span   { font-size: 0.77rem; opacity: 0.8; }

.action-arrow { font-size: 1.1rem; opacity: 0.6; }

/* ─────────────────────────────────────────────
   DASHBOARD — Recent Sessions
   ───────────────────────────────────────────── */
.recent-sessions {
  background: var(--white);
  border-radius: var(--r-lg);
  border: 1px solid rgba(200,212,224,0.4);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--gap-lg);
}

.session-row {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  padding: 14px 20px;
  border-bottom: 1px solid var(--cloud);
  transition: background var(--dur) var(--ease);
}

.session-row:last-child { border-bottom: none; }
.session-row:hover { background: var(--fog); }

.session-topic-icon { font-size: 1.3rem; flex-shrink: 0; }

.session-info { flex: 1; }

.session-topic {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.session-meta {
  font-size: 0.75rem;
  color: var(--slate);
  margin-top: 2px;
}

.session-score {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--r-pill);
}

.session-score--high   { color: var(--green);  background: var(--green-pale); }
.session-score--mid    { color: #d97706;        background: var(--gold-pale);  }
.session-score--low    { color: var(--red-fr);  background: var(--red-pale);   }

/* ─────────────────────────────────────────────
   DASHBOARD — Topic Progress Overview
   ───────────────────────────────────────────── */
.topic-progress-overview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--gap-sm);
  margin-bottom: var(--gap-xl);
}

.topic-progress-chip {
  background: var(--white);
  border-radius: var(--r-md);
  padding: 14px 16px;
  border: 1px solid rgba(200,212,224,0.4);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tpc-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tpc-icon { font-size: 1.1rem; }
.tpc-label { font-size: 0.82rem; font-weight: 600; color: var(--ink); flex: 1; }
.tpc-count { font-size: 0.75rem; color: var(--slate); }

.tpc-bar-bg {
  height: 5px;
  background: var(--cloud);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.tpc-bar-fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--french);
  transition: width 0.6s var(--ease);
}

/* ─────────────────────────────────────────────
   TOPICS GRID
   ───────────────────────────────────────────── */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--gap-md);
  margin-bottom: var(--gap-xl);
}

/* "All Topics" special card first */
.topic-card {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: 24px 20px;
  border: 2px solid transparent;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.topic-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--topic-color, var(--french));
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}

.topic-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--topic-color, var(--french));
}

.topic-card:active { transform: translateY(-2px); }

.topic-card-icon {
  font-size: 2rem;
  line-height: 1;
}

.topic-card-label {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
}

.topic-card-label-en {
  font-size: 0.75rem;
  color: var(--slate);
  margin-top: -6px;
}

.topic-card-desc {
  font-size: 0.8rem;
  color: var(--mid);
  line-height: 1.4;
  flex: 1;
}

.topic-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topic-card-count {
  font-size: 0.75rem;
  color: var(--slate);
  font-weight: 500;
}

.topic-card-arrow {
  color: var(--topic-color, var(--french));
  font-size: 1rem;
  font-weight: 700;
}

.topic-card--all {
  background: linear-gradient(135deg, var(--french) 0%, var(--french-lt) 100%);
  color: var(--white);
  --topic-color: var(--white);
}

.topic-card--all::after { display: none; }
.topic-card--all .topic-card-label { color: var(--white); }
.topic-card--all .topic-card-label-en { color: rgba(255,255,255,0.7); }
.topic-card--all .topic-card-desc { color: rgba(255,255,255,0.8); }
.topic-card--all .topic-card-count { color: rgba(255,255,255,0.7); }
.topic-card--all .topic-card-arrow { color: rgba(255,255,255,0.9); }
.topic-card--all:hover { border-color: transparent; }

/* ─────────────────────────────────────────────
   PRACTICE HEADER
   ───────────────────────────────────────────── */
.practice-header {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  margin-bottom: var(--gap-sm);
}

.btn-back {
  background: none;
  border: 1.5px solid var(--silver);
  border-radius: var(--r-md);
  padding: 8px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--mid);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.btn-back:hover { border-color: var(--french); color: var(--french); }

.practice-progress {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.practice-topic-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--slate);
  background: var(--cloud);
  padding: 3px 10px;
  border-radius: var(--r-pill);
}

.practice-q-counter {
  font-size: 0.82rem;
  color: var(--slate);
}

.practice-mode-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--french);
  background: var(--french-pale);
  padding: 4px 10px;
  border-radius: var(--r-pill);
}

/* Progress bar */
.session-progress-bar {
  height: 5px;
  background: var(--silver);
  border-radius: var(--r-pill);
  overflow: hidden;
  margin-bottom: var(--gap-md);
}

.session-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--french), var(--french-lt));
  border-radius: var(--r-pill);
  transition: width 0.5s var(--ease);
}

/* ─────────────────────────────────────────────
   QUESTION CARD
   ───────────────────────────────────────────── */
.question-card {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: 28px 30px;
  margin-bottom: var(--gap-md);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(200,212,224,0.4);
  position: relative;
  overflow: hidden;
}

.question-card::before {
  content: "«";
  position: absolute;
  top: -12px;
  left: 18px;
  font-family: 'Playfair Display', serif;
  font-size: 9rem;
  color: rgba(0,85,164,0.04);
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.question-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.question-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.question-number {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate);
  background: var(--cloud);
  padding: 3px 9px;
  border-radius: var(--r-pill);
}

.topic-badge {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--french);
  background: var(--french-pale);
  padding: 3px 10px;
  border-radius: var(--r-pill);
  letter-spacing: 0.02em;
}

.difficulty-badge {
  font-size: 0.75rem;
  color: var(--slate);
  letter-spacing: 1px;
}

/* TTS button */
.btn-tts {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--cloud);
  border: 1.5px solid var(--silver);
  border-radius: var(--r-pill);
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--mid);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.btn-tts:hover {
  background: var(--french-pale);
  border-color: var(--french);
  color: var(--french);
}

.btn-tts.playing {
  background: var(--french-pale);
  border-color: var(--french);
  color: var(--french);
  animation: tts-pulse 1.5s var(--ease) infinite;
}

@keyframes tts-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,85,164,0.3); }
  50%       { box-shadow: 0 0 0 6px rgba(0,85,164,0); }
}

.btn-tts--exam { margin-top: 10px; }

/* Question text */
.question-text {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.2rem, 2.5vw, 1.55rem);
  font-weight: 700;
  color: var(--navy);
  line-height: 1.35;
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}

/* Hint accordion */
.hint-accordion,
.vocab-accordion {
  border-top: 1px solid var(--cloud);
  padding-top: 10px;
  margin-top: 10px;
}

.hint-toggle,
.vocab-toggle {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate);
  padding: 0;
  transition: color var(--dur) var(--ease);
  width: 100%;
}

.hint-toggle:hover,
.vocab-toggle:hover { color: var(--french); }

.hint-arrow { font-size: 0.65rem; transition: transform var(--dur) var(--ease); margin-left: auto; }

[aria-expanded="true"] .hint-arrow { transform: rotate(180deg); }

.hint-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.32s var(--ease);
}

.hint-body.open,
.hint-body:not(.hidden) { max-height: 200px; }

.hint-body p {
  font-size: 0.83rem;
  color: var(--mid);
  padding-top: 8px;
  font-style: italic;
  line-height: 1.5;
}

/* Vocabulary body */
.vocab-body {
  padding-top: 10px;
}

.vocab-body.hidden { display: none; }

.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px;
}

.vocab-item {
  background: var(--fog);
  border: 1px solid var(--cloud);
  border-radius: var(--r-sm);
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.vocab-fr {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy);
}

.vocab-en {
  font-size: 0.73rem;
  color: var(--slate);
}

/* ─────────────────────────────────────────────
   CONVERSATION THREAD (follow-ups)
   ───────────────────────────────────────────── */
.conversation-thread { margin-bottom: var(--gap-md); }

/* AI message bubble */
.ai-message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: var(--gap-sm);
  animation: slideIn 0.3s var(--ease) both;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

.ai-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--french) 0%, var(--french-lt) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.ai-bubble {
  background: var(--white);
  border: 1.5px solid var(--french-pale);
  border-radius: 4px var(--r-lg) var(--r-lg) var(--r-lg);
  padding: 12px 16px;
  max-width: 85%;
  box-shadow: var(--shadow-xs);
}

.ai-bubble-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--french);
  margin-bottom: 6px;
}

.ai-bubble-text {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.3;
}

.ai-bubble-tts {
  margin-top: 8px;
}

/* ─────────────────────────────────────────────
   RECORD PANEL
   ───────────────────────────────────────────── */
.record-panel {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: 22px 26px;
  margin-bottom: var(--gap-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(200,212,224,0.4);
}

/* Waveform */
.waveform-container {
  position: relative;
  height: 60px;
  margin-bottom: var(--gap-sm);
  background: var(--fog);
  border-radius: var(--r-md);
  overflow: hidden;
}

.waveform-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.waveform-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--slate);
  pointer-events: none;
}

/* Timer */
.record-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--slate);
  margin-bottom: var(--gap-sm);
  height: 20px;
}

.timer-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red-fr);
  display: none;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

body[data-phase="recording"] .timer-dot { display: block; }
body[data-phase="recording"] .record-timer { color: var(--red-fr); }

/* Record controls */
.record-controls {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  flex-wrap: wrap;
}

/* The main record button */
.btn-record {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  color: var(--ink);
  border: 2px solid var(--silver);
  border-radius: var(--r-md);
  padding: 12px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all var(--dur) var(--ease);
  box-shadow: var(--shadow-xs);
}

.btn-record:hover {
  border-color: var(--french);
  color: var(--french);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-record.recording {
  background: #fff1f2;
  border-color: var(--red-fr);
  color: var(--red-fr);
  animation: pulse-border 1.5s var(--ease) infinite;
}

@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,65,53,0.25); }
  50%       { box-shadow: 0 0 0 6px rgba(239,65,53,0); }
}

.record-btn-icon { font-size: 1.1rem; }

.btn-icon-action {
  background: none;
  border: 1.5px solid var(--silver);
  border-radius: var(--r-md);
  padding: 10px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--slate);
  transition: all var(--dur) var(--ease);
}

.btn-icon-action:hover {
  border-color: var(--red-fr);
  color: var(--red-fr);
}

/* ─────────────────────────────────────────────
   TRANSCRIPT PANEL
   ───────────────────────────────────────────── */
.transcript-panel {
  margin-bottom: var(--gap-md);
}

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

.transcript-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate);
}

.word-count {
  font-size: 0.75rem;
  color: var(--slate);
  font-weight: 500;
}

.transcript-box {
  background: var(--white);
  border: 1.5px solid var(--silver);
  border-radius: var(--r-lg);
  min-height: 100px;
  padding: 16px;
  position: relative;
  transition: border-color var(--dur) var(--ease);
}

body[data-phase="recording"] .transcript-box {
  border-color: var(--red-fr);
  background: #fff9f9;
}

.transcript-placeholder {
  position: absolute;
  inset: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--slate);
  font-size: 0.88rem;
  pointer-events: none;
}

.transcript-text {
  font-size: 0.97rem;
  line-height: 1.75;
  color: var(--ink);
  min-height: 60px;
}

.final-text { color: var(--ink); }
.interim-text { color: var(--slate); font-style: italic; }

/* ─────────────────────────────────────────────
   ACTION BAR
   ───────────────────────────────────────────── */
.action-bar {
  display: flex;
  gap: var(--gap-sm);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--gap-md);
}

/* Primary CTA */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--french);
  color: var(--white);
  border: none;
  border-radius: var(--r-md);
  padding: 14px 28px;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0,85,164,0.28);
  transition: all var(--dur) var(--ease);
}

.btn-primary:hover {
  background: var(--french-lt);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,85,164,0.32);
}

.btn-submit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gold);
  color: var(--navy);
  border: none;
  border-radius: var(--r-md);
  padding: 12px 24px;
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: 0 3px 12px rgba(201,168,76,0.3);
  transition: all var(--dur) var(--ease);
}

.btn-submit:hover:not(:disabled) {
  background: var(--gold-lt);
  transform: translateY(-1px);
}

.btn-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-model {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  color: var(--mid);
  border: 1.5px solid var(--silver);
  border-radius: var(--r-md);
  padding: 11px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all var(--dur) var(--ease);
}

.btn-model:hover {
  border-color: var(--french);
  color: var(--french);
  background: var(--french-pale);
}

.btn-next {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--green);
  color: var(--white);
  border: none;
  border-radius: var(--r-md);
  padding: 12px 24px;
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: 0 3px 12px rgba(22,163,74,0.28);
  transition: all var(--dur) var(--ease);
}

.btn-next:hover {
  background: #15803d;
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  color: var(--slate);
  border: 1.5px solid var(--silver);
  border-radius: var(--r-md);
  padding: 9px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--dur) var(--ease);
}

.btn-secondary:hover { border-color: var(--red-fr); color: var(--red-fr); }

/* ─────────────────────────────────────────────
   FEEDBACK PANEL
   ───────────────────────────────────────────── */
.feedback-panel {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: 28px 30px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(200,212,224,0.4);
  animation: fadeUp 0.4s var(--ease) both;
  margin-bottom: var(--gap-md);
}

.feedback-panel.hidden { display: none; }

/* Loading state */
.feedback-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px 0;
  color: var(--slate);
  font-size: 0.9rem;
}

.loading-dots {
  display: flex;
  gap: 6px;
}

.loading-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--french);
  animation: bounce-dot 1.2s var(--ease) infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce-dot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%            { transform: scale(1.1); opacity: 1;   }
}

/* Feedback inner */
.feedback-inner { animation: fadeUp 0.3s var(--ease) both; }

.feedback-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--gap-sm);
  gap: var(--gap-md);
}

.feedback-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy);
}

/* Score badge */
.score-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  color: white;
  min-width: 64px;
  flex-shrink: 0;
}

.score-badge--high   { background: linear-gradient(135deg, #16a34a, #15803d); }
.score-badge--mid    { background: linear-gradient(135deg, #d97706, #b45309); }
.score-badge--low    { background: linear-gradient(135deg, #dc2626, #b91c1c); }

.score-num {
  font-family: 'Playfair Display', serif;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;
}

.score-denom {
  font-size: 0.75rem;
  opacity: 0.8;
}

/* Score bar */
.score-bar-container {
  margin: 14px 0;
}

.score-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--slate);
  margin-bottom: 5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.score-bar-bg {
  height: 8px;
  background: var(--cloud);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: var(--r-pill);
  transition: width 1s var(--ease);
}

.score-bar-fill--high   { background: linear-gradient(90deg, #16a34a, #4ade80); }
.score-bar-fill--mid    { background: linear-gradient(90deg, #d97706, #fbbf24); }
.score-bar-fill--low    { background: linear-gradient(90deg, #dc2626, #f87171); }

/* Encouragement callout */
.encouragement {
  font-size: 0.92rem;
  color: var(--mid);
  font-style: italic;
  padding: 12px 16px;
  background: var(--fog);
  border-radius: var(--r-md);
  border-left: 3px solid var(--gold);
  margin-bottom: var(--gap-md);
  line-height: 1.55;
}

/* Feedback sections */
.feedback-sections {
  display: grid;
  gap: var(--gap-sm);
}

.feedback-section {
  background: var(--fog);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  border: 1px solid var(--cloud);
}

.feedback-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--slate);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.feedback-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feedback-list-item {
  font-size: 0.86rem;
  color: var(--ink);
  padding: 9px 12px 9px 32px;
  background: var(--white);
  border-radius: var(--r-sm);
  position: relative;
  line-height: 1.5;
  border: 1px solid rgba(200,212,224,0.3);
}

.feedback-list-item::before {
  content: "→";
  position: absolute;
  left: 11px;
  color: var(--french);
  font-weight: 700;
}

/* Pronunciation card */
.pronunciation-card {
  background: var(--fog);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  border: 1px solid var(--cloud);
  margin-bottom: var(--gap-sm);
}

.pronunciation-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.pron-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: var(--white);
  border-radius: var(--r-md);
  padding: 10px 8px;
  border: 1px solid rgba(200,212,224,0.3);
}

.pron-metric-value {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy);
}

.pron-metric-label {
  font-size: 0.68rem;
  color: var(--slate);
  text-align: center;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Vocab suggestions */
.vocab-suggestion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.vocab-suggestion {
  background: var(--white);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  border: 1px solid rgba(200,212,224,0.3);
  font-size: 0.82rem;
}

.vocab-suggestion .basic {
  color: var(--red-fr);
  text-decoration: line-through;
  font-size: 0.78rem;
}

.vocab-suggestion .upgrade {
  color: var(--green);
  font-weight: 700;
}

.vocab-suggestion .example {
  color: var(--slate);
  font-style: italic;
  font-size: 0.75rem;
  margin-top: 2px;
}

/* Feedback meta */
.feedback-meta {
  font-size: 0.78rem;
  color: var(--slate);
  padding-top: 14px;
  border-top: 1px solid var(--cloud);
  margin-top: var(--gap-sm);
  display: flex;
  gap: var(--gap-md);
  flex-wrap: wrap;
}

.feedback-meta span { display: inline-flex; align-items: center; gap: 4px; }

/* ─────────────────────────────────────────────
   MODEL ANSWER PANEL
   ───────────────────────────────────────────── */
.model-answer-panel {
  background: linear-gradient(135deg, rgba(0,85,164,0.03) 0%, rgba(201,168,76,0.04) 100%);
  border: 1.5px solid var(--gold);
  border-radius: var(--r-xl);
  padding: 24px 28px;
  margin-bottom: var(--gap-md);
  animation: fadeUp 0.35s var(--ease) both;
}

.model-answer-panel.hidden { display: none; }

.model-answer-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.model-answer-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  flex: 1;
}

.model-answer-score {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold);
  background: var(--gold-pale);
  padding: 3px 10px;
  border-radius: var(--r-pill);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.model-answer-text {
  font-size: 0.93rem;
  color: var(--ink);
  line-height: 1.75;
  font-style: italic;
  border-left: 3px solid var(--gold);
  padding-left: 14px;
  margin-bottom: 12px;
}

.model-answer-notes {
  font-size: 0.8rem;
  color: var(--slate);
}

/* ─────────────────────────────────────────────
   EXAM MODE
   ───────────────────────────────────────────── */
.exam-rules {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  border: 1.5px solid var(--silver);
  margin-bottom: var(--gap-lg);
  box-shadow: var(--shadow-sm);
}

.exam-rules h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 12px;
}

.exam-rules ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exam-rules li {
  font-size: 0.87rem;
  color: var(--mid);
  display: flex;
  align-items: center;
  gap: 10px;
}

.exam-sets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--gap-md);
  margin-bottom: var(--gap-xl);
}

.exam-set-card {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: 22px 20px;
  border: 2px solid var(--silver);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  box-shadow: var(--shadow-sm);
  text-align: left;
  width: 100%;
}

.exam-set-card:hover {
  border-color: var(--french);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.exam-set-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--french);
  margin-bottom: 6px;
}

.exam-set-title {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 10px;
}

.exam-set-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.exam-set-topic-pill {
  font-size: 0.7rem;
  color: var(--mid);
  background: var(--cloud);
  padding: 2px 8px;
  border-radius: var(--r-pill);
}

/* Exam in progress */
.exam-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap-sm);
}

.exam-progress-info {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--mid);
}

.exam-timer-display {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--navy);
  background: var(--white);
  padding: 8px 16px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--silver);
  box-shadow: var(--shadow-xs);
}

.exam-timer-display.warning { color: var(--red-fr); border-color: var(--red-fr); animation: pulse-border 1s infinite; }

.exam-progress-track {
  height: 5px;
  background: var(--silver);
  border-radius: var(--r-pill);
  overflow: hidden;
  margin-bottom: var(--gap-md);
}

.exam-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--french), var(--french-lt));
  border-radius: var(--r-pill);
  transition: width 0.5s var(--ease);
}

.exam-mode-card { border: 2px solid var(--french-pale); }

/* Exam Results */
.exam-results {
  animation: fadeUp 0.4s var(--ease) both;
}

.exam-results-header {
  text-align: center;
  margin-bottom: var(--gap-lg);
}

.exam-results-trophy {
  font-size: 3.5rem;
  margin-bottom: 12px;
}

.exam-results-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}

.exam-results-subtitle {
  font-size: 0.95rem;
  color: var(--slate);
}

.exam-results-score-big {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: 'Playfair Display', serif;
  font-size: 3rem;
  font-weight: 700;
  color: var(--french);
  margin: var(--gap-md) 0;
}

.exam-results-score-denom {
  font-size: 1.5rem;
  color: var(--slate);
}

.exam-results-breakdown {
  display: grid;
  gap: var(--gap-sm);
  margin-bottom: var(--gap-lg);
}

.exam-result-row {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  border: 1px solid rgba(200,212,224,0.4);
  box-shadow: var(--shadow-xs);
}

.err-num { font-weight: 700; color: var(--slate); font-size: 0.85rem; min-width: 24px; }
.err-topic { flex: 1; font-size: 0.88rem; color: var(--ink); }
.err-text { font-size: 0.8rem; color: var(--mid); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.err-score {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--r-pill);
}

/* ─────────────────────────────────────────────
   DAILY CHALLENGE
   ───────────────────────────────────────────── */
.challenge-card {
  background: linear-gradient(135deg, rgba(239,65,53,0.04) 0%, rgba(201,168,76,0.06) 100%);
  border: 2px solid var(--gold);
  border-radius: var(--r-xl);
  padding: 28px 30px;
  margin-bottom: var(--gap-md);
  box-shadow: var(--shadow-md);
}

.challenge-topic-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.challenge-topic-badge {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--gold);
  background: var(--gold-pale);
  padding: 3px 10px;
  border-radius: var(--r-pill);
}

.challenge-difficulty { font-size: 0.85rem; color: var(--gold); }

.challenge-question {
  font-size: clamp(1.15rem, 2.5vw, 1.45rem);
}

.challenge-streak-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--gold-pale);
  border: 1.5px solid var(--gold);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  font-size: 0.8rem;
  color: var(--gold);
  font-weight: 700;
  flex-shrink: 0;
}

.challenge-streak-badge span:first-child { font-size: 1.5rem; }
.challenge-streak-badge #challenge-streak-num {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}

.challenge-completed-banner {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  background: var(--green-pale);
  border: 1.5px solid var(--green);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  font-size: 0.9rem;
  color: var(--green);
  margin-top: var(--gap-md);
}

.challenge-completed-banner span:first-child { font-size: 1.5rem; }
.challenge-completed-banner strong { display: block; font-weight: 700; }
.challenge-completed-banner p { color: var(--mid); font-size: 0.82rem; margin-top: 2px; }

/* ─────────────────────────────────────────────
   PROGRESS SCREEN
   ───────────────────────────────────────────── */
.progress-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap-sm);
  margin-bottom: var(--gap-lg);
}

.progress-stat-large {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: 22px 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(200,212,224,0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.psl-icon { font-size: 1.5rem; }

.psl-num {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}

.psl-label {
  font-size: 0.72rem;
  color: var(--slate);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Score chart */
.chart-card {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(200,212,224,0.4);
  margin-bottom: var(--gap-lg);
  position: relative;
  min-height: 160px;
}

.score-chart {
  width: 100%;
  height: 140px;
  display: block;
}

.chart-empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--slate);
  text-align: center;
  padding: 20px;
}

/* Topic breakdown */
.topic-breakdown {
  display: grid;
  gap: var(--gap-sm);
  margin-bottom: var(--gap-lg);
}

.topic-breakdown-row {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  border: 1px solid rgba(200,212,224,0.4);
  box-shadow: var(--shadow-xs);
}

.tdr-icon { font-size: 1.2rem; flex-shrink: 0; }

.tdr-info { flex: 1; }

.tdr-label { font-size: 0.88rem; font-weight: 600; color: var(--ink); }

.tdr-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
}

.tdr-bar {
  flex: 1;
  height: 6px;
  background: var(--cloud);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.tdr-bar-fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--french);
  transition: width 0.6s var(--ease);
}

.tdr-count { font-size: 0.72rem; color: var(--slate); white-space: nowrap; }

.tdr-score {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  min-width: 36px;
  text-align: right;
}

/* Session history */
.session-history-list {
  display: grid;
  gap: var(--gap-xs);
  margin-bottom: var(--gap-xl);
}

.history-row {
  background: var(--white);
  border-radius: var(--r-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  border: 1px solid rgba(200,212,224,0.3);
  font-size: 0.85rem;
}

.history-date { color: var(--slate); min-width: 90px; font-size: 0.78rem; }
.history-topic { flex: 1; color: var(--ink); font-weight: 500; }
.history-words { color: var(--slate); font-size: 0.78rem; min-width: 70px; }
.history-score {
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 0.82rem;
}

/* ─────────────────────────────────────────────
   MOBILE NAV OVERLAY
   ───────────────────────────────────────────── */
.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  display: flex;
}

.mobile-nav-overlay.hidden { display: none; }

.mobile-nav-drawer {
  background: var(--sidebar-bg);
  width: 260px;
  height: 100%;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  animation: slideInLeft 0.25s var(--ease) both;
}

@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

.mobile-close-btn {
  align-self: flex-end;
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 1.2rem;
  padding: 4px 8px;
  margin-bottom: 20px;
}

.mobile-nav-list { display: flex; flex-direction: column; gap: 4px; }

.mobile-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: var(--r-md);
  background: transparent;
  color: rgba(255,255,255,0.7);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  transition: all var(--dur) var(--ease);
}

.mobile-nav-item:hover { background: rgba(255,255,255,0.08); color: var(--white); }

/* ─────────────────────────────────────────────
   TOAST NOTIFICATIONS
   ───────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
  pointer-events: none;
}

.toast {
  background: var(--navy);
  color: var(--white);
  padding: 12px 18px;
  border-radius: var(--r-md);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.3s var(--ease) both;
  pointer-events: auto;
  max-width: 300px;
}

.toast--success { border-left: 4px solid var(--green); }
.toast--error   { border-left: 4px solid var(--red-fr); }
.toast--info    { border-left: 4px solid var(--french); }
.toast--gold    { border-left: 4px solid var(--gold); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ─────────────────────────────────────────────
   EMPTY STATE
   ───────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 36px 20px;
  text-align: center;
  color: var(--slate);
}

.empty-icon { font-size: 2.5rem; }
.empty-state p { font-size: 0.88rem; line-height: 1.5; max-width: 280px; }

/* ─────────────────────────────────────────────
   UTILITIES
   ───────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─────────────────────────────────────────────
   RESPONSIVE — Tablet (≤ 900px)
   ───────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 200px; }

  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .quick-actions { grid-template-columns: 1fr; }
  .progress-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .pronunciation-metrics { grid-template-columns: repeat(3, 1fr); }
}

/* ─────────────────────────────────────────────
   RESPONSIVE — Mobile (≤ 640px)
   ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .sidebar { display: none; }
  .mobile-topbar { display: flex; }

  .main-content {
    grid-column: 1;
    padding: 20px 16px 48px;
  }

  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .progress-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .pronunciation-metrics { grid-template-columns: repeat(3, 1fr); }
  .topics-grid { grid-template-columns: 1fr; }
  .exam-sets-grid { grid-template-columns: 1fr; }

  .question-card { padding: 20px; }
  .record-panel { padding: 16px 18px; }
  .feedback-panel { padding: 20px; }
  .challenge-card { padding: 20px; }

  .screen-title { font-size: 1.45rem; }
  .question-text { font-size: 1.1rem; }

  .action-bar { flex-direction: column; align-items: stretch; }
  .action-bar button { justify-content: center; }

  .feedback-header { flex-direction: column; gap: 10px; }
  .score-badge { flex-direction: row; gap: 4px; align-self: flex-start; }

  .exam-header { flex-direction: column; gap: 10px; align-items: flex-start; }

  .vocab-suggestion-grid { grid-template-columns: 1fr; }
  .vocab-grid { grid-template-columns: repeat(2, 1fr); }

  .toast-container { bottom: 16px; right: 12px; left: 12px; }
  .toast { max-width: 100%; }
}


/* ══════════════════════════════════════════════════════════════════════════
   AUTH MODAL
   ══════════════════════════════════════════════════════════════════════════ */

.auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.auth-modal-overlay.hidden { display: none; }

.auth-modal {
  background: var(--surface, #fff);
  border-radius: 20px;
  padding: 32px 28px 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.18);
  position: relative;
  animation: modalIn 0.22s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.auth-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--text-muted, #888);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
}
.auth-modal-close:hover { background: var(--surface-2, #f5f5f5); }

.auth-modal-header {
  text-align: center;
  margin-bottom: 20px;
}
.auth-modal-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--text, #1a1a2e);
}
.auth-modal-header p {
  font-size: 0.88rem;
  color: var(--text-muted, #666);
  margin: 0;
}

.auth-tabs {
  display: flex;
  background: var(--surface-2, #f5f5f5);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 18px;
  gap: 2px;
}
.auth-tab {
  flex: 1;
  border: none;
  background: none;
  padding: 8px 0;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted, #666);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.auth-tab.active {
  background: #fff;
  color: var(--text, #1a1a2e);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.auth-field {
  margin-bottom: 12px;
}
.auth-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted, #555);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.auth-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border, #e0e0e0);
  border-radius: 10px;
  font-size: 0.95rem;
  background: var(--surface, #fff);
  color: var(--text, #1a1a2e);
  box-sizing: border-box;
  transition: border-color 0.15s;
  outline: none;
}
.auth-field input:focus { border-color: #0055a4; }

.auth-error {
  background: #fee2e2;
  color: #c0392b;
  font-size: 0.84rem;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
}
.auth-error.hidden { display: none; }

.auth-submit-btn {
  width: 100%;
  margin-top: 6px;
  justify-content: center;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-muted, #999);
  font-size: 0.82rem;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border, #e0e0e0);
}

.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 16px;
  border: 1.5px solid var(--border, #e0e0e0);
  border-radius: 10px;
  background: #fff;
  color: var(--text, #1a1a2e);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-google:hover { background: var(--surface-2, #f8f8f8); border-color: #bbb; }

.auth-skip-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  background: none;
  border: none;
  color: var(--text-muted, #888);
  font-size: 0.83rem;
  cursor: pointer;
  text-align: center;
  padding: 6px;
}
.auth-skip-btn:hover { color: var(--text, #1a1a2e); text-decoration: underline; }
