/* ============================================================
   TYPING MANIAC — Cyberpunk dark arcade theme
   ============================================================ */

:root {
  --bg: #0d0d12;
  --bg-panel: #12121a;
  --neon-cyan: #00f0ff;
  --neon-magenta: #ff2d78;
  --danger-red: #ff3b3b;
  --ice-blue: #4dc9ff;
  --fire-orange: #ff7a1a;
  --spell-green: #39ff88;
  --text-dim: #8a8fa3;
  --text-bright: #e8ecf5;
  --font-display: 'Orbitron', 'Segoe UI', sans-serif;
  --font-mono: 'Share Tech Mono', 'Consolas', monospace;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text-bright);
  font-family: var(--font-mono);
  overflow: hidden;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(0, 240, 255, 0.06), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(255, 45, 120, 0.06), transparent 50%),
    var(--bg);
}

/* ============ Container & scanlines ============ */

#game-container {
  position: relative;
  width: 840px;
  max-width: 98vw;
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: 10px;
  background: var(--bg-panel);
  box-shadow:
    0 0 25px rgba(0, 240, 255, 0.12),
    inset 0 0 60px rgba(0, 0, 0, 0.6);
  padding: 12px 16px 16px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

/* subtle CRT scanlines */
#game-container::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 10px;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0, 0, 0, 0.10) 3px,
    rgba(0, 0, 0, 0.10) 4px
  );
  z-index: 5;
}

/* FREEZE active: icy tint on the whole cabinet */
#game-container.frozen {
  border-color: var(--ice-blue);
  box-shadow:
    0 0 45px rgba(77, 201, 255, 0.45),
    inset 0 0 80px rgba(77, 201, 255, 0.10);
  animation: freeze-pulse 1s ease-in-out infinite alternate;
}

@keyframes freeze-pulse {
  from { box-shadow: 0 0 30px rgba(77, 201, 255, 0.35), inset 0 0 60px rgba(77, 201, 255, 0.08); }
  to   { box-shadow: 0 0 55px rgba(77, 201, 255, 0.55), inset 0 0 90px rgba(77, 201, 255, 0.14); }
}

/* ============ HUD ============ */

#hud {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 6px 8px 12px;
  font-family: var(--font-display);
}

.hud-item {
  display: flex;
  flex-direction: column;
  min-width: 90px;
}

.hud-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.hud-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 3px currentColor);
}

.icon-score { color: var(--neon-cyan); }
.icon-high  { color: var(--neon-magenta); }
.icon-level { color: var(--fire-orange); }
.icon-combo { color: #7dff6a; }

.hud-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.7);
}

.hud-high  { color: var(--neon-magenta); text-shadow: 0 0 8px rgba(255, 45, 120, 0.7); }
.hud-level { color: var(--fire-orange);  text-shadow: 0 0 8px rgba(255, 122, 26, 0.7); }
.hud-combo { color: #7dff6a;             text-shadow: 0 0 8px rgba(125, 255, 106, 0.7); }

.combo-mult {
  font-size: 12px;
  margin-left: 4px;
  vertical-align: super;
  color: var(--text-bright);
}

#mute-btn {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(0, 240, 255, 0.4);
  background: transparent;
  color: var(--neon-cyan);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

#mute-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  margin: auto;
  filter: drop-shadow(0 0 3px currentColor);
}

#mute-btn .snd-off { display: none; }
#mute-btn:hover { box-shadow: 0 0 10px rgba(0, 240, 255, 0.5); }
#mute-btn.muted { color: var(--text-dim); border-color: rgba(138, 143, 163, 0.4); }
#mute-btn.muted .snd-wave { display: none; }
#mute-btn.muted .snd-off { display: block; }

/* ============ Playfield & canvas ============ */

#playfield {
  position: relative;
  width: 100%;
}

#game-canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 6px;
  background: #0a0a10;
}

/* ============ Overlay screens ============ */

.screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  border-radius: 6px;
  background: rgba(10, 10, 16, 0.92);
  backdrop-filter: blur(2px);
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.screen.hidden {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}

.game-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 52px;
  letter-spacing: 6px;
  color: var(--neon-cyan);
  text-shadow:
    0 0 10px rgba(0, 240, 255, 0.9),
    0 0 30px rgba(0, 240, 255, 0.6),
    0 0 60px rgba(0, 240, 255, 0.3);
  animation: title-flicker 3s infinite;
}

