/* ─── Over There — “Field Glass” design system ───────────────────────
   Source: Claude Design project “Over There! Game Design”, turn 8.
   Sora carries headings/UI, Space Mono carries the small uppercase
   labels; everything sits as frosted glass on a dusk-mountain backdrop. */

@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url(../vendor/fonts/sora-latin.woff2) format('woff2');
}
@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../vendor/fonts/space-mono-400-latin.woff2) format('woff2');
}
@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../vendor/fonts/space-mono-700-latin.woff2) format('woff2');
}

:root {
  --ink-0: #10161d;            /* deep slate — chrome, scrims, dark text bg */
  --ink-1: #1d2833;            /* slate — text on light surfaces */
  --accent: #ff8a4a;           /* expedition orange */
  --gold: #ffd166;
  --green: #58d68d;
  --offline: #66708f;
  --text: #fff;
  --text-dim: rgba(255, 255, 255, 0.65);
  --text-faint: rgba(255, 255, 255, 0.55);
  --glass: rgba(16, 22, 29, 0.5);
  --glass-heavy: rgba(16, 22, 29, 0.55);
  --line: rgba(255, 255, 255, 0.16);
  --line-strong: rgba(255, 255, 255, 0.22);
  --fill: rgba(255, 255, 255, 0.1);
  --paper: rgba(255, 255, 255, 0.92);
  --radius: 20px;
  --radius-s: 14px;
  --font-ui: 'Sora', -apple-system, system-ui, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: var(--font-ui);
  color: var(--text);
  background: linear-gradient(#9db4c6 0%, #7e97ab 38%, #55697c 68%, #2a3742 100%) fixed;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ─── scenic backdrop: mountains + scrim over the sky gradient ─── */

.backdrop { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.backdrop .mtn {
  position: absolute;
  width: 0;
  height: 0;
}
.backdrop .mtn-l {
  bottom: 34%;
  left: -60px;
  border-left: 170px solid transparent;
  border-right: 170px solid transparent;
  border-bottom: 210px solid rgba(38, 52, 64, 0.55);
  filter: blur(3px);
}
.backdrop .mtn-r {
  bottom: 26%;
  right: -90px;
  border-left: 200px solid transparent;
  border-right: 200px solid transparent;
  border-bottom: 250px solid rgba(24, 34, 44, 0.7);
  filter: blur(2px);
}
.backdrop .scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(16, 22, 29, 0.18), transparent 24%,
    rgba(16, 22, 29, 0.55) 55%, rgba(16, 22, 29, 0.9));
}

#app { position: relative; z-index: 1; height: 100dvh; overflow: hidden; }

.screen {
  display: none;
  height: 100dvh;
  padding: calc(16px + var(--safe-top)) 20px calc(20px + var(--safe-bottom));
  flex-direction: column;
  overflow-y: auto; /* tall content (lobby/setup cards) must stay reachable */
}
.screen.active { display: flex; }
#screen-aim, #screen-reveal { overflow: hidden; } /* fixed layouts */

.hidden { display: none !important; }

/* ─── type helpers ─── */

.subhead { display: flex; align-items: center; gap: 10px; padding: 6px 0 2px; }
.subhead-label {
  font: 400 10px var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.back-btn {
  font: 400 18px/1 var(--font-ui);
  color: var(--text-dim);
  background: none;
  border: none;
  padding: 6px 10px 6px 0;
  cursor: pointer;
}
.screen-title {
  font: 700 22px/1.15 var(--font-ui);
  letter-spacing: -0.01em;
  margin: 8px 0 16px;
}
.screen-title.center { text-align: center; margin-bottom: 8px; }

.hint { color: var(--text-faint); font-size: 12px; text-align: center; margin-top: 12px; }

.footlink {
  font: 400 10px var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: none;
  border: none;
  padding: 8px 10px;
  cursor: pointer;
}
.footlink:active { color: var(--text); }

/* ─── buttons ─── */

.btn {
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--ink-1);
  background: var(--accent);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, opacity 0.2s ease;
}
.btn:active { transform: scale(0.96); filter: brightness(1.08); }
.btn:disabled { opacity: 0.4; pointer-events: none; }

.btn-big {
  width: 100%;
  max-width: 420px;
  padding: 16px 24px;
  font-size: 16px;
  box-shadow: 0 10px 30px rgba(255, 138, 74, 0.4);
  margin: 0 auto;
}

.btn-small {
  padding: 12px 18px;
  font-size: 14px;
  flex-shrink: 0;
  background: var(--paper);
}

/* ─── cards / glass ─── */

.card {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px;
  margin-bottom: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 11px; }
.card h2 {
  font: 400 10px var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-faint);
}
.card-head h2 { margin: 0; }
.count::before { content: ' · '; }

