/* Groundtruth design system
   Palette inspired by evidence-first products: white paper, deep navy ink, slate text, one indigo accent,
   mint for "verified". Two themes from the same palette: Paper (light, default) and Navy (dark).
   Every text/background pair is checked for WCAG 2.2 AA (tools/contrast-check.py, tools/browser-qa.py). */
:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #FFFFFF; --glow: rgba(15, 23, 42, .035); --band: #0F172A; --on-band: #F1F5F9; --on-band-muted: #A9B6C9;
  --panel: #FFFFFF; --panel2: #F8FAFC; --sunk: #F8FAFC;
  --line: #E2E8F0; --line2: #CBD5E1; --hover: #F1F5F9;
  --text: #0F172A; --muted: #475569; --faint: #5B6B80;
  --brand: #4338CA; --brand-fill: #0F172A; --brand-fill-hover: #1E293B; --on-brand: #FFFFFF;
  --brand-soft: rgba(67, 56, 202, .07); --brand-line: rgba(67, 56, 202, .40);
  --ok: #047857; --ok-bg: #ECFDF5; --ok-line: #A7F3D0; --ok-solid: #047857; --on-ok: #FFFFFF; --mint: #10B981;
  --bad: #B91C1C; --bad-bg: #FEF2F2; --bad-line: #FECACA;
  --warn: #92400E; --warn-bg: #FFFBEB; --warn-line: #FCD34D; --warn-solid: #F59E0B; --on-warn: #1C1305;
  --info: #1D4ED8; --info-line: #BFDBFE;
  --neutral: #475569; --neutral-bg: #F1F5F9; --neutral-line: #CBD5E1;
  --accent-grad: linear-gradient(100deg, #1E293B, #64748B);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px -20px rgba(15, 23, 42, .18);
  --backdrop: rgba(15, 23, 42, .45);
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B1120; --glow: rgba(165, 180, 252, .06); --band: #111A2E; --on-band: #F1F5F9; --on-band-muted: #A9B6C9;
  --panel: #111A2E; --panel2: #162036; --sunk: #0E1628;
  --line: #1E293B; --line2: #334155; --hover: #1A2540;
  --text: #F1F5F9; --muted: #B4C0D1; --faint: #94A3B8;
  --brand: #A5B4FC; --brand-fill: #F1F5F9; --brand-fill-hover: #FFFFFF; --on-brand: #0F172A;
  --brand-soft: rgba(165, 180, 252, .12); --brand-line: rgba(165, 180, 252, .45);
  --ok: #6EE7B7; --ok-bg: rgba(110, 231, 183, .10); --ok-line: rgba(110, 231, 183, .38); --ok-solid: #34D399; --on-ok: #052E1C; --mint: #34D399;
  --bad: #FCA5A5; --bad-bg: rgba(252, 165, 165, .10); --bad-line: rgba(252, 165, 165, .40);
  --warn: #FCD34D; --warn-bg: rgba(252, 211, 77, .08); --warn-line: rgba(252, 211, 77, .36); --warn-solid: #FBBF24; --on-warn: #1C1305;
  --info: #93C5FD; --info-line: rgba(147, 197, 253, .40);
  --neutral: #CBD5E1; --neutral-bg: rgba(203, 213, 225, .08); --neutral-line: rgba(203, 213, 225, .36);
  --accent-grad: linear-gradient(100deg, #E2E8F0, #94A3B8);
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 16px 40px -24px rgba(0, 0, 0, .7);
  --backdrop: rgba(2, 6, 23, .7);
}
:root {
  --r: 20px; --r-sm: 12px;
  --display: "Archivo", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --paper: #FFFFFF; --paper-text: #1E293B; --paper-h2: #3730A3; --paper-faint: #475569; --paper-line: #E2E8F0;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; overflow-x: clip; background: var(--bg); color: var(--text);
  font: 15px/1.6 var(--sans); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  background-image: radial-gradient(1000px 440px at 50% -200px, var(--glow), transparent 70%);
  background-repeat: no-repeat;
}
h1, h2, h3, h4 { margin: 0; letter-spacing: -.022em; text-wrap: balance; }
.display, .head h1, .hero h1, .card h2, .feat h3, .dlg-head h2, .brand strong, .big, .tile b, .timebox big { font-family: var(--display); font-stretch: 125%; font-variation-settings: 'wdth' 125; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--brand); text-underline-offset: 2px; }
code { font: 12.5px var(--mono); background: var(--panel2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { max-width: 100%; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 8px; }
.skip:focus { left: 12px; background: var(--brand-fill); color: var(--on-brand); padding: 10px 14px; border-radius: 10px; z-index: 99; text-decoration: none; }
.wrapw { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
@media (min-width: 700px) { .wrapw { padding-left: 32px; padding-right: 32px; } }

/* ---------- header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; padding-bottom: 16px; }
.brand { display: flex; gap: 11px; align-items: center; color: var(--text); text-decoration: none; border-radius: 10px; }
.mark { width: 32px; height: 32px; border-radius: 10px; background: #0F172A; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); display: grid; place-items: center; flex: none; }
.brand strong { display: block; font-size: 16px; letter-spacing: -.02em; line-height: 1.15; }
.brand-txt { display: block; }
.brand .tagline { display: block; font-size: 12px; color: var(--faint); }
.tools { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); white-space: nowrap; }
.chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--neutral); }
.chip.live i { background: var(--ok-solid); } .chip.sandbox i { background: var(--warn-solid); }
.iconbtn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.iconbtn:hover { background: var(--hover); color: var(--text); }
.iconbtn svg { width: 17px; height: 17px; }
.show-sm { display: none !important; }
@media (max-width: 640px) { .chip { display: none; } .brand .tagline { display: none; } .hide-sm { display: none !important; } .show-sm { display: grid !important; } }

/* ---------- stepper ---------- */
.stepper { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 5px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); box-shadow: var(--shadow); }
.step { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: 999px; border: 0; background: transparent; color: var(--faint); font-size: 13px; text-align: left; min-width: 0; cursor: default; }
.step span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step b { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line2); font-size: 11.5px; font-weight: 600; }
.step.go { cursor: pointer; color: var(--muted); } .step.go:hover { background: var(--hover); color: var(--text); }
.step.done b { background: var(--ok-solid); border-color: var(--ok-solid); color: var(--on-ok); }
.step.now { background: var(--panel2); color: var(--text); font-weight: 550; }
.step.now b { background: var(--brand-fill); border-color: var(--brand-fill); color: var(--on-brand); }
.step.gate b { border-radius: 6px; }
@media (max-width: 760px) { .step span { display: none; } .step { justify-content: center; padding: 9px 4px; } }

main { padding-top: 22px; padding-bottom: 72px; outline: none; }
.head { margin: 6px 0 22px; }
.kicker { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel2); }
.kicker::before, .badge-top::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--mint); }
.head h1 { font-size: clamp(22px, 3vw, 32px); line-height: 1.15; font-weight: 750; letter-spacing: -.025em; }
.head p { color: var(--muted); max-width: 46em; margin-top: 8px; }
.ctx { display: inline-flex; gap: 8px; align-items: center; margin-top: 12px; font-size: 13px; color: var(--muted); padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); }
.ctx b { color: var(--text); font-weight: 600; }

