/* ENOGG — warm paper + red pen. Hand-written, no build step. */
@font-face { font-family: "Inter"; src: url("/assets/fonts/inter-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("/assets/fonts/fraunces-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("/assets/fonts/fraunces-var-italic.woff2") format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }

:root {
  --paper: #FBF8F1; --surface: #FFFFFF; --surface-2: #F4EFE3; --ink: #1C2541; --ink-muted: #5B6178; --ink-faint: #8A8FA3;
  --line: #E7E1D3; --line-strong: #D6CDB9; --redpen: #D7263D; --redpen-soft: #FBE4E7; --tick: #2E8B57; --tick-soft: #E1F2E8;
  --partial: #B86E00; --partial-soft: #FDF0DA; --focus: #3A6FF7; --info-soft: #E6EDFE;
  --shadow: 0 1px 2px rgba(28,37,65,.06), 0 4px 16px rgba(28,37,65,.06);
  --radius: 12px; --radius-sm: 8px;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --step--1: clamp(.83rem, .8rem + .1vw, .9rem); --step-0: 1rem; --step-1: clamp(1.15rem, 1.1rem + .3vw, 1.3rem);
  --step-2: clamp(1.4rem, 1.25rem + .7vw, 1.8rem); --step-3: clamp(1.8rem, 1.5rem + 1.4vw, 2.6rem); --step-4: clamp(2.2rem, 1.7rem + 2.6vw, 3.6rem);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12141C; --surface: #1B1E29; --surface-2: #222634; --ink: #ECE8DE; --ink-muted: #A3A8B8; --ink-faint: #7D8396;
    --line: #2C3040; --line-strong: #3A3F52; --redpen: #FF5A6E; --redpen-soft: #3A1E25; --tick: #4CC38A; --tick-soft: #17352A;
    --partial: #F5A623; --partial-soft: #3A2D14; --focus: #7EA2FF; --info-soft: #1E2843; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #12141C; --surface: #1B1E29; --surface-2: #222634; --ink: #ECE8DE; --ink-muted: #A3A8B8; --ink-faint: #7D8396;
  --line: #2C3040; --line-strong: #3A3F52; --redpen: #FF5A6E; --redpen-soft: #3A1E25; --tick: #4CC38A; --tick-soft: #17352A;
  --partial: #F5A623; --partial-soft: #3A2D14; --focus: #7EA2FF; --info-soft: #1E2843; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: var(--step-0); line-height: 1.55; -webkit-font-smoothing: antialiased; }
img, svg, video { max-width: 100%; height: auto; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: var(--step-3); } h2 { font-size: var(--step-2); } h3 { font-size: var(--step-1); } h4 { font-size: var(--step-0); }
p { margin: 0 0 1em; }
small, .small { font-size: var(--step--1); }
.muted { color: var(--ink-muted); } .faint { color: var(--ink-faint); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
[hidden] { display: none !important; }

/* Layout */
.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.wrap-narrow { max-width: 760px; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.spacer { flex: 1; }
main { min-height: 60vh; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 16px; height: 64px; }
.logo { font-family: var(--font-display); font-weight: 700; font-size: 1.45rem; text-decoration: none; letter-spacing: -.02em; display: inline-flex; align-items: center; gap: 8px; }
.logo .dot { color: var(--redpen); margin-left: -8px; }
.logo svg { width: 28px; height: 28px; }
.nav { display: flex; gap: 4px; align-items: center; }
.nav a { text-decoration: none; padding: 8px 12px; border-radius: 8px; color: var(--ink-muted); font-weight: 500; font-size: .95rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.icon-btn.menu-toggle { display: none; }
@media (max-width: 860px) {
  .icon-btn.menu-toggle { display: inline-flex; }
  .nav.collapsible { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--paper); border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; padding: 8px 16px 16px; }
  .nav.collapsible.open { display: flex; }
}

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer; transition: transform .06s ease, background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { border-color: var(--ink-faint); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--ink) 88%, var(--redpen)); }
.btn-accent { background: var(--redpen); border-color: var(--redpen); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--redpen); border-color: color-mix(in srgb, var(--redpen) 40%, var(--line)); }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: .85rem; border-radius: 8px; }
.btn-lg { min-height: 52px; padding: 14px 24px; font-size: 1.05rem; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn-block { width: 100%; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--ink-muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon { width: 20px; height: 20px; flex: none; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-flat { box-shadow: none; }
.card h2, .card h3 { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.panel { background: var(--surface-2); border-radius: var(--radius); padding: 16px; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .value { font-family: var(--font-display); font-size: var(--step-2); font-weight: 600; line-height: 1; }
.stat .label { color: var(--ink-muted); font-size: var(--step--1); }

/* Forms */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.field .hint { font-size: var(--step--1); color: var(--ink-muted); margin-top: 4px; font-weight: 400; }
input:not([type]), input[type=text], input[type=email], input[type=date], input[type=file], input[type=password], input[type=number], input[type=search], input[type=url], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 1rem;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--ink); flex: none; }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.inline-form { display: inline; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; }

/* Alerts & chips */
.alert { padding: 12px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; }
.alert-success { background: var(--tick-soft); border-color: color-mix(in srgb, var(--tick) 35%, transparent); }
.alert-error { background: var(--redpen-soft); border-color: color-mix(in srgb, var(--redpen) 35%, transparent); }
.alert-warn { background: var(--partial-soft); border-color: color-mix(in srgb, var(--partial) 35%, transparent); }
.alert-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--focus) 25%, transparent); }
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-2); color: var(--ink-muted); white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.chip-ok { background: var(--tick-soft); color: var(--tick); }
.chip-warn { background: var(--partial-soft); color: var(--partial); }
.chip-bad { background: var(--redpen-soft); color: var(--redpen); }
.chip-info { background: var(--info-soft); color: var(--focus); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--ink-muted); letter-spacing: .02em; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: left; font-weight: 600; color: var(--ink-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .table.stack-mobile thead { display: none; }
  .table.stack-mobile tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .table.stack-mobile td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 6px 14px; }
  .table.stack-mobile td::before { content: attr(data-label); color: var(--ink-muted); font-size: .8rem; font-weight: 600; }
}

