/* ═══════════════════════════════════════════════════
   Chess Arena v3 — Full Game Platform Theme
   Lobby, multiplayer, AI, replay, spectacular UI
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;700&display=swap');

:root {
  --bg: #0a0a12;
  --surface: rgba(20,20,32,0.85);
  --surface2: #1e1e32;
  --surface-glass: rgba(22, 22, 38, 0.7);
  --border: rgba(60,60,100,0.4);
  --text: #e8e8f4;
  --text-muted: #6a6a9a;
  --accent: #7c6fff;
  --accent2: #a78bfa;
  --accent-glow: rgba(124, 111, 255, 0.25);
  --gold: #f0c040;
  --danger: #ef4444;
  --success: #22c55e;
  --light-sq: #c8cfe0;
  --dark-sq: #6272a4;
  --selected: rgba(124, 111, 255, 0.55);
  --legal-dot: rgba(0, 0, 0, 0.3);
  --last-move: rgba(240, 192, 64, 0.3);
  --capture-ring: rgba(239, 68, 68, 0.6);
  --sq-size: clamp(52px, 8.5vw, 74px);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 40%, rgba(124,111,255,0.07) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(240,192,64,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 90%, rgba(34,197,94,0.03) 0%, transparent 50%);
  animation: bgFloat 25s ease-in-out infinite alternate;
  pointer-events: none; z-index: 0;
}
@keyframes bgFloat { 0%{opacity:.5;transform:scale(1)} 100%{opacity:1;transform:scale(1.08)} }

#particle-canvas { position:fixed;inset:0;width:100%;height:100%;pointer-events:none;z-index:50; }

/* ── Screen System ────────────────────────────── */
.screen { display:none; position:relative; z-index:1; min-height:100vh; }
.screen.active { display:flex; flex-direction:column; align-items:center; }

/* ══════════════════════════════════════════════════
   LOBBY
   ══════════════════════════════════════════════════ */
.lobby {
  max-width: 680px; width: 100%; padding: 2rem 1.5rem;
  display: flex; flex-direction: column; gap: 1.5rem; align-items: center;
}

.lobby-brand { text-align: center; padding: 2rem 0 1rem; }

.brand-crown {
  font-size: 4.5rem; line-height: 1;
  filter: drop-shadow(0 0 30px rgba(240,192,64,0.4));
  animation: crownFloat 3s ease-in-out infinite;
}
@keyframes crownFloat {
  0%,100% { transform:translateY(0); }
  50% { transform:translateY(-8px); }
}

.lobby-brand h1 {
  font-size: 2.8rem; font-weight: 900; letter-spacing: 0.1em;
  background: linear-gradient(135deg, var(--accent) 0%, var(--gold) 50%, var(--accent2) 100%);
  background-size: 200% 200%;
  animation: titleShimmer 4s ease-in-out infinite;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
@keyframes titleShimmer { 0%,100%{background-position:0% 50%} 50%{background-position:100% 50%} }

.brand-sub {
  font-size: 0.75rem; letter-spacing: 0.35em; color: var(--text-muted);
  text-transform: uppercase; margin-top: 0.3rem; font-weight: 700;
}

/* Name input */
.lobby-name-input { width: 100%; max-width: 380px; }
.lobby-name-input label {
  display: block; font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 0.4rem; font-weight: 700;
}
.lobby-name-input input {
  width: 100%; padding: 0.8rem 1rem; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface2);
  color: var(--text); font-size: 1rem; font-family: inherit;
  outline: none; transition: border-color 0.3s, box-shadow 0.3s;
}
.lobby-name-input input:focus {
  border-color: var(--accent); box-shadow: 0 0 20px var(--accent-glow);
}

/* Mode cards */
.lobby-modes {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem; width: 100%;
}

.mode-card {
  background: var(--surface-glass); backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: 16px;
  padding: 1.5rem 1rem; cursor: pointer; transition: all 0.3s cubic-bezier(0.23,1,0.32,1);
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  text-align: center; position: relative; overflow: hidden;
}

.mode-card:hover {
  border-color: var(--accent); transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(124,111,255,0.15);
}

.mode-card.selected { border-color: var(--accent); background: rgba(124,111,255,0.1); }

.mode-card.featured {
  border-color: rgba(240,192,64,0.3);
  background: linear-gradient(135deg, rgba(240,192,64,0.08), rgba(124,111,255,0.08));
}
.mode-card.featured:hover { border-color: var(--gold); box-shadow: 0 8px 30px rgba(240,192,64,0.15); }

