/* Wren — one stylesheet for every screen. Tokens from the brand board (design canvas · Brand).
   Apple-like restraint: near-white ground, ink, one blue. Body 17px, controls ≥ 44px on touch. */
:root {
  --bg: #fbfbfd; --card: #f5f5f7; --surface: #ffffff; --ink: #1d1d1f; --muted: #6e6e73; --line: #e5e5ea; --line2: #d2d2d7;
  --blue: #2455e6; --blue-soft: #eef2ff; --green: #1f8a4c; --green-soft: #e6f4ec; --red: #d6412b; --red-soft: #fdecea; --gold: #b7791f; --gold-soft: #fff4dc;
  --green-ink: #16703f; --red-ink: #b3261e; --gold-ink: #855400;   /* text on the soft fills: 4.5:1 or better (WCAG AA, 2026-11-14) */
  --r: 12px; --r2: 20px; --r3: 28px; --pad: 20px; --wrap: 980px;
  --font: 'Figtree', -apple-system, 'SF Pro Text', 'Helvetica Neue', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; line-height: 1.12; font-weight: 600; }
h1 { font-size: 34px; } h2 { font-size: 24px; } h3 { font-size: 19px; }
p { margin: 0; }
.muted { color: var(--muted); } .small { font-size: 14px; } .tiny { font-size: 12px; } .mono { font-variant-numeric: tabular-nums; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--pad); }
.stack { display: flex; flex-direction: column; } .stack-8 { gap: 8px; } .stack-12 { gap: 12px; } .stack-16 { gap: 16px; } .stack-24 { gap: 24px; } .stack-32 { gap: 32px; } .stack-48 { gap: 48px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; } .between { justify-content: space-between; } .grow { flex: 1; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } .grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 720px) { .grid2, .grid3 { grid-template-columns: 1fr; } h1 { font-size: 28px; } }

/* chrome */
.nav { height: 52px; background: rgba(251,251,253,.88); backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.nav .wrap { height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); font-size: 17px; }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 22px; font-size: 14px; }
.nav-links a { color: var(--ink); padding: 6px 0; border-bottom: 2px solid transparent; } .nav-links a:hover { text-decoration: none; }
.nav-links a[aria-current="page"] { border-bottom-color: var(--ink); }
@media (max-width: 720px) { .nav-links { gap: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; } .nav-links a { white-space: nowrap; } }
main { padding: 32px 0 80px; }
.foot { border-top: 1px solid var(--line); padding: 24px 0 40px; font-size: 12px; color: var(--muted); line-height: 1.6; }

