/* ===== THEMES (same as VocBuilder) ===== */
:root, [data-theme="cream"] {
  --bg: #f7f3eb; --surface: #fffbf3; --surface2: #f0ebe0;
  --border: #e0d6c4; --border2: #d4c9b5;
  --text: #3d3229; --text-dim: #6b5d4f; --text-dimmer: #9a8b7a;
  --accent: #c0392b; --accent-dim: #a93226; --accent-glow: rgba(192,57,43,0.12);
  --green: #2e7d32; --green-dim: rgba(46,125,50,0.10);
  --red: #c62828; --red-dim: rgba(198,40,40,0.10);
  --blue: #1565c0; --blue-dim: rgba(21,101,192,0.10);
  --radius: 12px; --radius-sm: 8px;
  --shadow: rgba(0,0,0,0.08);
}
[data-theme="paper"] {
  --bg: #f0f0ec; --surface: #ffffff; --surface2: #f5f5f2;
  --border: #dcdcd8; --border2: #c8c8c4;
  --text: #1a1a1a; --text-dim: #4a4a4a; --text-dimmer: #8a8a8a;
  --accent: #c0392b; --accent-dim: #a93226; --accent-glow: rgba(192,57,43,0.10);
  --green: #2e7d32; --green-dim: rgba(46,125,50,0.10);
  --red: #c62828; --red-dim: rgba(198,40,40,0.10);
  --blue: #1565c0; --blue-dim: rgba(21,101,192,0.10);
  --shadow: rgba(0,0,0,0.06);
}
[data-theme="sage"] {
  --bg: #e8efe5; --surface: #f2f7ef; --surface2: #dde8d8;
  --border: #c4d4be; --border2: #b0c4a8;
  --text: #2d3a2d; --text-dim: #4a5c4a; --text-dimmer: #7a8c7a;
  --accent: #c0392b; --accent-dim: #a93226; --accent-glow: rgba(192,57,43,0.12);
  --green: #2e7d32; --green-dim: rgba(46,125,50,0.10);
  --red: #c62828; --red-dim: rgba(198,40,40,0.10);
  --blue: #1565c0; --blue-dim: rgba(21,101,192,0.10);
  --shadow: rgba(0,0,0,0.06);
}
[data-theme="ocean"] {
  --bg: #e3edf7; --surface: #eef4fb; --surface2: #d8e6f4;
  --border: #b8cfea; --border2: #a0bfe0;
  --text: #1a2a3a; --text-dim: #3a5068; --text-dimmer: #6a8aa8;
  --accent: #c0392b; --accent-dim: #a93226; --accent-glow: rgba(192,57,43,0.12);
  --green: #2e7d32; --green-dim: rgba(46,125,50,0.10);
  --red: #c62828; --red-dim: rgba(198,40,40,0.10);
  --blue: #1565c0; --blue-dim: rgba(21,101,192,0.10);
  --shadow: rgba(0,0,0,0.06);
}
[data-theme="lavender"] {
  --bg: #ece5f0; --surface: #f5f0f7; --surface2: #e4dce8;
  --border: #d0c4d8; --border2: #beb0c8;
  --text: #2d2433; --text-dim: #4f4258; --text-dimmer: #8a7a94;
  --accent: #c0392b; --accent-dim: #a93226; --accent-glow: rgba(192,57,43,0.12);
  --green: #2e7d32; --green-dim: rgba(46,125,50,0.10);
  --red: #c62828; --red-dim: rgba(198,40,40,0.10);
  --blue: #1565c0; --blue-dim: rgba(21,101,192,0.10);
  --shadow: rgba(0,0,0,0.06);
}
[data-theme="dark"] {
  --bg: #1a1b1e; --surface: #25262b; --surface2: #2c2e33;
  --border: #3a3c42; --border2: #4a4c52;
  --text: #e0e0e0; --text-dim: #a8a8b0; --text-dimmer: #707080;
  --accent: #ef9a9a; --accent-dim: #e57373; --accent-glow: rgba(239,154,154,0.15);
  --green: #66bb6a; --green-dim: rgba(102,187,106,0.15);
  --red: #ef5350; --red-dim: rgba(239,83,80,0.15);
  --blue: #64b5f6; --blue-dim: rgba(100,181,246,0.15);
  --shadow: rgba(0,0,0,0.3);
}

