/* noRecognition Tester — the backer-facing experience.
 *
 * DESIGN INTENT
 *
 * A person opening this is doing something that should feel consequential:
 * standing in front of a surveillance model to find out, for themselves,
 * whether a printed pattern makes them harder to see. The page is organised
 * around that one act: set up, watch the live verdict, review and share. The
 * live view is the hero; everything else is secondary and folds away.
 *
 * COLOR IS MEANING, NOT DECORATION
 *   ink    (near-black on warm paper) — the voice and the structure
 *   green  — PROTECTED. on your device, yours, not detected.
 *   red    — detected, delete, a real failure.
 *   amber  — a caution that is not yet a failure.
 *
 * Light only, by standing instruction: warm paper, dark ink, one accent, a
 * faint dot grid so it never reads as stark white. No dark mode.
 *
 * TYPE avoids a webfont on purpose (CSP font-src 'self', and nothing to wait
 * for on a phone tether): a heavy system sans for the display voice, a Georgia
 * italic for the human line, and a monospace for anything a machine measured.
 *
 * CSP is style-src 'self': no inline style attributes anywhere. Dynamic sizes
 * (the confidence meter) are set through the CSSOM, which CSP allows.
 */

:root {
  --paper: #f6f3ea;
  --panel: #fdfbf6;
  --sunk: #f1ece0;
  --raise: #fffdf8;
  --ink: #14100b;
  --ink-2: #3d372d;
  --dim: #6b6151;
  --faint: #7d7364;
  --line: #e7dfcd;
  --line-2: #d6cbb2;

  --accent: #1d2b46;
  --accent-2: #142138;
  --accent-wash: #eaeef5;

  --protect: #157347;
  --protect-2: #0f5c37;
  --protect-wash: #e9f5ee;
  --danger: #b3261e;
  --danger-2: #8f1d17;
  --danger-wash: #fbecea;
  --amber: #9a5d08;
  --amber-wash: #fbf3e6;

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --sans:
    system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --serif: Georgia, "Times New Roman", serif;

  --r: 18px;
  --r-md: 12px;
  --r-sm: 9px;
  --shadow: 0 1px 2px rgb(20 16 11 / 4%), 0 18px 40px -24px rgb(20 16 11 / 22%);
  --shadow-lg: 0 2px 4px rgb(20 16 11 / 5%), 0 30px 60px -30px rgb(20 16 11 / 30%);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-color: var(--paper);
  background-image: radial-gradient(rgb(20 16 11 / 5%) 1px, transparent 1px);
  background-size: 22px 22px;
}

a {
  color: var(--accent);
  text-underline-offset: 2px;
}

.wrap {
  max-width: 1120px;
  margin-inline: auto;
  padding: 0 24px 72px;
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgb(246 243 234 / 82%);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid rgb(214 203 178 / 60%);
}
.topbar-in {
  max-width: 1120px;
  margin-inline: auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}
.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background:
    radial-gradient(circle at 50% 50%, var(--paper) 0 3px, transparent 3.5px),
    conic-gradient(from 45deg, var(--protect) 0 25%, var(--ink) 0 50%, var(--protect) 0 75%, var(--ink) 0);
  flex: none;
}
.brand b {
  font-size: 17px;
  font-weight: 780;
  letter-spacing: -0.015em;
}
.brand-sub {
  font: 650 11px var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--protect-2);
  background: var(--protect-wash);
  border: 1px solid #c6e6d3;
  padding: 2px 8px;
  border-radius: 999px;
}
.grow {
  flex: 1;
}
#backend {
  font: 500 11.5px var(--mono);
  color: var(--faint);
}
.navlink {
  font: 600 14px var(--sans);
  color: var(--ink-2);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
}
.navlink:hover {
  background: var(--sunk);
  color: var(--ink);
}

/* ---------- intro ---------- */

