/* =====================================================================
   Writing Studio — premium.css
   A quiet, editorial override layer: paper and ink by day,
   ink and lamplight by night. Link it LAST in index.html.

   How it is built
   - §1–2 retoken :root and dark mode. Most of the site follows from that.
   - §3–17 only touch what the tokens cannot reach.
   - Rules that compete with css/glass.css or css/clues.css start with
     ":root " (one extra class of specificity). glass.css is re-appended
     by JS after clues.css loads, so plain selectors here could lose.
   - §18 keeps Strict Exam screens (.cd-exam, .rd-root) undecorated.
   - §19 motion: no new loops, no parallax. Colour fades only when
     html[data-motion=on]; small lifts only without reduced motion.
   - Performance: no backdrop-filter on full-screen layers, the colour
     field no longer drifts, blur stays only on the top bar and the
     Vocabulary panel (and drops while you drag it).
   Undo: delete the <link> and this file.
   ===================================================================== */


/* =====================================================================
   §1  TOKENS — light ("paper and ink")
   Scoped with :not([data-theme=dark]) so none of it leaks into dark.
   ===================================================================== */
:root:not([data-theme=dark]) {
  --bg: #F5F2EC;
  --surface: #FFFDF9;
  --surface-2: #FAF7F1;
  --ink: #1A1A1F;
  --muted: #5F5B55;
  --line: #E4DED3;
  --brand: #1D3557;
  --brand-600: #142742;
  --brand-50: #ECF0F5;
  --accent: #B08440;
  --ok: #2B7352;
  --warn: #94600F;
  --err: #B93838;
  --spell: #D9434A;
  --focus: #2E63C9;
  --r-sm: 8px;
  --r-md: 11px;
  --r-lg: 16px;
  --shadow-1: 0 1px 1px rgba(45,36,22,.035), 0 1px 3px rgba(45,36,22,.06);
  --shadow-2: 0 1px 2px rgba(45,36,22,.05), 0 10px 26px -8px rgba(45,36,22,.16);
  --shadow-3: 0 2px 5px -1px rgba(45,36,22,.06), 0 20px 42px -14px rgba(45,36,22,.24);
  --surface-hi: inset 0 1px 0 rgba(255,255,255,.85);
  --on-brand: #FFFFFF;
  --chip-ink: #1D3557;
  --gold: #E2C47F;
  --ivory: #F5EDDC;
  --case-back: #EFE8DB;
  --case-back-2: #E2D7C4;
  --case-frame: #7A5232;
  --wood-1: #C99D68;
  --wood-2: #A0703F;
  --wood-3: #6B4524;
  --topbar-bg: rgba(245,242,236,.82);
  --paper-glow: rgba(255,251,242,.9);
  --skeleton: #ECE7DD;
  --skeleton-shine: rgba(255,255,255,.7);

  /* premium additions */
  --paper: #FFFFFF;                     /* the writing page, model answers */
  --head-ink: #172238;                  /* Fraunces headings: ink with a little navy */
  --line-strong: #D2CABC;
  --input-line: #958C7C;                /* 3:1 against the page, for form fields */
  --brand-line: rgba(29,53,87,.2);
  --brand-edge: rgba(29,53,87,.45);
  --brass: #8A6424;                     /* accent that passes 4.5:1 as text */
  --brass-50: #F7EFE1;
  --brass-line: rgba(176,132,64,.36);
  --warn-50: #FBF1DE;
  --hover-wash: rgba(26,26,31,.055);
  --select: rgba(176,132,64,.24);
  --mark: rgba(214,168,72,.34);
  --focus-halo: rgba(46,99,201,.16);
  --btn-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 1px 2px rgba(16,24,40,.2), 0 4px 10px -4px rgba(20,34,64,.4);
  --emboss: rgba(255,255,255,.7);
  --case-lamp: rgba(255,247,228,.8);
  --raised: #FFFFFF;                    /* selected segment / tab */
  --raised-shadow: 0 1px 2px rgba(40,30,15,.09), inset 0 0 0 1px var(--line);
  --vocab-bg: rgba(255,253,249,.92);
  --vocab-shadow: 0 1px 2px rgba(45,36,22,.06), 0 22px 50px -16px rgba(45,36,22,.32), inset 0 1px 0 rgba(255,255,255,.7);

  /* css/glass.css, retuned: more opaque, warmer, quieter */
  --glass-bg: rgba(255,253,249,.78);
  --glass-bg-strong: rgba(255,253,249,.94);
  --glass-bg-tint: rgba(255,253,249,.62);
  --glass-edge: rgba(255,255,255,.7);
  --glass-edge-dim: rgba(255,255,255,.22);
  --glass-inset: inset 0 1px 0 rgba(255,255,255,.75);
  --glass-shadow: 0 1px 2px rgba(45,36,22,.05), 0 18px 44px -14px rgba(45,36,22,.24);
  --glass-blur: 10px;
  --glass-sat: 1.15;
}

/* =====================================================================
   §2  TOKENS — dark ("ink and lamplight")
   ===================================================================== */