/* surfaces */
.card { background: var(--card); border-radius: var(--r2); padding: 24px; }
.card-white { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r2); padding: 24px; }
.card-ink { background: var(--ink); color: #f5f5f7; border-radius: var(--r2); padding: 24px; } .card-ink .muted { color: #a1a1a6; }
.hero-card { border-radius: var(--r3); padding: 32px; }
.label { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.eyebrow { font-size: 14px; font-weight: 600; color: var(--blue); }
.hr { height: 1px; background: var(--line); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 980px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; line-height: 1.2; }
.chip-blue { background: var(--blue-soft); color: var(--blue); border-color: transparent; font-weight: 500; }
.chip-green { background: var(--green-soft); color: var(--green-ink); border-color: transparent; }
.chip-red { background: var(--red-soft); color: var(--red-ink); border-color: transparent; }
.chip-ink { background: var(--ink); color: #fff; border-color: transparent; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 980px; border: 1px solid transparent; background: var(--blue); color: #fff; font: inherit; font-size: 17px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; filter: brightness(.95); } .btn:disabled { opacity: .45; cursor: default; filter: none; }
.btn-ink { background: var(--ink); } .btn-ghost { background: transparent; color: var(--ink); border-color: var(--line2); } .btn-white { background: #fff; color: var(--ink); border-color: var(--line2); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; } .btn-lg { min-height: 56px; padding: 0 28px; font-size: 19px; }
.btn-danger { background: var(--red); }
input[type=text], input[type=email], input[type=date], input[type=number], select { font: inherit; font-size: 17px; min-height: 48px; padding: 0 14px; border: 1px solid var(--line2); border-radius: var(--r); background: #fff; color: var(--ink); width: 100%; }
select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5l3 3 3-3' stroke='%236e6e73' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; }
.field .muted { font-weight: 400; }

/* options (A–D) */
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line2); background: #fff; cursor: pointer; font-size: 16px; line-height: 1.4; text-align: left; font-family: inherit; color: var(--ink); width: 100%; min-height: 48px; }
.opt b { color: var(--muted); font-weight: 600; min-width: 16px; }
.opt.sel { border: 2px solid var(--blue); background: var(--blue-soft); padding: 11px 13px; } .opt.sel b { color: var(--blue); }
.opt.right { border: 2px solid var(--green); background: var(--green-soft); padding: 11px 13px; } .opt.right b { color: var(--green); }
.opt.wrong { border: 2px solid var(--red); background: var(--red-soft); padding: 11px 13px; } .opt.wrong b { color: var(--red); }
.opt[disabled] { cursor: default; }

/* passages */
.passage { background: #fff; border: 1px solid var(--line); border-radius: var(--r2); padding: 24px 28px; font-size: 16px; line-height: 1.7; }
.passage p { margin: 0 0 1em; } .passage p:last-child { margin: 0; } .passage .poem { white-space: pre-line; }
.passage .ex-title { font-weight: 600; margin-top: 1em; }
.gap { display: inline-block; min-width: 3.2em; padding: 0 6px; border-bottom: 2px solid var(--line2); text-align: center; color: var(--muted); font-size: 14px; }
.gap.filled { color: var(--ink); border-bottom-color: var(--blue); font-size: inherit; }
.gap.cur { border-bottom-color: var(--blue); background: var(--blue-soft); }
.dd { display: inline-block; font: inherit; font-size: 15px; min-height: 34px; padding: 2px 30px 2px 10px; border: 1px solid var(--blue); border-radius: 8px; width: auto; background-color: #fff; }

/* rationale */
.why { background: #fff; border: 1px solid var(--line); border-radius: var(--r2); padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; line-height: 1.6; }
.why .ev { font-style: italic; color: var(--muted); } .why .rule { border-top: 1px solid var(--line); padding-top: 10px; }
.why .wrongline { color: var(--muted); }

/* bars */
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--green); }
.bar > i.low { background: var(--red); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 96px; } .bars > i { flex: 1; background: var(--line2); border-radius: 6px 6px 2px 2px; min-height: 3px; } .bars > i.now { background: var(--blue); }

/* steps */
.steps { display: flex; gap: 6px; } .steps a, .steps span { flex: 1; text-align: center; padding: 10px 4px; border-radius: 10px; background: var(--card); font-size: 13px; color: var(--muted); }
.steps .on { background: var(--ink); color: #fff; } .steps .done { color: var(--green); }
.steps a:hover { text-decoration: none; }

/* scale board */
.slots { display: flex; flex-direction: column; gap: 8px; }
.slot { display: flex; align-items: center; gap: 12px; } .slot .n { width: 20px; font-size: 13px; color: var(--muted); }
.slot .box { flex: 1; min-height: 48px; border-radius: var(--r); background: #fff; border: 2px dashed var(--line2); display: flex; align-items: center; padding: 0 14px; font-size: 17px; cursor: pointer; }
.slot .box.has { border-style: solid; border-color: var(--line2); } .slot .box.ok { border-color: var(--green); background: var(--green-soft); } .slot .box.bad { border-color: var(--red); background: var(--red-soft); }
.pool { display: flex; flex-wrap: wrap; gap: 8px; } .pool button { font: inherit; font-size: 16px; min-height: 44px; padding: 0 16px; border-radius: 980px; border: 1px solid var(--line2); background: #fff; cursor: pointer; }
.pool button.picked { background: var(--ink); color: #fff; border-color: var(--ink); }

/* words */
.word { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.word .hw { font-size: 19px; font-weight: 600; } .word .pos { color: var(--muted); font-size: 14px; margin-left: 6px; } .word .ipa { color: var(--muted); font-size: 14px; }
.word .en { margin-top: 2px; } .word .ex { color: var(--muted); font-size: 15px; margin-top: 4px; }
.star { min-width: 44px; min-height: 44px; border-radius: 12px; border: 1px solid var(--line2); background: #fff; cursor: pointer; font: inherit; font-size: 13px; color: var(--muted); padding: 0 10px; }
.star.on { background: var(--gold-soft); border-color: var(--gold); color: var(--gold); }
.speak { min-width: 40px; min-height: 40px; border-radius: 10px; border: 1px solid var(--line2); background: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }

/* test runner */
.runner { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--r2); overflow: hidden; background: #fff; min-height: 60vh; }
.runner .left { border-right: 1px solid var(--line); padding: 24px 28px; overflow: auto; max-height: 72vh; font-size: 16px; line-height: 1.7; }
.runner .right { padding: 24px 28px; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 860px) { .runner { grid-template-columns: 1fr; } .runner .left { border-right: 0; border-bottom: 1px solid var(--line); max-height: 44vh; } }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; flex-wrap: wrap; }
.timer { font-weight: 600; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 8px; } .timer.warn { color: var(--red); }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.qgrid button { min-height: 40px; border-radius: 8px; border: 1px solid var(--line2); background: #fff; font: inherit; font-size: 13px; cursor: pointer; }
.qgrid button.done { background: var(--card); } .qgrid button.flag { border-color: var(--gold); background: var(--gold-soft); } .qgrid button.cur { border: 2px solid var(--blue); }
.qgrid button.right { background: var(--green-soft); border-color: var(--green); } .qgrid button.wrong { background: var(--red-soft); border-color: var(--red); }

.score { font-size: 64px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; } .score small { font-size: 22px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; } .week i { display: block; height: 10px; border-radius: 5px; background: var(--line2); } .week i.on { background: var(--ink); } .week i.today { outline: 2px solid var(--blue); outline-offset: 2px; }
.week small { display: block; text-align: center; color: var(--muted); font-size: 11px; margin-top: 4px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.notice { background: var(--gold-soft); border-radius: var(--r); padding: 12px 14px; font-size: 14px; }
details summary { cursor: pointer; }
.sr { position: absolute; left: -9999px; }
/* "Report this question" (docs/13 stage 0) */
.linkish { background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; font: inherit; color: inherit; }
.report { padding: 10px 12px; border-radius: 12px; background: var(--card); }
.report select, .report textarea { width: 100%; font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid #d2d2d7; }
.draft-banner { background: #fff4ce; color: #5c4400; padding: 12px 16px; border-radius: 12px; font-size: 14px; }
/* "More" in the menu (2026-11-14) */
.nav-more { position: relative; font-size: 14px; }
.nav-more summary { list-style: none; cursor: pointer; padding: 6px 0; white-space: nowrap; border-bottom: 2px solid transparent; color: var(--ink); }
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more summary::after { content: " ▾"; font-size: 11px; color: var(--muted); }
.nav-more[data-current] summary { border-bottom-color: var(--ink); }
.nav-menu { position: absolute; right: 0; top: 34px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.08); padding: 6px; display: flex; flex-direction: column; min-width: 160px; z-index: 30; }
.nav-menu a { padding: 8px 12px !important; border-radius: 8px; border-bottom: 0 !important; white-space: nowrap; }
.nav-menu a:hover { background: var(--card); }
.nav-menu a[aria-current="page"] { font-weight: 600; }
@media (max-width: 720px) { .nav-links { overflow: visible; } .nav-menu { position: fixed; right: 12px; top: 52px; } }
/* the question-type map and the celebration (2026-11-14) */
.tmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tmap .t { border-radius: 12px; padding: 10px 12px; font-size: 13px; line-height: 1.3; background: var(--card); color: var(--muted); border: 1px solid transparent; }
.tmap .t b { display: block; font-size: 12px; font-weight: 600; margin-top: 4px; }
.tmap .t.learned { background: var(--green-soft); color: var(--green-ink); border-color: #bfe3cc; }
.tmap .t.checking, .tmap .t.practising { background: var(--blue-soft); color: var(--blue); border-color: #cdd8fb; }
.tmap .t.review { background: var(--gold-soft); color: var(--gold-ink); border-color: #f1d9a6; }
.tmap .t.waiting, .tmap .t.provisional, .tmap .t.watch { background: var(--surface); color: var(--ink); border-color: var(--line2); }
.tmap .dots i { display: inline-block; width: 7px; height: 7px; border-radius: 4px; background: currentColor; opacity: .25; margin-right: 3px; }
.tmap .dots i.on { opacity: 1; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { border-radius: 999px; padding: 6px 12px; font-size: 13px; background: var(--card); color: var(--muted); }
.badge.on { background: var(--gold-soft); color: #7a4e00; font-weight: 600; }
.celebrate { position: fixed; inset: 0; background: rgba(17,17,17,.55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; animation: cfade .2s ease-out; }
.celebrate .box { background: var(--surface); border-radius: 22px; padding: 28px 24px; max-width: 360px; width: 100%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.25); animation: cpop .35s cubic-bezier(.2,1.4,.4,1); }
.celebrate .big { font-size: 56px; line-height: 1; }
@keyframes cfade { from { opacity: 0 } to { opacity: 1 } }
@keyframes cpop { from { transform: scale(.8); opacity: 0 } to { transform: scale(1); opacity: 1 } }
@media (prefers-reduced-motion: reduce) { .celebrate, .celebrate .box { animation: none; } }
/* links inside running text are underlined, so they do not rely on colour alone (WCAG 1.4.1, 2026-11-14) */
:where(p, li, td, .small, .tiny, .muted, .foot, .why, .rule) a:not(.btn) { text-decoration: underline; text-underline-offset: 2px; }