.intro {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 28px;
  align-items: end;
  padding: 34px 0 22px;
  animation: rise 0.6s var(--ease) both;
}
.intro h1 {
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-weight: 830;
  margin: 0 0 12px;
  text-wrap: balance;
}
.intro .lede {
  margin: 0;
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 56ch;
}
.intro .lede a {
  color: var(--protect-2);
  font-weight: 650;
  white-space: nowrap;
}
.howto {
  list-style: none;
  counter-reset: how;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.howto li {
  counter-increment: how;
  display: grid;
  grid-template-columns: 30px 1fr;
  column-gap: 12px;
  align-items: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px 14px;
}
.howto li::before {
  content: counter(how);
  grid-row: span 2;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 750 13px var(--sans);
  color: #fff;
  background: var(--ink);
}
.howto b {
  font-size: 14.5px;
  line-height: 1.3;
}
.howto span {
  font-size: 13px;
  line-height: 1.45;
  color: var(--dim);
}

/* ---------- eyebrow ---------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 650 11px var(--sans);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--protect-2);
  background: var(--protect-wash);
  border: 1px solid #c6e6d3;
  padding: 5px 11px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--protect);
  box-shadow: 0 0 0 0 rgb(21 115 71 / 45%);
  animation: pulse 2.4s ease-out infinite;
}

/* ---------- panels ---------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px 22px;
  margin-top: 16px;
  box-shadow: var(--shadow);
  animation: rise 0.5s var(--ease) both;
}
.panel > h2,
.labhead h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 760;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 16px;
}
.stepnum {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font: 750 13px var(--sans);
  color: #fff;
  background: var(--ink);
  flex: none;
}

/* ---------- the stage: video + controls ---------- */

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
  gap: 16px;
  align-items: start;
}
.stage > .panel {
  margin-top: 0;
}
.stage-video {
  padding: 12px;
}
.stage-controls {
  position: sticky;
  top: 74px;
}

.videowrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 68vh;
  background:
    radial-gradient(ellipse at center, #2a221a 0%, #15110d 70%);
  border-radius: calc(var(--r) - 6px);
  overflow: hidden;
}
.videowrap video,
.videowrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.videowrap canvas {
  pointer-events: none;
}
.hud {
  position: absolute;
  top: 14px;
  left: 14px;
  font: 700 13px var(--mono);
  color: #fff;
  background: rgb(179 38 30 / 88%);
  padding: 7px 12px;
  border-radius: 8px;
  letter-spacing: 0.04em;
}
.livedot {
  position: absolute;
  top: 14px;
  right: 14px;
  display: none;
  align-items: center;
  gap: 7px;
  font: 750 11px var(--sans);
  letter-spacing: 0.14em;
  color: #fff;
  background: rgb(20 16 11 / 55%);
  padding: 6px 10px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}
.livedot span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff4b3e;
  animation: blink 1.4s ease-in-out infinite;
}
body[data-run="running"] .livedot {
  display: inline-flex;
}
.framing {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  font: 650 15px var(--sans);
  color: #fff;
  background: rgb(20 16 11 / 66%);
  padding: 9px 18px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  white-space: nowrap;
  max-width: calc(100% - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.2s ease;
}
.framing.good {
  background: rgb(21 115 71 / 86%);
}
.framing.far,
.framing.near {
  background: rgb(154 93 8 / 88%);
}
.framing.none,
.framing.unknown {
  background: rgb(20 16 11 / 62%);
}
.framing.seen {
  background: rgb(179 38 30 / 88%);
}

/* live numbers under the video */
#live {
  display: grid;
  grid-template-columns: 1.2fr 1.4fr auto;
  gap: 10px;
  margin-top: 12px;
}
#live > div {
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px 14px;
  min-width: 0;
}
#live .k {
  display: block;
  font: 650 10.5px var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
#live .k .dim {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
#live b {
  font: 750 19px/1.25 var(--mono);
  font-variant-numeric: tabular-nums;
}
.verdict-tile b {
  display: block;
  font-family: var(--sans) !important;
  font-size: 20px !important;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
#live b.seen {
  color: var(--danger);
}
#live b.clear {
  color: var(--protect-2);
}
#live .verdict-tile:has(b.seen) {
  background: var(--danger-wash);
  border-color: #efc9c5;
}
#live .verdict-tile:has(b.clear) {
  background: var(--protect-wash);
  border-color: #bfe0cd;
}
.conf-tile {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
}
.conf-tile .k {
  grid-column: 1 / -1;
}
.meter {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--sunk);
  border: 1px solid var(--line);
  overflow: visible;
}
.meter .fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  border-radius: 999px;
  background: var(--protect);
  transition: width 0.12s linear;
}
.meter .fill.seen {
  background: var(--danger);
}
.meter .line {
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: 75%;
  width: 2px;
  background: var(--ink);
  border-radius: 2px;
}
.mini-tiles {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.mini-tiles > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.mini-tiles b {
  font-size: 14px !important;
}

/* ---------- form controls ---------- */

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 14px;
}
.lbltxt {
  font: 650 13px var(--sans);
  color: var(--ink-2);
}
.opt {
  font-weight: 500;
  color: var(--faint);
  margin-left: 4px;
}
label.inline {
  flex-direction: row;
  align-items: center;
  gap: 9px;
  margin: 0;
  min-height: 44px;
  font-size: 14px;
  color: var(--ink-2);
}
.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

