:root {
  --bg: #fafafa;
  --surface: #f2f2f2;
  --card: #ffffff;
  --ink: #0a0a0a;
  --ink-2: #474747;
  --ink-3: #7a7a7a;
  --line: #e6e6e6;
  --line-2: #cfcfcf;
  /* Verdict colors: the only color on the site — validated for CVD + contrast (dataviz validator) */
  --rerouted: #d9573b;
  --genuine: #2a6fd6;
  --none: #d4d4d4;
  --focus: #0a0a0a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 6px 20px rgba(0, 0, 0, 0.06);
  --radius: 16px;
  --accent: #e2552f; /* from the logo's hat band; decoration only, never data */
  --tape: rgba(255, 255, 255, 0.6);
  --serif: "Fraunces", Georgia, serif;
  --mono: "Courier Prime", "Courier New", ui-monospace, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --accent: #ff6a3d;
  --tape: rgba(245, 242, 234, 0.22);
  --bg: #0a0a0a;
  --surface: #141414;
  --card: #141414;
  --ink: #f5f5f5;
  --ink-2: #b3b3b3;
  --ink-3: #7f7f7f;
  --line: #262626;
  --line-2: #383838;
  --rerouted: #e0663f;
  --genuine: #4a86e8;
  --none: #3d3d3d;
  --focus: #f5f5f5;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(30px, 4.4vw, 48px); }
h2 { font-size: clamp(22px, 2.6vw, 28px); }
h3 { font-size: 18px; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 19px; }
.logo { display: inline-block; background: url("/logo-light.svg") center / contain no-repeat; }
:root[data-theme="dark"] .logo { background-image: url("/logo-dark.svg"); }
.brand-logo { width: 34px; height: 34px; }
.brand:hover .brand-logo { animation: wiggle .5s ease-in-out; }
@keyframes wiggle { 25% { transform: rotate(-8deg); } 75% { transform: rotate(6deg); } }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  text-decoration: none; color: var(--ink-2); font-weight: 500;
  padding: 7px 12px; border-radius: 999px; transition: background .15s, color .15s;
}
.nav a:hover { color: var(--ink); background: var(--line); }
.nav a.active { color: var(--ink); background: var(--card); box-shadow: var(--shadow); }
.theme-toggle {
  appearance: none; border: 1px solid var(--line-2); background: var(--card); color: var(--ink);
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none;
}
.theme-toggle:hover { border-color: var(--ink-3); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
.me { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.me strong { color: var(--ink); font-variant-numeric: tabular-nums; }

main:focus, main:focus-visible { outline: none; }
main { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: clamp(20px, 4vw, 44px) clamp(16px, 4vw, 40px) 60px; outline: none; }
.footer { border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13px; padding: 20px clamp(16px, 4vw, 40px); display: grid; gap: 4px; text-align: center; }

/* ---------- common ---------- */
.eyebrow { font: 700 13px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.eyebrow::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: 1px; }
.mono { font-family: var(--mono); }
.lede { font-size: 17px; color: var(--ink-2); max-width: 62ch; }
.muted { color: var(--ink-3); }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

.btn {
  --b: var(--ink);
  appearance: none; border: 1px solid var(--line-2); background: var(--card); color: var(--ink);
  font: 600 15px/1 var(--sans); padding: 13px 20px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 10px; transition: transform .08s, background .15s, border-color .15s, box-shadow .15s;
  text-decoration: none;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { color: var(--ink); background: var(--line); }
.btn.big { padding: 18px 26px; font-size: 16px; }
.btn.genuine { border-color: color-mix(in srgb, var(--genuine) 45%, transparent); }
.btn.genuine:hover, .btn.genuine.picked { background: var(--genuine); color: #fff; border-color: var(--genuine); }
.btn.rerouted { border-color: color-mix(in srgb, var(--rerouted) 45%, transparent); }
.btn.rerouted:hover, .btn.rerouted.picked { background: var(--rerouted); color: #fff; border-color: var(--rerouted); }
kbd {
  font: 600 11px/1 var(--sans); padding: 3px 6px; border-radius: 5px;
  border: 1px solid currentColor; opacity: .55;
}

.seg { display: inline-flex; background: var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button {
  appearance: none; border: 0; background: transparent; color: var(--ink-2);
  font: 500 13px/1 var(--sans); padding: 8px 14px; border-radius: 999px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.chip { display: inline-flex; align-items: center; gap: 6px; font: 700 12px/1.2 var(--mono); letter-spacing: .02em; padding: 4px 10px; border-radius: 999px; background: var(--line); color: var(--ink-2); }
.chip.community { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }

.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line-2); border-left: 3px solid var(--ink);
  font-size: 14px;
}
.error { color: var(--rerouted); font-weight: 500; }

/* ---------- pair (the core) ---------- */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
/* Astra and Luna stay side by side at every width: comparing them is the whole point. */
.panel { overflow: hidden; display: flex; flex-direction: column; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head .swatch { width: 10px; height: 10px; border-radius: 3px; }
.panel-head b { font-family: var(--serif); font-size: 18px; }
.panel-head .muted { font-size: 13px; }
.panel-meta { font-family: var(--mono); padding: 8px 18px; font-size: 12.5px; color: var(--ink-2); border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.panel-head .zoom { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.canvas {
  /* Always white: many model SVGs have transparent backgrounds drawn for a white page. */
  aspect-ratio: 6 / 5; display: grid; place-items: center; padding: 14px; cursor: zoom-in; background: #fff;
}
.canvas img { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; display: block; }
.canvas.loading img { opacity: 0; }
.canvas { position: relative; }
.canvas.loading { animation: pulse 1.2s ease-in-out infinite; }
.canvas.loading::after { content: "Dusting for prints…"; position: absolute; font: 13px var(--mono); color: #7a7a7a; }
@keyframes pulse { 50% { opacity: .6; } }
.panel.astra .swatch { background: var(--ink); }
.panel.luna .swatch { background: transparent; box-shadow: inset 0 0 0 2px var(--ink); }
.panel.unlabeled .panel-head b { font-family: var(--sans); font-size: 15px; }
.panel.pickable { cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; }
.panel.pickable:hover { transform: translateY(-2px); border-color: var(--ink-3); }
.panel.correct { border: 2px solid var(--genuine); }
.panel.wrong { border: 2px solid var(--rerouted); }

/* ---------- judge ---------- */
.judge-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.judge-head h1 { font-size: clamp(26px, 3.4vw, 38px); }
.question { text-align: center; margin: 26px auto 16px; max-width: 60ch; }
.question h2 { margin-bottom: 6px; }
.actions { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.subactions { display: flex; justify-content: center; margin-top: 10px; }

.reveal { margin-top: 26px; padding: 22px 24px; display: grid; gap: 18px; animation: rise .25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.reveal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 760px) { .reveal-grid { grid-template-columns: 1fr; } }
.reveal h3 { margin-bottom: 8px; }
.reveal { position: relative; overflow: hidden; }
.stamp, .badge-stamp {
  font: 700 22px/1 var(--mono); text-transform: uppercase; letter-spacing: .12em;
  border: 3px solid currentColor; border-radius: 8px; padding: 8px 14px;
  box-shadow: inset 0 0 0 2px var(--card), inset 0 0 0 4px currentColor; /* double rule, like a rubber stamp */
  opacity: .9; pointer-events: none; user-select: none;
}
.reveal-top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.stamp { margin-left: auto; transform: rotate(-7deg); animation: stamp .35s cubic-bezier(.2, 1.6, .4, 1) both; }
.stamp.rerouted { color: var(--rerouted); }
.stamp.genuine { color: var(--genuine); }
.badge-stamp { display: inline-block; justify-self: start; color: var(--accent); transform: rotate(-6deg); animation: stamp .35s cubic-bezier(.2, 1.6, .4, 1) both; margin-bottom: 6px; }
.lock .badge-stamp { justify-self: center; }
@keyframes stamp { from { opacity: 0; transform: rotate(-20deg) scale(2.2); } }
@media (max-width: 640px) { .stamp { font-size: 16px; } }
.youvoted { font-size: 14px; color: var(--ink-2); }
.youvoted strong.r { color: var(--rerouted); }
.youvoted strong.g { color: var(--genuine); }

/* stacked bar: 2px surface gap between segments, rounded outer ends */
.bar { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; background: var(--none); }
.bar.lg { height: 22px; border-radius: 6px; }
.bar > span { display: block; height: 100%; min-width: 0; transition: flex-basis .5s ease; }
.bar .r { background: var(--rerouted); }
.bar .g { background: var(--genuine); }
.bar .n { background: var(--none); }
.bar-legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); margin-top: 8px; flex-wrap: wrap; }
.bar-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.bar-legend b { color: var(--ink); font-variant-numeric: tabular-nums; }
.verdict { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.verdict .ic { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 11px; }
.verdict.rerouted .ic { background: var(--rerouted); }
.verdict.genuine .ic { background: var(--genuine); }
.verdict.no-votes .ic, .verdict.hidden .ic { background: var(--none); color: var(--ink-2); }

.empty { text-align: center; padding: 60px 20px; display: grid; gap: 14px; justify-items: center; }
.empty-logo { width: 72px; height: 72px; justify-self: center; }

/* ---------- welcome / tutorial ---------- */
.steps { display: flex; gap: 8px; margin-bottom: 26px; }
.steps span { height: 4px; flex: 1; border-radius: 4px; background: var(--line-2); transition: background .2s; }
.steps span.on { background: var(--ink); }
/* the current step gets the accent */
.steps span.on:has(+ span:not(.on)), .steps span.on:last-child { background: var(--accent); }
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }
.hero .stack { gap: 18px; }
.hero-art { position: relative; aspect-ratio: 1; }
.hero-logo { width: 84px; height: 84px; margin-bottom: -4px; }
.evidence { position: absolute; width: 66%; margin: 0; padding: 10px 10px 0; border-radius: 6px; overflow: visible; }
.evidence img { width: 100%; display: block; background: #fff; border-radius: 2px; }
.evidence figcaption { font: 700 13px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; padding: 12px 2px 12px; color: var(--ink-2); }
.evidence::before { /* strip of tape */
  content: ""; position: absolute; top: -12px; left: 50%; width: 96px; height: 26px; transform: translateX(-50%) rotate(-3deg);
  background: var(--tape); border: 1px solid color-mix(in srgb, var(--ink) 8%, transparent); backdrop-filter: blur(1px);
}
.evidence:nth-child(1) { left: 0; top: 4%; transform: rotate(-4deg); }
.evidence:nth-child(2) { right: 0; bottom: 2%; transform: rotate(3deg); }
.evidence:nth-child(2)::before { transform: translateX(-50%) rotate(4deg); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 640px) { .facts { grid-template-columns: 1fr; } }
.fact { padding: 16px; }
.fact b { display: block; font-family: var(--serif); font-size: 17px; margin-bottom: 4px; }
.fact p { font-size: 14px; color: var(--ink-2); }
.tut-nav { display: flex; gap: 12px; margin-top: 26px; align-items: center; }
.quiz-result { text-align: center; margin-top: 18px; font-weight: 600; min-height: 24px; }

/* ---------- results ---------- */
.headline { display: grid; grid-template-columns: auto 1fr; gap: 34px; align-items: center; padding: 28px; margin: 22px 0; }
@media (max-width: 760px) { .headline { grid-template-columns: 1fr; } }
.big-number { font-family: var(--serif); font-size: clamp(56px, 8vw, 88px); font-weight: 700; line-height: .9; font-variant-numeric: tabular-nums; }
.big-number small { font-size: .38em; color: var(--ink-3); font-weight: 500; }
.stat-row { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 14px; font-size: 13px; color: var(--ink-3); }
.stat-row b { display: block; font-size: 20px; color: var(--ink); font-variant-numeric: tabular-nums; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.tile { padding: 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); display: grid; gap: 8px; cursor: default; }
a.tile { text-decoration: none; color: inherit; cursor: pointer; transition: transform .12s, border-color .12s; }
.tile:hover { border-color: var(--ink-3); transform: translateY(-1px); }
table.data a { font-weight: 600; }
.tile .t-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.tile .t-head b { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tile .t-foot { font-size: 12px; color: var(--ink-3); display: flex; justify-content: space-between; }
.tile.hidden .bar {
  background: repeating-linear-gradient(135deg, var(--none) 0 4px, transparent 4px 8px);
}
.tile.comm { border-style: dashed; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
table.data th { color: var(--ink-3); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- upload ---------- */
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .upload-grid { grid-template-columns: 1fr; } }
.drop {
  position: relative; display: grid; place-items: center; text-align: center; gap: 6px;
  aspect-ratio: 6 / 5; border: 2px dashed var(--line-2); border-radius: var(--radius); background: var(--card);
  cursor: pointer; padding: 16px; transition: border-color .15s, background .15s; overflow: hidden;
}
.drop:hover, .drop.over { border-color: var(--ink-3); background: var(--surface); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop img { background: #fff; border-radius: 10px; position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); object-fit: contain; }
.drop .lbl { font: 700 16px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: 14px; }
textarea, select, input[type="text"] {
  font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; width: 100%;
}
.radio-row { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-row label { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: 12px; cursor: pointer; background: var(--card); }
.radio-row label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.progress { height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--ink); border-radius: 8px; transition: width .4s; }
.lock { max-width: 520px; margin: 40px auto; padding: 32px; text-align: center; display: grid; gap: 16px; }

/* ---------- overlays ---------- */
.lightbox figcaption { font-family: var(--mono); }
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(10, 9, 6, .82); display: grid; place-items: center; padding: 30px; cursor: zoom-out; }
.lightbox figure { margin: 0; max-width: min(1100px, 100%); max-height: 100%; display: grid; gap: 10px; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 110px); background: #fff; border-radius: 12px; }
.lightbox figcaption { color: #eee; text-align: center; font-size: 14px; }
.lightbox-close { position: absolute; top: 14px; right: 18px; background: none; border: 0; color: #fff; font-size: 34px; cursor: pointer; }
.tooltip {
  position: fixed; z-index: 60; pointer-events: none; background: var(--ink); color: var(--bg);
  font-size: 12px; padding: 8px 10px; border-radius: 8px; max-width: 240px; box-shadow: var(--shadow);
}
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 70;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-weight: 500; animation: rise .2s ease-out;
}

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.lock > .btn { justify-self: center; }

/* ---------- account page ---------- */
.back { margin: -6px 0 10px -12px; }
.account-summary { padding: 20px 24px; display: grid; gap: 12px; margin-bottom: 30px; }
.account-pair { margin-bottom: 34px; }
.account-pair > h2 { margin-bottom: 12px; font-size: 22px; }
.pair-foot { margin-top: 14px; padding: 16px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: 10px; }
.pair-foot.row { display: flex; }
.stamp.small { font-size: 14px; padding: 5px 9px; border-width: 2px; margin-left: 0; }
.case-link { font-size: 13px; }

/* ---------- prompt ---------- */
.prompt-box { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 18px; background: var(--card); border: 1px dashed var(--line-2); border-radius: 12px; max-width: 640px; }
.prompt-box .mono { flex: 1; font-size: 16px; }
.prompt-box .copy { padding: 8px 14px; font-size: 13px; }
.prompt-notice { border-left-color: var(--accent); }
.prompt-notice blockquote { margin: 8px 0 0; padding: 8px 12px; background: var(--card); border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }

/* ---------- shared bits used by the phone layout ---------- */
.nav-ic { display: none; width: 22px; height: 22px; }
.l-short { display: none; }
.sort { width: auto; padding: 7px 12px; border-radius: 999px; font-size: 13px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.show-more { display: flex; margin: 16px auto 0; }
.lb-switch { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); background: rgba(255, 255, 255, .14); }
.lb-switch button { color: #ddd; font-size: 14px; padding: 9px 18px; }
.lb-switch button[aria-pressed="true"] { background: #fff; color: #0a0a0a; }
.lightbox img { cursor: pointer; }

/* Touch screens: no keyboard hints, no hover-only affordances. */
@media (hover: none) {
  kbd { display: none; }
  .panel.pickable:hover, .tile:hover { transform: none; }
}

/* ---------- phones ---------- */
@media (max-width: 640px) {
  body { font-size: 15px; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  main { padding: 18px 14px 36px; }

  /* header: one row; navigation moves to a bottom tab bar */
  /* no backdrop-filter here: it would make the header the containing block for the fixed tab bar */
  .topbar { gap: 10px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); backdrop-filter: none; background: var(--bg); }
  .brand { font-size: 17px; gap: 8px; }
  .brand-logo { width: 30px; height: 30px; }
  .me { margin-left: auto; font-size: 12px; }
  .theme-toggle { width: 40px; height: 40px; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; margin: 0;
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
  }
  .nav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 52px; padding: 4px 2px; border-radius: 12px; font-size: 11px; font-weight: 600; letter-spacing: .01em;
  }
  .nav a.active { background: transparent; box-shadow: none; color: var(--ink); }
  .nav a.active .nav-ic { color: var(--accent); }
  .nav-ic { display: block; }
  .l-long { display: none; }
  .l-short { display: inline; }
  .footer { font-size: 12px; padding: 16px 14px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); max-width: calc(100% - 28px); text-align: center; border-radius: 16px; }

  /* type */
  h1 { font-size: 27px; }
  h2 { font-size: 21px; }
  .lede { font-size: 15.5px; }
  .judge-head { gap: 12px; margin-bottom: 14px; }
  .judge-head .spacer { display: none; }

  /* segmented controls fill the width */
  .judge-head > .seg, .board-controls .seg { width: 100%; }
  .seg button { flex: 1; padding: 10px 8px; min-height: 40px; }
  .filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .filters button { flex: 0 0 auto; }
  .board-controls { gap: 10px; }
  .board-controls .spacer { display: none; }
  .board-controls h2 { width: 100%; }
  .sort { font-size: 16px; min-height: 40px; }

  /* pair panels: side by side, compact */
  .pair { gap: 8px; }
  .panel { border-radius: 12px; }
  .panel-head { padding: 9px 10px; gap: 6px; }
  .panel-head b { font-size: 16px; }
  .panel-head .muted, .panel-head .zoom { display: none; }
  .panel.unlabeled .panel-head b { font-size: 14px; }
  .panel-meta { padding: 6px 10px; font-size: 10.5px; line-height: 1.35; }
  .canvas { padding: 6px; }
  .canvas.loading::after { font-size: 11px; }

  /* judging */
  .question { margin: 18px auto 12px; }
  .question h2 { font-size: 20px; }
  .question p { font-size: 14px; }
  .actions { gap: 10px; flex-wrap: nowrap; }
  .actions .btn { flex: 1; justify-content: center; padding: 16px 10px; font-size: 15px; }
  .subactions .btn { min-height: 44px; }
  .case-link { display: inline-block; padding: 8px 0; }
  .case-meta { gap: 8px; margin-bottom: 10px !important; }
  .case-meta .spacer { display: none; }
  .phone-hide { display: none; }
  .reveal { padding: 16px; margin-top: 16px; gap: 14px; }
  .reveal .row .spacer, form .row .spacer { flex: 0 0 4px; }
  .tut-nav { flex-wrap: wrap; }
  .tut-nav .spacer { display: none; }
  .tut-nav .btn.primary { flex: 1 1 auto; justify-content: center; }
  .reveal .row .btn { padding: 14px 14px; white-space: nowrap; }
  .reveal .row .btn.primary { flex: 1; justify-content: center; }
  .stamp { font-size: 15px; padding: 6px 10px; }

  /* tutorial */
  .steps { margin-bottom: 18px; }
  .hero { gap: 22px; }
  .hero-logo { width: 64px; height: 64px; }
  .hero-art { aspect-ratio: 1 / 1.08; max-width: 420px; }
  .evidence { width: 56%; padding: 7px 7px 0; }
  .evidence figcaption { font-size: 10.5px; padding: 8px 1px; }
  .evidence::before { width: 64px; height: 20px; top: -9px; }
  .evidence:nth-child(1) { top: 2%; }
  .evidence:nth-child(2) { bottom: 0; }
  .tut-nav { margin-top: 18px; }
  .quiz-result { margin-top: 12px; font-size: 14px; }

  /* case board */
  .headline { padding: 18px; gap: 16px; margin: 16px 0; }
  .big-number { font-size: 60px; }
  .stat-row { gap: 20px; }
  .tiles { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .tile { padding: 8px; gap: 6px; border-radius: 10px; }
  .tile .t-head { font-size: 12px; }
  .tile .t-head .muted { display: none; }
  .tile .bar { height: 8px; }
  .tile .t-foot .verdict { font-size: 11.5px; gap: 5px; white-space: nowrap; }
  .tile .t-foot .verdict .ic { width: 15px; height: 15px; font-size: 9px; }
  table.data { font-size: 13px; white-space: nowrap; }

  /* account page */
  .account-summary { padding: 16px; margin-bottom: 22px; }
  .account-pair { margin-bottom: 24px; }
  .pair-foot { padding: 14px; }
  .pair-foot.row { flex-wrap: wrap; }
  .pair-foot.row > .muted { width: 100%; font-size: 13px; }
  .pair-foot.row .spacer { display: none; }
  .pair-foot.row .btn { flex: 1; justify-content: center; min-height: 46px; padding: 12px 8px; }

  /* upload */
  .upload-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .drop { aspect-ratio: 4 / 5; padding: 10px; border-radius: 12px; }
  .drop .lbl { font-size: 13px; }
  .drop .muted { font-size: 12px; }
  .radio-row label { flex: 1 1 auto; justify-content: center; min-height: 46px; }
  .prompt-box { flex-wrap: wrap; }
  .prompt-box .mono { font-size: 15px; }
  .prompt-box .copy { min-height: 40px; }
  .check input { width: 20px; height: 20px; flex: none; }
  textarea, select, input[type="text"] { font-size: 16px; } /* < 16px makes iOS zoom the page on focus */
  form .row .btn.primary { flex: 1; justify-content: center; }
  .lock { margin: 16px auto; padding: 24px 18px; }

  /* viewer */
  .lightbox { padding: 64px 10px 24px; }
  .lightbox img { max-height: calc(100dvh - 150px); }
}

/* smallest phones (e.g. 320px): logo-only brand so the header stays on one row */
@media (max-width: 360px) {
  .brand > span:not(.logo) { display: none; }
  .question h2 { font-size: 18px; }
  .question p { display: none; } /* the heading carries the question; keeps the vote buttons above the fold */
  .actions .btn { font-size: 14px; padding: 15px 8px; }
}

.drop.rendering::after { content: "Rendering…"; position: absolute; font: 13px var(--mono); color: var(--ink-3); }
