/* ============================================================
   Gita Guru — elegant, quiet, professional.
   One flat ivory ground, hairline borders, charcoal ink, a single
   antique-gold accent. Sanskrit and display text set in Gentium
   Plus (SIL) — complete, consistent IAST diacritics (ṛ ṝ ḷ ṅ ñ
   ṭ ḍ ṇ ś ṣ ṁ ḥ) from one face.
   ============================================================ */
@import url("fonts.css");

:root {
  /* ground & surfaces — flat, no gradients */
  --bg: #faf7f1;
  --card: #ffffff;
  --well: #f3eee3;            /* recessed surfaces: inputs, hints */
  --line: #e6ddcb;            /* hairline borders */

  /* ink */
  --ink: #2b2118;
  --ink-dim: #6e5d4b;
  --ink-faint: #a08c73;

  /* the single accent: antique gold, used sparingly */
  --accent: #a16207;
  --accent-deep: #7c4a05;
  --accent-soft: #f6efdc;

  /* feedback — emerald & earthen red, AA on white fills */
  --good: #047857;
  --good-deep: #065f46;
  --good-soft: #e3f3ec;
  --bad: #b91c1c;
  --bad-deep: #7f1d1d;
  --bad-soft: #fbeae7;

  /* ── Sacred Play layer: six jewel category colors ──
     `main` only for fills (white text on top), bars and large numerals;
     text on ivory always uses the `deep` variant; `soft` tints lean
     toward the ivory ground, never pure white. */
  --cat-remember: #4338ca;  --cat-remember-deep: #312e81;  --cat-remember-soft: #ecedfa;
  --cat-build:    #15803d;  --cat-build-deep:    #14532d;  --cat-build-soft:    #e7f2e8;
  --cat-listen:   #0f766e;  --cat-listen-deep:   #134e4a;  --cat-listen-soft:   #e2f1ee;
  --cat-quiz:     #6d28d9;  --cat-quiz-deep:     #4c1d95;  --cat-quiz-soft:     #f0eafb;
  --cat-match:    #be185d;  --cat-match-deep:    #9d174d;  --cat-match-soft:    #fbe8f0;
  --cat-quick:    #c2410c;  --cat-quick-deep:    #7c2d12;  --cat-quick-soft:    #fdece2;

  /* elevation — warm-ink shadows, never gray */
  --shadow: 0 1px 2px rgba(43, 33, 24, 0.06), 0 4px 14px rgba(43, 33, 24, 0.05);
  --e1: var(--shadow);
  --e2: 0 2px 4px rgba(43, 33, 24, 0.07), 0 10px 28px rgba(43, 33, 24, 0.10);
  --e3: 0 4px 10px rgba(43, 33, 24, 0.10), 0 18px 50px rgba(43, 33, 24, 0.16);

  /* radius & spacing scales */
  --r: 14px;
  --r-s: 10px; --r-m: 14px; --r-l: 18px; --r-xl: 24px; --r-pill: 999px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;

  /* motion tokens */
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-bounce: cubic-bezier(0.18, 1.65, 0.45, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.25, 1);
  --dur-1: 120ms; --dur-2: 240ms; --dur-3: 420ms; --dur-4: 800ms;

  --nav-h: 60px;
  --head-h: 54px;
  --serif: "Gentium Plus", Georgia, "Noto Serif", serif;
  --sans: -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --round: "Baloo 2", "Segoe UI", Roboto, sans-serif;
  --deva: "Noto Sans Devanagari", "Nirmala UI", "Mangal", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%;
  background: var(--bg);              /* one flat tone — nothing that cuts */
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  user-select: none;
}
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; position: relative; }
.screen {
  padding: calc(var(--head-h) + 14px) 18px calc(var(--nav-h) + 28px);
  animation: fadein 0.22s ease;
}
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

