/* Large type, WCAG AA contrast (every text/background pair >= 4.5:1), 48px touch targets, no web fonts. */
:root {
  --bg: #fdfcf9; --fg: #1a1a1a; --muted: #4a4f57; --card: #ffffff; --line: #c9ccd1;
  --primary: #1d3557; --on-primary: #ffffff; --accent: #8a3b12; --ok: #1e6b35; --warn: #7a4b00; --err: #a4161a;
  --source: #eef0f3; --ins: #d6f0dc; --del: #f8d7da; --focus: #b35c00;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111418; --fg: #f1f1f1; --muted: #b9bec6; --card: #1b2026; --line: #3a414a;
    --primary: #9cc3ff; --on-primary: #0b1220; --accent: #ffb38a; --ok: #7fd69a; --warn: #ffd27a; --err: #ff9a9e;
    --source: #232a32; --ins: #1f4a2c; --del: #5a2228; --focus: #ffb35c;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 20px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#app { max-width: 42rem; margin: 0 auto; padding: 0 16px 96px; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 20px 0 12px; }
h2 { font-size: 1.25rem; margin: 16px 0 8px; }
p { margin: 8px 0; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 0; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.lang, .pill { min-height: 44px; border-radius: 22px; border: 2px solid var(--line); background: var(--card); color: var(--fg); font: inherit; font-size: 0.85rem; padding: 4px 12px; cursor: pointer; }
.pill .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.pill[data-state="online"] .dot { background: var(--ok); }
.pill[data-state="syncing"] .dot { background: var(--primary); }
.pill[data-state="attention"] { border-color: var(--warn); }
.pill[data-state="attention"] .dot { background: var(--warn); }
.banner { margin: 12px 0; padding: 12px; border: 2px solid var(--warn); border-radius: 8px; }
.btn-wrap { margin: 12px 0; }
.btn { display: inline-block; width: 100%; min-height: 52px; padding: 12px 16px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; text-align: center; text-decoration: none; }
.btn.primary { background: var(--primary); color: var(--on-primary); border: 2px solid var(--primary); }
.btn.secondary { background: var(--card); color: var(--primary); border: 2px solid var(--primary); }
.btn.link { background: none; border: none; color: var(--primary); text-decoration: underline; width: auto; padding: 8px 0; min-height: 44px; }
.btn[disabled] { opacity: 1; background: var(--card); color: var(--muted); border: 2px dashed var(--line); cursor: not-allowed; }
.why { color: var(--muted); font-size: 0.9rem; margin: 4px 0 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 10rem; }
.stack > * + * { margin-top: 8px; }
.field { margin: 12px 0; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
input, textarea, select { width: 100%; font: inherit; color: var(--fg); background: var(--card); border: 2px solid var(--line); border-radius: 8px; padding: 10px 12px; }
textarea { min-height: 7rem; }
.code-input { font-size: 1.8rem; letter-spacing: 0.25em; text-transform: uppercase; text-align: center; font-family: ui-monospace, monospace; }
.lead { font-size: 1.15rem; }
.meta, small.alt, .alt { color: var(--muted); font-size: 0.9rem; }
.tag { display: inline-block; border: 1px solid var(--accent); color: var(--accent); border-radius: 6px; padding: 0 8px; font-size: 0.85rem; }
.error { color: var(--err); font-weight: 600; }
.warn { color: var(--warn); font-weight: 600; }
.source { background: var(--source); border-radius: 10px; padding: 14px; }
.reader { font-size: 1.25rem; line-height: 1.7; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 12px 0; }
.facts, .tasks, .qlist, .notice, .diff-list { padding-left: 1.2rem; }
.facts li, .tasks li { margin: 8px 0; }
.notice { border-left: 4px solid var(--primary); padding: 8px 8px 8px 1.6rem; }
.choice { border-top: 1px solid var(--line); padding-top: 8px; }
ins { background: var(--ins); text-decoration: underline; color: inherit; }
del { background: var(--del); color: inherit; }
u.term { text-decoration-thickness: 2px; text-underline-offset: 3px; }
.sheet { width: min(40rem, 100%); max-height: 85vh; border: none; border-radius: 16px 16px 0 0; margin: auto auto 0; background: var(--card); color: var(--fg); padding: 16px; }
.sheet::backdrop { background: rgb(0 0 0 / 0.45); }
#toast { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 40rem; margin: 0 auto; padding: 12px 16px; border-radius: 10px; background: var(--fg); color: var(--bg); z-index: 3; }
.code { color: var(--muted); font-size: 0.8rem; }
@media (prefers-reduced-motion: no-preference) { .pill[data-state="syncing"] .dot { animation: pulse 1.2s ease-in-out infinite; } }
@keyframes pulse { 50% { opacity: 0.35; } }

/* Workbench: touch targets of at least 48px, no information by colour alone, native disclosure widgets. */
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; z-index: 4; min-height: 48px; padding: 8px 16px; background: var(--primary); color: var(--on-primary); border: 0; border-radius: 0 0 10px 10px; font: inherit; }
.skip:focus { left: 16px; }
.tap { display: inline-flex; align-items: center; min-height: 48px; padding: 4px 0; }
.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn.small { min-height: 48px; width: auto; padding: 8px 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip { min-width: 48px; min-height: 48px; padding: 6px 10px; border-radius: 10px; border: 2px solid var(--primary); background: var(--card); color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; }
.chip.wide { padding: 6px 14px; }
.chip[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.tool { border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; margin: 12px 0; background: var(--card); }
.tool > summary { min-height: 48px; display: flex; align-items: center; font-weight: 600; cursor: pointer; }
.tool[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.terms, .revs, .seglist, .qa { list-style: none; padding: 0; margin: 8px 0; }
.terms li { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.revs li { border-bottom: 1px solid var(--line); padding: 8px 0; }
.seglist li { margin: 8px 0; }
.seg-row { display: block; min-height: 56px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--fg); text-decoration: none; }
.seg-row:hover { border-color: var(--primary); }
.badge { display: inline-block; border: 1px solid currentColor; border-radius: 6px; padding: 0 8px; font-size: 0.85rem; }
.badge.empty { color: var(--muted); }
.badge.pending { color: var(--warn); }
.badge.conflict { color: var(--err); }
.badge.done { color: var(--ok); }
.state-line { min-height: 1.6em; }
progress { width: 100%; height: 14px; accent-color: var(--primary); }
.tag { margin-left: 6px; }
.gloss dt { margin-top: 10px; }
.block { display: block; color: var(--fg); text-decoration: none; }
/* Visual stories (P-S02, P-R05) */
.story-card svg { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; }
.story-fig figcaption { margin-top: 8px; }
.story-text { font-size: 1.1rem; }
ul.plain { list-style: none; padding: 0; }
.check-item { display: flex; gap: 12px; align-items: flex-start; margin: 12px 0; }
.check-item input { flex: none; width: 28px; height: 28px; margin-top: 2px; }
.check-item label { font-weight: 400; }