/* ===== RESET ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
*:focus, *:focus-visible { outline: none !important; box-shadow: none !important; }
* { -webkit-tap-highlight-color: transparent; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans JP', 'Segoe UI', sans-serif;
  min-height: 100dvh;
  transition: background 0.2s, color 0.2s;
}

/* ===== SCREENS ===== */
.screen { display: none; min-height: 100dvh; }
.screen.active { display: block; }
.screen-content { max-width: 600px; margin: 0 auto; padding: 20px 16px 40px; }
.screen-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 8px;
}

/* ===== BUTTONS ===== */
.btn-back {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: none; color: var(--accent); font-size: 14px; font-weight: 600;
  cursor: pointer; padding: 8px 4px;
}
.btn-back svg { width: 18px; height: 18px; }
.site-top-link {
  color: var(--text-dimmer); font-size: 13px; text-decoration: none; font-weight: 500;
}
.btn-primary {
  background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 12px 24px; font-size: 15px; font-weight: 600; cursor: pointer;
  width: 100%;
}
.btn-primary:active { opacity: 0.85; }
.btn-secondary {
  background: var(--surface); color: var(--accent); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 20px; font-size: 14px; font-weight: 600;
  cursor: pointer; width: 100%;
}
.btn-back-group { display: flex; gap: 8px; align-items: center; }

/* ===== LOGIN ===== */
.login-card {
  max-width: 400px; margin: 80px auto; text-align: center; padding: 40px 20px;
}
.login-title { font-size: 28px; font-weight: 700; color: var(--accent); margin-bottom: 8px; }
.login-subtitle { color: var(--text-dim); margin-bottom: 32px; }
.ms-login-btn {
  display: inline-flex; align-items: center; gap: 12px;
  background: #fff; border: 1.5px solid #d0d0d0; border-radius: 8px;
  padding: 12px 28px; font-size: 15px; font-weight: 600; color: #333; cursor: pointer;
}
.ms-login-btn svg { width: 20px; height: 20px; }

/* ===== SECTION HEADINGS ===== */
.section-heading {
  font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 4px;
}
.section-sub { font-size: 13px; color: var(--text-dim); margin-bottom: 16px; }

/* ===== MODE CARDS ===== */
.mode-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 8px; }
.mode-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 20px 16px; text-align: center;
  cursor: pointer; transition: transform 0.1s, border-color 0.2s;
}
.mode-card:active { transform: scale(0.97); }
.mode-card-icon { font-size: 32px; margin-bottom: 8px; }
.mode-card-title { font-size: 16px; font-weight: 700; color: var(--text); }
.mode-card-desc { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.mode-card-test { border-color: var(--accent); }
.mode-card-training { border-color: var(--green); }

/* ===== SOURCE TABS ===== */
.source-tabs {
  display: flex; gap: 0; border-bottom: 2px solid var(--border);
  margin-bottom: 12px; overflow-x: auto;
}
.source-tab {
  background: none; border: none; padding: 10px 16px; font-size: 14px;
  font-weight: 600; color: var(--text-dim); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap;
}
.source-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ===== BOOK SELECT ===== */
.screen-book-layout { display: none; flex-direction: column; min-height: 100dvh; }
.screen-book-layout.active { display: flex; }
.book-select-header { padding: 16px 16px 0; max-width: 600px; margin: 0 auto; width: 100%; }
.book-select-scroll { flex: 1; overflow-y: auto; max-width: 600px; margin: 0 auto; width: 100%; padding: 0 16px 40px; }
.book-category-header {
  font-size: 13px; font-weight: 700; color: var(--text-dimmer); text-transform: uppercase;
  letter-spacing: 0.5px; padding: 12px 0 4px;
}
.book-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 6px; cursor: pointer;
  transition: border-color 0.2s;
}
.book-item:active { border-color: var(--accent); }
.book-item-name { font-weight: 600; font-size: 15px; }
.book-item-count { font-size: 13px; color: var(--text-dim); }