select,
input[type="text"],
input[type="email"],
input[type="url"],
input[type="number"] {
  width: 100%;
  font: 15px var(--sans);
  padding: 11px 13px;
  min-height: 46px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--raise);
  color: var(--ink);
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
select:hover:not(:disabled),
input:hover:not(:disabled) {
  border-color: #c3b699;
}
select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%236b6151' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
  text-overflow: ellipsis;
}
select:disabled,
input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
input:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(29 43 70 / 18%);
}
button:focus-visible,
summary:focus-visible,
a:focus-visible,
.chip:has(input:focus-visible),
.choice:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input::placeholder {
  color: var(--faint);
}
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--protect);
  flex: none;
}

/* "More options" disclosure inside the setup card */
details.more {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--raise);
  margin: 2px 0 16px;
}
details.more > summary {
  cursor: pointer;
  list-style: none;
  padding: 11px 14px;
  font: 650 13.5px var(--sans);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
details.more > summary::-webkit-details-marker {
  display: none;
}
details.more > summary::after,
details.fold > summary::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--dim);
  border-bottom: 2px solid var(--dim);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s var(--ease);
  flex: none;
}
details[open].more > summary::after,
details[open].fold > summary::after {
  transform: rotate(-135deg) translateY(-2px);
}
.more-body {
  padding: 2px 14px 4px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
/* detection-line slider */
.rangefield {
  margin: 0 0 16px;
}
.rangefield label {
  margin: 0 0 4px;
}
.rangefield .lbltxt {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.rangeval {
  font: 750 15px var(--mono);
  color: var(--ink);
}
input[type="range"] {
  width: 100%;
  height: 28px;
  margin: 0;
  accent-color: var(--ink);
  cursor: pointer;
}
input[type="range"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.rangescale {
  display: flex;
  justify-content: space-between;
  font: 500 11.5px var(--sans);
  color: var(--faint);
  margin-bottom: 6px;
}
.rangefield p {
  margin: 0;
  line-height: 1.5;
}
.rangefield .linklike {
  min-height: 0;
  font-weight: 650;
  color: var(--accent);
  margin-left: 4px;
}
.custombadge {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background: var(--amber-wash);
  border: 1px solid #ecd9b6;
  color: var(--amber);
  font: 650 13px var(--sans);
}

label.switch {
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-2);
  cursor: pointer;
}
label.switch input {
  margin-top: 2px;
}
label.switch:has(#xray:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}
#xraynote {
  display: block;
  font-style: italic;
}

/* ---------- buttons ---------- */

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 12px;
}
button {
  font: 650 14px var(--sans);
  padding: 10px 17px;
  min-height: 42px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--raise);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    box-shadow 0.14s ease,
    transform 0.06s ease;
}
button:hover:not(:disabled) {
  background: var(--sunk);
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
button.primary:hover:not(:disabled) {
  background: var(--accent-2);
}
button.destructive {
  color: var(--danger);
  border-color: #e6c4c1;
}
button.destructive:hover:not(:disabled) {
  background: var(--danger-wash);
}
button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}
button svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.runbar {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 10px;
}
button.big {
  min-height: 54px;
  font-size: 16px;
  border-radius: var(--r-md);
}
#start.primary {
  background: var(--protect);
  border-color: var(--protect);
  box-shadow: 0 10px 22px -12px rgb(21 115 71 / 70%);
}
#start.primary:hover:not(:disabled) {
  background: var(--protect-2);
}
body[data-run="running"] #stop {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  box-shadow: 0 10px 22px -12px rgb(179 38 30 / 70%);
}
body[data-run="running"] #stop:hover {
  background: var(--danger-2);
}
body[data-run="preparing"] #start .lbl::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid rgb(255 255 255 / 40%);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -1px;
  animation: spin 0.7s linear infinite;
}

.linklike {
  background: none;
  border: none;
  padding: 0;
  min-height: 0;
  font: inherit;
  color: var(--dim);
  text-decoration: underline;
  cursor: pointer;
}
.linklike:hover:not(:disabled) {
  background: none;
  color: var(--ink);
}

/* ---------- notes and status ---------- */

.why {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-2);
  background: var(--sunk);
  border-radius: var(--r-md);
  padding: 12px 15px;
  margin: 0 0 14px;
}
.why + .why {
  margin-top: -4px;
}
.why strong {
  color: var(--ink);
}
.why strong.local {
  color: var(--protect-2);
}

.status {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--dim);
  margin: 12px 0 0;
  min-height: 1em;
}
.status:empty {
  min-height: 0;
  margin: 0;
}
.status.ok {
  color: var(--protect-2);
}
.status.warn {
  color: var(--amber);
}
.status.err {
  color: var(--danger);
}
.small {
  font-size: 12.5px;
}
.dim {
  color: var(--dim);
}
.mono {
  font-family: var(--mono);
}
.warn {
  color: var(--amber);
}

