@font-face {
  font-family: "VT323";
  src: url("/VT323-latin.woff2") format("woff2");
}
@font-face {
  font-family: "PressStart2P";
  src: url("/PressStart2P-latin.woff2") format("woff2");
}

:root {
  --cyan: #00f0ff;
  --pink: #ff2a6d;
  --purple: #b388ff;
  --green: #7af7a7;
  --bg: #070a14;
  --panel: rgba(13, 18, 36, 0.92);
  --line: rgba(0, 240, 255, 0.25);
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: "VT323", monospace;
  color: #d6f4ff;
  -webkit-user-select: none; user-select: none;
  touch-action: none;
}

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }

/* ===== screens ===== */
.screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, rgba(0,240,255,0.07), transparent 60%), rgba(4, 6, 14, 0.78);
  z-index: 20;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.12), 0 12px 60px rgba(0,0,0,0.6);
  padding: 28px 32px;
  width: min(420px, 92vw);
  text-align: center;
  display: flex; flex-direction: column; gap: 12px;
  max-height: 92vh;
}
.panel.wide { width: min(560px, 94vw); }

.logo {
  font-family: "PressStart2P", monospace;
  font-size: 22px;
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(0, 240, 255, 0.6);
  letter-spacing: 1px;
}
.logo span { color: var(--pink); text-shadow: 0 0 18px rgba(255, 42, 109, 0.7); }
.tagline { font-size: 18px; color: #8fb8cc; }

.field { display: flex; flex-direction: column; gap: 4px; text-align: left; font-size: 18px; color: #8fb8cc; }
.field input {
  font-family: "VT323", monospace;
  font-size: 24px;
  padding: 8px 12px;
  background: rgba(0, 12, 24, 0.8);
  color: var(--cyan);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}
.field input:focus { border-color: var(--cyan); box-shadow: 0 0 12px rgba(0,240,255,0.3); }

.profile-line { font-size: 18px; color: var(--purple); min-height: 20px; }

button {
  font-family: "VT323", monospace;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 20, 40, 0.7);
  color: #d6f4ff;
}
button:active { transform: translateY(1px); }

.big { font-size: 24px; padding: 12px 16px; }
.big.primary {
  background: linear-gradient(180deg, rgba(0,240,255,0.25), rgba(0,240,255,0.08));
  border-color: var(--cyan); color: var(--cyan);
  text-shadow: 0 0 10px rgba(0,240,255,0.5);
}
.big.ranked {
  background: linear-gradient(180deg, rgba(255,42,109,0.25), rgba(255,42,109,0.08));
  border-color: var(--pink); color: #ffb3cb;
}
.big.ghost { background: transparent; color: #8fb8cc; }

.hint { font-size: 16px; color: #5d7d93; line-height: 1.35; }
.legal { font-size: 15px; }
.legal a { color: #5d7d93; }

.spinner {
  width: 42px; height: 42px; margin: 8px auto;
  border: 3px solid rgba(0,240,255,0.15);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#lb-table-wrap { max-height: 50vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
#lb-table { width: 100%; border-collapse: collapse; font-size: 20px; }
#lb-table th, #lb-table td { padding: 6px 10px; text-align: left; }
#lb-table th { position: sticky; top: 0; background: #0d1224; color: var(--cyan); font-weight: normal; }
#lb-table tr:nth-child(odd) td { background: rgba(0, 240, 255, 0.04); }
#lb-table td.me { color: var(--green); }

.rating-delta { font-family: "PressStart2P", monospace; font-size: 18px; padding: 8px; }
.rating-delta.up { color: var(--green); text-shadow: 0 0 12px rgba(122,247,167,0.5); }
.rating-delta.down { color: var(--pink); }

/* ===== HUD ===== */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud button { pointer-events: auto; }

#players-bar {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px;
}
.pcard {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 5px 10px;
  min-width: 118px;
  font-size: 17px;
}
.pcard.turn { border-color: var(--cyan); box-shadow: 0 0 14px rgba(0,240,255,0.35); }
.pcard.dead { opacity: 0.4; filter: grayscale(0.8); }
.pcard .pname { display: flex; justify-content: space-between; gap: 6px; white-space: nowrap; }
.pcard .prating { color: #8fb8cc; font-size: 14px; }
.pcard .hpbar { height: 6px; background: rgba(255,255,255,0.12); border-radius: 3px; margin-top: 3px; overflow: hidden; }
.pcard .hpfill { height: 100%; border-radius: 3px; transition: width 0.25s; }
.pcard .pstatus { font-size: 13px; color: #8fb8cc; min-height: 14px; }

#top-center {
  position: absolute; top: 64px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 10px; align-items: center;
}
#wind-box {
  display: flex; align-items: center; gap: 5px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 10px; font-size: 19px;
}
#wind-arrow { transition: transform 0.4s; }
#turn-box {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 12px; font-size: 19px;
  display: flex; gap: 10px;
}
#turn-timer { color: var(--pink); }

#aim-readout {
  position: absolute; left: 12px; bottom: 110px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px;
  font-size: 18px; color: #8fb8cc;
  display: flex; flex-direction: column; gap: 2px;
}
#aim-readout b { color: var(--cyan); float: right; margin-left: 10px; }

#bottom-bar {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  display: flex; align-items: flex-end; gap: 14px;
}
#weapons { display: flex; gap: 6px; }
.wpn-btn {
  font-size: 18px; padding: 8px 10px; min-width: 84px;
  border-radius: 8px;
}
.wpn-btn.sel { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 12px rgba(0,240,255,0.3); }
.wpn-btn.noammo { opacity: 0.35; }

#fire-wrap { display: flex; flex-direction: column; gap: 4px; align-items: center; }
#charge-bar {
  width: 130px; height: 10px;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--line); border-radius: 5px; overflow: hidden;
}
#charge-fill {
  width: 0%; height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--pink));
}
#btn-fire {
  font-size: 26px; padding: 10px 26px;
  border-color: var(--pink); color: #ffb3cb;
  background: linear-gradient(180deg, rgba(255,42,109,0.3), rgba(255,42,109,0.1));
  border-radius: 10px;
  display: flex; flex-direction: column; line-height: 1;
}
#btn-fire small { font-size: 12px; color: #b06; }
#btn-fire:disabled { opacity: 0.35; cursor: default; }

