/* Wolyser mini app: a reading fox in ink and gold, on warm cream paper.
 *
 * The shape language is warm paper and a gold marker: cards are chunky and
 * rounded, every surface is warm, and the current tab is a gold pill rather
 * than a rule. Gold means measured data first; it is a marker, not a
 * background. Motion is small and quick — screens rise, rows press — and it
 * all stops under `prefers-reduced-motion`.
 *
 * Two faces ship with the app (static/fonts/): Estedad for every Persian and
 * Latin label, Newsreader for the English headword, its gloss and its example,
 * which is the printed-dictionary voice. The IPA keeps a system face because
 * phonetic glyph coverage matters more than consistency there.
 */
@font-face{font-family:"Estedad";font-weight:400;font-style:normal;font-display:swap;
  src:url("fonts/estedad-arabic-400.woff2") format("woff2");
  unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+200C-200D,U+FB50-FDFF,U+FE70-FEFF}
@font-face{font-family:"Estedad";font-weight:600;font-style:normal;font-display:swap;
  src:url("fonts/estedad-arabic-600.woff2") format("woff2");
  unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+200C-200D,U+FB50-FDFF,U+FE70-FEFF}
@font-face{font-family:"Estedad";font-weight:700;font-style:normal;font-display:swap;
  src:url("fonts/estedad-arabic-700.woff2") format("woff2");
  unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+200C-200D,U+FB50-FDFF,U+FE70-FEFF}
@font-face{font-family:"Estedad";font-weight:400;font-style:normal;font-display:swap;
  src:url("fonts/estedad-latin-400.woff2") format("woff2");
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2190-2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Estedad";font-weight:600;font-style:normal;font-display:swap;
  src:url("fonts/estedad-latin-600.woff2") format("woff2");
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2190-2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Estedad";font-weight:700;font-style:normal;font-display:swap;
  src:url("fonts/estedad-latin-700.woff2") format("woff2");
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2190-2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Newsreader";font-weight:400;font-style:normal;font-display:swap;
  src:url("fonts/newsreader-latin-400.woff2") format("woff2");
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2190-2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Newsreader";font-weight:500;font-style:normal;font-display:swap;
  src:url("fonts/newsreader-latin-500.woff2") format("woff2");
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2190-2193,U+2212,U+2215,U+FEFF,U+FFFD}

:root{
  --ink:#1e2b4d; --ink2:#33405f; --muted:#6f7486;
  --gold:#c99233;            /* marks: bars, rules, the underline */
  --gold-text:#8a5f12;       /* the same measure as text, 5.6 on cream */
  --gold-soft:#f8e6c1; --gold-ink:#7a5410;
  --bg:#fbf2df; --card:#fffcf4; --line:#eddfc2;
  --surface2:#f7ecd5;        /* chips and small tiles */
  --surface3:#f0e2c6;        /* bar tracks and segmented wells */
  --latent:#e3d3b2;          /* a measure that is not the current pick */
  --tint:#fff7e7;            /* a row that opened */
  --mark-bg:#f9edd2;         /* the small accent numerals */
  --highlight:#f7dda2;       /* the word inside an example */
  --tab-idle:#8a8577; --chev:#bda98a;
  --on-ink:#fffaf0;          /* text on an ink-filled control */
  --btn-active:#162341;
  --scrim:rgba(30,43,77,.34);
  --toast-bg:rgba(30,43,77,.96); --toast-ink:#fffaf0;
  --green:#25774f; --green-soft:#e2f2e6;
  --bad:#b04a3f; --bad-soft:#f9e4de;
  --r-xs:8px; --r-sm:12px; --r-md:16px; --r-lg:20px; --r-xl:26px;
  --sh:0 10px 24px -20px rgba(30,43,77,.55);
  --sh-lift:0 18px 34px -26px rgba(30,43,77,.6);
  --sans:"Estedad",Tahoma,"Segoe UI",system-ui,sans-serif;
  --serif:"Newsreader",Georgia,"Times New Roman",serif;
  --ipa:"Segoe UI",Tahoma,sans-serif;
  --safe-t:env(safe-area-inset-top,0px);
  --safe-b:env(safe-area-inset-bottom,0px);
}

/* Night. The palette is the bot's idiom card: a near-black page, a warm cream
 * for type, and the card's red for every mark that carries a measure, with its
 * orange for accent text, because red at 11 px would not hold AA on black.
 * Only the tokens change; every component keeps its shape, its rules and its
 * hierarchy, so the two themes are the same app in two inks.
 *
 * Set by `data-theme` on <html> (see app.js: system, light or night).
 */
html[data-theme="dark"]{
  --ink:#f6eeda; --ink2:#e3d9c4; --muted:#a79f90;
  --gold:#f0b45f;            /* the fox's muzzle light, for a night page */
  --gold-text:#f2bd74;       /* 8.6 on #121522 */
  --gold-soft:#2b2418; --gold-ink:#ffd08a;
  --bg:#121522; --card:#1b2032; --line:#2b3247;
  --surface2:#232a3d; --surface3:#2b3247; --latent:#414a63;
  --tint:#202739;
  --mark-bg:#2a2216; --highlight:rgba(240,180,95,.3);
  --tab-idle:#948d7e; --chev:#6f7488;
  --on-ink:#151a26;
  --btn-active:#dcd2bd;
  --scrim:rgba(4,7,14,.66);
  --toast-bg:rgba(246,238,218,.97); --toast-ink:#151a26;
  --green:#8fd3a7; --green-soft:#1a2a22;
  --bad:#f0a79c; --bad-soft:#2c1c1b;
  --sh:0 12px 26px -22px rgba(0,0,0,.8);
  --sh-lift:0 20px 36px -26px rgba(0,0,0,.9);
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--ink);overflow:hidden;
  font-family:var(--sans);font-size:14px;-webkit-font-smoothing:antialiased}
button{font-family:inherit}
button:not(:disabled){cursor:pointer}
button:disabled{cursor:not-allowed}
a{cursor:pointer}
:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
[hidden]{display:none !important}

/* ---------- boot / error ---------- */
.boot{position:fixed;inset:0;display:grid;place-items:center;padding:28px;
  text-align:center;background:var(--bg);z-index:20}
.boot .mark{width:54px;height:54px;border-radius:var(--r-lg);background:var(--ink);
  color:var(--on-ink);display:grid;place-items:center;font:500 24px/1 var(--serif);
  margin:0 auto 14px;direction:ltr}
.boot h1{font-size:17px;margin:0 0 6px}
.boot p{font-size:12.5px;color:var(--muted);margin:0 0 16px;line-height:1.8;
  max-width:280px}
.boot .btn{margin:0 auto}
.spin{width:22px;height:22px;border:2px solid var(--line);border-top-color:var(--gold);
  border-radius:50%;animation:sp .8s linear infinite;margin:16px auto 0}
@keyframes sp{to{transform:rotate(360deg)}}

/* ---------- shell ---------- */
.app{position:fixed;inset:0;display:flex;flex-direction:column;
  background:var(--bg)}
.topbar{flex:0 0 auto;display:flex;align-items:center;gap:4px;
  padding:calc(var(--safe-t) + 4px) 8px 4px;
  background:var(--bg);border-bottom:1px solid var(--line);z-index:6}
.topbar .title{flex:1;text-align:center;font-size:14px;font-weight:700;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ibtn{width:44px;height:44px;border:1px solid transparent;border-radius:var(--r-sm);
  background:transparent;color:var(--ink);display:grid;place-items:center;
  cursor:pointer;font-size:17px;flex:0 0 auto}
.ibtn.ghost{color:var(--ink2)}
#langBtn{font-size:11px;font-weight:700;letter-spacing:.4px;
  border-color:var(--line)}
main{flex:1 1 auto;overflow-y:auto;overflow-x:hidden;padding:12px 14px 24px;
  /* The screen is rebuilt wholesale on every render; without this the
     browser's scroll anchoring can restore the old offset after the new
     markup lands, so a screen would open halfway down. */
  overflow-anchor:none;
  scrollbar-width:none;-webkit-overflow-scrolling:touch}
main::-webkit-scrollbar{display:none}

/* ---------- shared ---------- */
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--r-lg);
  padding:14px;margin-bottom:12px}