/* Page header */
.page-head { padding: 28px 0 16px; display: flex; gap: 16px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.crumbs { font-size: var(--step--1); color: var(--ink-muted); margin-bottom: 6px; }
.crumbs a { color: inherit; }

/* App shell */
.app-shell { padding-bottom: 64px; }
.balance-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: .9rem; text-decoration: none; }
.balance-pill strong { font-family: var(--font-display); }

/* Stepper */
.stepper { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 20px; counter-reset: step; flex-wrap: wrap; }
.stepper li { counter-increment: step; display: flex; align-items: center; gap: 8px; color: var(--ink-muted); font-weight: 600; font-size: .9rem; }
.stepper li::before { content: counter(step); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: .8rem; }
.stepper li.done::before { content: "✓"; background: var(--tick); color: #fff; }
.stepper li.current { color: var(--ink); }
.stepper li.current::before { background: var(--ink); color: var(--paper); }
.stepper li + li::after { order: -1; content: ""; width: 24px; height: 2px; background: var(--line); }

/* Upload */
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 24px; text-align: center; background: var(--surface); transition: border-color .15s, background .15s; }
.dropzone.drag { border-color: var(--focus); background: var(--info-soft); }
.dropzone p { margin: .25rem 0; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 12px; }
.thumb { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface-2); aspect-ratio: 3/4; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .n { position: absolute; left: 6px; top: 6px; background: var(--ink); color: var(--paper); font-size: .7rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; }
.thumb .warn { position: absolute; left: 6px; bottom: 6px; right: 6px; background: var(--partial-soft); color: var(--partial); font-size: .68rem; font-weight: 700; padding: 2px 6px; border-radius: 6px; }
.thumb .tools { position: absolute; right: 4px; top: 4px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.thumb:hover .tools, .thumb:focus-within .tools { opacity: 1; }
.thumb .tools button { width: 28px; height: 28px; border-radius: 6px; border: 0; background: var(--surface); color: var(--ink); cursor: pointer; box-shadow: var(--shadow); font-size: .8rem; }
.thumb.dragging { opacity: .4; }
.thumb.picked { outline: 3px solid var(--focus); }
.thumb.pending { display: grid; place-items: center; color: var(--ink-muted); font-size: .75rem; text-align: center; padding: 6px; }
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--ink); width: 0; transition: width .2s; }
@media (hover: none) { .thumb .tools { opacity: 1; } }