.field-label {
  font: 400 10px var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-faint);
  margin: 14px 0 8px;
}
.field-label:first-child, .card-head + .field-label { margin-top: 0; }

.round-pill {
  display: inline-block;
  align-self: center;
  font: 400 9px var(--font-mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--glass-heavy);
  border: 1px solid rgba(255, 138, 74, 0.45);
  border-radius: 999px;
  padding: 6px 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.center-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* `safe` falls back to top-aligned when content overflows, so nothing
     gets clipped above the scroll area on small screens */
  justify-content: safe center;
  gap: 14px;
  text-align: center;
  max-width: 460px;
  margin: 0 auto;
  width: 100%;
}

.setup-inner { max-width: 460px; margin: 0 auto; width: 100%; }

/* ─── home / splash ─── */

#screen-home {
  background:
    linear-gradient(rgba(16, 22, 29, 0.12), rgba(16, 22, 29, 0.12) 42%,
      rgba(16, 22, 29, 0.55) 72%, rgba(16, 22, 29, 0.92)),
    url('../bg.jpg') center top / cover no-repeat;
}

.home-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 460px;
  margin: 0 auto;
  width: 100%;
  padding-top: 4px;
}
.home-top { display: flex; justify-content: flex-end; align-items: center; min-height: 30px; }

.coords-pill {
  font: 400 10px var(--font-mono);
  color: rgba(255, 255, 255, 0.85);
  background: rgba(16, 22, 29, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 6px 11px;
}

.home-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 7vh 0 30px;
}
.home-logo {
  width: min(86%, 380px);
  filter: drop-shadow(0 8px 28px rgba(0, 0, 0, 0.4));
}
.home-tagline {
  font: 400 11px var(--font-mono);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.home-spacer { flex: 1; }

.mode-card {
  width: 100%;
  border-radius: var(--radius);
  background: rgba(16, 22, 29, 0.42);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line-strong);
  padding: 17px 18px;
  margin-top: 12px;
  color: var(--text);
  text-align: left;
}
button.mode-card { display: flex; align-items: center; gap: 12px; cursor: pointer; font: inherit; }
button.mode-card:active { transform: scale(0.985); }

.mode-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  padding: 0;
}