/* ===== QUIZ SETUP ===== */
.setup-mode-banner {
  background: var(--accent-glow); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.setup-mode-title { font-size: 18px; font-weight: 700; color: var(--accent); }
.setup-mode-sub { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.setup-range-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px;
}
.range-input {
  width: 70px; padding: 8px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 15px; background: var(--surface); color: var(--text); text-align: center;
}
.setup-start-btn { margin: 16px 0; }

.quiz-type-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.quiz-type-option {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px; text-align: center; cursor: pointer;
  transition: border-color 0.2s;
}
.quiz-type-option.active { border-color: var(--accent); background: var(--accent-glow); }
.quiz-type-label { font-size: 14px; font-weight: 700; }
.quiz-type-desc { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* Training batch */
.batch-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn-batch {
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--text);
}

/* ===== QUIZ SCREEN ===== */
.screen-quiz-fullscreen { padding: 0; }
.quiz-top { padding: 12px 16px 0; }
.quiz-header { display: flex; justify-content: space-between; align-items: center; }
.quiz-progress { font-size: 14px; font-weight: 600; color: var(--text-dim); }
.quiz-timer { font-size: 14px; font-weight: 700; color: var(--accent); }

.quiz-question-area { padding: 24px 16px; text-align: center; }
.question-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 24px 20px; min-height: 100px;
  display: flex; flex-direction: column; justify-content: center;
}
.question-label { display: none; }
.question-text { font-size: 20px; font-weight: 700; line-height: 1.4; }
.question-sub { font-size: 14px; color: var(--accent); margin-top: 8px; font-weight: 600; letter-spacing: 1px; }

/* Progress bar */
.progress-bar { height: 4px; background: var(--surface2); margin: 0 16px; border-radius: 2px; }
.progress-fill { height: 100%; border-radius: 2px; transition: none; }
.progress-fill.timer-blue { background: var(--blue); }
.progress-fill.timer-yellow { background: #f9a825; }
.progress-fill.timer-red { background: var(--red); }
.quiz-timer { font-family: 'JetBrains Mono', monospace; }
.quiz-timer.warning { color: var(--red) !important; }

/* Quiz flash overlay */
.quiz-flash {
  position: fixed; inset: 0; pointer-events: none; z-index: 100;
  opacity: 0; transition: opacity 0.15s ease-in;
}
.quiz-flash.flash-correct { background: rgba(46,125,50,0.18); opacity: 1; }
.quiz-flash.flash-wrong { background: rgba(198,40,40,0.18); opacity: 1; }

/* Feedback */
.feedback-bar {
  padding: 12px 16px; margin: 8px 16px; border-radius: var(--radius-sm);
  text-align: center; visibility: hidden; opacity: 0;
  transition: opacity 0.15s;
}
.feedback-bar.show { visibility: visible; opacity: 1; }
.feedback-bar.correct-fb { background: var(--green-dim); color: var(--green); border: 1.5px solid var(--green); }
.feedback-bar.wrong-fb { background: var(--red-dim); color: var(--red); border: 1.5px solid var(--red); }
.feedback-answer { font-weight: 700; margin-top: 4px; font-size: 16px; }

/* Choices */
.quiz-answer-area { padding: 8px 16px 24px; }
.choices-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
}
.choice-btn {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 12px;
  font-size: 14px; cursor: pointer; text-align: center;
  transition: border-color 0.1s; color: var(--text);
  word-break: break-word;
}
.choice-btn:active { border-color: var(--accent); }
.choice-btn.disabled { pointer-events: none; }
.choice-btn.correct { border-color: var(--green); background: var(--green-dim); font-weight: 700; }
.choice-btn.wrong { border-color: var(--red); background: var(--red-dim); opacity: 0.7; }
@media (max-width: 480px) {
  .choices-grid { grid-template-columns: 1fr; }
}