:root[data-theme=dark] {
  --bg: #101217;
  --surface: #171A20;
  --surface-2: #1C2027;
  --ink: #ECE8E0;
  --muted: #A39F98;
  --line: #2A2E37;
  --brand: #9DB7DC;
  --brand-600: #BCD0EC;
  --brand-50: #1A2330;
  --accent: #D4B06A;
  --ok: #55B886;
  --warn: #D9A24A;
  --err: #EF7171;
  --spell: #F0646A;
  --focus: #8AB0F0;
  --r-sm: 8px;
  --r-md: 11px;
  --r-lg: 16px;
  --shadow-1: 0 1px 2px rgba(0,0,0,.32);
  --shadow-2: 0 1px 2px rgba(0,0,0,.3), 0 12px 30px -8px rgba(0,0,0,.55);
  --shadow-3: 0 2px 6px rgba(0,0,0,.32), 0 22px 46px -12px rgba(0,0,0,.66);
  --surface-hi: inset 0 1px 0 rgba(255,255,255,.045);
  --on-brand: #0F1115;
  --chip-ink: #BCD0EC;
  --gold: #E2C47F;
  --ivory: #F1E8D4;
  --case-back: #1B1D23;
  --case-back-2: #14161B;
  --case-frame: #3B2918;
  --wood-1: #6F4F31;
  --wood-2: #553A20;
  --wood-3: #3A2714;
  --topbar-bg: rgba(16,18,23,.8);
  --paper-glow: rgba(212,176,106,.05);
  --skeleton: #232731;
  --skeleton-shine: rgba(255,255,255,.06);

  --paper: #1D2129;
  --head-ink: #F4F0E8;
  --line-strong: #3A3F4A;
  --input-line: #5F6675;
  --brand-line: rgba(157,183,220,.26);
  --brand-edge: rgba(157,183,220,.5);
  --brass: #D4B06A;
  --brass-50: #252015;
  --brass-line: rgba(212,176,106,.32);
  --warn-50: #2A2113;
  --hover-wash: rgba(236,232,224,.07);
  --select: rgba(212,176,106,.3);
  --mark: rgba(212,176,106,.3);
  --focus-halo: rgba(138,176,240,.2);
  --btn-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 1px 2px rgba(0,0,0,.45);
  --emboss: rgba(0,0,0,.3);
  --case-lamp: rgba(226,190,120,.11);
  --raised: #262B34;
  --raised-shadow: 0 1px 2px rgba(0,0,0,.4), inset 0 0 0 1px var(--line-strong);
  --vocab-bg: rgba(23,26,32,.92);
  --vocab-shadow: 0 1px 2px rgba(0,0,0,.4), 0 24px 54px -16px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.05);

  --glass-bg: rgba(23,26,32,.74);
  --glass-bg-strong: rgba(23,26,32,.93);
  --glass-bg-tint: rgba(23,26,32,.56);
  --glass-edge: rgba(255,255,255,.12);
  --glass-edge-dim: rgba(255,255,255,.06);
  --glass-inset: inset 0 1px 0 rgba(255,255,255,.06);
  --glass-shadow: 0 1px 2px rgba(0,0,0,.3), 0 20px 46px -12px rgba(0,0,0,.62);
  --glass-blur: 10px;
  --glass-sat: 1.15;
}

/* Referenced by vocab.css / answers.css / the chooser but never defined.
   Defining them fixes white chooser cards in dark mode and lets vocab
   examples and model answers render at their intended sizes. */
:root {
  --text: var(--ink);
  --card: var(--surface);
  --font: var(--font-ui);
  --font-essay: var(--font-ui);
}


/* =====================================================================
   §3  BASE — type, selection, focus
   ===================================================================== */
body {
  background:
    radial-gradient(1100px 520px at 50% -160px, var(--paper-glow), transparent 72%) no-repeat,
    var(--bg);
  letter-spacing: -.009em;              /* Inter's own tracking at 16 px */
}
/* Overlays that must match a textarea glyph for glyph, and the reading
   engine, keep normal tracking. */
.mirror, .flash-mirror,
.rd-root, .rd-pop, .rd-modal-layer, .rd-toast { letter-spacing: normal; word-spacing: normal; }

:is(.page, .pr, .sheet-inner, .vocab-float, .gate-card) :is(h1, h2, h3) {
  color: var(--head-ink);
  text-wrap: balance;
}
:is(.page, .pr, .sheet-inner, .vocab-float) ::selection { background: var(--select); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.book:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }

:is(.pr-q, .vocab-body, .sheet-inner, .clues-body, .zoom-body) {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.muted { color: var(--muted); }
.skip-link { border-radius: var(--r-sm); font-weight: 600; }


/* =====================================================================
   §4  TOP BAR AND BRAND
   Height stays exactly 60 px (Practice sizes itself from it).
   ===================================================================== */
:root .topbar {
  background: var(--topbar-bg);
  border-bottom-color: var(--line);
  box-shadow: 0 1px 0 var(--emboss);
  padding-left: clamp(12px, 4vw, 32px);
  padding-right: clamp(12px, 4vw, 32px);
}
/* On wide screens the brand lines up with the page's left edge. */
:root body:is([data-route=shelf], [data-route=book], [data-route=book-writing], [data-route=book-reading], [data-route=result]) .topbar {
  padding-left: max(clamp(12px, 4vw, 32px), calc((100% - 1200px) / 2 + clamp(14px, 4vw, 32px)));
  padding-right: max(clamp(12px, 4vw, 32px), calc((100% - 1200px) / 2 + clamp(14px, 4vw, 32px)));
}
:root body[data-route=practice] .topbar {
  background: var(--bg);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  padding-left: max(clamp(12px, 2vw, 24px), calc((100% - 1480px) / 2 + clamp(12px, 2vw, 24px)));
  padding-right: max(clamp(12px, 2vw, 24px), calc((100% - 1480px) / 2 + clamp(12px, 2vw, 24px)));
}

.brand { gap: 11px; }
.brand-mark { width: 24px; height: 24px; }
.brand-mark rect:nth-child(3) { opacity: .5; }
.brand-name {
  font: 600 19px/1.1 var(--font-head);
  letter-spacing: -.014em;
  color: var(--head-ink);
  min-width: 0;
}

.topbar .icon-btn { color: var(--muted); }
.topbar .icon-btn:hover { color: var(--ink); }


/* =====================================================================
   §5  BUTTONS, ICON BUTTONS, LINKS, CHIPS, STATUS
   Base .btn keeps its size and padding (many contexts tune those).
   ===================================================================== */
:root .btn { border-radius: var(--r-sm); letter-spacing: .003em; }

:root .btn-primary {
  background-color: var(--brand);
  background-image: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,0) 60%);
  border-color: var(--brand-600);
  color: var(--on-brand);
  box-shadow: var(--btn-shadow);
}
:root .btn-primary:hover { background-color: var(--brand-600); }
:root[data-theme=dark] .btn-primary { border-color: transparent; }
:root[data-theme=dark] .btn-primary:hover { background-color: var(--brand-600); }