.mode-icon { width: 38px; height: 38px; flex-shrink: 0; position: relative; }
.mode-icon.solo {
  border-radius: 50%;
  border: 1.5px solid rgba(255, 138, 74, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
}
.mode-icon.solo span { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.mode-icon.duo .c1 {
  position: absolute; left: 2px; top: 5px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #c9d7e2;
}
.mode-icon.duo .c2 {
  position: absolute; left: 14px; top: 9px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent);
  border: 1.5px solid rgba(16, 22, 29, 0.6);
}

.mode-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.mode-title { font: 600 17px var(--font-ui); }
.mode-sub {
  font: 400 9px var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.mode-chev { font: 400 16px var(--font-ui); color: var(--text-dim); transition: transform 0.25s ease, color 0.25s ease; }

.mode-card.multi.open { background: var(--glass-heavy); border-color: rgba(255, 138, 74, 0.5); }
.mode-card.multi.open .mode-chev { transform: rotate(90deg); color: var(--accent); }

.mode-options { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.3s ease, margin-top 0.3s ease; }
.mode-options > div { overflow: hidden; display: flex; flex-direction: column; gap: 8px; }
.mode-card.multi.open .mode-options { grid-template-rows: 1fr; margin-top: 14px; }

.mode-opt {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--fill);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  padding: 11px 14px;
  font: 600 13px var(--font-ui);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.mode-opt:active { transform: scale(0.98); }
.mode-opt.primary { background: var(--paper); border-color: transparent; color: var(--ink-1); }
.opt-glyph { font: 700 13px var(--font-mono); color: var(--accent); width: 14px; }
.opt-chev { margin-left: auto; font: 400 13px var(--font-ui); color: rgba(255, 255, 255, 0.5); }
.mode-opt.primary .opt-chev { color: #8a9aa8; }

.home-footer { display: flex; justify-content: center; gap: 18px; margin-top: 12px; }

/* Same-network game banner */
.nearby-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 2px;
  padding: 13px 16px;
  border-radius: 16px;
  background: rgba(255, 138, 74, 0.16);
  border: 1px solid rgba(255, 138, 74, 0.5);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 10px 26px -12px rgba(0, 0, 0, 0.45);
  color: var(--text);
  font: 400 13px var(--font-ui);
  text-align: left;
  cursor: pointer;
  animation: board-rise 0.45s cubic-bezier(0.2, 1.2, 0.4, 1) both;
}
.nearby-banner .live-dot { flex-shrink: 0; }
.nearby-text { flex: 1; min-width: 0; }
.nearby-text b { font-weight: 700; }
.nearby-join {
  font: 600 13px var(--font-ui);
  color: var(--ink-1);
  background: var(--accent);
  border-radius: 999px;
  padding: 7px 16px;
  flex-shrink: 0;
}

/* ─── how to play ─── */

.help-steps { display: flex; flex-direction: column; gap: 8px; }
.help-step {
  display: flex;
  gap: 12px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
}
.help-step.hot { border-color: rgba(255, 138, 74, 0.45); }
.help-step.star { background: rgba(255, 138, 74, 0.14); border-color: rgba(255, 138, 74, 0.4); }
.step-no { font: 700 12px var(--font-mono); color: var(--accent); flex-shrink: 0; padding-top: 2px; }
.step-title { display: block; font: 600 14px var(--font-ui); }
.step-body { display: block; font: 400 12px/1.45 var(--font-ui); color: var(--text-dim); margin-top: 2px; }

/* ─── inputs ─── */

input[type="text"] {
  font-family: var(--font-ui);
  font-size: 16px;
  color: var(--text);
  background: rgba(16, 22, 29, 0.45);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  padding: 12px 14px;
  outline: none;
}
input[type="text"]:focus { border-color: var(--accent); }

.add-row { display: flex; gap: 10px; }
.add-row input { flex: 1; min-width: 0; }

.join-card { width: 100%; text-align: left; }
.join-card h2 { margin-bottom: 8px; }
.join-card input { width: 100%; margin-bottom: 14px; }
#join-code { text-transform: uppercase; letter-spacing: 0.35em; font-weight: 700; }

/* ─── chips ─── */

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips:empty { margin-top: 0; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 600 12px var(--font-ui);
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--fill);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.chip button {
  font: inherit;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  line-height: 1;
  cursor: pointer;
}
.chip .presence { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.chip .presence.off { background: var(--offline); }
.chip .you, .chip .host {
  font: 400 9px var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.chip .host { color: var(--accent); }
.chip .series { color: var(--gold); font: 700 10px var(--font-mono); }
.chip.locked { border-color: var(--gold); }

/* ─── segmented controls + switches ─── */

.seg { display: flex; gap: 8px; }
.seg.grid2 { display: grid; grid-template-columns: 1fr 1fr; }
/* odd item count: the last option spans the full row */
.seg.grid2 button:last-child:nth-child(odd) { grid-column: 1 / -1; }
.seg.disabled { opacity: 0.45; pointer-events: none; }
.seg button {
  flex: 1;
  font: 600 14px var(--font-ui);
  color: var(--text-dim);
  background: var(--fill);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 0;
  cursor: pointer;
}
.seg button.on {
  color: var(--ink-1);
  background: var(--accent);
  border-color: transparent;
}

.seg-desc { font: 400 11px/1.45 var(--font-ui); color: var(--text-faint); margin-top: 8px; }

.rule-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.rule-label { font: 600 14px var(--font-ui); }
.rule-sub { display: block; color: var(--text-faint); font: 400 11px/1.4 var(--font-ui); margin-top: 3px; }
p.rule-sub { margin-top: 8px; }

.switch {
  position: relative;
  width: 50px;
  height: 29px;
  border-radius: 999px;
  background: rgba(16, 22, 29, 0.5);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform 0.2s ease, background 0.2s ease;
}
.switch[aria-checked="true"] { background: var(--accent); border-color: transparent; }
.switch[aria-checked="true"]::after { transform: translateX(21px); background: #fff; }

/* ─── brand block (pass-the-phone setup) ─── */

.brand { text-align: center; padding: 20px 0 22px; }
.brand-mark { font-size: 52px; line-height: 1; }
.brand-logo { width: min(60%, 240px); }
.tagline {
  font: 400 10px var(--font-mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 10px;
}

/* ─── lobby ─── */

.lobby-code-row { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.lobby-code {
  font: 700 42px var(--font-ui);
  letter-spacing: 0.14em;
  color: var(--accent);
}
.lobby-share { margin-left: auto; }
.lobby-qr svg {
  display: block;
  width: 96px;
  height: 96px;
  border-radius: 10px;
  background: #fff;
  padding: 5px;
  box-sizing: border-box;
}
.lobby-share-row { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 14px; }
.share-hint {
  font: 400 10px var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.lobby-share-row .footlink { padding: 4px 0; color: var(--text-dim); }

.chooser-tag {
  font: 400 9px var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.setup-summary { display: flex; flex-direction: column; gap: 9px; }
.sum-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sum-row .k { font: 400 13px var(--font-ui); color: rgba(255, 255, 255, 0.7); }
.sum-row .v { font: 600 13px var(--font-ui); color: var(--text); text-align: right; }
.sum-row .v.accent { color: var(--accent); }
.sum-row .v.dim { color: var(--text-faint); }

.wait-pill {
  font: 600 14px var(--font-ui);
  text-align: center;
  padding: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--line-strong);
  color: rgba(255, 255, 255, 0.75);
  margin-top: 12px;
}
.wait-pill:empty { display: none; }

/* ─── countdown ─── */

.cd-ring {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 138, 74, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 8px 0;
}
.cd-ring::before {
  content: '';
  position: absolute;
  inset: -1.5px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 138, 74, 0.5);
  animation: cd-ring 1s ease infinite;
}
@keyframes cd-ring {
  from { transform: scale(1); opacity: 0.7; }
  to { transform: scale(1.35); opacity: 0; }
}
.cd-number {
  font: 700 72px var(--font-ui);
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ─── waiting / spectator ─── */

.wait-status { font: 700 20px var(--font-ui); }
.wait-roster { justify-content: center; }

.live-globe {
  width: min(72vw, 300px);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 50px rgba(255, 138, 74, 0.14), 0 24px 50px -20px rgba(0, 0, 0, 0.5);
}
.live-globe:empty { display: none; }

/* ─── handoff ─── */

.pass-label {
  font: 400 11px var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 12px;
}
.handoff-name {
  font: 700 42px var(--font-ui);
  letter-spacing: -0.02em;
  color: var(--handoff-color, var(--accent));
  text-shadow: 0 0 40px color-mix(in srgb, var(--handoff-color, var(--accent)) 55%, transparent);
}
.pass-sub { color: var(--text-dim); font-size: 13px; max-width: 300px; margin-bottom: 14px; }

/* ─── aim: shared layout ─── */

#screen-aim {
  --scope-d: min(88vw, 44dvh);
  --scope-cy: 47%;
  position: relative;
  align-items: center;
  justify-content: space-between;
}
#screen-aim .aim-header,
#screen-aim .aim-footer { position: relative; z-index: 10; }

.aim-header { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
#aim-round { text-transform: uppercase; }

.target-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--glass-heavy);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 8px 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: pop-in 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.target-flag { font-size: 26px; line-height: 1; }
.target-name { font: 700 21px var(--font-ui); letter-spacing: -0.01em; }
.target-name.question { font: 600 14px/1.35 var(--font-ui); max-width: 240px; }

.aim-player {
  font: 400 10px var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

@keyframes pop-in {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.aim-footer { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 4px; }
.aim-footer .hint { margin: 0 0 10px; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); }

.btn-lock { box-shadow: 0 10px 30px rgba(255, 138, 74, 0.4); }

.locked-flash { animation: locked 0.5s ease; }
@keyframes locked {
  0% { filter: brightness(1); }
  30% { filter: brightness(1.8); transform: scale(1.03); }
  100% { filter: brightness(1); }
}

.distance-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 10px;
}
.distance-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.distance-value {
  font: 700 13px var(--font-mono);
  font-variant-numeric: tabular-nums;
  min-width: 88px;
  text-align: right;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

/* ─── aim: binocular scope (AR mode) ─── */

.ar-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #05080b;
  z-index: 1;
}
.ar-layer video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Lens mode: the WebGL canvas shows the feed; keep the video playing but
   invisible (it stays the texture source). */
.ar-layer.lens-on video { opacity: 0; }

.ar-lens {
  position: absolute;
  left: 50%;
  top: var(--scope-cy);
  width: var(--scope-d);
  height: var(--scope-d);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  z-index: 2;
}

/* Dark surround with a feathered rim — the world is visible only through
   the scope (a faint hint of it survives outside, like the mock). */
.scope-shade {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: radial-gradient(circle at 50% var(--scope-cy),
    transparent calc(var(--scope-d) / 2 - 12px),
    rgba(8, 12, 16, 0.6) calc(var(--scope-d) / 2 + 8px),
    rgba(5, 8, 11, 0.96) calc(var(--scope-d) / 2 + 64px));
  pointer-events: none;
}

/* Clipping circle for the horizon overlay + glass glint */
.scope {
  position: absolute;
  left: 50%;
  top: var(--scope-cy);
  width: var(--scope-d);
  height: var(--scope-d);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  overflow: hidden;
  z-index: 4;
  pointer-events: none;
}
.scope-glint {
  position: absolute;
  top: 14%;
  left: 10%;
  width: 46%;
  height: 15%;
  border-radius: 50%;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.26), transparent 70%);
  filter: blur(8px);
  transform: rotate(-24deg);
}

.scope-ring {
  position: absolute;
  left: 50%;
  top: var(--scope-cy);
  width: var(--scope-d);
  height: var(--scope-d);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  z-index: 5;
  pointer-events: none;
}

.ar-horizon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200vmax;
  height: 0;
  margin-left: -100vmax;
  will-change: transform;
}
.ar-horizon-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1.5px;
  background: linear-gradient(90deg, transparent,
    rgba(255, 255, 255, 0.85) 20%, rgba(255, 255, 255, 0.85) 80%, transparent);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}
.ar-cardinals span {
  position: absolute;
  top: -26px;
  left: 50%;
  margin-left: -0.5em;
  font: 600 13px var(--font-ui);
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
  will-change: transform, opacity;
  transition: opacity 0.2s ease;
}

.ar-crosshair {
  position: absolute;
  top: var(--scope-cy);
  left: 50%;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  z-index: 6;
  pointer-events: none;
}
.ar-crosshair::before,
.ar-crosshair::after {
  content: '';
  position: absolute;
}
.ar-crosshair::before {
  left: 50%; top: 0; bottom: 0; width: 1.5px; margin-left: -0.75px;
  background: linear-gradient(transparent, var(--accent) 30%, var(--accent) 70%, transparent);
}
.ar-crosshair::after {
  top: 50%; left: 0; right: 0; height: 1.5px; margin-top: -0.75px;
  background: linear-gradient(90deg, transparent, var(--accent) 30%, var(--accent) 70%, transparent);
}
.crosshair-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  box-shadow: 0 0 10px rgba(255, 138, 74, 0.6);
}
.crosshair-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: var(--accent);
}

.bearing-pill {
  position: absolute;
  left: 50%;
  top: var(--scope-cy);
  transform: translate(-50%, calc(var(--scope-d) / 2 + 16px));
  z-index: 6;
  font: 400 9px var(--font-mono);
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.85);
  background: var(--glass);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
}

