:root {
  --paper: #FBFAF7; --surface: #FFFFFF; --ink: #14213D; --muted: #4A5670; --blue: #12306B; --blue-2: #1E4A9E;
  --coral: #E4664F; --coral-text: #B23A25; --line: #DAD6CC; --tint: #EEF2FA;
  --pass: #1C6B3A; --pass-bg: #E6F4EA; --warn: #7A4F00; --warn-bg: #FFF4D6; --fail: #B3261E; --fail-bg: #FDECEA; --info-bg: #EEF2FA;
  --r-sm: 6px; --r-md: 12px; --r-lg: 20px; --shadow: 0 1px 2px rgba(20,33,61,.06), 0 8px 24px rgba(20,33,61,.06);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #0E1424; --surface: #162038; --ink: #F4F2EC; --muted: #B7BFD1; --blue: #9DB8F2; --blue-2: #B9CCF6;
    --coral: #F08A75; --coral-text: #F4A493; --line: #2C3958; --tint: #1B2847;
    --pass: #8FD6A5; --pass-bg: #12301F; --warn: #F2C66B; --warn-bg: #33270A; --fail: #F6A39C; --fail-bg: #3A1513; --info-bg: #1B2847; }
  .logo-light { display: none; } .logo-dark { display: inline; }
}
@media (prefers-color-scheme: light) { .logo-dark { display: none; } }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.55 var(--font); }
a { color: var(--blue-2); text-underline-offset: 3px; }
a:hover { color: var(--blue); }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 12px; z-index: 10; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

