/* Glimpse: a CCTV monitor over the globe. Graphite chrome, warm white type, one red REC light. */
:root {
  --ink: #0d0f10;
  --glass: rgba(14, 17, 18, .86);
  --glass-2: rgba(255, 255, 255, .06);
  --fg: #eef0ea;
  --muted: #9ba39d;
  --line: rgba(255, 255, 255, .13);
  --rec: #ff4b45;
  --paper: #efe9dc;
  --paper-ink: #16130e;
  --good: #7fe0a6;
  --body: "Chivo", "Segoe UI", system-ui, sans-serif;
  --mono: "Chivo Mono", ui-monospace, Consolas, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--fg); font: 15px/1.5 var(--body); overflow: hidden; }
button { font: inherit; color: inherit; }
a { color: var(--paper); }
#map { position: fixed; inset: 0; }
.maplibregl-canvas { cursor: crosshair; }
.maplibregl-ctrl-attrib { display: none; }

.top { position: fixed; top: calc(10px + var(--safe-t)); left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; pointer-events: none; z-index: 6; }
.top > * { pointer-events: auto; }
.brand { background: var(--glass); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font: 800 1rem var(--body); letter-spacing: .02em; cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.meter { display: flex; gap: 6px; }
.meter span { background: var(--glass); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; text-align: right; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.meter small { display: block; color: var(--muted); font: 600 .6rem var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.meter b { font: 600 1rem var(--mono); font-variant-numeric: tabular-nums; }

/* deck: monitor on top, controls under it. Phone: pinned to the bottom. Desktop: floating left column. */
.deck { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--glass); border-top: 1px solid var(--line); border-radius: 14px 14px 0 0; padding: 10px 10px calc(10px + var(--safe-b)); display: grid; gap: 8px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
@media (min-width: 760px) {
  .deck { left: 16px; right: auto; top: 64px; bottom: auto; width: min(540px, 46vw); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
}
.monitor { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #050606; border-radius: 8px; overflow: hidden; border: 1px solid #000; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
@media (max-width: 759px) { .monitor { aspect-ratio: 16 / 8.2; } }
.monitor canvas, .monitor video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.osd { position: absolute; z-index: 2; font: 600 .7rem var(--mono); letter-spacing: .08em; color: #f2f2ee; text-shadow: 0 1px 2px #000, 0 0 6px rgba(0,0,0,.6); display: flex; align-items: center; gap: 6px; }
.osd.tl { top: 8px; left: 10px; }
.osd.tr { top: 8px; right: 10px; }
.osd.bl { bottom: 8px; left: 10px; }
.osd.br { bottom: 6px; right: 6px; }
.rec { width: 8px; height: 8px; border-radius: 50%; background: var(--rec); display: inline-block; animation: rec 1.6s steps(1) infinite; }
@keyframes rec { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .rec { animation: none; } }
.tools { gap: 4px; }
.tool { background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.22); border-radius: 6px; width: 32px; height: 32px; display: grid; place-items: center; font: 600 1.05rem var(--mono); color: #fff; cursor: pointer; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.tool:disabled { opacity: .35; cursor: default; }
#screen, #big-screen { touch-action: none; cursor: grab; }
#screen:active, #big-screen:active { cursor: grabbing; }
.static { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; font: 600 .78rem var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); background: radial-gradient(circle, #1a1d1e, #060707); }
.static[hidden] { display: none; }

.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.thumbs:empty { display: none; }
.thumb { position: relative; padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; background: #050606; aspect-ratio: 16 / 10; cursor: pointer; }
.thumb canvas { display: block; width: 100%; height: 100%; }
.thumb span { position: absolute; left: 4px; top: 2px; font: 600 .62rem var(--mono); color: #fff; text-shadow: 0 1px 2px #000; }
.thumb.on { border-color: var(--paper); }
.clues { display: grid; grid-template-columns: 1fr; gap: 6px; }
.clues button { border: 1px solid var(--line); background: var(--glass-2); border-radius: 8px; padding: 6px 4px; cursor: pointer; display: grid; gap: 1px; text-align: center; font-size: .78rem; line-height: 1.2; }
.clues button em { font: 600 .66rem var(--mono); font-style: normal; color: var(--rec); }
.clues button.used { border-color: rgba(255, 75, 69, .6); }
.clues button.used em { color: var(--muted); }
.clues button:disabled { opacity: .35; cursor: default; }

.go { display: block; width: 100%; border: 0; border-radius: 8px; background: var(--paper); color: var(--paper-ink); padding: 12px 16px; font: 800 1rem var(--body); cursor: pointer; }
.go:disabled { background: var(--glass-2); color: var(--muted); cursor: default; font-weight: 600; }
.go.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line); }
.go small { font: 600 .8rem var(--mono); opacity: .65; margin-left: 4px; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--rec); outline-offset: 2px; }

.reveal { display: grid; gap: 6px; }
.pts { display: flex; align-items: baseline; gap: 8px; }
.pts b { font: 800 2.2rem/1 var(--mono); font-variant-numeric: tabular-nums; }
.pts span { color: var(--muted); }
.dist { margin: 0; color: var(--muted); }
.station { border-top: 1px solid var(--line); padding-top: 6px; display: grid; gap: 2px; }
.station b { font-size: 1rem; }
.station span { color: var(--muted); font-size: .9rem; }
.station small { color: var(--muted); font-size: .72rem; }

.screen { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); background: linear-gradient(180deg, rgba(13,15,16,.3), rgba(13,15,16,.86)); overflow: auto; }
.card { width: 100%; max-width: 440px; background: var(--glass); border: 1px solid var(--line); border-radius: 14px; padding: 24px; display: grid; gap: 12px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); position: relative; }
h1 { margin: 0; font: 800 3.1rem/1 var(--body); letter-spacing: -.02em; }
.kicker { margin: 0; display: flex; align-items: center; gap: 8px; color: var(--muted); font: 600 .72rem var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.lede { margin: 0; color: #d8dbd3; font-size: 1.05rem; }
.how { margin: 4px 0 0; padding-left: 1.2em; color: var(--muted); font-size: .9rem; display: grid; gap: 4px; }
.fine { margin: 0; color: var(--muted); font-size: .78rem; }
.done { margin: -4px 0 0; color: var(--good); font-size: .9rem; }
.lang-switch { position: absolute; top: 16px; right: 16px; display: flex; gap: 2px; border: 1px solid var(--line); border-radius: 6px; padding: 2px; }
.lang-switch button { border: 0; background: transparent; border-radius: 4px; padding: 3px 8px; font: 600 .72rem var(--mono); color: var(--muted); cursor: pointer; }
.lang-switch button.on { background: var(--glass-2); color: var(--fg); }
.total { font: 800 3.2rem/1 var(--mono); font-variant-numeric: tabular-nums; }
.of { margin: -6px 0 0; color: var(--muted); }
.summary { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.summary li { display: grid; grid-template-columns: 1.4em 1fr auto; gap: 8px; align-items: baseline; border-bottom: 1px solid var(--line); padding-bottom: 6px; font-size: .9rem; }
.summary li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary li small { color: var(--muted); }
.summary li b { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 8px; }
.row .go { flex: 1; }

.big { position: fixed; inset: 0; z-index: 20; background: rgba(5, 6, 6, .94); display: grid; place-items: center; padding: 16px; }
.big canvas { width: min(1400px, 100%, calc(84vh * 16 / 9)); aspect-ratio: 16 / 9; border-radius: 10px; }
.big-tools { position: absolute; bottom: calc(16px + var(--safe-b)); left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.big-tools .tool { width: 44px; height: 44px; font-size: 1.3rem; }
.icon { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass-2); display: grid; place-items: center; cursor: pointer; }
.close { position: absolute; top: calc(12px + var(--safe-t)); right: 12px; font-size: 1.5rem; line-height: 1; }

.toast { position: fixed; top: calc(60px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 30; background: var(--glass); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; font-size: .9rem; max-width: calc(100% - 32px); text-align: center; }
.credit { position: fixed; right: 8px; bottom: 6px; z-index: 4; font-size: .64rem; color: rgba(255, 255, 255, .5); text-align: right; }
.credit a { color: inherit; }
@media (max-width: 759px) { .credit { top: calc(58px + var(--safe-t)); bottom: auto; } }

.pin { width: 26px; height: 34px; }
.pin svg { width: 100%; height: 100%; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .5)); }
.answer { width: 22px; height: 22px; border-radius: 50%; background: var(--good); border: 3px solid var(--ink); box-shadow: 0 0 0 6px rgba(127, 224, 166, .28); }