.aim-live {
  position: absolute;
  top: calc(14px + var(--safe-top));
  left: 16px;
  z-index: 6;
  display: none;
  align-items: center;
  gap: 5px;
  font: 400 9px var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}
body[data-mode="multi"] .aim-live { display: flex; }
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: live-pulse 1.4s infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.04); }
}

/* ─── aim: compass dial (fallback mode) ─── */

.dial-container {
  position: relative;
  width: min(78vw, 46dvh, 360px);
  aspect-ratio: 1;
  margin: 8px 0;
  touch-action: none;
}
.dial-container svg { width: 100%; height: 100%; display: block; }

.lubber {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-top: 18px solid var(--accent);
  filter: drop-shadow(0 2px 8px rgba(255, 138, 74, 0.8));
}

.heading-readout {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.heading-deg {
  font: 700 clamp(38px, 11vw, 54px) var(--font-ui);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.heading-cardinal {
  font: 700 13px var(--font-mono);
  letter-spacing: 0.2em;
  color: var(--accent);
}

/* ─── reveal / globe ─── */

#screen-reveal { padding: 0; position: relative; }

#globe {
  flex: 1;
  width: 100%;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #0a0f16;
}

.map-credit {
  position: absolute;
  top: calc(14px + var(--safe-top));
  left: 16px;
  z-index: 5;
  font: 400 8px var(--font-mono);
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.4);
  pointer-events: none;
}