.mode-badge {
  position: absolute; top: 8px; right: 8px;
  background: linear-gradient(135deg, var(--gold), #e8a020);
  color: #000; font-size: 0.55rem; font-weight: 800;
  padding: 2px 8px; border-radius: 6px; letter-spacing: 0.08em;
}

.mode-icon { font-size: 2.2rem; line-height: 1; margin-bottom: 0.2rem; }
.mode-title { font-weight: 800; font-size: 1rem; letter-spacing: 0.03em; }
.mode-desc { font-size: 0.72rem; color: var(--text-muted); }

/* Lobby options panels */
.lobby-options {
  width: 100%; max-width: 460px; padding: 1.2rem;
  background: var(--surface-glass); backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: 16px;
  animation: slideUp 0.3s ease;
}
.lobby-options.hidden { display: none; }
.lobby-options h3 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 0.8rem; font-weight: 700; }

@keyframes slideUp { 0%{opacity:0;transform:translateY(12px)} 100%{opacity:1;transform:translateY(0)} }

/* Difficulty buttons */
.difficulty-row, .color-row { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.diff-btn, .color-btn {
  flex: 1; padding: 0.6rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface2);
  color: var(--text); font-size: 0.8rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.diff-btn:hover, .color-btn:hover { border-color: var(--accent); }
.diff-btn.active, .color-btn.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
}

.color-choice { margin-top: 0.5rem; }

/* Join input */
.join-row { display: flex; gap: 0.5rem; }
.code-input {
  flex: 1; padding: 0.8rem 1rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text); font-size: 1.2rem;
  font-family: 'JetBrains Mono', monospace; letter-spacing: 0.2em;
  text-align: center; text-transform: uppercase; outline: none;
}
.code-input:focus { border-color: var(--accent); box-shadow: 0 0 20px var(--accent-glow); }

/* Share box */
.share-box { text-align: center; padding: 1rem 0; }
.share-code {
  font-family: 'JetBrains Mono', monospace; font-size: 2.5rem; font-weight: 900;
  letter-spacing: 0.3em; color: var(--gold);
  text-shadow: 0 0 20px rgba(240,192,64,0.4);
}
.share-link-row { display: flex; gap: 0.5rem; margin-top: 0.8rem; }
.share-link-input {
  flex: 1; padding: 0.5rem 0.8rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text-muted); font-size: 0.8rem;
  font-family: 'JetBrains Mono', monospace; outline: none;
}
.share-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.6rem; }

/* Waiting status */
.waiting-status {
  display: flex; align-items: center; gap: 0.8rem;
  justify-content: center; padding: 0.8rem; color: var(--text-muted);
}
.spinner {
  width: 20px; height: 20px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════
   GAME SCREEN
   ══════════════════════════════════════════════════ */
#screen-game { min-height: 100vh; }

header {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.8rem 1.5rem; width: 100%;
  background: linear-gradient(180deg, rgba(20,20,32,0.9) 0%, transparent 100%);
}
header h1 {
  font-size: 1.2rem; font-weight: 800; letter-spacing: 0.08em;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.btn-back {
  background: none; border: 1px solid var(--border); color: var(--text);
  width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
  font-size: 1.1rem; transition: all 0.2s; display: flex; align-items: center; justify-content: center;
}
.btn-back:hover { border-color: var(--accent); background: rgba(124,111,255,0.1); }

.header-badges { display: flex; gap: 0.4rem; margin-left: auto; }
.badge {
  font-size: 0.6rem; font-weight: 800; letter-spacing: 0.08em;
  padding: 3px 10px; border-radius: 6px;
  background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border);
}
.badge-green { background: rgba(34,197,94,0.15); color: var(--success); border-color: rgba(34,197,94,0.3); }

.game-container {
  display: flex; gap: 1.2rem; padding: 0 1.5rem 2rem;
  max-width: 1200px; width: 100%; justify-content: center;
  align-items: flex-start; flex-wrap: wrap;
}

/* Board area */
.board-area { display: flex; flex-direction: column; gap: 0.5rem; }

/* Player bars */
.player-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 0.8rem; background: var(--surface-glass);
  backdrop-filter: blur(8px); border-radius: 10px;
  border: 1px solid var(--border); gap: 0.8rem;
}
.player-info { display: flex; align-items: center; gap: 0.5rem; }
.player-piece { font-size: 1.4rem; }
.player-name { font-weight: 700; font-size: 0.9rem; }
.captured-inline { font-size: 0.9rem; opacity: 0.6; margin-left: 0.3rem; }

