/* ============================================================
   Akshar — manuscript / ink-on-paper aesthetic
   ============================================================ */

:root {
  --paper:      #f4ecd8;   /* warm aged paper            */
  --paper-2:    #efe4c9;   /* slightly deeper panel      */
  --ink:        #241c14;   /* near-black warm ink        */
  --ink-soft:   #5a4a38;   /* secondary text             */
  --ink-faint:  #8a7659;   /* tertiary / hints           */
  --marigold:   #e0822a;   /* saffron / marigold accent  */
  --marigold-d: #c46714;
  --indigo:     #284b7c;   /* deep indigo accent         */
  --madder:     #b23a2e;   /* madder red                 */
  --leaf:       #4f7a3f;   /* correct                    */
  --line:       #d8c8a4;   /* hairline borders           */
  --shadow:     rgba(60, 42, 20, 0.18);
  --r: 18px;

  --font-display: "Fraunces", Georgia, serif;
  --font-ui: "Hanken Grotesk", system-ui, sans-serif;
  --font-deva: "Mukta", "Nirmala UI", "Noto Sans Devanagari", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-ui);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 15% 12%, rgba(224,130,42,0.10), transparent 42%),
    radial-gradient(circle at 85% 0%, rgba(40,75,124,0.10), transparent 45%),
    radial-gradient(circle at 50% 120%, rgba(178,58,46,0.08), transparent 55%);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* film-grain / paper tooth overlay */
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: 0.5; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
}

main, header, footer { position: relative; z-index: 2; }

/* ---------------- top bar ---------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(18px, 5vw, 56px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: 12px;
  background: none; border: none; cursor: pointer; color: inherit;
}
.brand-mark {
  font-family: var(--font-deva);
  font-size: 30px; font-weight: 700; line-height: 1;
  width: 50px; height: 50px; display: grid; place-items: center;
  color: var(--paper);
  background: var(--ink);
  border-radius: 14px;
  box-shadow: 3px 3px 0 var(--marigold);
  transition: transform .25s ease;
}
.brand:hover .brand-mark { transform: rotate(-4deg) scale(1.04); }
.brand-text { display: flex; flex-direction: column; text-align: left; }
.brand-text strong { font-family: var(--font-display); font-size: 20px; letter-spacing: .2px; }
.brand-text small { color: var(--ink-faint); font-size: 12px; letter-spacing: .5px; }

.stats { display: flex; gap: 10px; }
.stat {
  display: flex; align-items: center; gap: 6px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  padding: 7px 13px; border-radius: 999px;
  font-weight: 600; font-size: 14px;
  box-shadow: 0 1px 0 rgba(255,255,255,.5) inset;
}
.stat-icon { font-size: 14px; }

/* ---------------- layout ---------------- */
#app { max-width: 980px; margin: 0 auto; padding: clamp(24px, 5vw, 56px) clamp(18px, 5vw, 56px) 40px; }
.view { animation: rise .5s cubic-bezier(.2,.7,.3,1) both; }
.hidden { display: none !important; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------------- home ---------------- */
.eyebrow {
  font-family: var(--font-deva);
  color: var(--marigold-d); font-weight: 600;
  letter-spacing: 1px; margin-bottom: 12px;
}
.hero {
  font-family: var(--font-display);
  font-weight: 400; font-size: clamp(34px, 6vw, 60px);
  line-height: 1.05; letter-spacing: -.5px; max-width: 16ch;
}
.hero em { font-style: italic; color: var(--marigold-d); }
.lede { color: var(--ink-soft); font-size: clamp(16px, 2vw, 19px); margin: 18px 0 36px; max-width: 48ch; }

.deck-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 620px) { .deck-cards { grid-template-columns: 1fr; } }