:root .btn-ghost {
  background-color: var(--glass-bg-strong);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-1), var(--surface-hi);
}
:root .btn-ghost:hover { background-color: var(--surface); border-color: var(--input-line); }
:root[data-theme=dark] .btn-ghost { background-color: var(--surface-2); }
:root[data-theme=dark] .btn-ghost:hover { background-color: #232832; }

/* contexts that the two rules above would otherwise flatten */
:root .btn-ghost.btn-danger { color: var(--err); border-color: rgba(185,56,56,.4); }
:root[data-theme=dark] .btn-ghost.btn-danger { color: #FF8A8A; border-color: rgba(239,113,113,.4); }
:root .zoom-bar .btn-ghost { background-color: transparent; color: #FFFFFF; border-color: rgba(255,255,255,.35); box-shadow: none; }
:root .zoom-bar .btn-ghost:hover { background-color: rgba(255,255,255,.1); }
:root .fb-tip .fb-apply { background: var(--bg); color: var(--ink); border-color: transparent; box-shadow: none; }
:root .btn:disabled, :root .btn[disabled] { box-shadow: none; }

/* glass sheen: softer, still only on hover or press */
:root :is(.btn-primary, .btn-ghost, .icon-btn, .chip)::after {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.16), transparent);
}

:root .icon-btn { border-radius: 10px; }
:root .icon-btn:hover { background: var(--hover-wash); box-shadow: none; }
:root .zoom-bar .icon-btn:hover { background: rgba(255,255,255,.12); }
.icon-btn svg { stroke-width: 1.7; }

.back-link { color: var(--muted); font-size: 14.5px; font-weight: 500; gap: 2px; }
.back-link:hover { color: var(--ink); text-decoration: none; }
.back-link svg { width: 18px; height: 18px; stroke-width: 1.9; }
.link-btn { text-decoration-thickness: 1px; }

/* Chips: hairline-ringed, quieter */
:root .chip {
  padding: 3px 10px;
  font: 500 12.5px/1.4 var(--font-ui);
  letter-spacing: .005em;
  color: var(--chip-ink);
  background: var(--brand-50);
  box-shadow: inset 0 0 0 1px var(--brand-line);
}
:root .chip b { font-size: 10.5px; letter-spacing: .08em; opacity: .7; }
:root .chip.chip--t2 { background: var(--brass-50); color: var(--ink); box-shadow: inset 0 0 0 1px var(--brass-line); }
:root .chip.chip--best { background: var(--brass-50); color: var(--ink); font-weight: 600; box-shadow: inset 0 0 0 1px var(--brass-line); }
:root .chip.chip--done { box-shadow: inset 0 0 0 1px rgba(43,115,82,.5); }
:root[data-theme=dark] .chip.chip--done { box-shadow: inset 0 0 0 1px rgba(85,184,134,.5); }
.chip--done::before {
  content: ''; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--ok);
}

.status { font-size: 13px; gap: 8px; }
.status i { width: 8px; height: 8px; }
.test-status { font-size: 13px; font-weight: 500; color: var(--ink); }
.test-status.muted { color: var(--muted); font-weight: 400; }


/* =====================================================================
   §6  PAGE HEADS, EMPTY STATES, FOOTER, NOTICES
   ===================================================================== */
.page-head { margin-bottom: clamp(18px, 3vw, 30px); }
.page-title { font-size: clamp(30px, 4.4vw, 46px); line-height: 1.04; letter-spacing: -.024em; }
.eyebrow {
  font: 600 11.5px/1.3 var(--font-ui);
  letter-spacing: .14em;
  color: var(--brass);
  margin-bottom: 8px;
}
.page-head .eyebrow { display: flex; align-items: center; gap: 10px; }
.page-head .eyebrow::before {
  content: ''; flex: none; width: 22px; height: 1px; background: currentColor; opacity: .6;
}
.lede { margin-top: 10px; font-size: 15.5px; line-height: 1.55; color: var(--muted); max-width: 64ch; text-wrap: pretty; }

.empty-state { max-width: 520px; margin: 0 auto; padding: 10vh 8px 0; }
.empty-state::before {
  content: ''; display: block; width: 46px; height: 46px; margin: 0 auto 18px; border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: radial-gradient(circle, var(--accent) 0 2.5px, transparent 3px), var(--surface);
  box-shadow: var(--shadow-1), var(--surface-hi);
}
.empty-state .page-title { letter-spacing: -.015em; }
.empty-state p { line-height: 1.55; text-wrap: pretty; }

.site-foot { position: relative; border-top: 0; padding-top: 22px; margin-top: clamp(28px, 4.5vw, 48px); }
.site-foot::before {
  content: ''; position: absolute; top: 0; left: 50%; width: min(260px, 60%); height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--line-strong) 20%, var(--line-strong) 80%, transparent);
}
.site-foot::after {
  content: ''; position: absolute; top: 0; left: 50%; width: 5px; height: 5px;
  background: var(--accent); transform: translate(-50%, -50%) rotate(45deg);
  box-shadow: 0 0 0 4px var(--bg);
}
.site-foot p { font-size: 12.5px; letter-spacing: .01em; color: var(--muted); text-wrap: balance; }

.exam-banner {
  background: var(--brass-50);
  border-color: var(--brass-line);
  border-radius: var(--r-md);
  padding: 12px 16px;
  box-shadow: var(--surface-hi);
}
.exam-banner svg { stroke: var(--brass); }
.notice { background: var(--brand-50); border-color: var(--brand-line); border-radius: var(--r-md); }
:root .gate-card {
  background: var(--surface);
  border-color: var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1), var(--surface-hi);
}


/* =====================================================================
   §7  BOOKCASE AND BOOK COVERS
   One lamp-lit back panel, walnut frame, planks with a fine grain.
   No new shadows on books (they keep one moderate shadow each).
   ===================================================================== */
.bookcase {
  border-width: clamp(6px, .85vw, 10px);
  border-color: var(--case-frame);
  border-radius: 12px;
  background:
    radial-gradient(120% 60% at 50% -8%, var(--case-lamp), transparent 62%),
    repeating-linear-gradient(90deg, rgba(70,45,20,.022) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, var(--case-back), var(--case-back-2));
  box-shadow:
    var(--shadow-2),
    inset 0 0 0 1px rgba(0,0,0,.07),
    inset 0 14px 26px -10px rgba(40,24,8,.26);
}
html[data-theme=dark] .bookcase {
  box-shadow:
    var(--shadow-2),
    inset 0 0 0 1px rgba(0,0,0,.4),
    inset 0 14px 26px -10px rgba(0,0,0,.55);
}

.plank {
  background: linear-gradient(180deg, var(--wood-1) 0%, var(--wood-2) 52%, var(--wood-3) 100%);
  box-shadow: inset 0 1px 0 rgba(255,236,205,.38), inset 0 -1px 0 rgba(0,0,0,.28);
}
html[data-theme=dark] .plank { box-shadow: inset 0 1px 0 rgba(255,220,170,.16), inset 0 -1px 0 rgba(0,0,0,.4); }
.plank::before {                         /* static grain running along the plank */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    repeating-linear-gradient(179.2deg, rgba(0,0,0,.05) 0 1px, transparent 1px 5px, rgba(255,240,215,.05) 5px 6px, transparent 6px 11px),
    repeating-linear-gradient(180.6deg, transparent 0 7px, rgba(0,0,0,.035) 7px 8px, transparent 8px 13px);
}
.plank::after { height: 14px; background: linear-gradient(180deg, rgba(30,18,6,.2), rgba(30,18,6,0)); }

