/* Lookalike web app. "Chrome Y2K deck": cool grey ground, ink, one cyan accent, chunky
   Bricolage display type, black pill buttons with a hard accent shadow. Phone layout below 760px. */

:root {
  color-scheme: light;
  --bg: #E6E8ED;
  --surface: #FFFFFF;
  --ink: #111318;
  --muted: #535965;
  --line: rgba(17, 19, 24, 0.14);
  --soft: #F1F2F5;
  --accent: #2FEFFF;
  --accent-deep: #0FA3B8; /* accent strokes on white, decoration only */
  --lime: #B6FF2F;
  --pink: #FF3DF2;
  --dark: #111318;
  --dark-2: #30343C;
  --dark-ink: #E6E8ED;
  --dark-muted: #9AA0AB;
  --ok: #0F7B5F;
  --ok-bg: #E3F4EB;
  --warn: #9A4A07;
  --warn-bg: #FDF0E1;
  --cam: #0E0F12;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Bricolage Grotesque", Inter, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sh-1: 0 4px 14px rgba(22, 19, 15, 0.08);
  --sh-2: 0 18px 40px rgba(22, 19, 15, 0.16);
  --sh-3: 0 26px 60px rgba(17, 19, 24, 0.22);
  --ease-pop: cubic-bezier(0.3, 1.6, 0.5, 1);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}
main { flex: 1; }
h1, h2, p, figure { margin: 0; }
h1, h2 { font-family: var(--display); font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
img { max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--ink); }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
h1:focus, [tabindex="-1"]:focus { outline: none; }

.container { width: 100%; max-width: 1240px; margin-inline: auto; padding-inline: 32px; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.icon-xs { width: 14px; height: 14px; stroke-width: 2.8; }
.icon-sm { width: 18px; height: 18px; }
.icon-lg { width: 30px; height: 30px; }
.small { font-size: 13px; }
.only-mobile { display: none; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.skip-link { position: absolute; left: 16px; top: -60px; z-index: 80; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 12px; color: #fff; }

/* ---------- Top bar and footer ---------- */
.topbar-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-block: 20px; }
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--ink); text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 23px; letter-spacing: -0.03em; }
.brand:hover { color: var(--ink); }
.topnav { display: flex; flex-wrap: wrap; gap: 6px; font-size: 14px; font-weight: 600; }
.topnav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; color: var(--ink); text-decoration: none; }
.topnav a:hover { background: var(--surface); }
.footer { margin-top: 24px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-block: 24px; border-top: 1.5px solid var(--line); font-size: 13px; color: var(--muted); }