.readout {
  font-size: 13px;
  color: var(--ink-2);
}
#modelnote {
  margin: -6px 0 14px;
}
#modelnote:empty {
  display: none;
}
.readout.warnnote {
  background: var(--amber-wash);
  border: 1px solid #ecd9b6;
  border-radius: var(--r-sm);
  padding: 10px 13px;
  line-height: 1.5;
}

/* ---------- result + share ---------- */

.sharesummary {
  border-radius: var(--r-md);
  padding: 18px 20px;
  border: 1px solid var(--line-2);
  background: var(--sunk);
}
.sharesummary .headline {
  font-weight: 800;
  font-size: clamp(20px, 3vw, 26px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  color: var(--ink);
}
.sharesummary .subline {
  margin: 0 0 14px;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.55;
  max-width: 70ch;
}
.sharesummary.empty {
  border-style: dashed;
  background: transparent;
}
.sharesummary.empty .headline {
  font-size: 17px;
  color: var(--dim);
}
.sharesummary.empty .subline {
  margin: 0;
  color: var(--dim);
}
.sharesummary.pass {
  background: var(--protect-wash);
  border-color: #bfe0cd;
}
.sharesummary.pass .headline {
  color: var(--protect-2);
}
.sharesummary.fail {
  background: var(--danger-wash);
  border-color: #efc9c5;
}
.sharesummary.fail .headline {
  color: var(--danger-2);
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 4px 0 12px;
}
.stat {
  background: rgb(255 255 255 / 65%);
  border: 1px solid rgb(20 16 11 / 8%);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}
.stat .k {
  display: block;
  font: 650 10.5px var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.stat .v {
  font: 760 20px/1.3 var(--mono);
  font-variant-numeric: tabular-nums;
}
.recline {
  font-size: 13px;
  color: var(--ink-2);
  margin: 6px 0 0;
}
.recline.warn {
  color: var(--amber);
}

.objresults {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}
.obj {
  font: 700 12px var(--mono);
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--raise);
  white-space: nowrap;
}
.obj.seen {
  color: var(--danger);
  border-color: #e6c4c1;
  background: #fff;
}
.obj.clear {
  color: var(--protect-2);
  border-color: #bfe0cd;
  background: #fff;
}

.heatfig {
  margin: 14px 0 0;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
#shareheat {
  display: block;
  width: 100%;
  max-width: 320px;
  height: auto;
  border-radius: var(--r-sm);
  background: #000;
}
.heatfig figcaption {
  flex: 1 1 220px;
  font-size: 13px;
  color: var(--dim);
  line-height: 1.5;
}

.askblock {
  margin: 18px 0 4px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.ask {
  font-weight: 700;
  font-size: 15px;
  margin: 0 0 10px;
}
.ask .dim {
  display: block;
  font-weight: 400;
  font-size: 13px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
label.chip {
  margin: 0;
  flex-direction: row;
  cursor: pointer;
  position: relative;
}
label.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
label.chip span {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--raise);
  font: 600 14px var(--sans);
  color: var(--ink-2);
  transition: all 0.14s ease;
}
label.chip:hover span {
  border-color: #c3b699;
}
label.chip input:checked + span {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

fieldset.consent {
  margin: 14px 0 16px;
  padding: 0;
  border: none;
  display: grid;
  gap: 8px;
}
fieldset.consent legend {
  font-weight: 700;
  font-size: 15px;
  padding: 0;
  margin-bottom: 10px;
}
label.choice {
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  margin: 0;
  padding: 13px 15px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--raise);
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}
label.choice:hover {
  border-color: #c3b699;
}
label.choice:has(input:checked) {
  border-color: var(--protect);
  background: var(--protect-wash);
  box-shadow: 0 0 0 1px var(--protect) inset;
}
label.choice input[type="radio"] {
  width: 19px;
  height: 19px;
  margin: 2px 0 0;
  accent-color: var(--protect);
  flex: none;
}
label.choice b {
  display: block;
  font-size: 15px;
}
label.choice small {
  display: block;
  font-size: 13px;
  color: var(--dim);
  line-height: 1.45;
}
#sharewhat {
  margin: 4px 0 0;
}
#sharedetail {
  margin-top: 14px;
}
#sharedetail pre,
.jsonpreview {
  max-height: 260px;
  overflow: auto;
  background: var(--sunk);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px;
}
#diagvideo {
  display: block;
  width: 100%;
  max-width: 420px;
  margin-top: 12px;
  border-radius: var(--r-sm);
}

/* ---------- folded secondary sections ---------- */

