/* Ready for Citizenship. Design A2 "Study Desk" v2 (decision 2026-11-23): warm paper, indigo ink, Canadian red as an
 * accent only (eyebrow, active tab, current question, pass line), our own 7-point maple leaf.
 * Legal guardrails (lawyer, 2026-11-23): never the 11-point flag leaf, red-white-red bands, the "Canada" wordmark, the
 * coat of arms or the canada.ca look (black header + red bar, government layout and typefaces). The header stays on paper.
 * Type, self-hosted (CSP font-src 'self'): Literata for titles and scores, Atkinson Hyperlegible Next for everything you
 * read and tap (made for legibility, good for second-language readers). */
@font-face { font-family: 'Atkinson Next'; src: url('fonts/atkinson-hyperlegible-next-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Atkinson Next'; src: url('fonts/atkinson-hyperlegible-next-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Atkinson Next'; src: url('fonts/atkinson-hyperlegible-next-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Literata'; src: url('fonts/literata-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Roboto'; src: url('fonts/roboto-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }

/* Final design (declutter v2, approved 2026-11-23): spacing on a 4 px grid, a type scale of 4 steps (28 / 22 / 18 / 15,
 * plus 14 for the notice and legal line), 3 button styles (primary, secondary, text link), one icon set (24 grid, 2 px
 * stroke), 48 px tap targets. */
:root {
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --t-xl: 28px; --lh-xl: 36px; --t-l: 22px; --lh-l: 28px; --t-m: 18px; --lh-m: 28px; --t-s: 15px; --lh-s: 20px; --t-xs: 14px;
  --serif: 'Literata', 'Iowan Old Style', Georgia, serif;
  --sans: 'Atkinson Next', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r-card: 12px; --r-ctl: 8px; --tap: 48px; --tabh: 72px; --dockh: 132px;
  --bg: #f7f4ee; --surface: #ffffff; --ink: #1c2230; --muted: #4a5263; --line: #dad4c8; --line-strong: #b9b0a1;
  --primary: #2c3a8c; --primary-deep: #1f2a6b; --on-primary: #ffffff; --primary-text: #2c3a8c; --primary-soft: #e7eaf6;
  --maple: #d52b1e; --maple-text: #a8201a; --accent-soft: #fbeae7;
  --ok: #1e6b45; --ok-soft: #e3f1e8; --no: #9a2e28; --no-soft: #f8e6e4;
  --notice-bg: #efeadf; --land: #b0a796; --leaf-off: #8f8676; --focus: #1f2a6b; --mark: #2c3a8c;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #13161f; --surface: #1c2130; --ink: #eeeae2; --muted: #b1b7c5; --line: #2f3648; --line-strong: #4a536a;
    --primary: #4152b8; --primary-deep: #5263c8; --on-primary: #ffffff; --primary-text: #aeb9f7; --primary-soft: #262e52;
    --maple: #e5473b; --maple-text: #ff9a8f; --accent-soft: #3a1e1c;
    --ok: #7fd3a2; --ok-soft: #173326; --no: #ff9a8f; --no-soft: #3a1e1c;
    --notice-bg: #191d29; --land: #596075; --leaf-off: #7a839a; --focus: #c7cfff; --mark: #4152b8;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #13161f; --surface: #1c2130; --ink: #eeeae2; --muted: #b1b7c5; --line: #2f3648; --line-strong: #4a536a;
  --primary: #4152b8; --primary-deep: #5263c8; --on-primary: #ffffff; --primary-text: #aeb9f7; --primary-soft: #262e52;
  --maple: #e5473b; --maple-text: #ff9a8f; --accent-soft: #3a1e1c;
  --ok: #7fd3a2; --ok-soft: #173326; --no: #ff9a8f; --no-soft: #3a1e1c;
  --notice-bg: #191d29; --land: #596075; --leaf-off: #7a839a; --focus: #c7cfff; --mark: #4152b8;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--t-m)/var(--lh-m) var(--sans); min-height: 100vh; min-height: 100dvh; }
a { color: var(--primary-text); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }
h1:focus { outline: none; }
p { margin: 0 0 var(--s3); text-wrap: pretty; }
svg { flex: none; }
.ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }
.ico-s { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 10px 14px; z-index: 50; }
.skip:focus { left: 16px; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 72px;
  padding: env(safe-area-inset-top) calc(var(--s4) + env(safe-area-inset-right)) 0 calc(var(--s4) + env(safe-area-inset-left)); background: var(--bg); }
.brand { display: flex; align-items: center; gap: var(--s3); flex: 1; min-width: 0; color: var(--ink); text-decoration: none; min-height: var(--tap); }
.mark { width: 27px; height: 36px; flex: none; }
.mark .bm { fill: var(--mark); }
.mark .bt { fill: var(--maple); }
.mark .lf { fill: #fff; stroke: #fff; }
.wm { display: flex; flex-direction: column; line-height: 1; min-width: 0; }
.wm small { font: 700 12px/16px var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.wm b { font: 600 21px/24px var(--serif); color: var(--ink); white-space: nowrap; }
.topactions { display: flex; align-items: center; gap: var(--s2); flex: none; }
/* secondary button: header pills and in-page secondary actions, all the same height, border and type */
.btn2 { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: var(--tap); min-width: var(--tap); padding: 0 var(--s4);
  border: 2px solid var(--line-strong); border-radius: var(--r-ctl); background: var(--surface); color: var(--ink); font: 700 var(--t-s)/var(--lh-s) var(--sans);
  text-decoration: none; white-space: nowrap; cursor: pointer; text-align: center; }
.btn2:hover { background: var(--primary-soft); }
.btn2.block { display: flex; width: 100%; min-height: 56px; font-size: var(--t-m); white-space: normal; margin-top: var(--s3); }
.btn2:disabled { opacity: .45; cursor: default; }
.btn2.danger, .btn.danger { color: var(--no); border-color: var(--no); background: transparent; }
.acctbtn { position: relative; }
.acctico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; display: none; }
.acctbtn.in { padding: 0; width: var(--tap); }
.acctbtn.in .acctlabel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.avatar { position: relative; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 99px; background: var(--primary); color: var(--on-primary); font: 700 var(--t-s)/1 var(--sans); }
.acctbtn.synced .avatar::after { content: ''; position: absolute; right: -3px; bottom: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); border: 2px solid var(--surface); }
@media (max-width: 399px) {
  .brand { gap: var(--s2); }
  .wm b { font-size: 19px; }
  .btn2 { padding: 0 var(--s3); }
  .top { padding-left: calc(var(--s3) + env(safe-area-inset-left)); padding-right: calc(var(--s3) + env(safe-area-inset-right)); }
}
/* below 360 px the sign-in button becomes an icon button (label kept for screen readers) */
@media (max-width: 359px) {
  .top { min-height: 64px; }
  .mark { width: 24px; height: 32px; }
  .wm small { font-size: 11px; letter-spacing: .07em; }
  .wm b { font-size: 17px; line-height: 20px; }
  .btn2 { padding: 0 var(--s2); }
  .acctbtn:not(.in) { width: var(--tap); padding: 0; }
  .acctbtn:not(.in) .acctlabel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .acctbtn:not(.in) .acctico { display: block; }
}

/* compact notice: one line on phones (short form), the full sentence on tap, on wide screens and for screen readers */
.notice { margin: 0; background: var(--notice-bg); border-block: 1px solid var(--line); }
.noticebtn { display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: 44px; padding: var(--s2) calc(var(--s4) + env(safe-area-inset-right)) var(--s2) calc(var(--s4) + env(safe-area-inset-left));
  background: none; border: 0; color: var(--muted); font: 400 var(--t-xs)/20px var(--sans); text-align: left; cursor: pointer; }
.noticebtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; flex: none; }
.notice b { color: var(--ink); font-weight: 700; }
.notice .nt { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notice .full { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.notice.open .nt { white-space: normal; }
.notice.open .full { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; }
.notice.open .short { display: none; }
@media (min-width: 500px) {
  .notice .full { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .notice .short { display: none; }
}
.preview { margin: 0; padding: 6px 16px; font-size: 13px; font-weight: 700; color: var(--maple-text); background: var(--accent-soft); border-bottom: 1px solid var(--line); }

/* ---------- layout: 4 bottom tabs on phones, a rail on wide screens ---------- */
.shell { display: block; }
main { display: block; max-width: 560px; margin: 0 auto; padding: var(--s6) calc(var(--s4) + env(safe-area-inset-right)) var(--s5) calc(var(--s4) + env(safe-area-inset-left)); outline: none;
  min-height: calc(100vh - 120px); min-height: calc(100dvh - 120px); }
.tabs { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.tabs a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s1); min-height: var(--tabh); padding: 6px 2px;
  color: var(--muted); text-decoration: none; font: 600 var(--t-s)/var(--lh-s) var(--sans); text-align: center; }
.tabs a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.tabs a[aria-current="page"] { color: var(--primary-text); font-weight: 700; }
.tabs a[aria-current="page"]::before { content: ''; position: absolute; top: 0; left: 50%; width: 32px; height: 4px; margin-left: -16px; border-radius: 0 0 4px 4px; background: var(--maple); }
@media (max-width: 359px) { .tabs a { font-size: 13px; } }
@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: 232px 1fr; max-width: 1120px; margin: 0 auto; }
  .tabs { position: sticky; top: 88px; align-self: start; display: flex; flex-direction: column; gap: 2px; border: 0; background: transparent; padding: var(--s5) var(--s3); }
  .tabs a { flex-direction: row; justify-content: flex-start; gap: var(--s3); min-height: var(--tap); padding: 0 14px; border-radius: 10px; font-size: 16px; }
  .tabs a[aria-current="page"] { background: var(--primary-soft); }
  .tabs a[aria-current="page"]::before { top: 8px; bottom: 8px; left: 0; width: 4px; height: auto; margin: 0; border-radius: 0 4px 4px 0; }
  .tabs a:hover { background: var(--primary-soft); color: var(--primary-text); }
  main { margin: 0; max-width: 720px; padding: var(--s6) var(--s6) var(--s7); }
  .top { padding-left: 24px; padding-right: 24px; }
  .noticebtn, .preview { padding-left: 24px; }
}
.loading { color: var(--muted); padding: 40px 0; }
}
.noscript { padding: 16px 0; }

/* ---------- type ---------- */
.title, main h1 { font: 600 var(--t-xl)/var(--lh-xl) var(--serif); letter-spacing: -.01em; margin: 0 0 var(--s2); }
main h2 { font: 600 var(--t-m)/var(--lh-m) var(--serif); margin: var(--s6) 0 var(--s2); }
.h-sec { font: 600 var(--t-m)/var(--lh-m) var(--serif); margin: var(--s6) 0 var(--s2); }
.lead { color: var(--muted); margin-top: var(--s2); max-width: 62ch; }
.lead b { color: var(--ink); }
.factsline { margin-top: var(--s5); }
.kicker { display: flex; align-items: center; gap: var(--s2); font: 700 var(--t-s)/var(--lh-s) var(--sans); color: var(--muted); margin: 0 0 var(--s2); }
.kicker.red { color: var(--maple-text); }
.kicker .leaf { color: var(--maple); }
.meta { font: 400 var(--t-s)/var(--lh-s) var(--sans); color: var(--muted); margin: var(--s2) 0 0; }
.meta b { color: var(--ink); }
.muted { color: var(--muted); font-size: var(--t-s); line-height: var(--lh-s); }
.def { font: 400 var(--t-s)/var(--lh-s) var(--sans); color: var(--muted); margin: var(--s2) 0 var(--s3); }
.center { text-align: center; }
.num { font-family: var(--serif); font-weight: 600; white-space: nowrap; font-variant-numeric: lining-nums; }
.rdy { font-style: normal; font-weight: 700; color: var(--ok); }

/* ---------- cards ---------- */
.card, .panel { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--s5) var(--s4) var(--s4); margin: var(--s4) 0; }
.card.hero { border-top: 4px solid var(--primary); padding-top: 20px; margin-top: var(--s5); }
.card .ct, .panel h2 { font: 600 var(--t-m)/var(--lh-m) var(--serif); margin: 0; }
.card .cd { color: var(--muted); margin: var(--s1) 0 0; }
.card > .btn, .card > a.btn, .panel .btn { margin-top: var(--s5); }
.card > .meta.center { margin-top: var(--s3); }
.card.quiet { background: transparent; }
.cardhead { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s1) var(--s3); flex-wrap: wrap; }
.wmark { position: absolute; right: -16px; top: -12px; width: 88px; height: 88px; fill: var(--maple); opacity: .08; pointer-events: none; }
.card.hero .safe { padding-right: 64px; }
.card .strip { margin-top: var(--s3); }
.card.empty { padding: var(--s6) var(--s4); text-align: center; }
.card.empty .land { margin: 0 auto var(--s5); max-width: 240px; }

/* ---------- buttons ---------- */
/* primary: one per screen */
.btn { display: flex; align-items: center; justify-content: center; gap: var(--s2); width: 100%; min-height: 56px; padding: 0 var(--s4); border: 0; border-radius: var(--r-ctl);
  background: var(--primary); color: var(--on-primary); font: 700 var(--t-m)/var(--lh-m) var(--sans); text-decoration: none; text-align: center; cursor: pointer; }
.btn:hover { background: var(--primary-deep); }
.btn:disabled { opacity: .45; cursor: default; }
/* "Check answer" before a choice: readable, clearly inactive */
.btn[aria-disabled="true"] { background: var(--notice-bg); color: var(--muted); border: 2px dashed var(--line-strong); cursor: not-allowed; }
/* older screens (account) still say "btn ghost": the secondary style */
.btn.ghost { background: var(--surface); color: var(--ink); border: 2px solid var(--line-strong); font-size: var(--t-s); }
.btn.ghost:hover { background: var(--primary-soft); }
.btn.small { width: auto; min-height: var(--tap); font-size: var(--t-s); }
/* text link: underlined, full 48 px target */
.tlink { display: flex; align-items: center; gap: var(--s2); min-height: var(--tap); margin-top: var(--s2); font: 700 var(--t-m)/var(--lh-m) var(--sans); color: var(--primary-text);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; border-radius: 4px; }
.tlink .chev { margin-left: auto; color: var(--muted); }
.textbtn, .linkbtn { font: 700 var(--t-s)/1.2 var(--sans); color: var(--primary-text); background: none; border: 0; padding: 0; min-height: 44px; display: inline-flex; align-items: center;
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.actions { display: flex; flex-direction: column; gap: var(--s3); margin: var(--s5) 0; }
.actions > .btn2.block { margin-top: 0; }
.actions .btn.ghost, .actions .btn.small { width: 100%; }
.actions.split { flex-direction: row; }
.actions.split > * { flex: 1 1 0; }
.actions.wrap { flex-direction: row; flex-wrap: wrap; }
.actions.wrap .btn.ghost, .actions.wrap .btn2 { width: auto; flex: 1 1 auto; }
.filebtn { position: relative; overflow: hidden; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }

/* ---------- lists ---------- */
.list, .rows, .chapters { list-style: none; margin: var(--s3) 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.list > li + li { border-top: 1px solid var(--line); }
.row, .chapter, .list .li { display: flex; align-items: center; gap: var(--s3); min-height: 64px; padding: var(--s3) var(--s4); color: var(--ink); text-decoration: none; }
.row:hover, .chapter:hover { background: var(--primary-soft); }
.txt { flex: 1; min-width: 0; display: block; }
.txt > b, .rowtitle { display: block; font-weight: 700; }
.txt > span, .rowsub { display: block; font: 400 var(--t-s)/var(--lh-s) var(--sans); color: var(--muted); }
.txt .meta { display: block; margin-top: var(--s1); }
.chev { color: var(--muted); }
.tile { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-ctl); background: var(--primary-soft); color: var(--primary-text); flex: none; }
.tile.ok { background: var(--ok-soft); color: var(--ok); }
.tile.no { background: var(--no-soft); color: var(--no); }
.tile.chn { font: 600 18px/1 var(--serif); }
.count { flex: none; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px; background: var(--accent-soft); color: var(--maple-text); font-weight: 700; font-size: 14px; display: grid; place-items: center; }
.mbar { position: relative; display: block; height: 8px; margin-top: var(--s2); background: var(--primary-soft); border-radius: 99px; overflow: hidden; }
.mbar::after { content: ''; position: absolute; left: 80%; top: 0; bottom: 0; width: 2px; background: var(--muted); } /* the 80 % "ready" mark */
.mbar.plain::after { display: none; }
.mbar i { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 99px; }
.mbar.done i { background: var(--ok); }
.history .txt > b { font-weight: 600; }

/* progress leaves and streak */
.leaves { display: flex; justify-content: space-between; margin-top: var(--s3); color: var(--leaf-off); }
.leaf { flex: none; width: 20px; height: 20px; color: var(--maple); }
.leaf path:first-child { fill: currentColor; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.leaf path + path { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.leaves .leaf { width: 24px; height: 24px; color: var(--leaf-off); }
.leaves .leaf.off path:first-child { fill: none; }
.leaves .leaf.on { color: var(--maple); }
.streak b { color: var(--ink); }

/* three equal stat cells (mock test facts, results, progress) */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: var(--s4) 0 0; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface); }
.card > .stats:first-child { margin-top: 0; }
.card > .safe + .stats { margin-top: var(--s4); }
.stats div { display: flex; flex-direction: column; align-items: center; padding: var(--s3) var(--s1); text-align: center; min-width: 0; }
.stats div + div { border-left: 1px solid var(--line); }
.stats dd { order: -1; margin: 0; font: 600 var(--t-xl)/var(--lh-xl) var(--serif); font-variant-numeric: lining-nums; }
.stats dt { font: 400 var(--t-s)/var(--lh-s) var(--sans); color: var(--muted); text-wrap: balance; }
main > .stats { margin: var(--s4) 0; }

/* the strip: 20 cells and the pass line */
.strip { display: flex; align-items: center; gap: 4px; margin: var(--s2) 0; flex-wrap: nowrap; }
.strip .cell { flex: 1 1 0; min-width: 0; max-width: 28px; height: 8px; border-radius: 99px; background: var(--line); border: 0; padding: 0; }
.strip .cell.done { background: var(--primary); }
.strip .cell.ok { background: var(--ok); }
.strip .cell.bad { background: var(--no); }
.strip .passmark { flex: none; width: 3px; align-self: stretch; margin: -3px 2px; border-radius: 2px; background: var(--maple); }

/* ---------- focus mode (questions, mock test): no brand header, no tab bar ---------- */
body.focus-mode .top, body.focus-mode .notice, body.focus-mode .tabs, body.focus-mode .preview { display: none; }
body.focus-mode main { padding-top: var(--s2); }
body.focus-mode .foot { padding-bottom: calc(var(--dockh) + var(--s5) + env(safe-area-inset-bottom)); }
.qtop { display: grid; grid-template-columns: var(--tap) 1fr var(--tap); align-items: center; gap: var(--s2); min-height: 64px; margin: 0 calc(-1 * var(--s2)); padding-top: env(safe-area-inset-top); }
.qtop.timed { grid-template-columns: var(--tap) 1fr auto; }
.qtop .qcount { margin: 0; text-align: center; font: 700 var(--t-s)/var(--lh-s) var(--sans); color: var(--ink); }
.ghost { display: grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: var(--r-ctl); color: var(--ink); background: none; border: 0; cursor: pointer; padding: 0; }
.ghost:hover { background: var(--primary-soft); }
.pbar { height: 8px; margin: 0 0 var(--s5); background: var(--primary-soft); border-radius: 99px; overflow: hidden; }
.pbar i { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 99px; }
.timer { display: inline-flex; align-items: center; gap: var(--s1); min-height: 40px; padding: 0 var(--s3); border: 2px solid var(--line-strong); border-radius: 99px; background: var(--surface);
  font: 600 var(--t-s)/var(--lh-s) var(--serif); font-variant-numeric: tabular-nums lining-nums; margin-right: var(--s2); }
.timer.low { color: var(--no); border-color: var(--no); }
.dock { position: fixed; z-index: 25; left: 0; right: 0; bottom: 0; padding: var(--s3) calc(var(--s4) + env(safe-area-inset-right)) calc(var(--s2) + env(safe-area-inset-bottom)) calc(var(--s4) + env(safe-area-inset-left));
  background: var(--surface); border-top: 1px solid var(--line); }
.dock > *, .dockrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.dockrow { display: flex; gap: var(--s3); }
.dockrow .btn2 { flex: 0 0 auto; min-height: 56px; }
.dockrow .btn { flex: 1 1 auto; width: auto; }
.docknote { margin: var(--s2) auto 0; text-align: center; color: var(--muted); font: 400 var(--t-xs)/20px var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.docknote b { color: var(--ink); }
.question { font: 600 var(--t-l)/var(--lh-l) var(--serif); margin: 0 0 var(--s4); }
.hint { margin: calc(-1 * var(--s1)) 0 var(--s4); color: var(--muted); font: 400 var(--t-s)/var(--lh-s) var(--sans); }
.options { display: grid; gap: var(--s3); }
.options.tf { grid-template-columns: 1fr 1fr; }
.opt { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 64px; padding: var(--s3) var(--s4) var(--s3) var(--s3); text-align: left; font: 400 var(--t-m)/var(--lh-m) var(--sans);
  color: var(--ink); background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-ctl); cursor: pointer; }
.opt:hover:not(:disabled) { border-color: var(--primary); }
.letter { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border: 2px solid var(--line-strong); border-radius: 6px; font: 700 var(--t-s)/1 var(--sans); color: var(--muted); }
.letter:empty { display: none; }
.ot { flex: 1; min-width: 0; }
.opt .tag { display: block; font: 700 var(--t-s)/var(--lh-s) var(--sans); }
.options.tf .opt { justify-content: center; font-weight: 700; padding-left: var(--s4); }
.options.tf .ot { flex: 0 1 auto; text-align: center; }
.opt.sel { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.opt.sel .letter { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.opt.ok { border-color: var(--ok); background: var(--ok-soft); }
.opt.ok .letter { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.opt.ok .tag { color: var(--ok); }
.opt.no { border-color: var(--no); background: var(--no-soft); }
.opt.no .letter { background: var(--no); border-color: var(--no); color: var(--surface); }
.opt.no .tag { color: var(--no); }
.opt.dim { color: var(--muted); }
.opt:disabled { cursor: default; }
.fb { margin-top: var(--s5); padding: var(--s4) var(--s4) var(--s1); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: var(--r-card); }
.fb.bad { border-left-color: var(--no); }
.fb h2 { display: flex; align-items: center; gap: var(--s2); margin: 0; font: 700 var(--t-m)/var(--lh-m) var(--sans); color: var(--ok); }
.fb.bad h2 { color: var(--no); }
.fb > p { margin: var(--s1) 0 0; }
.ref { margin: var(--s2) 0 0; }
.src { display: inline-block; padding: 14px 0; font: 700 var(--t-s)/var(--lh-s) var(--sans); color: var(--primary-text); }
.src .ext, .source .ext { display: inline-block; vertical-align: -4px; margin-left: var(--s1); }
.reflinks { margin: 0 0 var(--s2); font-size: var(--t-s); }
.reflinks a { display: inline-flex; align-items: center; min-height: 44px; }
.qmap { margin-top: var(--s6); }
.qmap .h-sec { margin-top: 0; }
/* question map in the mock test: 2 rows of 10 on phones (44px tall targets), one row of 20 on wide screens */
.qgrid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin: var(--s2) 0; }
.qgrid .cell { position: relative; min-height: 44px; border-radius: 8px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--muted); font: 700 13px/1 var(--sans); cursor: pointer; padding: 0; }
.qgrid .cell.done { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-text); }
.qgrid .cell.cur { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); color: var(--ink); }
.qgrid .cell.afterpass::before { content: ''; position: absolute; left: -4.5px; top: -2px; bottom: -2px; width: 3px; border-radius: 2px; background: var(--maple); }
@media (min-width: 700px) { .qgrid { grid-template-columns: repeat(20, 1fr); } }
.chip { color: var(--muted); }

/* bottom sheet (confirmations) */
.sheetwrap { position: fixed; inset: 0; z-index: 70; }
.scrim { position: absolute; inset: 0; background: rgba(19, 22, 31, .55); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; padding: var(--s5) var(--s4) calc(var(--s5) + env(safe-area-inset-bottom)); background: var(--surface);
  border-radius: 16px 16px 0 0; box-shadow: 0 -8px 32px rgba(0, 0, 0, .18); }
.sheet .grab { width: 40px; height: 4px; margin: calc(-1 * var(--s3)) auto var(--s4); border-radius: 99px; background: var(--line-strong); }
.sheet h2 { font: 600 var(--t-l)/var(--lh-l) var(--serif); margin: 0; }
.sheet p { margin: var(--s2) 0 0; color: var(--muted); }
.sheet .btn { margin-top: var(--s5); }

/* results and reviews */
.result { margin: 0; }
.result-k { color: var(--ok); }
.result-k.bad { color: var(--no); }
.result .score { margin-bottom: 0; }
.score { font-variant-numeric: lining-nums; }
.review { list-style: none; margin: var(--s3) 0; padding: 0; }
.review li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--s4) var(--s4) var(--s1); margin: var(--s3) 0; }
.rhead { display: flex; gap: var(--s3); align-items: flex-start; margin-bottom: var(--s2); }
.rq { font-weight: 700; margin: 0; }
.rmeta { color: var(--muted); font-size: var(--t-s); line-height: var(--lh-s); margin: 2px 0 0; }
.ra { color: var(--muted); font-size: var(--t-s); margin-bottom: var(--s1); }
.review li.bad .ra { color: var(--no); }
.rc { color: var(--ok); font-weight: 700; font-size: var(--t-s); margin-bottom: var(--s1); }
.rx { font-size: var(--t-s); line-height: 1.5; margin-bottom: 0; }
.bych { list-style: none; margin: var(--s3) 0; padding: 0; }
.bych li a { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: baseline; padding: 10px 2px; color: var(--ink); text-decoration: none; min-height: 48px; }
.bych li a:hover { background: var(--primary-soft); }
.bych .mbar { grid-column: 1 / -1; }
.bcs { color: var(--muted); font-size: var(--t-s); font-variant-numeric: tabular-nums; }
.note { margin-top: var(--s5); }
details.more { border-top: 1px solid var(--line); padding: 4px 0; margin: var(--s4) 0; }
details.more:last-of-type { border-bottom: 1px solid var(--line); }
details.more summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; font-weight: 700; color: var(--primary-text); }
.rules { padding-left: 20px; margin: var(--s3) 0; }
.rules li { margin: 6px 0; }
.confirm { background: var(--surface); border: 1.5px solid var(--maple-text); border-radius: var(--r-ctl); padding: 14px 16px 2px; margin: var(--s4) 0; }

