/* Self-hosted Noto Sans Hebrew (variable weight, Hebrew + nikud only; see
   fonts/OFL.txt). unicode-range keeps it to Hebrew characters, so Latin and
   Cyrillic text still use the system UI font. Vowel-mark placement in the
   default system fonts varies a lot between platforms. */
@font-face {
  font-family: 'Noto Sans Hebrew';
  src: url('../fonts/noto-sans-hebrew.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0590-05FF, U+FB1D-FB4F, U+25CC;
}

:root {
  font-size: 16px;
  color-scheme: light dark;
  --bg: #f6f5f1;
  --card-bg: #ffffff;
  --text: #1f2320;
  --text-muted: #6b6f6a;
  --accent: #2f6b4f;
  --accent-hover: #245a41;
  --border: #e1ded4;
  --correct: #2f6b4f;
  --incorrect: #b3432b;
  --tag-bg: #ece8dd;
  --on-accent: #ffffff;
  --radius: 12px;
  --lg-bg: #0b6e5f;
  --lg-ink: #14213d;
  --lg-teal: #0b6e5f;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16181a;
    --card-bg: #1f2225;
    --text: #eceae4;
    --text-muted: #9a9d97;
    --accent: #4f9c74;
    --accent-hover: #5cb385;
    --border: #313530;
    --correct: #4f9c74;
    --incorrect: #d97a5f;
    --tag-bg: #2a2d28;
    --on-accent: #0e100f;
    --lg-bg: #0f8a76;
    --lg-ink: #ffffff;
    --lg-teal: #4fd1b5;
  }
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #16181a;
  --card-bg: #1f2225;
  --text: #eceae4;
  --text-muted: #9a9d97;
  --accent: #4f9c74;
  --accent-hover: #5cb385;
  --border: #313530;
  --correct: #4f9c74;
  --incorrect: #d97a5f;
  --tag-bg: #2a2d28;
  --on-accent: #0e100f;
  --lg-bg: #0f8a76;
  --lg-ink: #ffffff;
  --lg-teal: #4fd1b5;
}


* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans Hebrew', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  /* The footer sits at the bottom of the window when the page is short. */
  display: flex;
  flex-direction: column;
}
.hidden { display: none !important; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.topbar-titles h1 { margin: 0; line-height: 0; }
/* Poaling logo: symbol + wordmark. Colours follow the theme (reversed on dark). */
.logo { height: 42px; width: auto; display: block; }
.symbol { height: 1.15em; width: 1.15em; vertical-align: -0.25em; }
#aboutTitle { margin: 0 0 12px; line-height: 0; }
#aboutTitle .logo { height: 40px; }
/* Colours come from custom properties on :root: they inherit into the <use> copies,
   whereas theme/media selectors do not reach inside them. */
.lg-bg { fill: var(--lg-bg); }
.lg-ink { fill: var(--lg-ink); }
.lg-teal { fill: var(--lg-teal); }
.subtitle { margin: 2px 0 0; color: var(--text-muted); font-size: 0.85rem; }
.topbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 480px) {
  .topbar { padding: 12px 16px; gap: 8px; }
  .logo { height: 34px; }
  .subtitle { display: none; }
  .topbar-actions { flex-wrap: nowrap; width: 100%; gap: 6px; }
  .topbar-actions .btn { flex: 1 1 auto; min-width: 0; padding-left: 8px; padding-right: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* Settings shrinks to its ⚙ icon; the label stays for screen readers. */
  #settingsBtn { flex: 0 0 auto; min-width: 44px; }
  #settingsBtn [data-i18n] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

.main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.root-task-card { text-align: center; }
.root-header {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.root-display {
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.root-gizra-wrap { color: var(--text-muted); font-size: 0.85rem; display: flex; align-items: center; gap: 4px; }
.root-task-card .label { text-align: left; }
.root-task-card .task-text { text-align: left; }
.label { color: var(--text-muted); font-size: 0.8rem; }
.tag {
  background: var(--tag-bg);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.8rem;
}
.tag-verified { background: color-mix(in srgb, var(--correct) 16%, transparent); color: var(--correct); font-weight: 600; white-space: nowrap; cursor: help; }

.task-text {
  font-size: 1.05rem;
  margin: 8px 0 16px;
  font-weight: 500;
}
.answer-input {
  width: 100%;
  font-size: 1.3rem;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  margin-bottom: 10px;
}
.answer-input:focus { outline: 2px solid var(--accent); }
.answer-input::placeholder { font-size: 1rem; }
.answer-note { color: var(--text-muted); font-size: 0.78rem; text-align: right; margin: -4px 2px 12px; }

.task-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-actions-left, .task-actions-right { display: flex; gap: 8px; }
.btn.active { border-color: var(--accent); color: var(--accent); }
.hint-pattern { font-size: 1.35rem; font-weight: 600; color: var(--text); letter-spacing: 0.02em; }
.hint-text { margin-top: 10px; color: var(--text-muted); font-size: 0.9rem; }

.result-card { border-left: 4px solid var(--border); }
.result-card.result-correct { border-left-color: var(--correct); }
.result-card.result-incorrect { border-left-color: var(--incorrect); }
.result-status { font-weight: 700; font-size: 1.1rem; margin-bottom: 10px; }
.result-correct .result-status { color: var(--correct); }
.result-incorrect .result-status { color: var(--incorrect); }
.result-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.answer-nikud { font-size: 1.4rem; font-weight: 600; }
.example-text { font-size: 1.05rem; color: var(--text-muted); }
.diff-bad { color: var(--incorrect); background: color-mix(in srgb, var(--incorrect) 16%, transparent); border-radius: 3px; }
.rule-note { margin-top: 2px; }
.next-actions { display: flex; gap: 10px; margin-top: 14px; }
.next-actions .btn { flex: 1; }

.btn {
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { border-color: var(--accent); }
a.btn { display: inline-block; text-decoration: none; }
button { -webkit-tap-highlight-color: transparent; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { background: var(--tag-bg); }
.btn-ghost { background: transparent; }
.btn-small { padding: 4px 10px; font-size: 0.8rem; }
.btn:focus-visible, .mode-btn:focus-visible, .seg-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-danger { color: var(--incorrect); }
.btn-danger:hover { border-color: var(--incorrect); }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  z-index: 10;
}
.modal {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 22px;
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}
.modal h2 { margin-top: 0; padding-right: 36px; }
.modal-close-x {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close-x:hover { background: var(--tag-bg); color: var(--text); }
.filter-group { margin-bottom: 16px; }
.filter-group-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.filter-group-head-btns { display: flex; gap: 6px; }
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
  margin-top: 8px;
}
.check-item { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.field-group { margin-bottom: 14px; }
.field-group .label { display: block; margin-bottom: 6px; }
.error-text { color: var(--incorrect); }
.modal-divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.result-tools { display: flex; gap: 8px; margin-top: 4px; }
.btn-full-table { flex: 1; min-width: 0; }
#nikudToggleResult { white-space: nowrap; }

.modal-wide { max-width: 620px; }
.table-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.table-modal-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.table-content { margin-top: 10px; overflow-x: auto; }
.conj-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
  margin-bottom: 6px;
}
.conj-infinitive-box {
  background: var(--tag-bg);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.conj-infinitive-box .conj-title { margin-bottom: 0; }
.conj-infinitive-form { font-size: 1.3rem; }
.conj-table { width: 100%; border-collapse: collapse; }
/* Tense tabs only on narrow screens; there the table shows one tense column. */
.conj-tabs { display: none; margin-bottom: 8px; flex-wrap: wrap; }
@media (max-width: 560px) {
  .conj-tabs { display: inline-flex; }
  .conj-table [class*="col-"] { display: none; }
  .conj-table[data-tab="past"] .col-past,
  .conj-table[data-tab="present"] .col-present,
  .conj-table[data-tab="future"] .col-future,
  .conj-table[data-tab="imperative"] .col-imperative { display: table-cell; }
  /* Past/future/imperative don't vary by the speaker's gender: one אני / אנחנו row. */
  .conj-table:not([data-tab="present"]) .row-g-f { display: none; }
  .conj-table:not([data-tab="present"]) .gtag { display: none; }
  .conj-table[data-tab="imperative"] .row-no-imp { display: none; }
  .conj-table .conj-pronoun { width: 40%; }
}
.conj-table th, .conj-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.conj-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
}
.conj-pronoun {
  text-align: right;
  font-size: 1.05rem;
  color: var(--text-muted);
}
.conj-form { font-size: 1.05rem; font-weight: 600; }

@media (max-width: 480px) {
  .root-display { font-size: 2.1rem; }
  /* Phones: Check gets its own full-width row right under the answer, and
     Hint takes its place at the end of the second row (Nikud, New root, Hint). */
  .task-actions { flex-wrap: wrap; }
  .task-actions-left, .task-actions-right { display: contents; }
  .task-actions .btn { flex: 1 1 0; min-width: 0; }
  #checkBtn { order: -1; flex-basis: 100%; }
  #hintBtn { order: 1; }
  #keyboardBtn { order: 2; flex-basis: 100%; }
  .task-actions .nikud-toggle-task { flex: 0 0 auto; padding-left: 12px; padding-right: 12px; }
}

/* Mode switch: one row of tabs. When they don't fit (phones, longer
   Russian labels) the row scrolls sideways, with a fade on the clipped
   edge (.fade-start / .fade-end, set from app.js). */
.mode-switch {
  display: flex;
  width: max-content;
  max-width: 100%;
  margin: 0 auto 12px;
  background: var(--tag-bg);
  border-radius: 999px;
  padding: 3px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.mode-switch::-webkit-scrollbar { display: none; }
.mode-switch.fade-end { mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
.mode-switch.fade-start { mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); }
.mode-switch.fade-start.fade-end { mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
.mode-btn {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  scroll-snap-align: center;
}
.mode-btn.active { background: var(--card-bg); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.12); }
.review-badge-row { min-height: 0; margin-bottom: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
/* Nikud on/off on the task card, in every mode, left of New root (the result card has its own). */
.nikud-toggle-task { white-space: nowrap; }
/* The "Nikud" button: the dot inside the u (and the i's dot) show the state. */
.nikud-toggle { white-space: nowrap; transition: color .15s, background-color .15s, border-color .15s, box-shadow .15s; }
.nikud-word { font-weight: 500; font-size: 1.12em; letter-spacing: 0.03em; line-height: 1; }
/* In a 1em-tall box the baseline of Noto Sans (the app's font) sits ~0.89em
   down and its x-height ~0.54em above that, so 0.55em is the middle of the u's
   hollow; the u's right stem sits right of centre. */
.nk-u { position: relative; display: inline-block; line-height: 1; font-weight: 400; } /* a thinner u leaves room for its dot */
.nk-u.nk-dot::after {
  content: ''; position: absolute; left: 47%; top: 0.56em; width: 0.13em; height: 0.13em;
  border-radius: 50%; background: currentColor; transform: translate(-50%, -50%);
}
.nikud-toggle.nikud-on {
  color: var(--accent); border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 45%, transparent);
}
.no-candidates { margin: 12px 0; color: var(--text-muted); }
.tag-lock { display: inline-flex; align-items: center; gap: 4px; background: var(--tag-bg); font-weight: 600; }
.tag-lock bdi { font-size: 1.05em; }
.tag-lock-x { border: none; background: none; color: var(--text-muted); font-size: 1.1rem; line-height: 1; padding: 0 2px; cursor: pointer; }
.tag-lock-x:hover { color: var(--text); }
.verb-search-input { width: 100%; margin-top: 4px; }
.verb-search-results { list-style: none; margin: 6px 0 0; padding: 0; border: 1px solid var(--border); border-radius: 10px; max-height: 260px; overflow-y: auto; }
.verb-search-results li + li { border-top: 1px solid var(--border); }
.verb-search-results button { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; width: 100%; padding: 8px 12px; border: none; background: none; color: var(--text); text-align: start; cursor: pointer; font: inherit; }
.verb-search-results button:hover, .verb-search-results button:focus-visible { background: var(--tag-bg); }
.verb-search-root { font-weight: 700; font-size: 1.1rem; }
.verb-search-infs { color: var(--text-muted); }
.verb-search-form { flex-basis: 100%; font-size: 0.85rem; color: var(--text-muted); }
.verb-search-none { padding: 8px 12px; color: var(--text-muted); }
.tag-review { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-weight: 600; }

/* Settings: one labelled segmented control per row */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--tag-bg); border-radius: 999px; padding: 3px; }
.seg-btn {
  border: none; background: transparent; color: var(--text-muted);
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  font-size: 0.85rem; font-weight: 600;
}
.seg-btn.active { background: var(--card-bg); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.12); }
/* Recognition mode */
.recog-form-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 6px 0 18px;
  flex-wrap: wrap;
}
.recog-form { font-size: 2.6rem; font-weight: 700; }
.recog-grid { text-align: left; }
.recog-grid .field-group { margin-bottom: 10px; }
.recog-grid .answer-input { margin-bottom: 0; font-size: 1.1rem; padding: 9px 12px; }
.recog-grid .answer-input:disabled { opacity: 1; }
/* Binyan / tense / person: rows of tap buttons (radio groups) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.chip {
  flex: 1 0 auto; min-height: 40px; padding: 4px 10px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text);
  font: inherit; font-size: 0.9rem; cursor: pointer; touch-action: manipulation;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.25;
}
.chip [lang="he"] { font-size: 1.15rem; }
.chip-sub { font-size: 0.68rem; color: var(--text-muted); line-height: 1.1; }
.chip:hover:not(:disabled) { border-color: var(--accent); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--bg)); font-weight: 600; }
.chip:disabled { cursor: default; color: var(--text); }
.chip:disabled:not([aria-checked="true"]):not(.chip-right) { opacity: 0.4; }
.chip.chip-ok { border-color: var(--correct); box-shadow: inset 0 0 0 1px var(--correct); background: color-mix(in srgb, var(--correct) 14%, var(--bg)); }
.chip.chip-bad { border-color: var(--incorrect); box-shadow: inset 0 0 0 1px var(--incorrect); background: color-mix(in srgb, var(--incorrect) 14%, var(--bg)); }
.chip.chip-right { border: 1px dashed var(--correct); box-shadow: none; }
.recog-input.field-ok { border-color: var(--correct); box-shadow: inset 0 0 0 1px var(--correct); }
.recog-input.field-bad { border-color: var(--incorrect); box-shadow: inset 0 0 0 1px var(--incorrect); }
.recog-answer { font-size: 1.1rem; font-weight: 600; }

@media (max-width: 480px) {
  .mode-btn { padding: 6px 12px; }
  .recog-form { font-size: 2.1rem; }
  .chip { padding: 6px 8px; }
}
#recogAltText { display: flex; flex-direction: column; gap: 2px; }

/* Screen-reader-only text (the result announcement) */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Result flash: a brief tint on the result card */
@keyframes flashCorrect { from { background: color-mix(in srgb, var(--correct) 22%, var(--card-bg)); } to { background: var(--card-bg); } }
@keyframes flashIncorrect { from { background: color-mix(in srgb, var(--incorrect) 22%, var(--card-bg)); } to { background: var(--card-bg); } }
.result-card.flash-correct { animation: flashCorrect 0.7s ease-out; }
.result-card.flash-incorrect { animation: flashIncorrect 0.7s ease-out; }
@media (prefers-reduced-motion: reduce) {
  .result-card.flash-correct, .result-card.flash-incorrect { animation: none; }
}

/* On-screen Hebrew keyboard */
.hkb { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; user-select: none; -webkit-user-select: none; }
.hkb-row { display: flex; justify-content: center; gap: 5px; }
.hkb-key {
  flex: 0 1 44px; min-width: 0; height: 44px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text);
  font-size: 1.25rem; font-family: inherit; cursor: pointer;
  touch-action: manipulation;
}
.hkb-key:active { background: var(--tag-bg); }
.hkb-wide { flex-basis: 64px; font-size: 1.1rem; }
.hkb-space { flex: 1 1 auto; max-width: 240px; font-size: 0.85rem; color: var(--text-muted); }
.hkb-enter { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
@media (max-width: 480px) {
  .hkb-row { gap: 3px; }
  .hkb-key { height: 42px; font-size: 1.1rem; }
}

/* Filters: per-group warning and live match count */
.filter-warn { color: var(--incorrect); font-size: 0.8rem; margin-top: 4px; }
.filter-actions { justify-content: space-between; align-items: center; }
.filter-count { color: var(--text-muted); font-size: 0.9rem; }
.filter-count-zero { color: var(--incorrect); }

/* Settings: backup */
.setting-note { color: var(--text-muted); font-size: 0.85rem; margin: 6px 0 10px; }

/* Footer: "About the project" · "Contact me" */
.site-footer {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 28px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.footer-link {
  border: none;
  background: none;
  padding: 4px 2px;
  font: inherit;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.footer-link:hover { color: var(--text); }
.footer-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.about-lead { font-size: 1.05rem; line-height: 1.5; margin: 0 0 12px; }
/* Footer "Support the project" button and its dialog */
.footer-donate {
  margin-inline-start: 6px; padding: 5px 12px; border-radius: 999px; font: inherit; font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); cursor: pointer;
}
.modal-actions .footer-donate { margin-inline-start: 0; }
.footer-donate:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.footer-donate:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.donate-options { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.donate-option {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 12px; color: var(--text); text-decoration: none; background: var(--bg);
}
a.donate-option:hover { border-color: var(--accent); }
a.donate-option:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.donate-icon { width: 28px; height: 28px; flex: none; color: var(--accent); }
.donate-flag { width: 30px; height: 22px; flex: none; border-radius: 3px; box-shadow: 0 0 0 1px var(--border); }
.donate-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.donate-name { font-weight: 600; }
.donate-note { color: var(--text-muted); font-size: 0.85rem; }
.donate-go { color: var(--text-muted); }
.about-text { color: var(--text-muted); font-size: 0.9rem; line-height: 1.5; margin: 0 0 10px; }
.data-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Stats dashboard */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.stat-tile { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.stat-tile-label { color: var(--text-muted); font-size: 0.8rem; }
.stat-tile-value { font-size: 1.7rem; font-weight: 600; margin: 2px 0; }
.stat-tile-sub { color: var(--text-muted); font-size: 0.78rem; }
.stats-section { margin-top: 22px; }
.stats-h { font-size: 1rem; margin: 0 0 10px; }
.stats-block { margin-bottom: 16px; }
.stats-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 24px; }

.heat-scroll { overflow-x: auto; margin-top: 8px; }
.heat { border-collapse: separate; border-spacing: 2px; width: 100%; font-size: 0.8rem; }
.heat th { color: var(--text-muted); font-weight: 600; padding: 2px 4px; }
.heat-row-label { text-align: left; white-space: nowrap; font-size: 0.9rem; }
.heat-cell { text-align: center; border-radius: 4px; padding: 5px 2px; min-width: 52px; color: var(--text); font-variant-numeric: tabular-nums; }
.heat-cell.heat-strong { color: var(--on-accent); }
.heat-empty { background: var(--bg); color: var(--text-muted); }
.heat-pct { display: block; font-weight: 600; }
.heat-n { display: block; font-size: 0.7rem; opacity: 0.8; }
.heat-legend { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 0.75rem; margin-top: 6px; }
.heat-legend-ramp { flex: 0 0 120px; height: 8px; border-radius: 4px;
  background: linear-gradient(to right, color-mix(in oklab, var(--accent) 12%, var(--card-bg)), var(--accent)); }

.bar-list { list-style: none; padding: 0; margin: 8px 0 0; }
.bar-row { display: grid; grid-template-columns: minmax(70px, 34%) 1fr auto; align-items: center; gap: 8px; padding: 3px 0; font-size: 0.85rem; }
.bar-name { overflow-wrap: anywhere; }
.bar-track { height: 10px; background: var(--tag-bg); border-radius: 0 4px 4px 0; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.bar-val { color: var(--text-muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Prepositions mode */
.prep-meaning { color: var(--text-muted); font-size: 1rem; margin: -8px 0 14px; }
.prep-sentence { font-size: 1.35rem; line-height: 1.8; margin: 0 0 16px; text-align: center; }
.prep-blank {
  display: inline-block; min-width: 2.2em; border-bottom: 2px solid var(--accent);
  color: transparent; line-height: 1.2; margin: 0 2px;
}
.prep-mark { color: var(--accent); font-weight: 700; background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 3px; }
.prep-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 8px; margin-bottom: 14px; direction: rtl; }
.prep-choice {
  position: relative; height: 52px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text); font-size: 1.35rem; font-family: inherit; cursor: pointer;
  touch-action: manipulation;
}
.prep-choice:hover:not(:disabled) { border-color: var(--accent); }
.prep-num { position: absolute; top: 3px; left: 6px; font-size: 0.65rem; color: var(--text-muted); }
@media (hover: none) and (pointer: coarse) { .prep-num { display: none; } }
.prep-choice:disabled { cursor: default; }
.prep-choice.prep-eliminated { opacity: 0.25; }
.prep-choice.prep-right { border-color: var(--correct); box-shadow: inset 0 0 0 1px var(--correct); background: color-mix(in srgb, var(--correct) 14%, var(--bg)); }
.prep-choice.prep-wrong { border-color: var(--incorrect); box-shadow: inset 0 0 0 1px var(--incorrect); background: color-mix(in srgb, var(--incorrect) 14%, var(--bg)); }
@media (max-width: 480px) {
  .prep-choices { grid-template-columns: repeat(4, 1fr); }
  .prep-sentence { font-size: 1.2rem; }
}
