/* ════════════════════════════════════════════════════════
   style.css — Snixo UI styles
   Dark neon theme; everything is positioned over the canvas.
   ════════════════════════════════════════════════════════ */

/* ── Reset & base ───────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #080818;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #fff;
  -webkit-font-smoothing: antialiased;
}

/* ── Full-screen canvas ─────────────────────────────────── */
#game-canvas {
  position: fixed;
  inset: 0;
  display: block;
  cursor: crosshair;
  touch-action: none; /* prevent scroll/zoom interference */
}

/* ── Overlay base (start + death screens) ────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 8, 24, 0.88);
  backdrop-filter: blur(6px);
}

.overlay[hidden] { display: none; }

.overlay-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 44px 52px;
  background: rgba(15, 15, 40, 0.95);
  border: 1px solid rgba(120, 80, 255, 0.35);
  border-radius: 20px;
  box-shadow: 0 0 60px rgba(100, 60, 255, 0.25), 0 0 120px rgba(80, 40, 200, 0.12);
  max-width: 420px;
  width: 90%;
}

/* ── Logo ────────────────────────────────────────────────── */
.logo {
  font-size: 3.6rem;
  font-weight: 900;
  letter-spacing: 6px;
  background: linear-gradient(135deg, #a78bfa 0%, #60a5fa 50%, #34d399 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 0 20px rgba(167, 139, 250, 0.5));
}

.tagline {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: -8px;
}

/* ── Input field ─────────────────────────────────────────── */
#name-input {
  width: 100%;
  padding: 12px 18px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: #fff;
  outline: none;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#name-input::placeholder { color: rgba(255,255,255,0.3); }

#name-input:focus {
  border-color: rgba(167, 139, 250, 0.7);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.15);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary {
  width: 100%;
  padding: 13px 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 2px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  color: #fff;
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
}

.btn-primary:hover {
  opacity: 0.9;
  box-shadow: 0 6px 28px rgba(124, 58, 237, 0.6);
}
.btn-primary:active { transform: scale(0.97); }

/* ── Controls hint ───────────────────────────────────────── */
.controls-hint {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.3);
  text-align: center;
  line-height: 1.7;
}

/* ── Death screen specific ───────────────────────────────── */
.death-title {
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: #ff6b6b;
  text-shadow: 0 0 30px rgba(255, 107, 107, 0.6);
}

.death-info {
  color: rgba(255,255,255,0.55);
  font-size: 0.95rem;
}
.death-info strong { color: #fff; }

.score-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.score-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.4);
}

.score-value, #current-score {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ══════════════════════════════════════════════════════════
   HUD — layered on top of the canvas while playing
   ══════════════════════════════════════════════════════════ */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
#hud[hidden] { display: none; }

/* ── Leaderboard (top-left) ──────────────────────────────── */
#leaderboard {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 200px;
  background: rgba(10, 10, 28, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 12px 12px;
  backdrop-filter: blur(4px);
}

.lb-header {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

#lb-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

#lb-list li {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.15s;
}

#lb-list li.me {
  background: rgba(255,255,255,0.07);
  font-weight: 700;
}

.lb-rank {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.3);
  width: 14px;
  text-align: right;
  flex-shrink: 0;
}

.lb-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.lb-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255,255,255,0.85);
}

.lb-score {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.45);
  flex-shrink: 0;
}

/* ── Score box (top-right) ───────────────────────────────── */
#score-box {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  background: rgba(10, 10, 28, 0.78);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 10px 16px;
  backdrop-filter: blur(4px);
}

#score-box .score-label {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.35);
}

#current-score {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}

/* ── Name-taken error on start screen ────────────────────── */
.name-error {
  font-size: 0.8rem;
  color: #ff6b6b;
  text-align: center;
  margin-top: -6px;
  animation: fadeIn 0.2s ease;
}
.name-error[hidden] { display: none; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; } }

/* ── Ping pill (bottom-left) ─────────────────────────────── */
#ping-pill {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 9px;
  background: rgba(10, 10, 28, 0.78);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  backdrop-filter: blur(4px);
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
  font-variant-numeric: tabular-nums;
  transition: border-color 0.3s;
}

#ping-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #444;
  flex-shrink: 0;
  transition: background 0.4s, box-shadow 0.4s;
}

#ping-pill.ping-good   { border-color: rgba(74,222,128,0.25); }
#ping-pill.ping-ok     { border-color: rgba(250,204,21,0.25); }
#ping-pill.ping-bad    { border-color: rgba(249,115,22,0.25); }
#ping-pill.ping-terrible { border-color: rgba(239,68,68,0.3); }

#ping-pill.ping-good   #ping-dot { background:#4ade80; box-shadow:0 0 7px #4ade80; }
#ping-pill.ping-ok     #ping-dot { background:#facc15; box-shadow:0 0 7px #facc15; }
#ping-pill.ping-bad    #ping-dot { background:#f97316; box-shadow:0 0 7px #f97316; }
#ping-pill.ping-terrible #ping-dot { background:#ef4444; box-shadow:0 0 7px #ef4444; }

/* ── Minimap (bottom-right) ──────────────────────────────── */
#minimap-wrap {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: rgba(10, 10, 28, 0.78);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 6px;
  backdrop-filter: blur(4px);
  line-height: 0;
}

#minimap {
  display: block;
  border-radius: 6px;
}

/* ── Boost hint (bottom-center, fades automatically) ─────── */
#boost-hint {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.78rem;
  color: rgba(255,255,255,0.35);
  white-space: nowrap;
  transition: opacity 1s;
}

#boost-hint.hidden { opacity: 0; }

kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 0.72rem;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  background: rgba(255,255,255,0.07);
}

/* ── Responsive tweaks ───────────────────────────────────── */
@media (max-width: 600px) {
  .overlay-box { padding: 32px 24px; }
  .logo { font-size: 2.8rem; }
  #leaderboard { width: 160px; }
  #minimap-wrap canvas { width: 110px; height: 110px; }
}
