@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-display: swap; src: url('/fonts/mono-400.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 500; font-display: swap; src: url('/fonts/mono-500.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 700; font-display: swap; src: url('/fonts/mono-700.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-weight: 700; font-display: swap; src: url('/fonts/grotesk-700.woff2') format('woff2'); }

:root {
  color-scheme: dark;
  --signal: #7dffb2;
  --warn: #ffd37a;
  --text: #d9ffe9;
  --glass: rgb(5 19 13 / 0.74);
  --edge: rgb(125 255 178 / 0.3);
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-size: 100%;
  background: #030906;
  color: var(--text);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; }
h1 { margin: 0; font: 700 1.2rem 'Space Grotesk', system-ui, sans-serif; letter-spacing: 0.08em; color: #fff; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { cursor: default; opacity: 0.4; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

.eyebrow { font-size: 0.65rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--signal); }
.panel { background: var(--glass); border: 1px solid var(--edge); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.scan { position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, transparent 0 3px, rgb(0 0 0 / 0.11) 3px 4px); }
.corner { position: absolute; width: 34px; height: 34px; border: 2px solid var(--signal); pointer-events: none; }
.tl { left: 12px; top: 12px; border-right: 0; border-bottom: 0; }
.tr { right: 12px; top: 12px; border-left: 0; border-bottom: 0; }
.bl { left: 12px; bottom: 12px; border-right: 0; border-top: 0; }
.br { right: 12px; bottom: 12px; border-left: 0; border-top: 0; }

/* Viewer: a 16:9 stage as large as the window allows */
.stage { position: relative; width: min(100vw, 177.78vh); width: min(100vw, 177.78dvh); }
.screen { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #000; }
video { display: block; width: 100%; height: 100%; object-fit: contain; }
.shade { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 58%, rgb(0 0 0 / 0.65) 100%); }
/* Top corners sit below the camera's own burnt-in label and time. */
.screen .tl, .screen .tr { top: 7.5%; }
.cross { position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; translate: -50% -50%; pointer-events: none; border: 1px solid rgb(125 255 178 / 0.35); border-radius: 50%;
  background: linear-gradient(rgb(125 255 178 / 0.6), rgb(125 255 178 / 0.6)) center / 1px 100% no-repeat, linear-gradient(rgb(125 255 178 / 0.6), rgb(125 255 178 / 0.6)) center / 100% 1px no-repeat; }
.message { position: absolute; left: 50%; top: 50%; translate: -50% 36px; max-width: 90%; padding: 6px 14px; white-space: nowrap; font-size: 0.8rem; letter-spacing: 0.16em; text-transform: uppercase; background: var(--glass); border: 1px solid var(--edge); }
.message:empty { display: none; }

.overlay { transition: opacity 0.35s, visibility 0.35s; }
.stage.idle .overlay { opacity: 0; visibility: hidden; }
.stage.idle .cross { opacity: 0; }
.stage.idle { cursor: none; }

.id { position: absolute; left: 28px; top: calc(7.5% + 16px); padding: 10px 14px; border-left: 3px solid var(--signal); display: grid; gap: 3px; }
.line { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.75rem; }
.status { text-transform: uppercase; color: var(--warn); }
.status::before { content: '●'; margin-right: 6px; }
.live .status { color: var(--signal); }

.stats { position: absolute; right: 28px; top: calc(7.5% + 16px); width: 196px; padding: 10px 12px; font-size: 0.75rem; }
.stats dl { margin: 0; }
.stats dl div { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.stats dt { color: var(--signal); text-transform: uppercase; }
.stats dd { margin: 0; font-variant-numeric: tabular-nums; }
.stats svg { display: block; width: 100%; height: 34px; margin-top: 6px; }
.area { fill: rgb(125 255 178 / 0.14); }
.trace { fill: none; stroke: var(--signal); stroke-width: 1.4; vector-effect: non-scaling-stroke; }

.dock { position: absolute; left: 50%; bottom: 22px; translate: -50% 0; display: flex; align-items: center; gap: 6px; white-space: nowrap; padding: 7px 10px; background: rgb(4 16 11 / 0.86); border: 1px solid var(--edge); border-radius: 40px; font-size: 0.75rem; text-transform: uppercase; }
.dock form { display: contents; }
.divider { width: 1px; height: 20px; margin: 0 2px; background: var(--edge); }
.quality { display: flex; padding: 2px; background: #0d2419; border-radius: 20px; }
.quality button { min-height: 32px; padding: 0 14px; border-radius: 20px; font-weight: 700; }
.quality button[aria-pressed='true'] { background: var(--signal); color: #04140b; }
.action { display: flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 10px; border-radius: 20px; text-transform: uppercase; }
.action:hover:not(:disabled) { background: rgb(125 255 178 / 0.13); }
.action svg { width: 14px; height: 14px; fill: currentColor; }

/* Phones held sideways: the same overlays, made compact. */
@media (min-width: 601px) and (max-height: 480px), (min-width: 601px) and (max-width: 860px) and (orientation: landscape) {
  .id { left: 18px; top: calc(7.5% + 10px); padding: 6px 10px; }
  .id h1 { font-size: 0.9rem; }
  .id .eyebrow { display: none; }
  .stats { right: 18px; top: calc(7.5% + 10px); width: 164px; padding: 6px 10px; font-size: 0.65rem; }
  .stats dl div { padding: 0; }
  .stats svg { height: 20px; margin-top: 3px; }
  .cross { display: none; }
  .dock { bottom: 10px; padding: 3px 6px; }
  .quality button, .action { min-height: 40px; }
}

/* Narrow upright screens: readouts move below the video and stay visible. */
@media (max-width: 860px) and (orientation: portrait), (max-width: 600px) {
  .hud { place-items: start center; }
  .stage { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start; width: min(100%, 860px); padding: max(10px, env(safe-area-inset-top)) 10px 16px; }
  .screen { grid-column: 1 / -1; }
  .screen .corner { width: 18px; height: 18px; left: auto; }
  .screen .tl, .screen .bl { left: 8px; }
  .screen .tr, .screen .br { right: 8px; }
  .screen .bl, .screen .br { bottom: 8px; }
  .cross, .screen .scan { display: none; }
  .message { translate: -50% -50%; font-size: 0.7rem; }
  .id, .stats { position: static; width: auto; }
  .dock { position: static; translate: none; grid-column: 1 / -1; flex-wrap: wrap; justify-content: center; border-radius: 12px; }
  .divider { display: none; }
  .quality button, .action { min-height: 44px; }
  .stage.idle .overlay { opacity: 1; visibility: visible; }
  .stage.idle { cursor: auto; }
}
@media (max-width: 480px) {
  .stage { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .overlay { transition: none; }
}

/* Sign-in */
.gate { position: relative; padding: 24px 16px; background: radial-gradient(ellipse at center, #0b2417 0%, #030906 70%); }
.gate > .corner { position: fixed; }
.gate > .scan { position: fixed; }
.card { position: relative; width: min(100%, 360px); padding: 26px; border-left: 3px solid var(--signal); }
.card h1 { margin: 6px 0 4px; font-size: 1.5rem; }
.muted { color: #8fb8a2; font-size: 0.8rem; }
.error { min-height: 1.3em; margin: 14px 0 2px; color: #ff9d8f; font-size: 0.8rem; }
label { display: block; margin: 10px 0 6px; font-size: 0.65rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--signal); }
input { width: 100%; min-height: 44px; padding: 0 12px; font: inherit; color: #fff; background: rgb(0 0 0 / 0.45); border: 1px solid var(--edge); border-radius: 4px; }
input:focus-visible { outline-offset: 0; border-color: var(--signal); }
.card button { width: 100%; min-height: 46px; margin-top: 20px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; background: var(--signal); color: #04140b; border-radius: 40px; }
