* { box-sizing: border-box; margin: 0; padding: 0; }
button, .lesson-chip, .type-chip, .card-scene, .vocab-list-header, .filter-header {
  touch-action: manipulation;
}

body {
  font-family: 'Inter', sans-serif;
  background: #f0f4f8;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 48px;
  color: #1a202c;
  transition: background 0.25s, color 0.25s;
}

h1 { font-size: 1.5rem; margin-bottom: 4px; color: #2d3748; text-align: center; }
.subtitle { font-size: 0.88rem; color: #718096; margin-bottom: 20px; text-align: center; }

/* Header row with settings button */
.header-row {
  position: relative; width: 100%; max-width: 580px;
  display: flex; justify-content: center; align-items: center;
  margin-bottom: 4px;
}
.header-row h1 { flex: 1; }
.settings-btn {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  font-size: 1.3rem; color: #a0aec0; transition: color 0.2s, transform 0.2s;
  padding: 4px 6px; border-radius: 8px;
}
.settings-btn:hover { color: #4a5568; transform: translateY(-50%) rotate(30deg); }
/* Settings-btn inside header-actions: reset absolute positioning */
.header-actions .settings-btn {
  position: static; transform: none;
}
.header-actions .settings-btn:hover { transform: rotate(30deg); }

/* Filter panel */
.filter-panel {
  width: 100%;
  max-width: 580px;
  background: white;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  margin-bottom: 18px;
  overflow: hidden;
}
.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  cursor: pointer;
  user-select: none;
  gap: 10px;
}
.filter-header:hover { background: #f7fafc; }
.filter-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #4a5568;
  letter-spacing: 0.3px;
}
.filter-summary {
  font-size: 0.78rem;
  color: #718096;
  flex: 1;
  text-align: center;
}
.filter-chevron {
  font-size: 0.75rem;
  color: #a0aec0;
  transition: transform 0.2s;
}
.filter-chevron.open { transform: rotate(180deg); }
.filter-body {
  display: none;
  padding: 10px 14px 14px;
  border-top: 1px solid #e2e8f0;
}
.filter-body.open { display: block; }
.filter-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.filter-ctrl-btn {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid #cbd5e0;
  background: white;
  color: #4a5568;
  transition: all 0.15s;
}
.filter-ctrl-btn:hover { border-color: #2b6cb0; color: #2b6cb0; }
.lesson-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.lesson-chip {
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid #cbd5e0;
  background: white;
  color: #718096;
  transition: all 0.15s;
  white-space: nowrap;
  user-select: none;
}
.lesson-chip.selected {
  background: #2b6cb0;
  border-color: #2b6cb0;
  color: white;
}
.lesson-chip:hover:not(.selected) { border-color: #90cdf4; color: #2b6cb0; }

/* Type chips — distinct color per type */
.type-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.filter-section-label {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: #a0aec0; margin: 10px 0 6px;
}
.type-chip {
  padding: 5px 13px; border-radius: 999px; font-size: 0.78rem;
  font-weight: 700; cursor: pointer; border: 2px solid #cbd5e0;
  background: white; color: #718096;
  transition: all 0.15s; white-space: nowrap; user-select: none;
}
.type-chip.selected { color: white; }
.type-chip[data-type="Substantiv"].selected  { background: #2b6cb0; border-color: #2b6cb0; }
.type-chip[data-type="Verb"].selected         { background: #276749; border-color: #276749; }
.type-chip[data-type="Adjektiv"].selected     { background: #744210; border-color: #744210; }
.type-chip[data-type="Adverb"].selected       { background: #553c9a; border-color: #553c9a; }
.type-chip[data-type="Pronomen"].selected     { background: #97266d; border-color: #97266d; }
.type-chip[data-type="Ausdruck"].selected     { background: #c05621; border-color: #c05621; }
.type-chip[data-type="Partikel"].selected     { background: #2c7a7b; border-color: #2c7a7b; }

.type-chip[data-type="Substantiv"]:hover:not(.selected)  { border-color: #90cdf4; color: #2b6cb0; }
.type-chip[data-type="Verb"]:hover:not(.selected)         { border-color: #68d391; color: #276749; }
.type-chip[data-type="Adjektiv"]:hover:not(.selected)     { border-color: #f6ad55; color: #744210; }
.type-chip[data-type="Adverb"]:hover:not(.selected)       { border-color: #b794f4; color: #553c9a; }
.type-chip[data-type="Pronomen"]:hover:not(.selected)     { border-color: #f687b3; color: #97266d; }
.type-chip[data-type="Ausdruck"]:hover:not(.selected)     { border-color: #fbd38d; color: #c05621; }
.type-chip[data-type="Partikel"]:hover:not(.selected)     { border-color: #81e6d9; color: #2c7a7b; }

/* Card area */
.card-area {
  width: 100%;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.progress-bar-wrap { width: 100%; background: #e2e8f0; border-radius: 999px; height: 6px; }
.progress-bar-fill { height: 6px; border-radius: 999px; background: #2b6cb0; transition: width 0.3s; }
.progress-label { font-size: 0.8rem; color: #718096; text-align: right; width: 100%; margin-top: 4px; }

/* Flashcard */
.card-scene { width: 100%; height: 290px; perspective: 900px; cursor: pointer; overflow: hidden; border-radius: 18px; }
.card-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4,0,0.2,1);
}
.card-scene.flipped .card-inner { transform: rotateY(180deg); }

.card-face {
  position: absolute; width: 100%; height: 100%;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 18px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 28px 32px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.10);
  gap: 12px;
}
.card-front { background: white; }
.card-back  { background: #ebf4ff; transform: rotateY(180deg); }

.card-label { font-size: 0.7rem; letter-spacing: 1.2px; text-transform: uppercase; font-weight: 700; color: #a0aec0; }
.card-front .card-label { color: #90cdf4; }
.card-back  .card-label { color: #76b3e8; }

.arabic-main {
  font-size: 2.7rem; direction: rtl; text-align: center;
  line-height: 1.8; color: #1a365d;
  font-family: 'Noto Naskh Arabic',serif;
}
.arabic-sub {
  font-size: 1.25rem; direction: rtl; text-align: center;
  color: #4a6fa5; line-height: 1.7;
  font-family: 'Noto Naskh Arabic',serif;
}
.arabic-note {
  font-size: 0.78rem; text-align: center; color: #718096;
  background: #edf2f7; border-radius: 6px; padding: 3px 10px;
  font-family: 'Noto Naskh Arabic',serif;
  direction: ltr;
}
.german-main { font-size: 1.5rem; font-weight: 700; text-align: center; color: #1a365d; }
.german-sub  { font-size: 0.92rem; text-align: center; color: #4a6fa5; }
.hint { font-size: 0.75rem; color: #b0b8c8; margin-top: 4px; text-align: center; }
.type-badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700;
  background: #bee3f8; color: #2b6cb0; letter-spacing: 0.5px;
}
.lesson-badge {
  position: absolute; top: 14px; right: 18px;
  font-size: 0.68rem; font-weight: 700;
  color: #90cdf4; letter-spacing: 0.5px;
}

/* Direction toggle */
.dir-row { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.dir-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 999px; font-size: 0.8rem;
  font-weight: 700; cursor: pointer; border: 2px solid #e2e8f0;
  background: white; color: #718096; transition: all 0.2s;
  letter-spacing: 0.3px;
}
.dir-btn:hover { border-color: #2b6cb0; color: #2b6cb0; }
.dir-btn.de-ar { border-color: #48bb78; background: #f0fff4; color: #276749; }
.dir-btn.ar-de { border-color: #ed8936; background: #fffaf0; color: #7b341e; }
.dir-label { font-size: 0.75rem; color: #a0aec0; }

/* Nav */
.nav { display: flex; gap: 10px; align-items: center; }
.nav-btn {
  padding: 10px 20px; border-radius: 10px; font-size: 0.88rem;
  font-weight: 600; cursor: pointer; border: none;
  background: #2b6cb0; color: white; transition: background 0.18s, transform 0.1s;
}
.nav-btn:hover { background: #2c5282; }
.nav-btn:active { transform: scale(0.96); }
.nav-btn:disabled { background: #cbd5e0; cursor: default; }
.flip-btn {
  padding: 10px 20px; border-radius: 10px; font-size: 0.88rem;
  font-weight: 600; cursor: pointer;
  border: 2px solid #2b6cb0; background: white; color: #2b6cb0;
  transition: all 0.18s;
}
.flip-btn:hover { background: #ebf4ff; }

/* Shuffle */
.shuffle-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 999px; font-size: 0.8rem;
  font-weight: 700; cursor: pointer; border: 2px solid #e2e8f0;
  background: white; color: #718096; transition: all 0.2s;
  letter-spacing: 0.3px;
}
.shuffle-btn:hover { border-color: #805ad5; color: #553c9a; }
.shuffle-btn.active { border-color: #805ad5; background: #faf5ff; color: #553c9a; }

/* Vocab list */
.vocab-list { width: 100%; max-width: 580px; margin-top: 20px; }
.vocab-list-header {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: #a0aec0; margin-bottom: 10px;
  text-align: center; cursor: pointer; user-select: none;
}
.vocab-list-header:hover { color: #718096; }
.vocab-items { display: none; }
.vocab-items.open { display: block; }
.lesson-heading {
  font-size: 0.75rem; font-weight: 700; color: #a0aec0;
  text-transform: uppercase; letter-spacing: 1px;
  margin: 16px 0 6px; text-align: center;
}
.vocab-item {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 8px 14px; border-radius: 8px;
  background: white; margin-bottom: 5px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06); gap: 12px;
}
.vi-arabic {
  font-size: 1.15rem; direction: rtl; flex-shrink: 0;
  font-family: 'Noto Naskh Arabic',serif;
  color: #1a365d;
}
.vi-german { font-size: 0.86rem; color: #4a5568; text-align: right; }

/* ── Settings modal ────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 100;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white; border-radius: 18px;
  width: min(360px, 92vw); padding: 26px 24px 22px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  animation: modal-in 0.18s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.93); }
  to   { opacity: 1; transform: scale(1); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 1rem; font-weight: 700; color: #2d3748; }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.2rem; color: #a0aec0; line-height: 1;
  padding: 2px 6px; border-radius: 6px; transition: color 0.15s;
}
.modal-close:hover { color: #4a5568; }
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-top: 1px solid #e2e8f0;
}
.setting-label { font-size: 0.88rem; color: #4a5568; font-weight: 600; }
.setting-desc  { font-size: 0.75rem; color: #a0aec0; margin-top: 2px; }

/* Toggle switch */
.toggle-wrap { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-wrap input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0; border-radius: 999px;
  background: #cbd5e0; cursor: pointer; transition: background 0.2s;
}
.toggle-track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: white; transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle-wrap input:checked + .toggle-track { background: #2b6cb0; }
.toggle-wrap input:checked + .toggle-track::after { transform: translateX(20px); }

/* ── Dark mode ─────────────────────────────────────────────────── */
body.dark { background: #111827; color: #e2e8f0; }
body.dark h1 { color: #e2e8f0; }
body.dark .subtitle { color: #718096; }
body.dark .settings-btn { color: #4a5568; }
body.dark .settings-btn:hover { color: #a0aec0; }

body.dark .filter-panel { background: #1f2937; box-shadow: 0 2px 12px rgba(0,0,0,0.3); }
body.dark .filter-header:hover { background: #27303f; }
body.dark .filter-title { color: #a0aec0; }
body.dark .filter-summary { color: #718096; }
body.dark .filter-chevron { color: #4a5568; }
body.dark .filter-body { border-top-color: #374151; }
body.dark .filter-ctrl-btn { background: #1f2937; border-color: #374151; color: #a0aec0; }
body.dark .filter-ctrl-btn:hover { border-color: #63b3ed; color: #90cdf4; }
body.dark .filter-section-label { color: #4a5568; }
body.dark .lesson-chip { background: #1f2937; border-color: #374151; color: #718096; }
body.dark .lesson-chip.selected { background: #2b6cb0; border-color: #2b6cb0; color: white; }
body.dark .lesson-chip:hover:not(.selected) { border-color: #4299e1; color: #90cdf4; }
body.dark .type-chip { background: #1f2937; border-color: #374151; color: #9ca3af; }
body.dark .type-chip.selected { color: white; }

body.dark .progress-bar-wrap { background: #374151; }
body.dark .progress-label { color: #718096; }

body.dark .dir-btn { background: #1f2937; border-color: #374151; color: #718096; }
body.dark .dir-btn.de-ar { background: #1a2e22; border-color: #276749; color: #68d391; }
body.dark .dir-btn.ar-de { background: #2d1f0e; border-color: #c05621; color: #fbd38d; }
body.dark .shuffle-btn { background: #1f2937; border-color: #374151; color: #718096; }
body.dark .shuffle-btn.active { background: #1e1a2e; border-color: #805ad5; color: #b794f4; }

body.dark .card-front { background: #1f2937; box-shadow: 0 4px 20px rgba(0,0,0,0.35); }
body.dark .card-back  { background: #1e3a5f; box-shadow: 0 4px 20px rgba(0,0,0,0.35); }
body.dark .card-front .card-label { color: #4a6fa5; }
body.dark .card-back  .card-label { color: #4a6fa5; }
body.dark .arabic-main { color: #bee3f8; }
body.dark .arabic-sub  { color: #90cdf4; }
body.dark .arabic-note { background: #2d3748; color: #a0aec0; }
body.dark .german-main { color: #e2e8f0; }
body.dark .german-sub  { color: #90cdf4; }
body.dark .hint { color: #4a5568; }
body.dark .type-badge { background: #2c5282; color: #bee3f8; }
body.dark .lesson-badge { color: #4a6fa5; }

body.dark .nav-btn { background: #2b6cb0; }
body.dark .nav-btn:hover { background: #2c5282; }
body.dark .nav-btn:disabled { background: #2d3748; color: #4a5568; }
body.dark .flip-btn { background: #1f2937; border-color: #2b6cb0; color: #90cdf4; }
body.dark .flip-btn:hover { background: #1e3a5f; }

body.dark .vocab-list-header { color: #4a5568; }
body.dark .vocab-list-header:hover { color: #718096; }
body.dark .lesson-heading { color: #4a5568; }
body.dark .vocab-item { background: #1f2937; box-shadow: 0 1px 4px rgba(0,0,0,0.2); }
body.dark .vi-arabic { color: #bee3f8; }
body.dark .vi-german { color: #a0aec0; }

body.dark .modal { background: #1f2937; }
body.dark .modal-title { color: #e2e8f0; }
body.dark .modal-close { color: #4a5568; }
body.dark .modal-close:hover { color: #a0aec0; }
body.dark .setting-row { border-top-color: #374151; }
body.dark .setting-label { color: #a0aec0; }

/* ── Arabic font switcher ──────────────────────────────────────── */
.setting-row.col { flex-direction: column; align-items: flex-start; gap: 10px; }
.font-chips { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; }
.font-chip {
  flex: 1; min-width: 90px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 10px; border-radius: 10px; cursor: pointer;
  border: 2px solid #e2e8f0; background: white; transition: all 0.15s;
}
.font-chip:hover { border-color: #90cdf4; }
.font-chip.active { border-color: #2b6cb0; background: #ebf4ff; }
.font-chip-name { font-size: 0.7rem; font-weight: 700; color: #718096; letter-spacing: 0.3px; }
.font-chip.active .font-chip-name { color: #2b6cb0; }
.font-chip-preview { font-size: 1.35rem; direction: rtl; color: #1a365d; line-height: 1.6; }

body.dark .font-chip { background: #111827; border-color: #374151; }
body.dark .font-chip:hover { border-color: #4299e1; }
body.dark .font-chip.active { border-color: #2b6cb0; background: #1e3a5f; }
body.dark .font-chip-name { color: #718096; }
body.dark .font-chip.active .font-chip-name { color: #90cdf4; }
body.dark .font-chip-preview { color: #bee3f8; }

/* ── Arabic font overrides ─────────────────────────────────────── */
body.arabic-amiri .arabic-main,
body.arabic-amiri .arabic-sub,
body.arabic-amiri .arabic-note,
body.arabic-amiri .vi-arabic { font-family: 'Amiri', serif; }

body.arabic-cairo .arabic-main,
body.arabic-cairo .arabic-sub,
body.arabic-cairo .arabic-note,
body.arabic-cairo .vi-arabic { font-family: 'Cairo', sans-serif; }

/* ── Card flash animations ──────────────────────────────────────── */
@keyframes flash-correct {
  0%   { box-shadow: 0 0 0 0px #48bb78, 0 4px 20px rgba(0,0,0,0.10); }
  30%  { box-shadow: 0 0 0 5px #48bb78, 0 4px 20px rgba(0,0,0,0.10); }
  100% { box-shadow: 0 0 0 0px #48bb78, 0 4px 20px rgba(0,0,0,0.10); }
}
@keyframes flash-wrong {
  0%   { box-shadow: 0 0 0 0px #f56565, 0 4px 20px rgba(0,0,0,0.10); }
  30%  { box-shadow: 0 0 0 5px #f56565, 0 4px 20px rgba(0,0,0,0.10); }
  100% { box-shadow: 0 0 0 0px #f56565, 0 4px 20px rgba(0,0,0,0.10); }
}
.card-scene.flash-correct .card-face { animation: flash-correct 0.5s ease-out forwards; }
.card-scene.flash-wrong   .card-face { animation: flash-wrong   0.5s ease-out forwards; }

/* ── Mode Toggle ────────────────────────────────────────────────── */
.mode-toggle-row {
  display: flex; gap: 0; width: 100%;
  background: #e2e8f0; border-radius: 12px; padding: 3px;
  margin-bottom: 4px;
}
.mode-btn {
  flex: 1; padding: 8px 16px; border-radius: 9px;
  font-size: 0.85rem; font-weight: 700; cursor: pointer;
  border: none; background: transparent; color: #718096;
  transition: all 0.2s; letter-spacing: 0.3px;
}
.mode-btn.active { background: white; color: #2d3748; box-shadow: 0 1px 4px rgba(0,0,0,0.12); }
body.dark .mode-toggle-row { background: #374151; }
body.dark .mode-btn { color: #6b7280; }
body.dark .mode-btn.active { background: #1f2937; color: #e2e8f0; }

/* ── Quiz buttons ───────────────────────────────────────────────── */
.quiz-show-btn {
  padding: 12px 40px; border-radius: 12px; font-size: 0.95rem;
  font-weight: 700; cursor: pointer; border: 2px solid #2b6cb0;
  background: white; color: #2b6cb0; transition: all 0.18s;
}
.quiz-show-btn:hover { background: #ebf4ff; }
body.dark .quiz-show-btn { background: #1f2937; border-color: #2b6cb0; color: #90cdf4; }
body.dark .quiz-show-btn:hover { background: #1e3a5f; }

.quiz-eval-row { display: flex; gap: 12px; width: 100%; }
.quiz-btn {
  flex: 1; padding: 13px 16px; border-radius: 12px; font-size: 1rem;
  font-weight: 700; cursor: pointer; border: none; transition: all 0.18s;
}
.quiz-btn:active { transform: scale(0.96); }
.quiz-btn-correct { background: #48bb78; color: white; }
.quiz-btn-correct:hover { background: #38a169; }
.quiz-btn-wrong { background: #f56565; color: white; }
.quiz-btn-wrong:hover { background: #e53e3e; }

.quiz-end-msg { text-align: center; padding: 8px 0; }
.quiz-end-title { font-size: 1.05rem; font-weight: 700; color: #2d3748; margin-bottom: 6px; }
.quiz-end-sub { font-size: 0.85rem; color: #718096; margin-bottom: 12px; }
.quiz-restart-btn {
  padding: 9px 24px; border-radius: 10px; font-size: 0.88rem;
  font-weight: 700; cursor: pointer; border: 2px solid #2b6cb0;
  background: white; color: #2b6cb0; transition: all 0.18s;
}
.quiz-restart-btn:hover { background: #ebf4ff; }
body.dark .quiz-end-title { color: #e2e8f0; }
body.dark .quiz-restart-btn { background: #1f2937; color: #90cdf4; border-color: #2b6cb0; }
body.dark .quiz-restart-btn:hover { background: #1e3a5f; }

/* ── Wrong cards banner ─────────────────────────────────────────── */
.wrong-banner {
  width: 100%; background: #fff5f5; border: 1.5px solid #feb2b2;
  border-radius: 12px; padding: 10px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.wrong-banner-left { display: flex; align-items: center; gap: 8px; }
.wrong-banner-label { font-size: 0.85rem; font-weight: 700; color: #c53030; }
.wrong-banner-count {
  background: #fed7d7; color: #c53030; border-radius: 999px;
  padding: 2px 9px; font-size: 0.8rem; font-weight: 700;
}
.wrong-banner-actions { display: flex; gap: 7px; flex-shrink: 0; }
.wrong-action-btn {
  padding: 5px 12px; border-radius: 999px; font-size: 0.75rem;
  font-weight: 700; cursor: pointer; transition: all 0.15s; border: 1.5px solid;
}
.wrong-action-btn.practice { border-color: #c53030; color: #c53030; background: white; }
.wrong-action-btn.practice:hover { background: #fff5f5; }
.wrong-action-btn.clear { border-color: #cbd5e0; color: #718096; background: white; }
.wrong-action-btn.clear:hover { border-color: #a0aec0; }
body.dark .wrong-banner { background: #2d1515; border-color: #742a2a; }
body.dark .wrong-banner-label { color: #fc8181; }
body.dark .wrong-banner-count { background: #742a2a; color: #fc8181; }
body.dark .wrong-action-btn.practice { border-color: #fc8181; color: #fc8181; background: #2d1515; }
body.dark .wrong-action-btn.clear { border-color: #374151; color: #718096; background: #1f2937; }

/* Wrong-only indicator */
.wrong-only-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px; font-size: 0.78rem; font-weight: 700;
  background: #fed7d7; color: #c53030; border: 1.5px solid #feb2b2;
}
.wrong-only-chip button {
  background: none; border: none; cursor: pointer;
  color: #c53030; font-size: 0.85rem; padding: 0; line-height: 1; font-weight: 700;
}
body.dark .wrong-only-chip { background: #742a2a; color: #fc8181; border-color: #c53030; }
body.dark .wrong-only-chip button { color: #fc8181; }

/* ── Tutorial ───────────────────────────────────────────────────── */
.tut-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.55);
  transition: opacity 0.25s;
}
.tut-overlay.hidden { display: none; }

.tut-spotlight {
  position: absolute; border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.55);
  transition: top 0.35s ease, left 0.35s ease, width 0.35s ease, height 0.35s ease;
  pointer-events: none;
  z-index: 201;
}

.tut-tooltip {
  position: absolute; z-index: 202;
  background: white; border-radius: 14px;
  padding: 18px 20px 14px; width: min(340px, 88vw);
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  animation: tut-pop 0.25s ease;
}
@keyframes tut-pop {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tut-step-label {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: #90cdf4; margin-bottom: 6px;
}
.tut-title {
  font-size: 1rem; font-weight: 700; color: #2d3748; margin-bottom: 6px;
}
.tut-desc {
  font-size: 0.85rem; color: #4a5568; line-height: 1.5; margin-bottom: 16px;
}
.tut-actions {
  display: flex; align-items: center; justify-content: space-between;
}
.tut-skip {
  background: none; border: none; cursor: pointer;
  font-size: 0.78rem; color: #a0aec0; font-weight: 600;
  padding: 4px 0; transition: color 0.15s;
}
.tut-skip:hover { color: #718096; }
.tut-next {
  padding: 8px 22px; border-radius: 10px; font-size: 0.85rem;
  font-weight: 700; cursor: pointer; border: none;
  background: #2b6cb0; color: white; transition: background 0.15s;
}
.tut-next:hover { background: #2c5282; }
.tut-dots {
  display: flex; gap: 5px; align-items: center;
}
.tut-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #cbd5e0; transition: background 0.2s;
}
.tut-dot.active { background: #2b6cb0; }

body.dark .tut-tooltip { background: #1f2937; }
body.dark .tut-title { color: #e2e8f0; }
body.dark .tut-desc { color: #a0aec0; }
body.dark .tut-skip { color: #4a5568; }
body.dark .tut-skip:hover { color: #718096; }
body.dark .tut-dot { background: #374151; }
body.dark .tut-dot.active { background: #63b3ed; }

/* ─── App content wrapper ──────────────────────────────────────────────────── */
#app-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ─── Auth Overlay ─────────────────────────────────────────────────────────── */
.auth-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: #f0f4f8;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
}
.auth-modal {
  background: white;
  border-radius: 20px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.10);
  padding: 32px 28px 28px;
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 0;
}
.auth-header { text-align: center; margin-bottom: 24px; }
.auth-logo {
  font-size: 1.8rem; font-weight: 700; color: #2d3748;
  margin-bottom: 4px;
}
.auth-subtitle { font-size: 0.85rem; color: #718096; }

.auth-error {
  font-size: 0.82rem; color: #c53030;
  background: #fff5f5; border: 1px solid #fed7d7;
  border-radius: 8px; padding: 8px 12px;
  margin-bottom: 12px; display: none;
}
.auth-error:not(:empty) { display: block; }

.auth-input {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid #e2e8f0; border-radius: 10px;
  font-size: 0.95rem; font-family: 'Inter', sans-serif;
  color: #2d3748; background: #f7fafc;
  outline: none; transition: border-color 0.2s;
  margin-bottom: 10px; display: block;
}
.auth-input:focus { border-color: #2b6cb0; background: white; }

.auth-btn-primary {
  width: 100%; padding: 12px;
  background: #2b6cb0; color: white;
  border: none; border-radius: 10px;
  font-size: 0.95rem; font-weight: 700;
  cursor: pointer; transition: background 0.2s;
  margin-bottom: 0;
}
.auth-btn-primary:hover { background: #2c5282; }

.auth-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 0;
  color: #a0aec0; font-size: 0.8rem;
}
.auth-divider::before,
.auth-divider::after {
  content: ''; flex: 1; height: 1px; background: #e2e8f0;
}

.auth-btn-google {
  width: 100%; padding: 11px;
  background: white; color: #2d3748;
  border: 1.5px solid #e2e8f0; border-radius: 10px;
  font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: border-color 0.2s, background 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-family: 'Inter', sans-serif;
}
.auth-btn-google:hover { border-color: #a0aec0; background: #f7fafc; }

.auth-switch {
  text-align: center; margin-top: 16px;
  font-size: 0.85rem; color: #718096;
}
.auth-switch a {
  color: #2b6cb0; font-weight: 600; text-decoration: none;
}
.auth-switch a:hover { text-decoration: underline; }

/* ─── Header with logout ───────────────────────────────────────────────────── */
.header-actions {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; gap: 6px;
}
.user-display {
  font-size: 0.75rem; color: #a0aec0;
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.logout-btn {
  background: none; border: 1px solid #e2e8f0; cursor: pointer;
  font-size: 0.72rem; color: #a0aec0; font-weight: 600;
  padding: 3px 8px; border-radius: 6px; transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}
.logout-btn:hover { color: #4a5568; border-color: #a0aec0; }

/* Dark mode for auth */
body.dark .auth-overlay { background: #111827; }
body.dark .auth-modal { background: #1f2937; box-shadow: 0 4px 32px rgba(0,0,0,0.4); }
body.dark .auth-logo { color: #e2e8f0; }
body.dark .auth-input { background: #111827; border-color: #374151; color: #e2e8f0; }
body.dark .auth-input:focus { border-color: #63b3ed; background: #1a202c; }
body.dark .auth-btn-google { background: #111827; border-color: #374151; color: #e2e8f0; }
body.dark .auth-btn-google:hover { background: #1a202c; }
body.dark .auth-divider { color: #4a5568; }
body.dark .auth-divider::before, body.dark .auth-divider::after { background: #374151; }
body.dark .logout-btn { border-color: #374151; }
body.dark .logout-btn:hover { color: #a0aec0; border-color: #4a5568; }
