@font-face { font-family: 'Barlow Condensed'; src: url('assets/barlow-condensed-900.woff2') format('woff2'); font-weight: 900; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('assets/dm-sans.woff2') format('woff2'); font-weight: 100 1000; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #14102a;
  --panel: #221b45ee;
  --panel-2: #2e2560;
  --line: #4a3f8a;
  --text: #ffffff;
  --muted: #b9b0e8;
  --green: #4fdc5a; --green-d: #2b9a37;
  --orange: #ffa62b; --orange-d: #c8700c;
  --blue: #3fa9ff; --blue-d: #1f6fc4;
  --pink: #ff5fa8;
  --heading: 'Barlow Condensed', 'Arial Narrow', Impact, sans-serif;
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--text);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

#scene { position: fixed; inset: 0; width: 100vw; height: 100dvh; display: block; }
body[data-playing='true'] #scene { cursor: crosshair; }
.load-status { position: fixed; z-index: 5; left: 50%; top: 50%; translate: -50% -50%; margin: 0; padding: 14px 22px; border-radius: 14px; background: var(--panel); font-weight: 800; }

/* ---------- buttons ---------- */
.btn {
  --b: var(--panel-2); --s: #1a1538;
  display: flex; align-items: center; gap: 10px; justify-content: center;
  min-height: 48px; padding: 10px 18px;
  border: 0; border-radius: 14px;
  background: var(--b); box-shadow: 0 5px 0 var(--s), 0 8px 18px #0006;
  font-weight: 850; font-size: 1rem; letter-spacing: .01em;
  transition: transform 90ms ease, filter 120ms ease, box-shadow 90ms ease;
}
.btn:hover:not(:disabled) { filter: brightness(1.12); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--s), 0 3px 8px #0006; }
.btn-play { --b: linear-gradient(180deg, #6cf06f, var(--green)); --s: var(--green-d); background: var(--b); width: 100%; min-height: 72px; font: 900 2.4rem/1 var(--heading); text-transform: uppercase; letter-spacing: .04em; color: #0d2a10; text-shadow: 0 1px 0 #fff6; }
.btn-blue { --s: var(--blue-d); background: linear-gradient(180deg, #6cc0ff, var(--blue)); color: #06203d; width: 100%; font: 900 1.6rem/1 var(--heading); text-transform: uppercase; min-height: 58px; }
.btn-green { --s: var(--green-d); background: linear-gradient(180deg, #6cf06f, var(--green)); color: #0d2a10; }
.btn-small { min-height: 38px; padding: 6px 14px; font-size: .9rem; border-radius: 11px; }
.btn-ghost { background: #ffffff14; box-shadow: 0 4px 0 #0005; }
.tri { width: 0; height: 0; border-left: 20px solid currentColor; border-top: 13px solid transparent; border-bottom: 13px solid transparent; }
.icon-btn { width: 46px; height: 46px; border: 0; border-radius: 12px; background: var(--panel); box-shadow: 0 4px 0 #0007; font-size: 1.25rem; }
.icon-btn:hover { filter: brightness(1.2); }

/* ---------- lobby ---------- */
.lobby { position: fixed; inset: 0; z-index: 2; display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 420px) 1fr; grid-template-rows: auto 1fr; gap: 18px 22px; padding: 18px 24px 24px; pointer-events: none; }
.lobby::before { content: ''; position: fixed; inset: 0; z-index: -1; background: radial-gradient(120% 90% at 85% 55%, transparent 35%, #14102acc 75%), linear-gradient(90deg, #14102af2 0%, #14102acc 34%, transparent 62%); pointer-events: none; }
.lobby > * { pointer-events: auto; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; }
.topbar-right { display: flex; gap: 10px; }
.logo { display: flex; flex-direction: column; line-height: .8; font: 900 clamp(46px, 6vw, 78px)/.82 var(--heading); text-transform: uppercase; transform: rotate(-3deg); text-shadow: 0 5px 0 #0b0820, 0 10px 24px #000a; }
.logo span { color: #fff; }
.logo b { color: var(--orange); -webkit-text-stroke: 2px #6b2f00; }
.side { display: flex; flex-direction: column; gap: 14px; align-self: start; }
.player-card { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 16px; background: var(--panel); border: 2px solid var(--line); }
.player-card img { border-radius: 12px; background: #ffffff14; image-rendering: pixelated; }
.player-card small { display: block; color: var(--muted); font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.player-card strong { font: 900 1.6rem/1 var(--heading); }
.menu { display: flex; flex-direction: column; gap: 10px; }
.btn-menu { justify-content: flex-start; width: 100%; }
.btn-menu i { font-style: normal; width: 26px; text-align: center; }
.btn-menu[aria-pressed='true'] { --b: #4b3cb0; --s: #2a1f75; background: var(--b); outline: 2px solid #8e7dff; }

.panel { align-self: start; max-height: calc(100dvh - 150px); overflow-y: auto; padding: 18px 20px 22px; border-radius: 20px; background: var(--panel); border: 2px solid var(--line); box-shadow: 0 14px 40px #0008; backdrop-filter: blur(6px); }
.panel h2 { margin: 0 0 4px; font: 900 2.1rem/1 var(--heading); text-transform: uppercase; letter-spacing: .02em; }
.panel h3 { display: flex; justify-content: space-between; margin: 18px 0 8px; font-size: .78rem; font-weight: 900; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.panel h3 output { color: #fff; font-size: 1rem; }
.hint { margin: 0; color: var(--muted); font-size: .92rem; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.map-card { position: relative; height: 92px; border: 3px solid transparent; border-radius: 16px; overflow: hidden; display: flex; align-items: end; padding: 8px 10px; box-shadow: 0 5px 0 #0007; font: 900 1.35rem/1 var(--heading); text-transform: uppercase; text-shadow: 0 2px 4px #000; font-size: 1.1rem; }
.map-card.gym { background: linear-gradient(160deg, #f1b46e 0 45%, #c8854a 45% 52%, #3c7f73 52%); }
.map-card.yard { background: linear-gradient(160deg, #a8d8ff 0 40%, #a96348 40% 58%, #686e83 58%); }
.map-card.lot { background: linear-gradient(160deg, #b9d7ee 0 34%, #b0644a 34% 44%, #4a4d57 44% 70%, #f2c230 70% 72%, #4a4d57 72%); }
.map-card[aria-pressed='true'] { border-color: #fff; box-shadow: 0 5px 0 #0007, 0 0 0 4px var(--green); }
input[type='range'] { width: 100%; accent-color: var(--green); height: 28px; }
.seg { display: flex; gap: 6px; padding: 5px; border-radius: 14px; background: #0005; }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 10px; background: transparent; font-weight: 850; color: var(--muted); }
.seg button[aria-pressed='true'] { background: var(--orange); color: #3a1c00; box-shadow: 0 3px 0 var(--orange-d); }

.name-field { display: grid; gap: 6px; margin-top: 12px; font-size: .78rem; font-weight: 900; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.name-field input, #room-code { min-height: 48px; padding: 8px 14px; border: 2px solid var(--line); border-radius: 12px; background: #0006; font-size: 1.1rem; font-weight: 800; letter-spacing: 0; text-transform: none; color: #fff; }
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; }
.char-grid button { display: grid; justify-items: center; gap: 2px; padding: 6px 2px 5px; border: 2px solid transparent; border-radius: 14px; background: #ffffff10; font-size: .72rem; font-weight: 800; box-shadow: 0 3px 0 #0006; }
.char-grid img { image-rendering: pixelated; }
.char-grid button:hover { background: #ffffff22; }
.char-grid button[aria-pressed='true'] { border-color: var(--green); background: #4fdc5a33; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff3; background: var(--c, #0005); font-weight: 900; box-shadow: 0 3px 0 #0006; }
.swatches button[aria-pressed='true'] { border-color: #fff; transform: scale(1.08); }

.setting { display: flex; align-items: center; gap: 12px; min-height: 50px; font-weight: 750; border-bottom: 1px solid #ffffff14; }
.setting input[type='checkbox'] { width: 22px; height: 22px; accent-color: var(--green); }
.setting select { margin-left: auto; min-height: 40px; padding: 4px 10px; background: #0006; border: 2px solid var(--line); border-radius: 10px; }
.controls-help p { margin: 6px 0; color: var(--muted); font-size: .9rem; line-height: 1.9; }
kbd { display: inline-block; min-width: 26px; padding: 1px 7px; margin: 0 2px; border-radius: 6px; background: #ffffff1c; box-shadow: 0 2px 0 #0007; color: #fff; font: 800 .8rem/1.6 'DM Sans', sans-serif; text-align: center; }

.room { display: grid; gap: 14px; margin-top: 14px; }
#join-form label { display: block; margin-bottom: 6px; font-size: .78rem; font-weight: 900; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.join-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
#room-code { width: 100%; min-width: 0; text-transform: uppercase; letter-spacing: .25em; }
#room-code::placeholder { letter-spacing: .25em; color: #ffffff40; }
.room-live { display: grid; gap: 8px; margin-top: 14px; }
.code-box { display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 12px 14px; border-radius: 16px; background: #0006; border: 2px dashed var(--orange); }
.code-box small { grid-column: 1 / -1; color: var(--muted); font-weight: 800; text-transform: uppercase; font-size: .72rem; letter-spacing: .1em; }
.code-box strong { font: 900 2.4rem/1 var(--heading); letter-spacing: .14em; color: var(--orange); }
.roster { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0; padding: 0; list-style: none; }
.roster li { padding: 8px 10px; border-radius: 10px; background: #ffffff10; border-left: 5px solid var(--c); font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-start { min-height: 62px; font-size: 2rem; margin-top: 6px; }
#room-status { margin: 12px 0 0; color: var(--muted); font-size: .9rem; font-weight: 650; }
#room-status:empty { display: none; }

/* ---------- HUD ---------- */
.hud { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.hud-top { position: absolute; inset: 14px 14px auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 12px; }
.scoreboard, .killfeed { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.scoreboard { justify-self: start; min-width: 210px; }
.scoreboard li, .end-list li { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 10px; background: #14102acc; border-left: 5px solid var(--c); font-weight: 800; font-size: .9rem; }
.scoreboard li.me, .end-list li.me { background: #3b2f86ee; outline: 2px solid #fff6; }
.scoreboard b, .end-list b { color: var(--muted); }
.scoreboard span, .end-list span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scoreboard em, .end-list em { font-style: normal; font: 900 1.2rem/1 var(--heading); color: var(--orange); }
.timer { padding: 6px 20px 8px; border-radius: 14px; background: #14102add; border: 2px solid var(--line); font: 900 2.2rem/1 var(--heading); letter-spacing: .03em; }
.timer.low { color: #ff6464; animation: pulse 1s infinite; }
.killfeed { justify-self: end; justify-items: end; }
.killfeed li { padding: 5px 12px; border-radius: 10px; background: #14102acc; font-weight: 850; font-size: .88rem; animation: slide .25s ease-out; }
.banner { position: absolute; left: 50%; top: 30%; translate: -50% -50%; text-align: center; white-space: nowrap; font: 900 clamp(32px, 5vw, 56px)/1 var(--heading); text-transform: uppercase; text-shadow: 0 4px 0 #14102a, 0 8px 24px #000c; }
.banner[data-kind='big'] { font-size: clamp(70px, 12vw, 150px); color: var(--orange); -webkit-text-stroke: 3px #6b2f00; }
.banner[data-kind='sub'] { top: 40%; font-size: clamp(26px, 4vw, 44px); }
.banner.pop { animation: pop .4s cubic-bezier(.2, 1.6, .4, 1); }
.my-hp { position: absolute; left: 50%; bottom: 22px; translate: -50% 0; display: flex; gap: 6px; padding: 8px 12px; border-radius: 14px; background: #14102acc; }
.my-hp i { width: 30px; height: 18px; border-radius: 6px; background: #3a3f55; }
.my-hp i.on { background: linear-gradient(180deg, #9dff7a, #4fdc5a); box-shadow: 0 2px 0 var(--green-d); }
.hud-menu { position: absolute; left: 14px; bottom: 18px; pointer-events: auto; }
body[data-hit='true'] .hud::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 110px #ff3b3bb0; pointer-events: none; }
.end { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: min(440px, calc(100vw - 28px)); max-height: calc(100dvh - 40px); overflow-y: auto; padding: 22px; border-radius: 22px; background: var(--panel); border: 2px solid var(--line); box-shadow: 0 20px 60px #000c; pointer-events: auto; animation: pop .45s cubic-bezier(.2, 1.5, .4, 1); }
.end h2 { margin: 0 0 14px; text-align: center; font: 900 2.8rem/1 var(--heading); text-transform: uppercase; color: var(--orange); }
.end-list { margin: 0 0 16px; padding: 0; list-style: none; display: grid; gap: 5px; }
.end-actions { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.end-actions .btn-play { min-height: 58px; font-size: 1.8rem; }

.touch-controls { position: absolute; inset: auto 16px 74px; display: none; align-items: end; justify-content: space-between; pointer-events: none; }
.directions { display: grid; grid-template-columns: repeat(3, 56px); gap: 6px; }
.directions [data-direction='KeyW'] { grid-column: 2; }
.directions [data-direction='KeyA'] { grid-column: 1; grid-row: 2; }
.directions [data-direction='KeyS'] { grid-column: 2; grid-row: 2; }
.directions [data-direction='KeyD'] { grid-column: 3; grid-row: 2; }
.touch-actions { display: flex; align-items: end; gap: 12px; }
.touch-controls button { min-width: 56px; min-height: 56px; border: 0; border-radius: 16px; background: #14102acc; box-shadow: 0 4px 0 #0008; font-weight: 900; touch-action: none; user-select: none; pointer-events: auto; }
.touch-controls .fire { width: 84px; height: 84px; border-radius: 50%; background: var(--orange); color: #3a1c00; box-shadow: 0 5px 0 var(--orange-d); text-transform: uppercase; }
@media (pointer: coarse) { .touch-controls { display: flex; } }

@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
@keyframes pulse { 50% { transform: scale(1.08); } }

@media (max-width: 900px) {
  .lobby { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; overflow-y: auto; padding: 12px 16px 24px; }
  .lobby::before { background: linear-gradient(0deg, #14102af5 30%, #14102a99 60%, transparent 85%); }
  .side { margin-top: 30vh; }
  .panel { max-height: none; overflow: visible; }
  .scoreboard { min-width: 0; max-width: 42vw; }
  .scoreboard li:nth-child(n + 4):not(.me) { display: none; }
  .killfeed { display: none; }
  .timer { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.roster li.me { background: #3b2f86; outline: 2px solid #fff6; }
.hitmarker { position: fixed; width: 30px; height: 30px; translate: -50% -50%; opacity: 0; pointer-events: none; background: conic-gradient(from 45deg, #fff 0 6deg, transparent 6deg 90deg, #fff 90deg 96deg, transparent 96deg 180deg, #fff 180deg 186deg, transparent 186deg 270deg, #fff 270deg 276deg, transparent 276deg); -webkit-mask: radial-gradient(circle, transparent 5px, #000 6px, #000 14px, transparent 15px); mask: radial-gradient(circle, transparent 5px, #000 6px, #000 14px, transparent 15px); filter: drop-shadow(0 0 2px #000); }
.hitmarker.on { animation: hitmark .28s ease-out; }
@keyframes hitmark { 0% { opacity: 1; transform: scale(1.4); } 100% { opacity: 0; transform: scale(1); } }
.credit-name { margin: 18px 0 6px; font: 900 2.6rem/1 var(--heading); text-transform: uppercase; color: var(--orange); text-shadow: 0 4px 0 #0b0820; }
