/* COH-830 check flow (index.html). The review queue keeps styles.css.
   Cohort tokens (design-system.md): navy text scale, #2563EB primary, 48px
   comfortable controls with 8px radius, 12px cards, Google Sans, Lucide icons,
   green for success only, no gradients on buttons or cards.

   On a phone every step fits the screen without scrolling (founder request,
   22 October); tools/ui_check.mjs measures that at 390x664 and 360x640. A
   computer only hands off to the phone and follows it: those steps, and the
   result it follows to, use a two-column layout (body[data-layout="split"]).
   Every URL is relative so the page also works under /proxy/8830/. */
@font-face {
  font-family: "Google Sans";
  src: url("GoogleSans.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
:root {
  --bg: #F1F2F4;
  --surface: #FFFFFF;
  --surface-sunken: #F7F8F9;
  --text: #091E42;
  --text-subtle: #44546F;
  --text-subtlest: #626F86;
  --border: #DCDFE4;
  --border-bold: #B3B9C4;
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-subtle: #EFF5FF;
  --primary-tint: #DBEAFE;
  --info-text: #0C4A9E;
  --focus: #60A5FA;
  --success: #1D7A54;
  --success-bold: #22A06B;
  --success-subtle: #E6F7EE;
  --warning: #8D6900;
  --warning-bold: #F5CD47;
  --warning-subtle: #FEF8E6;
  --danger: #CA3521;
  --danger-text: #AE2A19;
  --danger-subtle: #FEECEC;
  --ink: #0B1220;
  --radius: 8px;
  --radius-card: 12px;
  color-scheme: light;
}

* { box-sizing: border-box; }
/* Components below set display; the hidden attribute must still win. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--surface); color: var(--text);
  font: 16px/1.5 "Google Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
main {
  flex: 1 1 auto; display: flex; flex-direction: column; width: 100%; max-width: 480px; margin: 0 auto;
  padding: 20px 20px max(20px, env(safe-area-inset-bottom)); outline: none;
}
h1 { font-size: 26px; line-height: 32px; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 20px; line-height: 26px; margin: 0; font-weight: 600; }
h3 { font-size: 15px; line-height: 22px; margin: 0 0 4px; font-weight: 600; }
p { margin: 0; }
.lead { margin-top: 8px; color: var(--text-subtle); font-size: 16px; line-height: 24px; }
.hint { color: var(--text-subtlest); font-size: 14px; line-height: 20px; }
.center { text-align: center; }
.kicker { margin-bottom: 4px; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--primary); }

.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.topbar {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  height: 56px; padding: 0 20px; padding-top: env(safe-area-inset-top); background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: block; height: 18px; width: auto; }
/* Georgian / English (i18n.js): a quiet text button at the end of the bar. */
.lang-switch {
  margin-left: auto; min-height: 32px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text-subtle); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.lang-switch:hover { color: var(--text); border-color: var(--text-subtle); }
.lang-switch[hidden] { display: none; }

/* A step fills the screen; its actions sit at the bottom like a native flow,
   and stay pinned in view if a small phone still runs out of room. */
.step { flex: 1 0 auto; display: flex; flex-direction: column; gap: 20px; }
.grow { flex: 1 0 auto; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.row > .button { flex: 1 1 140px; min-width: 0; }
.step-actions {
  margin-top: auto; position: sticky; bottom: 0; z-index: 1; display: flex; flex-direction: column; gap: 12px;
  padding-top: 8px; background: var(--surface);
}
.step-actions > p:empty { display: none; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.row > .field { flex: 1 1 120px; justify-content: flex-end; }

/* ------------------------------------------------------------- controls */
.label { font-weight: 600; font-size: 14px; }
.input {
  height: 48px; border: 1px solid var(--border-bold); border-radius: var(--radius); padding: 0 12px;
  font: inherit; color: var(--text); background: var(--surface); width: 100%;
}
select.input { appearance: auto; }
.input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger-text); font-size: 14px; line-height: 20px; }
.banner { border-radius: var(--radius); padding: 12px 14px; font-size: 14px; line-height: 20px; }
.banner.error { background: var(--danger-subtle); color: var(--danger-text); }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 48px; padding: 0 20px; border-radius: var(--radius); border: 1px solid transparent;
  font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; text-align: center; text-decoration: none;
}
.button.primary { background: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-hover); }
.button.secondary { background: var(--surface); color: var(--text); border-color: var(--border-bold); }
.button.secondary:hover { background: var(--surface-sunken); }
.button.quiet { background: transparent; color: var(--primary); min-height: 40px; }
.button.quiet:hover { background: var(--primary-subtle); }
.button:disabled { background: #E9EBEE; color: var(--text-subtlest); border-color: transparent; cursor: not-allowed; }
.link-button {
  display: inline; padding: 0; border: 0; background: none; font: inherit; color: var(--primary); font-weight: 600;
  text-align: inherit; cursor: pointer;
}
.link-button:hover { text-decoration: underline; text-underline-offset: 2px; }
.link-button:disabled { color: var(--text-subtlest); cursor: default; text-decoration: none; }
.icon-button {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.16); color: #fff;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.icon-button .i { width: 22px; height: 22px; }
.icon-button.plain { background: transparent; color: var(--text-subtle); -webkit-backdrop-filter: none; backdrop-filter: none; }
.icon-button.plain:hover { background: var(--bg); }
.button:focus-visible, .input:focus-visible, .link-button:focus-visible, .option:focus-visible, .icon-button:focus-visible,
.consent input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* -------------------------------------------------------------- content */
.art { display: flex; justify-content: center; }
.art img { display: block; width: 100%; max-width: 272px; height: auto; }

.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.rows li { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; align-items: start; }
.rows strong { display: block; font-size: 15px; line-height: 22px; font-weight: 600; }
.rows .sub { display: block; font-size: 14px; line-height: 20px; color: var(--text-subtle); }
.tile {
  width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: var(--primary-subtle); color: var(--primary);
}

/* Explicit, unticked consent. */
.consent {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-card);
  background: var(--surface-sunken); border: 1px solid var(--border); font-size: 14px; line-height: 20px; color: var(--text-subtle); cursor: pointer;
}
.consent input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--primary); }

