/* ═════════════════ ECHOVOID — Abyssal Theme ═════════════════ */
:root {
  --bg: #03060c;
  --card: #0a1220;
  --border: #1a2942;
  --text: #dce6f2;
  --muted: #6b7a93;
  --sonar: #35e0ff;
  --shard: #ffc857;
  --danger: #ff3d5e;
}

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

html, body {
  height: 100%; overflow: hidden;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--text);
}

.screen { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; }
.screen.active { display: flex; }

/* ─────────── Lobby ─────────── */
.lobby-card {
  position: relative; width: min(440px, 94vw);
  max-height: 94vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 18px; padding: 30px 26px;
  animation: rise .5s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

.pulse-ring {
  position: absolute; top: 34px; left: 50%;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--sonar); transform: translateX(-50%);
  animation: sonarPulse 2.4s ease-out infinite;
}
@keyframes sonarPulse {
  0%   { box-shadow: 0 0 0 0 rgba(53,224,255,.5); }
  100% { box-shadow: 0 0 0 90px rgba(53,224,255,0); }
}

.logo {
  margin-top: 14px; text-align: center;
  font-size: 2.6rem; font-weight: 900; letter-spacing: 6px;
  color: var(--text);
  text-shadow: 0 0 24px rgba(53,224,255,.55);
}
.logo span { color: var(--sonar); }
.tagline {
  text-align: center; color: var(--muted);
  font-size: .8rem; line-height: 1.5; margin: 10px 0 20px; font-style: italic;
}

.profile-box {
  display: flex; gap: 12px; align-items: center;
  background: #060b15; border: 1px solid var(--border);
  border-radius: 12px; padding: 12px;
}
.avatar {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800;
  background: radial-gradient(circle at 35% 35%, #35e0ff, #0b3947);
  color: #031018; flex-shrink: 0;
  box-shadow: 0 0 18px rgba(53,224,255,.35);
}
#player-name {
  width: 100%; background: transparent; border: none; outline: none;
  border-bottom: 1px dashed var(--border);
  color: var(--text); font-size: 1rem; font-weight: 600; padding: 2px 0;
}
#auth-status { color: var(--muted); font-size: .7rem; }

.lobby-actions { margin-top: 16px; display: grid; gap: 10px; }
.btn {
  border: none; border-radius: 10px; padding: 13px 16px;
  font-size: .95rem; font-weight: 700; cursor: pointer;
  transition: transform .12s, box-shadow .12s, opacity .12s;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:not(:disabled):hover { transform: translateY(-2px); }
.btn-primary {
  background: linear-gradient(90deg, #0e7d94, #35e0ff);
  color: #02131a; box-shadow: 0 4px 24px rgba(53,224,255,.35);
}
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }

.room-row { display: flex; gap: 10px; }
#room-code {
  flex: 1; text-transform: uppercase; letter-spacing: 5px; text-align: center;
  background: #060b15; border: 1px solid var(--border); border-radius: 10px;
  color: var(--sonar); font-weight: 800; padding: 12px; outline: none;
}
#room-code:focus { border-color: var(--sonar); box-shadow: 0 0 14px rgba(53,224,255,.25); }

.howto {
  margin-top: 16px; background: #060b15; border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px; font-size: .78rem; color: var(--muted);
}
.howto summary { cursor: pointer; color: var(--sonar); font-weight: 700; letter-spacing: 1px; }
.howto ul { margin: 10px 0 4px 16px; display: grid; gap: 6px; line-height: 1.45; }
.howto b { color: var(--text); }

.stats-box { margin-top: 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats-box > div { background: #060b15; border-radius: 10px; padding: 10px 6px; text-align: center; }
.stats-box span { font-size: 1.25rem; font-weight: 800; color: var(--sonar); display: block; }
.stats-box label { font-size: .6rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

.leaderboard { margin-top: 16px; }
.leaderboard h3 { font-size: .75rem; color: var(--shard); letter-spacing: 2px; margin-bottom: 8px; }
.leaderboard ol { list-style: none; display: grid; gap: 4px; }
.leaderboard li {
  display: flex; justify-content: space-between; font-size: .8rem;
  background: #060b15; border-radius: 8px; padding: 6px 10px;
}
.leaderboard li b { color: var(--sonar); }
.leaderboard .empty { color: var(--muted); font-size: .72rem; text-align: center; padding: 8px; justify-content: center; }

/* ─────────── Jogo ─────────── */
#screen-game { background: var(--bg); }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }

#vignette {
  position: absolute; inset: 0; pointer-events: none; z-index: 5;
  box-shadow: inset 0 0 180px 60px rgba(255, 61, 94, 0);
  transition: box-shadow .25s;
}
#vignette.danger { box-shadow: inset 0 0 180px 60px rgba(255, 61, 94, .5); }

.hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 6;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; pointer-events: none; font-size: .78rem;
  text-shadow: 0 1px 6px #000;
}
.hud b { color: var(--sonar); }
.hud-left, .hud-right { display: flex; gap: 14px; align-items: center; }
.hud-room { letter-spacing: 2px; }
.icon-btn {
  pointer-events: auto; background: #0a1220cc; border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 4px 8px; cursor: pointer;
}
.hud-shards { color: var(--shard); font-weight: 700; }
.hud-gate {
  color: var(--shard); font-weight: 800; letter-spacing: 1px;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: .35; } }
.hidden { display: none !important; }

.hud-bottom {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  z-index: 6; pointer-events: none; width: min(280px, 70vw);
}
.noise-bar {
  height: 14px; background: #060b15cc; border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden; position: relative;
}
#noise-fill {
  height: 100%; width: 60%;
  background: linear-gradient(90deg, #1d9db8, #35e0ff);
  transition: width .15s linear;
}
#noise-fill.loud { background: linear-gradient(90deg, #b8405a, var(--danger)); }
.noise-bar label {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: .55rem; letter-spacing: 3px; color: #cfeaf5; text-shadow: 0 1px 3px #000;
}

.hud-lb {
  position: absolute; top: 56px; right: 16px; z-index: 6;
  background: #060b15b0; backdrop-filter: blur(4px);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; min-width: 140px; pointer-events: none;
}
.hud-lb h4 { font-size: .58rem; letter-spacing: 2px; color: var(--shard); margin-bottom: 5px; }
.hud-lb ol { list-style: none; display: grid; gap: 3px; }
.hud-lb li { display: flex; justify-content: space-between; font-size: .7rem; gap: 10px; }
.hud-lb li b { color: var(--sonar); }
.hud-lb li.me { color: var(--shard); font-weight: 700; }

.modal {
  position: absolute; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background: rgba(2, 4, 9, .88); backdrop-filter: blur(5px);
}
.modal.hidden { display: none; }
.modal-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 34px 42px; text-align: center; display: grid; gap: 12px;
  box-shadow: 0 0 80px rgba(53,224,255,.18);
  animation: rise .35s ease;
}
#ro-title { font-size: 1.7rem; color: var(--sonar); text-shadow: 0 0 20px rgba(53,224,255,.5); }
#ro-winner { font-size: 1.05rem; }
#ro-me { color: var(--muted); }

@media (max-width: 480px) {
  .logo { font-size: 2rem; }
  .lobby-card { padding: 20px; }
  .hud-lb { display: none; }
}