/* ---------- Shared pieces ---------- */
.card { background: var(--surface); border-radius: 28px; box-shadow: var(--sh-1); }
.card-title { font-size: 22px; }
.eyebrow { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.sub { font-size: 16px; color: var(--muted); }
.view-head { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.view-head h1 { font-size: 44px; }
.link-back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px 0 14px; border: 1.5px solid var(--ink); border-radius: 999px; background: transparent; font-size: 14px; font-weight: 600; color: var(--ink); }
.link-back:hover { background: var(--surface); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); box-shadow: 0 5px 0 var(--accent); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 0 var(--accent); }
.btn-primary:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--accent); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-secondary:hover { background: var(--surface); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-big { min-height: 64px; padding: 0 10px 0 28px; justify-content: space-between; gap: 18px; font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: -0.01em; box-shadow: 0 6px 0 var(--accent); }
.btn-big:hover { box-shadow: 0 7px 0 var(--accent); }
.btn-big:active { box-shadow: 0 2px 0 var(--accent); transform: translateY(4px); }
.btn-orb { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: var(--ink); display: flex; align-items: center; justify-content: center; }
.btn-orb .icon { width: 22px; height: 22px; }
.btn-link { min-height: 48px; padding: 0 4px; border: 0; background: none; color: var(--ink); font-weight: 600; font-size: 15px; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
.btn-link:hover { text-decoration-thickness: 3px; }

.circle-btn { flex: none; width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); display: flex; align-items: center; justify-content: center; transition: transform 0.15s, background-color 0.15s; }
.circle-btn:hover { background: var(--surface); }
.circle-btn:active { transform: scale(0.92); }
.circle-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.circle-btn-lg { width: 64px; height: 64px; background: var(--surface); }
.circle-btn-lg .icon { width: 24px; height: 24px; stroke-width: 2.4; }

.seg { display: inline-flex; gap: 6px; }
.seg button { min-height: 44px; min-width: 76px; padding: 0 16px; border: 1.5px solid var(--ink); border-radius: 999px; background: transparent; color: var(--ink); font-size: 14px; font-weight: 600; white-space: nowrap; }
.seg button:hover { background: var(--surface); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.kpicker { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.kpicker legend { float: left; padding: 0; font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.privacy { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.privacy .icon { margin-top: 1px; }

/* ---------- Start ---------- */
.view-start { display: flex; flex-direction: column; gap: 56px; padding-block: 24px 64px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: center; gap: 32px; }
.hero-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 22px; }
.hero-copy h1 { font-size: clamp(3.6rem, 7.2vw, 6.4rem); line-height: 0.9; letter-spacing: -0.045em; }
.hl { display: inline-block; padding: 0 0.16em 0.06em; border-radius: 0.26em; background: var(--accent); color: var(--ink); transform: rotate(-2deg); }
.live-pill { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px 0 12px; border-radius: 999px; background: var(--surface); box-shadow: var(--sh-1); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: live 1.4s ease-out infinite; }
.live-sep { color: var(--muted); }
.lede { max-width: 30rem; font-size: 17px; line-height: 1.55; color: var(--muted); }
.hero-cta { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin-top: 6px; }
.hero-cta .btn-link { align-self: center; }
.dz-hint { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 14px; border: 1.5px dashed rgba(17, 19, 24, 0.3); border-radius: 18px; font-size: 13px; color: var(--muted); transition: border-color 0.15s, background-color 0.15s; }
body.is-dragging .dz-hint { border-color: var(--ink); background: rgba(47, 239, 255, 0.25); }
.hero-cta .privacy { justify-content: center; margin-top: 8px; }

/* The fanned cards: real library faces, purely decorative. */
.fan { position: relative; height: 520px; display: flex; align-items: center; justify-content: center; }
.fan > * { --z: 1.32; }
.fan-card { position: absolute; width: 150px; height: 200px; border: 4px solid #fff; border-radius: 24px; background: #fff; box-shadow: var(--sh-2); scale: var(--z); }
.fan-card.is-missing { display: none; }
.fan-in { position: relative; height: 100%; border-radius: 20px; overflow: hidden; background: var(--dark-2); }
.fan-in img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.fan-brackets { position: absolute; inset: 12px; pointer-events: none; opacity: 0.85;
  background:
    linear-gradient(#fff, #fff) top left / 16px 2.5px no-repeat,
    linear-gradient(#fff, #fff) top left / 2.5px 16px no-repeat,
    linear-gradient(#fff, #fff) top right / 16px 2.5px no-repeat,
    linear-gradient(#fff, #fff) top right / 2.5px 16px no-repeat; }
.fan-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 34px 12px 12px; background: linear-gradient(to bottom, rgba(22, 19, 15, 0), rgba(22, 19, 15, 0.85)); color: #fff; }
.fan-name { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; font-family: var(--display); font-weight: 800; font-size: 20px; line-height: 1; letter-spacing: -0.02em; }
.fan-name span { padding: 3px 7px; border-radius: 999px; background: var(--accent); color: var(--ink); font-size: 13px; letter-spacing: 0; }
/* Side cards hide one edge under their neighbour: keep name and score on the visible edge. */
.fan-c2 .fan-name, .fan-c5 .fan-name { align-items: flex-end; text-align: right; }
.fan-bar { display: block; margin-top: 7px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.28); overflow: hidden; }
.fan-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); animation: bar-grow 1.2s var(--ease-out) 0.5s both; }
.fan-top { width: 188px; height: 250px; border-width: 5px; border-radius: 28px; box-shadow: 0 28px 60px rgba(22, 19, 15, 0.26); }
.fan-top .fan-in { border-radius: 23px; }
.fan-top .fan-cap { padding: 44px 14px 14px; }
.fan-top .fan-name { font-size: 26px; }
.fan-match { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; }
.fan-match .fan-bar { flex: 1; margin: 0; height: 5px; }
.fan-zoom { animation: zoom 9s ease-in-out infinite; }
.fan-badge { position: absolute; top: -18px; right: -18px; width: 64px; height: 64px; border-radius: 50%; background: conic-gradient(var(--accent) 0 87%, var(--dark-2) 87% 100%); display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 20px rgba(22, 19, 15, 0.25); animation: pop 0.7s var(--ease-pop) 0.4s both; }
.fan-badge span { width: 52px; height: 52px; border-radius: 50%; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: 18px; }
.fan-c1 { transform: translate(-110px, 22px) rotate(-6deg) scale(0.86); animation: bob1 5s ease-in-out infinite; }
.fan-c2 { transform: translate(110px, 26px) rotate(6deg) scale(0.86); animation: bob2 5.6s ease-in-out infinite; }
.fan-c3 { transform: translate(0, -18px) rotate(-2deg); animation: bob3 4.6s ease-in-out infinite; }
.fan-c4 { transform: translate(-186px, 40px) rotate(-11deg) scale(0.72); animation: bob4 6.2s ease-in-out infinite; }
.fan-c5 { transform: translate(186px, 44px) rotate(11deg) scale(0.72); animation: bob5 5.8s ease-in-out infinite; }
.fan-you { position: absolute; bottom: 10px; width: 120px; height: 58px; border-radius: 999px; background: #fff; box-shadow: 0 10px 30px rgba(22, 19, 15, 0.14); display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; font-size: 15px; scale: var(--z); animation: bobyou 4s ease-in-out infinite; }
.fan-dash { animation: dash 1s linear infinite; }

@keyframes bob1 { 0%, 100% { transform: translate(-110px, 22px) rotate(-6deg) scale(0.86); } 50% { transform: translate(-112px, 12px) rotate(-7deg) scale(0.86); } }
@keyframes bob2 { 0%, 100% { transform: translate(110px, 26px) rotate(6deg) scale(0.86); } 50% { transform: translate(112px, 16px) rotate(7deg) scale(0.86); } }
@keyframes bob3 { 0%, 100% { transform: translate(0, -18px) rotate(-2deg); } 50% { transform: translate(0, -30px) rotate(2deg); } }
@keyframes bob4 { 0%, 100% { transform: translate(-186px, 40px) rotate(-11deg) scale(0.72); } 50% { transform: translate(-188px, 30px) rotate(-12deg) scale(0.72); } }
@keyframes bob5 { 0%, 100% { transform: translate(186px, 44px) rotate(11deg) scale(0.72); } 50% { transform: translate(188px, 34px) rotate(12deg) scale(0.72); } }
@keyframes bobyou { 0%, 100% { transform: translate(0, 0) rotate(3deg); } 50% { transform: translate(0, -8px) rotate(-1deg); } }
@keyframes dash { to { stroke-dashoffset: -24; } }
@keyframes zoom { 0%, 100% { transform: scale(1.04); } 50% { transform: scale(1.12); } }
@keyframes bar-grow { from { width: 0; } }
@keyframes pop { 0% { transform: scale(0) rotate(-20deg); } 70% { transform: scale(1.15) rotate(6deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(47, 239, 255, 0.7); } 100% { box-shadow: 0 0 0 8px rgba(47, 239, 255, 0); } }

/* Below the fold: how it works and options. */
.start-more { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.steps li { display: flex; flex-direction: column; gap: 6px; padding: 20px; border-radius: 24px; background: var(--surface); box-shadow: var(--sh-1); }
.step-num { align-self: flex-start; margin-bottom: 10px; padding: 3px 9px; border-radius: 999px; background: var(--ink); color: var(--accent); font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; }
.step-title { font-family: var(--display); font-weight: 800; font-size: 20px; line-height: 1.1; letter-spacing: -0.02em; }
.step-text { font-size: 14px; color: var(--muted); }
.start-opts { display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 22px; border-radius: 24px; background: var(--dark); color: var(--dark-ink); }
.start-opts .kpicker legend { float: none; margin-bottom: 10px; color: var(--dark-muted); }
.start-opts .kpicker { flex-direction: column; align-items: stretch; }
.start-opts .seg { display: flex; }
.start-opts .seg button { flex: 1; min-width: 0; border-color: var(--dark-2); color: var(--dark-ink); }
.start-opts .seg button:hover { background: var(--dark-2); }
.start-opts .seg button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.start-opts :focus-visible { outline-color: var(--accent); }
.tips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tips li { display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1.5px solid var(--dark-2); font-size: 13px; font-weight: 500; }
.tips .icon { color: var(--accent); }

/* ---------- Camera ---------- */
.view-camera { display: flex; flex-direction: column; gap: 24px; padding-block: 8px 56px; }
.cam-layout { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.viewfinder { position: relative; flex: 999 1 600px; min-width: 0; aspect-ratio: 4 / 3; max-height: 620px; border-radius: 28px; overflow: hidden; background: var(--cam); color: #fff; box-shadow: var(--sh-2); }
.viewfinder video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--cam); }
.viewfinder video.mirrored { transform: scaleX(-1); }
.oval { position: absolute; left: 50%; top: 46%; height: 72%; aspect-ratio: 3 / 4; transform: translate(-50%, -50%); border-radius: 50%; border: 3px solid var(--accent); box-shadow: 0 0 0 200vmax rgba(8, 9, 11, 0.5), 0 0 24px rgba(47, 239, 255, 0.35); pointer-events: none; }
.cam-top { position: absolute; top: 20px; left: 0; right: 0; display: flex; justify-content: center; }
.viewfinder .cam-close { display: none; } /* desktop has the Back button; phones get this one */
.cam-status { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px 0 12px; border-radius: 999px; background: #fff; color: var(--ink); font-size: 13px; font-weight: 600; white-space: nowrap; box-shadow: var(--sh-1); }
.cam-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dark-muted); }
.cam-status.is-live::before { background: var(--accent); animation: live 1.4s ease-out infinite; }
.cam-bottom { position: absolute; left: 0; right: 0; bottom: 24px; }
.cam-hints { display: none; }
.cam-controls { display: flex; align-items: center; justify-content: center; gap: 40px; }
.round-btn { width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.16); color: #fff; display: flex; align-items: center; justify-content: center; }
.round-btn:hover { background: rgba(255, 255, 255, 0.26); }
.round-btn .icon { width: 22px; height: 22px; }
.round-spacer { width: 52px; height: 52px; }
.shutter { width: 78px; height: 78px; padding: 0; border-radius: 50%; border: 4px solid #fff; background: transparent; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 4px rgba(47, 239, 255, 0.5); }
.shutter span { width: 58px; height: 58px; border-radius: 50%; background: var(--accent); transition: transform 0.1s; }
.shutter:active span { transform: scale(0.9); }
.shutter:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.shutter:disabled span { background: #fff; }
.viewfinder :focus-visible { outline-color: var(--accent); }

.cam-side { flex: 1 1 300px; min-width: 0; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; }
.check-icon { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--bg); color: var(--ink); display: flex; align-items: center; justify-content: center; }
.check-title { font-size: 15px; font-weight: 600; }
.check-text { margin-top: 2px; font-size: 13px; color: var(--muted); }
.checklist li.is-ok .check-icon { background: var(--ink); color: var(--accent); }
.checklist li.is-ok .check-text { color: var(--ok); }
.checklist li.is-warn .check-icon { background: var(--warn-bg); color: var(--warn); }
.checklist li.is-warn .check-text { color: var(--warn); }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.field select { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--surface); font-size: 15px; }
.checkbox { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; cursor: pointer; }
.checkbox input { width: 20px; height: 20px; margin: 0; accent-color: var(--ink); }
.cam-side .btn-primary { min-height: 56px; font-family: var(--display); font-weight: 800; font-size: 18px; }

/* ---------- Analyzing: the scan ---------- */
/* A full-screen takeover on the grey ground: a dark surveillance feed, a dark readout card,
   white while searching, cyan on lock-on, lime on the match. */
.view-analyzing {
  --hud: var(--accent);
  --hud-dim: rgba(47, 239, 255, 0.35);
  --hud-faint: rgba(47, 239, 255, 0.12);
  --lock: var(--accent);
  --hit: var(--lime);
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: auto;
  background: var(--bg);
  color: var(--ink);
  animation: scan-in 0.35s ease-out;
}
body[data-view="analyzing"] { overflow: hidden; }
.scan { min-height: 100%; display: flex; flex-direction: column; max-width: 1240px; margin-inline: auto; padding: 18px 32px 28px; gap: 18px; }

.scan-bar { display: flex; align-items: center; gap: 18px; font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.scan-tag { flex: 1; color: var(--ink); }
.scan-live { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
.scan-dot { width: 8px; height: 8px; border-radius: 50%; background: #FF3B3B; animation: scan-blink 1.2s steps(2, start) infinite; }
.scan-clock { min-width: 9ch; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }

.scan-main { flex: 1; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, 1fr); gap: 40px; align-items: center; }
.scan-stage { --box-h: min(64vh, 620px); --ar: 0.8; display: flex; flex-direction: column; align-items: center; gap: 14px; min-width: 0; }

/* The photo frame takes the photo's own aspect ratio, so face-box percentages land on the face. */
.scan-frame {
  position: relative;
  width: min(100%, calc(var(--box-h) * var(--ar)));
  aspect-ratio: var(--ar);
  border-radius: 22px;
  background: radial-gradient(circle at 50% 42%, #3A434C, #0B0E12 70%);
  box-shadow: var(--sh-3);
  overflow: hidden;
}
.scan-frame::after { /* scanlines and vignette */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 45%, transparent 55%, rgba(0, 0, 0, 0.6)),
    repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 4px);
}
.scan-frame > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: grayscale(0.8) contrast(1.2) brightness(0.85) sepia(0.3) hue-rotate(150deg) saturate(1.6); transition: filter 0.6s ease; animation: scan-develop 1.4s ease-out, scan-flicker 4s infinite 1.4s; }
.scan[data-phase="match"] .scan-frame > img { filter: none; animation: none; }
.scan-noise { position: absolute; inset: 0; opacity: 0.07; mix-blend-mode: screen; background: repeating-radial-gradient(circle at 17% 32%, #fff 0 0.5px, transparent 0.5px 3px), repeating-radial-gradient(circle at 73% 61%, #fff 0 0.5px, transparent 0.5px 4px); animation: scan-noise 0.4s steps(3) infinite; }
.scan-grid { position: absolute; inset: 0; background-image: linear-gradient(var(--hud-faint) 1px, transparent 1px), linear-gradient(90deg, var(--hud-faint) 1px, transparent 1px); background-size: 10% 10%; transition: opacity 0.6s; }
.scan[data-phase="match"] .scan-grid { opacity: 0; }
.scan-sweep { position: absolute; left: 0; right: 0; top: 0; height: 18%; background: linear-gradient(to bottom, transparent, rgba(47, 239, 255, 0.3) 92%, var(--hud) 96%, transparent); animation: scan-sweep 2s cubic-bezier(0.5, 0, 0.5, 1) infinite alternate; }
.scan[data-phase="match"] .scan-sweep, .scan[data-phase="prepare"] .scan-sweep { opacity: 0; }
.scan[data-phase="prepare"] .scan-frame::before { content: "Developing"; position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: 0.3em; text-transform: uppercase; color: var(--dark-ink); animation: scan-blink 0.8s steps(2, start) infinite; }
.scan-corner { position: absolute; z-index: 1; width: 26px; height: 26px; border: 0 solid var(--dark-ink); opacity: 0.9; }
.scan-corner.tl { top: 14px; left: 14px; border-top-width: 2px; border-left-width: 2px; }
.scan-corner.tr { top: 14px; right: 14px; border-top-width: 2px; border-right-width: 2px; }
.scan-corner.bl { bottom: 14px; left: 14px; border-bottom-width: 2px; border-left-width: 2px; }
.scan-corner.br { bottom: 14px; right: 14px; border-bottom-width: 2px; border-right-width: 2px; }

/* The reticle: wanders while searching, then flies onto the real face box. */
.scan-reticle {
  --c: #fff;
  position: absolute;
  z-index: 1;
  left: 35%;
  top: 30%;
  width: 30%;
  height: 36%;
  transition: left 0.45s cubic-bezier(0.3, 0, 0.2, 1), top 0.45s cubic-bezier(0.3, 0, 0.2, 1), width 0.45s cubic-bezier(0.3, 0, 0.2, 1), height 0.45s cubic-bezier(0.3, 0, 0.2, 1);
  background:
    linear-gradient(var(--c), var(--c)) top left / 16px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) top left / 2px 16px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 16px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 2px 16px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 16px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 2px 16px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 16px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 2px 16px no-repeat;
}
.scan[data-phase="idle"] .scan-reticle, .scan[data-phase="prepare"] .scan-reticle { opacity: 0; }
.scan-reticle::before, .scan-reticle::after { /* crosshair */
  content: "";
  position: absolute;
  background: var(--hud);
  opacity: 0.45;
}
.scan-reticle::before { left: 50%; top: -14px; bottom: -14px; width: 1px; }
.scan-reticle::after { top: 50%; left: -14px; right: -14px; height: 1px; }
.scan-reticle.is-locked { --c: var(--lock); transition-duration: 0.6s; transition-timing-function: cubic-bezier(0.7, 0, 0.2, 1); animation: scan-lock 0.6s ease-out; border-radius: 6px; box-shadow: 0 0 0 1px rgba(47, 239, 255, 0.35), inset 0 0 40px rgba(47, 239, 255, 0.12); }
.scan-reticle.is-locked::before, .scan-reticle.is-locked::after { opacity: 0; transition: opacity 0.3s 0.4s; }
.scan-reticle.is-match { --c: var(--hit); box-shadow: 0 0 0 1px rgba(182, 255, 47, 0.5), 0 0 30px rgba(182, 255, 47, 0.3); }
.scan-reticle-label { position: absolute; left: 0; bottom: calc(100% + 6px); padding: 2px 6px; border-radius: 3px; white-space: nowrap; font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); background: var(--c); }

.scan-mesh { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.mesh-line, .mesh-dot { fill: none; vector-effect: non-scaling-stroke; opacity: 0; }
.mesh-line { stroke: #fff; stroke-width: 1; }
.mesh-dot { stroke: var(--c); stroke-width: 5; stroke-linecap: round; }
.scan-reticle.is-locked .mesh-dot { animation: mesh-pop 0.25s ease-out forwards; animation-delay: calc(250ms + var(--i) * 9ms); }
.scan-reticle.is-locked .mesh-line { animation: mesh-fade 0.3s ease-out forwards; animation-delay: calc(450ms + var(--i) * 7ms); }
.scan[data-phase="match"] .mesh-line { opacity: 0.35 !important; }

/* The 512-D signature, as flickering bars under the feed. */
.scan-sig { display: flex; align-items: flex-end; gap: 3px; width: min(100%, calc(var(--box-h) * var(--ar))); height: 34px; }
.scan-sig span { --h: 0.1; flex: 1; height: calc(var(--h) * 100%); min-height: 3px; border-radius: 2px; background: rgba(17, 19, 24, 0.2); transition: height 0.07s linear, background 0.3s; }
.scan-sig span:nth-child(3n) { background: rgba(17, 19, 24, 0.32); }
.scan[data-phase="encode"] .scan-sig span, .scan[data-phase="xref"] .scan-sig span { background: var(--ink); }
.scan[data-phase="encode"] .scan-sig span:nth-child(3n), .scan[data-phase="xref"] .scan-sig span:nth-child(3n) { background: var(--accent-deep); }
.scan[data-phase="match"] .scan-sig span { background: var(--ink); }

/* The HUD column. */
.scan-hud { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.scan-step { font-size: 14px; font-weight: 600; color: var(--muted); }
.scan-hud h1 { margin-top: -8px; font-size: 48px; letter-spacing: -0.035em; }

.scan-panel { padding: 16px; border-radius: 22px; background: var(--dark); color: var(--dark-ink); font-family: var(--mono); font-size: 12px; }
.scan-panel-head { display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dark-muted); }
.scan-eq { display: flex; align-items: flex-end; gap: 2px; height: 18px; }
.scan-eq i { display: block; width: 3px; height: 18px; border-radius: 2px; background: var(--dark-ink); transform-origin: bottom; animation: eq 0.55s ease-in-out infinite alternate; }
.scan-eq i:nth-child(3n + 1) { background: var(--accent); }
.scan-eq i:nth-child(2) { animation-delay: -0.1s; } .scan-eq i:nth-child(3) { animation-delay: -0.35s; }
.scan-eq i:nth-child(4) { animation-delay: -0.2s; } .scan-eq i:nth-child(5) { animation-delay: -0.45s; }
.scan-eq i:nth-child(6) { animation-delay: -0.05s; } .scan-eq i:nth-child(7) { animation-delay: -0.3s; }
.scan-eq i:nth-child(8) { animation-delay: -0.15s; } .scan-eq i:nth-child(9) { animation-delay: -0.5s; }
.scan-eq i:nth-child(10) { animation-delay: -0.25s; } .scan-eq i:nth-child(11) { animation-delay: -0.4s; }
.scan-eq i:nth-child(12) { animation-delay: -0.12s; } .scan-eq i:nth-child(13) { animation-delay: -0.33s; }
.scan-eq i:nth-child(14) { animation-delay: -0.08s; }
.scan[data-phase="match"] .scan-eq i { animation-play-state: paused; }

.scan-log { list-style: none; margin: 14px 0 0; padding: 0; min-height: calc(6 * 1.75em); font-size: 12.5px; line-height: 1.75; color: var(--dark-muted); }
.scan-log li { display: flex; gap: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-log li:last-child { color: var(--dark-ink); }
.scan-log li:last-child::after { content: "▍"; color: var(--accent); animation: scan-blink 1s steps(2, start) infinite; }
.log-time { color: #6B717C; flex: none; }

.scan-segs { margin-top: 14px; display: flex; gap: 10px; }
.scan-seg { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.scan-seg > span { display: flex; justify-content: space-between; font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dark-muted); transition: color 0.2s; }
.scan-seg i { display: block; height: 6px; border-radius: 6px; background: var(--dark-2); overflow: hidden; }
.scan-seg b { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); }
.scan[data-phase="lock"] .s1 b { width: 100%; transition: width 0.7s linear; }
.scan[data-phase="encode"] .s1 b, .scan[data-phase="xref"] .s1 b, .scan[data-phase="match"] .s1 b { width: 100%; }
.scan[data-phase="encode"] .s2 b { width: 100%; transition: width 0.5s linear; }
.scan[data-phase="xref"] .s2 b, .scan[data-phase="match"] .s2 b { width: 100%; }
.scan[data-phase="xref"] .s3 b { width: 100%; transition: width 1.5s linear; }
.scan[data-phase="match"] .s3 b { width: 100%; background: var(--lime); }
.scan[data-phase="match"] .s1 b, .scan[data-phase="match"] .s2 b { background: var(--lime); }
.scan:is([data-phase="lock"], [data-phase="encode"], [data-phase="xref"], [data-phase="match"]) .s1 > span,
.scan:is([data-phase="encode"], [data-phase="xref"], [data-phase="match"]) .s2 > span,
.scan:is([data-phase="xref"], [data-phase="match"]) .s3 > span { color: var(--dark-ink); }

.scan-xref { position: relative; display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 16px; align-items: center; padding: 10px 18px 10px 10px; border-radius: 24px; background: var(--surface); box-shadow: var(--sh-1); }
.scan-xref-img { position: relative; width: 84px; aspect-ratio: 4 / 5; border-radius: 16px; overflow: hidden; background: repeating-linear-gradient(45deg, #DADDE3 0 6px, #E6E8ED 6px 12px); }
.scan-xref-img img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.3); }
.scan-xref-img img:not([src]) { visibility: hidden; }
.scan[data-phase="match"] .scan-xref-img img { filter: none; transition: filter 0.4s; }
.scan[data-phase="match"] .scan-xref-img { box-shadow: 0 0 0 3px var(--lime); }
.scan-xref-title { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.scan-xref-name { margin-top: 4px; font-family: var(--display); font-size: 26px; font-weight: 800; line-height: 1.1; letter-spacing: -0.025em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-count { margin-top: 6px; font-family: var(--mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.scan-count span:first-child { color: var(--ink); font-weight: 700; }
.scan-stamp { position: absolute; right: 14px; top: -16px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--ink); background: var(--lime); box-shadow: 0 8px 20px rgba(17, 19, 24, 0.2); transform: rotate(-4deg); animation: scan-stamp 0.5s var(--ease-pop); }

.scan-actions { display: flex; gap: 10px; }
.scan-actions .btn { min-height: 52px; }
.scan-actions .btn-primary { flex: 1; }

@keyframes scan-in { from { opacity: 0; } }
@keyframes scan-blink { to { visibility: hidden; } }
@keyframes scan-sweep { from { transform: translateY(-100%); } to { transform: translateY(560%); } }
@keyframes scan-noise { 33% { background-position: 3px 1px, -2px 2px; } 66% { background-position: -1px 3px, 2px -1px; } }
@keyframes scan-develop { from { filter: blur(10px) brightness(1.9) sepia(0.8); } }
@keyframes scan-flicker { 0%, 92%, 100% { opacity: 1; } 93% { opacity: 0.8; } 95% { opacity: 1; } 97% { opacity: 0.88; } }
@keyframes scan-lock { 0% { transform: scale(1.6); opacity: 0; } 60% { transform: scale(0.96); opacity: 1; } 100% { transform: none; } }
@keyframes mesh-pop { from { opacity: 0; } to { opacity: 1; } }
@keyframes mesh-fade { to { opacity: 0.75; } }
@keyframes scan-stamp { from { transform: rotate(-4deg) scale(0); } }
@keyframes eq { from { transform: scaleY(0.15); } to { transform: scaleY(1); } }

/* ---------- Results ---------- */
.view-results { display: flex; flex-direction: column; gap: 18px; padding-block: 4px 48px; }
.res-head { display: flex; align-items: center; gap: 18px; }
.res-title { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.res-title h1 { font-size: 44px; }
.cat-picker { margin: 0; padding: 0; border: 0; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--ink); background: transparent; font-size: 14px; font-weight: 600; white-space: nowrap; }
.chip:hover { background: var(--surface); }
.chip-count { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
.chip[aria-pressed="true"] .chip-count { color: var(--accent); }

.res-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 40px; align-items: start; }
.deck-col { position: relative; display: flex; flex-direction: column; align-items: center; gap: 24px; min-width: 0; padding-top: 18px; }

/* The deck: the current match on top, the next two fanned behind it. */
.deck-wrap { display: flex; flex-direction: column; align-items: center; gap: 30px; width: 100%; }
.deck { --deck-w: 340px; --deck-h: 500px; position: relative; width: min(100%, var(--deck-w)); height: var(--deck-h); }
.deck-back { position: absolute; inset: 0; border-radius: 28px; background: var(--surface); overflow: hidden; transition: transform 0.35s var(--ease-out); }
.deck-back img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.deck-back-2 { transform: translate(16px, 14px) rotate(7deg); box-shadow: 0 10px 30px rgba(17, 19, 24, 0.08); }
.deck-back-2 img { opacity: 0.35; }
.deck-back-1 { transform: translate(-12px, 8px) rotate(-5deg); box-shadow: 0 14px 34px rgba(17, 19, 24, 0.1); }
.deck-back-1 img { opacity: 0.55; }
.best {
  position: absolute;
  inset: 0;
  padding: 10px;
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--sh-3);
  display: flex;
  flex-direction: column;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  transform: translateX(var(--dx, 0)) rotate(var(--rot, 0deg));
  transition: transform 0.3s var(--ease-out);
}
.best.is-in { animation: card-in 0.6s var(--ease-out) both; }
.best.is-dragging { transition: none; cursor: grabbing; }
.best.is-dealt { animation: deal-in 0.5s var(--ease-out) both; }
.best.is-dealt.from-left { animation-name: deal-in-left; }
.best:focus-visible { outline-offset: 6px; }
.best-photo { position: relative; flex: 1; min-height: 0; border-radius: 20px; overflow: hidden; background: var(--soft); }
.best-photo > img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; pointer-events: none; }
.best-rank { position: absolute; left: 12px; top: 12px; padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.92); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.best-you { position: absolute; right: 12px; top: 12px; width: 58px; height: 58px; border-radius: 50%; overflow: hidden; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--ink), var(--sh-1); background: var(--soft); }
.best-you img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; display: block; pointer-events: none; }
.best-info { padding: 14px 90px 6px 8px; min-height: 76px; display: flex; flex-direction: column; justify-content: flex-end; }
.best-info h2 { font-size: 32px; overflow-wrap: anywhere; }
.best-extra { margin-top: 4px; font-size: 13px; color: var(--muted); }
.best-badge { position: absolute; right: -14px; bottom: 54px; width: 88px; height: 88px; border-radius: 50%; background: var(--accent); color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; box-shadow: 0 10px 24px rgba(17, 19, 24, 0.2); transform: rotate(6deg); }
.best.is-in .best-badge { animation: badge-pop 0.7s var(--ease-pop) 0.4s both; }
.best.is-dealt .best-badge { animation: badge-pop 0.6s var(--ease-pop) 0.15s both; }
.best-pct { font-family: var(--display); font-weight: 800; font-size: 28px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.best-word { margin-top: 2px; font-size: 11px; font-weight: 700; }

.deck-controls { display: flex; align-items: center; justify-content: center; gap: 18px; }
.deck-count { min-width: 3.6em; text-align: center; font-family: var(--display); font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.btn-next { padding: 0 28px; justify-content: center; gap: 10px; font-size: 18px; }
.btn-next .nudge { width: 22px; height: 22px; stroke-width: 2.4; animation: nudge 1.4s ease-in-out infinite; }

@keyframes card-in { from { opacity: 0; transform: translateY(30px) rotate(4deg) scale(0.95); } }
@keyframes deal-in { from { opacity: 0; transform: translateX(70px) rotate(8deg) scale(0.96); } }
@keyframes deal-in-left { from { opacity: 0; transform: translateX(-70px) rotate(-8deg) scale(0.96); } }
@keyframes badge-pop { 0% { transform: scale(0) rotate(-25deg); } 70% { transform: scale(1.15) rotate(8deg); } 100% { transform: scale(1) rotate(6deg); } }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(6px); } }

/* One burst of confetti when the results land. */
.confetti { position: absolute; inset: 0 0 auto 0; height: 320px; pointer-events: none; overflow: hidden; z-index: 2; }
.confetti i { position: absolute; top: 0; width: 8px; height: 14px; border-radius: 2px; opacity: 0; }
.confetti.is-on i { animation: confetti 2.6s ease-in 1 both; }
.confetti i:nth-child(1) { left: 8%; background: var(--accent); }
.confetti i:nth-child(2) { left: 22%; background: var(--ink); animation-delay: 0.4s; }
.confetti i:nth-child(3) { left: 38%; background: var(--lime); animation-delay: 0.9s; }
.confetti i:nth-child(4) { left: 54%; background: var(--accent); animation-delay: 0.2s; }
.confetti i:nth-child(5) { left: 68%; background: var(--pink); animation-delay: 0.7s; }
.confetti i:nth-child(6) { left: 80%; background: var(--ink); animation-delay: 1.2s; }
.confetti i:nth-child(7) { left: 92%; background: var(--lime); animation-delay: 0.5s; }
.confetti i:nth-child(8) { left: 30%; background: var(--pink); animation-delay: 1.5s; }
@keyframes confetti { 0% { transform: translateY(-20px) rotate(0); opacity: 0; } 10% { opacity: 1; } 100% { transform: translateY(300px) rotate(540deg); opacity: 0; } }

/* Research-group verdict. */
.verdict { position: relative; width: 100%; max-width: 560px; padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.verdict h2 { font-size: 34px; overflow-wrap: anywhere; }
.verdict-why { color: var(--muted); }
.verdict-others { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.verdict-others li { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 500; }
.verdict-others .vo-name { flex: 0 1 55%; min-width: 0; overflow-wrap: anywhere; }
.verdict-others .bar { flex: 1; height: 6px; border-radius: 6px; background: var(--bg); overflow: hidden; }
.verdict-others .bar-fill { height: 100%; border-radius: inherit; background: var(--ink); }
.verdict-others .vo-pct { width: 3.5em; text-align: right; font-family: var(--display); font-weight: 800; font-variant-numeric: tabular-nums; }
.verdict.is-assign { align-items: center; text-align: center; padding: 36px 28px 40px; }
.verdict.is-assign h2 { font-size: 48px; }
.verdict-you { width: 200px; height: 250px; margin-bottom: 14px; border: 5px solid #fff; border-radius: 28px; overflow: hidden; background: var(--soft); box-shadow: 0 0 0 3px var(--ink), var(--sh-2); transform: rotate(-2deg); }
.verdict-you img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; display: block; }
.verdict.is-deciding h2 { color: var(--muted); animation: verdict-pulse 0.9s ease-in-out infinite; }
.verdict.is-assign:not(.is-deciding) h2 { display: inline-block; padding: 0 0.16em 0.06em; border-radius: 0.24em; background: var(--accent); transform: rotate(-1.5deg); }
.verdict.is-revealed h2 { animation: verdict-reveal 0.6s var(--ease-pop); }
@keyframes verdict-pulse { 50% { opacity: 0.35; } }
@keyframes verdict-reveal { from { opacity: 0; transform: scale(0.6) rotate(-8deg); } }

/* Side column: your photo, K, the whole deck as a list. */
.res-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.your-photo { padding: 18px; display: grid; grid-template-columns: 112px minmax(0, 1fr); grid-template-areas: "frame title" "frame note" "frame actions"; gap: 6px 16px; align-items: start; }
.yp-title { grid-area: title; font-size: 20px; }
.yp-frame-wrap { grid-area: frame; display: flex; justify-content: center; border-radius: 16px; overflow: hidden; background: var(--bg); }
.yp-frame { position: relative; line-height: 0; }
.yp-frame img { display: block; max-width: 100%; max-height: 150px; width: auto; height: auto; }
.bbox { position: absolute; border: 2px solid var(--accent); border-radius: 4px; box-shadow: 0 0 0 1px var(--ink); }
.yp-note { grid-area: note; font-size: 12px; color: var(--muted); line-height: 1.45; }
.yp-actions { grid-area: actions; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.yp-actions .btn { flex: 1 1 auto; min-height: 40px; padding: 0 12px; gap: 6px; font-size: 13px; }
.yp-actions .btn .icon { width: 16px; height: 16px; }
.yp-k { flex-direction: column; align-items: stretch; }
.yp-k legend { float: none; margin-bottom: 8px; }
.yp-k .seg { display: flex; }
.yp-k .seg button { flex: 1; min-width: 0; padding: 0 8px; }

.all-matches { display: flex; flex-direction: column; gap: 10px; }
.more-title { font-size: 22px; }
.match-list { list-style: none; margin: 0; padding: 6px; display: flex; flex-direction: column; gap: 2px; border-radius: 24px; background: var(--surface); box-shadow: var(--sh-1); }
.match-btn { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 6px 12px 6px 8px; border: 0; border-radius: 18px; background: transparent; text-align: left; transition: background-color 0.15s; }
.match-btn:hover { background: var(--soft); }
.match-btn[aria-current="true"] { background: var(--ink); color: #fff; }
.match-num { flex: none; width: 22px; font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.match-btn[aria-current="true"] .match-num { color: var(--accent); }
.match-img { flex: none; width: 46px; height: 46px; border-radius: 14px; overflow: hidden; background: var(--bg); }
.match-img img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; display: block; }
.match-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.match-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match-extra { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match-extra:empty { display: none; }
.match-btn[aria-current="true"] .match-extra { color: var(--dark-muted); }
.match-pct { flex: none; min-width: 44px; text-align: right; font-family: var(--display); font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }

.about { padding: 16px 18px; border-radius: 22px; border: 1.5px solid var(--line); font-size: 13px; line-height: 1.55; color: var(--muted); }
.about-title { margin-bottom: 6px; font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.empty { width: 100%; padding: 28px; text-align: center; font-weight: 600; color: var(--muted); }

/* ---------- Problems ---------- */
.pb-wrap { max-width: 540px; margin-inline: auto; padding-block: 32px 72px; display: flex; flex-direction: column; gap: 20px; }
.pb-media { position: relative; border: 5px solid #fff; border-radius: 28px; overflow: hidden; background: var(--soft); box-shadow: var(--sh-2); transform: rotate(-1.5deg); }
.pb-media img { display: block; width: 100%; max-height: 320px; object-fit: cover; }
.pb-chip { position: absolute; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--ink); font-size: 13px; font-weight: 700; color: #fff; }
.pb-chip .icon { color: var(--accent); }
.pb-icon { width: 80px; height: 80px; border-radius: 50%; background: var(--accent); color: var(--ink); display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 0 var(--ink); transform: rotate(-6deg); }
.pb-icon .icon-lg { width: 34px; height: 34px; stroke-width: 2; }
.view-problem h1 { font-size: 44px; line-height: 0.95; letter-spacing: -0.04em; }
.pb-text { font-size: 16px; line-height: 1.55; color: var(--muted); }
.pb-steps { margin: 0; padding: 18px 18px 18px 40px; border-radius: 22px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
.pb-steps li::marker { font-family: var(--mono); font-weight: 700; }
.pb-tips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pb-tips li { padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--ink); font-size: 14px; font-weight: 600; }
.pb-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 12px; }
.pb-actions .btn { flex: 1 1 200px; min-height: 56px; }
.pb-actions .btn-primary { font-family: var(--display); font-weight: 800; font-size: 18px; }

/* ---------- Drag and drop anywhere ---------- */
.drop-overlay { position: fixed; inset: 12px; z-index: 40; display: none; align-items: center; justify-content: center; border: 3px dashed var(--ink); border-radius: 32px; background: rgba(47, 239, 255, 0.55); backdrop-filter: blur(6px); pointer-events: none; }
.drop-overlay p { font-family: var(--display); font-size: 48px; font-weight: 800; letter-spacing: -0.03em; color: var(--ink); }
body.is-dragging .drop-overlay { display: flex; }

/* ---------- Narrower desktops ---------- */
@media (max-width: 1080px) {
  .fan > * { --z: 1.1; }
  .fan { height: 440px; }
  .start-more { grid-template-columns: minmax(0, 1fr); }
  .res-layout { grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); gap: 28px; }
}

/* ---------- Phone ---------- */
@media (max-width: 760px) {
  .container { padding-inline: 20px; }
  .only-mobile { display: inline; }
  .only-desktop { display: none; }
  .topbar-inner { padding-block: 10px; }
  .brand { font-size: 20px; }
  .topnav { gap: 0; font-size: 13px; }
  .topnav a { padding: 0 10px; }
  .footer { margin-top: 8px; }
  .view-head h1 { font-size: 34px; }
  .sub { font-size: 14px; }

  .view-start { gap: 28px; padding-block: 6px 32px; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .hero-copy { display: contents; }
  .hero-copy h1 { order: 1; font-size: 58px; }
  .live-pill { order: 2; justify-self: start; margin-top: 16px; }
  .lede { display: none; }
  .fan { order: 3; height: 360px; margin-inline: -20px; overflow: hidden; }
  .fan-you { bottom: 4px; }
  .fan > * { --z: 1; }
  .hero-cta { order: 4; max-width: none; margin-top: 18px; }
  .hero-cta .privacy { margin-top: 0; text-align: center; }

  .start-more { gap: 16px; }
  .steps { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .steps li { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "num title" "num text"; gap: 2px 14px; align-items: center; padding: 14px 16px; border-radius: 20px; }
  .step-num { grid-area: num; margin: 0; }
  .step-title { grid-area: title; font-size: 17px; }
  .step-text { grid-area: text; font-size: 13px; }
  .start-opts { padding: 18px; border-radius: 22px; }

  /* Camera takes the whole screen. */
  body[data-view="camera"] .topbar, body[data-view="camera"] .footer { display: none; }
  body[data-view="camera"] { background: var(--cam); }
  .view-camera { position: fixed; inset: 0; z-index: 20; max-width: none; padding: 0; background: var(--cam); }
  .view-camera .view-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .cam-layout { position: absolute; inset: 0; }
  .viewfinder { position: absolute; inset: 0; aspect-ratio: auto; max-height: none; border-radius: 0; background: var(--cam); box-shadow: none; }
  .oval { top: 40%; height: auto; width: 74%; max-height: 56%; }
  .cam-top { top: 0; padding: calc(12px + env(safe-area-inset-top)) 16px 0; justify-content: flex-start; flex-direction: column; align-items: center; gap: 14px; }
  .viewfinder .cam-close { display: flex; align-self: flex-start; width: 44px; height: 44px; }
  .cam-bottom { bottom: 0; padding: 18px 20px calc(28px + env(safe-area-inset-bottom)); border-radius: 28px 28px 0 0; background: rgba(14, 15, 18, 0.9); display: flex; flex-direction: column; gap: 20px; }
  .cam-hints { display: flex; list-style: none; margin: 0; padding: 0; justify-content: center; gap: 8px; }
  .cam-hints li { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); font-size: 13px; font-weight: 600; }
  .cam-hints li.is-ok .icon { color: var(--accent); }
  .cam-hints li.is-warn { background: rgba(251, 191, 36, 0.18); color: #FDE68A; }
  .cam-hints li.is-warn .icon { color: #FBBF24; }
  .cam-controls { justify-content: space-between; padding: 0 12px; gap: 0; }
  .shutter { width: 82px; height: 82px; }
  .shutter span { width: 62px; height: 62px; }
  .cam-side { display: none; }

  .scan { padding: 14px 20px 22px; gap: 12px; }
  .scan-bar { gap: 10px; font-size: 10px; }
  .scan-tag { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .scan-main { grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; }
  .scan-stage { --box-h: 42vh; gap: 10px; }
  .scan-sig { height: 20px; }
  .scan-hud { gap: 12px; text-align: center; }
  .scan-step { display: none; }
  .scan-hud h1 { margin-top: 0; font-size: 34px; }
  .scan-panel { text-align: left; padding: 14px; }
  .scan-log { min-height: calc(3 * 1.7em); font-size: 11px; line-height: 1.7; margin-top: 10px; }
  .scan-log li:nth-last-child(n + 4) { display: none; }
  .scan-xref { grid-template-columns: 56px minmax(0, 1fr); gap: 12px; text-align: left; border-radius: 20px; }
  .scan-xref-img { width: 56px; border-radius: 12px; }
  .scan-xref-name { font-size: 20px; }
  .scan-actions .btn { flex: 1; }

  .view-results { gap: 14px; padding-block: 0 32px; }
  .res-head { gap: 14px; }
  .res-title { gap: 2px; }
  .res-title h1 { font-size: 30px; }
  .res-title .sub { font-size: 13px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin-inline: -20px; padding: 0 20px 2px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .res-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .deck-col { padding-top: 8px; gap: 20px; }
  .deck { --deck-w: 300px; --deck-h: 440px; }
  .deck-wrap { gap: 26px; }
  .best-info h2 { font-size: 28px; }
  .best-badge { width: 84px; height: 84px; right: -12px; }
  .best-pct { font-size: 26px; }
  .deck-controls { gap: 14px; }
  .btn-next { padding: 0 24px; }
  .verdict { padding: 20px; border-radius: 24px; }
  .verdict h2 { font-size: 26px; }
  .verdict.is-assign { padding: 28px 18px 32px; }
  .verdict.is-assign h2 { font-size: 36px; }
  .verdict-you { width: 150px; height: 188px; }
  .your-photo { grid-template-columns: 96px minmax(0, 1fr); padding: 14px; border-radius: 24px; }
  .yp-frame img { max-height: 130px; }

  .pb-wrap { padding-block: 8px 32px; }
  .view-problem h1 { font-size: 36px; }
  .pb-actions { flex-direction: column; }
  .pb-actions .btn { flex: none; }
  .drop-overlay p { font-size: 30px; }
}

@media (max-width: 380px) {
  .hero-copy h1 { font-size: 48px; }
  .fan { height: 300px; }
  .fan > * { --z: 0.9; }
  .seg button { min-width: 0; padding: 0 12px; }
  .deck { --deck-w: 280px; --deck-h: 410px; }
  .btn-next { padding: 0 18px; font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .confetti { display: none; }
}