/* ── Eval Bar ─────────────────────────────────── */
.eval-bar {
  width: 18px; height: calc(var(--sq-size) * 8 + 100px);
  background: #1a1a28; border-radius: 9px; overflow: hidden;
  border: 1px solid var(--border); align-self: center;
  display: flex; flex-direction: column-reverse;
}
.eval-fill {
  width: 100%; height: 50%;
  background: linear-gradient(180deg, #f5f5f5 0%, #ccc 100%);
  transition: height 0.6s cubic-bezier(0.23,1,0.32,1);
}

/* ── Board ────────────────────────────────────── */
#board {
  display: flex; flex-direction: column; border-radius: 8px;
  overflow: hidden; user-select: none;
  box-shadow: 0 0 0 1px var(--border), 0 12px 40px rgba(0,0,0,0.5), 0 0 80px rgba(124,111,255,0.04);
  transition: transform 0.5s cubic-bezier(0.23,1,0.32,1);
}
#board.flipped { transform: rotate(180deg); }
#board.flipped .piece, #board.flipped .row-label, #board.flipped .col-labels span { transform: rotate(180deg); }
#board.check-flash { animation: checkPulse 0.8s ease; }
#board.game-over { animation: gameOverShake 0.5s ease; }

@keyframes checkPulse {
  0%,100% { box-shadow: 0 0 0 1px var(--border), 0 12px 40px rgba(0,0,0,0.5); }
  30%,70% { box-shadow: 0 0 0 3px var(--danger), 0 0 60px rgba(239,68,68,0.4); }
}
@keyframes gameOverShake {
  0%,100%{transform:translateX(0)} 20%{transform:translateX(-5px)} 40%{transform:translateX(5px)}
  60%{transform:translateX(-3px)} 80%{transform:translateX(3px)}
}

.board-row { display: flex; align-items: center; }
.row-label { width: 22px; text-align: center; font-size: 0.65rem; color: var(--text-muted); font-weight: 700; opacity: 0.5; }
.col-labels { display: flex; height: 22px; }
.col-labels span { text-align: center; font-size: 0.65rem; color: var(--text-muted); font-weight: 700; opacity: 0.5; }
.col-labels span:first-child, .col-labels span:last-child { width: 22px; }
.col-labels span:not(:first-child):not(:last-child) { width: var(--sq-size); }

.square {
  width: var(--sq-size); height: var(--sq-size);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative; transition: filter 0.12s;
}
.square.light { background: var(--light-sq); }
.square.dark { background: var(--dark-sq); }
.square:hover { filter: brightness(1.1); }
.square.selected { background: var(--selected) !important; }
.square.last-move { background-color: var(--last-move) !important; }
.square.king-check {
  background: radial-gradient(circle, rgba(239,68,68,0.8), rgba(239,68,68,0.2), transparent 75%) !important;
  animation: kingDanger 1.2s ease infinite;
}
@keyframes kingDanger { 0%,100%{box-shadow:inset 0 0 10px rgba(239,68,68,0.3)} 50%{box-shadow:inset 0 0 22px rgba(239,68,68,0.6)} }

.square.legal-move::after {
  content: ''; position: absolute; width: 26%; height: 26%; border-radius: 50%;
  background: var(--legal-dot); animation: dotPulse 1.5s ease-in-out infinite;
}
@keyframes dotPulse { 0%,100%{transform:scale(1);opacity:.65} 50%{transform:scale(1.15);opacity:1} }

.square.capture-target::after {
  content: ''; position: absolute; width: 82%; height: 82%; border-radius: 50%;
  border: 3px solid var(--capture-ring); animation: capPulse 1.2s ease-in-out infinite;
}
@keyframes capPulse { 0%,100%{transform:scale(1);opacity:.55} 50%{transform:scale(1.05);opacity:1} }

.square.drag-hover { filter: brightness(1.3) !important; box-shadow: inset 0 0 15px var(--accent-glow); }

/* ── Pieces ────────────────────────────────────── */
.piece {
  font-size: clamp(2rem, 5.8vw, 3.6rem); line-height: 1; z-index: 1;
  cursor: grab; transition: transform 0.1s;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
.piece:hover { transform: scale(1.08); }
.piece:active { cursor: grabbing; transform: scale(1.12); }
.white-piece { filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5)) drop-shadow(0 0 6px rgba(255,255,255,0.08)); }
.black-piece { filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4)); }

.drag-ghost {
  position: fixed; font-size: 3.2rem; pointer-events: none; z-index: 1000;
  opacity: 0.9; filter: drop-shadow(0 4px 12px rgba(124,111,255,0.5));
}

