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

:root {
  --bg: #ffffff;
  --bg-2: #f8fafc;
  --bg-3: #f1f5f9;
  --border: #e2e8f0;
  --text-1: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #eef2ff;
  --success: #22c55e;
  --success-light: #f0fdf4;
  --success-border: #bbf7d0;
  --error: #ef4444;
  --error-light: #fef2f2;
  --error-border: #fecaca;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.03);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --font: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  --transition: 150ms ease;
  --nav-height: 64px;
  --max-w: 640px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --bg-2: #1e293b;
    --bg-3: #334155;
    --border: #334155;
    --text-1: #f1f5f9;
    --text-2: #94a3b8;
    --text-3: #64748b;
    --accent-light: #1e1b4b;
    --success-light: #052e16;
    --success-border: #166534;
    --error-light: #450a0a;
    --error-border: #7f1d1d;
  }
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-1);
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.no-nav { padding-bottom: 0; }

/* === Layout === */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }
.page { padding: 24px 0; }

/* === Typography === */
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.25; }
h2 { font-size: 1.375rem; font-weight: 600; line-height: 1.3; }
h3 { font-size: 1.125rem; font-weight: 600; }
p { line-height: 1.7; }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  min-height: 48px;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn-primary { background: var(--accent); color: #fff; width: 100%; }
.btn-primary:hover, .btn-primary:active { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-2);
  color: var(--text-1);
  border: 1.5px solid var(--border);
  width: 100%;
}
.btn-secondary:hover, .btn-secondary:active { background: var(--bg-3); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  padding: 8px 16px;
  min-height: 40px;
  width: auto;
}
.btn-ghost:hover { background: var(--bg-2); }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* === Progress Bar (fixed top, quiz pages) === */
.progress-bar-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg);
  padding: 12px 20px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-bar-back {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-2);
  padding: 4px;
  min-width: 32px;
  -webkit-tap-highlight-color: transparent;
}

.progress-bar-track {
  flex: 1;
  height: 8px;
  background: var(--bg-3);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width 0.5s cubic-bezier(.4,0,.2,1);
}

.progress-count {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-2);
  min-width: 36px;
  text-align: right;
}

.quiz-page { padding-top: 80px; }

/* === Question Card === */
.question-card { padding: 24px 0; }

.question-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: var(--accent-light);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}

.question-instruction {
  font-size: 0.9375rem;
  color: var(--text-2);
  margin-bottom: 16px;
  line-height: 1.5;
}

.question-instruction strong { color: var(--text-1); }

.question-passage {
  font-size: 0.9375rem;
  line-height: 1.8;
  color: var(--text-1);
  margin-bottom: 16px;
  padding: 16px;
  background: var(--bg-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.phrase-passage u {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  font-weight: 600;
  color: var(--accent);
}

.question-text {
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--text-1);
  margin-bottom: 20px;
  line-height: 1.6;
}

/* === Options === */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  font-size: 0.9375rem;
  color: var(--text-1);
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  min-height: 52px;
  width: 100%;
  line-height: 1.5;
}

.option-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-light); }
.option-btn.selected { border-color: var(--accent); background: var(--accent-light); }
.option-btn.pending { border-color: var(--accent); background: var(--accent-light); transform: scale(1.01); }
.option-btn.correct { border-color: var(--success); background: var(--success-light); }
.option-btn.wrong { border-color: var(--error); background: var(--error-light); }
.option-btn:disabled { cursor: default; }
.option-btn:disabled .word-clickable { pointer-events: auto; cursor: pointer; }

/* === Confirm Bar === */
.confirm-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.confirm-bar.show { display: flex; }
.confirm-hint { font-size: 0.8125rem; color: var(--text-2); }
.confirm-btn {
  padding: 6px 14px;
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

.option-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--bg-3);
  color: var(--text-2);
  margin-top: 1px;
  transition: all var(--transition);
}