/* Choice rows: tapping one continues. Every row takes the tallest row's
   height, so a longer line (or a translation) never makes them uneven. */
.options { display: grid; grid-auto-rows: 1fr; gap: 12px; }
.option {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) 20px; gap: 16px; align-items: center; width: 100%; padding: 16px;
  border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface);
  font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.option:hover { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
/* While the chosen document's check is being created (one tap, one check). */
.option:disabled { cursor: progress; }
.option img { width: 56px; height: 40px; display: block; }
.option .title { display: block; font-weight: 600; line-height: 22px; }
.option .sub { display: block; font-size: 14px; line-height: 20px; color: var(--text-subtle); }
.option .i { color: var(--text-subtlest); }

.note { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; font-size: 14px; line-height: 20px; background: var(--primary-subtle); color: var(--info-text); }

/* Good and bad example photos. */
.example { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.example-good { position: relative; border-radius: var(--radius-card); overflow: hidden; background: var(--ink); aspect-ratio: 16 / 9; }
.example-good img, .example-bad img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.step[data-document="ge_id_card"] .example-good { background: #252a33; aspect-ratio: 8 / 5; }
.step[data-document="ge_id_card"] .example-good img {
  inset: 50% auto auto 50%; width: 72%; height: auto; transform: translate(-50%, -50%) rotate(-1.5deg);
  filter: drop-shadow(0 3px 5px rgb(0 0 0 / 25%));
}
.examples-bad { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.example-bad { display: flex; flex-direction: column; gap: 6px; }
.example-bad .frame { position: relative; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; background: var(--ink); }
.mark {
  position: absolute; right: 8px; bottom: 8px; width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: #fff; background: var(--success-bold); box-shadow: 0 0 0 2px #fff;
}
.mark .i { width: 14px; height: 14px; stroke-width: 3; }
.mark.bad { background: var(--danger); width: 20px; height: 20px; right: 6px; bottom: 6px; }
.mark.bad .i { width: 12px; height: 12px; }
.example-label { font-size: 14px; line-height: 20px; color: var(--text-subtle); }
.example-label strong { color: var(--text); font-weight: 600; }
.example-bad .example-label { font-size: 13px; text-align: center; }

/* Centred states: checking, results, problems. */
.state { flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; }
.state .lead { margin-top: 0; max-width: 340px; }
.badge {
  width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none;
  background: var(--primary-subtle); color: var(--primary); box-shadow: 0 0 0 10px #F7FAFF;
}
.badge .i { width: 32px; height: 32px; stroke-width: 2.25; }
.badge.ok { background: var(--success-subtle); color: var(--success); box-shadow: 0 0 0 10px #F3FBF7; }
.badge.warn { background: var(--warning-subtle); color: var(--warning); box-shadow: 0 0 0 10px #FFFCF2; }
.badge.err { background: var(--danger-subtle); color: var(--danger-text); box-shadow: 0 0 0 10px #FFF7F7; }
.progress-bar { width: 168px; height: 4px; border-radius: 999px; background: #E9EBEE; overflow: hidden; position: relative; }
.progress-bar::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; border-radius: inherit; background: var(--primary); animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { from { left: -40%; } to { left: 100%; } }
.spinner { width: 40px; height: 40px; margin: 8px auto; border-radius: 50%; border: 4px solid var(--border); border-top-color: var(--primary); animation: spin 0.9s linear infinite; }
.spinner.small { width: 18px; height: 18px; border-width: 3px; margin: 0; border-color: rgba(12, 74, 158, 0.25); border-top-color: currentColor; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- camera */
body[data-step="camera"] { overflow: hidden; }
body[data-step="camera"] .topbar { display: none; }
.step.camera-step { position: fixed; inset: 0; z-index: 10; display: block; background: var(--ink); color: #fff; }
.step.camera-step[hidden] { display: none; }
.camera-view { position: absolute; inset: 0; overflow: hidden; }
.camera-view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera-view[data-mode="selfie"] video { transform: scaleX(-1); }
.camera-view.flash::after { content: ""; position: absolute; inset: 0; background: #fff; opacity: 0; animation: flash 0.3s ease-out; }
@keyframes flash { from { opacity: 0.8; } to { opacity: 0; } }
/* The guide: corner brackets over a dark scrim, placed by layoutFrame(). */
.camera-frame {
  --gc: #fff;
  position: absolute; border-radius: 18px; box-shadow: 0 0 0 200vmax rgba(5, 10, 24, 0.66); transition: background-color 0.2s;
}
.camera-frame .c { position: absolute; width: 36px; height: 36px; border: 4px solid var(--gc); transition: border-color 0.2s; }
.camera-frame .tl { top: -3px; left: -3px; border-right: 0; border-bottom: 0; border-top-left-radius: 20px; }
.camera-frame .tr { top: -3px; right: -3px; border-left: 0; border-bottom: 0; border-top-right-radius: 20px; }
.camera-frame .bl { bottom: -3px; left: -3px; border-right: 0; border-top: 0; border-bottom-left-radius: 20px; }
.camera-frame .br { bottom: -3px; right: -3px; border-left: 0; border-top: 0; border-bottom-right-radius: 20px; }
.camera-frame[data-quality="warn"] { --gc: var(--warning-bold); }
.camera-view[data-mode="selfie"] .camera-frame { border-radius: 50%; outline: 3px solid var(--gc); }
.camera-view[data-mode="selfie"] .camera-frame .c { display: none; }
.frame-done {
  position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%;
  display: none; align-items: center; justify-content: center; background: var(--success-bold); color: #fff;
  box-shadow: 0 0 0 8px rgba(34, 160, 107, 0.3);
}
.frame-done .i { width: 32px; height: 32px; stroke-width: 3; }
/* After the shutter: the picture freezes while it is checked, then a tick. */
.camera-step[data-phase="checking"] .camera-frame,
.camera-step[data-phase="accepted"] .camera-frame { background: rgba(5, 10, 24, 0.35); }
.camera-step[data-phase="accepted"] .camera-frame { --gc: #4BCE97; }
.camera-step[data-phase="accepted"] .frame-done { display: flex; }
.camera-step:not([data-phase="live"]) .camera-option { visibility: hidden; }
/* Flash check (COH-834): the screen around the oval becomes the colour. */
.camera-view.flashing .camera-frame { transition: none; outline-color: var(--flash); box-shadow: 0 0 0 200vmax var(--flash); }

.camera-top {
  position: absolute; top: 0; left: 0; right: 0; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 16px 0;
}
.camera-progress { justify-self: center; display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.85); }
.camera-progress .dots { display: flex; gap: 4px; }
.camera-progress .dots i { width: 18px; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.3); }
.camera-progress .dots i.on { background: #fff; }
.camera-instructions {
  position: absolute; top: calc(max(12px, env(safe-area-inset-top)) + 60px); left: 20px; right: 20px;
  max-width: 560px; margin: 0 auto; text-align: center;
}
.camera-instructions h1 { font-size: 22px; line-height: 28px; margin: 0; color: #fff; outline: none; }
.camera-instructions p { margin-top: 6px; font-size: 15px; line-height: 22px; color: rgba(255, 255, 255, 0.82); }
.camera-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 0 16px max(24px, env(safe-area-inset-bottom));
}
.camera-status {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 40px; padding: 8px 16px; border-radius: 999px;
  text-align: center; font-size: 15px; font-weight: 600; line-height: 20px; color: #fff; background: rgba(9, 30, 66, 0.72);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.camera-status:empty { visibility: hidden; }
.camera-status[data-tone="warn"] { background: var(--warning-bold); color: #3D2E00; }
.camera-status[data-tone="busy"]::before {
  content: ""; width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff; animation: spin 0.9s linear infinite;
}
.camera-status[data-tone="ok"]::before {
  content: ""; width: 18px; height: 18px; flex: none;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234BCE97' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M20 6 9 17l-5-5'/></svg>") center / contain no-repeat;
}
.camera-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: 100%; max-width: 360px; }
.camera-controls .shutter { grid-column: 2; }
.shutter {
  width: 76px; height: 76px; padding: 5px; border-radius: 50%; border: 4px solid #fff; background: transparent; cursor: pointer;
}
.shutter::after { content: ""; display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; transition: transform 0.1s; }
.shutter:active::after { transform: scale(0.92); }
.shutter:disabled { opacity: 0.45; cursor: default; }
.camera-option {
  grid-column: 1; justify-self: start; position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: #fff; cursor: pointer;
}
.shutter:focus-visible, .camera-option:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }

.camera-step[data-failed] .camera-instructions, .camera-step[data-failed] .camera-bottom { display: none; }
.camera-fallback {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 24px 20px; background: var(--ink); text-align: center;
}
.camera-fallback > * { width: 100%; max-width: 400px; }
.camera-fallback .badge { width: 72px; background: rgba(255, 255, 255, 0.08); color: #fff; box-shadow: none; }
.camera-fallback h2 { color: #fff; }
.camera-fallback p { color: rgba(255, 255, 255, 0.82); margin-bottom: 8px; }
.camera-fallback .button.secondary { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.5); }

/* "Now the back": the card turns over once, over the live camera. */
.camera-flip {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
  padding: 24px; text-align: center; background: rgba(5, 10, 24, 0.9); perspective: 900px; cursor: pointer;
}
.flip-card { position: relative; width: 200px; aspect-ratio: 1.586; transform-style: preserve-3d; animation: turn 1.2s cubic-bezier(.5, 0, .2, 1) 0.3s forwards; }
.flip-card img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 12px; backface-visibility: hidden; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45); }
.flip-card img + img { transform: rotateY(180deg); }
@keyframes turn { to { transform: rotateY(180deg); } }
.flip-text { font-size: 22px; line-height: 28px; font-weight: 600; color: #fff; }
.flip-sub { margin-top: 6px; font-size: 15px; color: rgba(255, 255, 255, 0.8); }

/* ---------------------------------------------------------------- review */
.review-step { gap: 16px; }
.review-media { display: flex; justify-content: center; min-height: 0; }
.review-media img { display: block; width: 100%; max-height: 40vh; object-fit: contain; border-radius: var(--radius-card); background: var(--ink); }
.review-media[data-mode="none"] { display: none; }
.review-step #review-badge { align-self: center; margin: 12px 0 4px; }
.review-status { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--primary-subtle); color: var(--info-text); font-size: 14px; line-height: 20px; }
.review-status[data-tone="ok"] { background: var(--success-subtle); color: var(--success); }
.review-status[data-tone="warn"] { background: var(--warning-subtle); color: var(--warning); }
.review-status[data-tone="error"] { background: var(--danger-subtle); color: var(--danger-text); }
.review-status-icon { flex: none; display: flex; padding-top: 1px; }
.review-status-body { min-width: 0; }
.review-status-body p { font-weight: 600; }
.warnings { margin: 4px 0 0; padding-left: 18px; }

/* ---------------------------------------------------------------- result */
.result-step { gap: 0; }
.result-main, .result-body { flex: 1 0 auto; display: flex; flex-direction: column; gap: 20px; }
.hero { flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; }
.hero h2 { font-size: 24px; line-height: 30px; }
.hero > p { color: var(--text-subtle); max-width: 360px; }
.hero > p.hint { color: var(--text-subtlest); font-size: 14px; }
.hero .badge { margin-bottom: 8px; }
.summary {
  width: 100%; list-style: none; margin: 4px 0 0; padding: 2px 16px; border: 1px solid var(--border); border-radius: var(--radius-card);
  text-align: left; font-size: 15px; line-height: 22px;
}
.summary li { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.summary li + li { border-top: 1px solid var(--border); }
.summary .i { width: 18px; height: 18px; color: var(--success); stroke-width: 2.5; }
.retake-item {
  width: 100%; display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 14px; align-items: center; padding: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-card); text-align: left;
}
.retake-item.no-thumb { grid-template-columns: minmax(0, 1fr); }
.retake-item .thumb { aspect-ratio: 1.53; border-radius: 8px; overflow: hidden; background: var(--ink); }
.retake-item .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; filter: blur(1.4px); }
.retake-item strong { display: block; font-size: 15px; line-height: 22px; font-weight: 600; }
.retake-item span span { display: block; font-size: 14px; line-height: 20px; color: var(--text-subtle); }
.hero-actions { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.tester-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; font-size: 13px; color: var(--text-subtlest); }
.tester-tools .link-button { font-size: 13px; }
.split-only, .result-aside { display: none !important; }

/* Tester details (in a sheet). */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0;
}
.notice { background: #E8F2FC; border-color: #BFDBFE; }
.prose ul { margin: 0 0 8px; padding-left: 20px; }
.prose li { margin-bottom: 4px; }
.prose p { margin-bottom: 8px; }
.prose h3 { margin-top: 12px; }
.slot-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.status-chip {
  font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 999px;
  background: var(--bg); color: var(--text-subtle); white-space: nowrap;
}
.status-chip[data-state="ok"] { background: var(--success-subtle); color: var(--success); }
.status-chip[data-state="warn"] { background: var(--warning-subtle); color: var(--warning); }
.status-chip[data-state="error"] { background: var(--danger-subtle); color: var(--danger-text); }
.facts { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 4px 12px; margin: 0; font-size: 14px; }
.facts dt { color: var(--text-subtlest); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.reasons { margin: 0; padding-left: 20px; font-size: 14px; color: var(--text-subtle); }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; margin: 8px 0 0; }
details summary { cursor: pointer; font-weight: 600; min-height: 24px; }

/* ---------------------------------------------------------------- sheets */
dialog.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; margin: auto auto 0; padding: 0; border: 0;
  border-radius: 20px 20px 0 0; background: var(--surface); color: var(--text);
}
dialog.sheet[open] { display: flex; flex-direction: column; }
dialog.sheet::backdrop { background: rgba(9, 30, 66, 0.5); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 8px 8px 20px; border-bottom: 1px solid var(--border); }
.sheet-body { overflow-y: auto; padding: 16px 20px max(20px, env(safe-area-inset-bottom)); }
body:has(dialog[open]) { overflow: hidden; }

/* ------------------------------------------------- computer: hand off only */
.split-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.split-head .brand { height: 20px; }
.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.stepper li { display: flex; flex-direction: column; gap: 10px; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--text-subtlest); }
.stepper li::before { content: ""; height: 4px; border-radius: 99px; background: var(--border); }
.stepper li.done { color: var(--text); }
.stepper li.done::before { background: var(--primary); }
.stepper li.now { color: var(--primary); }
.stepper li.now::before { background: var(--primary-tint); box-shadow: inset 40px 0 0 var(--primary); }
.stepper li.fail { color: var(--danger-text); }
.stepper li.fail::before { background: var(--danger); }
.needs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px 28px; font-size: 15px; color: var(--text-subtle); }
.needs li { display: inline-flex; align-items: center; gap: 10px; }
.needs .i { color: var(--text-subtlest); }
.handoff-card { display: flex; flex-direction: column; align-items: center; gap: 24px; text-align: center; }
/* The QR sits inside the same corner brackets as the phone's camera guide. */
.target { position: relative; padding: 24px; }
.target .c { position: absolute; width: 40px; height: 40px; border: 4px solid var(--primary); }
.target .tl { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 20px; }
.target .tr { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 20px; }
.target .bl { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 20px; }
.target .br { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 20px; }
.qr { width: 248px; height: 248px; padding: 12px; border-radius: 16px; background: #fff; box-shadow: 0 1px 2px rgba(9, 30, 66, 0.08), 0 12px 32px rgba(9, 30, 66, 0.08); }
.qr svg { display: block; width: 100%; height: 100%; }
.live { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; color: var(--text-subtle); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.5); } 70%, 100% { box-shadow: 0 0 0 8px rgba(37, 99, 235, 0); } }
.big-ring {
  position: relative; width: 168px; height: 168px; display: flex; align-items: center; justify-content: center; border-radius: 50%;
  background: #fff; color: var(--primary); box-shadow: 0 12px 32px rgba(9, 30, 66, 0.08);
}
.big-ring::before { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 4px solid var(--primary-tint); border-top-color: var(--primary); animation: spin 1.4s linear infinite; }
.big-ring .i { width: 64px; height: 64px; stroke-width: 1.5; }
.aside-status { font-size: 18px; line-height: 26px; font-weight: 600; text-align: center; max-width: 320px; }
.big-seal {
  width: 168px; height: 168px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff;
  background: var(--warning-bold); box-shadow: 0 0 0 16px rgba(245, 205, 71, 0.2);
}
.big-seal .i { width: 76px; height: 76px; stroke-width: 2.5; }
.result-step[data-tone="positive"] .big-seal { background: var(--success-bold); box-shadow: 0 0 0 16px rgba(34, 160, 107, 0.14); }
.result-step[data-tone="negative"] .big-seal { background: var(--danger); box-shadow: 0 0 0 16px rgba(202, 53, 33, 0.12); }
.result-step[data-tone="positive"] .result-aside { background: var(--success-subtle); }

body[data-layout="split"] { background: var(--surface); }
body[data-layout="split"] .topbar { display: none; }
body[data-layout="split"] main { max-width: none; padding: 0; }
body[data-layout="split"] .step.split,
body[data-layout="split"] .result-step { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; gap: 0; }
.split-main, body[data-layout="split"] .result-main { display: flex; flex-direction: column; padding: 28px clamp(32px, 6vw, 72px) 32px; gap: 0; }
.split-body, body[data-layout="split"] .result-body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 32px; max-width: 520px; padding: 24px 0; }
.split-body h1 { font-size: 38px; line-height: 46px; letter-spacing: -0.02em; }
.split-body .lead { font-size: 17px; line-height: 26px; max-width: 460px; }
.split-aside { background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 48px; text-align: center; }
.desk-actions .button { width: auto; }
body[data-layout="split"] .split-only { display: flex !important; }
body[data-layout="split"] .stepper.split-only { display: grid !important; }
body[data-layout="split"] .result-aside { display: flex !important; }
body[data-layout="split"] .result-step .hero { flex: 0 0 auto; align-items: flex-start; text-align: left; }
body[data-layout="split"] .result-step .hero h2 { font-size: 34px; line-height: 42px; }
body[data-layout="split"] .result-step .hero .badge { display: none; }
body[data-layout="split"] .result-step .step-actions { position: static; margin-top: 0; }
body[data-layout="split"] .result-step .row > .button { flex: 0 1 auto; width: auto; }
body[data-layout="split"] .result-step .tester-tools { justify-content: flex-start; }
/* Below a laptop width the code stacks under the text. */
@media (max-width: 860px) {
  body[data-layout="split"] .step.split, body[data-layout="split"] .result-step { grid-template-columns: 1fr; }
  .split-body h1 { font-size: 30px; line-height: 38px; }
}

/* A computer running the phone flow (only where the server allows it). */
@media (min-width: 640px) {
  main { padding-top: 40px; }
  .step-actions { position: static; }
  dialog.sheet { margin: auto; border-radius: var(--radius-card); max-height: 85vh; }
}

/* Short phones: the intro illustration is decoration, so the words win the
   space; everything else tightens a little. */
@media (max-height: 799px) {
  .intro-art { display: none; }
}
@media (max-height: 700px) {
  main { padding-top: 16px; }
  .step { gap: 16px; }
  h1 { font-size: 24px; line-height: 30px; }
  .lead { margin-top: 6px; }
  .rows { gap: 12px; }
  .consent { padding: 10px 14px; }
  .step-actions { gap: 10px; }
  .art img { max-width: 200px; }
  .example-good { aspect-ratio: 2 / 1; }
  .examples-bad .example-bad .frame { aspect-ratio: 4 / 3; }
  .badge { width: 60px; height: 60px; box-shadow: none; }
  .badge .i { width: 28px; height: 28px; }
  .hero { gap: 10px; }
  .hero h2 { font-size: 22px; line-height: 28px; }
  .camera-instructions { top: calc(max(12px, env(safe-area-inset-top)) + 52px); }
  .camera-instructions h1 { font-size: 20px; line-height: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .spinner, .progress-bar::after, .big-ring::before, .camera-status[data-tone="busy"]::before { animation-duration: 4s; }
  .flip-card { animation: none; transform: rotateY(180deg); }
  .camera-view.flash::after { animation: none; }
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