/* ---------- landing ---------- */
.hero { padding: clamp(18px, 5vw, 44px) 0 30px; text-align: center; }
.badge-top { display: inline-flex; gap: 8px; align-items: center; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); background: var(--panel2); border-radius: 999px; padding: 6px 14px; margin-bottom: 26px; }
.badge-top b { display: none; }
.hero h1 { font-size: clamp(34px, 7.2vw, 76px); line-height: .98; font-weight: 800; letter-spacing: -.03em; text-transform: uppercase; max-width: 12em; margin: 0 auto; }
.hero h1 em { display: block; font-style: italic; font-weight: 500; background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; padding-right: .08em; }
.hero p { color: var(--muted); font-size: clamp(15.5px, 2vw, 17.5px); max-width: 38em; margin: 18px auto 0; }
.cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 26px; }
.cta-note { margin-top: 12px; font-size: 13px; color: var(--faint); }
.cta-note button { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.feats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 10px 0 18px; }
.feat { padding: 22px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); box-shadow: var(--shadow); }
.feat .n { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; font: 700 12px var(--mono); color: #fff; background: #0F172A; }
.feat:nth-child(2) .n { background: #4338CA; } .feat:nth-child(3) .n { background: #047857; }
.feat h3 { font-size: 15px; margin: 14px 0 6px; font-weight: 750; }
.feat p { color: var(--muted); font-size: 13.5px; }
.flow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; margin: 0 0 40px; border-radius: var(--r); background: var(--band); overflow: hidden; border: 1px solid var(--line); }
.flow li { list-style: none; padding: 20px 18px; border-right: 1px solid rgba(255,255,255,.08); font-size: 13px; color: var(--on-band-muted); counter-increment: flow; }
.flow li::before { content: counter(flow, decimal-leading-zero); display: block; font: 700 12px var(--mono); color: var(--mint); margin-bottom: 8px; }
.flow { counter-reset: flow; }
.flow li:last-child { border-right: 0; }
.flow li b { display: block; color: var(--on-band); font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.flow li.h b::after { content: ' · you'; color: var(--mint); font-weight: 600; }
.flow { padding: 0; }
@media (max-width: 860px) { .feats { grid-template-columns: 1fr; } .flow { grid-template-columns: 1fr; } .flow li { border-right: 0; border-bottom: 1px solid rgba(255,255,255,.08); } .flow li:last-child { border-bottom: 0; } }

/* ---------- cards & layout ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; box-shadow: var(--shadow); }
.card h2 { font-size: 15.5px; font-weight: 620; }
.card .sub { color: var(--muted); font-size: 13.5px; margin: 4px 0 14px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: grid; gap: 16px; min-width: 0; }
.memo > div, .reviewgrid > div, .grid2 > * { min-width: 0; }
@media (max-width: 940px) { .grid2, .reviewgrid, .two, .memo { grid-template-columns: minmax(0, 1fr) !important; } .side { position: static !important; } }
@media (max-width: 480px) { .card { padding: 16px; } }

/* ---------- controls ---------- */
.btn { appearance: none; border: 1px solid var(--line2); background: var(--panel); padding: 9px 17px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 14px; line-height: 1.3; transition: background .15s, border-color .15s, transform .1s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; color: var(--text); text-decoration: none; }
.btn:hover:not(:disabled) { background: var(--hover); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand-fill); border-color: var(--brand-fill); color: var(--on-brand); }
.btn.primary:hover:not(:disabled) { background: var(--brand-fill-hover); border-color: var(--brand-fill-hover); }
.btn.lg { padding: 14px 26px; font-size: 15px; border-radius: 999px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { color: var(--text); background: var(--hover); }
.btn.sm { padding: 6px 13px; font-size: 13px; border-radius: 999px; }
.btn.block { width: 100%; }
.btn svg { width: 16px; height: 16px; flex: none; }
label.f, p.f { display: block; font-size: 12.5px; color: var(--muted); margin: 14px 0 6px; font-weight: 550; }
input[type=text], input[type=password], input[type=url], select, textarea { width: 100%; background: var(--sunk); border: 1px solid var(--line2); border-radius: var(--r-sm); padding: 9px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: var(--faint); opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
select { appearance: none; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
select option { background: var(--panel); color: var(--text); }
.hint { font-size: 12.5px; color: var(--faint); margin-top: 6px; }
.warn { color: var(--warn); } .err { color: var(--bad); } .ok { color: var(--ok); }
.row { display: flex; gap: 10px; align-items: center; } .row.sp { justify-content: space-between; } .wrap { flex-wrap: wrap; } .grow { flex: 1; }
.right { text-align: right; }
.ilist { display: grid; gap: 8px; margin-bottom: 4px; }
.item { display: flex; align-items: center; gap: 12px; padding: 9px 8px 9px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--sunk); }
.av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 650; font-size: 12.5px; background: var(--brand-soft); color: var(--brand); flex: none; }
.item .meta { flex: 1; min-width: 0; }
.item .meta b { display: block; font-size: 14px; font-weight: 580; }
.item .meta small { color: var(--faint); font-size: 12.5px; }
.aitem { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.aitem .id { font: 600 12px var(--mono); color: var(--brand); width: 24px; flex: none; }
.empty { border: 1px dashed var(--line2); border-radius: 11px; padding: 16px; text-align: center; color: var(--faint); font-size: 13.5px; }
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--sunk); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; cursor: pointer; font-size: 13.5px; color: var(--muted); }
.seg button:hover:not(:disabled) { color: var(--text); }
.seg button[aria-pressed=true] { background: var(--panel); color: var(--text); box-shadow: inset 0 0 0 1px var(--line2), 0 1px 2px rgba(15,23,42,.06); font-weight: 600; }
.seg button:disabled { cursor: not-allowed; opacity: .55; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel2); font-size: 13.5px; color: var(--muted); }
.notice.amber { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn); }
.notice.red { border-color: var(--bad-line); background: var(--bad-bg); color: var(--bad); }
.notice.violet { border-color: var(--brand-line); background: var(--brand-soft); color: var(--text); }