/* ── Sidebar ──────────────────────────────────── */
.sidebar {
  display: flex; flex-direction: column; gap: 0.7rem;
  min-width: 250px; max-width: 300px;
}
.panel {
  background: var(--surface-glass); backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 0.8rem 1rem; transition: border-color 0.3s;
}
.panel:hover { border-color: rgba(124,111,255,0.2); }
.panel h3 {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); margin-bottom: 0.4rem; font-weight: 700;
}

/* Turn indicator */
.turn-indicator {
  text-align: center; padding: 0.7rem; border-radius: 12px;
  font-weight: 700; font-size: 0.95rem; transition: all 0.4s;
  border: 1px solid transparent;
}
.turn-indicator.white {
  background: linear-gradient(135deg, rgba(232,232,244,0.12), rgba(208,208,228,0.06));
  color: #f0f0f8; border-color: rgba(255,255,255,0.1);
}
.turn-indicator.black {
  background: linear-gradient(135deg, rgba(30,30,50,0.5), rgba(50,50,70,0.3));
  color: #d0d0e0; border-color: rgba(255,255,255,0.05);
}
.turn-icon { font-size: 1.2em; vertical-align: middle; margin-right: 0.3rem; }

/* Status */
.status {
  text-align: center; padding: 0.5rem 0.8rem; border-radius: 10px;
  font-weight: 600; font-size: 0.82rem; background: var(--surface2); transition: all 0.3s;
}
.status.warning { background: rgba(239,68,68,0.12); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); animation: wPulse 1.5s ease infinite; }
.status.thinking { background: rgba(124,111,255,0.12); color: var(--accent2); border: 1px solid rgba(124,111,255,0.2); }
.status.gameover { background: linear-gradient(135deg, var(--accent), var(--gold)); color: #000; font-weight: 800; }
@keyframes wPulse { 0%,100%{box-shadow:0 0 0 rgba(239,68,68,0)} 50%{box-shadow:0 0 16px rgba(239,68,68,0.15)} }

/* Timer */
.timer {
  font-family: 'JetBrains Mono', monospace; font-size: 1.3rem; font-weight: 700;
  padding: 0.4rem 0.8rem; border-radius: 8px; background: var(--surface2);
  border: 2px solid transparent; transition: all 0.3s; min-width: 72px; text-align: center;
}
.timer.active { border-color: var(--accent); box-shadow: 0 0 14px var(--accent-glow); }
.timer.low { color: var(--danger) !important; border-color: var(--danger); box-shadow: 0 0 14px rgba(239,68,68,0.25); animation: timerPulse 0.5s ease infinite; }
@keyframes timerPulse { 0%,100%{opacity:1} 50%{opacity:.5} }

/* Chat */
.chat-messages {
  max-height: 140px; overflow-y: auto; margin-bottom: 0.5rem;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.chat-msg { font-size: 0.8rem; padding: 0.2rem 0; word-break: break-word; }
.chat-msg strong { color: var(--accent2); }
.chat-input-row { display: flex; gap: 0.4rem; }
.chat-input-row input {
  flex: 1; padding: 0.45rem 0.7rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text); font-size: 0.8rem; outline: none;
}
.chat-input-row input:focus { border-color: var(--accent); }

/* Captured */
.captured-section { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.3rem; min-height: 1.5rem; }
.cap-label { font-size: 0.65rem; color: var(--text-muted); min-width: 58px; }
.captured-row { display: flex; flex-wrap: wrap; gap: 1px; flex: 1; }
.captured-piece {
  font-size: 1rem; opacity: 0.7; transition: all 0.2s;
  animation: capIn 0.3s cubic-bezier(0.23,1,0.32,1);
}
.captured-piece:hover { opacity: 1; transform: scale(1.3); }
@keyframes capIn { 0%{opacity:0;transform:scale(.4) rotate(180deg)} 100%{opacity:.7;transform:scale(1) rotate(0)} }
.material-count { font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; font-weight: 700; color: var(--gold); min-width: 1.5rem; text-align: right; }

/* Move log */
#move-log { max-height: 180px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
#move-log::-webkit-scrollbar { width: 3px; }
#move-log::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.log-entry {
  display: flex; gap: 0.3rem; padding: 0.2rem 0.3rem; font-size: 0.78rem;
  border-radius: 4px; transition: background 0.15s; animation: logIn 0.2s ease;
}
.log-entry:hover { background: rgba(124,111,255,0.06); }
.log-entry.log-capture { color: var(--gold); }
@keyframes logIn { 0%{opacity:0;transform:translateX(-6px)} 100%{opacity:1;transform:translateX(0)} }
.move-num { color: var(--text-muted); min-width: 1.5rem; font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; }
.move-text { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; }