h1, h2, h3 { font-weight: 700; margin: 0 0 8px; }
h1 { font-size: 1.45rem; font-family: var(--serif); }
h2 { font-size: 1.06rem; letter-spacing: 0.01em; }
p { margin: 0 0 10px; }
a { color: var(--accent-deep); text-decoration: none; }
.dim { color: var(--ink-dim); }
.faint { color: var(--ink-faint); font-size: 0.84rem; }
.center { text-align: center; }
.spacer { height: 14px; }
.label {
  font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 700; margin-bottom: 6px;
}

/* ── fixed header ── */
.appheader {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  max-width: 560px; margin: 0 auto; height: var(--head-h);
  display: flex; align-items: center; gap: 10px; padding: 0 16px;
  background: rgba(250, 247, 241, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.appheader .brand {
  flex: 1; display: flex; align-items: baseline; gap: 7px;
  font-family: var(--serif); font-weight: 700; font-size: 1.12rem; color: var(--ink);
}
.appheader .brand .om { font-family: var(--deva); font-size: 1.15rem; color: var(--accent); }
.tilakmark { width: 17px; height: 22px; color: var(--accent); flex: 0 0 auto; align-self: center; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card);
  padding: 4px 10px; font-size: 0.78rem; font-weight: 700; color: var(--ink-dim);
}
.pill b { color: var(--accent-deep); }
.pill.tappable { cursor: pointer; font-family: inherit; }

/* ── cards & buttons ── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--ink); color: #fdfbf7;
  font-weight: 700; font-size: 0.98rem;
  border: 0; border-radius: 12px; padding: 13px 20px;
  cursor: pointer; width: 100%;
  transition: transform 0.08s ease, opacity 0.15s;
  font-family: var(--sans);
}
.btn:active { transform: scale(0.98); opacity: 0.92; }
.btn.secondary { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--accent-deep); border: 1px dashed var(--line); }
.btn.small { width: auto; padding: 8px 14px; font-size: 0.88rem; border-radius: 10px; }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.btnrow { display: flex; gap: 10px; }
.btnrow .btn { flex: 1; }

.chip {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em;
  background: var(--well); color: var(--ink-dim); border: 1px solid var(--line);
}
.chip.new { color: var(--ink-faint); }
.chip.learning { color: var(--accent-deep); }
.chip.due { color: var(--bad); background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 18%, #fff); }
.chip.known { color: var(--good); background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 22%, #fff); }

/* the verse reference, large and tied to the text below it */
.verseref { text-align: center; margin: 2px 0 10px; }
.verseref .vnum { font-family: var(--serif); font-size: 2rem; font-weight: 700; color: var(--ink); letter-spacing: 0.01em; }
.verseref .vch { font-size: 0.84rem; color: var(--ink-faint); margin-top: -2px; }
.verseref.sm { margin: 0 0 6px; }
.verseref.sm .vnum { font-size: 1.3rem; }
.verseref.sm .vch { font-size: 0.74rem; }

/* greeting block on Learn */
.greet { margin: 4px 0 14px; }
.greet h1 { font-size: 1.55rem; margin-bottom: 2px; }
.greet .sub { color: var(--ink-faint); font-size: 0.9rem; }

/* hero continue card */
.hero-cta { border-left: 3px solid var(--accent); }

/* compact chapter grid */
.chgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.chcell {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 12px; cursor: pointer; box-shadow: var(--shadow);
  min-width: 0; /* grid item: lets the nowrap title ellipsize instead of widening the track */
}
.chcell:active { border-color: var(--accent); }
.chcell .n { font-family: var(--serif); font-weight: 700; color: var(--accent-deep); font-size: 1.05rem; }
.chcell .t { font-family: var(--serif); font-size: 0.86rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chcell .xpbar { margin-top: 7px; }

/* ── the journey path: a winding trail of nodes ── */
.path { position: relative; padding: 14px 0 40px; }
.path::before {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0;
  border-left: 2px dashed var(--line); transform: translateX(-1px);
}
.pnode {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 58px; height: 58px; border-radius: 50%; margin: 26px auto;
  background: var(--card); border: 2px solid var(--line);
  color: var(--ink-faint); font-family: var(--serif); font-weight: 700; font-size: 1rem;
  cursor: pointer; box-shadow: var(--shadow);
}
.pnode.done { background: var(--accent); border-color: var(--accent); color: #fff; }
.pnode.current { border-color: var(--accent); color: var(--accent-deep); animation: pulse 1.8s infinite; }
.pnode.locked { opacity: 0.55; }
.pnode.gate { border-radius: 16px; font-size: 1.15rem; }
.pnode.crown { width: 68px; height: 68px; font-size: 1.45rem; border-width: 3px; }
.pnode .sub {
  position: absolute; top: 60px; left: 50%; transform: translateX(-50%);
  font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-faint); white-space: nowrap; font-family: var(--sans); font-weight: 700;
}
.pnode.crown .sub { top: 70px; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(161, 98, 7, 0.30); }
  50% { box-shadow: 0 0 0 12px rgba(161, 98, 7, 0); }
}

/* daily challenge on Play */
.daily {
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: var(--r); padding: 14px 16px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 12px; cursor: pointer; box-shadow: var(--shadow);
}
.daily .sun { font-size: 1.5rem; }
.daily b { display: block; }
.daily span { font-size: 0.8rem; color: var(--ink-dim); }
.best { margin-left: auto; font-size: 0.72rem; color: var(--accent-deep); font-weight: 800; white-space: nowrap; }

/* the Cards deck: full-height vertical snap scroller */
.deck {
  height: calc(100vh - var(--head-h) - var(--nav-h) - 8px);
  overflow-y: auto; scroll-snap-type: y mandatory;
  margin: -6px -4px 0; padding: 4px;
}
.deckitem { scroll-snap-align: center; min-height: 72%; display: flex; flex-direction: column; justify-content: center; padding: 10px 2px; }
.deckitem .flashwrap { margin: 0 0 10px; }
.deckhint { text-align: center; color: var(--ink-faint); font-size: 0.78rem; letter-spacing: 0.06em; }

.scopebar { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 16px; }
.scopechip {
  padding: 8px 14px; border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 0.84rem;
  background: var(--card); border: 1px solid var(--line); color: var(--ink-dim);
}
.scopechip.on { background: var(--ink); color: #fdfbf7; border-color: var(--ink); }

/* ── screen-local top bar ── */
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.topbar .back {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
  font-size: 1.2rem; cursor: pointer;
}
.topbar .title { flex: 1; min-width: 0; }
.topbar .title h1 { font-size: 1.08rem; margin: 0; }
.topbar .title .faint { margin: 0; }
.starbtn { font-size: 1.4rem; cursor: pointer; background: none; border: 0; color: #ddd2bd; transition: transform .12s; }
.starbtn.on { color: var(--accent); }
.starbtn:active { transform: scale(1.2); }

/* verse pager (top and bottom of the verse screen) */
.pager { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pager .btn { flex: 1; }
.pager .where { flex: 0 0 auto; font-size: 0.82rem; color: var(--ink-faint); font-weight: 700; }

/* ── stats ── */
.statrow { display: flex; gap: 10px; margin-bottom: 12px; }
.stat {
  flex: 1; text-align: center; padding: 12px 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
}
.stat b { display: block; font-size: 1.25rem; color: var(--ink); font-family: var(--serif); }
.stat span { font-size: 0.68rem; color: var(--ink-faint); letter-spacing: 0.08em; text-transform: uppercase; }
.ringwrap { display: flex; align-items: center; gap: 16px; }
.ring svg { display: block; }
.ring .pct { font-size: 1rem; font-weight: 700; fill: var(--ink); font-family: var(--serif); }
.ring .lbl { font-size: 0.48rem; fill: var(--ink-faint); letter-spacing: 0.1em; }
.xpbar { height: 6px; border-radius: 99px; background: var(--well); overflow: hidden; margin-top: 6px; }
.xpbar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* ── rows ── */
.vrow {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-bottom: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 13px;
  cursor: pointer; box-shadow: var(--shadow);
}
.vrow:active { border-color: var(--accent); }
.vrow .num {
  flex: 0 0 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); border: 1px solid var(--line);
  color: var(--accent-deep); font-weight: 700; font-size: 0.82rem; font-family: var(--serif);
}
.vrow .mid { flex: 1; min-width: 0; }
.vrow .inc {
  font-family: var(--serif); font-size: 0.99rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stars { font-size: 0.74rem; letter-spacing: 1.5px; color: var(--accent); }
.stars .off { color: #e4dac4; }

/* ── verse display ── */
.versecard { text-align: center; padding: 24px 16px; }
.uvaca { color: var(--ink-faint); font-style: italic; font-family: var(--serif); margin-bottom: 10px; font-size: 1rem; }
.deva-line { font-family: var(--deva); font-size: 1.2rem; color: var(--accent-deep); margin: 2px 0 10px; line-height: 1.9; }
.pada { font-family: var(--serif); font-size: 1.34rem; line-height: 1.8; margin: 3px 0; color: var(--ink); }
.pada .w { cursor: pointer; border-radius: 5px; padding: 1px 2px; transition: background 0.15s; }
.pada .w:active, .pada .w.hl { background: var(--accent-soft); color: var(--accent-deep); }
.transl { font-size: 0.97rem; color: var(--ink-dim); line-height: 1.65; font-family: var(--serif); }
.purport-toggle { cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.purport-body p { font-size: 0.96rem; color: var(--ink-dim); line-height: 1.7; margin-bottom: 12px; user-select: text; font-family: var(--serif); }
.wbw { margin-top: 4px; }
.wbw-item {
  display: flex; gap: 10px; padding: 9px 4px; cursor: pointer;
  border-bottom: 1px solid var(--well); align-items: baseline;
}
.wbw-item .w { font-family: var(--serif); font-size: 1.02rem; color: var(--accent-deep); flex: 0 0 38%; }
.wbw-item .m { color: var(--ink-dim); font-size: 0.9rem; }

/* inline word-explanation panel (no popup): slides open under the verse */
.wordpanel {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--r) var(--r) 0;
  padding: 14px 16px; margin: 10px 0 14px;
  animation: fadein 0.2s ease;
}
.wordpanel .word { font-family: var(--serif); font-size: 1.3rem; color: var(--ink); }
.wordpanel .gloss { color: var(--accent-deep); font-weight: 700; font-size: 0.92rem; margin: 1px 0 8px; }
.wordpanel p { font-size: 0.94rem; line-height: 1.65; color: var(--ink-dim); margin: 0 0 8px; font-family: var(--serif); }
.wordpanel .close { float: right; border: 0; background: none; color: var(--ink-faint); font-size: 1.1rem; cursor: pointer; }

/* ── sheet (kept for pickers & forms) ── */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(43, 33, 24, 0.4); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-width: 560px; margin: 0 auto; max-height: 78vh; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 18px 18px 0 0; padding: 18px 20px 30px;
  animation: sheetup 0.2s ease;
}
@keyframes sheetup { from { transform: translateY(36px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-handle { width: 38px; height: 4px; border-radius: 99px; background: var(--line); margin: -4px auto 14px; }
.rootword { font-family: var(--serif); font-size: 1.45rem; color: var(--ink); }
.rootline { margin: 10px 0; padding: 10px 12px; background: var(--card); border-radius: 10px; border: 1px solid var(--line); }
.rootline .k { font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); display: block; margin-bottom: 2px; }
.rootline .v { font-size: 0.94rem; }
.rootnote { font-size: 0.92rem; color: var(--ink-dim); font-style: italic; line-height: 1.6; padding: 4px 2px; font-family: var(--serif); }

/* ── memorize / review ── */
.stagebar { display: flex; gap: 6px; margin-bottom: 14px; }
.stagebar i { flex: 1; height: 4px; border-radius: 99px; background: var(--well); }
.stagebar i.on { background: var(--accent); }
.hintword { letter-spacing: 0.02em; }
.bigprompt { font-size: 1rem; color: var(--ink-dim); text-align: center; margin: 12px 0; }
.gradegrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grade { border: 1px solid var(--line); border-radius: 12px; padding: 12px 4px; font-weight: 700; font-size: 0.85rem; cursor: pointer; background: var(--card); font-family: var(--sans); }
.grade small { display: block; font-weight: 600; font-size: 0.64rem; color: var(--ink-faint); }
.grade.again { color: var(--bad); }
.grade.hard { color: var(--accent); }
.grade.good { color: var(--good); }
.grade.easy { color: var(--good-deep); }
.grade:active { transform: scale(0.97); background: var(--well); }

input.typebox {
  width: 100%; padding: 13px 14px; border-radius: 12px;
  background: var(--card); border: 1.5px solid var(--line);
  color: var(--ink); font-size: 1.05rem; font-family: var(--serif);
  outline: none;
}
input.typebox:focus { border-color: var(--accent); }
.typetarget { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin: 10px 0; }
.typetarget .tw {
  padding: 7px 11px; border-radius: 9px; font-family: var(--serif); font-size: 1.04rem;
  background: var(--well); color: var(--ink-faint); border: 1px solid var(--line);
}
.typetarget .tw.hit { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 28%, #fff); }
.typetarget .tw.miss { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 24%, #fff); }

/* game cards: quiet rows, small icons — not an arcade */
.gamelist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.gamerow {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 13px;
  padding: 12px 14px; cursor: pointer; box-shadow: var(--shadow);
}
.gamerow:active { border-color: var(--accent); }
.gamerow .ico { flex: 0 0 34px; height: 34px; border-radius: 9px; background: var(--well); display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.gamerow b { display: block; font-size: 0.95rem; }
.gamerow span { font-size: 0.78rem; color: var(--ink-dim); }

.gamegrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gamecard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 12px; text-align: center; cursor: pointer; box-shadow: var(--shadow);
}
.gamecard:active { border-color: var(--accent); }
.gamecard .ico { font-size: 1.2rem; display: block; margin-bottom: 4px; }
.gamecard b { display: block; font-size: 0.9rem; }
.gamecard span { font-size: 0.74rem; color: var(--ink-dim); }

.slotline { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; min-height: 44px; margin-bottom: 8px; }
.slot {
  min-width: 52px; padding: 9px 12px; border-radius: 10px; text-align: center;
  border: 1.5px dashed var(--line); color: var(--ink-faint);
  font-family: var(--serif); font-size: 1.05rem;
}
.slot.filled { border-style: solid; border-color: var(--accent); color: var(--accent-deep); background: var(--accent-soft); }
.tiles { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; margin-top: 16px; }
.tile {
  padding: 10px 15px; border-radius: 11px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line);
  font-family: var(--serif); font-size: 1.07rem; color: var(--ink);
  transition: transform 0.1s, opacity 0.2s, border-color 0.15s; box-shadow: var(--shadow);
}
.tile:active { transform: scale(0.95); }
.tile.used { opacity: 0; pointer-events: none; transform: scale(0.6); }
.tile.wrong { animation: shake 0.3s; border-color: var(--bad); }
.tile.letter { padding: 8px 12px; font-size: 1.12rem; min-width: 40px; }
@keyframes shake { 20% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 80% { transform: translateX(-3px); } }

.mcq { display: flex; flex-direction: column; gap: 9px; margin-top: 14px; }
.mcq .opt {
  padding: 12px 16px; border-radius: 12px; cursor: pointer; text-align: center;
  background: var(--card); border: 1px solid var(--line);
  font-family: var(--serif); font-size: 1.02rem; box-shadow: var(--shadow);
}
.mcq .opt.plain { font-family: var(--sans); font-size: 0.93rem; }
.mcq .opt.right { border-color: var(--good); background: var(--good-soft); }
.mcq .opt.wrongpick { border-color: var(--bad); background: var(--bad-soft); animation: shake 0.3s; }
.gapword { color: var(--accent-deep); border-bottom: 2px dashed var(--accent); padding: 0 6px; }

.pairgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 10px; }
.pair {
  padding: 11px 10px; border-radius: 11px; cursor: pointer; text-align: center;
  background: var(--card); border: 1px solid var(--line); font-size: 0.9rem;
  min-height: 50px; display: flex; align-items: center; justify-content: center;
  transition: opacity 0.25s, border-color 0.15s; box-shadow: var(--shadow);
}
.pair.sk { font-family: var(--serif); font-size: 1.03rem; color: var(--accent-deep); }
.pair.sel { border-color: var(--accent); background: var(--accent-soft); }
.pair.done { opacity: 0.25; pointer-events: none; border-color: var(--good); }
.pair.wrong { animation: shake 0.3s; border-color: var(--bad); }

.revealgrid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.rword {
  padding: 8px 12px; border-radius: 10px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line);
  font-family: var(--serif); font-size: 1.05rem; color: var(--ink-faint);
}
.rword.shown { color: var(--accent-deep); border-color: var(--accent); }

/* ── flashcards: 3D flip ──
   Both faces share one grid cell, so the card grows to fit whichever face
   is taller — long verses and full translations are never clipped. */
.flashwrap { perspective: 1200px; margin: 8px 0 14px; }
.flashcard {
  display: grid; width: 100%; min-height: 240px; cursor: pointer;
  transform-style: preserve-3d; transition: transform 0.5s cubic-bezier(.2,.7,.3,1);
}
.flashcard.flipped { transform: rotateY(180deg); }
.flashface {
  grid-area: 1 / 1; backface-visibility: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 22px 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.flashface.back { transform: rotateY(180deg); }
.flashface .ref { font-family: var(--serif); font-size: 1.7rem; color: var(--accent-deep); }

/* ── word rain: bubbles fall through a field ── */
.rainfield { position: relative; height: 280px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); overflow: hidden; margin-top: 12px; box-shadow: var(--shadow); }
.raindrop {
  position: absolute; top: -52px; padding: 10px 16px; border-radius: 999px;
  background: var(--accent-soft); border: 1px solid var(--line);
  font-family: var(--serif); font-size: 1.05rem; cursor: pointer; white-space: nowrap;
  animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(340px); } }
.raindrop:active { transform: scale(0.94); }

/* ── memory flip grid ── */
.memgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 12px; perspective: 1000px; }
.memcell { position: relative; aspect-ratio: 3/2.1; cursor: pointer; transform-style: preserve-3d; transition: transform 0.4s; }
.memcell.flipped { transform: rotateY(180deg); }
.memcell .f {
  position: absolute; inset: 0; backface-visibility: hidden;
  display: flex; align-items: center; justify-content: center; text-align: center;
  border-radius: 11px; border: 1px solid var(--line); font-size: 0.8rem; padding: 4px;
}
.memcell .f.front { background: var(--well); color: var(--ink-faint); font-size: 1.1rem; font-family: var(--deva); }
.memcell .f.backside { background: var(--card); transform: rotateY(180deg); }
.memcell .f.backside.sk { font-family: var(--serif); font-size: 0.95rem; color: var(--accent-deep); }
.memcell.matched { opacity: 0.35; pointer-events: none; }

/* ── lightning round: countdown bar ── */
.countbar { height: 6px; border-radius: 99px; background: var(--well); overflow: hidden; margin: 8px 0 14px; }
.countbar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transform-origin: left; }
.bigword { font-family: var(--serif); font-size: 1.9rem; text-align: center; margin: 18px 0 4px; color: var(--ink); }

/* ── results ── */
.bigscore { text-align: center; padding: 24px 10px; }
.bigscore .glyph { font-size: 2.4rem; display: block; margin-bottom: 6px; }
.bigscore b { font-size: 1.7rem; color: var(--ink); font-family: var(--serif); }
.sparkle { animation: pop 0.45s ease; }
@keyframes pop { 0% { transform: scale(0.7); opacity: 0; } 70% { transform: scale(1.05); } 100% { transform: scale(1); opacity: 1; } }

/* ── badges & calendar ── */
.badgegrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.badgecell { text-align: center; padding: 12px 6px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.badgecell .ico { font-size: 1.4rem; display: block; }
.badgecell b { font-size: 0.72rem; display: block; margin-top: 4px; }
.badgecell.locked { opacity: 0.32; filter: grayscale(1); }
.streakcal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 8px; }
.daycell { aspect-ratio: 1; border-radius: 6px; background: var(--well); display: flex; align-items: center; justify-content: center; font-size: 0.6rem; color: var(--ink-faint); }
.daycell.lit { background: var(--accent); color: #fff; font-weight: 700; }

/* ── settings ── */
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 2px; border-bottom: 1px solid var(--well); }
.switch { position: relative; width: 46px; height: 26px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 2; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--well); border: 1px solid var(--line); transition: background 0.2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform 0.2s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); }
select, input[type="range"] { accent-color: var(--accent); }
select { background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; font-size: 0.9rem; max-width: 56%; }
input.txt, textarea.txt {
  width: 100%; padding: 12px 14px; border-radius: 11px;
  background: var(--card); border: 1.5px solid var(--line);
  color: var(--ink); font-size: 1rem; font-family: var(--sans); outline: none;
}
textarea.txt { min-height: 90px; font-family: var(--serif); resize: vertical; }
input.txt:focus, textarea.txt:focus { border-color: var(--accent); }