.lbl{font-size:11px;color:var(--muted);margin-bottom:8px}
/* A section head is a label over a hairline, the way a catalogue rules off a
   group. The count sits at the far end like a page number. */
.sect{display:flex;align-items:baseline;justify-content:space-between;gap:10px;
  margin:22px 0 6px;padding-bottom:7px;border-bottom:1px solid var(--line);
  font-size:12.5px;font-weight:700}
.sect:first-child{margin-top:4px}
.sect span{font-size:11px;font-weight:400;color:var(--muted);
  font-variant-numeric:tabular-nums}
.chip{display:inline-block;font-size:10.5px;padding:2px 7px;border-radius:var(--r-xs);
  background:var(--surface2);color:var(--ink2);margin:0 0 4px 4px;white-space:nowrap}
.chip.gold{background:var(--gold-soft);color:var(--gold-ink)}
.chip.green{background:var(--green-soft);color:var(--green)}
.chip.ghost{background:transparent;border:1px solid var(--line);color:var(--muted)}
.btn{border:1px solid var(--ink);border-radius:var(--r-md);padding:10px 16px;
  font-size:13px;font-weight:600;background:var(--ink);color:var(--on-ink);
  cursor:pointer}
.btn:active{background:var(--btn-active)}
.btn.ghost{background:transparent;border-color:var(--line);color:var(--ink)}
.btn.ghost:active{background:var(--surface2)}
.btn:disabled{opacity:.45;cursor:not-allowed}
.bar{height:6px;border-radius:99px;background:var(--surface3);overflow:hidden}
.bar>i{display:block;height:100%;border-radius:99px;background:var(--gold)}
@media (prefers-reduced-motion:no-preference){.bar>i{transition:width .35s ease}}

/* Menu rows are a ruled list, not cards: one hairline under each row, paper
   showing through, and the 46 px height that keeps the tap target honest. */
.row{display:flex;align-items:center;gap:10px;width:100%;min-height:46px;
  padding:11px 2px;background:transparent;border:0;
  border-bottom:1px solid var(--line);border-radius:0;
  text-align:start;color:inherit;cursor:pointer}
.row .ttl{flex:1;font-size:13px;font-weight:600;min-width:0;
  display:flex;flex-direction:column;line-height:1.45}
.row .sub{font-size:11px;color:var(--muted);font-weight:400;margin-top:3px;
  display:block}
.chev{width:7px;height:7px;border-left:1.5px solid var(--chev);
  border-bottom:1.5px solid var(--chev);transform:rotate(45deg);flex:0 0 auto;
  margin-inline:3px}
[dir=ltr] .chev{transform:rotate(-135deg)}
.iso{unicode-bidi:isolate}

/* ---------- home ---------- */
.hello{display:flex;align-items:center;justify-content:space-between;
  margin:2px 0 12px;gap:10px}
.hello .hi{font-size:12px;color:var(--muted)}
.hello .nm{font-size:16px;font-weight:700}
.hello .sub{font-size:11px;color:var(--muted);margin-top:3px;line-height:1.5}
.streak{font-size:11.5px;background:var(--gold-soft);color:var(--gold-ink);
  border-radius:var(--r-xs);padding:4px 8px;font-weight:600;white-space:nowrap}

/* ---------- home: three sections, three shapes ----------------------------
 * The three groups below the card used to be the same ruled list, so the page
 * read as one long column with three headings in it. Each group now has the
 * shape of its own job: the lanes are a card whose rows open in place, the
 * exams are a numbered ledger that ends in a filled button, the books are a
 * shelf that pushes sideways. Only the section head stays the same, because
 * that is what tells the reader they are still on the same page. */
.lanes{background:var(--card);border:1px solid var(--line);
  border-radius:var(--r-lg);padding:2px 12px;margin-bottom:4px}
.lanes>.row{border-bottom:1px solid var(--line)}
.lanes>:last-child{border-bottom:0}
.lanes .row.open{background:var(--surface2)}
.lanes .qbody{border-bottom:0;margin:0;padding:2px 0 10px}
/* The lane's icon is a plate on the card rather than a glyph on the paper. */
.lanes .row .lic{width:30px;height:30px;flex:0 0 30px;border-radius:var(--r-sm);
  background:var(--gold-soft);color:var(--gold-ink);display:grid;
  place-items:center}
.lanes .row .lic svg{width:17px;height:17px}

/* A ledger, not a list: a catalogue number in the gutter, the paper's name in
   the dictionary face, the figures in a column that lines up down the block. */
.ledger-list{border-top:1px solid var(--line)}
.ledger{display:grid;grid-template-columns:26px 1fr auto 12px;gap:10px;
  align-items:center;width:100%;min-height:54px;padding:10px 2px;
  background:transparent;border:0;border-bottom:1px solid var(--line);
  text-align:start;color:inherit;cursor:pointer}
.ledger .no{font:500 10.5px/1 var(--serif);color:var(--gold-text);
  background:var(--mark-bg);border-radius:var(--r-xs);padding:5px 0;
  text-align:center;font-variant-numeric:tabular-nums}
.ledger .ttl{display:flex;flex-direction:column;min-width:0;line-height:1.4}
.ledger .pname{font-family:var(--serif);font-size:13.5px;font-weight:500;
  color:var(--ink);overflow-wrap:anywhere}
.ledger .sub{font-size:11px;color:var(--muted);margin-top:3px}
.ledger .mark{display:flex;flex-direction:column;gap:3px;text-align:center;
  font-size:13px;font-weight:600;line-height:1;color:var(--gold-text);
  font-variant-numeric:tabular-nums}
.ledger .mark i{font-style:normal;font-size:9px;font-weight:400;
  color:var(--muted)}
.ledger .chev{justify-self:end}
.allbtn{display:block;width:100%;margin-top:11px;text-align:center}

/* The shelf: cards in a strip that scrolls sideways, bled to the screen edge
   so the cut-off card at the end is what says there are more. */
.bkstrip{display:flex;gap:9px;overflow-x:auto;margin:2px -14px 0;
  padding:2px 14px 8px;scroll-snap-type:x proximity;scrollbar-width:none}
.bkstrip::-webkit-scrollbar{display:none}
.bkcard{position:relative;flex:0 0 134px;scroll-snap-align:start;
  display:flex;flex-direction:column;gap:6px;min-height:106px;
  background:var(--card);border:1px solid var(--line);
  border-inline-start:4px solid var(--surface3);border-radius:var(--r-md);
  padding:11px 12px;text-align:start;color:inherit;cursor:pointer}
.bkcard .bname{font-family:var(--serif);font-size:12.5px;line-height:1.35;
  color:var(--ink);direction:ltr;text-align:left;unicode-bidi:isolate;
  display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;
  overflow:hidden}
.bkcard .chip{align-self:flex-start;margin:0}
.bkcard .bfig{margin-top:auto;display:flex;flex-direction:column;
  font-size:10.5px;color:var(--muted);line-height:1.25}
.bkcard .bfig b{font-size:17px;font-weight:600;color:var(--ink);
  font-variant-numeric:tabular-nums}
/* The shelf's exit is a line under it, not a fifth card: a card at the end of a
   sideways strip is the one thing a reader may never scroll far enough to see. */
.shelfmore{display:flex;align-items:center;justify-content:space-between;
  width:100%;min-height:44px;padding:10px 2px 0;margin-top:4px;
  background:none;border:0;border-top:1px solid var(--line);
  color:var(--gold-text);font-family:inherit;font-size:12px;font-weight:600;
  cursor:pointer}
.word .w{font-family:var(--serif);font-size:31px;font-weight:500;
  letter-spacing:-.3px;margin:2px 0 9px;direction:ltr;text-align:left;
  overflow-wrap:anywhere}
/* Definition and example answer two different questions -- what the word means,
 * and how the paper actually used it -- so they get two different boxes rather
 * than one run of serif text. The definition sits on the gold paper a measured
 * claim gets; the example sits on the green an attested sentence gets, the same
 * green the key chip already uses. Both keep a bar on the text side, which
 * follows the script: the inline edge mirrors in Persian. */
.word .gloss{font-family:var(--serif);font-size:14px;color:var(--ink2);
  line-height:1.65;direction:ltr;text-align:left;margin:2px 0 8px;
  background:var(--gold-soft);border-inline-start:3px solid var(--gold);
  border-radius:var(--r-sm);padding:9px 11px}