details.fold {
  padding: 0;
}
details.fold > summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 16px;
  align-items: center;
  padding: 18px 22px;
  border-radius: var(--r);
}
details.fold > summary::-webkit-details-marker {
  display: none;
}
details.fold > summary::after {
  grid-column: 2;
  grid-row: 1 / span 2;
}
details.fold > summary:hover {
  background: rgb(241 236 224 / 50%);
}
.fold-title {
  font-weight: 760;
  font-size: 16.5px;
  letter-spacing: -0.01em;
}
.fold-sub {
  font-size: 13.5px;
  color: var(--dim);
}
.fold-body {
  padding: 4px 22px 20px;
}
.mini-steps {
  margin: 0 0 6px;
  padding-left: 20px;
  font-size: 14px;
  color: var(--ink-2);
}
.mini-steps li {
  margin-bottom: 3px;
}

/* ---------- lab protocol (Advanced mode) ---------- */

.labhead {
  margin: 40px 0 0;
  padding-top: 20px;
  border-top: 2px dashed var(--line-2);
}
.labhead h2 {
  margin-bottom: 2px;
}
.step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.step:last-child {
  border-bottom: none;
}
.step .num {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--sunk);
  border: 1px solid var(--line-2);
  display: grid;
  place-items: center;
  font: 700 12px var(--mono);
}
.step .body {
  flex: 1;
  min-width: 0;
}
.step .title {
  font-weight: 650;
  font-size: 14.5px;
}
.step .why {
  margin: 5px 0 6px;
}
.step .state {
  font: 12px var(--mono);
  color: var(--dim);
}
.step .state.ok {
  color: var(--protect-2);
}
.step .state.seen {
  color: var(--danger);
}
.step.active {
  background: var(--sunk);
  border-radius: var(--r-sm);
  padding-inline: 12px;
}
.step button {
  flex: none;
}

table.kv {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
table.kv td {
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.kv td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
table.kv tr:last-child td {
  border-bottom: none;
}
table.kv button {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 13px;
}
.num {
  font-variant-numeric: tabular-nums;
}
.verdict {
  font-weight: 750;
  font-size: 15px;
  margin-bottom: 6px;
}
.verdict.clear {
  color: var(--protect-2);
}
.verdict.seen {
  color: var(--danger);
}
.verdict.amber {
  color: var(--amber);
}
td.clear {
  color: var(--protect-2);
}
td.seen {
  color: var(--danger);
}
#settingrow {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px 12px;
}
#settingrow label {
  font: 650 12px var(--sans);
  color: var(--dim);
  margin: 0;
}
.tip {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-left: 5px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--sunk);
  color: var(--dim);
  font: 700 10px var(--sans);
  cursor: help;
  vertical-align: middle;
}
.tip:hover,
.tip:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  outline: none;
}

/* ---------- sign-in gate ---------- */

.signin {
  min-height: 72vh;
  display: grid;
  place-items: center;
  padding: 30px 0;
  animation: rise 0.5s var(--ease) both;
}
.signin-card {
  width: 100%;
  max-width: 440px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  padding: 34px 30px 26px;
  box-shadow: var(--shadow-lg);
}
.signin-card h1 {
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 800;
  margin: 0 0 8px;
}
#gateintro {
  margin-top: 8px;
}
.signin-card .field {
  display: block;
  margin: 20px 0 14px;
}
.signin-card .field > span {
  display: block;
  font: 650 13px var(--sans);
  color: var(--ink-2);
  margin-bottom: 6px;
}
.signin-card .primary {
  width: 100%;
  min-height: 50px;
  background: var(--protect);
  border-color: var(--protect);
  font-size: 15px;
}
.signin-card .primary:hover:not(:disabled) {
  background: var(--protect-2);
}
.signin-points {
  list-style: none;
  padding: 16px 0 0;
  margin: 18px 0 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--dim);
  display: grid;
  gap: 6px;
}
.signin-points li {
  padding-left: 22px;
  position: relative;
}
.signin-points li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 5px;
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--protect);
  border-bottom: 2px solid var(--protect);
  transform: rotate(-45deg);
}
.spinner {
  width: 24px;
  height: 24px;
  margin: 18px 0 6px;
  border: 2px solid var(--sunk);
  border-top-color: var(--protect);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ---------- account chip ---------- */

.acctchip {
  position: relative;
}
.avatar {
  width: 36px;
  height: 36px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--line-2);
  color: #fff;
  font: 700 14px var(--sans);
  text-transform: uppercase;
}
.avatar:hover:not(:disabled) {
  background: var(--accent-2);
}
.acctmenu {
  position: absolute;
  top: 46px;
  right: 0;
  min-width: 240px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  z-index: 40;
  animation: rise 0.14s ease both;
}
.acctmenu-who {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px 4px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
  word-break: break-all;
}
.acctmenu #acctadmin {
  display: block;
  padding: 6px 4px 10px;
}
.acctmenu #acctout {
  width: 100%;
}

/* ---------- footer ---------- */

.foot,
footer {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--faint);
}
footer p {
  margin: 0 0 4px;
}
footer a {
  color: var(--dim);
}
.modebar {
  margin-bottom: 10px;
}