#utility { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
#coins-box { font-size: 19px; color: gold; }
#shop { display: flex; gap: 4px; flex-wrap: wrap; max-width: 240px; }
.shop-btn { font-size: 14px; padding: 4px 6px; border-radius: 6px; }
.shop-btn:disabled { opacity: 0.35; cursor: default; }
.util-btn { font-size: 16px; padding: 5px 8px; border-radius: 6px; }
.util-btn.armed { border-color: var(--green); color: var(--green); box-shadow: 0 0 10px rgba(122,247,167,0.4); }

#aim-pad {
  position: absolute; right: 12px; bottom: 110px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.pad-btn { font-size: 22px; width: 48px; height: 48px; border-radius: 8px; }

#help-line {
  position: absolute; bottom: 0; left: 0; right: 0;
  text-align: center; font-size: 14px; color: rgba(143, 184, 204, 0.55);
  padding: 2px;
}

#banner {
  position: absolute; top: 32%; left: 50%; transform: translate(-50%, -50%);
  font-family: "PressStart2P", monospace;
  font-size: 22px; color: var(--cyan);
  text-shadow: 0 0 24px rgba(0,240,255,0.8);
  background: rgba(4,6,14,0.6); border-radius: 12px; padding: 14px 22px;
  pointer-events: none;
}

@media (max-width: 720px) {
  #aim-readout { bottom: 170px; left: 8px; transform: scale(0.85); transform-origin: bottom left; }
  #aim-pad { bottom: 170px; }
  #players-bar { flex-wrap: wrap; max-width: 96vw; }
  #bottom-bar { flex-direction: column; align-items: center; gap: 8px; width: 96vw; }
  #utility { flex-direction: row; align-items: center; }
  #help-line { display: none; }
}