/* Camera */
.camera { position: fixed; inset: 0; background: #000; z-index: 90; display: flex; flex-direction: column; color: #fff; }
.camera video, .camera canvas { width: 100%; height: 100%; object-fit: contain; }
.camera .stage { position: relative; flex: 1; overflow: hidden; touch-action: none; }
.camera .bar { display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); align-items: center; justify-content: space-between; background: rgba(0,0,0,.75); }
.camera .shutter { width: 68px; height: 68px; border-radius: 50%; border: 4px solid #fff; background: var(--redpen); cursor: pointer; }
.camera .handle { position: absolute; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%; border: 3px solid #fff; background: rgba(215,38,61,.6); touch-action: none; cursor: grab; }
.camera svg.quad { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.camera .msg { position: absolute; left: 16px; right: 16px; top: 16px; padding: 8px 12px; border-radius: 8px; background: rgba(0,0,0,.6); font-size: .9rem; text-align: center; }
.camera .count { font-weight: 700; }

/* Result view */
.score-hero { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.score-ring { position: relative; width: 140px; height: 140px; flex: none; display: grid; place-items: center; }
.score-ring svg { position: absolute; inset: 0; }
.score-ring .num { font-family: var(--font-display); font-size: 2rem; font-weight: 700; line-height: 1; text-align: center; color: var(--redpen); }
.score-ring .num small { display: block; font-size: .85rem; color: var(--ink-muted); font-weight: 500; margin-top: 4px; font-family: var(--font-body); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 24px 0 16px; overflow-x: auto; }
.tabs button, .tabs a { background: none; border: 0; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--ink-muted); border-bottom: 2px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; }
.tabs [aria-selected="true"] { color: var(--ink); border-bottom-color: var(--redpen); }
.q-list { display: flex; flex-direction: column; gap: 10px; }
.q { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.q > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; }
.q > summary::-webkit-details-marker { display: none; }
.q .q-label { font-family: var(--font-display); font-weight: 700; min-width: 3.2em; }
.q .q-score { margin-left: auto; font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums; }
.q .q-body { padding: 0 16px 16px; border-top: 1px solid var(--line); }
.q .q-body h4 { margin: 14px 0 4px; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); font-family: var(--font-body); }
.q.dropped { opacity: .65; }
.verdict { font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; text-transform: capitalize; }
.verdict-correct { background: var(--tick-soft); color: var(--tick); }
.verdict-partial { background: var(--partial-soft); color: var(--partial); }
.verdict-incorrect, .verdict-unreadable { background: var(--redpen-soft); color: var(--redpen); }
.verdict-unattempted { background: var(--surface-2); color: var(--ink-muted); }
.rubric { list-style: none; padding: 0; margin: 0; }
.rubric li { display: flex; gap: 8px; padding: 4px 0; font-size: .92rem; }
.rubric .pts { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink-muted); white-space: nowrap; }
.prose { max-width: 70ch; }
.prose p:last-child { margin-bottom: 0; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.prose blockquote { border-left: 3px solid var(--line-strong); margin: 0 0 1em; padding-left: 12px; color: var(--ink-muted); }
.prose img { border-radius: 8px; }
.prose h2 { margin-top: 1.6em; } .prose h3 { margin-top: 1.3em; }

/* Page viewer with annotation overlay */
.viewer { display: flex; flex-direction: column; gap: 16px; }
.viewer-page { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.viewer-page img { display: block; width: 100%; height: auto; }
.viewer-page svg.overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.viewer-page .pin { cursor: pointer; }
.viewer-page .page-no { position: absolute; left: 8px; top: 8px; background: var(--ink); color: var(--paper); font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.viewer-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; position: sticky; top: 72px; z-index: 5; background: var(--paper); padding: 8px 0; }
.viewer.hide-overlay svg.overlay { display: none; }
.viewer.zoom-2 .viewer-page img { width: 200%; max-width: none; }
.viewer.zoom-2 .viewer-page { overflow: auto; }
.viewer.zoom-2 .viewer-page svg.overlay { width: 200%; height: auto; }
.highlight-flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
.popover { position: absolute; z-index: 10; max-width: 260px; background: var(--ink); color: var(--paper); padding: 8px 10px; border-radius: 8px; font-size: .85rem; box-shadow: var(--shadow); }
.pages-purged { padding: 24px; text-align: center; color: var(--ink-muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* Charts */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--ink-muted); font-size: 11px; font-family: var(--font-body); }
.chart .axis { stroke: var(--line-strong); }
.chart .grid-line { stroke: var(--line); }
.chart .bar { fill: var(--ink); }
.chart .bar.bad { fill: var(--redpen); }
.chart .bar.mid { fill: var(--partial); }
.chart .bar.good { fill: var(--tick); }
.chart .line { fill: none; stroke: var(--redpen); stroke-width: 2.5; }
.chart .dot { fill: var(--surface); stroke: var(--redpen); stroke-width: 2; }
.heat { border-collapse: collapse; font-size: .82rem; }
.heat th, .heat td { padding: 6px 8px; border: 1px solid var(--surface); text-align: center; }
.heat th { color: var(--ink-muted); font-weight: 600; }
.heat td { border-radius: 4px; font-variant-numeric: tabular-nums; }
.meter { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; min-width: 80px; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--ink); }
.meter.good > span { background: var(--tick); } .meter.mid > span { background: var(--partial); } .meter.bad > span { background: var(--redpen); }

/* Empty states */
.empty { text-align: center; padding: 40px 16px; color: var(--ink-muted); }
.empty svg { width: 96px; height: 96px; color: var(--line-strong); margin-bottom: 8px; }
.empty h3 { color: var(--ink); }

/* Modal & toast */
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); padding: 24px; max-width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(18,20,28,.45); }
.toast-wrap { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 95; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: .93rem; }
.toast.error { background: var(--redpen); color: #fff; }

/* Marketing */
.hero { padding: 56px 0 40px; background-image: repeating-linear-gradient(to bottom, transparent 0 31px, color-mix(in srgb, var(--line) 70%, transparent) 31px 32px); background-position: 0 12px; position: relative; }
.hero::before { content: ""; position: absolute; top: 0; bottom: 0; left: max(16px, calc(50% - 600px)); width: 2px; background: color-mix(in srgb, var(--redpen) 35%, transparent); }
.hero h1 { font-size: var(--step-4); max-width: 15ch; }
.hero .lede { font-size: var(--step-1); color: var(--ink-muted); max-width: 52ch; }
.hero-grid { display: grid; gap: 32px; align-items: center; grid-template-columns: 1.1fr 1fr; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }
.scribble { position: relative; display: inline-block; }
.scribble svg { position: absolute; left: -6%; top: -18%; width: 112%; height: 136%; pointer-events: none; color: var(--redpen); }
.section { padding: 56px 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 700; color: var(--redpen); margin-bottom: 8px; }
.steps { counter-reset: s; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.steps .card { position: relative; padding-top: 44px; }
.steps .card::before { counter-increment: s; content: counter(s); position: absolute; top: 14px; left: 20px; font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; color: var(--redpen); }
.feature h3 { display: flex; gap: 10px; align-items: center; }
.feature .icon { color: var(--redpen); }
.price-card { display: flex; flex-direction: column; gap: 8px; }
.price-card .price { font-family: var(--font-display); font-size: var(--step-3); font-weight: 700; }
.price-card.featured { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink), var(--shadow); }
.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq details p { margin: 8px 0 0; color: var(--ink-muted); }
.demo-frame { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 16px; transform: rotate(-.6deg); }
.legal-banner { background: var(--partial-soft); color: var(--partial); padding: 10px 14px; border-radius: 10px; font-weight: 600; margin-bottom: 20px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0 48px; margin-top: 48px; color: var(--ink-muted); font-size: .9rem; }
.site-footer .cols { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.site-footer h4 { color: var(--ink); font-family: var(--font-body); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 6px 0; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* Auth */
.auth { max-width: 440px; margin: 48px auto; padding: 0 16px; }
.auth .card { padding: 28px; }
.auth h1 { font-size: var(--step-2); }
.code-list { columns: 2; font-family: ui-monospace, monospace; font-size: 1rem; padding: 16px; background: var(--surface-2); border-radius: 10px; list-style: none; margin: 0 0 16px; }
.qr { width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: 8px; }

/* Print */
@media print {
  .site-header, .site-footer, .no-print, .tabs, .viewer-toolbar, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; }
  [role="tabpanel"][hidden] { display: block !important; }
  .q > .q-body { display: block !important; }
  details.q:not([open]) > .q-body { display: block; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Small screens: keep the header within the viewport */
@media (max-width: 640px) {
  .site-header .wrap { gap: 4px; }
  .logo { font-size: 1.2rem; }
  .logo svg { width: 24px; height: 24px; }
  .balance-pill { padding: 6px 10px; }
  .balance-pill .muted { display: none; }
  .site-header .btn-sm { padding: 6px 10px; }
  .page-head { padding-top: 20px; }
  .score-ring { width: 112px; height: 112px; }
  .score-ring .num { font-size: 1.6rem; }
  .card { padding: 16px; }
}
@media (max-width: 380px) { .site-header .btn-ghost.btn-sm { display: none; } }