.option-btn.selected:not(.correct):not(.wrong) .option-label { background: var(--accent); color: #fff; }
.option-btn.pending .option-label { background: var(--accent); color: #fff; }
.option-btn.correct .option-label { background: var(--success); color: #fff; }
.option-btn.wrong .option-label { background: var(--error); color: #fff; }
.option-text { flex: 1; }

/* === Audio Button === */
.audio-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  background: var(--bg-2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-1);
  width: 100%;
  margin-bottom: 20px;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.audio-btn:hover { border-color: var(--accent); background: var(--accent-light); }

.audio-btn.playing {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}

.audio-btn svg { width: 22px; height: 22px; flex-shrink: 0; }
.audio-ripple { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; margin-left: auto; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity:1; transform:scale(1); } 50% { opacity:.5; transform:scale(1.4); } }

/* === Feedback Panel === */
.feedback-panel {
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  display: none;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

.feedback-panel.show { display: block; }
.feedback-panel.correct { background: var(--success-light); border: 1.5px solid var(--success-border); }
.feedback-panel.wrong { background: var(--error-light); border: 1.5px solid var(--error-border); }

.feedback-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.feedback-icon { font-size: 1.25rem; }
.feedback-result { font-size: 1rem; font-weight: 700; }
.feedback-panel.correct .feedback-result { color: #16a34a; }
.feedback-panel.wrong .feedback-result { color: #dc2626; }

.feedback-body { font-size: 0.875rem; color: var(--text-1); line-height: 1.75; }
.feedback-body strong { font-weight: 600; }
.feedback-loading { color: var(--text-2); font-style: italic; }
.feedback-audio-script { background: #f3f4f6; border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 10px; font-size: 0.875rem; color: var(--text-2); line-height: 1.6; }

/* === Word Tooltip === */
.word-clickable {
  cursor: pointer;
  border-bottom: 1.5px dashed var(--text-3);
  transition: border-color var(--transition);
  display: inline;
}
.word-clickable:hover { border-color: var(--accent); }
.word-clickable.in-vocab { border-bottom: 2px solid #93c5fd; }

.tooltip-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(15,23,42,.4);
  display: flex;
  align-items: flex-end;
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.tooltip-sheet {
  background: var(--bg);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-sm);
  padding: 24px 20px 20px;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  box-shadow: var(--shadow-lg);
  animation: sheetUp 0.25s cubic-bezier(.4,0,.2,1);
}
@keyframes sheetUp { from { transform:translateY(20px); opacity:0; } to { transform:translateY(0); opacity:1; } }

.tooltip-drag-handle { width: 36px; height: 4px; background: var(--border); border-radius: 2px; margin: -8px auto 20px; }

.tooltip-word-row { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; }
.tooltip-word { font-size: 1.5rem; font-weight: 700; color: var(--text-1); }
.tooltip-example-row { display: flex; align-items: flex-start; gap: 8px; }
.tooltip-example-row .tooltip-example { flex: 1; }

.tooltip-speak-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  background: var(--bg-3);
  border-radius: var(--radius-full);
  color: var(--accent);
  cursor: pointer;
  transition: background var(--transition);
}
.tooltip-speak-btn:hover { background: var(--accent-light); }

.tooltip-pos { font-size: 0.8125rem; color: var(--text-3); margin-top: 2px; margin-bottom: 10px; }
.tooltip-meaning { font-size: 1rem; color: var(--text-1); margin-bottom: 10px; }
.tooltip-example { font-size: 0.875rem; color: var(--text-2); font-style: italic; margin-bottom: 3px; }
.tooltip-translation { font-size: 0.8125rem; color: var(--text-3); margin-bottom: 18px; }
.tooltip-loading { font-size: 0.875rem; color: var(--text-2); padding: 12px 0 18px; display: flex; align-items: center; gap: 10px; }

.tooltip-actions { display: flex; gap: 10px; }
.tooltip-actions .btn { flex: 1; font-size: 0.875rem; padding: 10px 12px; min-height: 44px; }
.retry-lookup-btn { background: none; border: 1px solid var(--accent); color: var(--accent); border-radius: var(--radius-sm); padding: 2px 10px; font-size: 0.8125rem; cursor: pointer; margin-left: 6px; }

/* === Bottom Navigation === */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  padding-top: 8px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 100;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: var(--text-3);
  transition: color var(--transition);
  padding: 4px 8px;
  -webkit-tap-highlight-color: transparent;
}

.nav-item.active { color: var(--accent); }
.nav-item svg { width: 24px; height: 24px; }
.nav-label { font-size: 0.6875rem; font-weight: 600; }

/* === Home Page === */
.home-header { padding: 32px 0 24px; }
.greeting { font-size: 0.9375rem; color: var(--text-2); margin-bottom: 4px; }
.user-name { font-size: 1.625rem; font-weight: 700; }

.streak-card {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  color: white;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.streak-info {}
.streak-number { font-size: 2.75rem; font-weight: 800; line-height: 1; }
.streak-label { font-size: 0.875rem; opacity: 0.85; margin-top: 2px; }
.streak-icon { font-size: 2.75rem; }

.today-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.card-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 12px;
}

.today-progress-bar {
  height: 6px;
  background: var(--bg-3);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 8px;
}

.today-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(.4,0,.2,1);
}

.today-stats { display: flex; justify-content: space-between; font-size: 0.8125rem; color: var(--text-2); }
.today-stats strong { color: var(--text-1); }

.weekly-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.week-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 0.6875rem;
  color: var(--text-3);
}

.week-day-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-3);
}

.week-day-dot.done { background: var(--accent); color: #fff; }
.week-day-dot.today { border: 2px solid var(--accent); color: var(--accent); background: var(--accent-light); }

.milestone-banner {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: var(--radius);
  padding: 14px 18px;
  color: white;
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* === Login Page === */
.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 40px 24px;
  text-align: center;
  padding-bottom: 40px !important;
}

.login-logo { font-size: 3.5rem; margin-bottom: 24px; }
.login-title { font-size: 2rem; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.02em; }
.login-subtitle { font-size: 1rem; color: var(--text-2); margin-bottom: 48px; line-height: 1.65; max-width: 280px; }

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 28px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-full);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-1);
  cursor: pointer;
  width: 100%;
  max-width: 320px;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow);
}