.game-title .title-alt {
  color: var(--neon-magenta);
  text-shadow:
    0 0 10px rgba(255, 45, 120, 0.9),
    0 0 30px rgba(255, 45, 120, 0.6),
    0 0 60px rgba(255, 45, 120, 0.3);
}

@keyframes title-flicker {
  0%, 91%, 94%, 100% { opacity: 1; }
  92%, 93% { opacity: 0.65; }
}

.tagline { color: var(--text-dim); font-size: 15px; }

.instructions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  color: var(--text-dim);
}

.instr-row {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
}

.word-sample {
  display: inline-block;
  width: 130px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 15px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
}

.tier-normal { color: #d8dce8; text-shadow: 0 0 6px rgba(216, 220, 232, 0.6); }
.tier-fast   { color: var(--danger-red); text-shadow: 0 0 8px rgba(255, 59, 59, 0.8); }
.tier-heavy  { color: #3f8cff; text-shadow: 0 0 8px rgba(63, 140, 255, 0.8); }
.tier-freeze { color: var(--spell-green); text-shadow: 0 0 10px rgba(57, 255, 136, 0.9); font-weight: bold; }
.tier-blast  { color: var(--spell-green); text-shadow: 0 0 10px rgba(57, 255, 136, 0.9); font-weight: bold; }

.hint { color: var(--text-dim); font-size: 13px; }

kbd {
  font-family: var(--font-mono);
  border: 1px solid rgba(232, 236, 245, 0.35);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 12px;
  color: var(--text-bright);
  background: rgba(255, 255, 255, 0.05);
}

/* Neon buttons */
.neon-btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 4px;
  color: var(--neon-cyan);
  background: transparent;
  border: 2px solid var(--neon-cyan);
  border-radius: 6px;
  padding: 12px 38px;
  cursor: pointer;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.8);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.25), inset 0 0 14px rgba(0, 240, 255, 0.1);
  transition: all 0.2s;
  animation: btn-breathe 2s ease-in-out infinite alternate;
}

.neon-btn:hover {
  background: rgba(0, 240, 255, 0.12);
  box-shadow: 0 0 28px rgba(0, 240, 255, 0.6), inset 0 0 20px rgba(0, 240, 255, 0.2);
  transform: translateY(-1px);
}

.neon-btn:active { transform: translateY(1px); }

@keyframes btn-breathe {
  from { box-shadow: 0 0 10px rgba(0, 240, 255, 0.2), inset 0 0 10px rgba(0, 240, 255, 0.08); }
  to   { box-shadow: 0 0 22px rgba(0, 240, 255, 0.45), inset 0 0 18px rgba(0, 240, 255, 0.15); }
}

/* Game over */
.gameover-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 46px;
  letter-spacing: 8px;
  color: var(--danger-red);
  text-shadow:
    0 0 10px rgba(255, 59, 59, 0.9),
    0 0 35px rgba(255, 59, 59, 0.5);
}

.new-highscore {
  font-family: var(--font-display);
  color: #ffd54d;
  font-size: 16px;
  letter-spacing: 3px;
  text-shadow: 0 0 12px rgba(255, 213, 77, 0.9);
  animation: btn-breathe 1s ease-in-out infinite alternate;
}

.new-highscore.hidden { display: none; }

.final-stats {
  display: flex;
  gap: 36px;
}

.stat { display: flex; flex-direction: column; gap: 4px; }

.stat-label {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.7);
}

/* ============ Input bar ============ */

#input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.prompt-chevron {
  color: var(--neon-cyan);
  font-size: 20px;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.8);
  animation: chevron-blink 1.2s step-end infinite;
}

@keyframes chevron-blink {
  0%, 60% { opacity: 1; }
  61%, 100% { opacity: 0.35; }
}

#word-input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--text-bright);
  background: #0a0a10;
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 6px;
  padding: 10px 16px;
  outline: none;
  caret-color: var(--neon-cyan);
  transition: border-color 0.2s, box-shadow 0.2s;
}

#word-input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.35), inset 0 0 10px rgba(0, 240, 255, 0.08);
}

#word-input::placeholder { color: rgba(138, 143, 163, 0.5); }