.book::after { bottom: -4px; height: 9px; background: radial-gradient(ellipse at center, rgba(20,10,0,.42), rgba(0,0,0,0) 70%); }
.book-cover {
  box-shadow: 0 1px 1px rgba(0,0,0,.22), 0 8px 14px -8px rgba(0,0,0,.5), inset 0 0 0 1px rgba(255,255,255,.07);
}
.book-cover.has-img::after {           /* spine, laminate gloss, page-edge shade */
  background:
    linear-gradient(90deg, rgba(0,0,0,.30) 0, rgba(0,0,0,.08) 4.5%, rgba(255,255,255,.13) 6.5%,
      rgba(255,255,255,0) 11%, rgba(255,255,255,0) 95%, rgba(0,0,0,.12) 100%),
    linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,0) 28%);
}
:root .book-progress {
  font: 600 max(10px, 7.6cqw)/1.3 var(--font-ui);
  letter-spacing: .02em;
  color: #F5EDDC;
  background: rgba(18,17,16,.74);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 1px 3px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.14);
}
.dots i { width: 5px; height: 5px; }
/* drawn fallback cover (only if a photo fails): keep the label inside on phones */
.book-series { font-size: max(8px, 7.4cqw); letter-spacing: .06em; }
.book-label { overflow-wrap: break-word; }

.mini-book {
  width: 56px;
  border-radius: 2px 5px 5px 2px;
  box-shadow: 0 1px 1px rgba(0,0,0,.2), 0 10px 18px -10px rgba(0,0,0,.55);
}
.book-head {
  gap: 18px;
  margin: 6px 0 clamp(18px, 3vw, 28px);
  padding-bottom: clamp(16px, 2.4vw, 22px);
  border-bottom: 1px solid var(--line);
}
.book-head .page-title { font-size: clamp(26px, 3.6vw, 38px); }
.book-head .lede { margin-top: 6px; }


/* =====================================================================
   §8  OPEN-BOOK OVERLAY (pages only — timing lives in js/book-anim.js)
   ===================================================================== */
/* a lamp-lit spotlight instead of a full-screen blur */
.ba-dim { background: radial-gradient(ellipse 75% 65% at 50% 46%, rgba(28,22,14,.58), rgba(8,8,12,.86)); }
html[data-theme=dark] .ba-dim { background: radial-gradient(ellipse 75% 65% at 50% 46%, rgba(14,13,12,.68), rgba(2,3,6,.9)); }
.ba.ba-blur.is-on .ba-dim { -webkit-backdrop-filter: none; backdrop-filter: none; }

.ba-leaf {
  background-color: #F6EFE2;
  background-image:
    linear-gradient(90deg, rgba(70,48,18,.13) 0, rgba(70,48,18,.04) 4%, rgba(70,48,18,0) 11%),
    linear-gradient(180deg, #FCF8F0 0%, #F3EAD9 100%);
}
.ba-left {
  background-image:
    linear-gradient(270deg, rgba(70,48,18,.15) 0, rgba(70,48,18,.04) 4%, rgba(70,48,18,0) 12%),
    linear-gradient(180deg, #FCF8F0 0%, #F3EAD9 100%);
  box-shadow: inset -8px 0 14px -8px rgba(60,40,10,.2), 0 10px 28px -12px rgba(0,0,0,.5);
}
.ba-right { box-shadow: inset 8px 0 14px -8px rgba(60,40,10,.2), 0 10px 28px -12px rgba(0,0,0,.5); }
.ba-leaf::before {                       /* printed double-rule frame */
  content: ''; position: absolute; inset: 5.5% 7.5%; pointer-events: none;
  border: 1px solid rgba(138,100,36,.24);
  box-shadow: inset 0 0 0 2px rgba(252,248,240,.9), inset 0 0 0 3px rgba(138,100,36,.12);
}

.ba-page-inner { gap: .55em; color: #2A2219; letter-spacing: 0; }
.ba-kicker {
  font: 600 max(7.5px, 6.2cqw)/1.3 var(--font-ui);
  letter-spacing: .16em;
  color: #7A5A2A;
  opacity: 1;
  max-width: 100%;
}
.ba-kicker::after {
  content: ''; display: block; width: 2.4em; height: 1px; margin: .75em auto 0;
  background: currentColor; opacity: .5;
}
.ba-title {
  font: 600 max(15px, 14.5cqw)/1.04 var(--font-head);
  letter-spacing: -.018em;
  color: #221B12;
  max-width: 100%;
  overflow-wrap: break-word;
  text-wrap: balance;
}
.ba-title.ba-num {
  font-size: max(26px, 32cqw);
  line-height: .92;
  letter-spacing: -.035em;
  color: #1D2E49;
}
.ba-sub {
  font: 500 max(7.5px, 6.4cqw)/1.35 var(--font-ui);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #6B5A44;
  opacity: 1;
  margin-top: .3em;
  max-width: 100%;
}


/* =====================================================================
   §9  WRITING / READING CHOOSER
   ===================================================================== */
.skill-grid {
  margin-top: 0;
  gap: clamp(12px, 2vw, 22px);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}
.skill-card {
  --sk-pad: clamp(20px, 2.6vw, 30px);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1), var(--surface-hi);
  min-height: clamp(160px, 19vw, 232px);
  isolation: isolate;
}
.skill-card--writing { background: var(--surface); }
/* a faint wash of the book's own colour (older browsers keep plain paper) */
@supports (color: color-mix(in srgb, red 50%, blue)) {
  .skill-card--writing {
    background: linear-gradient(155deg, color-mix(in srgb, var(--book, var(--brand)) 11%, var(--surface)) 0%, var(--surface) 62%);
  }
  html[data-theme=dark] .skill-card--writing {
    background: linear-gradient(155deg, color-mix(in srgb, var(--book, var(--brand)) 22%, var(--surface)) 0%, var(--surface) 66%);
  }
}
/* ribbon bookmark: the book's colour for Writing, brass for Reading */
.skill-card::before {
  content: ''; position: absolute; top: 0; right: var(--sk-pad); z-index: 1;
  width: 13px; height: 30px;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 74%, 0 100%);
  pointer-events: none;
}
.skill-card--writing::before { background: var(--book, var(--brand)); }
.skill-card--soon::before { background: var(--line-strong); }

.skill-card-hit {
  position: relative;
  min-height: inherit;
  gap: 6px;
  padding: var(--sk-pad) calc(var(--sk-pad) + 52px) var(--sk-pad) var(--sk-pad);
  border-radius: inherit;
}
.skill-card-hit:focus-visible { outline-offset: -4px; border-radius: calc(var(--r-lg) - 2px); }
/* a quiet "go" mark: hairline circle and chevron */
a.skill-card-hit::before {
  content: ''; position: absolute; right: var(--sk-pad); bottom: var(--sk-pad);
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}
a.skill-card-hit::after {
  content: ''; position: absolute;
  right: calc(var(--sk-pad) + 17px); bottom: calc(var(--sk-pad) + 14.5px);
  width: 9px; height: 9px;
  border-top: 1.75px solid currentColor; border-right: 1.75px solid currentColor;
  transform: rotate(45deg);
  opacity: .55;
}
.skill-card:not(.skill-card--soon):hover a.skill-card-hit::before { border-color: var(--brand-line); background: var(--brand-50); }

.skill-kicker { font: 600 11.5px/1.3 var(--font-ui); letter-spacing: .14em; color: var(--brass); opacity: 1; }
.skill-name {
  font: 600 clamp(30px, 3.4vw, 42px)/1.02 var(--font-head);
  letter-spacing: -.026em;
  color: var(--head-ink);
  max-width: 100%;
  min-width: 0;
  overflow-wrap: break-word;
}
.skill-meta { font: 500 14px/1.45 var(--font-ui); color: var(--muted); opacity: 1; text-wrap: pretty; }

.skill-card--soon { opacity: 1; background: var(--surface-2); border-style: dashed; border-color: var(--line-strong); box-shadow: none; }
.skill-card--soon :is(.skill-name, .skill-kicker) { color: var(--muted); }
.skill-card--soon .skill-meta {
  align-self: flex-start; margin-top: 6px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  font: 600 11px/1.4 var(--font-ui); letter-spacing: .1em; text-transform: uppercase;
}

.skill-card:not(.skill-card--soon):hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-2), var(--surface-hi);
  transform: none;                        /* the lift is added in §19, motion only */
}