/* ===== TYPING QUIZ ===== */
.typing-tokens {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  justify-content: center; margin-bottom: 16px;
}
.typing-placeholder {
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 14px; font-weight: 700; color: var(--accent); font-size: 16px;
}
.typing-token-input {
  width: 100px; padding: 10px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 16px; text-align: center;
  background: var(--surface); color: var(--text);
  font-family: 'JetBrains Mono', monospace;
}
.typing-token-input:focus { border-color: var(--accent); }
.typing-input-wrap { position: relative; display: inline-block; }
.typing-optional-label {
  position: absolute; top: -8px; right: -4px; font-size: 10px;
  background: var(--accent); color: #fff; padding: 1px 5px; border-radius: 4px;
}
.typing-submit-btn { max-width: 200px; margin: 0 auto; }
.typing-hint { font-size: 13px; color: var(--accent); text-align: center; margin-bottom: 4px; font-weight: 600; letter-spacing: 1px; }

/* ===== PART QUIZ (card selection with segment structure) ===== */
.part-structure {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  justify-content: center; margin-bottom: 16px; padding: 12px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); min-height: 52px;
}
.part-slot {
  display: inline-flex; align-items: center; gap: 4px;
  min-width: 60px; min-height: 36px; padding: 6px 12px;
  border: 1.5px dashed var(--border2); border-radius: var(--radius-sm);
  background: var(--surface2); justify-content: center;
}
.part-slot-hint { font-size: 12px; color: var(--text-dimmer); font-style: italic; }
.part-filled-word {
  background: var(--accent-glow); border: 1px solid var(--accent);
  border-radius: 4px; padding: 2px 8px; font-weight: 600; font-size: 14px;
  color: var(--accent);
}
.part-cards {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 16px;
}
.part-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 16px;
  font-size: 15px; font-weight: 600; cursor: pointer; color: var(--text);
  transition: opacity 0.15s, border-color 0.15s;
}
.part-card:active { border-color: var(--accent); }
.part-card.used { opacity: 0.25; pointer-events: none; }
.part-actions { display: flex; gap: 8px; }
.part-actions .btn-secondary, .part-actions .btn-primary { width: auto; flex: 1; }

/* ===== RESULTS ===== */
.result-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 32px 20px; text-align: center;
  margin-bottom: 24px;
}
.result-score { font-size: 48px; font-weight: 800; color: var(--accent); }
.result-score-label { font-size: 16px; color: var(--text-dim); margin-top: 4px; }
.result-stats { display: flex; justify-content: center; gap: 24px; margin-top: 16px; font-size: 13px; color: var(--text-dim); }
.result-stat-val { font-weight: 700; color: var(--text); margin-right: 4px; }

.revision-list { display: flex; flex-direction: column; gap: 6px; }
.revision-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; background: var(--surface); border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.revision-item.wrong { border-color: var(--red); background: var(--red-dim); }
.revision-icon { font-size: 16px; flex-shrink: 0; margin-top: 2px; }
.revision-idiom { font-weight: 700; font-size: 14px; }
.revision-meaning { font-size: 13px; color: var(--text-dim); }
.revision-user-answer { font-size: 12px; color: var(--red); margin-top: 2px; }
.revision-correct-answer { font-size: 12px; color: var(--green); margin-top: 2px; }
.revision-item { cursor: pointer; }

