* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #070b14;
  --panel: rgba(13, 20, 38, 0.92);
  --neon: #00e5ff;
  --neon2: #ff3df0;
  --text: #dce6ff;
}
html, body { height: 100%; overflow: hidden; background: var(--bg); }
body {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
#game { display: block; width: 100vw; height: 100vh; }

.hidden { display: none !important; }

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 35%, rgba(0,40,80,0.55), rgba(3,6,14,0.92));
  backdrop-filter: blur(4px); z-index: 20;
}
.panel {
  background: var(--panel); border: 1px solid rgba(0,229,255,0.35);
  border-radius: 18px; padding: 34px 38px; text-align: center; max-width: 440px; width: 90%;
  box-shadow: 0 0 40px rgba(0,229,255,0.18), inset 0 0 30px rgba(0,229,255,0.05);
}
.panel h1 {
  font-size: 40px; letter-spacing: 2px; line-height: 1.05; margin-bottom: 6px;
  color: #fff; text-shadow: 0 0 16px var(--neon);
}
.panel h1 span { display: block; font-size: 22px; color: var(--neon2); text-shadow: 0 0 14px var(--neon2); }
.panel h2 { font-size: 30px; color: #fff; text-shadow: 0 0 14px var(--neon2); margin-bottom: 10px; }
.tag { color: #8fb6d8; font-size: 12.5px; margin-bottom: 22px; }
.panel p { margin-bottom: 8px; font-size: 14px; }
#name {
  width: 100%; padding: 13px 16px; font-size: 17px; font-family: inherit; text-align: center;
  background: #0a1124; border: 1px solid rgba(0,229,255,0.4); border-radius: 10px; color: #fff;
  margin-bottom: 14px; outline: none;
}
#name:focus { border-color: var(--neon); box-shadow: 0 0 14px rgba(0,229,255,0.4); }
button {
  cursor: pointer; font-family: inherit; font-weight: 700; letter-spacing: 1px;
  background: linear-gradient(135deg, var(--neon), #0090ff); color: #021018;
  border: none; border-radius: 10px; padding: 13px 26px; font-size: 16px;
  transition: transform .08s, box-shadow .2s; box-shadow: 0 0 18px rgba(0,229,255,0.4);
}
button:hover { box-shadow: 0 0 26px rgba(0,229,255,0.7); }
button:active { transform: scale(0.96); }
.how { margin-top: 20px; font-size: 11.5px; line-height: 1.7; color: #7fa6c8; }
.conn { margin-top: 14px; font-size: 11px; color: #5a7; }
.respawn-hint { color: #8fb6d8; font-size: 13px; }
#respawn-btn { margin-top: 14px; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#leaderboard {
  position: absolute; top: 14px; right: 14px; min-width: 168px;
  background: var(--panel); border: 1px solid rgba(0,229,255,0.25);
  border-radius: 12px; padding: 10px 14px; font-size: 13px;
}
.lb-title { color: var(--neon); margin-bottom: 6px; font-size: 12px; letter-spacing: 1px; }
#lb-list { list-style: none; }
#lb-list li { display: flex; align-items: center; gap: 7px; padding: 2px 0; white-space: nowrap; }
#lb-list .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
#lb-list .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; }
#lb-list .sc { color: #fff; font-weight: 700; }
#lb-list li.me .nm { color: var(--neon); font-weight: 700; }

#status { position: absolute; top: 14px; left: 14px; }
#score { font-size: 42px; font-weight: 800; color: #fff; text-shadow: 0 0 16px var(--neon); line-height: 1; }
.score-label { font-size: 11px; color: #7fa6c8; letter-spacing: 1px; }
#players-online { margin-top: 8px; font-size: 12px; color: #6f96b8; }

/* ---------- touch dpad ---------- */
#dpad {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 15; display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.dpad-mid { display: flex; gap: 56px; }
#dpad button {
  width: 62px; height: 62px; border-radius: 14px; font-size: 22px; padding: 0;
  background: rgba(0,229,255,0.16); color: var(--neon); border: 1px solid rgba(0,229,255,0.4);
  box-shadow: none;
}
@media (hover: none) and (pointer: coarse) { #leaderboard { font-size: 11px; min-width: 140px; } }
