/* PaperShield — one typeface (Atkinson Hyperlegible, made for low vision), postal navy, outcome shown as a stamp. */
@font-face { font-family: 'Atkinson'; src: url('../vendor/fonts/atkinson-hyperlegible-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Atkinson'; src: url('../vendor/fonts/atkinson-hyperlegible-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --paper: #EEF3F6; --card: #FFFFFF; --ink: #0F2A30; --muted: #3F565C; --line: #CFDCE1; --panel: #E2EBEF;
  --brand: #0F6B6B; --brand-ink: #FFFFFF; --brand-soft: #DDF0EE; --focus: #1A5FD0; --brand-hi: #1D8C86; --brand-deep: #0A4F52; --accent: #B7791F;
  --o-none: #1C6E40; --o-action: #9A4A00; --o-help: #6A3FA0; --o-scam: #B42318; --o-cantRead: #3F565C; --o-notSure: #6A3FA0;
  --lamp-off: #2E3E44; --housing: #1B2A2F;
  --base: 20px; --scale: 1; --radius-btn: 14px; --radius-card: 18px; --tap: 56px; --bright: 1; --tools-h: 3.6rem;
  --bg-art: url('../assets/bg.svg');
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  body[data-theme="system"] { --paper: #0C1A1E; --card: #142629; --ink: #E6F0F2; --muted: #A9BEC4; --line: #2B4248; --panel: #1B3035; --brand: #5CC4BE; --brand-ink: #062023; --brand-soft: #173A3B;
    --o-none: #6FD69C; --o-action: #F2A85A; --o-help: #C9A8FF; --o-scam: #FF8A7F; --o-cantRead: #A9BEC4; --o-notSure: #C9A8FF; --lamp-off: #23353A; --housing: #07141A; --bg-art: url('../assets/bg-dark.svg'); }
}
body[data-theme="dark"] { --paper: #0C1A1E; --card: #142629; --ink: #E6F0F2; --muted: #A9BEC4; --line: #2B4248; --panel: #1B3035; --brand: #5CC4BE; --brand-ink: #062023; --brand-soft: #173A3B;
  --o-none: #6FD69C; --o-action: #F2A85A; --o-help: #C9A8FF; --o-scam: #FF8A7F; --o-cantRead: #A9BEC4; --o-notSure: #C9A8FF; --lamp-off: #23353A; --housing: #07141A; --bg-art: url('../assets/bg-dark.svg'); }
body[data-theme="light"] { color-scheme: light; }

/* ACC-02 profiles */
body[data-profile="large"] { --base: 24px; --tap: 64px; }
body[data-profile="lowvision"] { --base: 28px; --tap: 72px; --muted: var(--ink); --line: var(--ink); }
body[data-profile="contrast"] { --paper: #ffffff; --ink: #000000; --muted: #000000; --line: #000000; --panel: #ffffff; --brand: #000000; --brand-ink: #ffffff;
  --o-none: #005a1f; --o-action: #6b3c00; --o-help: #3d1f7a; --o-scam: #9a0000; }
body[data-profile="colorblind"] { --o-none: #0b5cad; --o-action: #b35a00; --o-help: #6a3d9a; --o-scam: #000000; }
body[data-profile="hearing"] { --base: 21px; }
/* Filters go on <html>, not <body>: a filter on <body> pushes fixed bars (camera, tools) off the screen. */
html.invert { filter: invert(1) hue-rotate(180deg) brightness(var(--bright)); }
html.dim:not(.invert) { filter: brightness(var(--bright)); }

* { box-sizing: border-box; }
html { font-size: calc(var(--base) * var(--scale)); -webkit-text-size-adjust: 100%; height: 100%; scroll-padding-top: env(safe-area-inset-top, 0px); }
@supports (font: -apple-system-body) { html { font: -apple-system-body; font-size: max(calc(var(--base) * var(--scale)), 1em); } } /* ACC-15 dynamic type on iOS */
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body { margin: 0; background: var(--paper) var(--bg-art) center top / 720px auto repeat-y; color: var(--ink); font-family: 'Atkinson', 'Atkinson Hyperlegible', Verdana, Tahoma, sans-serif; line-height: 1.5; min-height: 100%; }
main { max-width: 40rem; margin: 0 auto; padding: 0.75rem 1rem 9rem; }
body:not(.one-hand) main { padding-bottom: 2rem; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0.9rem 0 0.4rem; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.1rem; } h4 { font-size: 1rem; }
p { margin: 0.4rem 0; max-width: 34em; }
a { color: var(--brand); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
[tabindex="-1"]:focus { outline: none; }
.muted { color: var(--muted); }
.lead { font-size: 1.1rem; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: var(--tap); padding: 0.5rem 1.1rem; font: inherit; font-weight: 700;
  color: var(--ink); background: var(--paper); border: 2px solid var(--ink); border-radius: var(--radius-btn); cursor: pointer; text-decoration: none; text-align: center; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.ghost { border-color: var(--line); }
.btn.small { min-height: 44px; padding: 0.3rem 0.8rem; font-size: 0.9rem; }
.btn.big { width: 100%; min-height: calc(var(--tap) + 8px); font-size: 1.1rem; }
.btn.danger { border-color: var(--o-scam); color: var(--o-scam); }
.btn[aria-pressed="true"] { background: var(--panel); outline: 3px solid var(--brand); }
.btn:disabled { opacity: 0.45; }
.link { background: none; border: 0; color: var(--brand); font: inherit; text-decoration: underline; padding: 0.6rem 0.3rem; min-height: 44px; cursor: pointer; }
.row { display: flex; gap: 0.6rem; align-items: center; } .row.wrap { flex-wrap: wrap; } .row > .btn { flex: 1 1 auto; }
.stack { display: flex; flex-direction: column; gap: 0.6rem; margin: 0.8rem 0; list-style: none; padding: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { font: inherit; font-size: 0.95rem; min-height: 48px; padding: 0.3rem 0.9rem; border: 2px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink); cursor: pointer; }
.chip.ev { border-color: var(--brand); }

/* header */
.bar { display: flex; align-items: center; gap: 0.6rem; border-bottom: 2px solid var(--line); padding-bottom: 0.4rem; position: sticky; top: env(safe-area-inset-top, 0px); background: var(--paper); z-index: 5; }
.bar-title { font-size: 1.15rem; margin: 0.4rem 0; flex: 1; }
.back { min-height: 48px; padding: 0.2rem 0.7rem; }
.home-head { display: flex; justify-content: space-between; align-items: center; }
.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.1rem; }
.shield-mark { width: 4.5rem; height: 5.2rem; background: var(--brand); clip-path: path('M36 0 L72 12 V44 C72 68 52 82 36 90 C20 82 0 68 0 44 V12 Z'); }
.shield-mark.small { width: 1.6rem; height: 1.9rem; clip-path: polygon(50% 0, 100% 14%, 100% 50%, 50% 100%, 0 50%, 0 14%); }
.greet { font-size: 1.9rem; margin-top: 1.2rem; }

/* home */
.today { border-left: 6px solid var(--brand); padding: 0.2rem 0 0.2rem 0.9rem; margin: 0.6rem 0 1rem; }
.today-list { list-style: none; padding: 0; margin: 0; }
.today-item { display: grid; grid-template-columns: 2rem 1fr auto; gap: 0.6rem; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.today-item p { margin: 0; }
.b-icon { font-size: 1.4rem; }
.encourage { font-weight: 700; color: var(--o-none); }
.panic { width: 100%; text-align: left; font: inherit; font-weight: 700; color: var(--o-scam); background: var(--paper); border: 2px dashed var(--o-scam); border-radius: var(--radius-btn); min-height: var(--tap); padding: 0.7rem 1rem; cursor: pointer; }
.small-h { font-size: 1rem; color: var(--muted); }
.links { display: flex; flex-wrap: wrap; gap: 0.2rem 0.8rem; margin: 1rem 0; }
.dock { margin-top: 1.2rem; }
body.one-hand .dock { position: fixed; left: 0; right: 0; bottom: 0; padding: 0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom, 0px)); background: var(--paper); border-top: 2px solid var(--line); z-index: 6; }
body.one-hand .dock > * { max-width: 40rem; margin-left: auto; margin-right: auto; }
.camera-btn { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 1rem; align-items: center; width: 100%; min-height: 6.5rem; padding: 0.8rem 1.2rem;
  background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 22px; font: inherit; text-align: left; cursor: pointer; }
.cam-lens { grid-row: 1 / span 2; width: 3.6rem; height: 3.6rem; border-radius: 50%; border: 6px solid var(--brand-ink); box-shadow: inset 0 0 0 6px var(--brand); background: var(--brand-ink); }
.cam-label { font-size: 1.45rem; font-weight: 700; } .cam-sub { font-size: 0.95rem; opacity: 0.9; }
.dock-row { display: flex; gap: 0.5rem; margin-top: 0.5rem; } .dock-row > * { flex: 1; font-size: 0.9rem; }
.file { position: relative; }

/* onboarding */
.onboard { padding-top: 1rem; } .onboard .shield-mark { margin: 1rem 0; }
.field { display: flex; flex-direction: column; gap: 0.3rem; margin: 0.8rem 0; font-weight: 700; }
input[type=text], input[type=tel], input[type=number], select { font: inherit; font-weight: 400; min-height: var(--tap); padding: 0.4rem 0.7rem; border: 2px solid var(--ink); border-radius: 10px; background: var(--paper); color: var(--ink); }
input[type=range] { width: 100%; min-height: 44px; }
.check, .radio { display: flex; align-items: center; gap: 0.6rem; min-height: 48px; }
.check input, .radio input { width: 1.6rem; height: 1.6rem; accent-color: var(--brand); }
fieldset { border: 2px solid var(--line); border-radius: 12px; margin: 0.8rem 0; }
.yesno { margin: 0.8rem 0; } .yesno .q { font-weight: 700; }

/* camera */
.cam-wrap { position: relative; background: #000; border-radius: 16px; overflow: hidden; margin-top: 0.6rem; }
.cam-video { width: 100%; display: block; max-height: 62vh; object-fit: cover; }
.frame { position: absolute; inset: 6%; border: 4px dashed rgba(255,255,255,0.85); border-radius: 12px; }
.cam-hint { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; max-width: none; padding: 0.8rem; background: rgba(0,0,0,0.75); color: #fff; font-size: 1.2rem; font-weight: 700; text-align: center; }
.cam-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.6rem; margin-top: 0.8rem; }
.shutter { width: 5rem; height: 5rem; border-radius: 50%; border: 6px solid var(--brand); background: var(--paper); cursor: pointer; }
.pagecount { font-weight: 700; }
.crop-wrap { overflow: auto; } .crop-canvas { touch-action: none; display: block; max-width: 100%; }
.thumbs { display: flex; gap: 0.5rem; overflow-x: auto; margin: 0.8rem 0; } .thumbs img { height: 9rem; border: 2px solid var(--line); border-radius: 8px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--paper); padding: 0.6rem 0; }

/* progress */
.progress { text-align: left; padding-top: 2rem; }
.spinner { width: 3.5rem; height: 3.5rem; border-radius: 50%; border: 6px solid var(--line); border-top-color: var(--brand); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-steps { font-size: 1.1rem; } .progress-steps li.done { color: var(--o-none); font-weight: 700; }

/* RESULT — the stamp is the one bold element */
.sample-badge { display: inline-block; margin-top: 0.6rem; padding: 0.2rem 0.7rem; border: 2px dashed var(--muted); border-radius: 8px; font-weight: 700; color: var(--muted); }
.outcome { --c: var(--o-none); display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 0.9rem; margin: 1rem 0.2rem 0.4rem;
  padding: 0.9rem 1.1rem; border: 5px double var(--c); border-radius: 10px; color: var(--c); transform: rotate(-1.2deg); animation: stamp 0.35s ease-out both; }
.o-icon { grid-row: 1 / span 2; display: grid; place-items: center; width: 3.4rem; height: 3.4rem; border-radius: 50%; background: var(--c); color: var(--paper); font-size: 1.9rem; font-weight: 700; }
.o-word { font-size: 1.55rem; font-weight: 700; letter-spacing: 0.01em; }
.o-band { font-weight: 700; color: var(--ink); }
.o-none { --c: var(--o-none); } .o-action { --c: var(--o-action); } .o-help { --c: var(--o-help); } .o-scam { --c: var(--o-scam); } .o-cantRead { --c: var(--o-cantRead); } .o-notSure { --c: var(--o-notSure); }
@keyframes stamp { from { transform: rotate(-6deg) scale(1.15); opacity: 0; } to { transform: rotate(-1.2deg) scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .outcome, .spinner { animation: none; } * { scroll-behavior: auto !important; } }
.opening { font-size: 1.1rem; }
.headline { font-size: 1.85rem; margin: 0.6rem 0 0.8rem; }
.scam-count { font-size: 1.2rem; font-weight: 700; color: var(--o-scam); }
.verify, .notsure { border-left: 5px solid var(--o-help); padding-left: 0.8rem; }
.ignore { font-size: 1.05rem; }
.playback, .steps-card, .why, .notread, .belongs, .grounded, .understand, .actions, .teach, .dont, .four, .reminder, .type-confirm, .card {
  margin: 1rem 0; padding: 0.9rem 1rem; border: 2px solid var(--line); border-radius: 14px; }
.playback { background: var(--panel); border-color: var(--panel); } .playback .row { margin: 0.3rem 0; }
.ask-rest { display: flex; gap: 0.5rem; align-items: center; font-weight: 700; }
.dont { border-color: var(--o-scam); } .dont ul { list-style: none; padding: 0; font-weight: 700; } .dont li { padding: 0.25rem 0; }
.teach { border-style: dashed; }
.steps-card ol { font-size: 1.1rem; padding-left: 1.4rem; } .steps-card li { margin: 0.35rem 0; }
.four { padding: 0; } .q { border-bottom: 2px solid var(--line); } .q:last-child { border-bottom: 0; }
.q > summary { cursor: pointer; font-weight: 700; font-size: 1.15rem; padding: 0.8rem 1rem; min-height: var(--tap); list-style-position: inside; }
.q > :not(summary) { padding: 0 1rem 0.8rem; }
.why ul { padding-left: 1.2rem; } .checks { list-style: none; padding: 0; } .checks .found { color: var(--o-scam); font-weight: 700; }
.conf { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 1rem; } .conf dt { font-weight: 700; } .conf dd { margin: 0; }
.c-clear { color: var(--o-none); } .c-review { color: var(--o-action); font-weight: 700; } .c-cantTell { color: var(--o-scam); font-weight: 700; } .c-none { color: var(--muted); }
.answer, .level-out { font-size: 1.15rem; font-weight: 700; margin-top: 0.6rem; } .level-label { color: var(--muted); font-size: 0.95rem; }
.timeline { padding: 0.4rem 0; } .tl-line { height: 14px; background: var(--panel); border-radius: 7px; overflow: hidden; border: 2px solid var(--line); }
.tl-fill { display: block; height: 100%; background: var(--brand); } .timeline.band-overdue .tl-fill, .timeline.band-urgent .tl-fill { background: var(--o-scam); }
.tl-labels { display: flex; justify-content: space-between; font-size: 0.9rem; font-weight: 700; margin-top: 0.3rem; gap: 0.5rem; }
.trusted-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.6rem 0; }
.disclaimer { font-weight: 700; border-top: 2px solid var(--line); padding-top: 0.8rem; margin-top: 1.2rem; }
.privacy-note { font-size: 0.95rem; color: var(--muted); }
.side { display: grid; gap: 1rem; } @media (min-width: 720px) { .side { grid-template-columns: 1fr 1fr; } }
.orig-text { font-family: Georgia, 'Times New Roman', serif; font-size: 0.95rem; line-height: 1.6; background: var(--panel); padding: 0.6rem 0.8rem; border-radius: 10px; max-height: 24rem; overflow: auto; }
.orig-text p { margin: 0.1rem 0; }
.gloss { font: inherit; background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline dotted 2px; cursor: pointer; }
.definition { font-weight: 700; }
.fix-list li { margin: 0.4rem 0; font-size: 1.1rem; }
.type-line { font-weight: 700; color: var(--o-scam); }
.pill { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; border: 2px solid var(--c); color: var(--c); font-weight: 700; white-space: nowrap; }
.band-overdue { color: var(--o-scam); }

/* evidence */
.ev-wrap { position: relative; overflow: auto; max-height: 70vh; border: 2px solid var(--line); border-radius: 12px; margin-top: 0.6rem; }
.ev-canvas { display: block; touch-action: none; max-width: 100%; }
.lens { position: absolute; width: 260px; height: 120px; border: 4px solid var(--brand); border-radius: 14px; box-shadow: 0 6px 18px rgba(0,0,0,0.35); pointer-events: none; background: #fff; }
.ev-list { list-style: none; padding: 0; } .ev-item { display: flex; gap: 0.6rem; align-items: center; width: 100%; text-align: left; font: inherit; padding: 0.6rem; min-height: var(--tap); border: 2px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); margin: 0.3rem 0; cursor: pointer; }
.ev-dot { flex: none; width: 1rem; height: 1rem; border-radius: 50%; }

/* panic */
.panic-screen .huge { font-size: 2.6rem; font-weight: 700; color: var(--o-scam); }

/* tables, glossary */
.scroll-x { overflow-x: auto; } .rules { border-collapse: collapse; width: 100%; } .rules td { border-bottom: 1px solid var(--line); padding: 0.5rem; vertical-align: top; }
.gloss-list dt { font-weight: 700; margin-top: 0.6rem; } .gloss-list dd { margin: 0 0 0.4rem; }
.diagram { width: 100%; height: auto; margin-top: 0.6rem; }
.person { display: flex; justify-content: space-between; gap: 0.5rem; align-items: center; border-bottom: 1px solid var(--line); }

/* dialog, toast, flash */
.dialog { border: 3px solid var(--ink); border-radius: 16px; padding: 1.2rem; max-width: min(34rem, 92vw); background: var(--paper); color: var(--ink); }
.dialog::backdrop { background: rgba(0,0,0,0.55); }
.dlg-msg { font-size: 1.15rem; font-weight: 700; }
.preview { white-space: pre-wrap; font-family: inherit; font-size: 0.9rem; background: var(--panel); padding: 0.7rem; border-radius: 10px; max-height: 40vh; overflow: auto; }
#toast { position: fixed; left: 1rem; right: 1rem; bottom: calc(10rem + env(safe-area-inset-bottom, 0px)); max-width: 36rem; margin: 0 auto; display: flex; gap: 0.8rem; align-items: center; justify-content: space-between;
  padding: 0.8rem 1rem; background: var(--ink); color: var(--paper); border-radius: 12px; font-weight: 700; z-index: 20; }
#toast .btn { background: var(--paper); }
#toast[hidden] { display: none; }
.flash { position: fixed; inset: 0; z-index: 50; pointer-events: none; animation: flash 0.9s ease-out; }
.flash.scam { background: var(--o-scam); } .flash.due { background: var(--o-action); }
@keyframes flash { 0%, 40% { opacity: 0.7; } 100% { opacity: 0; } }
#print { display: none; }

@media print { /* ACC-19 large print */
  body * { visibility: hidden; } #print, #print * { visibility: visible; }
  #print { display: block; position: absolute; inset: 0; font-size: 28pt; line-height: 1.4; color: #000; filter: none; }
  #print h1 { font-size: 40pt; } #print .p-head { font-size: 34pt; font-weight: 700; }
}

/* static pages */
.doc { max-width: 40rem; margin: 0 auto; padding: 1rem 1rem 3rem; }
.doc h1 { font-size: 1.8rem; } .doc li { margin: 0.3rem 0; } .doc .back-link { display: inline-block; margin-bottom: 0.6rem; }
.doc table { border-collapse: collapse; width: 100%; } .doc td, .doc th { border-bottom: 1px solid var(--line); padding: 0.4rem; text-align: left; vertical-align: top; }

/* landing (DEM-06) */
.land section { margin: 2.2rem 0; }
.land .hero h1 { font-size: 2.3rem; margin-top: 1.4rem; }
.ba { display: grid; gap: 1rem; } @media (min-width: 720px) { .ba { grid-template-columns: 1fr 1fr; } }
.ba figure { margin: 0; } .ba figcaption { font-weight: 700; margin-bottom: 0.4rem; }
.dense { font-family: Georgia, serif; font-size: 0.72rem; line-height: 1.25; text-align: justify; background: var(--panel); padding: 0.8rem; border-radius: 10px; color: var(--muted); }
.story { counter-reset: s; list-style: none; padding: 0; } .story li { counter-increment: s; padding: 0.6rem 0 0.6rem 3rem; position: relative; border-bottom: 1px solid var(--line); }
.story li::before { content: counter(s); position: absolute; left: 0; top: 0.5rem; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; }

/* =====================================================================
   DESIGN C — calm and trusted. Soft blue-grey page, white cards, teal.
   Headings and short lines centred; long paragraphs stay left for easy reading.
   ===================================================================== */
body[data-profile="contrast"] { --bg-art: none; --card: #ffffff; }
body.has-tools { padding-top: calc(var(--tools-h) + env(safe-area-inset-top, 0px)); }
body.has-tools main { padding-bottom: 7rem; }
body.has-tools.one-hand main { padding-bottom: 15rem; }

/* centred headings and short lines */
h1, h2, h3, .lead, .opening, .headline, .greet, .bar-title, .scam-count, .encourage, .small-h, .progress, .progress h1 { text-align: center; }
h1, h2, h3, .lead, .opening, .headline { margin-left: auto; margin-right: auto; }
.progress-steps { display: inline-block; text-align: left; }
.progress .spinner { margin: 0 auto 0.6rem; }
.today h2, .card h2, .card h3 { text-align: center; }
.sample-badge { display: block; width: fit-content; margin: 0.8rem auto 0; }

/* cards: white, soft, rounded */
.card, .playback, .steps-card, .why, .notread, .belongs, .grounded, .understand, .actions, .teach, .dont, .four, .reminder, .type-confirm, .today, fieldset, .orig-text {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-card); }
.today { border-left: 1px solid var(--line); padding: 0.6rem 1rem; }
.playback { background: var(--brand-soft); border-color: transparent; }
.dont { border: 2px solid var(--o-scam); }
.teach { border-style: dashed; }

/* buttons */
.btn { background: var(--card); color: var(--brand); border: 2px solid var(--line); border-radius: var(--radius-btn); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.ghost { background: var(--card); color: var(--brand); border-color: var(--line); }
.btn:hover { border-color: var(--brand); }
.chip { background: var(--card); border: 1.5px solid var(--line); color: var(--ink); }
.chip:hover, .chip:focus-visible { border-color: var(--brand); }
.panic { background: var(--card); text-align: center; }
.camera-btn { background: var(--brand); border-radius: 24px; }
.cam-lens { box-shadow: inset 0 0 0 6px var(--brand); }
.links { justify-content: center; }
input[type=text], input[type=tel], input[type=number], select { background: var(--card); border: 2px solid var(--line); border-radius: 12px; }
input:focus-visible, select:focus-visible { border-color: var(--brand); }
body.one-hand .dock { background: color-mix(in srgb, var(--paper) 92%, transparent); border-top: 1px solid var(--line); backdrop-filter: blur(6px); }

/* header bar: title centred between back and an empty slot */
.bar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); column-gap: 0.4rem; background: color-mix(in srgb, var(--paper) 94%, transparent); border-bottom: 1px solid var(--line);
  padding-top: 0.2rem; }
body.has-tools .bar { top: calc(var(--tools-h) + env(safe-area-inset-top, 0px)); }
.bar > :first-child { justify-self: start; } .bar::after { content: ''; }
.bar-title { overflow-wrap: anywhere; }
html, body { overflow-x: clip; }
main, .card, .outcome { min-width: 0; overflow-wrap: anywhere; }
.home-head { padding: 0.4rem 0; }
.brand { color: var(--ink); font-size: 1.15rem; }

/* logo */
.logo { display: inline-block; flex: none; }
.logo svg { width: 100%; height: 100%; display: block; overflow: visible; }
.lg-stop1 { stop-color: var(--brand-hi); } .lg-stop2 { stop-color: var(--brand-deep); }
.lg-shield { stroke: var(--brand-deep); stroke-width: 1.6; stroke-linejoin: round; }
.lg-rim { fill: none; stroke: #ffffff; stroke-opacity: 0.28; stroke-width: 1.2; }
.lg-page { fill: #ffffff; } .lg-fold { fill: #CFE6E3; }
.lg-lines { fill: none; stroke: #0F6B6B; stroke-opacity: 0.55; stroke-width: 2.2; stroke-linecap: round; }
.lg-badge { fill: var(--accent); stroke: #ffffff; stroke-width: 2.2; }
.lg-check { fill: none; stroke: #ffffff; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.onboard > p, .onboard > .lead { text-align: center; }
.onboard .logo { display: block; margin: 0.6rem auto 0.2rem; }
.logo-anim .lg-shield { fill-opacity: 0; stroke-dasharray: 220; stroke-dashoffset: 220; animation: lgDraw 0.9s ease-out forwards, lgFill 0.5s ease-out 0.75s forwards; }
.logo-anim .lg-rim { opacity: 0; animation: lgRise 0.5s ease-out 0.9s forwards; }
.logo-anim .lg-letter { opacity: 0; transform: translateY(7px); transform-box: fill-box; animation: lgRise 0.5s ease-out 1s forwards; }
.logo-anim .lg-badge { opacity: 0; transform: scale(0.3); transform-origin: 44px 50px; animation: lgPop 0.4s cubic-bezier(.3,1.5,.6,1) 1.35s forwards; }
.logo-anim .lg-check { stroke-dasharray: 16; stroke-dashoffset: 16; animation: lgDraw 0.4s ease-out 1.65s forwards; }
@keyframes lgDraw { to { stroke-dashoffset: 0; } }
@keyframes lgFill { to { fill-opacity: 1; } }
@keyframes lgRise { to { opacity: 1; transform: none; } }
@keyframes lgPop { to { opacity: 1; transform: scale(1); } }

/* RESULT: white card, traffic-light signal on top, answer in words below */
.outcome { --c: var(--o-none); display: flex; flex-direction: column; align-items: center; gap: 0.6rem; text-align: center; margin: 1rem 0 0.6rem;
  padding: 1.1rem 1rem 1rem; background: var(--card); border: 1px solid var(--line); border-top: 6px solid var(--c); border-radius: var(--radius-card);
  color: var(--c); transform: none; animation: rise 0.45s ease-out both; }
.outcome .o-icon { display: inline-grid; width: 2.2rem; height: 2.2rem; font-size: 1.3rem; margin-right: 0.5rem; vertical-align: middle; }
.o-word { font-size: 1.5rem; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; }
.o-band { color: var(--ink); background: var(--panel); border-radius: 14px; padding: 0.25rem 0.9rem; max-width: 100%; }
.outcome.o-none { --c: var(--o-none); } .outcome.o-action { --c: var(--o-action); } .outcome.o-help { --c: var(--o-help); } .outcome.o-scam { --c: var(--o-scam); }
.outcome.o-cantRead { --c: var(--o-cantRead); } .outcome.o-notSure { --c: var(--o-notSure); }
.outcome .o-icon { background: var(--c); color: var(--card); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.signal { display: flex; gap: 0.55rem; padding: 0.5rem 0.7rem; background: var(--housing); border-radius: 999px; }
.lamp { width: min(2.3rem, 12vw); height: min(2.3rem, 12vw); border-radius: 50%; background: var(--lamp-off); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 1.15rem; }
.lamp.on { box-shadow: 0 0 0 4px color-mix(in srgb, var(--lc) 35%, transparent); transform: scale(1.12); }
.lamp-scam.on { --lc: #E5372A; background: #E5372A; }
.lamp-help.on { --lc: #8B5CD6; background: #7B4CC8; }
.lamp-action.on { --lc: #F08A1C; background: #D9730D; }
.lamp-none.on { --lc: #2EA866; background: #1F8A50; }
.lamp.pulse { animation: lampPulse 2s ease-in-out 3; }
@keyframes lampPulse { 0%, 100% { box-shadow: 0 0 0 4px rgba(229,55,42,0.35); } 50% { box-shadow: 0 0 0 13px rgba(229,55,42,0.55); filter: brightness(1.25); } }

/* always-on tools: magnifier + text size on top, listen at the bottom */
#tools-top { position: fixed; top: 0; left: 0; right: 0; z-index: 30; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  height: calc(var(--tools-h) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 0.75rem 0;
  background: var(--card); border-bottom: 1px solid var(--line); font-size: 18px; }
.tool { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 48px; min-width: 48px; padding: 0.2rem 0.9rem; font: inherit; font-weight: 700;
  color: var(--brand); background: var(--brand-soft); border: 2px solid transparent; border-radius: 999px; cursor: pointer; }
.tool[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
.tool-group { display: flex; gap: 0.4rem; }
.tool-a { justify-content: center; padding: 0 0.7rem; } .a-small { font-size: 16px; } .a-big { font-size: 22px; }
.tool-ic { font-size: 20px; }
.fab { position: fixed; right: 1rem; bottom: 1rem; z-index: 30; display: inline-flex; align-items: center; gap: 0.5rem; min-height: 60px; padding: 0 1.3rem;
  font: inherit; font-size: 19px; font-weight: 700; color: var(--brand-ink); background: var(--brand); border: 3px solid var(--card); border-radius: 999px;
  box-shadow: 0 6px 18px rgba(8, 40, 44, 0.28); cursor: pointer; }
.fab.on { background: var(--o-scam); }
.fab-ic { font-size: 22px; }

.mag-lens { position: fixed; z-index: 40; width: 13rem; height: 13rem; border-radius: 50%; border: 5px solid var(--brand); background: var(--paper);
  box-shadow: 0 10px 30px rgba(8, 40, 44, 0.35), inset 0 0 0 3px var(--card); touch-action: none; cursor: grab; }
.mag-lens[hidden] { display: none; }
.mag-lens.dragging { cursor: grabbing; }
.lens-view { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; background: var(--paper) var(--bg-art) center / 720px auto; }
.lens-clone { position: absolute; left: 0; top: 0; margin: 0 !important; transform-origin: 0 0; pointer-events: none; }
.lens-clone .dock { position: static !important; }
.lens-close { position: absolute; top: -0.4rem; right: -0.4rem; width: 3rem; height: 3rem; border-radius: 50%; border: 3px solid var(--card); background: var(--ink); color: var(--card);
  font-size: 1.2rem; font-weight: 700; cursor: pointer; }

/* static pages share the same calm look */
.doc h1 { text-align: center; }
.doc table, .doc .card { background: var(--card); }

@media (prefers-reduced-motion: reduce) {
  .logo-anim * { animation: none !important; opacity: 1 !important; transform: none !important; stroke-dashoffset: 0 !important; fill-opacity: 1 !important; }
  .lamp.pulse, .outcome { animation: none; }
}

/* =====================================================================
   STAGE 2 — summary, letter view, speed slider, keep/delete, first-run pictures
   ===================================================================== */
.center { text-align: center; margin-left: auto; margin-right: auto; }
.say { display: flex; align-items: center; justify-content: center; gap: 0.3rem; margin: 0.7rem auto 0; min-height: 44px; padding: 0.3rem 1rem; font: inherit; font-size: 0.95rem; font-weight: 700;
  color: var(--brand); background: var(--brand-soft); border: 0; border-radius: 999px; cursor: pointer; }
.say:hover { outline: 2px solid var(--brand); }

/* Letter summary */
.summary h3 { margin-top: 0.2rem; }
.sum-list { display: grid; grid-template-columns: minmax(7rem, auto) 1fr; gap: 0 0.9rem; margin: 0.6rem 0 0; }
.sum-list dt { font-weight: 700; color: var(--muted); padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.sum-list dd { margin: 0; padding: 0.45rem 0; border-bottom: 1px solid var(--line); font-weight: 700; }
.sum-list dt:last-of-type, .sum-list dd:last-of-type { border-bottom: 0; }
@media (max-width: 460px) { .sum-list { grid-template-columns: 1fr; } .sum-list dt { border-bottom: 0; padding-bottom: 0; } }

.see-row { display: flex; justify-content: center; margin: 0.8rem 0; }
.see-row .btn.big { max-width: 26rem; }
.letter-pages { display: flex; flex-direction: column; gap: 1rem; margin: 0.8rem 0; }
.letter-canvas, .letter-img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); background: #fff; box-shadow: 0 4px 16px rgba(8, 40, 44, 0.12); }
.line-crop { display: block; max-width: 100%; height: auto; margin: 0.4rem auto; border-radius: 8px; background: #fff; }

/* Purple: ask someone you trust */
.btn.help-send, .btn.primary.help-send { background: var(--o-help); border-color: var(--o-help); color: var(--card); }
.help-send { margin: 0.6rem 0; }

/* Speed slider: turtle to rabbit */
.speed { margin: 0.8rem 0 0.2rem; }
.speed-title { font-weight: 700; text-align: center; margin: 0 auto 0.2rem; }
.speed-row { display: flex; align-items: center; gap: 0.6rem; }
.speed-end { font-size: 1.8rem; line-height: 1; }
.speed input[type=range] { flex: 1; accent-color: var(--brand); height: 44px; }
.speed-labels { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; color: var(--muted); }
.speed-out { font-weight: 700; color: var(--ink); }

/* I don't understand */
.level-label { display: flex; align-items: center; gap: 0.5rem; justify-content: center; font-weight: 700; color: var(--brand); font-size: 1rem; }
.level-n { display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-size: 0.95rem; }
.simple { list-style: none; padding: 0; margin: 0.4rem 0; } .simple li { padding: 0.35rem 0; font-size: 1.15rem; }
.understand .muted { font-weight: 400; font-size: 0.95rem; text-align: center; margin-left: auto; margin-right: auto; }

/* Keep or delete */
.keep { text-align: center; }
.keep .stack { max-width: 26rem; margin-left: auto; margin-right: auto; }
.keep-ok { font-size: 1.15rem; font-weight: 700; color: var(--o-none); margin-left: auto; margin-right: auto; }
.saved-list { list-style: none; padding: 0; margin: 0.4rem 0 0; }
.saved-item { display: grid; grid-template-columns: 2.4rem 1fr; gap: 0.3rem 0.7rem; align-items: start; padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.saved-item:last-child { border-bottom: 0; }
.saved-item p { margin: 0.1rem 0; }
.saved-dot { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--c, var(--brand)); color: var(--card); font-weight: 700; }
.saved-item.o-none { --c: var(--o-none); } .saved-item.o-action { --c: var(--o-action); } .saved-item.o-help { --c: var(--o-help); } .saved-item.o-scam { --c: var(--o-scam); }
.saved-btns { grid-column: 2; display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* First-run screens */
.ob-step { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; color: var(--muted); font-size: 0.9rem; text-align: center; margin: 0.4rem auto 0; }
.ob-dots { display: flex; gap: 0.4rem; } .ob-dots span { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--line); } .ob-dots span.on { background: var(--brand); width: 1.8rem; border-radius: 999px; }
.ob-pic { display: block; width: min(20rem, 100%); height: auto; margin: 0.6rem auto; }
.trust-line { display: block; max-width: 30rem; margin: 0.8rem auto; padding: 0.7rem 1rem; text-align: center; font-weight: 700; color: var(--ink); background: var(--brand-soft); border-radius: 14px; }
.ob-outcomes { list-style: none; padding: 0; margin: 0.6rem auto; max-width: 24rem; display: grid; gap: 0.5rem; }
.ob-outcomes li { --c: var(--o-none); display: flex; align-items: center; gap: 0.7rem; padding: 0.5rem 0.8rem; background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--c); border-radius: 12px; font-weight: 700; color: var(--ink); }
.ob-outcomes li.o-action { --c: var(--o-action); } .ob-outcomes li.o-help { --c: var(--o-help); } .ob-outcomes li.o-scam { --c: var(--o-scam); }
.ob-lamp { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--c); color: var(--card); flex: none; font-weight: 700; }
.ob-tools { text-align: center; margin-left: auto; margin-right: auto; }
.onboard .row { margin-top: 1rem; }
.onboard > .btn.big { margin-top: 0.6rem; }
.onboard > .link { display: block; margin: 0.4rem auto; }

/* short lines and buttons centred; long paragraphs stay left */
.four-say { padding: 0 1rem 0.8rem; }
.trusted-row, .row { justify-content: center; }
.privacy-note, .disclaimer { text-align: center; margin-left: auto; margin-right: auto; }
.disclaimer { max-width: none; }
.ignore, .verify, .notsure { max-width: none; }

/* static pages: logo in the header, same calm look */
.doc .brand { justify-content: center; margin: 0.6rem 0; }
.doc .lead, .doc .hero p { text-align: center; margin-left: auto; margin-right: auto; }
.doc .back-link { min-height: 44px; display: inline-flex; align-items: center; }
.doc-foot { text-align: center; margin: 2rem auto 0; }

/* Fixed bars (tools on top, camera bar and Listen at the bottom) grow with A+ only up to a limit,
   so at the biggest text they never cover the letter or cut their own words. */
:root { --tools-h: 64px; }
#tools-top { font-size: 18px; padding-left: 10px; padding-right: 10px; gap: 6px; }
#tools-top .tool { padding: 0.2em 0.8em; gap: 0.35em; }
#tools-top .tool-a { padding: 0 0.55em; }
#tools-top .tool-group { gap: 6px; }
@media (max-width: 360px) { #mag-btn span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }
.fab { right: 16px; padding: 0 1.2em; }
body.one-hand .dock { font-size: clamp(16px, 1rem, 22px); padding: 0.6em 1em calc(0.6em + env(safe-area-inset-bottom, 0px)); }
.dock .camera-btn { grid-template-columns: auto minmax(0, 1fr); min-height: 5.6em; padding: 0.7em 1.1em; column-gap: 0.9em; }
.dock .cam-lens { width: 3.2em; height: 3.2em; border-width: 0.3em; }
.dock .cam-label { font-size: 1.4em; overflow-wrap: normal; } .dock .cam-sub { font-size: 0.9em; }
.dock .dock-row > * { font-size: 0.9em; }
.dock .btn { min-height: 52px; }
body.has-tools.one-hand main { padding-bottom: calc(11em + 6rem); }
#toast { bottom: calc(9.5rem + env(safe-area-inset-bottom, 0px)); }

/* "Skip to content" link: hidden until it gets keyboard focus, then clearly visible.
   (Found by an AI test agent and confirmed by a fixed tap-size check: before this it stayed 1x1 px even when focused.) */
a.sr:focus, a.sr:focus-visible { position: fixed; z-index: 60; top: 8px; left: 8px; width: auto; height: auto; clip: auto; white-space: normal; overflow: visible;
  padding: 0.7rem 1.1rem; min-height: 48px; background: var(--brand); color: var(--brand-ink); border-radius: 12px; font-weight: 700; text-decoration: none; }
.say[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }

/* More space between sample-letter buttons, so a shaky tap does not land on the wrong one
   (found by the AI "hand tremor" test agent and confirmed by a fixed tap check). */
.demo-row .chips { gap: 0.9rem; }
.demo-row .chip { min-height: 56px; padding: 0.4rem 1.1rem; }