.google-btn:hover { border-color: var(--accent); background: var(--accent-light); box-shadow: var(--shadow-md); }

.google-icon { width: 22px; height: 22px; flex-shrink: 0; }

/* === Loading === */
.loading-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 16px;
  text-align: center;
  padding: 24px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bg-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text { font-size: 0.9375rem; color: var(--text-2); }
.loading-sub { font-size: 0.8125rem; color: var(--text-3); }

/* === Placement Test === */
.placement-intro {
  padding: 40px 0 32px;
  text-align: center;
}

.placement-icon { font-size: 3rem; margin-bottom: 16px; }
.placement-title { font-size: 1.625rem; font-weight: 800; margin-bottom: 8px; }
.placement-desc { font-size: 0.9375rem; color: var(--text-2); margin-bottom: 32px; line-height: 1.7; }

.info-list { list-style: none; text-align: left; margin-bottom: 32px; display: flex; flex-direction: column; gap: 10px; }
.info-list li { display: flex; align-items: flex-start; gap: 10px; font-size: 0.9375rem; color: var(--text-2); }
.info-dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; margin-top: 8px; flex-shrink: 0; }

.result-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 64px 0;
}

.result-level-display {
  font-size: 5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
}

.result-label { font-size: 1.125rem; font-weight: 600; margin-bottom: 6px; }
.result-desc { font-size: 0.9375rem; color: var(--text-2); margin-bottom: 32px; }
.result-countdown { font-size: 0.875rem; color: var(--text-3); }

/* === Session Completion === */
.completion-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 56px 24px;
}

.completion-icon { font-size: 4rem; margin-bottom: 16px; }
.completion-title { font-size: 1.75rem; font-weight: 800; margin-bottom: 8px; }
.completion-sub { font-size: 1rem; color: var(--text-2); margin-bottom: 36px; line-height: 1.6; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  margin-bottom: 36px;
}

.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 8px;
  text-align: center;
}

.stat-value { font-size: 1.875rem; font-weight: 800; color: var(--accent); line-height: 1; }
.stat-label { font-size: 0.6875rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 6px; }

/* === Vocabulary Page === */
.vocab-header { padding: 24px 0 16px; }
.vocab-count { font-size: 0.875rem; color: var(--text-2); margin-top: 4px; }

.vocab-empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-2);
}

.vocab-empty-icon { font-size: 3rem; margin-bottom: 12px; }
.vocab-empty-text { font-size: 0.9375rem; line-height: 1.6; }

.vocab-list { list-style: none; }

.vocab-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.vocab-item:last-child { border-bottom: none; }
.vocab-word-group { flex: 1; min-width: 0; }
.vocab-word { font-size: 1rem; font-weight: 600; }
.vocab-pos { font-size: 0.75rem; color: var(--text-3); }
.vocab-meaning { font-size: 0.875rem; color: var(--text-2); margin-top: 2px; }