.sheet {
  background: rgba(16, 22, 29, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  border-radius: 22px 22px 0 0;
  padding: 18px 20px calc(18px + var(--safe-bottom));
  max-height: 52dvh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}
.sheet h2 { font: 700 18px var(--font-ui); letter-spacing: -0.01em; }
.reveal-sub { color: var(--text-dim); font-size: 13px; margin-top: -8px; }
.results.standings { flex-shrink: 0; }

.results {
  list-style: none;
  overflow-y: visible; /* the sheet scrolls as one */
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.results li {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 10px 14px;
  font-size: 14px;
  text-align: left; /* .center-col centers text — rows read as rows */
}
.results li.winner { border-color: var(--gold); background: rgba(255, 209, 102, 0.1); }
.results .dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.results .r-name { font-weight: 600; flex: 1 1 auto; min-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results .r-detail {
  color: var(--text-faint);
  font: 400 10px var(--font-mono);
  font-variant-numeric: tabular-nums;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.results .r-badge { font: 700 12px var(--font-mono); color: var(--gold); white-space: nowrap; flex-shrink: 0; }

.results.final li { font-size: 16px; padding: 14px 16px; }
.results.final { width: 100%; max-width: 420px; }

/* ─── standings screen (between rounds) ─── */

.board-title { font: 700 28px var(--font-ui); letter-spacing: -0.02em; }

.board {
  list-style: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 2px;
}
.board li {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px 18px;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-align: left;
  animation: board-rise 0.5s cubic-bezier(0.2, 1.2, 0.4, 1) both;
  animation-delay: calc(var(--i) * 90ms);
}
.board li.leader { border-color: var(--gold); background: rgba(255, 209, 102, 0.12); }
.board .rank { font: 700 14px var(--font-mono); color: var(--accent); width: 24px; flex-shrink: 0; }
.board li.leader .rank { color: var(--gold); }
.board .dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.board .b-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.board .b-name {
  font: 700 18px var(--font-ui);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.board .b-gap {
  font: 400 9px var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.board .b-score { font: 700 16px var(--font-mono); white-space: nowrap; }
.board li.leader .b-score { color: var(--gold); }
@keyframes board-rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

.fact-card {
  width: 100%;
  text-align: left;
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 138, 74, 0.12);
  border: 1px solid rgba(255, 138, 74, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.fact-head { display: flex; align-items: center; gap: 10px; }
.fact-flag { font-size: 22px; line-height: 1; }
.fact-title { font: 700 15px var(--font-ui); }
.fact-text { font: 400 12.5px/1.55 var(--font-ui); color: var(--text-dim); margin-top: 6px; }

/* globe labels + markers */
.player-label, .target-label {
  background: rgba(16, 22, 29, 0.85);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  font: 700 11px var(--font-ui);
  padding: 2px 7px;
  white-space: nowrap;
}
.target-label { font-size: 12px; border-color: var(--gold); }
.player-label.winner { border-color: var(--gold); }

/* The miss readout: rides the dashed line between closest point and target */
.miss-pill {
  font: 700 15px var(--font-ui);
  color: var(--gold);
  background: rgba(16, 22, 29, 0.9);
  border: 1px solid rgba(255, 209, 102, 0.55);
  border-radius: 999px;
  padding: 7px 15px;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

/* Flat screen-space pins for Local reveals — no 3D pillars at street scale */
.map-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--dot-color, transparent);
  box-shadow: 0 0 0 2px rgba(16, 22, 29, 0.55), 0 2px 8px rgba(0, 0, 0, 0.5);
}
.map-dot.target {
  width: 18px;
  height: 18px;
  border-color: var(--gold);
  background: transparent;
  position: relative;
}
.map-dot.target::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: var(--gold);
}
.map-dot.origin {
  width: 9px;
  height: 9px;
  border-color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.35);
}

/* ─── gathering scanner (Local mode) ─── */

.gathering {
  position: fixed;
  inset: 0;
  z-index: 1800;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(16, 22, 29, 0.78);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
}
.radar {
  position: relative;
  width: 160px;
  height: 160px;
  margin-bottom: 18px;
}
.radar span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 138, 74, 0.55);
  animation: radar-ring 2.4s cubic-bezier(0.2, 0.6, 0.4, 1) infinite;
}
.radar span:nth-child(2) { animation-delay: 0.8s; }
.radar span:nth-child(3) { animation-delay: 1.6s; }
.radar-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px rgba(255, 138, 74, 0.8);
  animation: live-pulse 1.4s infinite;
}
@keyframes radar-ring {
  from { transform: scale(0.08); opacity: 1; }
  to { transform: scale(1); opacity: 0; }
}
.gathering-title {
  font: 400 12px var(--font-mono);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}
.gathering-sub { font: 400 13px var(--font-ui); color: var(--text-dim); }

@media (prefers-reduced-motion: reduce) {
  .radar span, .radar-dot { animation: none; }
}

/* ─── fixed chrome: timer, leave, toast ─── */

.turn-timer {
  position: fixed;
  top: calc(12px + var(--safe-top));
  right: 16px;
  z-index: 1500;
  min-width: 56px;
  text-align: center;
  font: 600 14px var(--font-ui);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--glass-heavy);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 7px 13px;
}
.turn-timer.urgent {
  color: var(--ink-1);
  background: var(--accent);
  border-color: transparent;
  animation: timer-pulse 1s ease infinite;
}
@keyframes timer-pulse {
  50% { transform: scale(1.08); }
}