/* study notes */
.links { list-style: none; margin: var(--s3) 0; padding: 0; }
.links li { padding: 2px 0; }
.links a { display: inline-flex; min-height: 44px; align-items: center; }
.ext { font-size: .85em; }
.source { color: var(--muted); font-size: var(--t-s); line-height: var(--lh-s); margin-top: var(--s5); }
.source a { display: inline-flex; align-items: center; min-height: 44px; }
.crumb { margin: 0 0 var(--s2); font-size: var(--t-s); }
.crumb a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; font-weight: 700; }
.toc { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: var(--s4) 0 var(--s5); }
.toc summary { display: flex; align-items: center; min-height: var(--tap); cursor: pointer; font-weight: 700; font-size: var(--t-s); color: var(--primary-text); list-style: none; }
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: ''; width: 8px; height: 8px; margin-left: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-3px); }
.toc[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.toc ul { list-style: none; margin: 0 0 10px; padding: 0; }
.toc a { display: flex; align-items: center; min-height: 44px; padding: 4px 0; font-size: var(--t-s); text-decoration: none; color: var(--ink); line-height: 1.3; }
.toc a:hover { color: var(--primary-text); text-decoration: underline; }
.notes section { padding: 6px 0 4px; scroll-margin-top: 88px; }
.notes h2 { font: 600 var(--t-l)/var(--lh-l) var(--serif); margin: var(--s5) 0 var(--s2); }
.notes p { max-width: 66ch; }
.localq { list-style: none; margin: var(--s4) 0; padding: 0; }
.localq li { border-top: 1px solid var(--line); padding: 12px 0 2px; }

/* flashcards */
.quizhead { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }
.quizhead .qof { color: var(--muted); font-size: var(--t-s); }
.flash { display: flex; flex-direction: column; justify-content: center; gap: var(--s4); width: 100%; min-height: 240px; margin: var(--s3) 0 6px; padding: var(--s5) 20px; text-align: left;
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: 16px; cursor: pointer; color: var(--ink); font: inherit; }
.flash .front { font: 600 var(--t-l)/var(--lh-l) var(--serif); }
.flash .back { font-size: var(--t-m); line-height: 1.5; padding-top: var(--s4); border-top: 1px solid var(--line); }
.flash .hint { margin: 0; }
.flash.flipped { border-color: var(--primary); cursor: default; }
.boxinfo { color: var(--muted); font-size: var(--t-s); }
textarea { width: 100%; font: 14px/1.4 ui-monospace, Menlo, Consolas, monospace; color: var(--ink); background: var(--surface); border: 2px solid var(--line-strong); border-radius: var(--r-ctl); padding: 10px; resize: vertical; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--tabh) + 16px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: var(--t-s); max-width: calc(100% - 32px); transition: opacity .2s, transform .2s; z-index: 80; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
body.focus-mode .toast { bottom: calc(var(--dockh) + 16px + env(safe-area-inset-bottom)); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } html { scroll-behavior: auto; } }

