/* Prøveklar — "the study desk": squared paper, Øresund ink, highlighter, teacher's pen. */

:root {
  --paper: #f2f5f6;
  --sheet: #ffffff;
  --grid: rgba(28, 61, 99, 0.07);
  --ink: #1c3d63;
  --ink-strong: #132c49;
  --ink-2: #48668a;
  --text: #1b2733;
  --muted: #5a6979;
  --rule: #cfdbe3;
  --hl: #ffe24a;
  --hl-wash: rgba(255, 226, 74, 0.7);
  --red: #c0392b;
  --red-wash: #fbe9e6;
  --green: #1f7a47;
  --green-wash: #e5f3ea;
  --focus: #1f6fe0;
  --on-ink: #ffffff;
  --shadow-sheet: 0 1px 0 rgba(28, 61, 99, 0.06), 0 18px 36px -24px rgba(19, 44, 73, 0.45);

  --font-ui: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-read: "Literata", Georgia, "Times New Roman", serif;

  --fs-sm: 0.875rem;
  --fs-base: 1.0625rem;
  --fs-md: 1.25rem;
  --fs-lg: 1.5625rem;
  --fs-xl: 1.953rem;
  --fs-hero: clamp(2.35rem, 1.4rem + 4.2vw, 4.4rem);

  --gutter: 1rem;
  --wrap: 70rem;
  --grid-size: 28px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1924;
    --sheet: #15222f;
    --grid: rgba(150, 190, 230, 0.06);
    --ink: #a8c9ec;
    --ink-strong: #cfe2f6;
    --ink-2: #86a6c8;
    --text: #e3eaf1;
    --muted: #9aabbb;
    --rule: #2a3c4f;
    --hl: #e5c93a;
    --hl-wash: rgba(229, 201, 58, 0.32);
    --red: #ff8f80;
    --red-wash: rgba(255, 143, 128, 0.12);
    --green: #74d6a0;
    --green-wash: rgba(116, 214, 160, 0.12);
    --focus: #7fb4ff;
    --on-ink: #0f1924;
    --shadow-sheet: 0 1px 0 rgba(0, 0, 0, 0.3), 0 18px 40px -24px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1924; --sheet: #15222f; --grid: rgba(150, 190, 230, 0.06); --ink: #a8c9ec; --ink-strong: #cfe2f6;
  --ink-2: #86a6c8; --text: #e3eaf1; --muted: #9aabbb; --rule: #2a3c4f; --hl: #e5c93a; --hl-wash: rgba(229, 201, 58, 0.32);
  --red: #ff8f80; --red-wash: rgba(255, 143, 128, 0.12); --green: #74d6a0; --green-wash: rgba(116, 214, 160, 0.12);
  --focus: #7fb4ff; --on-ink: #0f1924; color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 var(--fs-base)/1.55 var(--font-ui);
  color: var(--text);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-feature-settings: "ss01";
}
main { flex: 1; }
img, svg { display: block; max-width: 100%; }
a { color: var(--ink); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
@media (min-width: 40rem) { :root { --gutter: 1.75rem; } }

.skip { position: absolute; inset-inline-start: 1rem; top: -4rem; background: var(--ink); color: var(--on-ink); padding: 0.6rem 1rem; z-index: 50; }
.skip:focus { top: 1rem; }

.h2 { font-size: var(--fs-lg); line-height: 1.2; font-weight: 750; color: var(--ink-strong); letter-spacing: -0.012em; margin: 0 0 1rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 3rem; padding: 0.7rem 1.25rem;
  font: 650 1rem/1.2 var(--font-ui); text-decoration: none; cursor: pointer;
  border-radius: 8px; border: 2px solid transparent;
  transition: background-color 0.15s, color 0.15s, transform 0.1s;
}
.btn:active { transform: translateY(1px); }
.btn--ink { background: var(--ink); color: var(--on-ink); }
.btn--ink:hover { background: var(--ink-strong); }
.btn--line { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn--line:hover { background: var(--sheet); }
.btn--quiet { background: none; color: var(--ink); border: 0; padding-inline: 0; min-height: 2.5rem; text-decoration: underline; text-underline-offset: 0.2em; }
.btn--danger { background: transparent; color: var(--red); border-color: currentColor; }
.btn--big { min-height: 3.5rem; font-size: var(--fs-md); padding-inline: 1.75rem; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ---------- masthead + tabs ---------- */
.masthead { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); }
.masthead__in { display: flex; align-items: center; gap: 1rem; min-height: 3.75rem; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em; color: var(--ink-strong); text-decoration: none; }
.logo { width: 1.75rem; height: 1.75rem; flex: none; }
.logo__box { fill: var(--sheet); stroke: var(--ink); stroke-width: 2.2; }
.logo__x { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }

.tabs { display: flex; gap: 0.25rem; margin-inline-start: auto; }
.tabs a { position: relative; display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.5rem 0.75rem; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; }
.tabs a:hover { background: var(--sheet); }
.tabs a[aria-current] { background: var(--sheet); box-shadow: inset 0 -3px 0 var(--hl); }
.tabs svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs__badge { min-width: 1.3rem; height: 1.3rem; padding: 0 0.3rem; border-radius: 999px; background: var(--hl); color: #1b2733; font: 700 0.75rem/1.3rem var(--font-ui); text-align: center; }

.langpick { position: relative; }
.langpick summary { list-style: none; display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer; padding: 0.5rem 0.6rem; border-radius: 8px; color: var(--ink); font-weight: 600; }
.langpick summary::-webkit-details-marker { display: none; }
.langpick summary:hover { background: var(--sheet); }
.langpick svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.6; }
.langpick ul { position: absolute; inset-inline-end: 0; top: calc(100% + 0.35rem); margin: 0; padding: 0.35rem; list-style: none; background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px; box-shadow: var(--shadow-sheet); min-width: 10rem; }
.langpick a { display: block; padding: 0.55rem 0.75rem; border-radius: 6px; text-decoration: none; color: var(--text); }
.langpick a:hover { background: var(--paper); }
.langpick a[aria-current] { font-weight: 700; color: var(--ink); }

/* phones: tabs become a bottom bar for thumbs */
@media (max-width: 47.99rem) {
  .tabs {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 30; margin: 0; gap: 0;
    background: var(--sheet); border-top: 1px solid var(--rule);
    padding: 0.3rem 0.5rem calc(0.3rem + env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .tabs a { flex-direction: column; gap: 0.1rem; font-size: 0.75rem; padding: 0.35rem 0.5rem; flex: 1; }
  .tabs a[aria-current] { box-shadow: inset 0 3px 0 var(--hl); background: none; }
  .tabs__badge { position: absolute; top: 0.1rem; inset-inline-start: calc(50% + 0.4rem); }
  .langpick { margin-inline-start: auto; }
  .masthead { backdrop-filter: none; background: var(--paper); position: relative; }
  body { padding-bottom: calc(4.25rem + env(safe-area-inset-bottom)); }
  body.page-workbook, body.page-root { padding-bottom: 0; }
}

/* ---------- footer ---------- */
.foot { margin-top: 4rem; border-top: 1px solid var(--rule); background: var(--paper); }
.foot__in { padding-block: 2rem 2.5rem; color: var(--muted); font-size: var(--fs-sm); }
.foot__disclaimer { max-width: 60ch; margin: 0 0 0.5rem; }
.foot__meta { margin: 0 0 1rem; }
.foot__links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin: 0; padding: 0; list-style: none; }

/* ---------- hand-drawn ink X (the signature mark) ---------- */
.xmark { width: 100%; height: 100%; overflow: visible; }
.xmark path { fill: none; stroke: var(--ink); stroke-width: 3.2; stroke-linecap: round; stroke-dasharray: 22; stroke-dashoffset: 22; }
.is-marked .xmark path:first-child { animation: draw 0.16s ease-out forwards; }
.is-marked .xmark path:last-child { animation: draw 0.16s 0.12s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .xmark path { animation: none !important; stroke-dashoffset: 0; }
  .opt:not(.is-marked) .xmark path { stroke-dashoffset: 22; }
  * { scroll-behavior: auto !important; }
}

/* ---------- paper sheet ---------- */
.sheet { background: var(--sheet); border-radius: 3px; box-shadow: var(--shadow-sheet); padding: 1.5rem 1.25rem; position: relative; }
@media (min-width: 40rem) { .sheet { padding: 2rem 2.25rem; } }
.sheet__head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; color: var(--muted); font-size: var(--fs-sm); margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px dashed var(--rule); }
.sheet__head > :first-child { color: var(--ink); font-weight: 700; }

/* ---------- question + options ---------- */
.q { font-size: var(--fs-md); line-height: 1.35; font-weight: 650; color: var(--ink-strong); margin: 0 0 1.25rem; letter-spacing: -0.005em; }
@media (min-width: 40rem) { .q { font-size: var(--fs-lg); } }
.q__tr { display: block; margin-top: 0.4rem; font: italic 400 1rem/1.45 var(--font-read); color: var(--muted); letter-spacing: 0; }

.opts { display: grid; gap: 0.6rem; margin: 0; padding: 0; }
.opt {
  display: grid; grid-template-columns: 2rem 1fr; align-items: center; gap: 0.9rem;
  width: 100%; min-height: 3.5rem; padding: 0.7rem 1rem 0.7rem 0.8rem;
  font: 500 var(--fs-base)/1.35 var(--font-ui); color: var(--text); text-align: start;
  background: var(--sheet); border: 1.5px solid var(--rule); border-radius: 8px; cursor: pointer;
  transition: border-color 0.12s, background-color 0.12s;
}
.opt:hover:not([disabled]) { border-color: var(--ink-2); background: color-mix(in srgb, var(--hl) 10%, var(--sheet)); }
.opt[disabled] { cursor: default; }
.opt__box { position: relative; width: 2rem; height: 2rem; border: 2px solid var(--ink); border-radius: 3px; background: var(--sheet); padding: 0.2rem; }
.opt__text { display: block; }
.opt__tr { display: block; margin-top: 0.2rem; font: italic 400 0.9375rem/1.4 var(--font-read); color: var(--muted); }
.opt.is-marked { border-color: var(--ink); }

/* teacher's marking after an answer */
.opt.is-right { border-color: var(--green); background: var(--green-wash); }
.opt.is-right .opt__box::after {
  content: ""; position: absolute; inset: -0.55rem -0.6rem -0.5rem -0.55rem;
  border: 2.5px solid var(--green); border-radius: 50% 46% 52% 48% / 55% 50% 50% 45%;
  transform: rotate(-8deg);
}
.opt.is-wrong { border-color: var(--red); background: var(--red-wash); }
.opt.is-wrong .opt__text > span:first-child { text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 2px; }

/* mock exam: selectable, changeable */
.opt[role="radio"][aria-checked="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }

/* feedback note */
.note { margin-top: 1.25rem; padding: 1rem 1.1rem 1.1rem; border-inline-start: 4px solid var(--ink-2); background: var(--paper); border-radius: 0 8px 8px 0; }
.note--right { border-color: var(--green); }
.note--wrong { border-color: var(--red); }
.note__verdict { margin: 0 0 0.35rem; font-weight: 750; font-size: var(--fs-md); }
.note--right .note__verdict { color: var(--green); }
.note--wrong .note__verdict { color: var(--red); }
.note__text { margin: 0; font: 400 1.0625rem/1.6 var(--font-read); }
.note__tr { margin: 0.5rem 0 0; font: italic 400 1rem/1.55 var(--font-read); color: var(--muted); }
.note__src { margin: 0.6rem 0 0; font-size: var(--fs-sm); color: var(--muted); }
.note__src a { color: var(--muted); }

/* ---------- home: hero ---------- */
.hero { display: grid; gap: 2.5rem; padding-block: 2.5rem 3rem; align-items: center; }
@media (min-width: 60rem) { .hero { grid-template-columns: 5fr 6fr; gap: 4rem; padding-block: 4.5rem 5rem; } }
.hero__title { font-size: var(--fs-hero); line-height: 1.02; font-weight: 820; letter-spacing: -0.032em; color: var(--ink-strong); margin: 0 0 1.25rem; text-wrap: balance; hyphens: manual; overflow-wrap: anywhere; }
.hero__lede { font-size: var(--fs-md); line-height: 1.5; max-width: 34ch; margin: 0 0 1.25rem; color: var(--text); }
.hero__sitting { margin: 0 0 1.75rem; color: var(--muted); max-width: 40ch; }
.hero__sitting b { color: var(--text); font-weight: 650; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
@media (min-width: 60rem) { .hero__sheet .sheet { transform: rotate(-0.8deg); } }
.hero__sheet .sheet::before {
  content: ""; position: absolute; inset-block: 0; inset-inline-start: 2.6rem; width: 1.5px; background: color-mix(in srgb, var(--red) 35%, transparent);
}
@media (max-width: 39.99rem) { .hero__sheet .sheet::before { display: none; } }
.sheet--exam .q, .sheet--exam .opts, .sheet--exam .note, .sheet--exam .sheet__head, .sheet--exam .btn--quiet { position: relative; }
@media (min-width: 40rem) { .sheet--exam { padding-inline-start: 3.75rem; } }
.q--sample { min-height: 3.2em; }

/* ---------- home: preparation ruler ---------- */
.prep { padding-block: 1rem 3rem; }
.prep__grid { display: grid; gap: 2rem; background: var(--sheet); box-shadow: var(--shadow-sheet); border-radius: 3px; padding: 1.5rem 1.25rem; }
@media (min-width: 52rem) { .prep__grid { grid-template-columns: 3fr 2fr; padding: 2rem 2.25rem; gap: 3rem; } }
.prep__label { margin: 0 0 0.75rem; font-weight: 700; color: var(--ink); }
.prep__estimate { margin: 1rem 0 0.25rem; font-size: var(--fs-md); font-weight: 650; color: var(--ink-strong); }
.prep__help { margin: 0; color: var(--muted); font-size: var(--fs-sm); max-width: 48ch; }
.prep__next p { margin: 0 0 0.6rem; }
.prep__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.25rem; }

/* a 25-mark ruler with the pass line at 20, filled with highlighter */
.ruler { --v: 0; position: relative; height: 3rem; border: 1.5px solid var(--ink); border-radius: 3px; background: var(--sheet); }
.ruler__fill { position: absolute; inset-block: 0.45rem; inset-inline-start: 0; width: calc(var(--v) / 25 * 100%); background: var(--hl-wash); border-radius: 0 2px 2px 0; transition: width 0.8s cubic-bezier(.2,.7,.2,1); }
.ruler__ticks { position: absolute; inset: 0; background-image: repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px calc(100% / 25)); mask: linear-gradient(to bottom, #000 0 22%, transparent 22% 78%, #000 78%); -webkit-mask: linear-gradient(to bottom, #000 0 22%, transparent 22% 78%, #000 78%); opacity: 0.55; }
.ruler__pass { position: absolute; inset-block: -0.5rem; inset-inline-start: 80%; width: 0; border-inline-start: 2.5px solid var(--red); }
.ruler__pass span { position: absolute; top: -1.35rem; transform: translateX(-50%); font-size: 0.8rem; font-weight: 700; color: var(--red); }
@media (prefers-reduced-motion: reduce) { .ruler__fill { transition: none; } }

/* ---------- home: table of contents with highlighter progress ---------- */
.topics { padding-block: 1rem 2rem; }
.topics__head { margin-bottom: 1.25rem; }
.topics__lede { margin: -0.5rem 0 0; color: var(--muted); max-width: 52ch; }
.toc { list-style: none; margin: 0; padding: 0; display: grid; column-gap: 3rem; }
@media (min-width: 52rem) { .toc { grid-template-columns: 1fr 1fr; } }
.toc__row { display: grid; grid-template-columns: 2.25rem 1fr auto; align-items: baseline; gap: 0.75rem; padding: 0.85rem 0.25rem; border-bottom: 1px solid var(--rule); color: var(--text); text-decoration: none; }
a.toc__row:hover .toc__text { text-decoration: underline; text-underline-offset: 0.2em; }
.toc__n { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink-2); text-align: end; }
.toc__title { position: relative; display: block; }
.toc__text { position: relative; font-weight: 650; color: var(--ink-strong); }
.toc__hl { position: absolute; inset-inline-start: -0.2rem; top: 0.3em; height: 0.95em; width: calc(var(--p, 0) * (100% + 0.4rem)); max-width: calc(100% + 0.4rem); background: var(--hl-wash); border-radius: 2px 6px 3px 5px; z-index: 0; transition: width 0.6s; }
.toc__tr { display: block; color: var(--muted); font-size: var(--fs-sm); }
.toc__count { color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; font-variant-numeric: tabular-nums; }
.toc__row--off .toc__text, .toc__row--off .toc__n { color: var(--muted); font-weight: 500; }

/* ---------- topic page ---------- */
.topic { max-width: 46rem; padding-block: 2.5rem 1rem; }
.topic__head--art { display: grid; gap: 1.5rem; }
.topic__art { margin: 0; background: #fff; border-radius: 3px; box-shadow: var(--shadow-sheet); padding: 0.75rem; transform: rotate(0.6deg); max-width: 26rem; }
.topic__art img { width: 100%; height: auto; }
@media (min-width: 52rem) {
  .topic { max-width: 60rem; }
  .topic__head--art { grid-template-columns: 1fr 22rem; align-items: center; gap: 3rem; }
  .topic__head--art .topic__art { order: 2; }
  .topic > .topic__sec, .topic > .trbar, .topic > .topic__end, .topic > .pager { max-width: 46rem; }
}
.topic__kicker { margin: 0 0 0.35rem; color: var(--ink-2); font-weight: 700; }
.topic__title { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.1rem); line-height: 1.05; font-weight: 800; letter-spacing: -0.025em; color: var(--ink-strong); margin: 0; text-wrap: balance; }
.topic__tr { margin: 0.4rem 0 0; font: italic 400 var(--fs-md)/1.4 var(--font-read); color: var(--muted); }
.topic__meter { --p: 0; position: relative; margin: 1.5rem 0 1.25rem; height: 0.6rem; border-radius: 99px; background: var(--rule); max-width: 22rem; }
.topic__meter-fill { position: absolute; inset-block: 0; inset-inline-start: 0; width: calc(var(--p) * 100%); background: var(--hl); border-radius: 99px; }
.topic__meter-text { position: absolute; top: 0.9rem; inset-inline-start: 0; font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }
.topic__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2.5rem; }
.topic__draft { margin: 1rem 0 0; padding: 0.5rem 0.75rem; background: var(--red-wash); color: var(--red); border-radius: 6px; font-size: var(--fs-sm); display: inline-block; }
.topic__sec { margin-top: 3rem; }

.trbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-top: 2rem; padding: 0.6rem 0; }
.trbar__note { margin: 0; font-size: var(--fs-sm); color: var(--muted); flex: 1 1 18rem; }
.trtoggle { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.5rem; padding: 0.35rem 0.9rem 0.35rem 0.45rem; border: 1.5px solid var(--ink); border-radius: 99px; background: var(--sheet); color: var(--ink); font: 650 0.9375rem/1 var(--font-ui); cursor: pointer; }
.trtoggle::before { content: ""; width: 2.1rem; height: 1.25rem; border-radius: 99px; background: var(--rule); box-shadow: inset 0 0 0 0 transparent; transition: background-color 0.15s; background-image: radial-gradient(circle at 0.62rem 50%, var(--sheet) 0.45rem, transparent 0.5rem); }
.trtoggle[aria-pressed="true"]::before { background-color: var(--ink); background-image: radial-gradient(circle at 1.48rem 50%, var(--sheet) 0.45rem, transparent 0.5rem); }
.trtoggle__off { display: none; }
.trtoggle[aria-pressed="true"] .trtoggle__on { display: none; }
.trtoggle[aria-pressed="true"] .trtoggle__off { display: inline; }

.tr { display: none; }
.show-tr .tr { display: block; }
.prose p { font: 400 1.125rem/1.7 var(--font-read); margin: 0 0 1.1rem; max-width: 66ch; }
.prose p.tr, .facts .tr, .vocab .tr { font: italic 400 1.0625rem/1.6 var(--font-read); color: var(--muted); margin-top: -0.6rem; padding-inline-start: 0.9rem; border-inline-start: 2px solid var(--rule); }
.facts .tr, .vocab .tr { margin-top: 0.3rem; }

.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.facts li { font: 400 1.125rem/1.6 var(--font-read); }
.facts mark { background: linear-gradient(to bottom, transparent 0.18em, var(--hl-wash) 0.18em, var(--hl-wash) 1.15em, transparent 1.15em); color: inherit; padding-inline: 0.1em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.facts__src { margin-inline-start: 0.4rem; font: 400 var(--fs-sm)/1 var(--font-ui); color: var(--muted); white-space: nowrap; }

.vocab { margin: 0; display: grid; gap: 0; }
@media (min-width: 40rem) { .vocab { grid-template-columns: 1fr 1fr; column-gap: 2.5rem; } }
.vocab__item { padding: 0.9rem 0; border-bottom: 1px solid var(--rule); }
.vocab dt { font-weight: 750; color: var(--ink-strong); }
.vocab__tr { font-weight: 500; color: var(--muted); font-style: italic; font-family: var(--font-read); }
.vocab dd { margin: 0.2rem 0 0; font: 400 1rem/1.55 var(--font-read); }

.topic__end { margin-top: 3.5rem; display: grid; justify-items: start; gap: 1rem; }
.topic__end p { margin: 0; color: var(--muted); font-size: var(--fs-sm); }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.pager a { display: grid; gap: 0.15rem; text-decoration: none; font-weight: 650; max-width: 48%; }
.pager small { color: var(--muted); font-weight: 500; }
.pager__next { text-align: end; margin-inline-start: auto; }

/* ---------- quiz ---------- */
.quiz { max-width: 44rem; padding-block: 1.5rem 2rem; }
.quiz__msg { color: var(--muted); padding-block: 3rem; }
.quiz__top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.quiz__title { margin: 0; font-size: var(--fs-md); font-weight: 750; color: var(--ink-strong); }
.quiz__count { color: var(--muted); font-variant-numeric: tabular-nums; }
.quiz__timer { font: 700 var(--fs-md)/1 var(--font-ui); font-variant-numeric: tabular-nums; color: var(--ink); padding: 0.4rem 0.7rem; border: 1.5px solid var(--ink); border-radius: 6px; }
.quiz__timer.is-low { color: var(--red); border-color: var(--red); }
.track { display: flex; gap: 3px; margin-bottom: 1.25rem; }
.track span { flex: 1; height: 0.4rem; border-radius: 2px; background: var(--rule); }
.track .is-right { background: var(--green); }
.track .is-wrong { background: var(--red); }
.track .is-now { background: var(--ink); }
.quiz__trline { display: flex; justify-content: flex-end; margin: -0.25rem 0 0.75rem; }
.quiz__actions { position: sticky; bottom: 0; display: flex; gap: 0.75rem; justify-content: flex-end; padding-block: 0.75rem; margin-top: 1rem; background: var(--paper); box-shadow: 0 -1px 0 var(--rule); }
.quiz__actions:empty, .quiz__actions:has(> [hidden]:only-child) { box-shadow: none; }
@media (max-width: 47.99rem) { .quiz__actions { bottom: calc(4.25rem + env(safe-area-inset-bottom)); } .quiz__actions .btn { flex: 1; } }

/* mock exam booklet navigator: 25 numbered boxes (the real test is a numbered sequence) */
.booklet { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.4rem, 1fr)); gap: 0.4rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }
.booklet button { position: relative; width: 100%; aspect-ratio: 1; border: 1.5px solid var(--rule); border-radius: 4px; background: var(--sheet); color: var(--muted); font: 600 0.8125rem/1 var(--font-ui); cursor: pointer; font-variant-numeric: tabular-nums; }
.booklet button.is-done { border-color: var(--ink-2); color: var(--ink); background: color-mix(in srgb, var(--hl) 22%, var(--sheet)); }
.booklet button[aria-current="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); color: var(--ink-strong); }

.result { text-align: start; }
.result__verdict { font-size: clamp(2.2rem, 1.6rem + 3vw, 3.5rem); line-height: 1.05; font-weight: 820; letter-spacing: -0.03em; margin: 0.5rem 0; color: var(--ink-strong); }
.result__verdict.is-pass { color: var(--green); }
.result__score { font-size: var(--fs-md); margin: 0 0 1.5rem; }
.result .ruler { margin: 2rem 0 0.75rem; }
.result__list { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 1rem; }
.result__item { background: var(--sheet); border-radius: 3px; box-shadow: var(--shadow-sheet); padding: 1.1rem 1.25rem; }
.result__item h3 { margin: 0 0 0.6rem; font-size: var(--fs-base); line-height: 1.4; color: var(--ink-strong); }
.result__item p { margin: 0.25rem 0 0; }
.result__yours { color: var(--red); text-decoration: line-through; }
.result__right { color: var(--green); font-weight: 650; }
.result__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }

/* ---------- about ---------- */
.prose-page { max-width: 44rem; padding-block: 2.5rem 1rem; }
.prose-page > p { font: 400 1.125rem/1.7 var(--font-read); max-width: 64ch; }
.prose-page .h2 { margin-top: 2.5rem; }
.about__disclaimer { padding: 1rem 1.1rem; border-inline-start: 4px solid var(--hl); background: var(--sheet); }
.about__data { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.about__status { min-height: 1.5rem; color: var(--green); }

/* ---------- root language chooser ---------- */
.root { max-width: 40rem; padding-block: 4rem; }
.brand--big { font-size: 1.75rem; margin: 0 0 2.5rem; }
.brand--big .logo { width: 2.5rem; height: 2.5rem; }
.root__langs { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem; }
.root__langs a { display: grid; gap: 0.25rem; padding: 1.25rem 1.4rem; background: var(--sheet); box-shadow: var(--shadow-sheet); border-radius: 3px; text-decoration: none; }
.root__langs a:hover b { text-decoration: underline; }
.root__langs b { font-size: var(--fs-lg); line-height: 1.2; color: var(--ink-strong); letter-spacing: -0.015em; }
.root__langs span { color: var(--muted); }
.root__note { margin-top: 2.5rem; color: var(--muted); font-size: var(--fs-sm); max-width: 56ch; }

/* ---------- workbook (screen + print) ---------- */
.page-workbook { background-image: none; }
.wb-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; max-width: 52rem; margin: 0 auto; padding: 1rem var(--gutter); }
.wb { max-width: 52rem; margin: 0 auto 3rem; background: var(--sheet); box-shadow: var(--shadow-sheet); padding: 2.5rem 2.25rem; color: var(--text); }
.wb h1 { font-size: 1.9rem; line-height: 1.1; margin: 0.5rem 0 1rem; color: var(--ink-strong); letter-spacing: -0.02em; }
.wb h2 { font-size: 1.2rem; margin: 2rem 0 0.6rem; color: var(--ink-strong); border-bottom: 2px solid var(--ink); padding-bottom: 0.25rem; }
.wb p, .wb li { font: 400 1rem/1.6 var(--font-read); }
.wb__head { position: relative; min-height: 8rem; }
.wb__art { position: absolute; top: -0.5rem; inset-inline-end: 0; width: 11rem; height: auto; }
@media (max-width: 40rem) { .wb__art { position: static; width: 9rem; margin-bottom: 0.5rem; } }
.wb__head h1, .wb__name { max-width: calc(100% - 12rem); }
@media (max-width: 40rem) { .wb__head h1, .wb__name { max-width: none; } }
.wb__brand { display: flex; align-items: center; gap: 0.5rem; font: 700 0.95rem/1 var(--font-ui) !important; color: var(--ink); margin: 0; }
.wb__brand .logo { width: 1.3rem; height: 1.3rem; }
.wb__kind { color: var(--muted); font-weight: 500; }
.wb__name { font-family: var(--font-ui) !important; color: var(--muted); }
.wb__name span { display: inline-block; width: 12rem; border-bottom: 1px solid var(--muted); margin-inline: 0.4rem 1.5rem; }
.wb__hint { color: var(--muted); font-family: var(--font-ui) !important; font-size: 0.9rem !important; margin-top: 0; }
.wb__facts li { margin-bottom: 0.4rem; }
.wb__vocab { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.wb__vocab th, .wb__vocab td { border: 1px solid var(--rule); padding: 0.45rem 0.6rem; text-align: start; vertical-align: top; }
.wb__vocab th { font-family: var(--font-ui); background: var(--paper); }
.wb__vocab td:last-child { width: 30%; }
.wb__test > ol { padding-inline-start: 1.6rem; }
.wb__q { break-inside: avoid; margin-bottom: 0.9rem; }
.wb__q p { margin: 0 0 0.35rem; font-weight: 600; }
.wb__q ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.25rem; }
.wb__q li { display: flex; align-items: center; gap: 0.5rem; }
.wb__box { width: 1rem; height: 1rem; border: 1.5px solid var(--ink); border-radius: 2px; flex: none; }
.wb__letter { font-family: var(--font-ui); color: var(--muted); width: 0.9rem; }
.wb__lines { height: 9rem; background-image: repeating-linear-gradient(to bottom, transparent 0 1.75rem, var(--rule) 1.75rem calc(1.75rem + 1px)); }
.wb__key { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; padding-inline-start: 1.6rem; font-family: var(--font-ui); }
.wb__key li { min-width: 2.5rem; font-family: var(--font-ui); }
.wb__foot { margin-top: 2rem; font-size: 0.8rem; color: var(--muted); }

@media print {
  @page { size: A4; margin: 16mm 15mm; }
  :root { --text: #000; --ink: #1c3d63; --ink-strong: #000; --rule: #999; --muted: #444; --sheet: #fff; --paper: #fff; }
  body { background: #fff !important; padding: 0 !important; display: block; }
  .wb-bar, .masthead, .foot, .tabs, .skip { display: none !important; }
  .wb { box-shadow: none; padding: 0; margin: 0; max-width: none; }
  .wb__answers { break-before: page; }
  .wb__keep { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

.note { scroll-margin-bottom: 6rem; }
@media (max-width: 47.99rem) { .note { scroll-margin-bottom: 10.5rem; } }

.weak { margin: 1.5rem 0 0; }
.weak p { margin: 0 0 0.5rem; font-weight: 650; }
.weak ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.weak a { display: inline-block; padding: 0.45rem 0.8rem; border-radius: 99px; background: var(--sheet); border: 1.5px solid var(--ink-2); text-decoration: none; font-weight: 600; }
.weak a:hover { background: color-mix(in srgb, var(--hl) 25%, var(--sheet)); }