.vocab-badge {
  font-size: 0.6875rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
  flex-shrink: 0;
}

.vocab-badge.active { background: var(--accent-light); color: var(--accent); }
.vocab-badge.known { background: var(--success-light); color: var(--success); }

/* === Progress Page === */
.progress-header { padding: 24px 0 20px; }

.level-cards { display: flex; flex-direction: column; gap: 12px; margin-bottom: 28px; }

.level-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.level-card-icon { font-size: 1.75rem; }
.level-card-body { flex: 1; }
.level-card-name { font-size: 0.9375rem; font-weight: 600; margin-bottom: 2px; }
.level-card-meta { font-size: 0.8125rem; color: var(--text-2); }

.level-badge {
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: var(--radius-full);
}

.accuracy-bar-label { display: flex; justify-content: space-between; font-size: 0.8125rem; color: var(--text-2); margin-bottom: 6px; }
.accuracy-bar-track { height: 6px; background: var(--bg-3); border-radius: var(--radius-full); overflow: hidden; }
.accuracy-bar-fill { height: 100%; border-radius: var(--radius-full); background: var(--accent); transition: width 1s ease; }

/* === Toast === */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--text-1);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 400;
  white-space: nowrap;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* === Start Screen === */
.start-screen { padding: 48px 0; text-align: center; }
.start-icon { font-size: 3.5rem; margin-bottom: 20px; }
.start-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 8px; }
.start-meta { font-size: 0.9375rem; color: var(--text-2); margin-bottom: 32px; line-height: 1.6; }

.skill-pills { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 32px; }
.skill-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
}

/* === Utility === */
.hidden { display: none !important; }
.text-center { text-align: center; }
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.section-gap { margin-bottom: 28px; }

/* === Speaking Question === */
.speaking-prompt {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.speaking-zh { font-size: 1rem; color: var(--text-1); font-weight: 500; margin-bottom: 6px; }
.speaking-en { font-size: 0.875rem; color: var(--text-2); font-style: italic; }

.speaking-controls { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 20px 0; }

.speak-mic-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.speak-mic-btn:hover { background: var(--accent-hover); }
.speak-mic-btn.recording {
  background: var(--error);
  animation: pulse 1s infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }

.speak-status { font-size: 0.875rem; color: var(--text-3); text-align: center; }
.speak-transcript {
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.9375rem;
  color: var(--text-1);
  font-style: italic;
  margin-bottom: 8px;
}
.speak-score { font-size: 1.25rem; letter-spacing: 2px; color: #f59e0b; }
.speak-scores { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 0.8125rem; color: var(--text-2); }
.speak-scores span { background: var(--bg-3); padding: 4px 10px; border-radius: var(--radius-full); }
.inline-speak-btn {
  background: none; border: none; cursor: pointer; color: var(--accent);
  font-size: 0.9rem; padding: 0 4px; vertical-align: middle;
}

/* === Ask Tutor === */
.ask-tutor-section {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.ask-tutor-toggle {
  background: none;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius-full);
  padding: 7px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.ask-tutor-toggle:hover, .ask-tutor-toggle:active {
  background: var(--accent);
  color: #fff;
}

.ask-tutor-panel {
  margin-top: 10px;
}

.ask-tutor-messages {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.ask-msg {
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  line-height: 1.55;
  max-width: 90%;
}

.ask-msg-user {
  background: var(--accent);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.ask-msg-ai {
  background: var(--bg-3);
  color: var(--text-1);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

/* === Feedback FAB === */
.feedback-fab {
  position: fixed;
  right: 16px;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 14px);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  transition: transform 0.15s, box-shadow 0.15s;
}

.feedback-fab:hover { transform: scale(1.08); box-shadow: 0 6px 18px rgba(99, 102, 241, 0.55); }
.feedback-fab:active { transform: scale(0.94); }

body.no-nav .feedback-fab { bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); }

.ask-tutor-input-row {
  display: flex;
  gap: 8px;
}

.ask-tutor-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 9px 14px;
  font-size: 0.9rem;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-1);
  outline: none;
  transition: border-color var(--transition);
}
.ask-tutor-input:focus { border-color: var(--accent); }

.ask-tutor-send {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  padding: 9px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition);
}
.ask-tutor-send:hover { background: var(--accent-hover); }
.ask-tutor-send:disabled { opacity: 0.5; cursor: not-allowed; }
