/* Pallet Label Check - RetailerHub brand (Poppins, #3859F3 / #6AC9F9). Mobile first. */
:root {
  --brand: #3859F3;
  --brand-rgb: 56 89 243;
  --cyan: #6AC9F9;
  --grad: linear-gradient(111.08deg, #6AC9F9 -0.42%, #3859F3 106.75%);
  --ink: #1d2433;
  --text: #4A4A4A;
  --muted: #6b7280;
  --line: #e4e8f1;
  --bg: #f6f8fc;
  --card: #ffffff;
  --tint: #D4DFEF;
  --pass: #12a150;
  --pass-bg: #e9f8ef;
  --fail: #e5484d;
  --fail-bg: #fdecec;
  --cant: #c97a06;
  --cant-bg: #fff4e0;
  --retake: #2f6fe0;
  --retake-bg: #eaf2ff;
  --nc: #8a8f98;
  --nc-bg: #f1f2f4;
  --shadow: 0 10px 30px rgba(70, 119, 245, 0.12);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: Poppins, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image: linear-gradient(180deg, rgba(106, 201, 249, 0.10) 0, rgba(56, 89, 243, 0.04) 260px, rgba(246, 248, 252, 0) 520px);
  background-repeat: no-repeat;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-weight: 400; }

/* ------------------------------------------------ top bar */
.topbar { background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.logo { height: 28px; width: auto; display: block; }
.pill-proto { font-size: 12px; font-weight: 600; color: var(--brand); background: rgba(var(--brand-rgb) / 0.08); border: 1px solid rgba(var(--brand-rgb) / 0.2); padding: 3px 10px; border-radius: 999px; letter-spacing: 0.02em; }

.ph-banner { background: #fff1c2; color: #6b4a00; border-bottom: 1px solid #f3d27a; font-size: 13.5px; padding: 9px 0; }
.ph-banner strong { letter-spacing: 0.04em; }

/* ------------------------------------------------ intro */
.intro { padding: 28px 0 8px; text-align: center; }
.eyebrow { margin: 0 0 6px; font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand); }
h1 { margin: 0 0 12px; color: var(--ink); font-size: 27px; line-height: 1.22; font-weight: 700; letter-spacing: -0.01em; }
.lede { margin: 0 auto 24px; max-width: 560px; font-size: 15.5px; }

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; max-width: 420px; min-height: 64px; padding: 0 24px;
  border: 0; border-radius: 16px; cursor: pointer;
  background: var(--grad); color: #fff;
  font: 600 19px/1 Poppins, system-ui, sans-serif;
  box-shadow: 0 10px 24px rgba(56, 89, 243, 0.32);
  transition: transform .12s ease, box-shadow .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:active { transform: translateY(1px) scale(0.99); box-shadow: 0 6px 14px rgba(56, 89, 243, 0.3); }
.btn-primary:focus-visible, .btn-secondary:focus-visible { outline: 3px solid rgba(var(--brand-rgb) / 0.45); outline-offset: 3px; }
.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; max-width: 420px; min-height: 50px; margin-top: 12px; padding: 0 20px;
  border: 1.5px solid rgba(var(--brand-rgb) / 0.35); border-radius: 14px; cursor: pointer;
  background: #fff; color: var(--brand); font: 600 15.5px/1 Poppins, system-ui, sans-serif;
}
.btn-secondary--dark { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.45); }
.tip { margin: 14px auto 0; font-size: 13.5px; color: var(--muted); max-width: 420px; }