/* Detail / Explanation (shared by results, super search, idiom review) */
.revision-detail {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
}
.detail-section { margin-bottom: 10px; }
.detail-label { font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.detail-text { font-size: 13px; line-height: 1.6; color: var(--text); }
.detail-slot { font-size: 13px; margin-bottom: 2px; }
.detail-slot-key { font-weight: 700; color: var(--accent); margin-right: 6px; }
.detail-slot-pos { color: var(--text-dim); margin-right: 6px; }
.detail-slot-typical { color: var(--text-dimmer); font-size: 12px; }
.detail-example { margin-bottom: 8px; }
.detail-ex-en { font-size: 13px; font-weight: 500; color: var(--text); }
.detail-ex-ja { font-size: 12px; color: var(--text-dim); margin-top: 1px; }

/* ===== HISTORY / CALENDAR ===== */
.calendar-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 12px; }
.calendar-nav-btn {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px 12px; cursor: pointer; font-size: 16px; color: var(--text);
}
.calendar-nav-title { font-size: 18px; font-weight: 700; }
.calendar-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 12px; color: var(--text-dimmer); margin-bottom: 4px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendar-cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 13px; border-radius: var(--radius-sm); background: var(--surface);
}
.calendar-cell.empty { background: transparent; }
.calendar-cell.level-1 { background: rgba(46,125,50,0.15); }
.calendar-cell.level-2 { background: rgba(46,125,50,0.30); }
.calendar-cell.level-3 { background: rgba(46,125,50,0.50); color: #fff; }
.calendar-monthly-summary { text-align: center; margin-top: 12px; font-size: 14px; color: var(--text-dim); }

/* ===== SUPER SEARCH ===== */
.ss-section { margin-bottom: 20px; }
.ss-section-label { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.ss-section-hint { font-weight: 400; font-size: 12px; color: var(--text-dim); }
.ss-text-input { width: 100%; padding: 10px 12px; font-size: 15px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); box-sizing: border-box; }
.ss-text-input:focus { outline: none; border-color: var(--accent); }
.ss-cat-label { font-size: 12px; color: var(--text-dimmer); margin: 8px 0 4px; font-weight: 600; }
.ss-results-summary { font-weight: 700; margin-bottom: 12px; }
.ss-results-actions { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.ss-btn-sm { width: auto !important; padding: 8px 16px !important; font-size: 13px !important; }
.ss-results-list { display: flex; flex-direction: column; gap: 6px; }
.ss-result-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px; background: var(--surface); border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.ss-result-idiom { font-weight: 700; font-size: 14px; }
.ss-result-meaning { font-size: 13px; color: var(--text-dim); }
.ss-result-tags { font-size: 11px; color: var(--text-dimmer); margin-top: 2px; }
.ss-cb { flex-shrink: 0; margin-top: 3px; }
.ss-filters-area { display: flex; flex-direction: column; gap: 4px; }
.ss-filter-category { margin-bottom: 2px; }
.ss-filter-title {
  font-size: 13px; font-weight: 600; color: var(--text-dim); cursor: pointer;
  padding: 6px 0; display: flex; align-items: center; gap: 6px;
  user-select: none;
}
.ss-filter-title-active { color: var(--accent); }
.ss-filter-count { font-size: 11px; font-weight: 400; color: var(--accent); }
.ss-filter-arrow { font-size: 10px; margin-left: auto; color: var(--text-dimmer); }
.ss-filter-chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 4px 0 8px; }

/* ===== CHIP ===== */
.chip {
  display: inline-block; padding: 6px 14px; border: 1.5px solid var(--border);
  border-radius: 20px; font-size: 13px; cursor: pointer; background: var(--surface);
  color: var(--text); transition: border-color 0.15s;
}
.chip.active { border-color: var(--accent); background: var(--accent-glow); color: var(--accent); font-weight: 600; }

/* ===== FILTER PANEL ===== */
.filter-category { margin-bottom: 16px; }
.filter-category-title { font-weight: 700; font-size: 14px; margin-bottom: 8px; color: var(--text); }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ===== MY LIST ===== */
.mylist-header { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.btn-mylist-new {
  background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.mylist-item {
  display: flex; align-items: center; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 6px; cursor: pointer; gap: 12px;
}
.mylist-item-name { flex: 1; font-weight: 600; }
.mylist-item-count { font-size: 13px; color: var(--text-dim); }
.mylist-delete-btn {
  background: none; border: none; color: var(--red); font-size: 18px; cursor: pointer;
  padding: 4px 8px;
}

/* ===== IDIOM REVIEW ===== */
.ir-card {
  padding: 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 6px; cursor: pointer;
}
.ir-top { display: flex; align-items: center; gap: 10px; }
.ir-num { font-size: 12px; color: var(--text-dimmer); font-weight: 600; min-width: 28px; }
.ir-idiom { font-weight: 700; font-size: 14px; flex: 1; }
.ir-meaning { font-size: 12px; color: var(--text-dim); flex: 1; }
.ir-bar-wrap { width: 60px; height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.ir-bar { height: 100%; border-radius: 3px; }
.ir-pct { font-size: 12px; font-weight: 600; color: var(--text-dim); width: 36px; text-align: right; }

/* ===== SETTINGS ===== */
.settings-group { margin-bottom: 20px; }
.settings-label { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.settings-row { display: flex; align-items: center; gap: 12px; }
.settings-range { flex: 1; }
.settings-val { font-size: 14px; font-weight: 600; min-width: 60px; text-align: right; }
.theme-dots { display: flex; gap: 12px; }
.theme-dot {
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: border-color 0.2s;
}
.theme-dot.active { border-color: var(--accent); }
.theme-dot[data-theme="cream"] { background: #f7f3eb; border: 2px solid #d4c9b5; }
.theme-dot[data-theme="paper"] { background: #f0f0ec; border: 2px solid #c8c8c4; }
.theme-dot[data-theme="sage"] { background: #e8efe5; border: 2px solid #b0c4a8; }
.theme-dot[data-theme="ocean"] { background: #e3edf7; border: 2px solid #a0bfe0; }
.theme-dot[data-theme="lavender"] { background: #ece5f0; border: 2px solid #beb0c8; }
.theme-dot[data-theme="dark"] { background: #1a1b1e; border: 2px solid #4a4c52; }
.theme-dot.active[data-theme="cream"] { border-color: #b8860b; }
.theme-dot.active[data-theme="paper"] { border-color: #2962ff; }
.theme-dot.active[data-theme="sage"] { border-color: #2e7d32; }
.theme-dot.active[data-theme="ocean"] { border-color: #1565c0; }
.theme-dot.active[data-theme="lavender"] { border-color: #6a1b9a; }
.theme-dot.active[data-theme="dark"] { border-color: #7caef8; }

/* ===== FLASHCARD ===== */
.fc-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;
}
.fc-progress { font-size: 14px; font-weight: 600; color: var(--text-dim); }
.fc-direction-toggle { display: flex; gap: 4px; }
.fc-card-wrapper { perspective: 1000px; margin-bottom: 24px; }
.fc-card {
  position: relative; width: 100%; min-height: 260px; cursor: pointer;
  transform-style: preserve-3d; transition: transform 0.5s ease;
}
.fc-card.flipped { transform: rotateY(180deg); }
.fc-card-front, .fc-card-back {
  position: absolute; width: 100%; min-height: 260px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--surface); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 32px 24px; text-align: center;
}
.fc-card-back { transform: rotateY(180deg); }
.fc-text { font-size: 24px; font-weight: 600; line-height: 1.5; word-break: break-word; margin-bottom: 12px; }
.fc-meta { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.fc-hint { font-size: 11px; color: var(--text-dimmer); margin-top: auto; }
.fc-swipe-hints { display: flex; justify-content: space-between; width: 100%; margin-top: auto; padding-top: 12px; }
.fc-swipe-hint { font-size: 12px; color: var(--text-dimmer); }
.fc-hint-left { color: var(--green); }
.fc-hint-right { color: var(--red); }
@media (max-width: 520px) {
  .fc-text { font-size: 20px; }
  .fc-card-front, .fc-card-back { min-height: 220px; padding: 24px 16px; }
}

/* ===== LOADING ===== */
.loading-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.3); display: none;
  align-items: center; justify-content: center;
}
.loading-box {
  background: var(--surface); border-radius: var(--radius);
  padding: 32px; text-align: center;
  box-shadow: 0 4px 24px var(--shadow);
}
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 14px; color: var(--text-dim); }

/* ===== TOAST ===== */
.toast-container {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 10000; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  background: var(--green); color: #fff; padding: 10px 20px;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  opacity: 0; transition: opacity 0.3s;
}
.toast.show { opacity: 1; }
.toast.toast-error { background: var(--red); }

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .quiz-type-grid { grid-template-columns: 1fr 1fr; }
  .question-text { font-size: 17px; }
}
@media (min-width: 768px) {
  .choices-grid { grid-template-columns: repeat(4, 1fr); }
}