.word .actions{display:flex;gap:8px;margin-top:14px}

/* ---------- exams ---------- */
.backlink{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;
  color:var(--muted);cursor:pointer;margin:0 0 10px;background:none;
  border:0;font-family:inherit;min-height:36px}
/* A bar label is a two-cell line: what is measured at the reading edge, the
   figure at the far edge, so the figures form a column down the card. */
.brow{margin-bottom:12px}
.brow .t{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:baseline;
  font-size:11.5px;margin-bottom:5px}
.brow .t b{font-size:11.5px;color:var(--gold-text);font-weight:600;
  font-variant-numeric:tabular-nums;white-space:nowrap}
.brow .t span{min-width:0;overflow-wrap:anywhere}
/* ---------- grammar tree ---------- */
.ghead{font-size:20px;font-weight:700;margin:0 0 3px}
/* On a list screen the count line is the header, since the bar above already
   names the screen: it gets the same hairline a section head carries. */
.gsub{font-size:11.5px;color:var(--muted);margin:0 0 8px;padding-bottom:9px;
  border-bottom:1px solid var(--line);font-variant-numeric:tabular-nums}
.gnote{font-size:11px;color:var(--muted);margin:0 0 12px;line-height:1.6}
.main{background:var(--card);border:1px solid var(--line);border-radius:var(--r-lg);
  margin-bottom:8px;overflow:hidden}
.main .h{display:flex;align-items:center;gap:9px;padding:12px;cursor:pointer;
  width:100%;min-height:46px;border:0;background:none;text-align:start;color:inherit}
.main .h .fa{flex:1;font-size:12.5px;font-weight:600;min-width:0;
  display:flex;flex-direction:column;gap:2px;line-height:1.4}
.main .h .en{font-size:10.5px;color:var(--muted);font-weight:400;direction:ltr;
  text-align:start;display:block}
.main .h .n{font-size:11px;color:var(--gold-text);font-weight:600;flex:0 0 auto;
  font-variant-numeric:tabular-nums}
.main .body{border-top:1px solid var(--line);padding:2px 10px 8px}
.semi{margin-top:6px}
.semi .sh{font-size:11px;color:var(--muted);padding:6px 2px;display:flex;
  justify-content:space-between}
.catrow{display:flex;align-items:center;gap:8px;padding:9px 2px;
  font-size:11.5px;border-bottom:1px solid var(--line);cursor:pointer;
  width:100%;min-height:44px;border-inline:0;border-top:0;background:none;
  text-align:start;color:inherit}
.catrow:last-child{border-bottom:0}
.catrow .cname{flex:1;display:flex;align-items:center;gap:7px;min-width:0}
.catrow .cname span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.catrow i{font-style:normal;color:var(--gold-text);font-size:10px;min-width:20px;
  text-align:center;background:var(--mark-bg);border-radius:var(--r-xs);padding:1px 0;
  flex:0 0 auto}
.catrow .cc{font-size:10.5px;color:var(--muted);min-width:16px;
  text-align:center;font-variant-numeric:tabular-nums}

/* ---------- profile ---------- */
.who{display:flex;align-items:center;gap:12px;margin:4px 0 14px}
.av{width:52px;height:52px;border-radius:50%;background:var(--ink);
  color:var(--on-ink);
  display:grid;place-items:center;font:500 22px/1 var(--serif);direction:ltr;
  flex:0 0 auto;overflow:hidden}