/* typed text currently matches no falling word */
#word-input.no-match {
  border-color: rgba(255, 59, 59, 0.7);
  box-shadow: 0 0 12px rgba(255, 59, 59, 0.3), inset 0 0 8px rgba(255, 59, 59, 0.08);
  caret-color: var(--danger-red);
}

#word-input.shake {
  animation: input-shake 0.3s;
  border-color: var(--danger-red);
  box-shadow: 0 0 16px rgba(255, 59, 59, 0.5);
}

@keyframes input-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.spell-legend {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  letter-spacing: 1px;
}

.legend-freeze,
.legend-blast {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--spell-green);
  text-shadow: 0 0 6px rgba(57, 255, 136, 0.7);
}

.legend-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 3px currentColor);
}

/* ============ Mode select ============ */

.game-title .title-sub {
  display: block;
  font-size: 20px;
  letter-spacing: 14px;
  color: var(--fire-orange);
  text-shadow:
    0 0 8px rgba(255, 122, 26, 0.9),
    0 0 24px rgba(255, 122, 26, 0.5);
  margin-top: 2px;
}

.mode-buttons {
  display: flex;
  gap: 22px;
}

.mode-btn {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 260px;
  padding: 16px 20px;
  font-size: 22px;
}

.mode-btn .mode-desc {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.5px;
  text-transform: none;
  color: var(--text-dim);
  text-shadow: none;
  line-height: 1.5;
}

.mode-btn-alt {
  color: var(--neon-magenta);
  border-color: var(--neon-magenta);
  text-shadow: 0 0 8px rgba(255, 45, 120, 0.8);
  box-shadow: 0 0 14px rgba(255, 45, 120, 0.25), inset 0 0 14px rgba(255, 45, 120, 0.1);
  animation: none;
}

.mode-btn-alt:hover {
  background: rgba(255, 45, 120, 0.12);
  box-shadow: 0 0 28px rgba(255, 45, 120, 0.6), inset 0 0 20px rgba(255, 45, 120, 0.2);
}

.word-special {
  color: #ffd54d;
  background: rgba(8, 8, 14, 0.95);
  border: 1px solid #ffd54d;
  text-shadow: 0 0 8px rgba(255, 213, 77, 0.8);
}

/* ============ Levels HUD ============ */

#level-hud {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 0 8px 10px;
}

#level-hud.hidden { display: none; }

.progress-wrap.hidden { display: none; }

.progress-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.progress-bar {
  flex: 1;
  height: 10px;
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--spell-green));
  box-shadow: 0 0 10px rgba(57, 255, 136, 0.6);
  transition: width 0.25s ease;
}

.progress-text {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

.pile-counter {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
}

.pile-counter svg { width: 14px; height: 14px; filter: drop-shadow(0 0 3px currentColor); }
.pile-green { color: var(--spell-green); text-shadow: 0 0 6px rgba(57, 255, 136, 0.7); }
.pile-red   { color: var(--danger-red);  text-shadow: 0 0 6px rgba(255, 59, 59, 0.7); }
.pile-max   { font-size: 11px; color: var(--text-dim); text-shadow: none; }

.pile-label {
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  text-shadow: none;
}

.dead-meter {
  display: flex;
  gap: 2px;
  margin-left: 4px;
}

.dead-cell {
  width: 5px;
  height: 13px;
  border: 1px solid rgba(255, 59, 59, 0.35);
  border-radius: 1px;
  background: rgba(0, 0, 0, 0.4);
}

.dead-cell.filled {
  background: var(--danger-red);
  box-shadow: 0 0 5px rgba(255, 59, 59, 0.8);
}

.pile-danger { animation: pile-alarm 0.5s ease-in-out infinite alternate; }
@keyframes pile-alarm {
  from { text-shadow: 0 0 6px rgba(255, 59, 59, 0.7); }
  to   { text-shadow: 0 0 16px rgba(255, 59, 59, 1); transform: scale(1.08); }
}

.inventory {
  display: flex;
  gap: 4px;
}

.inv-slot {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(138, 143, 163, 0.35);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.45);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 900;
}

.inv-slot.filled {
  border-color: currentColor;
  box-shadow: 0 0 8px currentColor, inset 0 0 6px rgba(255, 255, 255, 0.08);
  text-shadow: 0 0 6px currentColor;
}

/* ============ Levels menu / auth ============ */

