/* One reading column, a sticky progress bar, and cards for each line the visitor marks. */
:root {
  --bg: #f4f7f6; --surface: #ffffff; --ink: #14221e; --muted: #5a6a64; --line: #d4dedb;
  --teal: #0e7c6b; --teal-ink: #ffffff; --teal-soft: #dcf0ec;
  --ok: #1d7a3e; --ok-soft: #dff1e5;
  --no: #a23b2a; --no-soft: #f8e1dc;
  --skip: #55616b; --skip-soft: #e6eaed;
  --gold: #8a6a14; --gold-soft: #f6ecd0;
  --d-box: #ffffff; --d-line: #14221e; --d-strong: #dcf0ec; --d-faint: #7a8a84;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1a17; --surface: #16251f; --ink: #e6f0ec; --muted: #9bb0a8; --line: #2a3d36;
    --teal: #3cb8a2; --teal-ink: #08201b; --teal-soft: #1b3a33;
    --ok: #6fd08f; --ok-soft: #1a3a27; --no: #f0937f; --no-soft: #402019; --skip: #aab7bf; --skip-soft: #26323a;
    --gold: #e0be63; --gold-soft: #3a3115;
    --d-box: #16251f; --d-line: #e6f0ec; --d-strong: #1b3a33; --d-faint: #8aa097;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.55; }
.wrap { max-width: 760px; margin-inline: auto; padding: 0 16px 120px; }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.3rem); font-weight: 700; letter-spacing: -0.015em; }
h2 { font-size: 1.45rem; font-weight: 650; }
h3 { font-size: 1.12rem; font-weight: 650; }
p { margin: 0 0 12px; max-width: 66ch; }
.kicker { font-family: var(--mono); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--teal); margin: 0 0 10px; }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

/* top bar */
.bar { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); }
.bar-in { max-width: 1000px; margin-inline: auto; padding: 8px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.bar-title { font-weight: 650; font-size: .95rem; }
#nav { display: flex; gap: 6px; flex-wrap: wrap; flex: 1 1 auto; }
#nav a { font-size: .8rem; color: var(--muted); text-decoration: none; padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
#nav a:hover { color: var(--teal); border-color: var(--teal); }
.bar-count { font-family: var(--mono); font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.meter { flex: 1 0 100%; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--teal); transition: width .25s; }

/* intro */
.hero { padding-block: 44px 8px; }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-block: 22px; padding: 0; list-style: none; counter-reset: s; }
.how li { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; font-size: .95rem; counter-increment: s; }
.how li::before { content: counter(s); display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; margin-right: 8px; border-radius: 50%; background: var(--teal); color: var(--teal-ink); font-weight: 700; font-size: .85rem; }
.how b { display: block; margin-bottom: 2px; }
.notes { margin: 0 0 8px; padding-left: 1.2em; color: var(--muted); font-size: .95rem; }
.notes li { margin-bottom: 4px; }

/* sections */
section.part { margin-top: 56px; scroll-margin-top: 90px; }
section.part > .lead { color: var(--muted); }
.about { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-top: 16px; }
.about .wide { grid-column: 1 / -1; }
label.f { display: grid; gap: 4px; font-size: .88rem; color: var(--muted); min-width: 0; }
input[type="text"], textarea { font: inherit; font-size: 1rem; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 9px 11px; width: 100%; min-width: 0; }
textarea { min-height: 76px; resize: vertical; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: .9rem; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; background: var(--bg); cursor: pointer; min-height: 38px; }
.check input { accent-color: var(--teal); width: 16px; height: 16px; }
.check:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }

.stage { margin-top: 30px; }
.stage > h3 { padding-bottom: 8px; border-bottom: 2px solid var(--teal); display: inline-block; }
.line { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-top: 12px; }
.line.done { border-left: 4px solid var(--teal); }
.line p.q { margin-bottom: 10px; }
.marks { display: flex; gap: 8px; flex-wrap: wrap; }
button.mark { font: inherit; font-size: .95rem; font-weight: 600; border: 2px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 8px; padding: 9px 16px; min-height: 44px; cursor: pointer; }
button.mark:hover { border-color: var(--teal); }
button.mark.right[aria-pressed="true"] { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
button.mark.wrong[aria-pressed="true"] { background: var(--no-soft); border-color: var(--no); color: var(--no); }
button.mark.skip[aria-pressed="true"] { background: var(--skip-soft); border-color: var(--skip); color: var(--skip); }
.say { margin-top: 10px; }
.say[hidden] { display: none; }
.missing { margin-top: 14px; background: var(--gold-soft); border: 1px dashed var(--gold); border-radius: 8px; padding: 12px 14px; }
.missing label { color: var(--ink); font-weight: 600; }

/* diagrams */
.pic { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-top: 18px; }
.pic svg { width: 100%; height: auto; display: block; margin-block: 8px; }
.pic .caption { color: var(--muted); font-size: .95rem; margin: 0; }
.pic .box rect { fill: var(--d-box); stroke: var(--d-line); stroke-width: 1.5; }
.pic .box.strong rect { fill: var(--d-strong); stroke-width: 2.2; }
.pic .box.dashed rect { stroke-dasharray: 5 4; }
.pic text { fill: var(--d-line); font-family: var(--font); text-anchor: middle; }
.pic .t1 { font-size: 14px; font-weight: 650; }
.pic .t2 { font-size: 11.5px; fill: var(--muted); }
.pic .lb { font-size: 11.5px; fill: var(--muted); }
.pic .lb.faint { fill: var(--d-faint); font-style: italic; }
.pic .ln { stroke: var(--d-line); stroke-width: 1.6; fill: none; }
.pic .ln.dash { stroke-dasharray: 5 4; }
.pic .ah { fill: var(--d-line); }
.choice { margin-top: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.choice legend { font-weight: 650; padding: 0; margin-bottom: 8px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.opts { display: flex; gap: 8px; flex-wrap: wrap; }
.opt { display: inline-flex; gap: 8px; align-items: center; border: 2px solid var(--line); border-radius: 8px; padding: 8px 14px; min-height: 44px; cursor: pointer; background: var(--bg); font-weight: 600; }
.opt input { accent-color: var(--teal); width: 18px; height: 18px; }
.opt:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.qcard { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-top: 12px; }
.qcard .skipline { margin-top: 8px; font-size: .88rem; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.qcard .skipline input { accent-color: var(--teal); width: 16px; height: 16px; }
.add { border: 1px dashed var(--teal); border-radius: 8px; padding: 14px 16px; margin-top: 12px; display: grid; gap: 10px; background: var(--surface); }
.btn { font: inherit; font-weight: 650; border: 2px solid var(--teal); background: var(--teal); color: var(--teal-ink); border-radius: 8px; padding: 10px 18px; min-height: 46px; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--teal); }
.btn.small { min-height: 36px; padding: 5px 12px; font-size: .9rem; }
.btn.plain { border-color: var(--line); background: transparent; color: var(--muted); font-weight: 500; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.send { margin-top: 56px; background: var(--surface); border: 2px solid var(--teal); border-radius: 10px; padding: 20px; }
.send .row { display: flex; gap: 10px; flex-wrap: wrap; margin-block: 14px; }
.stat { font-family: var(--mono); font-size: .88rem; color: var(--muted); }
pre.preview { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 12px; max-height: 320px; overflow: auto; font-size: .78rem; white-space: pre-wrap; word-break: break-word; }
.test-banner { background: var(--gold-soft); border-left: 4px solid var(--gold); padding: 8px 14px; border-radius: 0 6px 6px 0; font-size: .9rem; margin-top: 14px; }
@media (max-width: 520px) { button.mark { flex: 1 1 30%; padding-inline: 8px; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .meter i { transition: none; } }

/* ---- step-by-step frame ---- */
.top { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.top-in { max-width: 760px; margin-inline: auto; padding: 8px 16px; display: flex; gap: 10px; align-items: center; }
.top-title { font-weight: 650; font-size: .95rem; white-space: nowrap; }
.top-step { font-family: var(--mono); font-size: .78rem; color: var(--muted); white-space: nowrap; margin-left: auto; }
#jump { font: inherit; font-size: .85rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; min-width: 0; flex: 1 1 auto; max-width: 320px; text-overflow: ellipsis; }
.top .meter { height: 4px; border-radius: 0; }
.wrap { padding-top: 26px; padding-bottom: 150px; }
.stephead { margin-bottom: 18px; }
.stephead h1 { font-size: clamp(1.5rem, 5vw, 2rem); }
.stephead .lead { margin-top: 10px; color: var(--muted); }
.stepbody > .lead { font-size: 1.05rem; }
h2.sub { margin: 28px 0 0; }
.skiprow { margin-top: 18px; }
.linkbtn { font: inherit; font-size: .9rem; color: var(--teal); background: none; border: 0; padding: 8px 6px; min-height: 40px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn:disabled { opacity: .6; }
label.f.bigl { color: var(--ink); font-size: 1rem; }
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--bg); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.dock-in { max-width: 760px; margin-inline: auto; padding: 10px 16px; display: flex; gap: 12px; align-items: center; }
.dock-mid { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; min-width: 0; text-align: center; }
.dock-stat { font-family: var(--mono); font-size: .72rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
#next, #back { min-width: 96px; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); z-index: 20; max-width: 560px; margin-inline: auto; background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 8px; font-size: .95rem; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast[hidden] { display: none; }
@media (max-width: 560px) {
  body { font-size: 16px; }
  .top-title { display: none; }
  .dock-in { gap: 8px; padding-inline: 12px; }
  #next, #back { min-width: 84px; padding-inline: 14px; }
  .linkbtn { font-size: .82rem; }
  .dock-stat #saved { display: none; }
}

.formerr { color: var(--no); font-weight: 600; margin: 0; }
.formerr[hidden] { display: none; }
input[type="email"] { font: inherit; font-size: 1rem; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 9px 11px; width: 100%; min-width: 0; }
@media (min-width: 561px) { .top-title { max-width: 18em; overflow: hidden; text-overflow: ellipsis; } }

/* ---- left navigation (desktop) and slide-out contents (phone) ---- */
.shell { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); padding: 18px 14px 24px; display: flex; flex-direction: column; gap: 14px; z-index: 30; }
.side-head { display: flex; align-items: flex-start; gap: 8px; justify-content: space-between; }
.side-title { font-weight: 700; font-size: 1rem; line-height: 1.25; }
.side-close { display: none; font: inherit; font-size: .85rem; color: var(--teal); background: none; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; cursor: pointer; min-height: 36px; }
.side-foot { margin: auto 0 0; font-size: .8rem; color: var(--muted); line-height: 1.4; }
#nav { display: flex; flex-direction: column; gap: 14px; }
.nv { font: inherit; font-size: .9rem; text-align: left; color: var(--ink); background: none; border: 0; border-radius: 6px; padding: 8px 10px; cursor: pointer; display: flex; gap: 8px; align-items: flex-start; width: 100%; min-height: 40px; line-height: 1.3; }
.nv:hover { background: var(--teal-soft); }
.nv.top { font-weight: 600; }
.nv.on { background: var(--teal-soft); box-shadow: inset 3px 0 0 var(--teal); font-weight: 600; }
.nv .tick { flex: 0 0 1.2em; width: 1.2em; height: 1.2em; border: 1.5px solid var(--line); border-radius: 50%; display: inline-grid; place-items: center; font-size: .7rem; line-height: 1; margin-top: .1em; color: var(--teal-ink); }
.nv.ok .tick { background: var(--teal); border-color: var(--teal); }
.grp { display: flex; flex-direction: column; gap: 2px; }
.grp-head { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; padding: 4px 10px 6px; }
.grp-title { font-weight: 700; font-size: .92rem; grid-column: 1 / -1; }
.grp-meta { font-size: .78rem; color: var(--muted); }
.pstatus { font-family: var(--mono); font-size: .72rem; justify-self: end; color: var(--muted); }
.pstatus.s-submitted { color: var(--ok); font-weight: 700; }
.pstatus.s-in-progress { color: var(--gold); font-weight: 700; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.main { min-width: 0; position: relative; }
.top { position: sticky; top: 0; z-index: 10; padding-top: env(safe-area-inset-top, 0px); }
.top-in { max-width: 760px; }
.menubtn { display: none; font: inherit; font-weight: 600; font-size: .9rem; color: var(--teal); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; min-height: 40px; cursor: pointer; }
.scrim { display: none; }
.dock { left: 300px; }
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-top: 12px; }
.partcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.partcard h3 { font-size: 1.1rem; }
.partcard p { margin: 0; }
.partcard .btn { margin-top: auto; align-self: flex-start; }
.partcard .pstatus { justify-self: start; margin-top: 6px; }
.small { font-size: .85rem; }
details.missing > summary, details.others > summary { cursor: pointer; font-weight: 600; color: var(--teal); min-height: 36px; display: flex; align-items: center; }
details.missing { margin-top: 14px; background: var(--gold-soft); border: 1px dashed var(--gold); border-radius: 8px; padding: 6px 14px 12px; }
details.others { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 8px; }
details.others[open] > summary { margin-bottom: 8px; }
body.landing .dock { display: none; }
body.landing .wrap { padding-bottom: 60px; }
.after { margin-top: 24px; border-top: 2px solid var(--teal); padding-top: 8px; }

@media (max-width: 900px) {
  .shell { display: block; }
  .side { position: fixed; top: 0; left: 0; bottom: 0; width: min(88vw, 340px); height: auto; transform: translateX(-102%); transition: transform .22s ease; box-shadow: 0 0 30px rgba(0,0,0,.35); padding-top: calc(18px + env(safe-area-inset-top, 0px)); }
  body.drawer .side { transform: translateX(0); }
  .side-close { display: inline-block; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 25; opacity: 0; pointer-events: none; transition: opacity .22s; }
  body.drawer .scrim { opacity: 1; pointer-events: auto; }
  .menubtn { display: inline-block; }
  .dock { left: 0; }
  .top-in { padding-inline: 12px; }
}
@media (prefers-reduced-motion: reduce) { .side, .scrim { transition: none; } }

/* ---- identity bar on part pages ---- */
.identbar { margin: 0 0 18px; padding: 10px 14px; border: 1px solid var(--gold); background: var(--gold-soft); border-radius: 8px; font-size: .92rem; }
.identbar.ok { border-color: var(--line); background: var(--surface); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: space-between; color: var(--muted); }
.identbar.flash { box-shadow: 0 0 0 3px var(--teal); }
.identhint { margin: 0 0 8px; }
.identrow { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.identrow input { font: inherit; font-size: 1rem; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 9px 11px; min-width: 0; width: 100%; }