/* ── leaderboard ── */
.lb { margin-top: 10px; }
.lbrow {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 8px; border-radius: 10px; margin-bottom: 4px;
  background: var(--card); border: 1px solid var(--line);
}
.lbrow.me { border-color: var(--accent); background: var(--accent-soft); }
.lbrow .medal { flex: 0 0 24px; text-align: center; }
.lbrow .lbname { flex: 1; font-weight: 700; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbrow .lbname i { color: var(--ink-faint); font-size: 0.76rem; font-style: normal; }
.lbrow .lbval { color: var(--accent-deep); white-space: nowrap; font-weight: 700; }

/* ── bottom nav ── */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  max-width: 560px; margin: 0 auto; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: rgba(250, 247, 241, 0.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink-faint); font-size: 0.74rem; font-weight: 700; position: relative;
}
.nav-item svg { width: 24px; height: 24px; fill: currentColor; }
.nav-item.active { color: var(--accent-deep); }
.nav-item .navwrap { position: relative; }
.nav-item .badge {
  position: absolute; top: -3px; right: -8px;
  background: var(--bad); color: #fff; font-size: 0.6rem; font-weight: 800;
  min-width: 16px; height: 16px; border-radius: 99px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.nav-item .badge[hidden] { display: none; }

/* ── toast ── */
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 16px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fdfbf7; font-weight: 700; font-size: 0.88rem;
  padding: 10px 18px; border-radius: 999px; z-index: 60;
  box-shadow: 0 6px 20px rgba(43, 33, 24, 0.3); white-space: nowrap;
  animation: toastin 0.22s ease;
}
@keyframes toastin { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ── welcome / onboarding ── */
.welcome { min-height: calc(100vh - var(--head-h) - var(--nav-h)); display: flex; flex-direction: column; justify-content: center; padding: 10px 4px; }
.welcome .om-big { font-family: var(--deva); font-size: 3rem; color: var(--accent); text-align: center; display: block; margin-bottom: 8px; }
.welcome h1 { text-align: center; font-size: 1.8rem; }
.welcome .tag { text-align: center; color: var(--ink-dim); font-family: var(--serif); font-style: italic; margin-bottom: 26px; }
.tour { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 20px; }
.tour .t { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding: 13px 14px; box-shadow: var(--shadow); }
.tour .t .ico { flex: 0 0 30px; text-align: center; font-size: 1.1rem; }

@media (min-width: 480px) {
  .pada { font-size: 1.44rem; }
}
