/* ========================================
   French 1 Learning Companion - Styles
   Mobile-first, dark mode support
   ======================================== */

/* --- CSS Custom Properties --- */
:root {
  --bg: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: #ffffff;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #1e40af;
  --accent-light: #dbeafe;
  --french-color: #2563eb;
  --border: #e2e8f0;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #f59e0b;
  --danger: #dc2626;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --nav-height: 64px;
  --header-height: 56px;
  --player-height: 72px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

/* --- Dark Mode --- */
@media (prefers-color-scheme: dark) {
  :root:not(.light-mode) {
    --bg: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-light: #1e3a5f;
    --french-color: #60a5fa;
    --border: #334155;
    --success-light: #14532d;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  }
}

.dark-mode {
  --bg: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #3b82f6;
  --accent-light: #1e3a5f;
  --french-color: #60a5fa;
  --border: #334155;
  --success-light: #14532d;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* --- App Shell --- */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
}

#app.has-player {
  padding-bottom: calc(var(--nav-height) + var(--player-height) + var(--safe-bottom));
}

#app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  height: var(--header-height);
  padding: 0 16px;
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  gap: 12px;
}

#app-header h1 {
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-back {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 8px;
  margin: -8px;
  margin-right: 4px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#main-content {
  flex: 1;
  padding: 16px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}

/* --- Bottom Navigation --- */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  min-width: 64px;
  min-height: 44px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
}

.nav-item.active {
  color: var(--accent);
}

.nav-item svg {
  width: 22px;
  height: 22px;
}

/* --- Dashboard / Home --- */
.dashboard {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.continue-card {
  background: linear-gradient(135deg, var(--accent), #3b82f6);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform 0.15s;
}

.continue-card:active {
  transform: scale(0.98);
}

.continue-card h2 {
  font-size: 14px;
  font-weight: 500;
  opacity: 0.9;
  margin-bottom: 4px;
}

.continue-card .lesson-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}

.continue-card .progress-info {
  font-size: 13px;
  opacity: 0.85;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* --- Progress Bar --- */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--success);
  border-radius: 4px;
  transition: width 0.4s ease;
}

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

.progress-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.progress-header span {
  font-size: 13px;
  color: var(--text-secondary);
}

/* --- Lesson Grid --- */
.section-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 12px;
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}

.lesson-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.lesson-cell:active {
  transform: scale(0.96);
}

.lesson-cell.completed {
  background: var(--success-light);
  border-color: var(--success);
  color: var(--success);
}

.lesson-cell.locked {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.lesson-cell .cell-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
}

.lesson-cell.completed .cell-label {
  color: var(--success);
}

/* --- Lesson View --- */
.lesson-view {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Lesson Tabs */
.lesson-tabs {
  display: flex;
  gap: 0;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 16px;
}

.lesson-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 44px;
}

.lesson-tab.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* --- Audio Player --- */
.audio-player {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom));
  left: 0;
  right: 0;
  z-index: 150;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 8px 16px;
  height: var(--player-height);
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.player-btn {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s;
}

.player-btn:active {
  background: var(--bg-secondary);
}

.player-btn.play-btn {
  background: var(--accent);
  color: #fff;
  width: 44px;
  height: 44px;
}

.player-btn.play-btn:active {
  background: var(--accent);
  opacity: 0.85;
}