.deck {
  position: relative; overflow: hidden;
  text-align: left; cursor: pointer; color: inherit;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 24px 24px 22px;
  box-shadow: 0 6px 22px -16px var(--shadow);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.deck:hover { transform: translateY(-4px); box-shadow: 0 18px 34px -20px var(--shadow); border-color: var(--marigold); }
.deck-glyph {
  position: absolute; right: -8px; top: -22px;
  font-family: var(--font-deva); font-size: 150px; font-weight: 700;
  color: var(--ink); opacity: .06; line-height: 1; pointer-events: none;
}
.deck-title { font-family: var(--font-deva); font-size: 34px; font-weight: 700; line-height: 1; }
.deck-sub { color: var(--ink-faint); font-weight: 600; letter-spacing: .5px; margin-bottom: 16px; }
.deck-meta { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-soft); }
.deck-bar { flex: 1; height: 7px; background: #e3d4b0; border-radius: 99px; overflow: hidden; }
.deck-bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--marigold), var(--marigold-d)); border-radius: 99px; transition: width .6s ease; }
.deck-go { margin-top: 18px; font-weight: 700; color: var(--marigold-d); }

/* wide matra card spanning full width under the two decks */
.deck-wide { grid-column: 1 / -1; width: 100%; margin-top: 18px; display: block; }
.deck-wide .deck-sub em { font-style: italic; color: var(--marigold-d); }
.deck-blurb {
  font-family: var(--font-deva); color: var(--ink-soft); font-size: 17px;
  margin: 2px 0 16px; max-width: 46ch;
}

/* quiz launcher */
.quiz-card {
  margin-top: 22px;
  display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between;
  background: var(--ink); color: var(--paper);
  border-radius: var(--r); padding: 22px 26px;
  box-shadow: 0 14px 30px -20px var(--shadow);
}
.quiz-card h3 { font-family: var(--font-display); font-size: 22px; font-weight: 500; }
.quiz-card p { color: #d9c9a6; font-size: 14px; margin-top: 4px; max-width: 40ch; }
.quiz-card-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.tip { margin-top: 22px; color: var(--ink-faint); font-size: 13px; }

/* ---------------- buttons ---------------- */
.btn {
  font-family: var(--font-ui); font-weight: 600; font-size: 15px;
  padding: 11px 18px; border-radius: 12px; cursor: pointer;
  border: 1px solid transparent; background: var(--marigold); color: #fff;
  box-shadow: 0 3px 0 var(--marigold-d);
  transition: transform .1s ease, box-shadow .1s ease, background .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--marigold-d); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); box-shadow: none; }