/* =====================================================================
   §10  WRITING AND READING TEST LISTS
   ===================================================================== */
.test-grid { gap: clamp(12px, 1.8vw, 20px); }
:root .test-card {
  background: var(--surface);
  border-color: var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1), var(--surface-hi);
}
:root .test-card:hover { border-color: var(--line-strong); }
.thumb {
  border-radius: calc(var(--r-lg) - 5px);
  background: #FFFFFF;
  border-color: var(--line);
}
html[data-theme=dark] .thumb { background: #E6E4DF; border-color: transparent; }
/* the loading tint sits under the picture only, not as a beige frame around it */
.thumb img { background-clip: content-box; }
.test-name { font: 600 20px/1.1 var(--font-head); letter-spacing: -.014em; color: var(--head-ink); }
.test-body { gap: 9px; }

/* Reading cards: only the two buttons are clickable, so the card itself stays still */
.reading-card { padding: 16px 16px 14px; gap: 14px; cursor: default; align-items: stretch; }  /* phones: no longer centred and squeezed */
.reading-card:hover::after { opacity: 0; }
.reading-card .test-body { gap: 8px; }
.reading-actions { margin-top: auto; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.reading-actions .btn { flex: 1 1 0; min-width: 0; padding: 0 12px; }


/* =====================================================================
   §11  SHEETS — mode, task, Settings, tour, model-answer confirm
   Solid paper instead of glass: crisper text, no blur behind the dim.
   ===================================================================== */
dialog.sheet::backdrop { background: rgba(22,18,12,.46); -webkit-backdrop-filter: none; backdrop-filter: none; }
html[data-theme=dark] dialog.sheet::backdrop { background: rgba(0,0,0,.6); }

:root .sheet-inner {
  background: var(--surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--glass-shadow), var(--surface-hi);
  padding: 20px clamp(18px, 3vw, 28px) 24px;
}
.sheet-head { margin-bottom: 16px; }
.sheet-head h2 { font-size: 24px; letter-spacing: -.018em; }
.sheet-grab { width: 36px; background: var(--line-strong); }
.sheet-inner > p { line-height: 1.55; }
.sheet-inner > p + .sheet-actions { margin-top: 18px; }

/* Mode choice (Practice / Strict) */
.mode-step { gap: 10px; }
:root .mode-choice {
  background: var(--surface-2);
  border-color: var(--line);
  box-shadow: var(--surface-hi);
}
:root .mode-choice.mode-choice--strict { border-color: var(--brass-line); }
:root button.mode-choice:hover { border-color: var(--brand-edge); background: var(--surface); }
.mode-icon { border-radius: 12px; }
.mode-icon svg { width: 22px; height: 22px; stroke-width: 1.7; }
.mode-icon--practice { background: var(--brand-50); color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand-line); }
.mode-icon--strict { background: var(--brass-50); color: var(--brass); box-shadow: inset 0 0 0 1px var(--brass-line); }
.mode-name { font: 600 18.5px/1.2 var(--font-head); letter-spacing: -.012em; color: var(--head-ink); }
.mode-desc { font-size: 14.5px; text-wrap: pretty; }
.btn-start { margin-top: 12px; }
.last-result { font-size: 14.5px; }

/* Task choice */
.step-q { font: 600 15px/1.4 var(--font-ui); }
.task-choice { gap: 6px; background: var(--surface-2); box-shadow: var(--surface-hi); }
.task-choice:hover { border-color: var(--brand-edge); background: var(--surface); }
.task-choice-name { font: 600 18px/1.2 var(--font-head); letter-spacing: -.012em; color: var(--head-ink); }
.task-choice-meta { font-size: 12.5px; letter-spacing: .01em; }
.task-choice-prompt { font-size: 14px; line-height: 1.55; text-wrap: pretty; }

/* Settings */
.field { margin-bottom: 20px; }
.field > legend {
  font: 600 11px/1.3 var(--font-ui);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 10px;
}
.field-label { color: var(--ink); }
.field-label--sub { font-size: 13.5px; }
.field-help { font-size: 13px; line-height: 1.5; text-wrap: pretty; }
.field input[type=text],
.field input[type=number] {
  border-color: var(--input-line);
  border-radius: var(--r-sm);
  background: var(--paper);
  box-shadow: inset 0 1px 2px rgba(40,30,15,.05);
}
.field input[type=text]:focus-visible,
.field input[type=number]:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
.field input::placeholder { color: var(--muted); opacity: .8; }

.segmented { padding: 3px; gap: 3px; border-radius: 11px; background: var(--surface-2); border-color: var(--line); }
.segmented span { border-radius: 8px; font-size: 14.5px; }
.segmented input:checked + span { background: var(--raised); box-shadow: var(--raised-shadow); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }

.field-switch { background: var(--surface-2); border-color: var(--line); }
input.switch { background: var(--line-strong); border-color: rgba(0,0,0,.08); }
input.switch:checked { background: var(--brand); border-color: var(--brand); }
input.switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ai-test-result { font-weight: 500; }

/* Tour */
.tour-art {
  height: 120px;
  border-color: var(--line);
  background: radial-gradient(120% 100% at 50% 0%, var(--brand-50), var(--surface-2) 72%);
}
.tour-art svg { stroke: var(--brand); stroke-width: 2; }
.tour-art .t-on { fill: var(--brass-50); stroke: var(--accent); }
.tour-body h2 { font-size: 25px; letter-spacing: -.018em; }
.tour-text { font-size: 15.5px; text-wrap: pretty; }
.tour-dots { gap: 6px; }
.tour-dots li { width: 6px; height: 6px; background: var(--line-strong); }
.tour-dots li.is-on { width: 18px; border-radius: 3px; background: var(--brand); }
.tour-never { font-size: 14px; color: var(--muted); }


/* =====================================================================
   §12  WRITING PRACTICE (two columns stay two columns)
   The editor's font, padding, border width and line height are not
   touched: the spelling mirror copies them.
   ===================================================================== */
.pr-title { letter-spacing: -.016em; }

:root .pr-tasks { background: var(--surface-2); border-color: var(--line); box-shadow: none; }
:root .pr-tasks a { border-radius: 8px; }
:root .pr-tasks a[aria-current=page] { background: var(--raised); color: var(--ink); box-shadow: var(--raised-shadow); }

:root .pr-helpers { background: var(--surface-2); border-color: var(--line); box-shadow: none; }
.pr-helpers-label { font-size: 11px; letter-spacing: .14em; color: var(--brass); }
.hp-track { background: var(--line-strong); }
.hp-thumb { box-shadow: 0 1px 2px rgba(0,0,0,.25), 0 0 0 .5px rgba(0,0,0,.08); }
.hp-name { font-size: 14px; }
.pr-vocab-btn, .pr-answer-btn { font-weight: 600; letter-spacing: .01em; }

.pr-q, .pr-w {
  background: var(--surface);
  border-color: var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1), var(--surface-hi);
}
.pr-q-title { font-size: 18px; letter-spacing: -.012em; }
.pr-rubric { font-size: 14px; line-height: 1.55; }
.pr-q .prompt-box {
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: 4px 10px 10px 4px;
  background: var(--surface-2);
  padding: 14px 16px;
  font-weight: 500;
  line-height: 1.6;
}
.pr-q .prompt-box--t2 { font-weight: 600; }
:root .pr-q .prompt-figure { background: transparent; border: 0; padding: 0; }
.chart-btn { border-color: var(--line); border-radius: var(--r-md); }
.chart-btn::after { border-radius: 8px; background-color: rgba(23,26,32,.7); }
html[data-theme=dark] :is(.chart-btn, .prompt-figure) { background-color: #E9E7E2; border-color: transparent; }
details.scan summary { font-size: 14.5px; }

/* the writing page: brightest surface, hairline edge, calm focus */
.editor-wrap { background: var(--paper); box-shadow: inset 0 1px 2px rgba(40,30,15,.05); }
html[data-theme=dark] .editor-wrap { box-shadow: inset 0 1px 2px rgba(0,0,0,.25); }
.editor { border-color: var(--line); color: var(--ink); }
.editor:focus-visible, .editor:focus { border-color: var(--brand-edge); box-shadow: 0 0 0 3px var(--focus-halo); }
.editor::placeholder { color: var(--muted); opacity: .8; }

.pr-status { font-size: 13.5px; }
.wc-pill { font-size: 13.5px; }
.pr-saved { font-size: 12.5px; letter-spacing: .01em; }

.sg-chip:hover { border-color: var(--brand-edge); }
.sg-chip.is-first { border-color: var(--brand-edge); }
.sg-tag { letter-spacing: .08em; }


/* =====================================================================
   §13  CLUES PANEL AND AI PLAN (clues.css is loaded later by JS)
   ===================================================================== */
:root :is(.clues-panel, .sg-plan) {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--surface-hi);
}
:root :is(.clues-title, .sg-plan-title) { font-size: 16px; letter-spacing: -.01em; color: var(--head-ink); }
:root :is(.clues-h, .sg-plan-h, .fb-h) {
  font: 600 11px/1.3 var(--font-ui);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--brass);
}
:root .clues-idea { background: var(--surface); border-color: var(--line); }
:root .clues-idea-h { color: var(--brand); }
:root .clues-caution { background: var(--warn-50); border-color: var(--brass-line); }
:root .clues-chip { border-color: var(--line); background: var(--surface); }
:root .clues-chip:hover, :root .clues-chip:active { border-color: var(--brand-edge); background: var(--brand-50); }