/* ---------- gut check ---------- */
.gutlist { display: grid; gap: 10px; }
.gut { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); }
.gut .id { font: 600 12px var(--mono); color: var(--brand); margin-right: 10px; }
.gut .seg button[aria-pressed=true] { background: var(--brand-fill); color: var(--on-brand); box-shadow: none; }
@media (max-width: 700px) { .gut { grid-template-columns: 1fr; } .gut .seg { display: grid; grid-template-columns: repeat(3, 1fr); } }

/* ---------- run ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.tile { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--sunk); }
.tile b { display: block; font-size: 24px; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.tile span { font-size: 12.5px; color: var(--muted); }
@media (max-width: 700px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.stages { display: grid; gap: 8px; }
.stage { display: flex; gap: 14px; align-items: flex-start; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--sunk); }
.stage .ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line2); flex: none; font-size: 12px; color: var(--faint); margin-top: 1px; }
.stage.active { border-color: var(--brand-line); } .stage.active .ic { border-color: var(--brand-fill); background: var(--brand-fill); animation: pulse 1.4s infinite; }
.stage.done .ic { background: var(--ok-solid); border-color: var(--ok-solid); color: var(--on-ok); }
.stage b { display: block; font-weight: 580; font-size: 14.5px; } .stage small { color: var(--muted); font-size: 13px; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--brand-line); } 70% { box-shadow: 0 0 0 7px transparent; } }
.pips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.pip { font-size: 12px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line2); color: var(--faint); }
.pip.ok { color: var(--ok); border-color: var(--ok-line); } .pip.rej { color: var(--bad); border-color: var(--bad-line); }
.log { font: 12.5px/1.65 var(--mono); color: var(--faint); max-height: 180px; overflow: auto; padding: 12px 14px; background: var(--sunk); border-radius: 12px; border: 1px solid var(--line); margin-top: 14px; }
.log .e { color: var(--bad); } .log .w { color: var(--warn); }
.coach { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 12px; }
.coach .c { border: 1px solid var(--line); border-radius: 12px; background: var(--sunk); padding: 12px 14px; }
.coach .c header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.coach .c header b { font-size: 14px; }
.meter { height: 6px; border-radius: 99px; background: var(--panel2); overflow: hidden; margin: 4px 0 2px; }
.meter i { display: block; height: 100%; background: var(--brand-fill); border-radius: 99px; }
.coach ul { margin: 8px 0 0; padding-left: 16px; font-size: 12.5px; color: var(--muted); }
.coach li { margin: 3px 0; }
.coach .stat { display: flex; justify-content: space-between; font-size: 12px; color: var(--faint); }

/* ---------- checkpoint ---------- */
.ovbar { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 16px 18px; border-radius: var(--r); background: var(--band); color: var(--on-band); }
.ovbar .ov { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); color: var(--on-band-muted); }
.ovbar .ov:hover { background: rgba(255,255,255,.12); color: var(--on-band); }
.ovbar .ov.done { border-color: rgba(52,211,153,.5); color: var(--on-band); }
.ovbar .ov code { color: #C7D2FE; }
.ovbar .t { font-size: 14px; color: var(--on-band-muted); } .ovbar .t b { color: var(--on-band); }
.ovs { display: flex; gap: 6px; flex-wrap: wrap; }
.ov { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line2); background: var(--panel); border-radius: 999px; padding: 5px 10px; font-size: 12.5px; cursor: pointer; color: var(--muted); }
.ov:hover { color: var(--text); background: var(--hover); }
.ov.done { border-color: var(--ok-line); color: var(--text); }
.ov code { background: transparent; border: 0; padding: 0; color: var(--brand); font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; background: var(--neutral); flex: none; }
.dot.supported { background: var(--ok-solid); } .dot.contradicted { background: var(--bad); } .dot.mixed { background: var(--warn-solid); }
.reviewgrid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; margin-top: 16px; align-items: start; }
.side { position: sticky; top: 14px; display: grid; gap: 12px; }
.acard { padding: 0; overflow: hidden; margin-bottom: 16px; scroll-margin-top: 16px; }
.acard.decided { border-color: var(--ok-line); }
.badge.fragile { color: var(--warn); border-color: var(--warn-line); background: var(--warn-bg); } .badge.robust { color: var(--ok); border-color: var(--ok-line); background: var(--ok-bg); }
.ahead { padding: 18px 20px 16px; border-bottom: 1px solid var(--line); }
.ahead h3 { font-size: 17px; line-height: 1.38; font-weight: 600; display: flex; gap: 10px; }
.ahead h3 code { background: transparent; border: 0; padding: 0; color: var(--brand); margin-top: 3px; font-size: 13px; font-weight: 600; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.badge { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line2); color: var(--muted); display: inline-flex; gap: 6px; align-items: center; font-weight: 500; }
.badge.supported { color: var(--ok); border-color: var(--ok-line); background: var(--ok-bg); }
.badge.contradicted { color: var(--bad); border-color: var(--bad-line); background: var(--bad-bg); }
.badge.mixed { color: var(--warn); border-color: var(--warn-line); background: var(--warn-bg); }
.badge.untested { color: var(--neutral); border-color: var(--neutral-line); background: var(--neutral-bg); }
.badge.surprise { color: var(--on-warn); background: var(--warn-solid); border-color: var(--warn-solid); font-weight: 650; }
.abody { padding: 18px 20px; display: grid; gap: 14px; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.col { min-width: 0; }
.col h4 { margin: 0 0 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); display: flex; justify-content: space-between; font-weight: 600; }
.col h4 span:last-child { font: 600 11.5px var(--mono); }
.quote { margin: 0 0 8px; padding: 10px 12px; border-left: 2px solid var(--line2); background: var(--sunk); border-radius: 0 10px 10px 0; }
.col.s .quote { border-left-color: var(--ok-solid); } .col.c .quote { border-left-color: var(--bad); }
.quote q { display: block; font: italic 15px/1.5 var(--serif); color: var(--text); }
.quote .by { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 7px; font-size: 12px; color: var(--faint); }
.quote .by b { color: var(--muted); font-weight: 600; }
.pill { font-size: 10.5px; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line2); text-transform: uppercase; letter-spacing: .05em; font-weight: 650; }
.pill.behavior { color: var(--ok); border-color: var(--ok-line); } .pill.opinion { color: var(--info); border-color: var(--info-line); } .pill.hypothetical { color: var(--warn); border-color: var(--warn-line); } .pill.prompt { color: var(--bad); border-color: var(--bad-line); }
details > summary { cursor: pointer; list-style: none; border-radius: 6px; }
details > summary::-webkit-details-marker { display: none; }
.quote details { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.quote summary { color: var(--faint); font-size: 12px; } .quote summary:hover { color: var(--muted); }
.more > summary { font-size: 12.5px; color: var(--brand); padding: 4px 2px; font-weight: 550; }
.none { font-size: 13px; color: var(--faint); padding: 10px 12px; border: 1px dashed var(--line2); border-radius: 10px; }
.rule { font-size: 13px; color: var(--muted); padding: 10px 12px; border-radius: 10px; background: var(--sunk); border: 1px solid var(--line); }
.rule b { color: var(--text); font-weight: 600; }
.rt { border: 1px solid var(--bad-line); background: var(--bad-bg); border-radius: 12px; padding: 0 14px; }
.rt > summary { padding: 11px 0; font-weight: 600; color: var(--bad); font-size: 14px; display: flex; justify-content: space-between; gap: 10px; }
.rt > summary::after { content: '+'; font-weight: 400; } .rt[open] > summary::after { content: '−'; }
.rt dl { margin: 0 0 14px; display: grid; gap: 10px; }
.rt dt { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; }
.rt dd { margin: 2px 0 0; font-size: 14px; color: var(--text); }
.decide { border-top: 1px solid var(--line); padding: 18px 20px; background: var(--panel2); }
.decide h4 { font-size: 14px; font-weight: 620; margin-bottom: 10px; }
.opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border: 0; padding: 0; margin: 0; }
.opts legend { padding: 0; }
@media (max-width: 700px) { .opts { grid-template-columns: 1fr; } }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border: 1px solid var(--line2); border-radius: 11px; cursor: pointer; background: var(--panel); font-size: 14px; font-weight: 580; }
.opt:hover { background: var(--hover); }
.opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.opt:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.opt input { accent-color: var(--brand-fill); margin-top: 4px; width: 16px; height: 16px; flex: none; }
.opt small { color: var(--muted); display: block; font-weight: 400; font-size: 12.5px; line-height: 1.4; margin-top: 2px; }
.done-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.done-line .ok b { color: var(--text); }
.side .card { padding: 16px; } .side h2 { font-size: 14px; margin-bottom: 6px; }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 7px 0; border-bottom: 1px solid var(--line); color: var(--muted); }
.kv:last-of-type { border: 0; } .kv b { font-variant-numeric: tabular-nums; color: var(--text); }
.side details { margin-top: 8px; } .side summary { font-size: 12.5px; color: var(--brand); font-weight: 550; padding: 2px 0; }
.rejq { font: italic 13px/1.45 var(--serif); color: var(--bad); text-decoration: line-through; text-decoration-color: var(--bad-line); margin-top: 8px; }
.lq { font: italic 13px/1.45 var(--serif); color: var(--muted); margin-top: 8px; }
.big { font-size: 28px; font-weight: 680; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }

/* ---------- memo ---------- */
.timebox { display: grid; grid-template-columns: repeat(3, auto) 1fr; gap: 32px; align-items: center; }
.timebox big { display: block; font-size: 30px; font-weight: 680; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.timebox .acc { color: var(--brand); }
@media (max-width: 860px) { .timebox { grid-template-columns: 1fr 1fr; gap: 18px; } .timebox > p { grid-column: 1 / -1; } }
.memo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.memo textarea { min-height: 560px; font: 12.5px/1.6 var(--mono); }
.preview { background: var(--paper); color: var(--paper-text); border-radius: 12px; padding: 8px 28px 24px; max-height: 600px; overflow: auto; border: 1px solid var(--line2); }
.preview h1 { font: 650 24px/1.2 var(--sans); margin: 18px 0 8px; letter-spacing: -.02em; color: #141418; }
.preview h2 { font: 650 15px/1.3 var(--sans); margin: 22px 0 6px; color: var(--paper-h2); letter-spacing: -.01em; }
.preview p, .preview li { font: 14.5px/1.6 var(--serif); color: var(--paper-text); }
.preview ul, .preview ol { padding-left: 20px; } .preview li { margin: 4px 0; }
.preview code { background: #F4F4F5; border-color: #E4E4E7; color: #27272A; }
.preview table { border-collapse: collapse; width: 100%; font: 12px/1.45 var(--sans); margin: 10px 0; display: block; overflow-x: auto; }
.preview th, .preview td { border: 1px solid var(--paper-line); padding: 6px 8px; text-align: left; vertical-align: top; color: var(--paper-text); }
.preview th { background: #F4F4F5; }
.cite { font: 600 10.5px var(--mono); padding: 1px 5px; border-radius: 5px; background: #EDE9FE; color: #4C1D95; border: 1px solid #DDD6FE; cursor: help; white-space: nowrap; }
.cite.bad { background: #FEE2E2; color: #991B1B; border-color: #FECACA; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line2); border-radius: 12px; cursor: pointer; background: var(--panel2); }
.check:has(input:checked) { border-color: var(--ok-line); background: var(--ok-bg); }
.check input { margin-top: 3px; accent-color: var(--brand-fill); width: 18px; height: 18px; flex: none; }
@media (max-width: 940px) { .memo textarea { min-height: 300px; } .preview { max-height: none; } }
@media (max-width: 480px) { .preview { padding: 4px 16px 18px; } }

/* ---------- dialog ---------- */
dialog { width: min(720px, calc(100% - 24px)); max-height: min(86vh, 860px); border: 1px solid var(--line2); border-radius: 16px; background: var(--panel); color: var(--text); padding: 0; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5); }
dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(3px); }
dialog[open] { animation: pop .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.dlg-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); background: var(--panel); z-index: 1; }
.dlg-head h2 { font-size: 17px; }
.dlg-body { padding: 18px 20px 22px; font-size: 14.5px; color: var(--muted); }
.dlg-body h3 { font-size: 14.5px; color: var(--text); margin: 20px 0 6px; } .dlg-body h3:first-child { margin-top: 0; }
.dlg-body p + p { margin-top: 8px; }
.dlg-body ol, .dlg-body ul { padding-left: 20px; margin: 6px 0; } .dlg-body li { margin: 6px 0; }
.dlg-body li b, .dlg-body p b { color: var(--text); }
.dlg-body table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 8px 0; }
.dlg-body th, .dlg-body td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.dlg-body th { color: var(--text); font-weight: 600; }
.dlg-body pre { font: 12.5px/1.55 var(--mono); background: var(--sunk); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow-x: auto; color: var(--text); white-space: pre-wrap; }

/* ---------- footer & toast ---------- */
.foot { color: var(--faint); font-size: 12.5px; display: flex; gap: 10px 24px; flex-wrap: wrap; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 20px; padding-bottom: max(36px, env(safe-area-inset-bottom)); }
.foot nav { display: flex; gap: 4px 16px; flex-wrap: wrap; }
.linkbtn { display: inline-flex; align-items: center; background: none; border: 0; padding: 4px 0; color: var(--muted); cursor: pointer; font-size: 12.5px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line2); }
.linkbtn:hover { color: var(--text); }
.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translate(-50%, 16px); background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; font-size: 14px; font-weight: 500; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
#printArea { display: none; }

/* ---------- touch devices: 44px targets, no iOS zoom ---------- */
@media (pointer: coarse) {
  .btn, .seg button, .ov, .step, .iconbtn, .linkbtn { min-height: 44px; }
  .iconbtn { width: 44px; height: 44px; }
  .btn.sm { padding: 8px 13px; }
  input[type=text], input[type=password], input[type=url], select, textarea { font-size: 16px; min-height: 44px; }
  .opt { min-height: 52px; }
  details > summary { padding-top: 6px; padding-bottom: 6px; }
}
@media (forced-colors: active) {
  .btn.primary, .step.now b, .mark { forced-color-adjust: none; }
  .card, .opt, .quote { border: 1px solid CanvasText; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

@media print {
  body { background: #fff !important; }
  body > * { display: none !important; }
  #printArea { display: block !important; color: #111; font: 11pt/1.55 Georgia, serif; padding: 0 8mm; }
  #printArea h1 { font: 700 20pt/1.2 Helvetica, Arial, sans-serif; }
  #printArea h2 { font: 700 12.5pt/1.3 Helvetica, Arial, sans-serif; margin-top: 16pt; color: #3B2FB3; break-after: avoid; }
  #printArea table { border-collapse: collapse; width: 100%; font: 8.5pt/1.4 Helvetica, Arial, sans-serif; }
  #printArea th, #printArea td { border: 1px solid #ccc; padding: 4px 6px; text-align: left; vertical-align: top; }
  #printArea tr { break-inside: avoid; }
  #printArea .cite { font: 700 7.5pt monospace; color: #4C1D95; background: none; border: 0; padding: 0; }
}

/* ---------- motion: calm, one idea (rise + fade), only on step entry ---------- */
.progress { height: 3px; margin: 10px 14px 0; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; width: 20%; border-radius: inherit; background: var(--accent-grad); transition: width .6s cubic-bezier(.2,.7,.2,1); }
.step, .step b { transition: background .3s ease, color .3s ease, border-color .3s ease; }
.rv { opacity: 0; transform: translateY(16px); transition: opacity .6s cubic-bezier(.2,.7,.2,1), transform .6s cubic-bezier(.2,.7,.2,1); transition-delay: calc(var(--i, 0) * 70ms); }
.rv.in { opacity: 1; transform: none; }
.btn:active:not(:disabled) { transform: scale(.97); }
html { scroll-behavior: smooth; }
#keyWarn .notice { margin-top: 8px; }
@media (prefers-reduced-motion: reduce) { .rv { opacity: 1; transform: none; } .progress i { transition: none; } }

/* ---------- premium polish ---------- */
body { background-image: radial-gradient(900px 420px at 50% -160px, var(--glow), transparent 70%), radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 0); background-size: auto, 28px 28px; background-repeat: no-repeat, repeat; background-position: 0 0, 0 0; }
body::before { content: ''; position: fixed; inset: 0; z-index: -1; background: radial-gradient(ellipse at 50% 20%, transparent 0, var(--bg) 78%); pointer-events: none; }
.card { border-radius: 22px; box-shadow: var(--shadow); transition: border-color .25s, box-shadow .25s; }
.card:hover { border-color: var(--line2); }
.stepper { backdrop-filter: saturate(1.4) blur(10px); }
.step.lock { cursor: pointer; opacity: .75; }
.step.lock:hover { background: var(--hover); }
.btn.primary { box-shadow: 0 6px 16px -8px rgba(15, 23, 42, .55); transition: transform .15s, box-shadow .2s, background .15s; }
.btn.primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 22px -10px rgba(15, 23, 42, .6); }
.peek { max-width: 760px; margin: 44px auto 0; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); box-shadow: 0 30px 60px -34px rgba(15, 23, 42, .35), var(--shadow); text-align: left; overflow: hidden; }
.peek-bar { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--panel2); font-size: 12px; color: var(--faint); }
.peek-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--line2); }
.peek-bar span { margin-left: 10px; font-weight: 600; letter-spacing: .02em; }
.peek-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.peek-row .pid { font: 700 12px var(--mono); color: var(--on-brand); background: var(--brand-fill); border-radius: 8px; padding: 3px 8px; }
.peek-row .pt { font-size: 13.5px; color: var(--text); min-width: 0; }
.peek-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 18px; font-size: 12.5px; color: var(--muted); background: var(--panel2); }
.peek-foot b { color: var(--ok); font-weight: 600; }
@media (max-width: 640px) { .peek-row { grid-template-columns: auto 1fr; } .peek-row .badge { grid-column: 2; justify-self: start; } .peek { margin-top: 30px; } }