.player-seek {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.seek-bar {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}

.seek-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.seek-bar::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

.player-time {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.speed-btn {
  font-size: 12px;
  font-weight: 600;
  min-width: 44px;
  color: var(--text-secondary);
}

/* --- Transcript --- */
.transcript {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 24px;
}

.segment {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
  line-height: 1.6;
}

.segment:active {
  background: var(--bg-secondary);
}

.segment.active {
  background: var(--accent-light);
  transform: scale(1.01);
}

.segment .seg-text {
  font-size: 15px;
  color: var(--text);
}

.segment.type-french .seg-text {
  font-size: 20px;
  color: var(--french-color);
  font-weight: 500;
}

.segment .seg-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.segment.type-narrator .seg-text {
  color: var(--text-secondary);
  font-style: italic;
}

.segment.type-instruction .seg-text {
  color: var(--text-secondary);
}

/* --- Vocab Cards (Lesson Tab) --- */
.vocab-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 24px;
}

.vocab-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.vocab-card .french {
  font-size: 20px;
  color: var(--french-color);
  font-weight: 500;
  margin-bottom: 4px;
}

.vocab-card .english {
  font-size: 15px;
  color: var(--text);
}

.vocab-card .notes {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- Dialogues --- */
.dialogue-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 24px;
}

.dialogue-line {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.dialogue-line .speaker {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.dialogue-line .d-french {
  font-size: 20px;
  color: var(--french-color);
  font-weight: 500;
  margin-bottom: 4px;
}

.dialogue-line .d-english {
  font-size: 14px;
  color: var(--text-secondary);
}

/* --- Reading Section --- */
.reading-section {
  padding-bottom: 24px;
}

.reading-section h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 12px;
}

.reading-exercise {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.reading-exercise .r-french {
  font-size: 20px;
  color: var(--french-color);
  font-weight: 500;
  margin-bottom: 8px;
  line-height: 1.5;
}

.reading-exercise .r-english {
  font-size: 14px;
  color: var(--text-secondary);
}

/* --- Mark Complete --- */
.mark-complete-btn {
  display: block;
  width: 100%;
  padding: 14px;
  margin-top: 16px;
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: opacity 0.15s;
}

.mark-complete-btn:active {
  opacity: 0.85;
}

.mark-complete-btn.completed {
  background: var(--bg-secondary);
  color: var(--success);
  border: 2px solid var(--success);
  cursor: default;
}

/* --- Settings --- */
.settings-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.settings-group h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px 8px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  min-height: 44px;
  border-top: 1px solid var(--border);
}

.setting-row:first-child {
  border-top: none;
}

.setting-row label {
  font-size: 15px;
  color: var(--text);
}

.setting-row .setting-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Toggle Switch */
.toggle {
  position: relative;
  width: 50px;
  height: 30px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle .slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 15px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle .slider::before {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle input:checked + .slider {
  background: var(--accent);
}

.toggle input:checked + .slider::before {
  transform: translateX(20px);
}

/* Danger Button */
.btn-danger {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  color: var(--danger);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  min-height: 44px;
}

.btn-danger:active {
  background: rgba(220, 38, 38, 0.08);
}

/* --- Quiz Styles (shared) --- */
.quiz-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quiz-prompt {
  text-align: center;
  padding: 24px 16px;
}

.quiz-prompt .direction {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.quiz-prompt .prompt-text {
  font-size: 24px;
  font-weight: 600;
  color: var(--french-color);
}

.quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-choice {
  display: block;
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  min-height: 44px;
  transition: border-color 0.15s;
}

.quiz-choice:active {
  border-color: var(--accent);
}

.quiz-choice.correct {
  border-color: var(--success);
  background: var(--success-light);
}

.quiz-choice.incorrect {
  border-color: var(--danger);
  background: rgba(220, 38, 38, 0.08);
}

.quiz-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 18px;
  color: var(--text);
  outline: none;
  min-height: 44px;
}

.quiz-input:focus {
  border-color: var(--accent);
}

/* SRS Grade Buttons */
.grade-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.grade-btn {
  padding: 12px 8px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  min-height: 44px;
  transition: opacity 0.15s;
}

.grade-btn:active {
  opacity: 0.8;
}

.grade-btn.again { background: var(--danger); }
.grade-btn.hard { background: #f59e0b; }
.grade-btn.good { background: var(--success); }
.grade-btn.easy { background: #3b82f6; }

/* --- Vocab Browser Styles --- */
.vocab-browser {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vocab-search {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--text);
  outline: none;
}

.vocab-search:focus {
  border-color: var(--accent);
}

.vocab-filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.filter-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  min-height: 36px;
  transition: all 0.15s;
}

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.nav-item .badge {
  position: absolute;
  top: 2px;
  right: 4px;
}

.nav-item {
  position: relative;
}

/* --- Empty States --- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 17px;
  color: var(--text);
  margin-bottom: 4px;
}

.empty-state p {
  font-size: 14px;
}

/* --- Utility --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Smooth scroll for transcript */
.transcript {
  scroll-behavior: smooth;
}

/* Loading spinner */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Utility Classes --- */
.hidden {
  display: none !important;
}

/* --- Button Styles --- */
.btn-action {
  display: inline-block;
  padding: 12px 24px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  min-height: 44px;
  transition: opacity 0.15s;
}

.btn-action:active {
  opacity: 0.85;
}

.btn-secondary {
  display: inline-block;
  padding: 12px 24px;
  background: var(--bg-secondary);
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
  min-height: 44px;
}

/* --- Quiz Styles (quiz.js) --- */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quiz-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.quiz-counter {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.quiz-progress {
  width: 100%;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
}

.quiz-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.quiz-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.quiz-direction {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quiz-word {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--french-color);
  text-align: center;
  padding: 16px 0;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-option {
  display: block;
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  min-height: 44px;
  transition: border-color 0.15s, background 0.15s;
}

.quiz-option:active {
  border-color: var(--accent);
}

.quiz-option.correct {
  border-color: var(--success);
  background: var(--success-light);
}

.quiz-option.incorrect {
  border-color: var(--danger);
  background: rgba(220, 38, 38, 0.08);
}

.quiz-card.answered .quiz-option {
  cursor: default;
  opacity: 0.7;
}

.quiz-card.answered .quiz-option.correct,
.quiz-card.answered .quiz-option.incorrect {
  opacity: 1;
}

.quiz-input-wrap {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.quiz-input-wrap .quiz-input {
  flex: 1;
}

.quiz-check-btn {
  padding: 12px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  min-width: 80px;
  transition: opacity 0.15s;
}

.quiz-check-btn:active {
  opacity: 0.85;
}

.quiz-input.correct {
  border-color: var(--success);
  background: var(--success-light);
}

.quiz-input.incorrect {
  border-color: var(--danger);
  background: rgba(220, 38, 38, 0.08);
}

.quiz-feedback {
  margin-top: 16px;
  text-align: center;
  font-size: 16px;
}

.feedback-correct {
  color: var(--success);
  font-weight: 600;
}

.feedback-incorrect {
  color: var(--danger);
}

.feedback-incorrect strong {
  color: var(--french-color);
}

.quiz-grades {
  margin-top: 8px;
}

.grade-prompt {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 8px;
}

.grade-btn.grade-again { background: var(--danger); }
.grade-btn.grade-hard { background: #f59e0b; }
.grade-btn.grade-good { background: var(--success); }
.grade-btn.grade-easy { background: #3b82f6; }

.grade-btn.suggested {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

/* Quiz Summary */
.quiz-summary {
  text-align: center;
  padding: 24px 0;
}

.quiz-summary h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.summary-stat {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 16px;
}

.summary-number {
  display: block;
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
}

.summary-stat.correct .summary-number {
  color: var(--success);
}

.summary-stat.incorrect .summary-number {
  color: var(--danger);
}

.summary-label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.summary-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.summary-actions .btn-action,
.summary-actions .btn-secondary {
  width: 100%;
  text-align: center;
}

.quiz-restart-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}

/* --- Vocab Browser Styles (vocab.js) --- */
.vocab-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vocab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.vocab-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.vocab-count {
  font-size: 14px;
  color: var(--text-muted);
}

.vocab-controls {
  display: flex;
  gap: 8px;
}

.vocab-controls .vocab-search {
  flex: 1;
}

.vocab-filter {
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  min-width: 120px;
}

/* Vocab cards in browser */
.vocab-container .vocab-card {
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.vocab-container .vocab-card.expanded {
  box-shadow: var(--shadow-md);
}

.vocab-card-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.vocab-card-left {
  flex: 1;
  min-width: 0;
}

.vocab-french {
  display: block;
  font-size: 18px;
  color: var(--french-color);
  font-weight: 500;
  margin-bottom: 2px;
}

.vocab-english {
  display: block;
  font-size: 14px;
  color: var(--text-secondary);
}

.vocab-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.vocab-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.vocab-status.status-new {
  background: var(--bg-secondary);
  color: var(--text-muted);
}

.vocab-status.status-learning {
  background: #fef3c7;
  color: #92400e;
}

.dark-mode .vocab-status.status-learning,
:root:not(.light-mode) .vocab-status.status-learning {
  background: #78350f;
  color: #fbbf24;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light-mode) .vocab-status.status-learning {
    background: #78350f;
    color: #fbbf24;
  }
}

.vocab-status.status-mature {
  background: var(--success-light);
  color: var(--success);
}

.vocab-lesson-tag {
  font-size: 11px;
  color: var(--text-muted);
}

.vocab-card-details {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.vocab-notes {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.vocab-srs-info {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.vocab-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 15px;
}

/* --- Today View --- */
.today-view {
  gap: 16px;
}

.streak-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  border-radius: var(--radius);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}

.streak-fire {
  font-size: 22px;
}

.action-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.action-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s;
  min-height: 72px;
}

.action-card:active {
  transform: scale(0.98);
}

.action-card .action-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.action-review .action-icon {
  background: #dbeafe;
  color: #2563eb;
}

.action-lesson .action-icon {
  background: #dcfce7;
  color: #16a34a;
}

.action-quick .action-icon {
  background: #fef3c7;
  color: #d97706;
}

.dark-mode .action-review .action-icon {
  background: #1e3a5f;
  color: #60a5fa;
}

.dark-mode .action-lesson .action-icon {
  background: #14532d;
  color: #4ade80;
}

.dark-mode .action-quick .action-icon {
  background: #78350f;
  color: #fbbf24;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light-mode) .action-review .action-icon {
    background: #1e3a5f;
    color: #60a5fa;
  }
  :root:not(.light-mode) .action-lesson .action-icon {
    background: #14532d;
    color: #4ade80;
  }
  :root:not(.light-mode) .action-quick .action-icon {
    background: #78350f;
    color: #fbbf24;
  }
}

.action-card .action-label {
  font-size: 16px;
  font-weight: 600;
}

.action-card .action-detail {
  font-size: 13px;
  color: var(--text-muted);
}

.action-card.caught-up .action-detail {
  color: var(--success);
}

.today-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

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

.today-stat-value {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

.today-stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.lesson-grid-toggle {
  margin-top: 4px;
}

.lesson-grid-toggle summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lesson-grid-toggle summary::before {
  content: '\\25B6';
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.lesson-grid-toggle[open] summary::before {
  transform: rotate(90deg);
}

.lesson-grid-toggle summary::-webkit-details-marker {
  display: none;
}

.lesson-grid-toggle .lesson-grid {
  margin-top: 12px;
}

/* --- Quick Quiz Summary --- */
.quick-summary {
  text-align: center;
  padding: 48px 24px;
}

.quick-score {
  font-size: 36px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.quick-message {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.quick-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.quick-actions .btn {
  padding: 14px 32px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  min-height: 44px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  border: none;
}

.quick-actions .btn-primary {
  background: var(--accent);
  color: #fff;
}

.quick-actions .btn-secondary {
  background: var(--bg-secondary);
  color: var(--text);
  border: 1px solid var(--border);
}

/* --- Audio Download Settings --- */
.download-actions {
  display: flex;
  gap: 8px;
  padding: 8px 16px 12px;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  min-height: 36px;
}

.download-list {
  max-height: 400px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.download-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  min-height: 44px;
}

.download-label {
  flex: 1;
  font-size: 14px;
  color: var(--text);
}

.download-progress {
  flex: 1;
  height: 4px;
  background: var(--bg-secondary);
  border-radius: 2px;
  overflow: hidden;
}

.download-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.2s;
  width: 0%;
}

.btn-download {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  min-width: 80px;
  text-align: center;
  min-height: 36px;
}

.btn-download.cached {
  color: var(--danger);
  border-color: var(--danger);
  background: transparent;
}

.btn-download:disabled {
  opacity: 0.6;
  cursor: default;
}

/* --- Offline Audio Message --- */
.audio-offline-msg {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom));
  left: 0;
  right: 0;
  z-index: 150;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 16px;
  height: var(--player-height);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.audio-offline-msg a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

/* --- Offline Badge on Player --- */
.offline-badge {
  position: absolute;
  top: -8px;
  right: 16px;
  padding: 2px 8px;
  background: var(--success);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