/* =====================================================================
   §14  FLOATING VOCABULARY / SENTENCE-STARTERS PANEL
   A small blur is fine here; it drops while dragging or resizing.
   ===================================================================== */
:root .vocab-float {
  color: var(--ink);
  background: var(--vocab-bg);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  -webkit-backdrop-filter: saturate(1.15) blur(10px);
  backdrop-filter: saturate(1.15) blur(10px);
  box-shadow: var(--vocab-shadow);
}
:root[data-theme=dark] .vocab-float { background: var(--vocab-bg); box-shadow: var(--vocab-shadow); }
/* placed after the dark rule on purpose: same specificity, these must win */
:root .vocab-float.is-dragging,
:root .vocab-float.is-resizing,
:root[data-motion=off] .vocab-float { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface); }

:root .vocab-float-head { padding: 4px 4px 4px 14px; border-bottom-color: var(--line); }
:root .vocab-float-head .eyebrow { font: 600 10px/1.2 var(--font-ui); letter-spacing: .14em; color: var(--brass); }
:root .vocab-float-head h2 { font: 600 15px/1.25 var(--font-head); letter-spacing: -.01em; color: var(--head-ink); }
:root .vocab-float-actions .icon-btn { color: var(--muted); }
:root .vocab-float-actions .icon-btn:hover { color: var(--ink); }

:root .vocab-toolbar { padding: 10px 10px 8px; }
:root .vocab-tabs { gap: 3px; border-radius: 10px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
:root .vocab-tab { border-radius: 7px; font-weight: 600; color: var(--muted); }
:root .vocab-tab:hover { color: var(--ink); }
:root .vocab-tab.is-on { background: var(--raised); color: var(--ink); box-shadow: var(--raised-shadow); }
:root .vocab-tab:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

:root .vocab-search {
  padding: 0 12px 0 33px;
  border-color: var(--input-line);
  border-radius: var(--r-sm);
  color: var(--ink);
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5' fill='none' stroke='%238A847B' stroke-width='2'/%3E%3Cpath d='M15.5 15.5 20 20' stroke='%238A847B' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 11px 50% / 15px;
}
:root .vocab-search::placeholder { color: var(--muted); opacity: .85; }
:root .vocab-search:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }

:root .vocab-body { padding: 2px 10px 14px; }
:root .vocab-sec h3 {
  margin: 4px 2px 8px;
  font: 600 10.5px/1.3 var(--font-ui);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--brass);
}
:root .vocab-count { background: var(--brand-50); color: var(--chip-ink); letter-spacing: 0; }
:root .vocab-item {
  margin: 0 0 6px;
  padding: 9px 11px;
  border-color: var(--line);
  background: var(--surface);
}
:root[data-theme=dark] .vocab-item { background: var(--surface-2); }
:root .vocab-word { font-weight: 600; color: var(--ink); }
:root .vocab-pos { font-style: italic; color: var(--muted); }
:root .vocab-bn { color: var(--ink); }
:root .vocab-ex { font-size: 13.5px; line-height: 1.5; color: var(--ink); }
:root .vocab-ex mark, :root[data-theme=dark] .vocab-ex mark { background: var(--mark); font-weight: 600; }
:root .vocab-starter .vocab-word { font-weight: 500; }
:root .vocab-resize::before { border-right-color: var(--input-line); border-bottom-color: var(--input-line); }


/* =====================================================================
   §15  MODEL ANSWER SHEET (answers.css)
   ===================================================================== */
.answer-meta { font-size: 13px; }
.answer-legend { background: var(--brass-50); border-color: var(--brass-line); border-radius: var(--r-md); }
:is(.answer-text, .answer-legend) mark,
html[data-theme=dark] :is(.answer-text, .answer-legend) mark { background: var(--mark); }
.answer-text { background: var(--paper); border-color: var(--line); color: var(--ink); }
.answer-gloss { border-top-color: var(--line); }
.answer-gloss h3 { font: 600 15.5px/1.3 var(--font-head); letter-spacing: -.01em; }
.answer-gloss .answer-gloss-row { border-bottom-color: var(--line); }


/* =====================================================================
   §16  RESULTS, AI FEEDBACK, HOME PROGRESS CARD
   ===================================================================== */
