/* Scanner page: the live scanner and its results. Builds on /assets/css/site.css tokens. */

.phone-only { display: none; }
@media (max-width: 960px) { .phone-only { display: inline-flex; } .desktop-only { display: none !important; } }
.hero-scan { min-height: 0; padding-bottom: 0; grid-template-columns: minmax(0, 1fr) 320px; }
.open-phone { display: flex; gap: 16px; align-items: center; }
.open-phone .code-tile { padding: 12px; border-radius: 16px; }
.open-phone .code-tile svg { width: 96px; height: 96px; }
.open-phone > div { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
/* The live scanner's section: tighter than other panels (about 64px desktop, 40px phone). */
.panel.app-panel { padding-top: 64px; padding-bottom: 64px; }
@media (max-width: 640px) { .panel.app-panel { padding-top: 40px; padding-bottom: 40px; } }
/* The 320px demo fits beside the copy down to the tablet breakpoint (the generic .hero stacks at 1180px). */
@media (max-width: 960px) { .hero-scan { grid-template-columns: minmax(0, 1fr); } }

/* ───────────── the live scanner ───────────── */
.app { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 24px; align-items: start; }
/* The live camera box never grows past the screen, so the preview and Stop / Torch / Zoom fit together (landscape
   phones, 1024x768). width: 100% keeps WebKit from shrinking the width through aspect-ratio instead. */
.app > .scanner > .viewport { width: 100%; max-height: max(180px, calc(100svh - 220px)); }
/* The box can be shorter than 4:3 (the cap above): the viewfinder is sized from the box's width and height (a
   size container), so it stays square instead of stretching to the width. */
.app > .scanner > .viewport { container-type: size; }
.app > .scanner > .viewport > .frame { width: min(62cqw, 78cqh); max-height: none; }
.viewport.drag { box-shadow: inset 0 0 0 4px var(--lime); }
.viewport video, .viewport img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.viewport img { object-fit: contain; background: #0C0B08; }
.overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
/* Outlines can be tapped to pick a code; the picked one is bright, the rest quieter. */
.overlay .mark { pointer-events: auto; cursor: pointer; }
.overlay .mark polygon { fill: rgba(196,240,51,.12); stroke: #C4F033; stroke-opacity: .75; }
.overlay .mark circle { fill: #0C0B08; stroke: #C4F033; stroke-width: 2; }
.overlay .mark text { fill: #C4F033; font-family: var(--display); font-weight: 700; text-anchor: middle; dominant-baseline: central; }
.overlay .mark.active polygon { fill: rgba(196,240,51,.4); stroke: #fff; stroke-opacity: 1; }
.overlay .mark.active circle { fill: #C4F033; stroke: #fff; }
.overlay .mark.active text { fill: #0C0B08; }
.controls label.btn { cursor: pointer; position: relative; }
.controls label.btn:focus-within { outline: 2px solid var(--ink); outline-offset: 3px; }
.controls label.btn.disabled { opacity: .45; pointer-events: none; }
.zoom { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; border-radius: var(--r-btn); background: var(--btn2); font-size: 15px; font-weight: 600; }
.zoom input { accent-color: var(--lime); width: 140px; }
.hint { font-size: 14px; color: var(--ink2); }
@media (pointer: coarse) { .hint { display: none; } }

/* ───────────── results (the card's own classes live in site.css: every page renders the card) ───────────── */
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Several codes: numbered chips, wrapping onto more rows on a small phone (nothing hidden), the picked one dark. */
.pick-hint { font-size: 14px; color: var(--ink2); }
.pick-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.pick-list li { flex: 0 1 auto; min-width: 0; max-width: 100%; }
.pick { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; max-width: 100%; padding: 5px 16px 5px 6px; text-align: left; border: 1px solid var(--line); background: var(--g-top); border-radius: 999px; cursor: pointer; }
.pick .num { width: 36px; height: 36px; flex-shrink: 0; border-radius: 999px; background: var(--lime); color: #0C0B08; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.pick-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.pick-text strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-text span { font-size: 12px; color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-ink); border-color: transparent; }
.pick[aria-pressed="true"] .pick-text span { color: inherit; opacity: .75; }
.picked { display: flex; flex-direction: column; gap: 16px; }

/* Lookups */
.lookup-panel { display: flex; flex-direction: column; gap: 10px; }
.ai { border-radius: 18px; background: var(--lime-well); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.ai-confidence { font-size: 13px; color: var(--ink2); }

/* Explain this: inline in the result, never a sheet. Turnstile renders into .ts-widget, under what is sent. */
.explain { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 16px; background: var(--well); }
.explain[hidden] { display: none; }
.explain-what { display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.explain-what h4 { font-family: var(--display); font-weight: 600; font-size: 20px; }
.explain-what ul { padding-left: 1.2em; display: flex; flex-direction: column; gap: 4px; }
.consent-value { font-family: var(--mono); font-size: 15px; background: var(--paper); padding: 8px 12px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.ts-widget:empty { display: none; }
.explain-status:empty { display: none; }
.consent-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lookup-panel:empty { display: none; }

/* Only a fallback now (app.js confirms on the button that was tapped): light, so it never reads as part of a
   dark button under it. */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 40; transform: translate(-50%, 16px); opacity: 0; padding: 12px 18px; border-radius: var(--r-btn); background: var(--g-solid); color: var(--ink); box-shadow: var(--g-shadow); font-weight: 600; transition: opacity var(--fade-dur) var(--fade), transform var(--spring-snappy-dur) var(--spring-snappy); pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.noscript { text-align: center; padding: 16px; }
/* A readable line length for the paragraph; the section keeps .wrap's width, so it lines up with the rest. */
.credits p { max-width: 760px; }

@media (max-width: 1180px) {
  .app { grid-template-columns: minmax(0, 1fr); }
}