/* ---------- about page (shared stylesheet) ---------- */

.hero {
  padding: 34px 0 8px;
  animation: rise 0.6s var(--ease) both;
}
.hero h1 {
  font-size: clamp(30px, 6.4vw, 46px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  font-weight: 820;
  margin: 0 0 18px;
  text-wrap: balance;
}
.hero h1 .said {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.01em;
  color: var(--protect-2);
}
.hero .lede {
  font-size: clamp(16px, 2.4vw, 19px);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 60ch;
  margin: 0;
}
.hero .lede strong {
  color: var(--ink);
  font-weight: 650;
}
.promise {
  margin: 34px 0 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--raise), var(--panel));
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise 0.6s var(--ease) 0.08s both;
}
.promise-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--protect-wash);
}
.promise-head svg {
  width: 18px;
  height: 18px;
  color: var(--protect);
  flex: none;
}
.promise-head b {
  font-size: 13px;
  letter-spacing: 0.02em;
}
.promise-head .said {
  margin-left: auto;
  font: italic 13px/1.4 var(--serif);
  color: var(--protect-2);
}
.pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
}
.pillar {
  background: var(--panel);
  padding: 20px 18px 18px;
}
.pillar svg {
  width: 22px;
  height: 22px;
  color: var(--ink);
  margin-bottom: 10px;
}
.pillar h3 {
  font-size: 14.5px;
  font-weight: 700;
  margin: 0 0 5px;
  letter-spacing: -0.01em;
}
.pillar p {
  font-size: 12.8px;
  line-height: 1.5;
  color: var(--dim);
  margin: 0;
}
.promise-foot {
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  font-size: 12.8px;
  line-height: 1.55;
  color: var(--ink-2);
  background: var(--raise);
}
.promise-foot strong {
  color: var(--protect-2);
}
.wrap.about-main {
  max-width: 820px;
}
.about-main .panel > h2 {
  font-size: 17px;
}

/* ---------- motion ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes blink {
  50% {
    opacity: 0.25;
  }
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgb(21 115 71 / 45%);
  }
  70% {
    box-shadow: 0 0 0 7px rgb(21 115 71 / 0%);
  }
  100% {
    box-shadow: 0 0 0 0 rgb(21 115 71 / 0%);
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  html {
    scroll-behavior: auto;
  }
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .intro {
    grid-template-columns: 1fr;
    gap: 18px;
    padding-top: 24px;
  }
  .stage {
    grid-template-columns: 1fr;
  }
  .stage-controls {
    position: static;
  }
  /* On a phone, setup comes first; the camera sits right under Start. */
  .stage-controls {
    order: -1;
  }
}

@media (max-width: 560px) {
  .wrap {
    padding: 0 14px 56px;
  }
  .topbar-in {
    padding: 8px 14px;
    gap: 8px;
  }
  .brand-sub {
    display: none;
  }
  #backend {
    display: none;
  }
  .panel {
    padding: 16px;
    border-radius: 16px;
  }
  .stage-video {
    padding: 8px;
  }
  .intro h1 {
    font-size: 30px;
  }
  .howto li {
    padding: 10px 12px;
  }
  .pair {
    grid-template-columns: 1fr;
  }
  #live {
    grid-template-columns: 1fr;
  }
  #live .mini-tiles {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: space-between;
  }
  .stats {
    grid-template-columns: 1fr 1fr;
  }
  .pillars {
    grid-template-columns: 1fr;
  }
  .promise-head .said {
    display: none;
  }
  details.fold > summary {
    padding: 16px;
  }
  .fold-body {
    padding: 4px 16px 16px;
  }
  .step {
    flex-wrap: wrap;
  }
  .step button {
    width: 100%;
  }
  input[type="file"] {
    padding: 12px 0;
  }
  .row > button {
    flex: 1 1 auto;
  }
}

@media (max-width: 380px) {
  .runbar {
    grid-template-columns: 1fr;
  }
}

/* ---------- accessibility: never color alone ----------
   Detected wears an open eye, not detected a struck-through eye, so the
   verdict survives red/green color blindness and grayscale screenshots. */
#live b.seen::before,
#live b.clear::before,
.obj.seen::before,
.obj.clear::before {
  content: "";
  display: inline-block;
  width: 0.95em;
  height: 0.95em;
  margin-right: 0.35em;
  vertical-align: -0.1em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
}
#live b.clear::before,
.obj.clear::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 2l20 20'/%3E%3Cpath d='M6.7 6.7A10.5 10.5 0 0 0 1 12s4 7 11 7a10 10 0 0 0 5.3-1.5'/%3E%3Cpath d='M9.9 4.2A10.6 10.6 0 0 1 12 4c7 0 11 8 11 8a18 18 0 0 1-2.2 3.1'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 2l20 20'/%3E%3Cpath d='M6.7 6.7A10.5 10.5 0 0 0 1 12s4 7 11 7a10 10 0 0 0 5.3-1.5'/%3E%3Cpath d='M9.9 4.2A10.6 10.6 0 0 1 12 4c7 0 11 8 11 8a18 18 0 0 1-2.2 3.1'/%3E%3C/svg%3E");
}
/* A detected meter is hatched as well as red. */
.meter .fill.seen {
  background: repeating-linear-gradient(-45deg, var(--danger) 0 5px, var(--danger-2) 5px 9px);
}

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

