:root {
  --bg: #0f1622; --panel: #182233; --panel-2: #22304a; --ink: #f2f5f9; --mute: #9fb0c4; --line: #2b3a52;
  --lime: #DFE01A; --storm: #7b2ff7; --storm-2: #c9a6ff; --red: #ff4d5e; --orange: #FBB315; --cyan: #05A9CE; --pink: #EF4F99;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.4; overscroll-behavior: none; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--mute); }
.center { text-align: center; }
.err { color: var(--red); font-weight: 700; margin: 10px 0; min-height: 1px; }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 0; border-radius: 14px; padding: 15px 18px; font-weight: 800; font-size: 17px; cursor: pointer; background: var(--panel-2); color: var(--ink); text-decoration: none; }
.btn.lime { background: var(--lime); color: #0f1622; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.btn.small { width: auto; padding: 9px 14px; font-size: 15px; border-radius: 11px; }
.btn:disabled { opacity: .45; }
.stack > * + * { margin-top: 10px; }
input[type=text] { width: 100%; padding: 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--panel); font-size: 18px; }
input:focus { outline: none; border-color: var(--lime); }
label.f { display: block; margin-bottom: 14px; }
label.f span { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; color: var(--mute); }

/* brand title */
.title { font-weight: 800; font-size: 44px; line-height: .9; letter-spacing: -1px; text-transform: uppercase; margin: 0; }
.title em { font-style: normal; color: var(--storm-2); display: block; }
.tag { display: inline-block; background: var(--lime); color: #0f1622; font-weight: 800; font-size: 14px; letter-spacing: .5px; padding: 5px 9px 4px; transform: skewX(-6deg) rotate(-2deg); }

/* home / join */
.home { min-height: 100vh; padding: calc(30px + var(--safe-t)) 24px calc(30px + var(--safe-b)); display: flex; flex-direction: column; gap: 18px;
  background: radial-gradient(120% 60% at 50% 0%, rgba(123,47,247,.45), transparent 70%), var(--bg); }
.home .logo { width: 140px; }
.home .grow { flex: 1; }
.codein { text-align: center; letter-spacing: 8px; font-size: 28px !important; font-weight: 800; text-transform: uppercase; }
.card { background: var(--panel); border-radius: 18px; padding: 16px; }
.card + .card { margin-top: 12px; }
.card h3 { margin: 0 0 8px; }
.rules { margin: 0; padding-left: 20px; color: var(--mute); }
.rules li { margin-bottom: 6px; }
.rules b { color: var(--ink); }

/* lobby */
.page { padding: calc(16px + var(--safe-t)) 16px calc(24px + var(--safe-b)); max-width: 560px; margin: 0 auto; }
.mehead { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.av { width: 56px; height: 56px; border-radius: 50%; background: var(--panel-2) center/cover; flex: none; border: 3px solid var(--lime); }
.bigbib { font-size: 56px; font-weight: 800; line-height: 1; color: var(--lime); }
.faces { display: flex; flex-wrap: wrap; gap: 8px; }
.faces span { display: flex; flex-direction: column; align-items: center; width: 60px; font-size: 12px; color: var(--mute); text-align: center; overflow: hidden; }
.faces i { width: 46px; height: 46px; border-radius: 50%; background: var(--panel-2) center/cover; margin-bottom: 3px; }
.countbig { font-size: 64px; font-weight: 800; color: var(--lime); text-align: center; line-height: 1; }

/* the game screen */
.game { position: fixed; inset: 0; display: flex; flex-direction: column; }
.game .mapel { position: absolute; inset: 0; }
.hud { position: absolute; left: 0; right: 0; top: 0; padding: calc(8px + var(--safe-t)) 10px 0; display: flex; flex-direction: column; gap: 6px; pointer-events: none; z-index: 5; }
.hud .row { display: flex; gap: 6px; }
.chip { background: rgba(15,22,34,.86); border-radius: 12px; padding: 7px 11px; font-weight: 800; font-size: 15px; backdrop-filter: blur(6px); white-space: nowrap; }
.chip small { display: block; font-size: 11px; color: var(--mute); font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
.chip.wide { flex: 1; }
.chip.storm { background: rgba(123,47,247,.9); }
.chip.ping { background: rgba(5,169,206,.92); }
.feedline { align-self: flex-start; background: rgba(15,22,34,.8); border-radius: 10px; padding: 5px 10px; font-size: 13px; font-weight: 700; }
.foot { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 12px calc(12px + var(--safe-b)); display: flex; gap: 10px; align-items: flex-end; z-index: 5; }
.tagbtn { flex: 1; height: 74px; border-radius: 22px; border: 0; background: var(--lime); color: #0f1622; font-size: 26px; font-weight: 800; letter-spacing: 1px; box-shadow: 0 6px 24px rgba(0,0,0,.45); cursor: pointer; }
.tagbtn:disabled { background: #4b5566; color: #c5ccd6; font-size: 16px; letter-spacing: 0; }
.sqbtn { width: 64px; height: 64px; border-radius: 18px; border: 0; background: rgba(15,22,34,.9); color: var(--ink); font-size: 24px; cursor: pointer; display: grid; place-items: center; line-height: 1; }
.sqbtn small { display: block; font-size: 10px; font-weight: 800; color: var(--mute); }

/* warnings */
.stormwarn { position: absolute; left: 10px; right: 10px; top: 50%; transform: translateY(-50%); z-index: 6; background: rgba(123,47,247,.95); border-radius: 18px; padding: 16px; text-align: center; animation: throb 1s infinite; }
.stormwarn b { font-size: 40px; display: block; line-height: 1; }
@keyframes throb { 50% { box-shadow: 0 0 0 10px rgba(123,47,247,.35); } }
.near { position: absolute; inset: 0; pointer-events: none; z-index: 4; box-shadow: inset 0 0 0 0 rgba(255,77,94,.0); animation: heart 1.1s infinite; }
@keyframes heart { 0%, 100% { box-shadow: inset 0 0 40px 6px rgba(255,77,94,.25); } 15% { box-shadow: inset 0 0 90px 22px rgba(255,77,94,.7); } 30% { box-shadow: inset 0 0 40px 6px rgba(255,77,94,.3); } 45% { box-shadow: inset 0 0 80px 18px rgba(255,77,94,.6); } }
.nearchip { position: absolute; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%); z-index: 6; background: var(--red); color: #fff; border-radius: 99px; padding: 8px 16px; font-weight: 800; display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.nearchip .arrow { display: inline-block; font-size: 20px; transition: transform .4s; }
.offline { position: absolute; left: 10px; right: 10px; bottom: calc(100px + var(--safe-b)); z-index: 6; background: var(--orange); color: #0f1622; border-radius: 12px; padding: 10px 12px; font-weight: 800; text-align: center; }

/* full-screen layers */
.layer { position: fixed; inset: 0; z-index: 50; background: rgba(15,22,34,.94); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: calc(20px + var(--safe-t)) 22px calc(20px + var(--safe-b)); overflow: auto; }
.layer h2 { font-size: 30px; margin: 8px 0; line-height: 1.05; }
.layer .x { position: absolute; top: calc(12px + var(--safe-t)); right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--panel-2); font-size: 20px; cursor: pointer; }
.mycode { background: #fff; padding: 18px; border-radius: 18px; }
.mycode canvas, .mycode img { display: block; width: min(78vw, 60vh) !important; height: auto !important; image-rendering: pixelated; }
.victory { font-size: 54px; font-weight: 800; line-height: .9; text-transform: uppercase; color: var(--lime); letter-spacing: -1px; text-shadow: 0 0 30px rgba(223,224,26,.5); }
.bigav { width: 130px; height: 130px; border-radius: 50%; background: var(--panel-2) center/cover; border: 5px solid var(--lime); margin: 10px auto; }
.outav { filter: grayscale(1); border-color: var(--red); }
.standings { width: 100%; max-width: 420px; text-align: left; margin-top: 14px; }
.standings div { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.standings .pl { width: 30px; font-weight: 800; color: var(--lime); }
.standings i { width: 34px; height: 34px; border-radius: 50%; background: var(--panel-2) center/cover; flex: none; }
.standings .nm { flex: 1; font-weight: 700; }
.standings .me { background: rgba(223,224,26,.12); }
.splat { font-size: 80px; animation: pop .5s ease-out; }
@keyframes pop { from { transform: scale(.3); } 70% { transform: scale(1.2); } to { transform: scale(1); } }

/* camera: selfie + scanner */
.cam { position: fixed; inset: 0; z-index: 60; background: #000; }
.cam video { width: 100%; height: 100%; object-fit: cover; }
.cam .top { position: absolute; top: 0; left: 0; right: 0; padding: calc(12px + var(--safe-t)) 14px; display: flex; justify-content: space-between; align-items: center; color: #fff; font-weight: 800; text-shadow: 0 1px 4px #000; }
.cam .x { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(0,0,0,.5); color: #fff; font-size: 20px; cursor: pointer; }
.cam .shutter { position: absolute; left: 50%; bottom: calc(26px + var(--safe-b)); transform: translateX(-50%); width: 78px; height: 78px; border-radius: 50%; border: 5px solid #fff; background: rgba(255,255,255,.3); cursor: pointer; }
.cam .aim { position: absolute; left: 50%; top: 50%; width: 64vmin; height: 64vmin; transform: translate(-50%, -50%); border: 4px solid var(--lime); border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
.cam .aim::before, .cam .aim::after { content: ''; position: absolute; left: 50%; top: 50%; background: var(--lime); transform: translate(-50%, -50%); }
.cam .aim::before { width: 30px; height: 4px; } .cam .aim::after { width: 4px; height: 30px; }
.cam .typeit { position: absolute; left: 14px; right: 14px; bottom: calc(16px + var(--safe-b)); display: flex; gap: 8px; }
.cam .typeit input { flex: 1; text-transform: uppercase; letter-spacing: 3px; font-weight: 800; background: rgba(15,22,34,.85); }
.preview { width: 100%; max-width: 360px; border-radius: 18px; display: block; margin: 0 auto 12px; }

.toast { position: fixed; left: 12px; right: 12px; top: calc(110px + var(--safe-t)); z-index: 80; background: var(--panel-2); color: var(--ink); font-weight: 800; padding: 12px 14px; border-radius: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.5); text-align: center; }
.toast.lime { background: var(--lime); color: #0f1622; }
.toast.red { background: var(--red); color: #fff; }

/* map pins (StormMap) */
.sm { background: #1b2533; overflow: hidden; }
.sm-radar { display: block; }
.sm-bg { fill: #1b2533; } .sm-grid { fill: none; stroke: #2b3a52; stroke-width: 1; }
.sm-storm { fill: rgba(123,47,247,.45); } .sm-edge { fill: none; stroke: #c9a6ff; stroke-width: 3; } .sm-next { fill: none; stroke: #fff; stroke-width: 2; stroke-dasharray: 6 5; }
.sm-scale { fill: #6f8299; font-size: 11px; font-family: inherit; }
.sm-mk { position: absolute; transform: translate(-50%, -50%); z-index: 2; }
.sm-pin { display: flex; flex-direction: column; align-items: center; }
.sm-pin i { width: 30px; height: 30px; border-radius: 50%; background: var(--panel-2) center/cover; border: 3px solid #fff; display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: 14px; color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.sm-pin b { margin-top: 2px; font-size: 11px; background: rgba(15,22,34,.85); color: #fff; padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
.sm-pin.me i { width: 22px; height: 22px; background: var(--cyan); border-color: #fff; box-shadow: 0 0 0 6px rgba(5,169,206,.3); }
.sm-pin.ping i { border-color: var(--cyan); animation: blip 1s infinite; }
.sm-pin.stormer i { border-color: var(--storm-2); }
.sm-pin.lost i { border-color: var(--orange); opacity: .8; }
.sm-pin.drop i { background: var(--lime); color: #0f1622; border-color: #0f1622; }
.sm-pin.out i { filter: grayscale(1); opacity: .5; border-color: #777; }
.sm-pin.live i { border-color: var(--lime); }
@keyframes blip { 50% { box-shadow: 0 0 0 10px rgba(5,169,206,.0), 0 0 0 4px rgba(5,169,206,.6); } }
.game .sm-scale { display: none; }