/* ---------- setup flow: readable transcripts, one sticky action bar ---------- */
.item.iv { align-items: flex-start; }
.item.iv details { flex: 1; min-width: 0; }
.item.iv summary { display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; border-radius: 8px; min-height: 40px; }
.item.iv summary::-webkit-details-marker { display: none; }
.item.iv .show { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.item.iv details[open] .show { display: none; }
.item.iv textarea { margin-top: 10px; min-height: 170px; font: 13px/1.55 var(--mono); }
.item.iv > .btn { margin-top: 3px; }
.setupbar { position: sticky; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 20; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 22px; padding: 10px 12px 10px 16px; border: 1px solid var(--line2); border-radius: 999px; background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: blur(12px); box-shadow: 0 18px 40px -18px rgba(15, 23, 42, .35); }
.setupbar .grow { flex: 1; min-width: 160px; }
.checks { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; flex-wrap: wrap; }
.checks li { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--faint); padding: 4px 11px 4px 5px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel2); }
.checks li i { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font: 600 11px var(--sans); font-style: normal; border: 1px solid var(--line2); }
.checks li.ok { color: var(--ok); border-color: var(--ok-line); background: var(--ok-bg); }
.checks li.ok i { background: var(--ok-solid); border-color: var(--ok-solid); color: var(--on-ok); }
@media (max-width: 640px) { .setupbar { border-radius: 22px; } .setupbar .btn { width: 100%; } }
.item.iv textarea { display: block; width: 100%; resize: vertical; }
.toast { bottom: max(84px, calc(env(safe-area-inset-bottom) + 76px)); }
@media (max-width: 640px) {
  .item.iv { flex-wrap: wrap; }
  .item.iv details { flex: 1 1 100%; order: 1; }
  .item.iv > .btn { order: 2; margin: 2px 0 0 auto; }
  .setupbar { position: static; box-shadow: none; backdrop-filter: none; background: var(--panel); }
}