/* Buttons */
.btn-row { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.btn {
  flex: 1; padding: 0.55rem 0.5rem; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface-glass); backdrop-filter: blur(6px);
  color: var(--text); font-size: 0.72rem; font-weight: 700; cursor: pointer;
  transition: all 0.2s cubic-bezier(0.23,1,0.32,1);
  text-align: center; text-transform: uppercase; letter-spacing: 0.05em;
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 4px 12px var(--accent-glow); }
.btn:active { transform: translateY(0); }
.btn.btn-danger:hover { border-color: var(--danger); box-shadow: 0 4px 12px rgba(239,68,68,0.2); }
.btn.btn-primary { background: linear-gradient(135deg, var(--accent), #5a4ad4); border-color: var(--accent); color: #fff; }
.btn.btn-primary:hover { box-shadow: 0 6px 24px var(--accent-glow); }
.btn.btn-lg { padding: 0.8rem 1.5rem; font-size: 0.9rem; margin-top: 0.5rem; }
.btn-icon { font-size: 1rem; padding: 0.5rem 0.6rem; min-width: 38px; flex: 0; }

/* Replay controls */
.replay-slider, .speed-slider { width: 100%; accent-color: var(--accent); }
.replay-bar { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.replay-counter { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: var(--text-muted); min-width: 3rem; }

/* ── Modals ───────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
  z-index: 200; display: flex; align-items: center; justify-content: center;
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 1.5rem 2rem; text-align: center; max-width: 360px;
  animation: modalIn 0.3s cubic-bezier(0.23,1,0.32,1);
}
.modal-box p { margin-bottom: 1rem; font-size: 0.95rem; }

/* Promotion Modal */
#promotion-modal {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px); z-index: 200; align-items: center; justify-content: center;
}
#promotion-modal.visible { display: flex; }
.promo-content {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 1.5rem 2rem; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: modalIn 0.3s cubic-bezier(0.23,1,0.32,1);
}
@keyframes modalIn { 0%{opacity:0;transform:translateY(16px) scale(.96)} 100%{opacity:1;transform:translateY(0) scale(1)} }
.promo-content h3 { margin-bottom: 1rem; font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.promo-pieces { display: flex; gap: 0.8rem; justify-content: center; }
.promo-btn {
  width: 68px; height: 76px; font-size: 2.5rem; border: 2px solid var(--border);
  border-radius: 14px; background: var(--surface2); color: var(--text); cursor: pointer;
  transition: all 0.25s cubic-bezier(0.23,1,0.32,1);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.promo-btn small { font-size: 0.55rem; text-transform: uppercase; color: var(--text-muted); margin-top: 2px; }
.promo-btn:hover {
  border-color: var(--accent); background: linear-gradient(135deg, var(--accent), #5a4ad4);
  transform: scale(1.1) translateY(-4px); box-shadow: 0 8px 24px var(--accent-glow); color: #fff;
}
.promo-btn:hover small { color: rgba(255,255,255,0.8); }

/* Game Over overlay */
.gameover-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px;
  padding: 2.5rem 3rem; text-align: center; max-width: 420px;
  animation: modalIn 0.4s cubic-bezier(0.23,1,0.32,1);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}
.gameover-crown {
  font-size: 5rem; line-height: 1; margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 30px rgba(240,192,64,0.5));
  animation: crownFloat 2s ease-in-out infinite;
}
.gameover-box h2 {
  font-size: 1.8rem; font-weight: 900; margin-bottom: 0.3rem;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.gameover-box p { color: var(--text-muted); font-size: 1rem; margin-bottom: 1.5rem; }
.gameover-actions { justify-content: center; }
.gameover-actions .btn { min-width: 90px; }

/* ── Responsive ───────────────────────────────── */
@media (max-width: 900px) {
  :root { --sq-size: clamp(44px, 11vw, 60px); }
  .game-container { flex-direction: column; align-items: center; padding: 0 0.5rem 1rem; }
  .sidebar { flex-direction: row; flex-wrap: wrap; max-width: 100%; min-width: unset; gap: 0.5rem; }
  .sidebar .panel { flex: 1; min-width: 140px; }
  .eval-bar { display: none; }
  .lobby-modes { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  :root { --sq-size: clamp(38px, 12vw, 48px); }
  .piece { font-size: clamp(1.7rem, 8vw, 2.2rem); }
  .lobby-brand h1 { font-size: 2rem; }
  .lobby-modes { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .mode-card { padding: 1rem 0.5rem; }
  .gameover-box { padding: 1.5rem; }
}

.hidden { display: none !important; }