/* Sits top-right (design 8b); never collides with the turn timer — the
   timer shows only while aiming, when the leave button is hidden. */
.leave-btn {
  position: fixed;
  top: calc(12px + var(--safe-top));
  right: 16px;
  z-index: 1500;
  font: 400 10px var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--glass-heavy);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  cursor: pointer;
}
.leave-btn.confirm {
  color: var(--ink-1);
  background: var(--accent);
  border-color: transparent;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + var(--safe-bottom));
  transform: translateX(-50%);
  background: rgba(16, 22, 29, 0.95);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font: 400 13px var(--font-ui);
  padding: 12px 18px;
  border-radius: var(--radius-s);
  max-width: 86vw;
  text-align: center;
  z-index: 2000;
  transition: opacity 0.3s ease;
}

/* ─── liquid glass ────────────────────────────────────────────────
   One shared treatment for every frosted surface: deeper blur with a
   saturation boost (color bleeds through like real glass), a 1px light
   catch along the top edge, and a soft drop shadow lifting it off the
   scene — the same optics as the AR scope. */

.card, .mode-card, .help-step, .board li, .fact-card, .target-card,
.wait-pill, .toast, .turn-timer, .leave-btn, .coords-pill, .round-pill,
.bearing-pill, .miss-pill {
  backdrop-filter: blur(22px) saturate(165%);
  -webkit-backdrop-filter: blur(22px) saturate(165%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18),
    0 12px 32px -14px rgba(0, 0, 0, 0.5);
}
.sheet {
  backdrop-filter: blur(26px) saturate(160%);
  -webkit-backdrop-filter: blur(26px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

/* A diagonal light sheen across the large panels */
.card, .mode-card, .fact-card, .board li { position: relative; overflow: hidden; }
.card::before, .mode-card::before, .fact-card::before, .board li::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(115deg,
    rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.025) 32%, transparent 55%);
  pointer-events: none;
}

/* ─── motion preferences ─── */

@media (prefers-reduced-motion: reduce) {
  .cd-ring::before, .live-dot, .turn-timer.urgent { animation: none; }
  .target-card, .board li { animation: none; }
  .mode-options { transition: none; }
}