.btn-ghost:hover { border-color: var(--ink); background: rgba(0,0,0,.03); }
.btn-quiz { background: var(--paper); color: var(--ink); box-shadow: 0 3px 0 #00000033; }
.btn-quiz-all { background: var(--marigold); color: #fff; box-shadow: 0 3px 0 var(--marigold-d); }

/* ---------------- learn head ---------------- */
.learn-head { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.learn-head h2 { font-family: var(--font-display); font-weight: 500; font-size: clamp(22px,3vw,30px); flex: 1; }
.back { background: none; border: none; cursor: pointer; color: var(--ink-soft); font-weight: 600; font-size: 15px; font-family: var(--font-ui); }
.back:hover { color: var(--marigold-d); }
.counter { color: var(--ink-faint); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------------- flashcard ---------------- */
.flash { display: grid; gap: 16px; place-items: center; margin-bottom: 22px; }
.flash-card {
  position: relative;
  width: min(420px, 92vw); aspect-ratio: 4 / 3;
  display: grid; place-content: center; gap: 6px; text-align: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.45), transparent 60%),
    var(--paper-2);
  border: 1px solid var(--line); border-radius: 26px; cursor: pointer;
  box-shadow: 0 20px 40px -26px var(--shadow), 0 1px 0 rgba(255,255,255,.6) inset;
  transition: transform .15s ease;
}
.flash-card::after {
  content: ""; position: absolute; inset: 9px; border: 1px solid var(--line);
  border-radius: 18px; pointer-events: none; opacity: .6;
}
.flash-card:hover { transform: translateY(-3px); }
.flash-card:active { transform: scale(.98); }
.flash-card.speaking { animation: pulse .5s ease; }
@keyframes pulse { 0%{transform:scale(1)} 40%{transform:scale(1.05)} 100%{transform:scale(1)} }

.flash-char { font-family: var(--font-deva); font-size: clamp(96px, 22vw, 150px); font-weight: 600; line-height: .95; color: var(--ink); }
.flash-roman { font-family: var(--font-display); font-style: italic; font-size: 30px; color: var(--marigold-d); }
.flash-hint { color: var(--ink-faint); font-size: 14px; }
.speaker { position: absolute; bottom: 16px; left: 0; right: 0; color: var(--ink-faint); font-size: 12px; letter-spacing: .5px; }

.flash-example {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; justify-content: center;
  background: var(--paper-2); border: 1px dashed var(--line);
  padding: 12px 20px; border-radius: 14px; cursor: pointer; max-width: 92vw;
}
.flash-example .ex-char { font-family: var(--font-deva); font-size: 30px; font-weight: 600; }
.flash-example .ex-roman { font-style: italic; color: var(--marigold-d); font-family: var(--font-display); }
.flash-example .ex-mean { color: var(--ink-soft); }
.flash-example .ex-spk { color: var(--ink-faint); font-size: 13px; }

.learn-nav { display: flex; gap: 12px; justify-content: center; margin-bottom: 30px; }

/* ---------------- letter grid ---------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 10px; }
.cell {
  position: relative; aspect-ratio: 1; cursor: pointer;
  display: grid; place-content: center; gap: 2px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px;
  transition: transform .12s ease, border-color .12s ease, background .2s ease;
}
.cell:hover { transform: translateY(-2px); border-color: var(--marigold); }
.cell.active { border-color: var(--ink); background: #fff8e9; box-shadow: 0 0 0 2px var(--ink) inset; }
.cell.known::before { content: "✓"; position: absolute; top: 5px; right: 7px; font-size: 11px; color: var(--leaf); font-weight: 800; }
.cell-char { font-family: var(--font-deva); font-size: 30px; font-weight: 600; line-height: 1; }
.cell-roman { font-size: 11px; color: var(--ink-faint); font-style: italic; }
.group-label { grid-column: 1 / -1; font-family: var(--font-deva); font-weight: 700; color: var(--ink-soft); margin: 14px 0 2px; font-size: 18px; }
.group-label:first-child { margin-top: 0; }

/* ---------------- matras ---------------- */
.matra-intro { color: var(--ink-soft); font-size: 16px; max-width: 60ch; margin-bottom: 26px; }
.matra-intro b { color: var(--ink); }
.matra-h { font-family: var(--font-display); font-weight: 500; font-size: 19px; margin: 26px 0 12px; color: var(--ink); }
.matra-h:first-of-type { margin-top: 0; }

.matra-signs { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; }
.msign {
  cursor: pointer; aspect-ratio: 1; display: grid; place-content: center; gap: 2px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px;
  transition: transform .12s ease, border-color .12s ease, background .2s ease;
}
.msign:hover { transform: translateY(-2px); border-color: var(--marigold); }
.msign.active { border-color: var(--ink); background: #fff8e9; box-shadow: 0 0 0 2px var(--ink) inset; }
.msign-sign { font-family: var(--font-deva); font-size: 30px; font-weight: 600; line-height: 1; color: var(--marigold-d); }
.msign-roman { font-size: 11px; color: var(--ink-faint); font-style: italic; }

/* focused-sign explainer card */
.matra-focus { margin-top: 16px; }
.matra-focus-card {
  position: relative; width: 100%; text-align: left; cursor: pointer; color: inherit;
  display: flex; align-items: center; gap: 22px;
  background:
    radial-gradient(circle at 18% 20%, rgba(255,255,255,.4), transparent 55%),
    var(--paper-2);
  border: 1px solid var(--line); border-radius: 20px; padding: 22px 24px;
  box-shadow: 0 14px 30px -24px var(--shadow);
  transition: transform .15s ease;
}
.matra-focus-card:hover { transform: translateY(-2px); }
.matra-focus-card.speaking { animation: pulse .5s ease; }
.mf-sign {
  font-family: var(--font-deva); font-size: 76px; font-weight: 700; line-height: 1;
  color: var(--ink); min-width: 90px; text-align: center;
}
.mf-body { display: flex; flex-direction: column; gap: 4px; }
.mf-name { font-family: var(--font-deva); font-size: 24px; font-weight: 700; }
.mf-note { color: var(--ink-soft); font-size: 14px; }
.mf-ex { font-family: var(--font-deva); font-size: 18px; color: var(--marigold-d); margin-top: 6px; }
.mf-ex i { font-style: italic; font-family: var(--font-display); }
.matra-focus-card .speaker { position: absolute; bottom: 12px; right: 18px; left: auto; }

/* base consonant chooser */
.base-row { display: flex; flex-wrap: wrap; gap: 8px; }
.base-chip {
  font-family: var(--font-deva); font-size: 24px; font-weight: 600; line-height: 1;
  width: 50px; height: 50px; display: grid; place-content: center; cursor: pointer;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; color: var(--ink);
  transition: transform .1s ease, border-color .12s ease, background .2s ease;
}
.base-chip:hover { transform: translateY(-2px); border-color: var(--marigold); }
.base-chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* generated syllable grid */
.combo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 10px; margin-top: 16px; }
.combo {
  cursor: pointer; aspect-ratio: 1; display: grid; place-content: center; gap: 3px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px;
  transition: transform .12s ease, border-color .12s ease, background .2s ease;
}
.combo:hover { transform: translateY(-2px); border-color: var(--marigold); }
.combo.speaking { animation: pulse .5s ease; border-color: var(--ink); }
.combo-char { font-family: var(--font-deva); font-size: 34px; font-weight: 600; line-height: 1; }
.combo-roman { font-size: 12px; color: var(--ink-faint); font-style: italic; }
.combo-inherent .combo-char { color: var(--ink-faint); }

@media (max-width: 480px) {
  .mf-sign { font-size: 56px; min-width: 64px; }
  .matra-focus-card { gap: 14px; padding: 18px; }
}

/* ---------------- conjuncts ---------------- */
/* half-letter rule chips:  क → क्  */
.cj-rule { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.cj-chip {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-deva); font-size: 26px; font-weight: 600; line-height: 1;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 14px;
}
.cj-chip .cj-arrow { color: var(--ink-faint); font-size: 15px; }
.cj-chip .cj-half  { color: var(--marigold-d); }

/* the special four read as 2–3 glyphs, so give the tile a little breathing room */
.cj-specials { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
.cj-specials .msign-sign { font-size: 26px; }

/* ---------------- words ---------------- */
.words-bars { display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; align-items: stretch; margin-bottom: 26px; }
.level-row { display: flex; gap: 10px; flex-wrap: wrap; }
.level-chip {
  text-align: left; cursor: pointer; color: var(--ink);
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 8px 16px; display: flex; flex-direction: column; gap: 1px;
  transition: transform .1s ease, border-color .12s ease, background .2s ease;
}
.level-chip:hover { transform: translateY(-2px); border-color: var(--marigold); }
.level-chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.level-chip .level-name { font-family: var(--font-deva); font-weight: 700; font-size: 18px; line-height: 1.1; }
.level-chip .level-sub { font-size: 11px; letter-spacing: .3px; opacity: .8; }

.mode-toggle { display: flex; gap: 6px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px; padding: 5px; align-self: center; }
.mode-btn {
  font-family: var(--font-ui); font-weight: 600; font-size: 14px; cursor: pointer;
  background: none; border: none; color: var(--ink-soft); padding: 8px 16px; border-radius: 10px;
  transition: background .2s ease, color .2s ease;
}
.mode-btn.active { background: var(--ink); color: var(--paper); }

/* read mode */
.word-card { aspect-ratio: 16 / 9; }
.word-char { font-size: clamp(54px, 13vw, 96px); }
.word-reveal { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 6px; }
.word-mean { color: var(--ink-soft); font-size: 17px; }
.word-prompt { color: var(--ink-faint); font-size: 14px; font-style: italic; margin-top: 8px; }
.word-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.word-cell { aspect-ratio: 3 / 2; }
.word-cell-char { font-size: 26px; }

/* build mode */
.build-prompt { text-align: center; margin-bottom: 24px; }
.build-replay { background: var(--indigo); box-shadow: 0 4px 0 #1c3556; }
.build-clue { margin-top: 14px; color: var(--ink-soft); font-size: 17px; }
.build-clue #buildRoman { font-family: var(--font-display); font-style: italic; color: var(--marigold-d); }
.build-clue #buildMean { font-weight: 600; color: var(--ink); }

.build-slots { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 8px 0; }
.build-slots.speaking { animation: pulse .5s ease; }
.build-slot {
  font-family: var(--font-deva); font-size: 38px; font-weight: 600; line-height: 1;
  min-width: 72px; height: 86px; display: grid; place-content: center; color: var(--ink);
  background: var(--paper); border: 2px dashed var(--line); border-radius: 14px; cursor: pointer;
  transition: border-color .15s ease, background .2s ease, transform .1s ease;
}
.build-slot.filled { border-style: solid; background: var(--paper-2); }
.build-slot.filled:hover { border-color: var(--madder); }
.build-slot.right { border-color: var(--leaf); background: #e7f0df; color: var(--leaf); border-style: solid; }
.build-slot.wrong { border-color: var(--madder); background: #f6e2df; animation: shake .4s ease; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }

.build-feedback { min-height: 24px; text-align: center; font-weight: 600; margin: 10px 0; }
.build-feedback.good { color: var(--leaf); }
.build-feedback.bad { color: var(--madder); }

.build-tiles { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 28px; }
.build-tile {
  font-family: var(--font-deva); font-size: 34px; font-weight: 600; line-height: 1;
  min-width: 66px; height: 78px; display: grid; place-content: center; cursor: pointer; color: var(--ink);
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 4px 12px -10px var(--shadow);
  transition: transform .1s ease, border-color .12s ease, background .2s ease;
}
.build-tile:hover { transform: translateY(-2px); border-color: var(--marigold); }
.build-tile.used { opacity: .25; pointer-events: none; }
.build-tile:disabled { cursor: default; }

@media (max-width: 480px) {
  .words-bars { flex-direction: column; }
  .mode-toggle { align-self: flex-start; }
  .build-slot { min-width: 56px; height: 70px; font-size: 30px; }
  .build-tile { min-width: 54px; height: 64px; font-size: 28px; }
}

/* ---------------- sentences ---------------- */
/* grammar "glue word" reference chips */
.gram-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 26px; }
.gram-chip {
  text-align: left; cursor: pointer; color: var(--ink);
  display: flex; flex-direction: column; gap: 1px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px;
  transition: transform .1s ease, border-color .12s ease, background .2s ease;
}
.gram-chip:hover { transform: translateY(-2px); border-color: var(--marigold); }
.gram-chip.speaking { animation: pulse .5s ease; }
.gram-chip .gram-w { font-family: var(--font-deva); font-size: 26px; font-weight: 700; line-height: 1.1; color: var(--indigo); }
.gram-chip.gram-gender .gram-w { color: var(--madder); }
.gram-chip .gram-roman { font-style: italic; font-family: var(--font-display); color: var(--marigold-d); font-size: 14px; }
.gram-chip .gram-gloss { color: var(--ink-soft); font-size: 12px; }

/* read mode: sentence card (wraps text, highlights glue words) */
.sent-card { aspect-ratio: auto; min-height: 230px; padding: 30px 26px 40px; }
.sent-char { font-family: var(--font-deva); font-size: clamp(28px, 5.5vw, 44px); font-weight: 600; line-height: 1.4; color: var(--ink); max-width: 18ch; }
.sent-char .pp { color: var(--indigo); background: rgba(40,75,124,.10); border-radius: 6px; padding: 0 .12em; }
.sent-reveal { display: flex; flex-direction: column; align-items: center; gap: 3px; margin-top: 14px; }
.sent-reveal .flash-roman { font-size: 22px; }
.sent-mean { color: var(--ink-soft); font-size: 17px; }
.sent-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.sent-cell { aspect-ratio: auto; padding: 14px 12px; }
.sent-cell-char { font-family: var(--font-deva); font-size: 19px; font-weight: 600; line-height: 1.3; }

/* fill mode */
.fill-sentence {
  font-family: var(--font-deva); font-size: clamp(24px, 4.5vw, 34px); font-weight: 600;
  line-height: 1.6; color: var(--ink); margin: 16px 0 4px; text-align: center;
}
.fill-sentence.speaking { animation: pulse .5s ease; }
.fill-slot {
  display: inline-grid; place-content: center; min-width: 1.8em; padding: 0 .25em;
  border-bottom: 3px dashed var(--marigold); color: var(--marigold-d);
}
.fill-slot.right { border-bottom-style: solid; border-color: var(--leaf); color: var(--leaf); }
.fill-options { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 24px; }
.fill-opt {
  font-family: var(--font-deva); font-size: 28px; font-weight: 600; line-height: 1;
  min-width: 72px; padding: 14px 20px; cursor: pointer; color: var(--ink);
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 4px 12px -10px var(--shadow);
  transition: transform .1s ease, border-color .12s ease, background .2s ease;
}
.fill-opt:hover { transform: translateY(-2px); border-color: var(--marigold); }
.fill-opt.wrong { background: #f6e2df; border-color: var(--madder); color: var(--madder); animation: shake .4s ease; }
.fill-opt:disabled { cursor: default; opacity: .55; }

/* ---------------- quiz ---------------- */
.quiz-stage { text-align: center; max-width: 560px; margin: 0 auto; }
.quiz-prompt { font-family: var(--font-display); font-size: clamp(20px,3vw,26px); font-weight: 500; margin-bottom: 18px; }
.replay {
  font-family: var(--font-ui); font-weight: 600; font-size: 16px;
  background: var(--indigo); color: #fff; border: none; cursor: pointer;
  padding: 16px 26px; border-radius: 14px; box-shadow: 0 4px 0 #1c3556;
  transition: transform .1s ease;
}
.replay:hover { transform: translateY(-1px); }
.replay:active { transform: translateY(3px); box-shadow: 0 1px 0 #1c3556; }
.replay.speaking { animation: pulse .5s ease; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 28px 0 10px; }
.opt {
  font-family: var(--font-deva); font-size: 52px; font-weight: 600;
  padding: 18px 0; cursor: pointer; color: var(--ink);
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 6px 16px -12px var(--shadow);
  transition: transform .1s ease, background .2s ease, border-color .2s ease;
}
.opt:hover { transform: translateY(-2px); border-color: var(--marigold); }
.opt.correct { background: #e7f0df; border-color: var(--leaf); color: var(--leaf); }
.opt.wrong { background: #f6e2df; border-color: var(--madder); color: var(--madder); }
.opt:disabled { cursor: default; }
.quiz-feedback { min-height: 26px; font-weight: 600; }
.quiz-feedback.good { color: var(--leaf); }
.quiz-feedback.bad { color: var(--madder); }

.quiz-done { text-align: center; max-width: 460px; margin: 30px auto; }
.quiz-done h3 { font-family: var(--font-display); font-size: 34px; }
.quiz-done p { color: var(--ink-soft); margin: 10px 0 24px; }

/* ---------------- footer ---------------- */
.footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(18px,5vw,56px); border-top: 1px solid var(--line);
  color: var(--ink-faint); font-size: 13px; max-width: 980px; margin: 0 auto; width: 100%;
}
.footer .version { letter-spacing: .6px; font-size: 11px; color: var(--ink-faint); opacity: .8; text-align: center; }
.reset { background: none; border: none; color: var(--ink-faint); cursor: pointer; text-decoration: underline; font-size: 13px; font-family: var(--font-ui); }
.reset:hover { color: var(--madder); }

@media (max-width: 560px) {
  .footer { flex-direction: column; gap: 8px; text-align: center; }
}

@media (max-width: 480px) {
  .options { gap: 10px; }
  .opt { font-size: 42px; }
}
