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

:root {
  --bg:          #0d0f14;
  --surface:     #161921;
  --surface2:    #1e2230;
  --border:      #2a2f42;
  --text:        #e8eaf0;
  --text-dim:    #6b7280;
  --accent:      #4f9cf9;
  --accent-glow: rgba(79,156,249,0.25);
  --green:       #4ade80;
  --red:         #f87171;
  --orange:      #fb923c;
  --purple:      #a78bfa;
  --yellow:      #fbbf24;
  --flame1:      #ff6b00;
  --flame2:      #ff3a00;
}

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

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

/* ── Logo ─────────────────────────────────────────────────────────────────── */
.logo {
  font-size: 2.8rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: var(--text);
  text-transform: uppercase;
}
.logo span { color: var(--accent); }

/* ── Auth ─────────────────────────────────────────────────────────────────── */
.auth-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem 2.5rem 2rem;
  width: min(420px, 94vw);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.tab-row { display: flex; gap: 0.5rem; }
.tab {
  flex: 1;
  padding: 0.5rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.15s;
}
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.auth-form { display: flex; flex-direction: column; gap: 0.75rem; }
.auth-form input {
  padding: 0.7rem 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
}
.auth-form input:focus { border-color: var(--accent); }

.form-error { color: var(--red); font-size: 0.85rem; min-height: 1.1em; }
.hidden { display: none !important; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
button {
  padding: 0.7rem 1.4rem;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
button:hover  { opacity: 0.9; }
button:active { transform: scale(0.97); }
button.secondary {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
button.secondary:hover { border-color: var(--accent); color: var(--accent); }
button.small { font-size: 0.85rem; padding: 0.45rem 0.9rem; }

/* ── Menu ─────────────────────────────────────────────────────────────────── */
.menu-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}
.menu-user { color: var(--text-dim); font-size: 0.95rem; }
.menu-user strong { color: var(--text); }
.menu-buttons { display: flex; flex-direction: column; gap: 0.75rem; width: 240px; }
.menu-buttons button { width: 100%; }

/* ── Lobby browser ────────────────────────────────────────────────────────── */
.lobby-browser-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
  width: min(520px, 96vw);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.lb-header { display: flex; justify-content: space-between; align-items: center; }
.lb-header h2 { font-size: 1.4rem; }

.create-row { display: flex; gap: 0.6rem; }
.create-row input {
  flex: 1;
  padding: 0.6rem 0.9rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
}
.create-row input:focus { border-color: var(--accent); }

#lobby-list { display: flex; flex-direction: column; gap: 0.5rem; min-height: 120px; }
.lobby-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.lobby-row-info { display: flex; flex-direction: column; gap: 0.2rem; }
.lobby-row-name  { font-weight: 600; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-row-meta  { font-size: 0.8rem; color: var(--text-dim); }
.empty-msg  { color: var(--text-dim); font-size: 0.9rem; padding: 0.5rem 0; }
button.refresh { align-self: flex-end; }

/* ── Lobby waiting room (two-panel) ──────────────────────────────────────── */
#screen-lobby { padding: 1rem; align-items: center; }

.lobby-wrap {
  display: flex;
  gap: 1rem;
  width: min(900px, 98vw);
  height: min(620px, 90vh);
}

.lobby-left {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 320px;
  flex-shrink: 0;
  overflow-y: auto;
}

.lobby-right {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

/* ── Lobby slot grid ──────────────────────────────────────────────────────── */
.slots-section { display: flex; flex-direction: column; gap: 0.4rem; }
.slots-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.slot-grid { display: flex; flex-direction: column; gap: 0.35rem; }
.slot-grid-spectators { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; }

.slot-tile {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.slot-tile:hover { border-color: var(--accent); }
.slot-tile.slot-empty { opacity: 0.5; }
.slot-tile.slot-closed {
  opacity: 0.4;
  cursor: default;
  background: rgba(248,113,113,0.05);
  border-color: rgba(248,113,113,0.2);
}
.slot-tile.slot-me    { border-color: var(--accent); }
.slot-tile.slot-host  { border-color: var(--accent); }

.slot-tile-name {
  font-weight: 700;
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.slot-tile-elo  { font-size: 0.72rem; color: var(--text-dim); flex-shrink: 0; }
.slot-tile-icon { font-size: 0.7rem; flex-shrink: 0; }

/* ── Slot action menu ─────────────────────────────────────────────────────── */
.slot-menu {
  position: fixed;
  z-index: 100;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.4rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  min-width: 180px;
}
.slot-menu-item {
  display: block;
  width: 100%;
  padding: 0.5rem 0.9rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}
.slot-menu-item:hover { background: var(--surface2); opacity: 1; }
.slot-menu-item.danger { color: var(--red); }

.lobby-result {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  text-align: center;
}
.result-title  { display: block; font-size: 1.3rem; font-weight: 800; margin-bottom: 0.3rem; }
.result-scores { font-size: 0.83rem; color: var(--text-dim); }

.lobby-status  { color: var(--text-dim); font-size: 0.9rem; }
.lobby-actions { display: flex; gap: 0.75rem; margin-top: auto; }

/* ── Lobby chat ───────────────────────────────────────────────────────────── */
.lobby-chat-header {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.lobby-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.chat-msg {
  font-size: 0.88rem;
  line-height: 1.45;
  word-break: break-word;
}
.chat-username { font-weight: 700; color: var(--text-dim); }
.chat-username.chat-mine { color: var(--accent); }
.chat-text { color: var(--text); }

.lobby-chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.lobby-chat-form input {
  flex: 1;
  padding: 0.5rem 0.85rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}
.lobby-chat-form input:focus { border-color: var(--accent); }
.lobby-chat-form button { flex-shrink: 0; font-size: 0.9rem; padding: 0.5rem 1rem; }

/* ── Ranked queue ─────────────────────────────────────────────────────────── */
.queue-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem 2.5rem 2rem;
  width: min(360px, 90vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  text-align: center;
}
.queue-box h2 { font-size: 1.6rem; }

.queue-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.queue-stats { display: flex; flex-direction: column; gap: 0.3rem; }
#queue-wait-label { font-size: 1.8rem; font-weight: 800; color: var(--text); }
.queue-range      { font-size: 1rem; color: var(--accent); font-weight: 600; }
.queue-size       { font-size: 0.82rem; color: var(--text-dim); }

/* ── Match badge ──────────────────────────────────────────────────────────── */
.match-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.match-badge.ranked   { background: rgba(79,156,249,0.15); border: 1px solid var(--accent); color: var(--accent); }
.match-badge.unranked { background: rgba(107,114,128,0.15); border: 1px solid var(--text-dim); color: var(--text-dim); }

/* ── Countdown ────────────────────────────────────────────────────────────── */
.countdown-box {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
#countdown-label  { font-size: 1.2rem; color: var(--text-dim); }
.countdown-vs     { font-size: 1rem; color: var(--text-dim); margin-top: 0.5rem; }
.countdown-vs strong { color: var(--text); }
#countdown-number {
  font-size: clamp(5rem, 20vw, 12rem);
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  text-shadow: 0 0 60px var(--accent-glow);
  transition: transform 0.1s;
}
#countdown-number.pulse { animation: pulse 0.25s ease; }
@keyframes pulse {
  0%   { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ── Game layout ──────────────────────────────────────────────────────────── */
#screen-game {
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  padding: 0;
}

.game-layout {
  display: grid;
  grid-template-columns: 1fr 120px 1fr;
  flex: 1;
  height: calc(100vh - 56px); /* subtract input bar */
  overflow: hidden;
}

/* ── Zone ─────────────────────────────────────────────────────────────────── */
.zone {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.zone-player  { border-right: none; }
.zone-opponent { border-left: none; }

.zone-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 2;
}
.zone-name   { font-weight: 700; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zone-score  { font-size: 0.85rem; color: var(--text-dim); margin-left: auto; }
.zone-lives  { font-size: 1rem; letter-spacing: 0.05em; }
.zone-opponent .zone-name  { margin-left: auto; }
.zone-opponent .zone-score { margin-left: 0; margin-right: auto; }

/* ── Fall area ────────────────────────────────────────────────────────────── */
.fall-area {
  position: relative;
  flex: 1;
  overflow: hidden;
}

/* ── Word cards ───────────────────────────────────────────────────────────── */
.word-card {
  position: absolute;
  padding: 4px 11px;
  border-radius: 6px;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
  transform: translateX(-50%);
  border: 1px solid transparent;
  transition: background 0.08s;
}

/* Player's own words */
.zone-player .word-card {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text);
}
.zone-player .word-card.matched {
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* Opponent-sent attack words landing in player's zone */
@keyframes attack-pulse {
  0%, 100% { box-shadow: 0 0 6px 1px rgba(167,139,250,0.45); }
  50%       { box-shadow: 0 0 14px 3px rgba(167,139,250,0.8); }
}
.zone-player .word-card.attack {
  background: rgba(167,139,250,0.14);
  border-color: rgba(167,139,250,0.6);
  color: var(--purple);
  animation: attack-pulse 1.4s ease-in-out infinite;
}
.zone-player .word-card.attack.matched {
  border-color: var(--purple);
  box-shadow: 0 0 14px 3px rgba(167,139,250,0.75);
  animation: none;
}

/* Opponent's words (dimmed, read-only) */
.zone-opponent .word-card {
  background: rgba(248,113,113,0.08);
  border-color: rgba(248,113,113,0.25);
  color: var(--red);
  opacity: 0.75;
}

/* Attack words on opponent's side (words YOU sent — visible to sender) */
@keyframes attack-pulse-opp {
  0%, 100% { box-shadow: 0 0 5px 1px rgba(167,139,250,0.3); }
  50%       { box-shadow: 0 0 11px 2px rgba(167,139,250,0.6); }
}
.zone-opponent .word-card.attack {
  background: rgba(167,139,250,0.1);
  border-color: rgba(167,139,250,0.45);
  color: var(--purple);
  opacity: 0.9;
  animation: attack-pulse-opp 1.4s ease-in-out infinite;
}

/* Typed match highlight */
.match-done   { color: var(--green); }
.match-remain { color: inherit; }

/* ── Flame ────────────────────────────────────────────────────────────────── */
.flame {
  height: 28px;
  flex-shrink: 0;
  background: linear-gradient(to top, var(--flame2), var(--flame1), transparent);
  animation: flicker 0.8s ease-in-out infinite alternate;
  position: relative;
  z-index: 1;
}
@keyframes flicker {
  from { opacity: 0.85; }
  to   { opacity: 1; }
}

/* ── Communal zone ────────────────────────────────────────────────────────── */
.zone-communal {
  background: var(--surface);
  border-left:  1px solid var(--border);
  border-right: 1px solid var(--border);
}
.zone-communal .zone-header { justify-content: center; }
.communal-label { color: var(--orange); font-size: 0.75rem; letter-spacing: 0.12em; }

.communal-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.4rem;
  overflow-y: auto;
  flex: 1;
}

.communal-word {
  padding: 4px 10px;
  background: rgba(251,146,60,0.1);
  border: 1px solid rgba(251,146,60,0.3);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--orange);
  white-space: nowrap;
  max-width: 108px;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: center;
}
.communal-word.matched {
  border-color: var(--orange);
  box-shadow: 0 0 8px rgba(251,146,60,0.35);
}

/* ── Input bar ────────────────────────────────────────────────────────────── */
.input-bar {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
#game-input {
  width: 100%;
  padding: 0.6rem 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#game-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
#game-input.has-match { border-color: var(--green); box-shadow: 0 0 0 2px rgba(74,222,128,0.2); }
#game-input:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Game-end overlay ─────────────────────────────────────────────────────── */
.game-end-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  z-index: 50;
  backdrop-filter: blur(2px);
}
.game-end-message {
  font-size: clamp(2.4rem, 7vw, 4.5rem);
  font-weight: 900;
  text-align: center;
  text-shadow: 0 0 40px currentColor;
  animation: end-pulse 0.75s ease-in-out infinite alternate;
}
@keyframes end-pulse {
  from { transform: scale(0.88); opacity: 0.85; }
  to   { transform: scale(1.12); opacity: 1;    }
}

/* ── Spectate banner ──────────────────────────────────────────────────────── */
.spectate-banner {
  text-align: center;
  padding: 0.35rem 1rem;
  background: rgba(79, 156, 249, 0.12);
  border-top: 1px solid rgba(79, 156, 249, 0.3);
  color: var(--accent);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

/* ── Game over ────────────────────────────────────────────────────────────── */
.gameover-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  width: min(380px, 92vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}
#gameover-title  { font-size: 2rem; font-weight: 900; }
#gameover-detail { color: var(--text-dim); }
#gameover-elo    { font-size: 1.1rem; font-weight: 700; }
.gameover-box button { width: 100%; }
#gameover-badge { margin-bottom: 0.25rem; }

/* ── Leaderboard ──────────────────────────────────────────────────────────── */
.leaderboard-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
  width: min(520px, 96vw);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 90vh;
  overflow: hidden;
}
#leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  overflow-y: auto;
  display: block;
  max-height: 70vh;
}
#leaderboard-table thead { position: sticky; top: 0; background: var(--surface); }
#leaderboard-table th { text-align: left; padding: 0.5rem 0.6rem; color: var(--text-dim); font-weight: 600; border-bottom: 1px solid var(--border); }
#leaderboard-table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid rgba(42,47,66,0.5); }
#leaderboard-table tr:hover td { background: var(--surface2); }
#leaderboard-table td:nth-child(1) { color: var(--text-dim); }
#leaderboard-table td:nth-child(3) { color: var(--accent); font-weight: 700; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 999;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Player stats modal ───────────────────────────────────────────────────── */
.stats-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stats-modal-overlay.hidden { display: none; }

.stats-modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.4rem 1.6rem 1.6rem;
  width: min(300px, 88vw);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.stats-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.stats-modal-header h3 { font-size: 1.1rem; font-weight: 800; }

.stats-modal-body { display: flex; flex-direction: column; gap: 0.1rem; }

.stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.stats-row:last-child { border-bottom: none; }
.stats-label { color: var(--text-dim); }
.stats-val   { font-weight: 700; }

/* ── Life colors ──────────────────────────────────────────────────────────── */
.lives-3 { color: var(--green); }
.lives-2 { color: var(--yellow); }
.lives-1 { color: var(--red); }
.lives-0 { color: var(--red); opacity: 0.5; }

/* ── OAuth buttons ────────────────────────────────────────────────────────── */
.oauth-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.btn-oauth { display: flex; align-items: center; gap: 0.5rem; justify-content: center; font-size: 0.9rem; padding: 0.6rem 1rem; }
.btn-oauth.google   { background: #4285F4; }
.btn-oauth.github   { background: #24292e; }
.btn-oauth.discord  { background: #5865F2; }
.btn-oauth.facebook { background: #1877F2; }

/* ── OAuth highlight (shown when user should use a specific provider) ─────── */
@keyframes oauth-pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--accent); }
  50%       { box-shadow: 0 0 0 5px rgba(79,156,249,0.4); }
}
.btn-oauth.oauth-highlight {
  box-shadow: 0 0 0 2px var(--accent);
  animation: oauth-pulse 0.9s ease-in-out 4;
}

/* ── Divider ──────────────────────────────────────────────────────────────── */
.divider { display: flex; align-items: center; gap: 0.75rem; color: var(--text-dim); font-size: 0.82rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Guest section ────────────────────────────────────────────────────────── */
.guest-section { border-top: 1px solid var(--border); padding-top: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }

/* ── Online count ─────────────────────────────────────────────────────────── */
.online-count  { color: var(--green); font-size: 0.82rem; text-align: center; }
.menu-online   { color: var(--text-dim); font-size: 0.82rem; }

/* ── Username setup screen ────────────────────────────────────────────────── */
.setup-subtitle { font-size: 1.1rem; font-weight: 700; text-align: center; }
.setup-hint     { color: var(--text-dim); font-size: 0.85rem; text-align: center; }

/* ── Verify prompt ────────────────────────────────────────────────────────── */
.verify-prompt  { display: flex; flex-direction: column; gap: 0.75rem; text-align: center; }
.verify-prompt p { color: var(--text-dim); font-size: 0.9rem; }

/* ── Profile screen ───────────────────────────────────────────────────────── */
#screen-profile { align-items: center; overflow-y: auto; }

.profile-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
  width: min(620px, 96vw);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 90vh;
  overflow-y: auto;
}

.profile-stats { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.stat-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 1.2rem;
  flex: 1;
  text-align: center;
  min-width: 80px;
}
.stat-val   { display: block; font-size: 1.4rem; font-weight: 800; color: var(--accent); }
.stat-label { display: block; font-size: 0.75rem; color: var(--text-dim); margin-top: 0.2rem; }

#elo-graph  { width: 100%; border-radius: 8px; background: var(--surface2); display: block; }

#profile-matches { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
#profile-matches th { text-align: left; padding: 0.4rem 0.5rem; color: var(--text-dim); border-bottom: 1px solid var(--border); }
#profile-matches td { padding: 0.4rem 0.5rem; border-bottom: 1px solid rgba(42,47,66,0.5); }

.result-win  { color: var(--green);  font-weight: 700; }
.result-loss { color: var(--red);    font-weight: 700; }
.result-draw { color: var(--yellow); font-weight: 700; }