.screen-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 34px;
  letter-spacing: 6px;
  color: var(--neon-magenta);
  text-shadow: 0 0 10px rgba(255, 45, 120, 0.9), 0 0 30px rgba(255, 45, 120, 0.5);
}

.auth-status {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 14px;
}

.auth-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 260px;
  font-size: 14px;
  padding: 12px 20px;
  animation: none;
}

.auth-icon { width: 16px; height: 16px; }

.auth-note {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-dim);
  max-width: 420px;
  line-height: 1.5;
}

.user-badge {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.7);
  margin-bottom: 16px;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(5, 56px);
  gap: 10px;
  justify-content: center;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}

.level-cell {
  width: 56px;
  height: 56px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.06);
  border: 1px solid rgba(0, 240, 255, 0.4);
  border-radius: 6px;
  cursor: pointer;
  text-shadow: 0 0 6px rgba(0, 240, 255, 0.7);
  transition: all 0.15s;
}

.level-cell:hover:not(.locked) {
  background: rgba(0, 240, 255, 0.16);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.5);
}

.level-cell.locked {
  color: rgba(138, 143, 163, 0.5);
  border-color: rgba(138, 143, 163, 0.25);
  background: rgba(0, 0, 0, 0.3);
  cursor: not-allowed;
  text-shadow: none;
}

.text-btn {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--text-dim);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px 14px;
  transition: color 0.2s;
}

.text-btn:hover { color: var(--text-bright); text-shadow: 0 0 8px rgba(232, 236, 245, 0.5); }

/* ============ Game over: name entry + leaderboard ============ */

.btn-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

#arcade-save {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 320px;
}

#arcade-save.hidden { display: none; }

.name-entry {
  display: flex;
  gap: 8px;
  width: 100%;
}

#player-name {
  flex: 1;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-align: center;
  color: var(--text-bright);
  background: #0a0a10;
  border: 1px solid rgba(255, 213, 77, 0.5);
  border-radius: 6px;
  padding: 8px 12px;
  outline: none;
  caret-color: #ffd54d;
}

#player-name:focus {
  border-color: #ffd54d;
  box-shadow: 0 0 14px rgba(255, 213, 77, 0.4);
}

.small-btn {
  font-size: 13px;
  padding: 8px 18px;
  letter-spacing: 2px;
  animation: none;
}

.small-btn:disabled { opacity: 0.5; cursor: default; }

.leaderboard {
  list-style: none;
  counter-reset: rank;
  width: 100%;
  max-height: 150px;
  overflow-y: auto;
  font-size: 14px;
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.4);
  padding: 6px 0;
}

.leaderboard li {
  counter-increment: rank;
  display: flex;
  justify-content: space-between;
  padding: 3px 14px 3px 38px;
  position: relative;
  color: var(--text-bright);
}

.leaderboard li::before {
  content: counter(rank);
  position: absolute;
  left: 14px;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 11px;
}

.leaderboard li span:last-child { color: var(--neon-cyan); }

.leaderboard .lb-me {
  color: #ffd54d;
  text-shadow: 0 0 6px rgba(255, 213, 77, 0.6);
}
.leaderboard .lb-me span:last-child { color: #ffd54d; }

.leaderboard .lb-empty {
  justify-content: center;
  padding: 6px;
  color: var(--text-dim);
}
.leaderboard .lb-empty::before { content: none; }

.levelclear-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 40px;
  letter-spacing: 6px;
  color: var(--spell-green);
  text-shadow: 0 0 10px rgba(57, 255, 136, 0.9), 0 0 35px rgba(57, 255, 136, 0.5);
}

.legend-key {
  color: var(--text-dim);
  font-size: 11px;
  white-space: nowrap;
}
.legend-key kbd { font-size: 10px; padding: 0 5px; }

.key-hint {
  font-size: 12px;
  color: var(--text-dim);
}
.key-hint kbd { font-size: 11px; }

/* ============ Versus mode ============ */

.mode-btn-versus {
  color: var(--spell-green);
  border-color: var(--spell-green);
  text-shadow: 0 0 8px rgba(57, 255, 136, 0.8);
  box-shadow: 0 0 14px rgba(57, 255, 136, 0.25), inset 0 0 14px rgba(57, 255, 136, 0.1);
  animation: none;
}