.what { margin: 26px auto 0; max-width: 560px; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 4px 16px; }
.what summary { cursor: pointer; padding: 12px 0; font-weight: 600; color: var(--ink); font-size: 15px; }
.rules-mini { margin: 0 0 12px; padding-left: 18px; font-size: 14px; }
.rules-mini li { margin: 6px 0; }
.rules-mini .tag { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* ------------------------------------------------ start-screen reference (below the fold) */
.ref { margin: 44px auto 0; padding-top: 28px; max-width: 560px; text-align: left; border-top: 1px solid var(--line); }
.ref-title { margin: 0 0 14px; font-size: 20px; font-weight: 700; color: var(--ink); line-height: 1.3; text-align: center; text-wrap: balance; }
.ref-figure { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 10px 12px; }
.ref-zoom { display: block; }
.ref-figure img { display: block; width: 100%; height: auto; border-radius: 8px; background: #fff; }
.ref-caption { margin: 10px 2px 6px; font-size: 14px; color: var(--ink); line-height: 1.45; }
.ref-figure .cite { margin-left: 2px; }
.ref-sub { margin: 24px 0 10px; font-size: 16px; font-weight: 600; color: var(--ink); }
.ref-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ref-item { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; }
.ref-check { grid-row: span 2; align-self: start; display: grid; place-items: center; width: 22px; height: 22px; margin-top: 1px; border-radius: 999px; background: rgba(var(--brand-rgb) / 0.1); color: var(--brand); }
.ref-check svg { width: 14px; height: 14px; }
.ref-text { margin: 0; font-size: 14px; color: var(--ink); line-height: 1.45; }
.ref-item .cite { font-size: 12px; }

/* ------------------------------------------------ error */
.error-box { margin: 18px auto; max-width: 560px; background: var(--fail-bg); color: #8a1f22; border: 1px solid #f5c2c3; padding: 12px 16px; border-radius: 12px; font-size: 14.5px; }

/* ------------------------------------------------ stage (frozen frame + boxes) */
.result { padding: 18px 0 8px; }
.stage { position: relative; width: 100%; border-radius: var(--radius); overflow: hidden; background: #0b0f1a; box-shadow: var(--shadow); line-height: 0; }
.stage img { display: block; width: 100%; height: auto; max-height: 72vh; object-fit: contain; margin: 0 auto; }
.boxes { position: absolute; inset: 0; pointer-events: none; }
.box { position: absolute; border: 3px solid var(--brand); border-radius: 6px; box-shadow: 0 0 0 2px rgba(255,255,255,0.85), 0 0 18px rgba(var(--brand-rgb) / 0.55); opacity: 0; transform: scale(1.06); transition: opacity .45s ease, transform .45s ease; }
.box.on { opacity: 1; transform: scale(1); }
.box--placard { border-style: dashed; border-color: #ffffff; box-shadow: 0 0 0 1px rgba(0,0,0,0.35); }
.box--warn { border-color: var(--fail); box-shadow: 0 0 0 2px rgba(255,255,255,0.85), 0 0 18px rgba(229, 72, 77, 0.6); }
.box-tag { position: absolute; left: -13px; top: -13px; min-width: 26px; height: 26px; padding: 0 7px; display: grid; place-items: center; border-radius: 999px; font: 700 13px/1 Poppins, sans-serif; color: #fff; background: var(--brand); box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0,0,0,0.3); }
.box--placard .box-tag { background: rgba(20, 24, 36, 0.8); }
.box--warn .box-tag { background: var(--fail); }
.box--build { border-style: dashed; border-color: var(--cant); box-shadow: 0 0 0 2px rgba(255,255,255,0.8), 0 0 14px rgba(201, 122, 6, 0.5); }
.box--build .box-tag { background: var(--cant); }
.box.edge-top .box-tag { top: 2px; }
.box.edge-left .box-tag { left: 2px; }

.elapsed { text-align: center; margin: 10px 0 0; font-size: 13.5px; color: var(--muted); }
.elapsed:empty { display: none; }
.legend { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.legend-item { display: inline-flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px 5px 6px; font-size: 13px; color: var(--ink); }
.legend-num { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 600; }
.legend-item.placard .legend-num { background: #6f7b91; }
.legend-item.warn .legend-num { background: var(--fail); }
.legend-item.build .legend-num { background: var(--cant); }

/* ------------------------------------------------ reticle + sweep (ported from fitness-helper Scanner) */
.reticle { position: absolute; pointer-events: none; }
/* Camera guide band: 84% of the width, from just under the status chip to just above the hint (room for a
   2-line hint), so the ghost never touches the chip, hint or shutter. The SVG fits this band keeping its shape. */
.reticle--cam {
  left: 8%; right: 8%;
  top: calc(max(66px, env(safe-area-inset-top) + 54px) + 46px);
  bottom: calc(max(26px, env(safe-area-inset-bottom)) + 104px + 52px);
}
.reticle--inline { top: 64px; left: 7%; right: 7%; bottom: 7%; transition: opacity .4s ease; }
.corner { position: absolute; width: 28px; height: 28px; border-color: rgba(255, 255, 255, 0.55); border-style: solid; border-width: 0; transition: border-color .2s ease; }
.corner.tl { left: 0; top: 0; border-left-width: 3px; border-top-width: 3px; border-top-left-radius: 8px; }
.corner.tr { right: 0; top: 0; border-right-width: 3px; border-top-width: 3px; border-top-right-radius: 8px; }
.corner.bl { left: 0; bottom: 0; border-left-width: 3px; border-bottom-width: 3px; border-bottom-left-radius: 8px; }
.corner.br { right: 0; bottom: 0; border-right-width: 3px; border-bottom-width: 3px; border-bottom-right-radius: 8px; }
.reticle.locked .corner, .reticle--inline .corner { border-color: var(--brand); }
.sweep {
  position: absolute; left: 4px; right: 4px; height: 2px; border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  box-shadow: 0 0 12px 2px rgba(var(--brand-rgb) / 0.55);
  animation: pc-sweep 2.2s ease-in-out infinite alternate;
}
.sweep--fast { animation-duration: 0.9s; }
@keyframes pc-sweep { from { top: 0; } to { top: calc(100% - 2px); } }
.stage.done .reticle--inline { opacity: 0; }
.stage.done .sweep { animation: none; display: none; }

/* ghost pallet guide on the live camera: white strokes ~55%, soft glow, no fill */
.ghost { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; transition: opacity .35s ease;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.45)) drop-shadow(0 0 1px rgba(0, 0, 0, 0.55)); }
.ghost path { fill: none; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.ghost .g-line path, .ghost .g-line { stroke: rgba(255, 255, 255, 0.55); stroke-width: 2; }
.ghost .g-corner { stroke: rgba(255, 255, 255, 0.75); stroke-width: 3; }
.ghost .g-faint path { stroke: rgba(255, 255, 255, 0.28); stroke-width: 1.2; stroke-dasharray: 3 6; }
.ghost .g-label path { stroke: rgba(255, 255, 255, 0.8); stroke-width: 1.6; }
.ghost .g-label .g-bars { stroke-width: 1.2; }
.camera:not(.ghost-off) .reticle--cam .corner { opacity: 0; } /* the ghost replaces the corner brackets */
.camera.ghost-off .ghost { display: none; }
.camera.captured .ghost { opacity: 0; }
.ghost-toggle { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; z-index: 3; height: 44px; padding: 0 14px 0 12px;
  display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: 999px; background: rgba(12, 16, 28, 0.55); color: #fff;
  font: 500 13.5px/1 Poppins, system-ui, sans-serif; cursor: pointer; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); -webkit-tap-highlight-color: transparent; }
.ghost-toggle[aria-pressed="false"] { color: rgba(255, 255, 255, 0.8); }
.ghost-toggle:focus-visible { outline: 3px solid rgba(255, 255, 255, 0.6); outline-offset: 2px; }

/* shutter flash */
.flash { position: fixed; inset: 0; background: #fff; z-index: 100; pointer-events: none; animation: pc-flash 260ms ease-out forwards; }
@keyframes pc-flash { from { opacity: 0.85; } to { opacity: 0; } }

/* status chip */
.chip-row { position: absolute; left: 0; right: 0; top: 14px; display: flex; justify-content: center; padding: 0 16px; pointer-events: none; line-height: 1.3; }
.chip { margin: 0; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: rgba(12, 16, 28, 0.6); color: #fff; font-size: 14px; font-weight: 500; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.chip .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--cyan); box-shadow: 0 0 0 3px rgba(106, 201, 249, 0.25); animation: pc-pulse 1.2s ease-in-out infinite; }
@keyframes pc-pulse { 50% { opacity: 0.35; } }
.stage.done .chip-row { opacity: 0; transition: opacity .3s ease; }
/* While checking, boxes land on the photo: keep the status chip at the bottom, clear of the labels up top. */
.stage .chip-row { top: auto; bottom: 14px; }

/* ------------------------------------------------ live camera (full-bleed) */
.camera { position: fixed; inset: 0; z-index: 50; background: #000; overflow: hidden; }
.camera video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-tap { position: absolute; inset: 0; background: transparent; border: 0; cursor: default; -webkit-tap-highlight-color: transparent; }
.chip-row--cam { top: max(66px, calc(env(safe-area-inset-top) + 54px)); }
.cam-close { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 12px; width: 44px; height: 44px; border-radius: 999px; border: 0; background: rgba(12, 16, 28, 0.55); color: #fff; display: grid; place-items: center; cursor: pointer; z-index: 3; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.cam-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 20px max(26px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; background: linear-gradient(0deg, rgba(0,0,0,0.55), rgba(0,0,0,0)); z-index: 3; }
.cam-upload { justify-self: start; color: #fff; font-size: 14px; font-weight: 500; padding: 10px 4px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.cam-spacer { justify-self: end; }
.shutter { width: 76px; height: 76px; border-radius: 999px; border: 4px solid #fff; background: transparent; padding: 5px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.shutter span { display: block; width: 100%; height: 100%; border-radius: 999px; background: #fff; transition: transform .1s ease; }
.shutter:active span { transform: scale(0.9); }
.cam-hint { position: absolute; left: 0; right: 0; bottom: calc(max(26px, env(safe-area-inset-bottom)) + 104px); margin: 0; padding: 0 24px; text-align: center; color: #fff; font-size: 14.5px; font-weight: 500; text-shadow: 0 1px 6px rgba(0,0,0,0.7); pointer-events: none; z-index: 3; }
.cam-unavailable { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 0 32px; text-align: center; background: #0b0f1a; color: rgba(255,255,255,0.85); }
.cam-unavailable p { margin: 0 0 14px; font-size: 15px; }

/* landscape phones: shutter in a right-hand column (like the native camera), chip in the top row, hint at the
   bottom, so the ghost can use the full height between them */
@media (orientation: landscape) and (max-height: 540px) {
  .chip-row--cam { top: max(12px, env(safe-area-inset-top)); }
  .cam-hint { bottom: max(12px, env(safe-area-inset-bottom)); }
  .reticle--cam { left: 140px; right: 140px; top: calc(max(12px, env(safe-area-inset-top)) + 46px); bottom: calc(max(12px, env(safe-area-inset-bottom)) + 34px); }
  .cam-bottom { left: auto; top: 0; width: 132px; padding: 16px max(16px, env(safe-area-inset-right)) 16px 16px;
    grid-template-columns: none; grid-template-rows: 1fr auto 1fr; justify-items: center; background: linear-gradient(270deg, rgba(0,0,0,0.5), rgba(0,0,0,0)); }
  .cam-spacer { order: 1; }
  .shutter { order: 2; }
  .cam-upload { order: 3; justify-self: center; align-self: start; margin-top: 10px; white-space: nowrap; font-size: 13.5px; }
}

/* ------------------------------------------------ verdict */
.verdict { margin-top: 16px; border-radius: var(--radius); padding: 18px 18px 16px; background: var(--card); box-shadow: var(--shadow); border-left: 8px solid var(--nc); animation: pc-rise .35s ease both; }
.verdict-head { display: flex; align-items: center; gap: 14px; }
.verdict-icon { flex: none; width: 54px; height: 54px; border-radius: 999px; display: grid; place-items: center; color: #fff; }
.verdict-icon svg { width: 30px; height: 30px; }
.verdict-word { margin: 0; font-size: 34px; line-height: 1.05; font-weight: 700; letter-spacing: 0.01em; }
.verdict-summary { margin: 4px 0 0; font-size: 14.5px; color: var(--ink); }
.verdict-counts { margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.count { font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.verdict-hint { margin: 12px 0 0; font-size: 14px; background: rgba(var(--brand-rgb) / 0.06); color: var(--ink); border-radius: 10px; padding: 9px 12px; }
.verdict.v-pass { border-left-color: var(--pass); } .verdict.v-pass .verdict-icon { background: var(--pass); } .verdict.v-pass .verdict-word { color: var(--pass); }
.verdict.v-fail { border-left-color: var(--fail); } .verdict.v-fail .verdict-icon { background: var(--fail); } .verdict.v-fail .verdict-word { color: var(--fail); }
.verdict.v-cant_tell { border-left-color: var(--cant); } .verdict.v-cant_tell .verdict-icon { background: var(--cant); } .verdict.v-cant_tell .verdict-word { color: var(--cant); }
/* RETAKE: friendly coaching, brand blue (not red, not the CAN'T TELL amber) */
.verdict.v-retake { border-left-color: var(--retake); background: linear-gradient(180deg, var(--retake-bg), #fff 70%); }
.verdict.v-retake .verdict-icon { background: var(--grad); }
.verdict.v-retake .verdict-word { color: var(--retake); }
/* word beside the icon, coaching line full width below it */
.verdict.v-retake .verdict-head { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 14px; }
.verdict.v-retake .verdict-head > div { display: contents; }
.verdict.v-retake .verdict-summary { grid-column: 1 / -1; margin-top: 14px; font-size: 17px; font-weight: 500; line-height: 1.5; }
.is-retake .btn-again { background: #fff; color: var(--brand); border: 1.5px solid rgba(var(--brand-rgb) / 0.35); box-shadow: none; min-height: 52px; font-size: 16px; }
.btn-retake { display: flex; max-width: none; margin-top: 16px; }

/* collapse toggle for the rule list (shown on RETAKE) */
.rules-toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; margin-top: 18px; min-height: 52px; padding: 0 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; color: var(--ink); font: 600 15px/1.2 Poppins, system-ui, sans-serif; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.rules-toggle svg { flex: none; color: var(--muted); transition: transform .15s ease; }
.rules-toggle.open svg { transform: rotate(180deg); }
.rules-toggle:focus-visible { outline: 3px solid rgba(var(--brand-rgb) / 0.45); outline-offset: 3px; }
.rules-toggle:not([hidden]) + #rules-body .section-title { margin-top: 18px; }
@keyframes pc-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.c-pass { background: var(--pass-bg); color: #0b6b35; }
.c-fail { background: var(--fail-bg); color: #a32226; }
.c-cant_tell { background: var(--cant-bg); color: #8a5300; }
.c-not_checkable { background: var(--nc-bg); color: #565b64; }
.c-tip { background: rgba(56, 89, 243, 0.09); color: #2a44c0; }
.c-info { background: #eef1f6; color: #4b5568; }

/* ------------------------------------------------ rule rows */
.section-title { margin: 28px 0 12px; font-size: 18px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.section-sub { margin: 22px 0 10px; font-size: 15px; font-weight: 600; color: var(--muted); }
.rule-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rule { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 14px 12px; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; animation: pc-rise .35s ease both; }
.rule-badge { grid-row: span 3; align-self: start; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 999px; color: #fff; }
.rule-badge svg { width: 19px; height: 19px; }
.rule.r-pass .rule-badge { background: var(--pass); }
.rule.r-fail .rule-badge { background: var(--fail); }
.rule.r-cant_tell .rule-badge { background: var(--cant); }
.rule.r-not_checkable .rule-badge { background: var(--nc); }
.rule.r-tip .rule-badge { background: var(--brand); }
.rule.r-info .rule-badge { background: #6f7b91; }
.rule.r-fail { border-color: #f5c2c3; box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.07); }
.rule-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.rule-plain { margin: 0; font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.4; }
.rule-verdict { flex: none; font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; margin-top: 1px; }
.rule-reason { margin: 0; font-size: 14px; color: var(--text); }
.rule-meta { margin: 2px 0 0; }
.cite { margin: 0; display: inline-flex; align-items: flex-start; gap: 6px; font-size: 12.5px; color: var(--muted); }
.cite svg { flex: none; margin-top: 2px; }
.quote { margin-top: 6px; font-size: 13px; }
.quote summary { cursor: pointer; color: var(--brand); font-weight: 500; font-size: 13px; list-style: none; display: inline-flex; align-items: center; gap: 4px; }
.quote summary::-webkit-details-marker { display: none; }
.quote summary::before { content: "▸"; font-size: 11px; transition: transform .15s ease; }
.quote[open] summary::before { transform: rotate(90deg); }
.quote blockquote { margin: 8px 0 2px; padding: 10px 12px; border-left: 3px solid var(--cyan); background: #f5f8ff; border-radius: 0 10px 10px 0; color: var(--ink); font-style: italic; white-space: pre-wrap; }
.rule-rows--nc { margin-top: 10px; }
.rule-rows--nc .rule { background: #fafbfc; }
.nc-block { margin-top: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 2px 14px 12px; }
.nc-block summary { cursor: pointer; padding: 10px 0 0; font-weight: 600; color: var(--ink); font-size: 15px; }
.source { margin: 14px 0 0; font-size: 13px; color: var(--muted); }
.source a { color: var(--brand); font-weight: 500; }
.diagram-shows { margin: -4px 0 12px; font-size: 13.5px; color: var(--text); }
.rule-rows--nc .rule-plain { color: #4b5160; font-weight: 500; }
.group-list { margin: 8px 0 2px; padding-left: 18px; font-size: 13.5px; color: var(--text); }

/* ------------------------------------------------ check groups (one section per parallel model call) */
.groups { display: grid; gap: 14px; }
.grp { background: rgba(255, 255, 255, 0.55); border: 1px solid var(--line); border-radius: 16px; padding: 10px 10px 10px; }
.grp-head { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 4px; }
.grp-title { margin: 0; flex: 1; font-size: 16px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.grp-meta { flex: none; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.grp-status { flex: none; display: grid; place-items: center; width: 26px; height: 26px; }
.spinner { width: 20px; height: 20px; border-radius: 999px; border: 2.5px solid rgba(var(--brand-rgb) / 0.18); border-top-color: var(--brand); animation: pc-spin .8s linear infinite; }
@keyframes pc-spin { to { transform: rotate(360deg); } }
.grp-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 999px; color: #fff; background: var(--pass); animation: pc-pop .3s ease both; }
.grp-icon svg { width: 16px; height: 16px; }
@keyframes pc-pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
.grp.s-fail .grp-icon { background: var(--fail); }
.grp.s-cant_tell .grp-icon, .grp.s-failed .grp-icon { background: var(--cant); }
.grp.s-tip .grp-icon { background: var(--brand); }
.grp.s-info .grp-icon { background: #6f7b91; }
.grp.s-failed .grp-meta { color: #8a5300; font-weight: 500; }
.grp.is-pending .grp-title { color: var(--muted); font-weight: 500; }
.grp-rows { margin-top: 8px; }
.grp-rows:empty { display: none; }

/* passing rows fold into one "✓ N checks passed" line per section */
.grp-fold { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; margin-top: 8px; padding: 0 12px 0 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; color: var(--ink); text-align: left;
  font: 500 14.5px/1.3 Poppins, system-ui, sans-serif; cursor: pointer; -webkit-tap-highlight-color: transparent; animation: pc-rise .35s ease both; }
.grp-fold:focus-visible { outline: 3px solid rgba(var(--brand-rgb) / 0.45); outline-offset: 2px; }
.fold-check { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 999px; background: var(--pass-bg); color: var(--pass); }
.fold-check svg { width: 15px; height: 15px; }
.fold-text { flex: 1; }
.fold-chev { flex: none; display: grid; place-items: center; color: var(--muted); transition: transform .15s ease; }
.grp.unfolded .fold-chev { transform: rotate(180deg); }
.grp-passed { margin-top: 10px; }
/* all-pass section = one line: the header and the fold line share one tappable card row */
.grp.is-done.all-pass { display: grid; grid-template-columns: 26px 1fr auto; column-gap: 10px; align-items: center; padding: 10px 10px 10px 14px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.grp.is-done.all-pass .grp-head { display: contents; }
.grp.is-done.all-pass .grp-status { grid-column: 1; grid-row: 1 / span 2; align-self: center; }
.grp.is-done.all-pass .grp-title { grid-column: 2; grid-row: 1; }
.grp.is-done.all-pass .grp-meta { grid-column: 3; grid-row: 1; text-align: right; }
.grp.is-done.all-pass .grp-fold { grid-column: 2 / 4; grid-row: 2; min-height: 30px; margin: 0; padding: 0; border: 0; background: none; color: var(--pass); font-size: 14px; font-weight: 500; animation: none; }
.grp.is-done.all-pass .fold-check { width: 16px; height: 16px; margin-right: -4px; background: none; }
.grp.is-done.all-pass .fold-check svg { width: 16px; height: 16px; }
.grp.is-done.all-pass .grp-rows { display: none; }
.grp.is-done.all-pass .grp-passed { grid-column: 1 / -1; grid-row: 3; margin-top: 8px; cursor: auto; }
.rule.still { animation: none; }
.group-list li { margin: 4px 0; }

/* ------------------------------------------------ diagram + timing */
.diagram { margin: 0; }
.diagram img { display: block; width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--line); background: #fff; }
.diagram .cite { margin-top: 8px; }
.more-diagrams { margin-top: 12px; font-size: 14px; }
.more-diagrams summary { cursor: pointer; color: var(--brand); font-weight: 500; }
.more-diagrams figure { margin: 12px 0 0; }
.more-diagrams figcaption { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.timing { margin: 24px 0 0; text-align: center; font-size: 15px; color: var(--ink); font-weight: 500; }
.timing .muted { display: block; font-size: 12.5px; font-weight: 400; }
.timing .muted:empty { display: none; }
.btn-again { display: flex; margin: 16px auto 0; }

.footer { margin-top: 36px; padding: 22px 0 max(26px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; font-size: 13px; color: var(--muted); text-align: center; }

/* ------------------------------------------------ larger screens */
@media (min-width: 720px) {
  .intro { padding-top: 56px; }
  h1 { font-size: 40px; }
  .lede { font-size: 17px; }
  .verdict-word { font-size: 40px; }
  .rule { padding: 16px 18px 14px; }
}

/* ------------------------------------------------ reduced motion: no sweep, no flash */
@media (prefers-reduced-motion: reduce) {
  .sweep, .sweep--fast { animation: none; top: 50%; }
  .flash { animation: none; opacity: 0; display: none; }
  .chip .dot { animation: none; }
  .box { transition: none; transform: none; }
  .verdict, .rule, .grp-icon, .grp-fold { animation: none; }
  .fold-chev { transition: none; }
  .spinner { animation-duration: 2.4s; }
  .ghost { transition: none; }
}