header.site { border-bottom: 1px solid var(--line); background: var(--surface); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; min-height: 48px; }
.brand img { height: 36px; width: auto; }
nav.top ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; flex-wrap: wrap; }
nav.top a { display: inline-flex; align-items: center; min-height: 48px; padding: 0 12px; text-decoration: none; color: var(--ink); border-radius: var(--r-sm); font-weight: 500; }
nav.top a[aria-current="page"] { color: var(--blue); box-shadow: inset 0 -3px 0 var(--coral); }
.preview-bar { background: var(--blue); color: #fff; font-size: 14px; text-align: center; padding: 6px 16px; }
@media (prefers-color-scheme: dark) { .preview-bar { background: #24365F; } }

main { padding: 32px 0 64px; }
h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 16px; color: var(--blue); }
h2 { font-size: clamp(22px, 3vw, 28px); line-height: 1.2; margin: 40px 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 19px; margin: 24px 0 8px; }
p.lede { font-size: 20px; color: var(--muted); max-width: 46ch; margin: 0 0 24px; }
.muted { color: var(--muted); }
.small { font-size: 15px; }

.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; gap: 24px; } }
.hero-art { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; min-width: 48px; padding: 0 22px;
  border-radius: 999px; border: 2px solid var(--blue); background: var(--blue); color: #fff; font: 600 17px var(--font); cursor: pointer; text-decoration: none; }
@media (prefers-color-scheme: dark) { .btn { color: #0E1424; } }
.btn:hover { filter: brightness(1.08); color: #fff; }
@media (prefers-color-scheme: dark) { .btn:hover { color: #0E1424; } }
.btn.secondary { background: transparent; color: var(--blue); }
.btn.danger { background: transparent; color: var(--fail); border-color: var(--fail); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; filter: none; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px; box-shadow: var(--shadow); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 820px) { .grid3, .grid2 { grid-template-columns: 1fr; } }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding-left: 48px; margin-bottom: 16px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--tint); color: var(--blue); font-weight: 700; display: grid; place-items: center; }

.notice { border-left: 4px solid var(--coral); background: var(--surface); padding: 12px 16px; border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.independent { font-size: 15px; color: var(--muted); }

fieldset { border: 0; padding: 0; margin: 0 0 16px; }
legend { font-weight: 700; font-size: 19px; margin-bottom: 8px; }
.choice { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .choice { grid-template-columns: 1fr; } }
.choice label { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border: 2px solid var(--line); border-radius: var(--r-md); background: var(--surface); cursor: pointer; min-height: 48px; }
.choice input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--blue); flex: none; }
.choice label:has(input:checked) { border-color: var(--blue); background: var(--tint); }
.choice strong { display: block; }

.drop { display: block; border: 2px dashed var(--blue-2); border-radius: var(--r-lg); padding: 32px 16px; text-align: center; background: var(--surface); }
.drop.over { background: var(--tint); }
.drop[aria-disabled="true"] { opacity: .6; border-color: var(--line); }
.drop input[type=file] { position: absolute; opacity: 0; width: 1px; height: 1px; }

.status { min-height: 1.5em; font-weight: 600; }
.report-head { padding: 16px 20px; border-radius: var(--r-md); font-weight: 700; font-size: 20px; }
.report-head.retake_required { background: var(--fail-bg); color: var(--fail); }
.report-head.needs_user_review { background: var(--info-bg); color: var(--blue); }
.items { list-style: none; padding: 0; margin: 0; }
.items li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 560px) { .items li { grid-template-columns: 1fr; gap: 4px; } }
.badge { display: inline-block; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; height: fit-content; width: fit-content; }
.b-measured_pass { background: var(--pass-bg); color: var(--pass); }
.b-measured_fail { background: var(--fail-bg); color: var(--fail); }
.b-estimated_warning { background: var(--warn-bg); color: var(--warn); }
.b-user_review { background: var(--info-bg); color: var(--blue); }
.b-not_checked { background: transparent; color: var(--muted); border: 1px solid var(--line); }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 24px; align-items: start; }
@media (max-width: 900px) { .workspace { grid-template-columns: 1fr; } }
.stage { position: relative; background: repeating-conic-gradient(var(--line) 0 25%, transparent 0 50%) 0 0/16px 16px; border-radius: var(--r-md); overflow: hidden; touch-action: manipulation; }
.stage img, .stage canvas { display: block; width: 100%; height: auto; }
.stage .guide { position: absolute; left: 0; right: 0; height: 0; border-top: 2px dashed var(--coral); pointer-events: none; }
.stage .guide span { position: absolute; right: 6px; top: -24px; background: #A8361F; color: #fff; font-size: 12px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.stage.marking { cursor: crosshair; outline: 3px solid var(--coral); }
.mark-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.mark-controls label { font-weight: 600; font-size: 15px; display: grid; gap: 4px; }
.mark-controls input { min-height: 48px; font: inherit; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; word-break: break-all; }
details { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 16px; background: var(--surface); margin-bottom: 12px; }
summary { cursor: pointer; font-weight: 600; min-height: 32px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-scroll { overflow-x: auto; }
.price { font-size: 32px; font-weight: 800; color: var(--blue); }
.off { display: inline-block; background: var(--warn-bg); color: var(--warn); font-weight: 700; font-size: 13px; padding: 3px 10px; border-radius: 999px; }
.draft { background: var(--warn-bg); color: var(--warn); padding: 12px 16px; border-radius: var(--r-sm); font-weight: 600; }

footer.site { border-top: 1px solid var(--line); background: var(--surface); padding: 32px 0; font-size: 15px; color: var(--muted); }
footer.site ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 12px 0; }
footer.site a { display: inline-flex; min-height: 48px; align-items: center; padding: 0 8px; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: no-preference) { .btn, .choice label { transition: background-color .15s, border-color .15s; } }
.mt0 { margin-top: 0; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.items li.group { display: block; border-bottom: 0; padding-bottom: 0; }
#drophelp { display: block; margin-top: 12px; }
#sb-canvas { width: 100%; height: auto; }
.card > :first-child { margin-top: 0; }
/* v0.3 */
.step-h { margin-top: 32px; }
.field { margin: 16px 0; display: grid; gap: 8px; max-width: 560px; }
.field-label { font-weight: 700; font-size: 17px; margin: 16px 0 8px; display: block; }
.text { min-height: 48px; font: inherit; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); width: 100%; }
.text:focus-visible { border-color: var(--blue); }
.routes { display: grid; gap: 12px; }
.route { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border: 2px solid var(--line); border-radius: var(--r-md); background: var(--surface); cursor: pointer; }
.route input { width: 22px; height: 22px; margin-top: 3px; accent-color: var(--blue); flex: none; }
.route:has(input:checked) { border-color: var(--blue); background: var(--tint); }
.block { display: block; margin-top: 4px; }
.route-summary p:first-child { margin-top: 0; }
.export-grid { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 720px) { .export-grid { grid-template-columns: 1fr; } }
.export-fig { margin: 0; }
.export-frame { position: relative; border: 1px solid var(--line); max-width: 300px; }
.export-frame img { display: block; width: 100%; height: auto; }
.band { position: absolute; left: 0; right: 0; background: rgba(228, 102, 79, .22); border-top: 2px dashed var(--coral); border-bottom: 2px dashed var(--coral); pointer-events: none; }
.vguide { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px dashed var(--blue-2); pointer-events: none; }
h4 { margin: 16px 0 6px; font-size: 16px; }
.slot { margin-top: 24px; }
.slot-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.consent { display: flex; gap: 12px; align-items: flex-start; min-height: 48px; padding: 12px 0; cursor: pointer; }
.consent input { width: 24px; height: 24px; flex: none; margin: 0; accent-color: var(--blue); }
/* Reserve the route picker's height before JavaScript mounts it (measured: 126 / 152 / 280-306 px) so the page below doesn't jump. */
#picker { min-height: 126px; }
@media (max-width: 820px) { #picker { min-height: 152px; } }
@media (max-width: 640px) { #picker { min-height: 310px; } }

/* Analytics choice banner (shown only where analytics can run) */
.consent-banner { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 50; max-width: 640px; margin: 0 auto; padding: 16px; background: var(--surface); color: var(--ink); border: 2px solid var(--blue); border-radius: var(--r-md); box-shadow: var(--shadow); }
.consent-banner p { margin: 0 0 12px; }
.consent-row { display: flex; gap: 12px; flex-wrap: wrap; }
.consent-row .btn { flex: 1 1 160px; min-height: 48px; }
.linklike { background: none; border: 0; padding: 12px 4px; min-height: 48px; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