/* ---------- account: sign-in screen and forms (auth logic unchanged) ---------- */
.form { max-width: 480px; margin: var(--s2) 0 var(--s4); }
.form.inline { margin-top: var(--s4); }
.field { display: block; margin: 0 0 var(--s4); }
.field > span { display: block; font-weight: 700; margin: 0 0 var(--s2); }
.field input { width: 100%; min-height: 56px; padding: 0 var(--s4); font: 400 var(--t-m)/var(--lh-m) var(--sans); color: var(--ink); background: var(--surface); border: 2px solid var(--line-strong); border-radius: var(--r-ctl); }
.field input:focus-visible { border-color: var(--focus); }
.field input::placeholder { color: var(--muted); }
.form .hint { margin: calc(-1 * var(--s2)) 0 var(--s4); }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-size: var(--t-s); cursor: pointer; }
.check input { width: 24px; height: 24px; accent-color: var(--primary); margin: 0; }
.formerr:empty { display: none; }
.okmsg { background: var(--ok-soft); color: var(--ink); border-radius: var(--r-ctl); padding: 12px 14px; font-size: var(--t-s); line-height: var(--lh-s); }
.warn { background: var(--accent-soft); color: var(--ink); border-radius: var(--r-ctl); padding: 12px 14px; font-size: var(--t-s); line-height: var(--lh-s); }
.or { display: flex; align-items: center; gap: var(--s3); margin: var(--s5) 0; color: var(--muted); font: 400 var(--t-s)/var(--lh-s) var(--sans); }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.switch { font-size: var(--t-s); color: var(--muted); }
#syncLine { color: var(--muted); font-size: var(--t-s); }
.seg { display: flex; margin: var(--s4) 0; border: 2px solid var(--line-strong); border-radius: 12px; padding: 3px; background: var(--surface); }
.segbtn { flex: 1 1 0; min-height: 44px; padding: 0 10px; font: 700 var(--t-s)/1.2 var(--sans); color: var(--primary-text); background: transparent; border: 0; border-radius: 9px; cursor: pointer; }
.segbtn[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
/* Google's standard "Sign in with Google" button (branding guidelines, web): light theme #fff / 1px #747775 / text
 * #1f1f1f, dark theme #131314 / 1px #8e918f / text #e3e3e3; Roboto Medium 14px, 40px high, 12px side padding, 20px G
 * with 12px after it, 4px corners. Unaltered, at its own width; an invisible
 * strip above and below makes the tap target 46px. */
.gsi { position: relative; display: inline-flex; align-items: center; height: 40px; max-width: 400px; padding: 0 12px;
  background: #fff; border: 1px solid #747775; border-radius: 4px; color: #1f1f1f; font: 500 14px/20px 'Roboto', arial, sans-serif; letter-spacing: .25px;
  text-decoration: none; white-space: nowrap; cursor: pointer; transition: background-color .218s, border-color .218s, box-shadow .218s; }
.gsi::after { content: ''; position: absolute; left: 0; right: 0; top: -3px; bottom: -3px; }
.gsi-state { position: absolute; inset: 0; border-radius: 3px; background: #303030; opacity: 0; transition: opacity .218s; pointer-events: none; }
.gsi-icon { display: block; width: 20px; height: 20px; min-width: 20px; margin-right: 12px; }
.gsi-icon svg { display: block; width: 20px; height: 20px; }
.gsi-text { position: relative; overflow: hidden; text-overflow: ellipsis; }
.gsi:hover { box-shadow: 0 1px 2px 0 rgba(60, 64, 67, .30), 0 1px 3px 1px rgba(60, 64, 67, .15); }
.gsi:hover .gsi-state { opacity: .08; }
.gsi:active .gsi-state, .gsi:focus-visible .gsi-state { opacity: .12; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .gsi { background: #131314; border-color: #8e918f; color: #e3e3e3; } :root:not([data-theme="light"]) .gsi-state { background: #fff; } }
:root[data-theme="dark"] .gsi { background: #131314; border-color: #8e918f; color: #e3e3e3; }
:root[data-theme="dark"] .gsi-state { background: #fff; }
.actions.gsirow { margin: var(--s5) 0 0; }

/* account journey: suggestion cards, "another device" line, welcome line */
.panel.acctcard { background: var(--primary-soft); border-color: var(--primary); }
.panel.acctcard .muted { margin: var(--s1) 0 0; }
.panel.primary { border-top: 4px solid var(--primary); }
.panel .actions { margin: var(--s4) 0; }
.cardfoot { margin: 0; display: flex; gap: var(--s4); align-items: center; }
.cardfoot.split { justify-content: space-between; }
.cardfoot a { font: 700 var(--t-s)/1.2 var(--sans); color: var(--primary-text); min-height: 44px; display: inline-flex; align-items: center; }
.nudgeline { display: flex; align-items: center; gap: var(--s2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 4px 4px 4px 14px; font-size: var(--t-s); line-height: var(--lh-s); margin: var(--s4) 0; }
.nudgeline > span { flex: 1; }
.nudgeline a { font-weight: 700; }
.welcome { margin: 0; }
.welcome .kicker { color: var(--muted); }
.okline { font-weight: 700; color: var(--ok); font-size: var(--t-s); margin: 0; }
.actions.stack { max-width: 480px; }

/* landscape: brand illustration, end of page only */
.land { display: block; width: 100%; max-width: 560px; height: auto; margin: var(--s7) auto 0; color: var(--land); fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.land .fillbg { fill: var(--land-fill, var(--bg)); }
.card .land { --land-fill: var(--surface); }

/* ---------- footer: the same on every screen (legal links in both languages, About, FR descriptor) ---------- */
.foot { max-width: 560px; margin: 0 auto; padding: var(--s4) calc(var(--s4) + env(safe-area-inset-right)) calc(var(--tabh) + var(--s5) + env(safe-area-inset-bottom)) calc(var(--s4) + env(safe-area-inset-left));
  border-top: 1px solid var(--line); color: var(--muted); font: 400 var(--t-s)/var(--lh-s) var(--sans); }
.foot p { margin: 0; }
.foot .fdesc { margin-bottom: var(--s2); }
.flinks { display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--s5); }
.foot .lfi { white-space: nowrap; display: inline-flex; align-items: center; min-height: var(--tap); }
.foot a { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--primary-text); }
@media (min-width: 960px) {
  .foot { max-width: 1120px; padding: var(--s4) 32px var(--s7) calc(232px + 32px); border-top: 0; }
  .foot > p { max-width: 720px; }
  .foot > p:first-child { border-top: 1px solid var(--line); padding-top: var(--s3); }
  body.focus-mode .foot { padding-left: 32px; }
  body.focus-mode .shell { grid-template-columns: 1fr; }
  body.focus-mode main { margin: 0 auto; max-width: 640px; }
}

/* ---------- static legal pages (privacy, terms; EN and FR) ---------- */
.legalpage main.legal { max-width: 760px; margin: 0 auto; padding: var(--s5) calc(var(--s4) + env(safe-area-inset-right)) calc(var(--s7) + env(safe-area-inset-bottom)) calc(var(--s4) + env(safe-area-inset-left)); min-height: 0; }
.legal h1 { margin-bottom: 6px; }
.legal h2 { margin: var(--s5) 0 var(--s2); }
.legal ul, .legal ol { padding-left: 1.3em; margin: 0 0 12px; }
.legal li { margin-bottom: 6px; }
.legal code { font-size: 0.92em; background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 0 4px; }
.legal .tablewrap { overflow-x: auto; margin: 0 0 14px; }
.legal table { border-collapse: collapse; width: 100%; font-size: var(--t-s); background: var(--surface); overflow-wrap: anywhere; }
.legal th, .legal td { text-align: left; vertical-align: top; padding: 8px 10px; border: 1px solid var(--line); }
.legal th { font-weight: 700; }
.legal .legalnav { margin-top: var(--s6); padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--t-s); }
.legalpage .top { border-bottom: 1px solid var(--line); }
.legalpage .langbtn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0 var(--s4); border: 2px solid var(--line-strong); border-radius: var(--r-ctl);
  background: var(--surface); color: var(--ink); font: 700 var(--t-s)/var(--lh-s) var(--sans); text-decoration: none; white-space: nowrap; }
.legalbrand { font: 600 18px/1.2 var(--serif); }
.legaldesc { display: block; font: 400 13px/1.3 var(--sans); color: var(--muted); margin-top: 2px; }

/* very narrow phones (320 px): tighter spacing so today's Start button shows without scrolling (critique, 320x568) */
@media (max-width: 359px) {
  main { padding-top: var(--s3); }
  .title, main h1 { font-size: 23px; line-height: 28px; }
  .card.hero { margin-top: var(--s3); padding: var(--s3) var(--s3) var(--s3); }
  .card > .btn, .card > a.btn { margin-top: var(--s3); }
  .kicker { margin-bottom: var(--s1); }
  .card .cd { font-size: 17px; line-height: 24px; }
  .card.hero .safe { padding-right: 36px; }
  .wmark { width: 64px; height: 64px; right: -12px; top: -8px; }