.result-meta > div {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--surface-hi);
}
.result-meta dt { font: 600 10.5px/1.3 var(--font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.result-meta dd { margin-top: 5px; color: var(--ink); }
.result-part { border-color: var(--line); padding: clamp(18px, 3vw, 28px); }
.result-part-head { padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.result-part-head h2 { font-size: 21px; letter-spacing: -.015em; }
.result-part-head h2 .muted { letter-spacing: 0; }
.word-pill { font-size: 13px; background: var(--brand-50); box-shadow: inset 0 0 0 1px var(--brand-line); }
.word-pill.word-pill--short { background: rgba(185,56,56,.1); box-shadow: inset 0 0 0 1px rgba(185,56,56,.3); }
.result-warn {
  margin: 0 0 12px; padding: 8px 12px;
  border-radius: var(--r-sm);
  background: var(--warn-50);
  border: 1px solid var(--brass-line);
}

.fb-hero { border-color: var(--line); }
.fb-ring-num { letter-spacing: -.02em; }
.fb-card { border-color: var(--line); box-shadow: var(--surface-hi); }
.fb-card h3 { font-size: 15.5px; letter-spacing: -.005em; }
.fb-band { border-radius: 9px; box-shadow: inset 0 0 0 1px var(--brand-line); }
.fb-quote { border-left-color: var(--accent); }
.fb-text { background: var(--paper); border-color: var(--line); }
.fb-improved { background: var(--surface); }

:root .progress-card { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-1), var(--surface-hi); }
.pg-head h2 { letter-spacing: -.015em; }
.pg-big { letter-spacing: -.02em; }


/* =====================================================================
   §17  TOAST, SPELLING MENU, ZOOM
   ===================================================================== */
.toast { border-radius: 12px; font-size: 14px; }
:root .spell-menu {
  border: 1px solid var(--line-strong);
  border-top: 2px solid var(--spell);
  background: var(--glass-bg-strong);
  box-shadow: var(--glass-shadow);
}
.sm-item { border-radius: 7px; }


/* =====================================================================
   §18  STRICT EXAM GUARDS — .cd-exam (writing) and .rd-root (reading)
   No colour field behind them, no press-squish, no tracking change.
   The only polish: a little more air between passage lines.
   ===================================================================== */
html body[data-route=exam]::before,
html body[data-route=reading-session]::before,
html body.rd-active::before { display: none; }

.cd-exam, .cd-exam * { letter-spacing: normal; word-spacing: normal; }
.rd-root .rd-ptext { line-height: 1.6; }
/* app.css sets Fraunces on every h1–h3, which leaked into the reading
   engine; the real test uses the same sans-serif as the passage. */
.rd-root :is(h1, h2, h3, h4) { font-family: inherit; letter-spacing: normal; }

@media (prefers-reduced-motion: no-preference) {
  html[data-motion=on] :is(.rd-root, .cd-exam) :is(button, .btn, .rd-btn):active:not(:disabled) { transform: none; }
}


/* =====================================================================
   §19  MOTION AND PERFORMANCE
   ===================================================================== */
/* The colour field (glass.css) becomes a still wash of lamplight:
   no drift, so the top-bar blur is not recomputed every frame. */
html body::before {
  inset: 0;
  animation: none !important;
  background:
    radial-gradient(70% 55% at 50% -14%, rgba(255,250,238,.95), rgba(255,250,238,0) 70%),
    radial-gradient(40% 36% at 100% 0%, rgba(176,132,64,.10), rgba(176,132,64,0) 70%),
    radial-gradient(46% 42% at 0% 100%, rgba(29,53,87,.06), rgba(29,53,87,0) 72%);
}
html[data-theme=dark] body::before {
  background:
    radial-gradient(70% 55% at 50% -14%, rgba(212,176,106,.075), rgba(212,176,106,0) 70%),
    radial-gradient(40% 36% at 100% 0%, rgba(157,183,220,.06), rgba(157,183,220,0) 70%),
    radial-gradient(46% 42% at 0% 100%, rgba(157,183,220,.045), rgba(157,183,220,0) 72%);
}
html:not([data-motion=off]) body::before { opacity: 1; }   /* motion off: glass.css still hides it */

/* Colour fades on hover (kept with reduced motion, off with Animations off) */
html[data-motion=on] body :is(.btn, .icon-btn, .chip, .sg-chip, .clues-chip, .vocab-tab, .pr-tasks a, .task-choice, .mode-choice, .back-link) {
  transition: transform 160ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
html[data-motion=on] body .test-card { transition: transform 220ms var(--ease-out), border-color 200ms ease; }
html[data-motion=on] a.skill-card-hit::before { transition: background-color 200ms ease, border-color 200ms ease; }

@media (prefers-reduced-motion: no-preference) {
  html[data-motion=on] .skill-card { transition: transform 260ms var(--ease-out), box-shadow 260ms var(--ease-out), border-color 200ms ease; }
  html[data-motion=on] .skill-card:not(.skill-card--soon):hover { transform: translateY(-2px); }
  html[data-motion=on] a.skill-card-hit::after { transition: transform 220ms var(--ease-out); }
  html[data-motion=on] .skill-card:not(.skill-card--soon):hover a.skill-card-hit::after { transform: translateX(2px) rotate(45deg); }

  /* mode cards: a 1 px lift instead of a 2% scale (no text blur) */
  html[data-motion=on] .mode-choice:hover { transform: translateY(-1px); }
  html[data-motion=on] .mode-choice--strict:hover { transform: none; }

  /* reading cards are not buttons */
  html[data-motion=on] .reading-card:hover,
  html[data-motion=on] .reading-card:active { transform: none; }

  /* chips are labels, not buttons: no press-squish */
  html[data-motion=on] body .chip:active:not(:disabled) { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html[data-motion=on] .skill-card { transition: box-shadow 200ms ease, border-color 200ms ease; }
  html[data-motion=on] body :is(.btn, .icon-btn, .chip, .sg-chip, .clues-chip, .vocab-tab, .pr-tasks a, .task-choice, .mode-choice, .back-link) {
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
  }
}
html[data-motion=off] .skill-card,
html[data-motion=off] a.skill-card-hit::before,
html[data-motion=off] a.skill-card-hit::after { transition: none; }


/* =====================================================================
   §20  PHONE AND DESKTOP
   ===================================================================== */
@media (max-width: 600px) {
  :root .sheet-inner {
    border-radius: 20px 20px 0 0;
    border-width: 1px 0 0;
    padding: 14px 18px calc(22px + env(safe-area-inset-bottom));
  }
  .sheet-head h2 { font-size: 22px; }
}
@media (max-width: 560px) {
  .test-name { font-size: 19px; }
  .skill-card { min-height: 150px; }
  .skill-name { font-size: 30px; }
}
@media (max-width: 420px) {
  .page-head .eyebrow::before { width: 16px; }
  .bookcase { border-radius: 10px; }
  .brand { gap: 9px; }
}
@media (pointer: coarse) {
  :root .vocab-tab { min-height: 44px; }
  :root .vocab-search { min-height: 44px; }
  .segmented span { min-height: 44px; }
  .toast-act { min-height: 44px; }
}
@media (min-width: 900px) {
  .brand-name { font-size: 20px; }
}
@media (min-width: 1100px) {
  .page-head { margin-bottom: 32px; }
  .lede { font-size: 16px; }
  .test-name { font-size: 21px; }
}


/* =====================================================================
   §21  FALLBACKS
   ===================================================================== */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  :root .topbar { background: var(--bg); }
  :root .vocab-float, :root[data-theme=dark] .vocab-float,
  :root .rd-vocab-panel, :root .rd-hw-pop { background: var(--surface); }
}
@media (prefers-reduced-transparency: reduce) {
  :root .topbar { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
  :root .vocab-float, :root[data-theme=dark] .vocab-float,
  :root .rd-vocab-panel, :root .rd-hw-pop {
    background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none;
  }
}
@media (forced-colors: active) {
  .skill-card::before, a.skill-card-hit::before, a.skill-card-hit::after,
  .site-foot::before, .site-foot::after, .page-head .eyebrow::before,
  .empty-state::before, .ba-leaf::before, .plank::before, .chip--done::before { display: none; }
  :root .btn-primary { background-image: none; }
}


/* =====================================================================
   §22  READING PRACTICE VOCAB
   The Vocabulary panel keeps the writing vocab-float paper look.
   The hard-word popover is liquid glass (see reading-vocab.css); this
   file only sets theme text colours so contrast holds in light and dark.
   Official exam screens stay undecorated.
   ===================================================================== */
:root .rd-vocab-panel {
  color: var(--ink);
  background: var(--vocab-bg);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: var(--vocab-shadow);
}
:root[data-motion=off] .rd-vocab-panel { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface); }
:root .rd-vocab-kicker,
:root .rd-vocab-h { font: 600 10px/1.2 var(--font-ui); letter-spacing: .14em; color: var(--brass); }
:root .rd-vocab-ptitle { font: 600 15px/1.25 var(--font-head); letter-spacing: -.01em; color: var(--head-ink); }
:root .rd-vocab-term { color: var(--err); text-decoration-color: color-mix(in srgb, var(--err) 40%, transparent); }
:root .rd-vocab-pos, :root .rd-vocab-miss { color: var(--muted); }
:root .rd-vocab-ex, :root .rd-vocab-pat-en { color: var(--muted); }
:root .rd-vocab-item, :root .rd-vocab-pat { border-bottom-color: var(--line); }
:root .rd-vocab-head { border-bottom-color: var(--line); }
:root .rd-vocab-close:hover, :root .rd-vocab-close:focus-visible { background: var(--hover-wash); }

:root .rd-hw-pop { color: var(--ink); }
:root .rd-hw-pop-word { color: var(--head-ink); }
:root .rd-hw-pop-pos { color: var(--brass); }
:root .rd-hw-pop-bn { color: var(--ink); }
:root .rd-hw-pop-ex { color: var(--muted); }

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  html:not([data-motion=off]) .rd-vocab-panel {
    -webkit-backdrop-filter: saturate(1.15) blur(10px);
    backdrop-filter: saturate(1.15) blur(10px);
  }
}


/* =====================================================================
   §23  READING PRACTICE EVIDENCE / HINTS
   Small glass boxes only; official exam screens stay undecorated.
   ===================================================================== */
:root .rd-help-box {
  color: var(--ink);
  background: var(--vocab-bg);
  border: 1px solid var(--line-strong);
  box-shadow: var(--vocab-shadow);
}
:root[data-motion=off] .rd-help-box { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface); }
:root .rd-help-kicker { color: var(--brass); }
:root .rd-help-answer { color: var(--head-ink); }
:root .rd-help-btn { color: var(--brand); background: var(--surface); border-color: var(--line); }
:root .rd-help-btn:hover, :root .rd-help-btn:focus-visible { border-color: var(--brand-edge); background: var(--brand-50); }
:root .rd-ev { background: color-mix(in srgb, var(--accent) 28%, transparent); }
:root .rd-ev-back { background: var(--brand); color: var(--on-brand); }
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  :root .rd-help-box { background: var(--surface); }
}
