/* Disco Overflow: neon UI over a bloomed WebGL floor. */

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

:root {
  --pink: #ff2fa0;
  --cyan: #2fffd7;
  --gold: #ffe020;
  --purple: #b44bff;
  --bg: #05050a;
  --panel: rgba(10, 10, 22, 0.92);
}

html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: #eee;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
}

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

.screen {
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  overflow-y: auto;
  background: radial-gradient(circle at 50% 20%, rgba(180, 75, 255, 0.18), transparent 60%), rgba(3, 3, 10, 0.82);
}
.screen.active { display: flex; }
.screen.transparent { background: none; pointer-events: none; display: none; }
.screen.transparent.active { display: block; }

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 47, 160, 0.45);
  box-shadow: 0 0 40px rgba(255, 47, 160, 0.25), inset 0 0 60px rgba(47, 255, 215, 0.05);
  border-radius: 14px;
  padding: 28px 32px;
  width: min(480px, 92vw);
  max-height: 92vh;
  overflow-y: auto;
  margin: 20px;
}

.title {
  font-size: 2.6rem;
  line-height: 1.05;
  text-align: center;
  background: linear-gradient(90deg, var(--pink), var(--gold), var(--cyan), var(--purple), var(--pink));
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 4s linear infinite;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.title.small { font-size: 1.8rem; }
@keyframes shimmer { to { background-position: 300% 0; } }

.tagline { text-align: center; color: #9aa; margin-bottom: 20px; font-size: 0.9rem; }

.field { margin: 14px 0; }
.field label { display: block; font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--cyan); margin-bottom: 6px; }
.row { display: flex; gap: 8px; }
.row.center { justify-content: center; }

input, select {
  background: #0c0c18;
  border: 1px solid rgba(47, 255, 215, 0.35);
  color: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 1rem;
  width: 100%;
  outline: none;
}
input:focus, select:focus { border-color: var(--pink); box-shadow: 0 0 12px rgba(255, 47, 160, 0.4); }
.code-input { width: 110px; text-transform: uppercase; letter-spacing: 0.3em; text-align: center; font-weight: bold; }

.btn {
  background: #14142a;
  color: #fff;
  border: 1px solid rgba(255, 47, 160, 0.6);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { box-shadow: 0 0 16px rgba(255, 47, 160, 0.6); transform: translateY(-1px); }
.btn:disabled { opacity: 0.4; cursor: default; box-shadow: none; transform: none; }
.btn.primary { background: linear-gradient(90deg, #ff2fa0, #b44bff); border: none; font-weight: bold; }
.btn.small { padding: 6px 12px; font-size: 0.85rem; }

.dim { color: #778; font-size: 0.85rem; margin: 6px 0; }
.code { font-family: monospace; font-weight: bold; color: var(--gold); letter-spacing: 0.2em; }
.code.big { font-size: 1.6rem; text-shadow: 0 0 14px rgba(255, 224, 32, 0.7); }

.room-list { max-height: 170px; overflow-y: auto; }
.room-row {
  display: grid; grid-template-columns: 60px 1fr auto 46px;
  gap: 8px; align-items: center;
  padding: 8px 10px; margin: 4px 0;
  background: #0c0c18; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent;
  font-size: 0.88rem;
}
.room-row:hover { border-color: var(--cyan); }
.room-row.live { border-color: rgba(255, 47, 160, 0.35); }
.room-row .dim { margin: 0; }
.live-tag { color: var(--pink); font-size: 0.74rem; font-weight: bold; white-space: nowrap; }

.leaderboard { margin-top: 18px; }
.leaderboard h3 { color: var(--gold); margin-bottom: 8px; }
.leaderboard table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.leaderboard th { color: var(--cyan); text-align: left; padding: 4px 6px; font-weight: normal; }
.leaderboard td { padding: 4px 6px; border-top: 1px solid #1a1a30; }

.lobby-players { margin: 16px 0; }
.player-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px;
  padding: 10px 12px; margin: 6px 0;
  background: #0c0c18; border-radius: 8px;
}
.ready { color: var(--cyan); font-weight: bold; }

/* HUD */
.hud-top {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 12px 16px; pointer-events: none;
}
.hud-top .btn { pointer-events: auto; }
#hud-players { display: flex; flex-direction: column; gap: 6px; min-width: 220px; max-height: 60vh; overflow: hidden; }
.hud-name { font-size: 0.78rem; font-weight: bold; text-shadow: 0 0 8px rgba(0, 0, 0, 0.9); }
.hud-player .hud-hp { height: 10px; background: #1a1a30; border-radius: 5px; overflow: hidden; }
.hud-player .hud-hp-fill { height: 100%; background: linear-gradient(90deg, var(--pink), var(--gold)); transition: width 0.2s; }
.hud-player.mine .hud-hp-fill { background: linear-gradient(90deg, var(--cyan), #35ff6a); }
.hud-tags { display: flex; gap: 8px; font-size: 0.78rem; margin-top: 2px; }
.dmgx { color: var(--gold); font-weight: bold; }
.combo { color: var(--purple); }
.fever { color: var(--pink); font-weight: bold; animation: blink 0.4s steps(2) infinite; }
.down { color: #ff5555; font-weight: bold; }
.coins { color: var(--gold); }
.dash-ready { color: var(--cyan); font-weight: bold; }
@keyframes blink { 50% { opacity: 0.2; } }

.hud-center { text-align: center; text-shadow: 0 0 10px rgba(0, 0, 0, 0.9); }
#hud-time { font-size: 1.7rem; font-weight: bold; color: #fff; }
#hud-level { color: var(--cyan); font-weight: bold; }
#hud-kills { color: #9aa; font-size: 0.85rem; }

.hud-xp { position: fixed; bottom: 0; left: 0; right: 0; height: 12px; background: rgba(20, 20, 40, 0.8); }
#hud-xp-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--purple), var(--pink)); box-shadow: 0 0 14px var(--purple); transition: width 0.25s; }
#hud-xp-label {
  position: absolute; inset: 0;
  text-align: center; font-size: 0.66rem; line-height: 12px;
  color: #cdd; text-shadow: 0 0 6px #000; letter-spacing: 0.08em;
}

.hud-hint {
  position: fixed; bottom: 18px; left: 0; right: 0;
  text-align: center; font-size: 0.72rem; color: #667;
  letter-spacing: 0.08em; pointer-events: none;
  text-shadow: 0 0 8px #000;
}

/* Chat: log floats bottom-left, the input slides in on T */
#chat { position: fixed; left: 16px; bottom: 34px; width: min(420px, 46vw); pointer-events: none; }
#chat-log { display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px; }
#chat-log.pinned .chat-line { opacity: 1 !important; }
.chat-line {
  font-size: 0.82rem; color: #dde;
  background: rgba(6, 6, 16, 0.55); border-left: 2px solid rgba(255, 47, 160, 0.5);
  padding: 3px 8px; border-radius: 0 6px 6px 0;
  text-shadow: 0 0 6px #000;
  transition: opacity 1.2s;
  overflow-wrap: anywhere;
}
.chat-line.system { border-left-color: rgba(47, 255, 215, 0.5); }
.chat-line.faded { opacity: 0; }
.chat-who { font-weight: bold; margin-right: 6px; }
.chat-sys { color: var(--cyan); font-style: italic; }

#chat-box { display: none; align-items: center; gap: 8px; pointer-events: auto; }
#chat-box.open { display: flex; }
.chat-prompt { color: var(--pink); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.16em; }
#chat-input { padding: 7px 10px; font-size: 0.9rem; background: rgba(8, 8, 20, 0.95); }

/* Overlays */
.overlay {
  position: fixed; inset: 0; display: none;
  align-items: center; justify-content: center;
  background: rgba(3, 3, 10, 0.78);
  backdrop-filter: blur(3px);
  z-index: 10;
}
.overlay.active { display: flex; }
.ov-inner { text-align: center; width: min(880px, 94vw); padding: 20px; }

.cards { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin: 22px 0; }
.card {
  width: 190px; min-height: 150px;
  background: var(--panel);
  border: 2px solid #333;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.card:hover { transform: translateY(-6px) scale(1.03); }
.card.locked { pointer-events: none; opacity: 0.45; }
.card.picked { opacity: 1; transform: scale(1.06); box-shadow: 0 0 30px rgba(255, 255, 255, 0.4); }
.card-tier { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.15em; margin-bottom: 6px; }
.card-name { font-weight: bold; font-size: 1.05rem; margin-bottom: 8px; }
.card-desc { font-size: 0.82rem; color: #aab; }
.tier-common   { border-color: #4a5a6a; } .tier-common .card-tier { color: #8aa; }
.tier-uncommon { border-color: var(--cyan); box-shadow: 0 0 12px rgba(47, 255, 215, 0.25); } .tier-uncommon .card-tier { color: var(--cyan); }
.tier-rare     { border-color: var(--purple); box-shadow: 0 0 16px rgba(180, 75, 255, 0.35); } .tier-rare .card-tier { color: var(--purple); }
.tier-engine   { border-color: var(--gold); box-shadow: 0 0 20px rgba(255, 224, 32, 0.4); } .tier-engine .card-tier { color: var(--gold); }
.tier-exotic   { border-color: var(--pink); box-shadow: 0 0 24px rgba(255, 47, 160, 0.5); animation: exotic-glow 1.2s ease-in-out infinite alternate; } .tier-exotic .card-tier { color: var(--pink); }
.tier-weapon   { border-color: #fff; } .tier-weapon .card-tier { color: #fff; }
@keyframes exotic-glow { to { box-shadow: 0 0 40px rgba(255, 47, 160, 0.9); } }

.over-score {
  font-size: 3.2rem; font-weight: bold; margin: 10px 0;
  color: var(--gold); text-shadow: 0 0 30px rgba(255, 224, 32, 0.8);
}
.over-top { margin: 18px auto; max-width: 380px; text-align: left; }
.top-row { padding: 4px 0; border-bottom: 1px solid #1a1a30; font-size: 0.88rem; }

#toasts { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 20; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--panel);
  border: 1px solid var(--cyan);
  border-radius: 8px;
  padding: 10px 18px;
  animation: toast-in 0.25s ease-out;
  box-shadow: 0 0 18px rgba(47, 255, 215, 0.35);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
