/* LOOK_SCANNER // LAYA — CRT/cyber shell.
   Mobile-first. Layouts are verified at 360, 390 and 430 px. */

@font-face {
  font-family: 'LOOK Mono';
  src: url('/fonts/DejaVuSansMono.ttf') format('truetype');
  font-display: swap;
}

:root {
  --bg: #05070c;
  --panel: #0b1018;
  --panel-edge: #1b2940;
  --grid: #16202e;
  --neon: #37f5c8;
  --pink: #ff2fd0;
  --amber: #ffd166;
  --danger: #ff5d73;
  --text: #cdeee4;
  --muted: #6f8a9b;
  --radius: 10px;
  --mono: 'LOOK Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  padding: 0 12px 28px;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px, 28px 28px;
  background-position: -1px -1px;
}

.crt {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9;
  background:
    repeating-linear-gradient(180deg, rgba(55, 245, 200, 0.045) 0 1px, transparent 1px 3px),
    radial-gradient(120% 80% at 50% 0%, rgba(255, 47, 208, 0.08), transparent 60%);
  mix-blend-mode: screen;
}

.bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 2px 10px;
}

.brand {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.18em;
  color: var(--neon);
  text-shadow: 0 0 8px rgba(55, 245, 200, 0.55);
  word-break: break-word;
}

.brand-mark { color: var(--pink); animation: blink 1.6s steps(2, end) infinite; }
.brand-tag { color: var(--muted); font-size: 11px; letter-spacing: 0.1em; }

@keyframes blink { 50% { opacity: 0.25; } }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  border: 1px solid var(--panel-edge);
  border-radius: 999px;
  padding: 3px 9px;
}

.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 6px currentColor;
}

.status[data-state="ready"] { color: var(--neon); border-color: rgba(55, 245, 200, 0.4); }
.status[data-state="ready"] .status-dot { background: var(--neon); }
.status[data-state="busy"] { color: var(--amber); border-color: rgba(255, 209, 102, 0.4); }
.status[data-state="busy"] .status-dot { background: var(--amber); }
.status[data-state="offline"], .status[data-state="error"] { color: var(--danger); border-color: rgba(255, 93, 115, 0.45); }
.status[data-state="offline"] .status-dot, .status[data-state="error"] .status-dot { background: var(--danger); }

#main {
  display: grid;
  /* minmax(0, 1fr) keeps the single-column track from being widened by the passport block. */
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.panel {
  min-width: 0;
  background: linear-gradient(180deg, rgba(11, 16, 24, 0.96), rgba(6, 9, 15, 0.96));
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: inset 0 0 40px rgba(55, 245, 200, 0.05);
}

.metrics,
.metrics > div,
.provenance,
.comment,
.verdict { min-width: 0; }

.panel-title {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--pink);
  text-transform: uppercase;
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 58vh;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--panel-edge);
  background:
    radial-gradient(60% 60% at 50% 45%, rgba(55, 245, 200, 0.07), transparent 70%),
    #03050a;
}

#video, #preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #03050a;
}

.stage-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 4px;
  text-align: center;
  color: var(--muted);
  letter-spacing: 0.16em;
}

.stage-empty p { margin: 0; }
.stage-empty .hint { font-size: 11px; letter-spacing: 0.04em; max-width: 24ch; }