.who .nm{font-size:15px;font-weight:700}
.who .id{font-size:11px;color:var(--muted);direction:ltr}
.vipcard{background:linear-gradient(140deg,#16324f,#27507a);color:#fff;
  border-color:#27507a}
.vipcard .lbl{color:#d3e2f0}
.vipcard .v{font-size:15px;font-weight:700}
.vipcard p{font-size:11.5px;color:#cfdeec;margin:6px 0 12px;line-height:1.75}
.vipcard .btn{background:var(--gold);border-color:var(--gold);color:#241a05}
.prow{display:flex;align-items:center;justify-content:space-between;gap:10px;
  background:transparent;border:0;border-bottom:1px solid var(--line);
  border-radius:0;padding:13px 2px;margin:0;font-size:12.5px;min-height:46px}
.prow .r{font-size:11.5px;color:var(--muted);direction:ltr}
.langsw{display:flex;background:var(--surface3);border-radius:var(--r-sm);
  padding:2px}
.langsw button{border:0;background:transparent;font-size:11px;padding:5px 10px;
  border-radius:6px;cursor:pointer;color:var(--ink2);min-height:30px}
.langsw button.on{background:var(--card);font-weight:600;color:var(--ink)}
.foot{font-size:11px;color:var(--muted);text-align:center;margin:20px 8px 0;
  line-height:1.9}

/* ---------- tabs ---------- */
/* The current tab is marked by a rule on the bar's top edge: the same hairline
   the section heads use, moved to the chrome. */
.tabs{flex:0 0 auto;display:flex;background:var(--card);
  border-top:1px solid var(--line);padding-bottom:var(--safe-b)}
.tabs button{position:relative;flex:1;min-height:52px;border:0;background:transparent;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:4px;font-size:10.5px;line-height:1;color:var(--tab-idle);cursor:pointer;
  padding:9px 2px 8px}
.tabs button.on{color:var(--ink);font-weight:600}
.tabs button.on::before{content:"";position:absolute;top:0;inset-inline:14px;
  height:2px;background:var(--ink)}
.tabs button span{max-width:100%;overflow:hidden;text-overflow:ellipsis;
  white-space:nowrap}
.tabs svg{width:20px;height:20px;stroke:currentColor;fill:none;
  stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}

/* ---------- sheet ---------- */
.sheet{position:absolute;inset:0;background:var(--scrim);
  display:flex;align-items:flex-end;z-index:8}
.sheet .in{background:var(--card);width:100%;border-radius:var(--r-xl) var(--r-xl) 0 0;
  border-top:1px solid var(--line);padding:14px 16px calc(20px + var(--safe-b));
  max-height:78%;overflow-y:auto}
@media (prefers-reduced-motion:no-preference){
  .sheet .in{animation:up .18s ease-out}
  .toast{animation:up .18s ease-out}
}
@keyframes up{from{transform:translateY(14px);opacity:.6}to{transform:none;
  opacity:1}}
.sheet .grab{width:36px;height:3px;border-radius:99px;background:var(--surface3);
  margin:0 auto 14px}
.sheet h3{margin:0 0 2px;font-size:15px;display:flex;gap:8px;align-items:baseline}
.sheet h3 i{font-style:normal;font-size:10.5px;color:var(--gold-text);
  background:var(--mark-bg);border-radius:var(--r-xs);padding:1px 5px}
.sheet .en{direction:ltr;text-align:left;font-size:11px;color:var(--muted);
  margin:0 0 8px}
.sheet .path{font-size:11px;color:var(--gold-text);margin:0 0 10px}
.sheet .cue{font-size:12px;line-height:1.9;color:var(--ink2);
  border-top:1px solid var(--line);border-bottom:1px solid var(--line);
  border-radius:0;padding:10px 0}
.sheet .cue b{display:block;font-size:10.5px;color:var(--muted);
  margin-bottom:4px;font-weight:600}
.sheet .cue .ln{display:block;unicode-bidi:plaintext;margin-bottom:4px}
.sheet .cue .ln:last-child{margin-bottom:0}
.sheet .used{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}
.sheet .used span{font-size:10.5px;background:var(--surface2);
  border-radius:var(--r-xs);
  padding:3px 7px;color:var(--ink2)}
.sheet .used span em{font-style:normal;color:var(--gold-text);font-weight:600}
.sheet .close{margin-top:14px;width:100%}

/* ---------- toast ---------- */
.toast{position:fixed;left:50%;bottom:calc(78px + var(--safe-b));
  transform:translateX(-50%);background:var(--toast-bg);color:var(--toast-ink);
  font-size:12px;padding:9px 16px;border-radius:99px;z-index:30;
  max-width:86vw;text-align:center}

/* ---------- word card: phonetic + example ---------- */
.word .pron{display:flex;align-items:center;gap:9px;margin:0 0 9px}
.word .ipa{font-size:13.5px;color:var(--ink2);font-family:var(--ipa)}
.saydot{width:32px;height:32px;border-radius:50%;border:1px solid var(--line);
  background:var(--card);font-size:13px;line-height:1;cursor:pointer;padding:0;
  display:grid;place-items:center;flex:0 0 auto;color:var(--ink2)}
.saydot svg{width:17px;height:17px;stroke:currentColor;fill:none;
  stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.saydot:active{background:var(--surface2)}
.word .chips{display:flex;flex-wrap:wrap;gap:4px;margin-bottom:7px}
/* The example is still set as a dictionary example, only now it has a surface
 * of its own so it cannot be mistaken for a second line of the definition. */
.word .ex{font-family:var(--serif);font-size:13.5px;color:var(--ink2);
  line-height:1.75;direction:ltr;text-align:left;
  background:var(--green-soft);border-inline-start:3px solid var(--green);
  border-radius:var(--r-sm);padding:9px 11px;
  margin:0 0 6px;unicode-bidi:plaintext}
.word .ex b{font-weight:500;
  background:linear-gradient(transparent 64%,var(--highlight) 64%)}
.word .fagloss{font-size:12.5px;color:var(--muted);margin-bottom:6px}

/* ---------- section panel ---------- */
.scard{display:flex;align-items:center;gap:12px;width:100%;min-height:58px;
  text-align:start;background:transparent;border:0;
  border-bottom:1px solid var(--line);border-radius:0;padding:12px 2px;
  cursor:pointer;color:inherit}
.scard .sic{width:32px;height:32px;border:1px solid var(--line);
  border-radius:var(--r-sm);background:var(--card);color:var(--ink2);
  display:grid;place-items:center;flex:0 0 auto}
.scard .sic svg{width:18px;height:18px;stroke:currentColor;fill:none;
  stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.scard .stt{flex:1;display:flex;flex-direction:column;gap:3px;min-width:0}
.scard .stt b{font-size:13px;font-weight:700}
.scard .stt span{font-size:11px;color:var(--muted);line-height:1.5}
.scard .chev{margin-inline-end:2px}
.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(88px,1fr));
  gap:8px;margin-bottom:12px}
.stats.n2{grid-template-columns:repeat(2,1fr)}
.stats.n3{grid-template-columns:repeat(3,1fr)}
.stats.n4{grid-template-columns:repeat(2,1fr)}
.stats>div{background:var(--card);border:1px solid var(--line);
  border-radius:var(--r-md);padding:11px 8px;text-align:center}
.stats b{display:block;font-size:17px;font-weight:600;line-height:1.2;
  font-variant-numeric:tabular-nums}
.stats span{font-size:10.5px;color:var(--muted);display:block;margin-top:4px}
.note p{font-size:12px;line-height:1.95;color:var(--ink2);margin:0}
.row.flat{cursor:default}
.row.more{justify-content:space-between;padding:13px 2px;border-bottom:0;
  border-top:1px solid var(--line);margin-top:2px}
.row.more .ttl{flex:1;font-weight:600;font-size:12px;color:var(--gold-text)}

/* ---------- rows that open ---------- */
.row.open{background:var(--tint);border-bottom-color:var(--line)}
/* home lanes: the row's icon is the tab it names, drawn the same way */
.row .lic{flex:0 0 20px;color:var(--ink2);display:flex}
.row .lic svg{width:20px;height:20px;stroke:currentColor;fill:none;
  stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.qbody .stats{margin-bottom:10px}
.qbody .brow{margin-top:9px}
.row .bar.thin{height:3px;margin-top:7px;background:var(--surface3)}
.row .bar.thin>i{background:var(--gold)}
.chev.up{transform:rotate(-135deg)}
[dir=ltr] .chev.up{transform:rotate(45deg)}
.qbody{padding:4px 2px 10px;border-bottom:1px solid var(--line);
  margin:-2px 0 8px}

/* ---------- search ---------- */
.searchbox{display:flex;gap:8px;margin-bottom:14px}
.searchbox input{flex:1;min-width:0;padding:11px 12px;border-radius:var(--r-sm);
  border:1px solid var(--line);background:var(--card);color:var(--ink);
  font-family:inherit;font-size:13px}
.sense{padding:9px 0;border-bottom:1px solid var(--line)}
.sense:last-child{border-bottom:0}
.sense i{font-style:normal;font-size:10.5px;color:var(--muted);
  display:block;margin-bottom:2px}
.gloss{font-family:var(--serif);font-size:13px;color:var(--ink2);line-height:1.7}
.card.empty{color:var(--muted);text-align:center;font-size:12px;line-height:1.8}
.card.empty p{margin:0 0 8px}

/* ---------- exam questions ---------- */
.qcard{padding:13px 14px}
.qhead{display:flex;align-items:center;gap:6px;margin-bottom:9px}
.qn{font:500 13px/1 var(--serif);color:var(--gold-text);direction:ltr;
  margin-inline-end:2px}
.stem{font-family:var(--serif);font-size:13px;line-height:1.75;color:var(--ink2);
  border-top:1px solid var(--line);border-bottom:1px solid var(--line);
  border-radius:0;padding:9px 0;margin-bottom:9px;unicode-bidi:plaintext;
  white-space:pre-line}
.stem.missing{color:var(--muted);font-style:italic}
.opts{display:flex;flex-direction:column}
.opt{display:flex;align-items:center;gap:6px;width:100%;text-align:start;
  background:none;border:0;border-bottom:1px solid var(--line);padding:10px 2px;
  cursor:pointer;color:var(--ink);font-family:inherit;min-height:44px}
.opt:last-child{border-bottom:0}
.opt .ow{flex:1;font-size:12.5px;font-weight:500;min-width:0;
  overflow-wrap:anywhere}
.opt.ok .ow{color:var(--green);font-weight:700}
.opt.ok{background:var(--green-soft)}
/* An idiom is not a lexicon headword, so its option row is not a link. */
.opt.plain{cursor:default}
/* The idioms a question used, kept under its options. */
.inote{margin-top:10px;padding-top:9px;border-top:1px dashed var(--line)}
.inote .qhead{margin-bottom:4px;flex-wrap:wrap}
.inote .iw{font:500 13.5px/1.4 var(--serif);color:var(--ink);direction:ltr;
  overflow-wrap:anywhere;margin-inline-end:2px}

/* ---------- book-list table ---------- */
/* A figure table, not a data grid: the name takes the room left after five
   fixed numeric columns, the header sits in the muted voice, and the rows are
   ruled like every other list in the app. Numbers are tabular so the columns
   line up, and the name may wrap because a book title is not a label. */
.tbl{margin:12px 0 2px;border-top:1px solid var(--line)}
.tbl .th,.tbl .tr{display:grid;gap:4px;align-items:baseline;padding:7px 2px;
  border-bottom:1px solid var(--line);font-variant-numeric:tabular-nums}
.tbl.n6 .th,.tbl.n6 .tr{grid-template-columns:1fr repeat(5,32px)}
.tbl.n3 .th,.tbl.n3 .tr{grid-template-columns:1fr repeat(2,44px)}
/* The interactive variant carries a narrow last column for the chevron that
   says a row opens. */
.tbl.n4 .th,.tbl.n4 .tr{grid-template-columns:1fr repeat(2,44px) 12px}
.tbl.n7 .th,.tbl.n7 .tr{grid-template-columns:1fr repeat(5,30px) 12px}
/* A row that opens is still a ruled table row, not a button with a box: no
   background of its own, no radius, the same grid as the header. */
.tbl button.tr{width:100%;border:0;background:transparent;color:inherit;
  font-family:inherit;cursor:pointer;text-align:start;min-height:40px}
.tbl button.tr .chev{justify-self:end}
.tbl .qbody{padding:0 2px 8px}
.tbl .th{font-size:10px;color:var(--muted)}
.tbl .tr{font-size:11.5px;line-height:1.5}
.tbl .tr span:first-child{font-weight:600;overflow-wrap:anywhere}
.tbl span:not(:first-child){text-align:end;word-break:keep-all}
/* The gap list is a sentence of words, not a control: it reads as the tail of
   the table it belongs to. */
.nblist{font-size:11.5px;color:var(--muted);line-height:1.9;margin:0 0 6px;
  padding:0 2px;unicode-bidi:plaintext}

/* ---------- recycled ---------- */
/* A bar row doubles as the picker here, so the graph and the choice are one
   control rather than two. The picked row is inked (bold label, gold bar, paper
   white) and the rest stay latent, the way the tab bar marks the current tab;
   the pick is never carried by colour alone — `aria-pressed` and the weight say
   it too. */
.row.pick{position:relative}
.row.pick.on{background:var(--tint)}
.row.pick.on .ttl{font-weight:700}
.row.pick .bar>i{background:var(--latent)}
.row.pick.on .bar>i{background:var(--gold)}
/* A word in a ruled list keeps the dictionary face it carries on its card. */
.row .recw{font-family:var(--serif);font-size:15px;font-weight:500}

/* ---------- night ---------- */
/* Only what a token swap cannot do: the one gradient gets a deeper well so it
   does not glow against #101010, and the button sitting on it moves from the
   red fill to the orange one, because #241a05 on the red is 3.4:1. */
html[data-theme="dark"] .vipcard{
  background:linear-gradient(140deg,#14202b,#1d3247);border-color:#1d3247}
html[data-theme="dark"] .vipcard .lbl{color:#cddbe8}
html[data-theme="dark"] .vipcard p{color:#c6d5e2}
html[data-theme="dark"] .vipcard .btn{background:var(--gold-text);
  border-color:var(--gold-text);color:#201408}
html[data-theme="dark"] .vipcard .btn:active{background:#f0b060}

/* ---------- grammar exams ---------- */
/* Charts that label themselves: the branch list is written out in words, and
   each paper's bar carries its top three branches in a caption underneath. */
.gexam{display:block;width:100%;text-align:start;padding:13px 2px;
  border:0;border-bottom:1px solid var(--line);background:none;color:inherit;
  font:inherit;cursor:pointer}
.gexam:last-child{border-bottom:0}
.gexam .gt{display:flex;align-items:baseline;gap:8px;font-size:12.5px;
  font-weight:600}
.gexam .gt .iso{flex:1;min-width:0;overflow-wrap:anywhere}
.gexam .gn2{font-size:11px;color:var(--gold-text);font-weight:600}
.gexam .chev{margin-inline-start:2px}
.gexam .gsub2{display:block;margin-top:5px;font-size:10.5px;
  color:var(--muted)}
.ebar{display:flex;height:8px;border-radius:99px;overflow:hidden;
  background:var(--surface3);margin-top:7px}
.ebar.empty{opacity:.55}
.ebar>i{display:block;height:100%}
.ecap{display:flex;flex-wrap:wrap;gap:3px 12px;margin-top:6px}
.ck{display:inline-flex;align-items:center;gap:4px;font-size:10.5px;
  line-height:1.5;color:var(--muted)}
.ck i{flex:0 0 7px;width:7px;height:7px;border-radius:2px}
/* The three levels above a question, in order: branch › sub-group › topic. */
.gpath{margin:3px 0 8px;font-size:10.5px;line-height:1.9;color:var(--ink2)}
.gpath .pl{color:var(--muted)}
.gpath .gsep{margin:0 2px;color:var(--muted)}
.gpath b{font-weight:600;color:var(--ink)}
.gopts{display:flex;flex-direction:column}
.gopt{display:flex;align-items:flex-start;gap:8px;padding:6px 0;
  border-bottom:1px solid var(--line);font-size:12.5px;line-height:1.5}
.gopt:last-child{border-bottom:0}
.gopt .ol{flex:0 0 15px;padding-top:1px;font-size:11px;font-weight:600;
  color:var(--muted)}
.gopt .ot{flex:1;min-width:0;overflow-wrap:anywhere}
.gopt.ok .ol{color:var(--green)}
.gopt.ok .ot{font-weight:600}

/* ---------- category browser ---------- */
.gcrit{margin:0;font-size:12px;line-height:1.95;color:var(--ink2)}
.gnote .pl{color:var(--muted)}
.gcrmb{margin:0 0 4px;font-size:11px}
.glink{background:none;border:0;padding:0;font:inherit;color:var(--gold-text);
  cursor:pointer}
.glink:active{opacity:.6}
.gyear{display:flex;align-items:flex-end;gap:5px;height:112px;padding-top:4px}
.ycol{flex:1;display:flex;flex-direction:column;justify-content:flex-end;
  align-items:center;height:100%;gap:4px;min-width:0}
.ycol i{display:block;width:100%;max-width:26px;min-height:2px;
  border-radius:2px 2px 0 0;background:var(--gold)}
.ycol b{font-size:9px;color:var(--muted);font-weight:400;
  font-variant-numeric:tabular-nums}
.gsum{margin-top:6px;font-size:10.5px;color:var(--muted)}
.ycol .yv{font-size:9px;color:var(--gold-text);font-weight:600;
  font-variant-numeric:tabular-nums;line-height:1}
.gyear{height:124px}
.gexam .ebar{height:6px;margin-top:6px}
.gexam .ebar>i{background:var(--gold-text)}
.ghalf{margin-top:12px}
.ghalf + .ghalf{padding-top:12px;border-top:1px solid var(--line)}
.glbl{display:flex;align-items:baseline;justify-content:space-between;gap:8px;
  font-size:11px;font-weight:600;color:var(--ink2)}
.glbl span{font-weight:400;font-size:10px;color:var(--muted)}
.ghalf .gyear{height:96px;padding-top:2px}
/* A year with no question must draw nothing, not a hairline that reads as 1. */
.ycol i{min-height:0}

/* ---------- quiz ---------- */
.qrow{display:flex;align-items:center;gap:10px;padding:9px 0;
  border-bottom:1px solid var(--line);font-size:11.5px}
.qrow:last-child{border-bottom:0}
.qrow>span{flex:0 0 58px;color:var(--muted)}
.qsel{flex:1;min-width:0;font:inherit;font-size:12px;color:var(--ink);
  background:var(--card);border:1px solid var(--line);
  border-radius:var(--r-sm);padding:8px}
/* The popup list is painted by the OS, not by the select box, so it needs its
   own pair of colours or it comes back black-on-dark in the night theme. */
.qsel option{color:var(--ink);background:var(--card)}
.qsel:disabled{opacity:.45}
.qchips{display:flex;gap:6px;flex-wrap:wrap}
.qchip{font:inherit;font-size:11.5px;padding:6px 13px;border-radius:99px;
  border:1px solid var(--line);background:none;color:var(--ink2);
  cursor:pointer}
.qchip.on{background:var(--gold-soft);border-color:var(--gold);
  color:var(--gold-ink)}
.qopt{width:100%;text-align:start;background:none;border:0;font:inherit;
  color:inherit;cursor:pointer}
.qopt:disabled{cursor:default;opacity:1}
.qopt.bad .ot,.qopt.bad .ol{color:var(--bad)}
.qopt.bad .ot{font-weight:600}
.qfb{font-size:12px;font-weight:600;margin:12px 2px 4px}
.qfb.good{color:var(--green)}
.qfb.bad{color:var(--bad)}
.qres{display:flex;align-items:baseline;gap:8px;margin:0 0 16px}
.qres b{font-size:38px;line-height:1;font-weight:700}
.qres span{font-size:12px;color:var(--muted)}
.chip.bad{background:var(--bad-soft);color:var(--bad)}
.btn.plain{background:none;color:var(--ink2);border:1px solid var(--line)}

/* ===========================================================================
 * The warm skin
 *
 * The fox is the app's voice: navy fur, gold ears, a cream page. Everything
 * below is that one character translated into chrome — warm cream paper,
 * chunky rounded cards, a floating tab bar with a gold pill on the current
 * tab, and small motions that make taps feel answered. Structure is
 * untouched: same tabs, same screens, same rows; only the surface and the
 * timing change.
 * ------------------------------------------------------------------------- */

/* ---------- boot: the fox instead of a monogram ---------- */
.boot h1{font-size:20px;letter-spacing:-.2px}
.spin{border-top-color:var(--gold);border-width:2.5px}

/* ---------- the hero: your account, and today's budget --------------------
 * No picture sits here. The card answers the two things the home screen is
 * opened with — who you are, and how much of today's lookup allowance is
 * left — and the notebook line follows underneath. */
.hero{position:relative;background:linear-gradient(155deg,#fffaf0 0%,#f9e9c9 100%);
  border:1px solid var(--line);border-radius:var(--r-xl);
  padding:14px 16px;margin:2px 0 14px;overflow:hidden;box-shadow:var(--sh)}
.hero::after{content:"";position:absolute;inset-block:-46px;inset-inline-end:-54px;
  width:190px;height:190px;border-radius:50%;
  background:radial-gradient(circle,rgba(201,146,51,.2),transparent 68%);
  pointer-events:none}
.hero .hello{position:relative;z-index:1;display:flex;align-items:flex-start;
  justify-content:space-between;gap:10px;margin:0;text-align:start}
.hero .hello .hi{font-size:11px;color:var(--gold-text);font-weight:600;
  letter-spacing:.3px}
.hero .hello .nm{font-size:19px;font-weight:700;letter-spacing:-.3px;
  margin-top:1px;overflow-wrap:anywhere}
.hero .streak{align-self:flex-start;background:var(--card);
  border:1px solid var(--line);border-radius:999px;padding:5px 10px}
.hero .quota{position:relative;z-index:1;display:flex;align-items:center;
  gap:10px;margin-top:12px}
.hero .qbar{flex:1;height:7px;border-radius:99px;background:var(--surface3);
  overflow:hidden}
.hero .qbar>i{display:block;height:100%;border-radius:99px;background:var(--gold)}
@media (prefers-reduced-motion:no-preference){
  .hero .qbar>i{transition:width .5s cubic-bezier(.2,.8,.25,1)}
}
.hero .qtext{font-size:10.5px;color:var(--muted);white-space:nowrap;
  font-variant-numeric:tabular-nums}
.hero>.sub{position:relative;z-index:1;font-size:11px;color:var(--muted);
  margin-top:9px;line-height:1.6}
html[data-theme="dark"] .hero{
  background:linear-gradient(155deg,#1e2438 0%,#262a3f 100%)}
html[data-theme="dark"] .hero::after{
  background:radial-gradient(circle,rgba(240,180,95,.14),transparent 68%)}

/* ---------- surfaces: chunky, warm, rounded ---------- */
.card{border-radius:var(--r-xl);box-shadow:var(--sh);border-color:var(--line)}
.lanes{border-radius:var(--r-xl);box-shadow:var(--sh);padding:4px 14px}
.card.empty{border-style:dashed;border-color:var(--line);
  background:transparent;box-shadow:none;padding:22px 16px;font-size:12.5px}
.word .gloss{border-radius:var(--r-md)}
.word .ex{border-radius:var(--r-md)}
.stats>div{border-radius:var(--r-lg);box-shadow:var(--sh)}
.qcard{border-radius:var(--r-xl)}
.bkcard{border-radius:var(--r-lg);box-shadow:var(--sh);
  border-inline-start-width:5px}
.bkcard:active{border-inline-start-color:var(--gold)}
.main{border-radius:var(--r-xl);box-shadow:var(--sh)}

/* A section head keeps its label but the rule under it turns into a dotted
 * seam, and the label itself carries a gold underline — a marker stroke that
 * follows the words, so it mirrors with the script without a positioned box. */
.sect{border-bottom:2px dotted var(--line);margin:26px 0 12px;padding:0 2px 8px;
  font-size:13px;gap:8px;justify-content:space-between}
.sect>span{font-weight:600}
.sect:not(:has(span)){text-decoration:underline;
  text-decoration-color:var(--gold);text-decoration-thickness:3px;
  text-underline-offset:7px;text-decoration-skip-ink:none}
.sect span{margin-inline-start:auto;text-decoration:none}

/* ---------- controls ---------- */
.btn{border-radius:999px;padding:12px 20px;font-weight:700;
  box-shadow:0 10px 20px -16px rgba(30,43,77,.9)}
.btn:active{transform:scale(.975)}
.btn.ghost{background:var(--card);box-shadow:none}
.chip{border-radius:999px;padding:3px 9px}
.qchip{border-radius:999px;padding:7px 14px;background:var(--card)}
.qchip.on{background:var(--gold-soft);border-color:var(--gold)}
.chip.gold,.chip.green,.chip.bad{border-radius:999px}
.langsw{border-radius:999px;padding:3px}
.langsw button{border-radius:999px}
.row,.prow,.scard,.ledger,.gexam{transition:background .18s ease}
.scard .sic{border-radius:var(--r-md);background:var(--gold-soft);
  color:var(--gold-ink);border-color:transparent}
.lanes .row .lic{border-radius:var(--r-md)}
.ledger .no{border-radius:var(--r-sm);background:var(--gold-soft);
  color:var(--gold-ink)}
.streak{border-radius:999px;background:var(--gold-soft);color:var(--gold-ink)}
.saydot{border-radius:50%;box-shadow:var(--sh)}
.allbtn,.shelfmore{box-shadow:none}

/* ---------- the tab bar floats ---------- */
.tabs{margin:6px 10px calc(8px + var(--safe-b));padding:6px 6px;
  border:1px solid var(--line);border-top:1px solid var(--line);
  border-radius:24px;background:var(--card);box-shadow:var(--sh-lift);
  gap:2px}
.tabs button{border-radius:18px;transition:background .2s ease,color .2s ease,
  transform .14s ease}
.tabs button.on{background:var(--gold-soft);color:var(--gold-ink);
  font-weight:700}
.tabs button.on::before{display:none}
.tabs svg{transition:transform .2s ease}
.tabs button.on svg{transform:translateY(-1px) scale(1.06)}
.tabs button:active{transform:scale(.95)}

/* ---------- motion: screens rise, taps answer ---------- */
@keyframes rise{from{opacity:0;transform:translateY(10px)}to{opacity:1;
  transform:none}}
@media (prefers-reduced-motion:no-preference){
  #screen>*{animation:rise .3s cubic-bezier(.2,.8,.25,1) both}
  #screen>*:nth-child(2){animation-delay:.03s}
  #screen>*:nth-child(3){animation-delay:.06s}
  #screen>*:nth-child(4){animation-delay:.09s}
  #screen>*:nth-child(5){animation-delay:.12s}
  #screen>*:nth-child(6){animation-delay:.14s}
  #screen>*:nth-child(n+7){animation-delay:.16s}
  .card,.lanes,.store,.qcard{transition:transform .2s ease,box-shadow .2s ease}
  .row:active,.scard:active,.ledger:active,.gexam:active,.bkcard:active,
  .prow:active,.opt:active,.qopt:active{transform:scale(.985)}
  .ibtn:active{transform:scale(.9)}
  .opt.ok,.qopt.ok{animation:pop .3s ease}
  .toast{animation:toastIn .26s cubic-bezier(.2,.8,.25,1)}
}
@keyframes pop{0%{transform:scale(.98)}60%{transform:scale(1.014)}
  100%{transform:none}}
@keyframes toastIn{from{opacity:0;transform:translate(-50%,10px)}
  to{opacity:1;transform:translate(-50%,0)}}
.toast{transform:translateX(-50%)}

/* ---------- night: the book by lamplight ---------- */
html[data-theme="dark"] .vipcard{
  background:linear-gradient(140deg,#1c2438,#2a3654);border-color:#2a3654;
  box-shadow:var(--sh)}
html[data-theme="dark"] .vipcard .btn{box-shadow:0 10px 18px -14px #000}
html[data-theme="dark"] .card.empty{background:transparent}
html[data-theme="dark"] .tabs{box-shadow:0 18px 30px -24px #000}

/* The fox also turns up where the app is waiting, so a spinner is never the
 * only thing on the page. */


/* Tool menus become a stack of chunky cards rather than a bare ruled list:
 * the same rows, the same order, but each one is a thing you can press and
 * the fox's gold plate holds its icon. */
.scard{background:var(--card);border:1px solid var(--line);
  border-radius:var(--r-lg);box-shadow:var(--sh);padding:13px 14px;
  margin-bottom:10px;border-bottom:1px solid var(--line);min-height:62px}
.scard .stt b{font-size:13.5px;letter-spacing:-.1px}
.scard .sic{width:38px;height:38px;border-radius:var(--r-md)}
.scard .sic svg{width:19px;height:19px}
.scard:last-child{margin-bottom:0}

/* The tailpiece: a fox at the end of a menu, small and quiet. */


/* The account avatar is the initial on ink; the badge is not scaled down to
 * a size where its wordmark turns to mush. */
.who .av{border-radius:50%;box-shadow:var(--sh);font-size:20px}
.card.empty{border-radius:var(--r-lg)}
.vipcard{background:linear-gradient(140deg,#1e2b4d,#33406b);
  border-color:#33406b}

/* The book shelf: a grabbing hand while it is being dragged, and no snap
 * fighting the finger mid-drag. */
.bkstrip{cursor:grab;overscroll-behavior-x:contain;scrollbar-width:none}
.bkstrip.dragging{cursor:grabbing;scroll-snap-type:none;
  scroll-behavior:auto;user-select:none}
.bkstrip.dragging .bkcard{pointer-events:none}
/* Snap must respect the strip's own breathing room, or the first card is
 * pulled flush to the edge and its padding disappears. */
.bkstrip{scroll-padding-inline:14px}

/* Two pronunciations, two boxes: the bank keeps UK and US in one string, but
 * they answer different questions, so each gets its own labelled plate. */
.pron{flex-wrap:wrap;row-gap:7px}
.ipabox{display:inline-flex;align-items:baseline;gap:7px;
  background:var(--surface2);border:1px solid var(--line);
  border-radius:var(--r-sm);padding:5px 10px}
.ipabox b{font-size:9.5px;font-weight:700;letter-spacing:.6px;
  color:var(--gold-text)}
.ipabox .ipa{font-size:13px;color:var(--ink2);white-space:nowrap}
/* The headword and its play button share a line, so the two pronunciation
 * boxes below have the full width to themselves. */
.wrow{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
.wrow .w{margin-bottom:9px}
.wrow .saydot{margin-top:6px}

/* ---------- a word's exam questions, opened in place ---------- */
.wqgroup{margin-bottom:10px}
.wqex{border-bottom:0;padding-bottom:2px}
.row.wq{padding-inline-start:18px;border-bottom:1px dashed var(--line)}
/* The base .row .ttl is a column (title over subtitle); here the number and
 * its part chips sit on one line, so the row stays one row tall. */
.wqex .ttl,.row.wq .ttl{display:flex;flex-direction:row;align-items:center;
  gap:7px;flex-wrap:wrap;text-align:start}
.wqex .ttl{font-size:12px;font-weight:600;color:var(--ink2)}
.row.wq .ttl{font-weight:600}
.wqbody{padding:2px 18px 12px;margin-top:-4px}
.wqbody .stem{margin-bottom:8px}
.wqload{font-size:11.5px;color:var(--muted);padding:8px 0}

/* ===========================================================================
 * Motion: the sheet behaves like paper
 *
 * Everything here is either driven by a state that only exists after a tap
 * (an unfolded answer, a marked option) or by :active, so a plain re-render
 * never sets the whole page dancing. Colours cross-fade when the theme flips,
 * the hero's glow breathes, and every press answers with a small physical
 * move. All of it is off under `prefers-reduced-motion`.
 * ------------------------------------------------------------------------- */
@media (prefers-reduced-motion:no-preference){
  /* A theme flip is a change of light, not a flash: the surfaces cross-fade. */
  body,.app,.topbar,.card,.tabs,.sheet .in,.hero{
    transition:background-color .3s ease,color .3s ease,border-color .3s ease}
  /* The answer unfolds from under its question rather than appearing. */
  @keyframes unfold{from{opacity:0;transform:translateY(-6px)}
    to{opacity:1;transform:none}}
  @keyframes shake{0%,100%{transform:none}20%{transform:translateX(-3px)}
    40%{transform:translateX(3px)}60%{transform:translateX(-2px)}
    80%{transform:translateX(2px)}}
  @keyframes glow{0%,100%{opacity:.75;transform:scale(1)}
    50%{opacity:1;transform:scale(1.07)}}
  @keyframes ring{from{opacity:.9;transform:scale(.8)}
    to{opacity:0;transform:scale(1.5)}}

  .qbody,.wqbody{animation:unfold .26s cubic-bezier(.2,.8,.25,1) both;
    transform-origin:top center}
  /* A wrong option shakes once; the right one still pops. */
  .opt.bad,.qopt.bad{animation:shake .36s ease both}
  .opt.ok,.qopt.ok{animation:pop .3s ease both}

  /* The hero's corner light breathes, slowly enough to be a mood. */
  .hero::after{animation:glow 7s ease-in-out infinite}

  /* Icons and gutter numbers take the press with the row. */
  .scard .sic,.ledger .no{transition:transform .16s ease}
  .scard:active .sic{transform:rotate(-7deg) scale(.93)}
  .ledger:active .no{transform:translateY(1.5px) scale(.96)}

  /* The speaker draws a ring when it is pressed. */
  .saydot{position:relative}
  .saydot::after{content:"";position:absolute;inset:-4px;border-radius:50%;
    border:2px solid var(--gold);opacity:0;pointer-events:none}
  .saydot:active::after{animation:ring .5s ease-out}

  /* Cards hold their lift while pressed instead of snapping. */
  .card,.lanes,.hero,.qcard{transition:transform .2s ease,box-shadow .2s ease,
    background-color .3s ease,color .3s ease,border-color .3s ease}
}

/* A few more, all of them either always-on or tied to a single event. */
@media (prefers-reduced-motion:no-preference){
  /* The boot mark bobs while the app is fetching, so a wait is not a freeze. */
  @keyframes bob{0%,100%{transform:translateY(0)}50%{transform:translateY(-4px)}}
  .boot .mark{animation:bob 1.8s ease-in-out infinite}
  .boot .spin{margin-top:20px}

  /* The streak chip breathes once every few seconds, like a lit stove. */
  @keyframes breathe{0%,100%{transform:scale(1)}50%{transform:scale(1.035)}}
  .streak{animation:breathe 3.6s ease-in-out infinite;display:inline-block}

  /* A shelf card tips into the press instead of only shrinking. */
  @keyframes tip{to{transform:rotate(-1.2deg) translateY(1px)}}
  .bkcard:active{animation:tip .16s ease forwards}

  /* The practice score lands big, then settles. */
  @keyframes land{from{opacity:0;transform:scale(.82)}60%{opacity:1;
    transform:scale(1.04)}to{opacity:1;transform:none}}
  .qres b{animation:land .34s cubic-bezier(.2,.8,.25,1) both}

  /* The feedback line slides in under the marked answer. */
  @keyframes slideIn{from{opacity:0;transform:translateY(4px)}
    to{opacity:1;transform:none}}
  .qfb{animation:slideIn .24s ease both}
}

/* ============================================================================
   v3 — hierarchy, density and states (2026-11-14)

   The v2 skin drifted from DESIGN.md in four measurable ways, and this section
   corrects them without touching markup:

   1. --muted shipped at #6f7486, which is 4.18:1 on paper and 3.59:1 on the tab
      bar — under AA for the 11 px captions it is used on. DESIGN.md's #5b6672
      measured 4.18 too (it was written against #f7f3ea, not the warmer #fbf2df),
      so the token is set to the darkest warm grey that still reads grey: 5.9:1
      on paper, 6.4:1 on a card.
   2. Tap targets: the play button was 32 px and the synonym chips 26 px. Both
      are now a 44 px hit area with a smaller drawn shape, so the page did not
      grow.
   3. Type floor: IPA labels and ledger captions sat at 9–9.5 px; the floor is
      10.5, which is what the rest of the micro-copy uses.
   4. Structure: every surface carried a shadow and a 20–26 px radius, so a card
      nested in the hero looked like the same plane twice. Shadows are gone, the
      radii come down to DESIGN.md's range, and separation is the hairline again.

   The rest is hierarchy: the headword is the one thing on the word screen and is
   set at 34 px; the hero's quota becomes a labelled measure instead of a thin
   bar with a caption floating beside it; sections are ruled with one hairline
   instead of a dotted seam.
   ========================================================================== */

:root{
  --muted:#57616d;          /* 5.9 on paper, 6.4 on card */
  --tab-idle:#63605a;       /* 5.6 on the tab bar */
  --line:#e6d8ba;
  --r-xs:6px; --r-sm:10px; --r-md:12px; --r-lg:14px; --r-xl:18px;
  --sh:none; --sh-lift:none;
}
html[data-theme="dark"]{
  --muted:#b6ad9e;          /* 8.1 on the card */
  --tab-idle:#a29a8c;       /* 6.2 on the tab bar */
  --line:#2f2c26;
}

/* --- separation is a rule, not a shadow ---------------------------------- */
.card,.lanes,.stats>div,.bkcard,.main,.saydot,.btn,.qcard{
  box-shadow:none;
}
.card,.word,.lanes,.main,.qcard{border-radius:var(--r-lg)}
.btn{border-radius:var(--r-md);padding:12px 18px}
.chip{border-radius:var(--r-xs)}
.chip.gold,.chip.green,.chip.bad,.qchip,.streak{border-radius:999px}

/* --- the type floor ------------------------------------------------------ */
.ipabox b{font-size:10.5px;letter-spacing:.5px}
.ledger .mark i{font-size:10.5px}
.hero .qtext{font-size:11.5px}
.tabs button{font-size:11px}
.card.empty{font-size:13px;line-height:1.9;padding:20px 16px;border-style:solid}

/* --- tap targets: 44 px of hit area, a smaller drawn shape ---------------- */
.saydot{position:relative;width:34px;height:34px}
.saydot::after{content:"";position:absolute;inset:-7px;border-radius:50%}
.langsw button{min-height:44px;padding:8px 12px;font-size:12px}
.chips{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-top:2px}
.chip{margin:0}
button.chip{display:inline-flex;align-items:center;min-height:44px;
  padding:0 14px;font-size:12px}

/* --- home: one focal point, a labelled measure ---------------------------- */
.hero{background:var(--card);border-radius:var(--r-lg);padding:14px 16px}
.hero::after{display:none}
.hero .hello .nm{font-size:19px;line-height:1.2}
.hero .quota{flex-direction:column;align-items:stretch;gap:7px;margin-top:12px}
.hero .qtext{order:-1;white-space:normal}
.hero .qbar{height:6px}
.hero .streak{background:var(--surface2);border-color:transparent}

/* --- the word screen: the headword is the page ---------------------------- */
.word .w{font-size:34px;line-height:1.1}
.wrow{justify-content:flex-start;gap:12px}
.pron{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:10px}
.pron .ipabox{background:transparent;border-color:transparent;padding:3px 0}
.pron .saydot{flex:0 0 auto}

/* --- section heads: one hairline, the label keeps its marker -------------- */
.sect{border-bottom:1px solid var(--line);margin:24px 0 10px;padding:0 0 8px}

/* --- rows read as a list, and answer the finger --------------------------- */
.row,.ledger,.prow,.scard,.gexam{transition:background .16s ease}
.row:active,.ledger:active,.prow:active{background:var(--tint)}
.ledger{min-height:56px}
.ledger .pname{font-size:14px}

/* --- the paid surface: the one gradient, legible -------------------------- */
.vipcard .lbl{color:#e9f1fa}
.vipcard p{color:#dde8f5}

/* --- keyboard and reduced motion ----------------------------------------- */
:focus-visible{outline:2px solid var(--gold-text);outline-offset:2px;
  border-radius:var(--r-xs)}
button:focus:not(:focus-visible){outline:none}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.001ms!important;
    animation-iteration-count:1!important;transition-duration:.001ms!important;
    scroll-behavior:auto!important}
}

/* --- the last three measurements -----------------------------------------
 * The play control keeps its 34 px circle but the button box is 44 px, so the
 * figure is a real target rather than an expanded invisible one.
 * The remaining 9–10 px captions (chart years, table heads, category marks,
 * legend labels) come up to the 10.5 floor, and the back link gets a full row. */
.saydot{width:44px;height:44px;border:0;background:none;position:relative}
.saydot::before{content:"";position:absolute;inset:5px;border-radius:50%;
  border:1px solid var(--line);background:var(--card)}
.saydot svg{position:relative}
.saydot:active{background:none}
.saydot:active::before{background:var(--surface2)}
.pron .saydot,.wrow .saydot{margin:0}
.catrow i{font-size:10.5px}
.tbl .th{font-size:10.5px}
.ycol b,.ycol .yv{font-size:10.5px}
.glbl span{font-size:10.5px}
.backlink{min-height:44px}

/* --- the home card is one surface, and a synonym is a word ----------------
 * The word of the day is already inside the hero card; giving it a second
 * border made the home screen read as two frames around one fact, so the
 * inner card keeps only its top rule. Synonyms are Latin words in an RTL page:
 * the row runs left to right and wears hairline chips, so the eye reads them as
 * words to look up rather than as a segmented control. */
.hero .card{background:transparent;border:0;border-top:1px solid var(--line);
  border-radius:0;padding:12px 0 0;margin:0}
.hero .card .card{border-top:0}
.chips.latin{direction:ltr;justify-content:flex-start}
button.chip{background:transparent;border:1px solid var(--line);
  color:var(--ink);font-weight:600}
button.chip:active{background:var(--surface2)}

/* --- home keeps its boxes -------------------------------------------------
 * The inline pass above flattens the whole app onto hairline rules, which is
 * what the word screen wanted. The home screen did not: it is a dashboard of
 * separate jobs — today's word, the lanes, the exam ledger, the shelf — and
 * each one reads better as its own raised box. So the v2 composition is
 * restored here, scoped to the home view through the `data-view` attribute the
 * renderer sets, and the global rules above stay as they are for every other
 * screen. Contrast, type floor and 44 px targets are not reverted; only the
 * surfaces and the hero's paper.
 */
:root{--sh-card:0 10px 24px -20px rgba(30,43,77,.55)}
html[data-theme="dark"]{--sh-card:0 12px 26px -22px rgba(0,0,0,.8)}

#screen[data-view="home"] .hero{
  background:linear-gradient(155deg,#fffaf0 0%,#f9e9c9 100%);
  border-radius:var(--r-xl);padding:14px 16px;
  box-shadow:var(--sh-card)}
#screen[data-view="home"] .hero::after{display:block}
#screen[data-view="home"] .hero .card{
  background:var(--card);border:1px solid var(--line);
  border-radius:var(--r-xl);padding:14px;margin:0;
  box-shadow:var(--sh-card)}
#screen[data-view="home"] .card,
#screen[data-view="home"] .lanes,
#screen[data-view="home"] .stats>div{border-radius:var(--r-xl);
  box-shadow:var(--sh-card)}
#screen[data-view="home"] .bkcard{border-radius:var(--r-lg);
  box-shadow:var(--sh-card)}
#screen[data-view="home"] .sect{border-bottom:2px dotted var(--line);
  margin:26px 0 12px;padding:0 2px 8px}
#screen[data-view="home"] .streak{background:var(--card);
  border:1px solid var(--line)}
html[data-theme="dark"] #screen[data-view="home"] .hero{
  background:linear-gradient(155deg,#1e2438 0%,#262a3f 100%)}

/* --- a column is a paper, not a year ---------------------------------------
 * The grammar history used to add a year's papers into one column, so 1398,
 * 1399, 1402, 1403 and 1404 each lost a paper. Each paper now has its own bar;
 * the year is printed once under the group, and the bars inside a group are
 * separated by a hairline so two papers read as two, not as one thick column. */
.gyear{align-items:flex-end;gap:7px}
.ygrp{flex:1;display:flex;flex-direction:column;justify-content:flex-end;
  height:100%;gap:5px;min-width:0}
.ybars{flex:1;display:flex;align-items:flex-end;justify-content:center;
  gap:2px;min-height:0}
.ycol{flex:1;height:100%;justify-content:flex-end}
.ycol+.ycol{border-inline-start:1px solid var(--line)}
.ycol i{max-width:16px}
.ygrp>b{text-align:center;overflow:hidden;text-overflow:ellipsis;font-size:10.5px;
  color:var(--muted);font-weight:400;font-variant-numeric:tabular-nums}
.gyear-note{display:flex;flex-wrap:wrap;gap:4px 12px;margin:7px 0 0;
  font-size:10.5px;line-height:1.7;color:var(--muted)}
.gyear-note b{font-weight:600;color:var(--ink2);font-variant-numeric:tabular-nums}

/* --- two papers in a year, at phone width ---------------------------------
 * The axis now carries every stored paper (22 of them), so a year label sits in
 * a narrower cell than before: it may bleed into the gap rather than clip to
 * "۱۴۰…". A paper with no question for the branch gets a 2 px latent stub, so
 * the column is visibly there and visibly empty, not missing. */
.ygrp>b{overflow:visible;white-space:nowrap;margin-inline:-6px;font-size:10.5px}
.ycol i.zero{min-height:2px;background:var(--latent);opacity:.9}
.gyear-note{justify-content:flex-start}