.mode-btn-versus:hover {
  background: rgba(57, 255, 136, 0.12);
  box-shadow: 0 0 28px rgba(57, 255, 136, 0.6), inset 0 0 20px rgba(57, 255, 136, 0.2);
}

#versus-setup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.versus-join, .versus-create {
  display: flex;
  align-items: center;
  gap: 10px;
}

#room-code-input {
  width: 130px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 8px;
  text-transform: uppercase;
  text-align: center;
  color: var(--spell-green);
  background: #0a0a10;
  border: 1px solid rgba(57, 255, 136, 0.5);
  border-radius: 6px;
  padding: 8px 4px 8px 12px;
  outline: none;
  caret-color: var(--spell-green);
}

#room-code-input:focus {
  border-color: var(--spell-green);
  box-shadow: 0 0 14px rgba(57, 255, 136, 0.4);
}

.versus-or { font-size: 12px; color: var(--text-dim); }

#versus-kind {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-bright);
  background: #0a0a10;
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 6px;
  padding: 9px 10px;
  outline: none;
}

.versus-level-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--text-dim);
}

.versus-level-label.hidden { display: none; }

#versus-level {
  width: 58px;
  font-family: var(--font-display);
  font-size: 15px;
  text-align: center;
  color: var(--fire-orange);
  background: #0a0a10;
  border: 1px solid rgba(255, 122, 26, 0.4);
  border-radius: 6px;
  padding: 7px 4px;
  outline: none;
}

.lobby-code-label {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.lobby-code {
  font-family: var(--font-display);
  font-size: 46px;
  font-weight: 900;
  letter-spacing: 16px;
  color: var(--spell-green);
  text-shadow: 0 0 14px rgba(57, 255, 136, 0.9), 0 0 40px rgba(57, 255, 136, 0.4);
  margin: 4px 0 2px 16px; /* offset the trailing letter-spacing */
}

.lobby-kind {
  font-size: 13px;
  color: var(--fire-orange);
  text-shadow: 0 0 6px rgba(255, 122, 26, 0.6);
  margin-bottom: 8px;
}

.lobby-players {
  list-style: none;
  width: 300px;
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.4);
  padding: 6px 0;
  margin-bottom: 6px;
}

.lobby-players li {
  display: flex;
  justify-content: space-between;
  padding: 4px 16px;
  font-size: 14px;
  color: var(--text-bright);
}

.lobby-players li span:last-child { color: var(--text-dim); font-size: 12px; }
.lobby-players li.is-ready span:last-child {
  color: var(--spell-green);
  text-shadow: 0 0 6px rgba(57, 255, 136, 0.7);
}
.lobby-players li.me span:first-child {
  color: var(--neon-cyan);
  text-shadow: 0 0 6px rgba(0, 240, 255, 0.6);
}

#versus-lobby {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#versus-lobby.hidden { display: none; }
#versus-setup.hidden { display: none; }

/* live rivals panel over the playfield */
#opponents {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

#opponents.hidden { display: none; }

.opp {
  min-width: 140px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 45, 120, 0.45);
  border-radius: 6px;
  background: rgba(10, 10, 16, 0.85);
  box-shadow: 0 0 10px rgba(255, 45, 120, 0.15);
}

.opp-name {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--neon-magenta);
  text-shadow: 0 0 6px rgba(255, 45, 120, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.opp-score {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-bright);
}

.opp-dead-meter {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--danger-red);
}

.opp-dead { opacity: 0.55; border-color: rgba(138, 143, 163, 0.4); }
.opp-done { border-color: var(--spell-green); box-shadow: 0 0 10px rgba(57, 255, 136, 0.3); }

.mp-results { margin-top: 4px; width: 320px; }
.mp-results.hidden { display: none; }

/* ============ Responsive ============ */

@media (max-width: 640px) {
  .progress-wrap { flex-basis: 100%; }
  .pile-label { display: none; }
  .game-title { font-size: 32px; letter-spacing: 3px; }
  .gameover-title { font-size: 30px; letter-spacing: 4px; }
  .hud-item { min-width: 60px; }
  .hud-value { font-size: 16px; }
  .final-stats { gap: 18px; }
  .stat-value { font-size: 22px; }
  .instructions { font-size: 12px; }
  .word-sample { width: 96px; font-size: 12px; }
  .spell-legend { display: none; }
}