.reticle { position: absolute; inset: 10%; }
.reticle .corner {
  position: absolute;
  width: 18px; height: 18px;
  border: 2px solid var(--neon);
  opacity: 0.75;
}
.reticle .tl { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.reticle .tr { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.reticle .bl { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.reticle .br { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.reticle .crosshair {
  position: absolute;
  inset: 46% 46%;
  border: 1px solid var(--neon);
  border-radius: 50%;
  opacity: 0.6;
}

.scanline-sweep {
  position: absolute;
  left: 0; right: 0;
  height: 22%;
  background: linear-gradient(180deg, transparent, rgba(55, 245, 200, 0.28), transparent);
  animation: sweep 1.6s linear infinite;
  pointer-events: none;
}
@keyframes sweep {
  0% { top: -25%; }
  100% { top: 105%; }
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.row-tight { margin-top: 8px; }

.btn, .scan-action {
  appearance: none;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--neon);
  background: rgba(55, 245, 200, 0.06);
  border: 1px solid rgba(55, 245, 200, 0.45);
  border-radius: 8px;
  padding: 11px 13px;
  cursor: pointer;
  flex: 1 1 44%;
  text-align: center;
  transition: background 120ms ease, transform 90ms ease;
}

.btn:hover:not(:disabled), .scan-action:hover:not(:disabled) { background: rgba(55, 245, 200, 0.14); }
.btn:active:not(:disabled), .scan-action:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible, .scan-action:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

.btn:disabled, .scan-action:disabled {
  color: var(--muted);
  border-color: var(--panel-edge);
  background: rgba(111, 138, 155, 0.05);
  cursor: not-allowed;
}

.btn-alt { color: var(--amber); border-color: rgba(255, 209, 102, 0.45); background: rgba(255, 209, 102, 0.06); }
.btn-alt:hover:not(:disabled) { background: rgba(255, 209, 102, 0.14); }
.btn-ghost { color: var(--muted); border-color: var(--panel-edge); background: transparent; }

.scan-action {
  width: 100%;
  flex: 1 1 100%;
  font-size: 17px;
  letter-spacing: 0.26em;
  padding: 18px 12px;
  color: #04100d;
  background: var(--neon);
  border-color: var(--neon);
  text-shadow: none;
  box-shadow: 0 0 18px rgba(55, 245, 200, 0.35);
}
.scan-action:hover:not(:disabled) { background: #6bffe0; }
.scan-action:disabled { color: var(--muted); background: rgba(111, 138, 155, 0.06); box-shadow: none; }

.progress { margin-top: 12px; }
.progress-track {
  height: 10px;
  border: 1px solid var(--panel-edge);
  border-radius: 999px;
  overflow: hidden;
  background: #04070d;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--neon), var(--pink));
  transition: width 220ms ease;
}
.stages {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.stages li { flex: 1 1 auto; text-align: center; }
.stages li[data-done="1"] { color: var(--neon); }
.stages li[data-active="1"] { color: var(--amber); }
.progress-label { margin: 6px 0 0; font-size: 11px; color: var(--muted); letter-spacing: 0.06em; }

.error-code { margin: 0; color: var(--danger); letter-spacing: 0.12em; font-size: 12px; }
.error-message { margin: 6px 0 0; color: var(--text); }
.error-hint { margin: 6px 0 0; color: var(--muted); font-size: 11px; }

.verdict { margin: 0; font-size: 17px; color: var(--neon); letter-spacing: 0.06em; }
.status-chip { margin: 6px 0 0; font-size: 11px; letter-spacing: 0.12em; color: var(--muted); }

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 0;
}
.metrics > div {
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  padding: 8px;
  background: rgba(55, 245, 200, 0.03);
}
.metrics dt { font-size: 9px; letter-spacing: 0.16em; color: var(--muted); }
.metrics dd { margin: 4px 0 0; font-size: 14px; color: var(--neon); word-break: break-word; }

.comment { margin: 12px 0 0; color: var(--text); }
.provenance { margin: 10px 0 0; font-size: 11px; color: var(--muted); letter-spacing: 0.04em; word-break: break-word; }

.warnings { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.warnings li {
  font-size: 11px;
  color: var(--amber);
  border-left: 2px solid rgba(255, 209, 102, 0.5);
  padding-left: 8px;
}

.passport {
  margin: 12px 0 0;
  padding: 10px;
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  background: #03060b;
  color: var(--neon);
  font-size: 10px;
  line-height: 1.25;
  white-space: pre;
  overflow-x: auto;
  max-width: 100%;
}

.foot { margin-top: 18px; color: var(--muted); font-size: 10px; letter-spacing: 0.06em; }
.foot p { margin: 3px 0; }

/* Wider phones and both landscape/side-by-side orientations. */
@media (min-width: 430px) {
  body { padding: 0 16px 32px; }
  .btn, .scan-action { flex: 1 1 30%; }
  .scan-action { flex: 1 1 100%; }
}

@media (min-width: 760px) {
  #main { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  #result-panel, #error-panel { grid-column: span 2; }
  .stage { max-height: 44vh; }
}

@media (prefers-reduced-motion: reduce) {
  .brand-mark { animation: none; }
  .scanline-sweep { animation: none; display: none; }
  .progress-fill { transition: none; }
}