/* camera explainer, shown before the browser's own permission prompt */
.camgate {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  color: #fff;
  background: rgb(20 16 11 / 72%);
  backdrop-filter: blur(4px);
}
.camgate svg {
  width: 40px;
  height: 40px;
}
.camgate p {
  margin: 0;
  max-width: 34ch;
  font-size: 15px;
  line-height: 1.5;
}

/* ---------- test type, guide, big view ---------- */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  gap: 4px;
  background: var(--sunk);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin: 0 0 14px;
}
.segmented label {
  margin: 0;
  position: relative;
  cursor: pointer;
}
.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.segmented span {
  display: block;
  text-align: center;
  padding: 9px 8px;
  border-radius: var(--r-sm);
  font: 650 14px var(--sans);
  color: var(--dim);
  transition: background 0.14s ease, color 0.14s ease;
}
.segmented input:checked + span {
  background: var(--raise);
  color: var(--ink);
  box-shadow: 0 1px 3px rgb(20 16 11 / 12%);
}
.segmented label:has(input:focus-visible) span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.comparehint {
  margin: -4px 0 14px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--accent-wash);
  color: var(--accent);
  font: 600 13.5px/1.45 var(--sans);
}
.comparehint.part2 {
  background: var(--protect-wash);
  color: var(--protect-2);
}

