/* Outbreak: night-ops radio look. Two team colours carry all meaning:
   survivors are cyan, the horde is acid green, the radio is amber, danger is red. */

:root {
  --bg: #0a0c0b;
  --panel: #121614;
  --panel-2: #1a1f1c;
  --line: #2a312d;
  --text: #e8ece9;
  --dim: #8b958f;
  --surv: #62e6ff;
  --horde: #b8ff3d;
  --radio: #ffb21e;
  --danger: #ff4d3d;
  --team: var(--surv);
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, monospace;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
body[data-team='horde'] { --team: var(--horde); }

[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); overflow: hidden; }
body { position: fixed; inset: 0; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, select { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; }
h2 { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); margin: 22px 0 10px; font-weight: 600; }
h3 { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); margin: 18px 0 8px; }
button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.screen { position: fixed; inset: 0; display: none; z-index: 10; }
body[data-screen='home'] #home,
body[data-screen='lobby'] #lobby,
body[data-screen='game'] #game { display: block; }
body[data-screen='home'] #dock { display: none; }

/* ------------------------------------------------------------- shared bits */
.eyebrow { font: 600 11px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--dim); margin: 0 0 8px; }
.hint { font-size: 13px; color: var(--dim); line-height: 1.45; margin: 8px 0; }
.error { color: var(--danger); font-size: 14px; min-height: 1em; margin: 10px 0 0; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 52px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--panel-2); font-weight: 650; font-size: 16px; letter-spacing: .02em;
}
.btn:active { transform: scale(.985); }
.btn.primary { background: var(--team); color: #06110d; border-color: transparent; }
.btn.danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.small { width: auto; min-height: 40px; font-size: 14px; padding: 0 14px; border-radius: 11px; }
.btn.small svg { width: 18px; height: 18px; }
.btn:disabled { opacity: .45; }
.link { background: none; border: 0; color: var(--dim); text-decoration: underline; padding: 14px 0; font-size: 14px; display: block; margin: 8px auto 0; }
.link.small { font-size: 12px; padding: 6px 0; margin: 0 auto; }
.field { display: block; margin: 0 0 12px; }
.field span { display: block; font: 600 11px var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; }
input, select {
  width: 100%; height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); font: 600 17px var(--mono); letter-spacing: .08em; padding: 0 14px; outline: none;
}
select { font: 500 16px var(--sans); letter-spacing: 0; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%); background-position: calc(100% - 20px) 23px, calc(100% - 15px) 23px; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus, select:focus { border-color: var(--team); }
input::placeholder { color: #4c5550; }

/* -------------------------------------------------------------------- home */
/* One screen, no scrolling: the art fills the top, the form sits at the bottom. */
#home { overflow: hidden; background: var(--bg); }
.hero { position: absolute; inset: 0 0 auto; height: 72%; overflow: hidden; }
.hero img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; display: block; animation: kenburns 22s ease-in-out infinite alternate; }
.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(10, 12, 11, .35), transparent 30%, rgba(10, 12, 11, .55) 62%, var(--bg) 98%); }
@keyframes kenburns { from { transform: scale(1.02); } to { transform: scale(1.12) translateY(-2%); } }
.sweep {
  position: absolute; left: 50%; top: 34%; width: 160vmax; height: 160vmax; translate: -50% -50%;
  background: conic-gradient(from 0deg, rgba(98, 230, 255, .12), transparent 12%);
  border-radius: 50%; animation: sweep 7s linear infinite; pointer-events: none; mix-blend-mode: screen;
  mask: radial-gradient(circle, #000 0 25%, transparent 55%);
}
@keyframes sweep { to { rotate: 360deg; } }
.home-inner {
  position: relative; height: 100%; max-width: 440px; margin: 0 auto; display: flex; flex-direction: column; justify-content: flex-end;
  padding: calc(16px + var(--safe-t)) 20px calc(10px + var(--safe-b));
}
.wordmark { position: relative; font: 800 clamp(44px, 14.5vw, 66px)/0.9 var(--mono); letter-spacing: .02em; margin: 2px 0 12px; text-shadow: 0 4px 30px rgba(0, 0, 0, .8); }
.wordmark span { color: var(--horde); text-shadow: 0 0 18px rgba(184, 255, 61, .55); animation: flicker 4s infinite; }
@keyframes flicker { 0%, 91%, 95%, 100% { opacity: 1; } 93% { opacity: .25; } 97% { opacity: .6; } }
/* the RGB-split glitch: two clipped copies of the word jitter for a split second every few seconds */
.wordmark::before, .wordmark::after { content: attr(data-text); position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.wordmark::before { color: var(--surv); animation: glitch-a 5s infinite steps(1); }
.wordmark::after { color: var(--danger); animation: glitch-b 5s infinite steps(1); }
@keyframes glitch-a { 0%, 86%, 92%, 100% { opacity: 0; } 87% { opacity: .8; transform: translate(-3px, 1px); clip-path: inset(10% 0 55% 0); } 89% { opacity: .8; transform: translate(4px, -1px); clip-path: inset(60% 0 8% 0); } 91% { opacity: .6; transform: translate(-2px, 0); clip-path: inset(35% 0 40% 0); } }
@keyframes glitch-b { 0%, 87%, 93%, 100% { opacity: 0; } 88% { opacity: .7; transform: translate(3px, 0); clip-path: inset(50% 0 20% 0); } 90% { opacity: .7; transform: translate(-4px, 1px); clip-path: inset(5% 0 70% 0); } }
.tagline { font-size: 15px; line-height: 1.45; color: #c4ccc7; margin: 0 0 18px; text-shadow: 0 1px 8px #000; }
.home-inner .field { margin-bottom: 10px; }
#createBtn { margin: 4px 0 10px; }
.join-row { display: flex; gap: 10px; }
.join-row input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .3em; text-align: center; }
.join-row .btn { width: 104px; flex: none; }
#homeError:empty { min-height: 0; margin: 0; }
.home-links { display: flex; justify-content: center; gap: 22px; }
.home-links .link { margin: 0; padding: 12px 0; }
.link.install { display: flex; align-items: center; gap: 6px; color: var(--team); text-decoration: none; font-weight: 650; animation: nudge 3s ease-in-out infinite; }
.link.install svg { width: 16px; height: 16px; }
@keyframes nudge { 0%, 80%, 100% { transform: none; } 85% { transform: translateY(-3px); } 90% { transform: none; } 95% { transform: translateY(-2px); } }
.rise { animation: rise .7s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 70ms + 120ms); }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@media (max-height: 640px) {
  .tagline { display: none; }
  .wordmark { font-size: 44px; margin-bottom: 14px; }
}

/* --------------------------------------------------------------------- map */
#map { position: fixed; inset: 0; background: #0d100f; z-index: 1; }
body[data-screen='home'] #map { visibility: hidden; }
body[data-screen='lobby'] #map { bottom: 50%; }
.leaflet-container { background: #0d100f; font-family: var(--sans); }
.tiles-dark { filter: invert(1) hue-rotate(180deg) brightness(.82) contrast(.92) saturate(.35); }
.leaflet-control-attribution { background: rgba(10, 12, 11, .7) !important; color: #6b746f !important; font-size: 9px !important; }
.leaflet-control-attribution a { color: #8b958f !important; }
body[data-screen='game'] .leaflet-bottom { bottom: calc(150px + var(--safe-b)); }
body[data-screen='game'] .leaflet-top { top: calc(114px + var(--safe-t)); }
.leaflet-control-zoom a { background: var(--panel) !important; color: var(--text) !important; border-color: var(--line) !important; }

.mk { position: relative; }
.mk .dot { position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #0a0c0b; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 35%, transparent); }
.mk .lbl { position: absolute; left: 12px; top: -9px; white-space: nowrap; font: 700 11px var(--mono); letter-spacing: .06em; color: var(--c); text-shadow: 0 1px 2px #000, 0 0 6px #000; }
.mk.surv { --c: var(--surv); }
.mk.horde { --c: var(--horde); }
.mk.stale { opacity: .45; }
.mk.me .dot { left: -9px; top: -9px; width: 18px; height: 18px; background: #fff; box-shadow: 0 0 0 4px var(--team), 0 0 18px var(--team); }
.mk.me .dot::after { content: ''; position: absolute; inset: -12px; border-radius: 50%; border: 2px solid var(--team); animation: ring 2s ease-out infinite; }
.mk.reveal .dot { border-radius: 2px; rotate: 45deg; background: transparent; border: 2px solid var(--danger); box-shadow: none; }
.mk.reveal { --c: var(--danger); }
.mk.out { --c: var(--danger); }
.mk.out .dot { animation: blink .8s steps(2) infinite; }
.mk.radio { --c: var(--radio); }
.mk.radio .dot { left: -5px; top: -5px; width: 10px; height: 10px; }
.mk.radio .dot::before, .mk.radio .dot::after { content: ''; position: absolute; left: 50%; top: 50%; width: 120px; height: 120px; margin: -60px; border-radius: 50%; border: 2px solid var(--radio); animation: ring 2.4s ease-out infinite; }
.mk.radio .dot::after { animation-delay: 1.2s; }
@keyframes ring { from { transform: scale(.1); opacity: 1; } to { transform: scale(1); opacity: 0; } }
@keyframes blink { 50% { opacity: .2; } }

/* ------------------------------------------------------------------- lobby */
#lobby { top: 50%; z-index: 12; }
.sheet {
  position: absolute; inset: -18px 0 0; overflow-y: auto; background: var(--bg); border-radius: 22px 22px 0 0;
  border-top: 1px solid var(--line); padding: 22px 20px calc(170px + var(--safe-b)); box-shadow: 0 -20px 40px rgba(0, 0, 0, .5);
  overscroll-behavior: contain; scrollbar-width: none; overflow-x: hidden;
}
.sheet::-webkit-scrollbar, .card::-webkit-scrollbar, .ob-track::-webkit-scrollbar { display: none; }
body[data-screen='lobby'] .sheet { animation: sheet-up .55s cubic-bezier(.2, .9, .25, 1.05) both; }
@keyframes sheet-up { from { transform: translateY(70%); opacity: .4; } }
.sheet::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: -10px auto 14px; }
.sheet > * { max-width: 520px; margin-left: auto; margin-right: auto; }
.lobby-head { display: flex; align-items: center; justify-content: space-between; }
.code { font: 800 clamp(30px, 10vw, 40px)/1 var(--mono); letter-spacing: .22em; margin: 0; color: var(--team); }
.chips { display: flex; gap: 8px; margin-top: 16px; }
.chip { flex: 1; height: 38px; border-radius: 19px; border: 1px solid var(--line); background: var(--panel); font: 600 12px var(--mono); letter-spacing: .1em; color: var(--dim); }
.chip[data-ok='1'] { color: var(--team); border-color: color-mix(in srgb, var(--team) 40%, transparent); }
.chip[data-ok='-1'] { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.roster { list-style: none; margin: 0; padding: 0; }
.roster li.new { animation: pop .45s cubic-bezier(.2, .9, .3, 1.3) both; }
@keyframes pop { from { opacity: 0; transform: translateX(-14px) scale(.96); } }
.roster li { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); font: 600 15px var(--mono); letter-spacing: .05em; }
.roster li .tag { margin-left: auto; font: 600 10px var(--mono); letter-spacing: .14em; color: var(--dim); text-transform: uppercase; }
.roster li .led { width: 8px; height: 8px; border-radius: 50%; background: var(--surv); box-shadow: 0 0 8px var(--surv); }
.roster li.off .led { background: #444; box-shadow: none; }
.roster li.horde .led { background: var(--horde); box-shadow: 0 0 8px var(--horde); }
.row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.row .hint { margin: 0; }
.range { display: block; margin: 4px 0 18px; }
.range span { display: flex; justify-content: space-between; font: 600 11px var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin-bottom: 4px; }
.range b { color: var(--text); }
input[type='range'] { height: 34px; padding: 0; border: 0; background: none; accent-color: var(--team); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
#botsBtn { margin: 4px 0 12px; }
#startBtn { margin-top: 8px; }
.summary { font: 500 14px/1.6 var(--mono); color: #c4ccc7; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
body:not([data-host='1']) #hostSettings { display: none; }
body[data-host='1'] #guestSettings { display: none; }

/* -------------------------------------------------------------------- game */
#game { pointer-events: none; }
#game > * { pointer-events: auto; }
.hud {
  position: absolute; left: 10px; right: 10px; top: calc(10px + var(--safe-t)); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  background: rgba(10, 12, 11, .82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px;
  row-gap: 8px;
}
body[data-screen='game'] .hud { animation: drop .6s cubic-bezier(.2, .9, .25, 1.1) both; }
@keyframes drop { from { transform: translateY(-130%); } }
.run-stats { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); font: 600 11px var(--mono); letter-spacing: .04em; color: var(--dim); }
.run-stats b { color: var(--text); font-weight: 800; }
.run-stats b.tick { animation: tick .5s ease-out; }
@keyframes tick { from { color: var(--team); text-shadow: 0 0 10px var(--team); } }
.hud-left, .hud-right { display: flex; flex-direction: column; gap: 5px; }
.hud-left { align-items: flex-start; }
.hud-right { align-items: flex-end; }
.badge { font: 800 11px var(--mono); letter-spacing: .14em; color: #06110d; background: var(--team); border-radius: 6px; padding: 4px 7px; }
.pill { font: 600 10px var(--mono); letter-spacing: .14em; color: var(--dim); }
.clock { font: 800 30px/1 var(--mono); letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.counts { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font: 700 11px var(--mono); letter-spacing: .06em; }
.counts .s { color: var(--surv); }
.counts .h { color: var(--horde); }
.reveal-in { font: 600 10px var(--mono); letter-spacing: .1em; color: var(--danger); }
.banner {
  position: absolute; left: 10px; right: 10px; top: calc(122px + var(--safe-t)); padding: 12px 14px; border-radius: 14px;
  font: 700 14px/1.35 var(--mono); letter-spacing: .04em; text-align: center; background: rgba(10, 12, 11, .9); border: 1px solid var(--line);
}
.banner.warn { border-color: var(--danger); color: var(--danger); animation: blink 1s steps(2) infinite; }
.banner.big { top: 0; left: 0; right: 0; bottom: 0; border-radius: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(5, 7, 6, .94); font-size: 18px; padding: 30px; }
.banner.big b { font-size: 72px; letter-spacing: .04em; color: var(--team); text-shadow: 0 0 30px var(--team); }
.banner.big b.beat { animation: beat .9s ease-out; }
@keyframes beat { 0% { transform: scale(1.18); } 100% { transform: none; } }
.banner.big { animation: fade .4s ease both; }
@keyframes fade { from { opacity: 0; } }

#threat { position: fixed; inset: 0; pointer-events: none; z-index: 5; opacity: 0; transition: opacity .6s; box-shadow: inset 0 0 120px 40px rgba(255, 50, 40, .55); }
#threat[data-level='1'] { opacity: .35; animation: pulse 1.4s ease-in-out infinite; }
#threat[data-level='2'] { opacity: .6; animation: pulse .9s ease-in-out infinite; }
#threat[data-level='3'] { opacity: .9; animation: pulse .55s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { filter: brightness(.6); } 15% { filter: brightness(1.3); } 30% { filter: brightness(.8); } 45% { filter: brightness(1.15); } }

/* -------------------------------------------------------------------- dock */
#dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 0 16px calc(16px + var(--safe-b)); pointer-events: none; }
#dock > * { pointer-events: auto; }
.dock-row { display: flex; align-items: center; justify-content: space-between; max-width: 460px; margin: 0 auto; }
body[data-screen='lobby'] .dock-row { justify-content: center; }
body[data-screen='lobby'] #dock { padding-top: 26px; background: linear-gradient(to top, var(--bg) 55%, transparent); }
body[data-screen='lobby'] #recenterBtn, body[data-screen='lobby'] #actionBtn { display: none; }
.round.side {
  width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--line); background: rgba(18, 22, 20, .92);
  display: flex; align-items: center; justify-content: center; font: 800 12px var(--mono); letter-spacing: .1em;
}
#actionBtn { position: relative; }
#actionBtn.off { visibility: hidden; }
#actionBtn.bite { background: var(--horde); color: #06110d; border: 0; box-shadow: 0 0 22px rgba(184, 255, 61, .45); }
#actionBtn.bite.cool { opacity: .4; }
#actionBtn.tagged { font-size: 10px; color: var(--dim); }
.ptt-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ptt {
  width: 104px; height: 104px; border-radius: 50%; border: 3px solid var(--team); background: radial-gradient(circle at 50% 35%, #26302b, #121614 70%);
  color: var(--team); display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 30px rgba(0, 0, 0, .6), inset 0 2px 0 rgba(255, 255, 255, .06); touch-action: none;
}
.ptt svg { width: 40px; height: 40px; position: relative; z-index: 1; }
.ptt { position: relative; transition: transform .15s, background .15s, box-shadow .2s; }
.ptt::before, .ptt::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--radio); opacity: 0; pointer-events: none; }
.ptt[data-s='tx']::before, .ptt[data-s='tx']::after { animation: ripple 1.4s ease-out infinite; }
.ptt[data-s='tx']::after { animation-delay: .7s; }
.ptt[data-s='rx']::before { border-color: var(--team); animation: ripple 1.8s ease-out infinite; }
@keyframes ripple { from { transform: scale(1); opacity: .9; } to { transform: scale(1.7); opacity: 0; } }
body[data-screen='game'] .dock-row { animation: rise .6s .15s cubic-bezier(.2, .8, .2, 1) both; }
.ptt[data-s='wait'] { border-color: var(--radio); color: var(--radio); }
.ptt[data-s='tx'] { background: var(--radio); border-color: var(--radio); color: #1a1000; box-shadow: 0 0 40px rgba(255, 178, 30, .7); transform: scale(1.04); }
.ptt[data-s='busy'] { border-color: var(--danger); color: var(--danger); }
.ptt[data-s='rx'] { border-style: dashed; }
.chan { font: 700 10px var(--mono); letter-spacing: .18em; color: var(--dim); background: rgba(10, 12, 11, .8); padding: 3px 8px; border-radius: 6px; }
.rx-line { display: flex; align-items: center; gap: 8px; width: max-content; margin: 0 auto 10px; padding: 7px 12px; border-radius: 10px; background: rgba(10, 12, 11, .9); border: 1px solid var(--radio); color: var(--radio); font: 700 13px var(--mono); letter-spacing: .08em; }
.rx-line i { display: flex; align-items: flex-end; gap: 2px; width: 14px; height: 12px; }
.rx-line i { --bar: linear-gradient(currentColor, currentColor); }
.rx-line i { background: var(--bar) 0 100% / 3px 40% no-repeat, var(--bar) 5px 100% / 3px 90% no-repeat, var(--bar) 10px 100% / 3px 60% no-repeat; animation: eq .45s steps(3) infinite; }
@keyframes eq { 33% { background-size: 3px 90%, 3px 50%, 3px 100%; } 66% { background-size: 3px 60%, 3px 100%, 3px 35%; } }
.rx-line { animation: fade .2s ease; }
.rx-line.me { background: var(--radio); color: #1a1000; }
.rx-line.me { color: #1a1000; }

/* ------------------------------------------------------------------ modals */
.modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, .6); padding: 16px 16px calc(16px + var(--safe-b)); }
.modal[hidden] { display: none; }
.modal:not([hidden]) .card { animation: card-up .45s cubic-bezier(.2, .9, .25, 1.05) both; }
@keyframes card-up { from { transform: translateY(40px); opacity: 0; } }
.modal:not([hidden]) { animation: fade .3s ease both; }
.card { width: 100%; max-width: 440px; max-height: 100%; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: none; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 22px; }
.card h2 { font-size: 24px; letter-spacing: 0; text-transform: none; color: var(--text); margin: 0 0 14px; }
.card .btn + .btn { margin-top: 10px; }
.card.danger { border-color: var(--danger); box-shadow: 0 0 60px rgba(255, 77, 61, .3); animation: card-up .45s both, shake .5s .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin: 0 0 18px; }
.bar i { display: block; height: 100%; background: var(--danger); width: 100%; transition: width .25s linear; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.chain { margin: 0 0 18px; padding: 0; list-style: none; }
.chain li { animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 60ms + 500ms); }
.chain li { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); font: 600 14px var(--mono); }
.chain li .t { color: var(--dim); font-size: 12px; min-width: 44px; }
.chain li .by { color: var(--dim); font-weight: 500; font-size: 12px; }
.chain li.alive { color: var(--surv); }
#winner.surv { color: var(--surv); }
#winner.horde { color: var(--horde); }

#flash { position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: 0; background: radial-gradient(circle, rgba(184, 255, 61, .2), rgba(184, 255, 61, .75)); }
#flash.go { animation: flash 1.6s ease-out; }
body.shake #game, body.shake #map { animation: quake .6s cubic-bezier(.36, .07, .19, .97); }
@keyframes quake { 10%, 90% { transform: translate(-2px, 1px); } 20%, 80% { transform: translate(4px, -2px); } 30%, 50%, 70% { transform: translate(-6px, 2px); } 40%, 60% { transform: translate(6px, -1px); } }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }

#toasts { position: fixed; left: 0; right: 0; top: calc(176px + var(--safe-t)); z-index: 45; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
body[data-screen='lobby'] #toasts { top: calc(16px + var(--safe-t)); }
.toast { max-width: 420px; padding: 10px 14px; border-radius: 12px; background: rgba(18, 22, 20, .95); border: 1px solid var(--line); font: 600 13px/1.4 var(--mono); letter-spacing: .03em; animation: toast 4.2s ease forwards; text-align: center; }
.toast.surv { border-color: var(--surv); color: var(--surv); }
.toast.horde { border-color: var(--horde); color: var(--horde); }
.toast.danger { border-color: var(--danger); color: var(--danger); }
.toast.radio { border-color: var(--radio); color: var(--radio); }
@keyframes toast { 0% { opacity: 0; transform: translateY(-8px); } 8%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* -------------------------------------------------------------- big moments */
.stamp { position: fixed; inset: 0; z-index: 48; display: flex; align-items: center; justify-content: center; pointer-events: none; opacity: 0; }
.stamp b { font: 900 clamp(38px, 12vw, 72px)/1 var(--mono); letter-spacing: .04em; text-align: center; padding: 10px 18px; border: 4px solid currentColor; border-radius: 10px; rotate: -6deg; background: rgba(5, 7, 6, .7); text-shadow: 0 0 24px currentColor; }
.stamp.go { animation: stamp-life 1.9s ease forwards; }
.stamp.go b { animation: stamp-hit .45s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes stamp-life { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes stamp-hit { from { transform: scale(2.6); opacity: 0; filter: blur(6px); } }
#scan { position: fixed; left: 0; right: 0; top: 0; height: 30vh; z-index: 46; pointer-events: none; opacity: 0; background: linear-gradient(to bottom, transparent, rgba(255, 77, 61, .28) 85%, rgba(255, 77, 61, .9) 99%, transparent); }
#scan.go { animation: scan 1.3s cubic-bezier(.4, 0, .6, 1); }
@keyframes scan { 0% { opacity: 1; transform: translateY(-100%); } 90% { opacity: 1; } 100% { opacity: 0; transform: translateY(340%); } }

/* ------------------------------------------------------------- onboarding */
.onboard { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; animation: fade .35s ease both; }
.ob-skip { position: absolute; top: calc(12px + var(--safe-t)); right: 14px; z-index: 2; background: rgba(10, 12, 11, .6); border: 1px solid var(--line); border-radius: 20px; padding: 8px 14px; font: 600 12px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--text); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.ob-track { flex: 1; min-height: 0; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior: contain; }
.ob-slide { flex: 0 0 100%; width: 100%; scroll-snap-align: center; scroll-snap-stop: always; display: flex; flex-direction: column; overflow: hidden; }
.ob-art { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.ob-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: translateX(calc(var(--p, 0) * 18%)) scale(1.12); }
.ob-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 55%, var(--bg)); }
.ob-text { flex: none; padding: 4px 24px 8px; max-width: 520px; margin: 0 auto; width: 100%; }
.ob-text h2 { font: 800 clamp(26px, 7.4vw, 32px)/1.1 var(--sans); letter-spacing: -.01em; text-transform: none; color: var(--text); margin: 0 0 10px; }
.ob-text p:not(.eyebrow) { font-size: 15px; line-height: 1.5; color: #b9c2bd; margin: 0; }
.ob-text .eyebrow { color: var(--team); }
.ob-slide .ob-text > * { opacity: 0; transform: translateY(14px); transition: opacity .5s, transform .5s cubic-bezier(.2, .8, .2, 1); }
.ob-slide.on .ob-text > * { opacity: 1; transform: none; }
.ob-slide.on .ob-text > :nth-child(2) { transition-delay: .08s; }
.ob-slide.on .ob-text > :nth-child(3) { transition-delay: .16s; }
.ob-slide.on .ob-text > :nth-child(4) { transition-delay: .24s; }
.ob-icon { display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 50%, #15241d, var(--bg) 65%); }
.ob-icon img { position: relative; inset: auto; width: min(46vw, 210px); height: auto; transform: none; border-radius: 24%; box-shadow: 0 20px 60px rgba(0, 0, 0, .6), 0 0 60px rgba(98, 230, 255, .2); animation: float 4s ease-in-out infinite; }
.ob-icon i { position: absolute; left: 50%; top: 50%; width: min(46vw, 210px); aspect-ratio: 1; translate: -50% -50%; border: 2px solid var(--surv); border-radius: 50%; animation: ripple 2.6s ease-out infinite; }
.ob-icon i + i { border-color: var(--horde); animation-delay: 1.3s; }
.ob-icon::after { display: none; }
@keyframes float { 50% { transform: translateY(-8px); } }
.ob-stats { display: flex; gap: 8px; margin: 14px 0; }
.ob-stats span { flex: 1; text-align: center; padding: 10px 4px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font: 600 11px var(--mono); color: var(--dim); }
.ob-stats b { display: block; font-size: 22px; color: var(--text); margin-bottom: 2px; }
.ob-weight { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--dim); }
.ob-weight span { display: flex; align-items: center; gap: 8px; color: var(--dim); }
.ob-weight input { width: 84px; height: 44px; text-align: center; }
.ob-foot { flex: none; display: flex; align-items: center; gap: 16px; padding: 12px 24px calc(16px + var(--safe-b)); max-width: 520px; width: 100%; margin: 0 auto; }
.ob-foot .btn { width: auto; flex: 1; }
.ob-dots { display: flex; gap: 6px; }
.ob-dots i { width: 7px; height: 7px; border-radius: 4px; background: var(--line); transition: width .3s, background .3s; }
.ob-dots i.on { width: 22px; background: var(--team); }

/* ---------------------------------------------------------------- install */
.install-card .install-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.install-card h2 { font-size: 21px; margin: 0; }
.app-icon { width: 64px; height: 64px; border-radius: 15px; flex: none; box-shadow: 0 0 30px rgba(98, 230, 255, .25); }
.perks { list-style: none; padding: 0; margin: 10px 0 16px; }
.perks li { position: relative; padding: 6px 0 6px 26px; font-size: 14px; color: #c4ccc7; }
.perks li::before { content: ''; position: absolute; left: 4px; top: 11px; width: 10px; height: 6px; border: solid var(--team); border-width: 0 0 2px 2px; rotate: -45deg; }
.steps { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 10px; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-size: 14px; line-height: 1.35; animation: rise .5s both; }
.steps li:nth-child(2) { animation-delay: .1s; }
.steps li:nth-child(3) { animation-delay: .2s; }
.steps small { color: var(--dim); }
.steps i { flex: none; width: 34px; height: 34px; border-radius: 9px; background: var(--bg); display: flex; align-items: center; justify-content: center; color: #4da3ff; }
.steps i svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.steps i img { width: 34px; height: 34px; border-radius: 9px; }
.ios-arrow { position: fixed; left: 50%; bottom: calc(6px + var(--safe-b)); width: 26px; height: 26px; margin-left: -13px; border: solid var(--team); border-width: 0 4px 4px 0; rotate: 45deg; animation: point 1.1s ease-in-out infinite; filter: drop-shadow(0 0 6px var(--team)); }
@keyframes point { 50% { translate: 0 8px; } }

/* --------------------------------------------------------------- end screen */
.over-card { padding: 0; }
.over-card > :not(.over-art):not(.over-title) { margin-left: 20px; margin-right: 20px; }
.over-card > :last-child { margin-bottom: 20px; }
.over-card > .btn { width: calc(100% - 40px); }
.over-art { position: relative; height: 150px; overflow: hidden; border-radius: 22px 22px 0 0; }
.over-art img { width: 100%; height: 100%; object-fit: cover; animation: kenburns 14s ease-in-out infinite alternate; }
.over-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 30%, var(--panel)); }
.over-title { position: relative; margin: -44px 20px 0; }
.over-title h2 { font-size: 30px; margin-bottom: 4px; animation: glitch-in .9s steps(1) both .2s; }
@keyframes glitch-in { 0% { opacity: 0; } 10% { opacity: 1; transform: translateX(-8px); clip-path: inset(0 0 60% 0); } 25% { transform: translateX(6px); clip-path: inset(40% 0 0 0); } 40% { transform: none; clip-path: none; } 55% { opacity: .4; } 65%, 100% { opacity: 1; } }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.stat { padding: 10px 8px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); text-align: center; animation: pop .5s cubic-bezier(.2, .9, .3, 1.3) both; animation-delay: calc(var(--i, 0) * 70ms + 300ms); }
.stat b { display: block; font: 800 20px/1.1 var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }
.stat span { font: 600 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.stat.hot b { color: var(--radio); }
#weightBtn { margin-top: 6px; }
.awards { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.awards:empty { display: none; }
.award { display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 8px; border-radius: 20px; background: var(--panel-2); border: 1px solid var(--line); font: 600 12px var(--mono); animation: pop .5s cubic-bezier(.2, .9, .3, 1.3) both; animation-delay: calc(var(--i, 0) * 90ms + 700ms); }
.award i { font-style: normal; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--c, var(--team)); color: #06110d; font-size: 13px; }
.award small { color: var(--dim); font-weight: 500; }

@media (min-width: 900px) {
  body[data-screen='lobby'] #map { bottom: 0; right: 520px; }
  #lobby { top: 0; left: auto; width: 520px; }
  .sheet { inset: 0; border-radius: 0; border-top: 0; border-left: 1px solid var(--line); }
  body[data-screen='lobby'] #dock { left: auto; width: 520px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .ob-art img { transform: scale(1.12); }
}