.guidestep {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  padding: 10px 20px;
  border-radius: 999px;
  background: rgb(255 253 248 / 92%);
  color: var(--ink);
  font: 750 clamp(16px, 2.6vw, 22px) var(--sans);
  box-shadow: 0 8px 24px -10px rgb(0 0 0 / 50%);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bigbtn {
  position: absolute;
  left: 12px;
  bottom: 14px;
  min-height: 38px;
  padding: 7px 12px;
  font-size: 13px;
  color: #fff;
  background: rgb(20 16 11 / 55%);
  border: 1px solid rgb(255 255 255 / 20%);
  backdrop-filter: blur(6px);
}
.bigbtn:hover:not(:disabled) {
  background: rgb(20 16 11 / 75%);
}
.bigverdict {
  display: none;
}
/* Screen-edge colour while running: visible from across a room. */
body[data-run="running"] .videowrap.edge-seen {
  box-shadow: inset 0 0 0 6px var(--danger);
}
body[data-run="running"] .videowrap.edge-clear {
  box-shadow: inset 0 0 0 6px var(--protect);
}
.videowrap:fullscreen,
.videowrap.bigview {
  max-height: none;
  aspect-ratio: auto;
  border-radius: 0;
  background: #000;
}
.videowrap.bigview {
  position: fixed;
  inset: 0;
  z-index: 100;
}
.videowrap:fullscreen video,
.videowrap:fullscreen canvas,
.videowrap.bigview video,
.videowrap.bigview canvas {
  object-fit: contain;
}
.videowrap:fullscreen .bigverdict,
.videowrap.bigview .bigverdict {
  display: block;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 0.25em 0.6em;
  border-radius: 24px;
  font: 850 clamp(40px, 9vw, 120px)/1.05 var(--sans);
  letter-spacing: -0.02em;
  text-align: center;
  color: #fff;
  pointer-events: none;
  text-shadow: 0 2px 12px rgb(0 0 0 / 40%);
}
.videowrap:fullscreen .bigverdict:empty,
.videowrap.bigview .bigverdict:empty {
  display: none;
}
.videowrap:fullscreen .bigverdict.seen,
.videowrap.bigview .bigverdict.seen {
  background: rgb(179 38 30 / 78%);
}
.videowrap:fullscreen .bigverdict.clear,
.videowrap.bigview .bigverdict.clear {
  background: rgb(21 115 71 / 78%);
}
.videowrap:fullscreen.edge-seen,
.videowrap.bigview.edge-seen {
  box-shadow: inset 0 0 0 16px var(--danger);
}
.videowrap:fullscreen.edge-clear,
.videowrap.bigview.edge-clear {
  box-shadow: inset 0 0 0 16px var(--protect);
}
.videowrap:fullscreen .guidestep,
.videowrap.bigview .guidestep {
  font-size: clamp(22px, 4vw, 40px);
  top: 24px;
}
body.noscroll {
  overflow: hidden;
}

/* ---------- review: timeline, per-pose, compare, gauntlet ---------- */
.subhead {
  font-size: 15px;
  font-weight: 750;
  margin: 22px 0 10px;
}
.review {
  margin-top: 6px;
}
.timeline {
  margin: 0;
}
.tlwrap {
  position: relative;
}
#timeline {
  display: block;
  width: 100%;
  height: 170px;
  cursor: crosshair;
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  touch-action: pan-y;
}
.tltip {
  position: absolute;
  top: -8px;
  transform: translateY(-100%);
  max-width: 260px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font: 600 12px/1.4 var(--sans);
  pointer-events: none;
  z-index: 5;
}
.timeline figcaption {
  font-size: 13px;
  color: var(--dim);
  margin-top: 6px;
}
#reviewclip {
  display: block;
  width: 100%;
  max-width: 520px;
  margin-top: 12px;
  border-radius: var(--r-sm);
  background: #000;
}
.cmprow,
.grow-row {
  display: grid;
  grid-template-columns: minmax(120px, 190px) 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
}
.cmplabel,
.gname {
  font-weight: 650;
  font-size: 14px;
  min-width: 0;
}
.gfam {
  display: block;
  font-weight: 500;
  font-size: 12px;
  color: var(--faint);
}
.cmpbar {
  height: 12px;
  border-radius: 999px;
  background: var(--sunk);
  overflow: hidden;
}
.cmpbar > span {
  display: block;
  height: 100%;
  width: 0;
  min-width: 2px;
  border-radius: 999px;
  background: var(--ink);
  transition: width 0.4s var(--ease);
}
.cmpbar > span.b {
  background: var(--faint);
}
.cmpbar > span.z {
  background: var(--line-2);
}
.cmpval {
  font: 750 16px var(--mono);
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: right;
}
.cmpline {
  font-weight: 650;
  margin: 8px 0 4px;
}
.comparecard {
  margin-top: 14px;
  padding: 4px 18px 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--raise);
}
.comparecard .subhead {
  margin-top: 14px;
}
.grow-row.err {
  grid-template-columns: minmax(120px, 190px) 1fr;
  color: var(--amber);
}
.gauntlet {
  margin-top: 8px;
  padding-top: 4px;
}
.progress {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}
.progress .bar {
  height: 8px;
  border-radius: 999px;
  background: var(--sunk);
  overflow: hidden;
}
.progress .bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--protect);
  transition: width 0.2s linear;
}
@media (max-width: 560px) {
  .cmprow,
  .grow-row {
    grid-template-columns: 1fr auto;
  }
  .cmprow .cmpbar,
  .grow-row .cmpbar {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* ---------- garment code, quality checklist ---------- */
.codefield {
  display: flex;
  gap: 8px;
}
.codefield input {
  font-family: var(--mono);
  letter-spacing: 0.04em;
}
.codefield button {
  flex: none;
  min-height: 46px;
}
.ok-text {
  color: var(--protect-2);
}
.scandlg video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #000;
  border-radius: var(--r-sm);
  margin: 6px 0 8px;
}
.qualitybox {
  margin-top: 14px;
  padding: 4px 18px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: var(--raise);
}
.qualitybox.has-warn {
  border-color: #ecd9b6;
  background: var(--amber-wash);
}
.qualitybox .subhead {
  margin-top: 12px;
}
.qualitybox ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.qualitybox li {
  position: relative;
  padding-left: 26px;
  font-size: 14px;
  line-height: 1.45;
}
.qualitybox li::before {
  position: absolute;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 800 12px/18px var(--sans);
  text-align: center;
  color: #fff;
}
.qualitybox li.ok::before {
  content: "\2713";
  background: var(--protect);
}
.qualitybox li.warn::before {
  content: "!";
  background: var(--amber);
}
.qualitybox li.ok {
  color: var(--dim);
}

/* ---------- in-page dialogs (dialogs.js) ---------- */
dialog.modal {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}
dialog.modal[open] {
  animation: rise 0.18s var(--ease) both;
}
dialog.modal::backdrop {
  background: rgb(20 16 11 / 45%);
  backdrop-filter: blur(3px);
}
dialog.modal form {
  padding: 22px 22px 18px;
}
.modal-title {
  font-size: 19px;
  font-weight: 780;
  letter-spacing: -0.015em;
  margin: 0 0 8px;
}
.modal-body p {
  margin: 0 0 10px;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.55;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}
button.destructive-solid {
  background: var(--danger);
  border-color: var(--danger);
}
button.destructive-solid:hover:not(:disabled) {
  background: var(--danger-2);
}

/* The hidden attribute must win over any display rule above. */
[hidden] {
  display: none !important;
}
