.cards-mp-announce-and-pile-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

@media (max-width: 720px) {
  .cards-mp-announce-and-pile-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
}

/* ═══════════════════════════════════════════════
   ULTIMATE TIC TAC TOE — STYLE
   ═══════════════════════════════════════════════ */

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

:root {
  --bg: #0c0a07;
  --surface: #1a1610;
  --surface2: #282018;
  --border: #4a3d2a;
  --text: #f7ecd8;
  --text-dim: #9c8f78;
  /* X = bright gold, O = warm bronze — both read as “golden” but stay distinct */
  --x-color: #e8c547;
  --x-glow: rgba(232, 197, 71, 0.5);
  --o-color: #c9954a;
  --o-glow: rgba(201, 149, 74, 0.48);
  --accent: #d4a84b;
  --accent-glow: rgba(212, 168, 75, 0.45);
  --cream: #faf4e6;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-lg: 20px;
}

html, body {
  width: 100%; height: 100%;
  font-family: 'Rajdhani', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ─── Particle Canvas ─── */
#particleCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ─── Screens ─── */
.screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  transform: scale(0.95);
}
.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: scale(1);
}

/* Gameplay screen: fill viewport (fixes endless board stuck to content-width / “half screen”) */
#gameScreen.screen.active {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}
#gameScreen.screen.active .game-layout {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-height: 100%;
}

/* ─── Menu Container ─── */
.menu-container {
  background: linear-gradient(135deg, var(--surface), var(--surface2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  max-width: 520px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05);
}

/* ─── Logo ─── */
.logo-wrapper { text-align: center; margin-bottom: 36px; }
.game-logo {
  font-family: 'Orbitron', sans-serif;
  font-size: 64px;
  font-weight: 900;
  letter-spacing: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.logo-x {
  color: var(--x-color);
  text-shadow: 0 0 20px var(--x-glow), 0 0 40px var(--x-glow);
  animation: pulse-x 2s ease-in-out infinite;
}
.logo-o {
  color: var(--o-color);
  text-shadow: 0 0 20px var(--o-glow), 0 0 40px var(--o-glow);
  animation: pulse-o 2s ease-in-out infinite 0.5s;
}
.logo-vs {
  font-size: 24px;
  color: var(--text-dim);
  font-weight: 400;
}
.game-subtitle {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  letter-spacing: 6px;
  color: var(--accent);
  margin-top: 8px;
}
.logo-underline {
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, var(--x-color), var(--accent), var(--o-color));
  margin: 12px auto 0;
  border-radius: 2px;
}

@keyframes pulse-x {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
@keyframes pulse-o {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* ─── Buttons ─── */
.btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
  transition: left 0.5s ease;
}
.btn:hover::before { left: 100%; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.3); }
.btn:active { transform: translateY(0); }

.btn-icon { font-size: 28px; flex-shrink: 0; }
.btn-text { display: flex; flex-direction: column; }
.btn-text strong { font-size: 18px; font-weight: 700; letter-spacing: 2px; }
.btn-text small { font-size: 12px; color: var(--text-dim); }

.btn-primary { border-color: var(--x-color); }
.btn-primary:hover { background: rgba(232, 197, 71, 0.12); box-shadow: 0 0 20px var(--x-glow); }
.btn-secondary { border-color: var(--accent); }
.btn-secondary:hover { background: rgba(212, 168, 75, 0.12); box-shadow: 0 0 20px var(--accent-glow); }
.btn-accent { border-color: var(--o-color); }
.btn-accent:hover { background: rgba(201, 149, 74, 0.12); box-shadow: 0 0 20px var(--o-glow); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.1); }

.btn-glow { animation: btn-glow-pulse 3s ease-in-out infinite; }
@keyframes btn-glow-pulse {
  0%, 100% { box-shadow: 0 0 5px rgba(255,255,255,0.05); }
  50% { box-shadow: 0 0 15px rgba(255,255,255,0.1); }
}

.menu-buttons { display: flex; flex-direction: column; gap: 14px; }

.btn-back {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  transition: all 0.3s;
  margin-bottom: 16px;
}
.btn-back:hover { color: var(--text); border-color: var(--text); }

/* ─── Screen Title ─── */
.screen-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 24px;
  text-align: center;
  margin-bottom: 28px;
  background: linear-gradient(90deg, var(--x-color), var(--accent), var(--o-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Difficulty Cards ─── */
.difficulty-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.diff-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 16px;
}
.diff-card:hover {
  transform: translateX(6px);
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}
.diff-icon { font-size: 36px; }
.diff-card h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 16px;
  margin-bottom: 2px;
}
.diff-card p { font-size: 13px; color: var(--text-dim); }
.diff-stars { color: var(--warning); font-size: 14px; margin-top: 2px; letter-spacing: 2px; }
.diff-easy:hover { border-color: var(--success); box-shadow: 0 0 20px rgba(34,197,94,0.3); }
.diff-medium:hover { border-color: var(--warning); box-shadow: 0 0 20px rgba(245,158,11,0.3); }
.diff-hard:hover { border-color: var(--danger); box-shadow: 0 0 20px rgba(239,68,68,0.3); }

/* ─── Online Menu ─── */
.name-input-group { margin-bottom: 20px; }
.name-input-group label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
  letter-spacing: 1px;
}
.name-input-group input,
#roomCodeInput {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px;
  outline: none;
  transition: border-color 0.3s;
}
.name-input-group input:focus,
#roomCodeInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.online-hub-hint,
.online-step-hint {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 18px;
}
.online-hub-actions,
.online-game-pick-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.online-game-pick {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.online-game-pick:hover {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}
.online-game-pick-icon { font-size: 22px; }
.online-game-pick small { color: var(--text-dim); font-size: 12px; }
.online-step-cta { width: 100%; margin-top: 8px; }
.online-join-room-card {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(212, 168, 75, 0.35);
  background: rgba(212, 168, 75, 0.08);
}
.online-join-room-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.board-size-option.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 18px var(--accent-glow);
}
.join-room-group { display: flex; gap: 8px; }
.join-room-group input { flex: 1; text-transform: uppercase; text-align: center; letter-spacing: 4px; font-weight: 700; }
.join-room-group .btn { width: auto; padding: 12px 24px; }

.lobby-section { margin-top: 8px; }
.lobby-section h3 {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 10px;
  letter-spacing: 1px;
}
.lobby-list {
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.lobby-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}
.lobby-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}
.lobby-item:last-child { border-bottom: none; }
.lobby-item:hover { background: var(--surface2); }
.lobby-item-name { font-weight: 600; }
.lobby-dim {
  font-weight: 500;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1px;
}
.lobby-item-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  transition: all 0.2s;
}
.lobby-item-btn:hover { transform: scale(1.05); }

/* ─── Waiting Room ─── */
.waiting-content { text-align: center; }
.waiting-content h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 20px;
  margin-bottom: 20px;
}
.spinner {
  width: 50px; height: 50px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.room-code-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}
.room-code-display span { color: var(--text-dim); font-size: 14px; }
.room-code-display strong {
  font-family: 'Orbitron', sans-serif;
  font-size: 32px;
  letter-spacing: 6px;
  color: var(--accent);
  text-shadow: 0 0 15px var(--accent-glow);
}
.btn-copy {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
}
.btn-copy:hover { border-color: var(--accent); }
.waiting-hint { color: var(--text-dim); font-size: 14px; margin-bottom: 20px; }
#btnDestroyRoom { margin-bottom: 10px; width: 100%; max-width: 320px; }
.game-actions .btn-danger { margin-left: 8px; }

/* ═══════════════════════════════════════════════
   GAME SCREEN
   ═══════════════════════════════════════════════ */
.game-layout {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  gap: 12px;
  overflow-y: auto;
}

/* Standard header block (hidden in endless full-screen mode) */
.game-standard-ui {
  display: contents;
}
.game-standard-ui > * {
  width: 100%;
  max-width: 500px;
}
.layout-endless.game-layout {
  padding: 0;
  gap: 0;
  overflow: hidden;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.layout-endless .game-standard-ui {
  display: none;
}

/* ─── Endless: floating HUD + edge-to-edge grid ─── */
.endless-top-hud {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px 16px 10px;
  z-index: 25;
  background: linear-gradient(180deg, rgba(22, 18, 12, 0.94) 0%, rgba(35, 28, 18, 0.55) 100%);
  pointer-events: none;
}
.endless-top-hud > * {
  pointer-events: auto;
}
.layout-endless .endless-top-hud {
  display: flex;
  flex-wrap: wrap;
  row-gap: 10px;
}
.endless-fab {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(212, 168, 75, 0.45);
  background: linear-gradient(145deg, #4a3d28, #2a2215);
  color: #fcecc4;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow:
    0 4px 18px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 220, 160, 0.18);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.endless-fab:hover {
  transform: scale(1.06);
  box-shadow:
    0 6px 26px rgba(212, 168, 75, 0.45),
    inset 0 1px 0 rgba(255, 230, 180, 0.25);
}
.endless-fab:active { transform: scale(0.98); }
.endless-zoom-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
}
.endless-zoom-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(201, 162, 80, 0.55);
  background: linear-gradient(145deg, #3d3424, #221c12);
  color: #fcecc4;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 210, 140, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.endless-zoom-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(212, 168, 75, 0.4), inset 0 1px 0 rgba(255, 220, 160, 0.2);
}
.endless-zoom-btn:active {
  transform: scale(0.97);
}

.endless-turn-pill {
  min-width: 160px;
  padding: 12px 28px;
  border-radius: 999px;
  background: linear-gradient(145deg, #4a3f2a, #2a2215);
  border: 1px solid rgba(212, 175, 95, 0.55);
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-align: center;
  color: #ffe8a8;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(255, 200, 100, 0.35);
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 220, 160, 0.15);
}
.endless-score-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.endless-score-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(18, 14, 10, 0.78);
  border: 1px solid rgba(212, 175, 95, 0.28);
  font-size: 12px;
}
.endless-score-chip--x .endless-score-name { color: var(--x-color); }
.endless-score-chip--o .endless-score-name { color: var(--o-color); }
.endless-score-name {
  font-weight: 700;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.endless-score-val {
  font-family: 'Orbitron', sans-serif;
  font-size: 16px;
  font-weight: 900;
  color: var(--accent);
}
.endless-score-chip--winner {
  border-color: rgba(212, 175, 95, 0.75);
  box-shadow: 0 0 16px rgba(212, 168, 75, 0.35);
  animation: score-winner-pulse 1.2s ease-in-out infinite alternate;
}
.layout-endless .board-container {
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  align-self: stretch;
}
.board-zoom-spacer {
  display: contents;
}
.layout-endless .board-zoom-spacer {
  display: block;
  position: relative;
}
.layout-endless .board-inner {
  box-sizing: border-box;
  display: block;
  position: relative;
  cursor: crosshair;
}
.endless-grid-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  display: none;
}
.layout-endless .endless-grid-canvas {
  display: block;
}
.layout-endless .board {
  display: none !important;
  min-width: 0;
  min-height: 0;
  z-index: 2;
  gap: 0;
  background: transparent;
  box-shadow: none;
}
.layout-endless .cell {
  border-radius: 2px;
  border: 1px solid rgba(160, 130, 70, 0.35);
  background: var(--cream);
  color: #3d2e12;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: none;
}
.layout-endless .cell:hover:not(.taken):not(.disabled) {
  background: #fff6dc;
  transform: none;
  box-shadow: inset 0 0 0 1px rgba(212, 168, 75, 0.45);
  border-color: rgba(180, 140, 60, 0.55);
}
.layout-endless .cell.x-cell {
  color: #6b4a08;
  text-shadow: 0 0 12px rgba(232, 197, 71, 0.35);
  background: linear-gradient(180deg, #fff9e8 0%, #f8e8b8 100%);
}
.layout-endless .cell.o-cell {
  color: #5c3a12;
  text-shadow: 0 0 10px rgba(201, 149, 74, 0.35);
  background: linear-gradient(180deg, #fff4e0 0%, #edd4a8 100%);
}
.layout-endless .cell.win-cell.x-cell { background: rgba(232, 197, 71, 0.38); }
.layout-endless .cell.win-cell.o-cell { background: rgba(201, 149, 74, 0.36); }
.layout-endless .game-actions {
  display: none;
}

.game-topbar {
  width: 100%;
  max-width: 500px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.round-badge, .game-mode-badge {
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  letter-spacing: 2px;
}
.game-mode-badge { color: var(--accent); border-color: var(--accent); }

/* ─── Players Bar ─── */
.players-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 500px;
}
.player-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 2px solid var(--border);
  position: relative;
  transition: all 0.4s ease;
}
.player-card.active-turn {
  border-color: var(--x-color);
  box-shadow: 0 0 20px var(--x-glow);
}
.player-card.player-o.active-turn {
  border-color: var(--o-color);
  box-shadow: 0 0 20px var(--o-glow);
}
.player-symbol {
  font-family: 'Orbitron', sans-serif;
  font-size: 24px;
  font-weight: 900;
}
.player-x .player-symbol { color: var(--x-color); text-shadow: 0 0 10px var(--x-glow); }
.player-o .player-symbol { color: var(--o-color); text-shadow: 0 0 10px var(--o-glow); }
.player-info { display: flex; flex-direction: column; }
.player-name { font-size: 14px; font-weight: 600; }
.player-score {
  font-family: 'Orbitron', sans-serif;
  font-size: 20px;
  font-weight: 900;
  color: var(--accent);
}
.turn-indicator {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 40px;
  height: 3px;
  border-radius: 2px;
  background: var(--x-color);
  transition: transform 0.3s ease;
}
.player-o .turn-indicator { background: var(--o-color); }
.player-card.active-turn .turn-indicator { transform: translateX(-50%) scaleX(1); }

.vs-divider {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* ─── Game Status ─── */
.game-status {
  font-family: 'Orbitron', sans-serif;
  font-size: 16px;
  letter-spacing: 2px;
  color: var(--text-dim);
  text-align: center;
  min-height: 24px;
  transition: color 0.3s;
}

/* ─── Board size pickers ─── */
.board-size-hint {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
  line-height: 1.45;
}
.board-size-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.board-size-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}
.board-size-option {
  padding: 14px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.board-size-option:hover {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}
.board-size-option small {
  display: block;
  margin-top: 4px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
}
.board-size-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.size-chip {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-dim);
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
}
.size-chip:hover { border-color: var(--text-dim); color: var(--text); }
.size-chip.active {
  border-color: var(--x-color);
  color: var(--x-color);
  box-shadow: 0 0 12px var(--x-glow);
}
.online-board-row {
  margin-bottom: 16px;
}
.online-board-row label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.board-size-select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px;
  cursor: pointer;
}

/* ─── Board + scroll (cell zoom = pixel resize, no transform scale) ─── */
.board-container {
  position: relative;
  max-width: min(96vw, 600px);
  overflow: visible;
}
.board-zoom-viewport {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-height: min(52vh, 520px);
  min-height: 120px;
  border-radius: var(--radius);
  border: 1px solid rgba(100, 80, 45, 0.55);
  background: radial-gradient(ellipse 90% 70% at 50% 20%, #242018 0%, #100f0c 100%);
  touch-action: pan-x pan-y;
}
.layout-endless .board-zoom-viewport {
  max-height: none;
  flex: 1;
  min-width: 0;
  width: 100%;
  min-height: 0;
  height: 100%;
  border: none;
  border-radius: 0;
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: none;
  touch-action: none;
  background: radial-gradient(ellipse 100% 80% at 50% 15%, #252218 0%, #12110e 42%, #060605 100%);
  cursor: grab;
}
.layout-endless .board-zoom-viewport.board-pan-grabbing {
  cursor: grabbing;
  user-select: none;
}
.board-inner {
  position: relative;
  display: inline-block;
  vertical-align: top;
}
.board {
  display: grid;
  gap: 5px;
  position: relative;
  z-index: 2;
  padding: 4px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(212, 175, 95, 0.35) 0%, rgba(140, 110, 50, 0.25) 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.6), 0 4px 20px rgba(0, 0, 0, 0.45);
}
.cell {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  background: linear-gradient(165deg, #1e1c18 0%, #0c0b09 55%, #080706 100%);
  border: 1px solid #050504;
  border-radius: calc(var(--radius) - 2px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: 'Orbitron', sans-serif;
  font-size: 42px;
  font-weight: 900;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  user-select: none;
  box-shadow:
    inset 0 1px 0 rgba(212, 175, 95, 0.08),
    inset 0 -5px 14px rgba(0, 0, 0, 0.65);
}
.cell:hover:not(.taken):not(.disabled) {
  border-color: rgba(212, 175, 95, 0.45);
  background: linear-gradient(165deg, #28241c 0%, #12110e 100%);
  transform: scale(1.04);
  box-shadow:
    inset 0 0 0 1px rgba(212, 175, 95, 0.2),
    0 0 18px rgba(212, 168, 75, 0.25);
}
.cell.taken { cursor: default; }
.cell.disabled { cursor: default; opacity: 0.7; }

.cell-last-move {
  z-index: 1;
  position: relative;
}
.cell.x-cell.cell-last-move,
.cell.o-cell.cell-last-move {
  /* Pop runs on .classic-mark-wrap; here only the cell rim breathes */
  animation: last-move-cell-breathe 1.25s ease-in-out infinite;
}
@keyframes last-move-cell-breathe {
  0%, 100% {
    box-shadow:
      inset 0 0 0 2px rgba(255, 220, 150, 0.85),
      inset 0 0 28px rgba(212, 168, 75, 0.45),
      0 0 16px rgba(200, 150, 60, 0.55);
  }
  50% {
    box-shadow:
      inset 0 0 0 5px rgba(255, 245, 210, 0.95),
      inset 0 0 44px rgba(232, 197, 71, 0.55),
      0 0 32px rgba(212, 160, 70, 0.75);
  }
}

.cell.x-cell::before,
.cell.o-cell::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: -1;
  background: radial-gradient(ellipse 100% 90% at 35% 22%, #2e2a22 0%, #141210 58%, #060605 100%);
  box-shadow:
    inset 0 0 0 1px rgba(212, 175, 95, 0.18),
    inset 0 -6px 20px rgba(0, 0, 0, 0.88),
    inset 0 3px 10px rgba(55, 48, 35, 0.35);
  pointer-events: none;
}
.cell.x-cell,
.cell.o-cell {
  border-color: #0a0908;
  isolation: isolate;
}
/* Text fallback only if a mark is plain text (SVG marks ignore this) */
.cell.x-cell { color: #f2d65a; }
.cell.o-cell { color: #e8bc4a; }

.svg-defs-portal {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Classic 3×3: marks are SVG (.classic-mark-wrap); slab stays on ::before (z-index:-1) */
.game-layout:not(.layout-endless) .cell.x-cell,
.game-layout:not(.layout-endless) .cell.o-cell {
  background-color: transparent;
  box-shadow:
    inset 0 1px 0 rgba(212, 175, 95, 0.08),
    inset 0 -5px 14px rgba(0, 0, 0, 0.65);
}

.game-layout:not(.layout-endless) .cell.taken .classic-mark-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  pointer-events: none;
  animation: cell-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Metallic SVG: extra bloom + top-left specular (filter stays on SVG only) */
.game-layout:not(.layout-endless) .classic-mark-svg {
  width: 2.25em;
  height: 2.25em;
  max-width: 78%;
  max-height: 78%;
  overflow: visible;
  filter:
    drop-shadow(-1px -2px 1px rgba(255, 255, 255, 0.75))
    drop-shadow(0 -1px 2px rgba(255, 255, 255, 0.45))
    drop-shadow(0 2px 4px rgba(0, 0, 0, 0.88))
    drop-shadow(0 5px 12px rgba(0, 0, 0, 0.55))
    drop-shadow(0 0 18px rgba(255, 230, 160, 0.85))
    drop-shadow(0 0 32px rgba(255, 190, 80, 0.4));
  animation: classic-svg-metal-glint 4.8s ease-in-out infinite;
}

.game-layout:not(.layout-endless) .classic-mark-svg-o {
  animation-duration: 4s;
}

@keyframes classic-svg-metal-glint {
  0%, 100% {
    filter:
      drop-shadow(-1px -2px 1px rgba(255, 255, 255, 0.62))
      drop-shadow(0 0 4px rgba(255, 255, 255, 0.35))
      drop-shadow(0 2px 4px rgba(0, 0, 0, 0.82))
      drop-shadow(0 5px 11px rgba(0, 0, 0, 0.48))
      drop-shadow(0 0 14px rgba(255, 220, 150, 0.65))
      drop-shadow(0 0 26px rgba(255, 175, 60, 0.32));
  }
  50% {
    filter:
      drop-shadow(-2px -3px 2px rgba(255, 255, 255, 1))
      drop-shadow(0 0 10px rgba(255, 255, 255, 0.55))
      drop-shadow(0 2px 4px rgba(0, 0, 0, 0.72))
      drop-shadow(0 6px 14px rgba(0, 0, 0, 0.4))
      drop-shadow(0 0 28px rgba(255, 248, 220, 1))
      drop-shadow(0 0 48px rgba(255, 200, 90, 0.55));
  }
}
@keyframes cell-pop {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.cell.win-cell {
  animation: win-pulse 0.6s ease-in-out infinite alternate;
}
.cell.win-cell.x-cell::before,
.cell.win-cell.o-cell::before {
  background: radial-gradient(ellipse 100% 90% at 35% 22%, #3a3528 0%, #1a1812 100%);
  box-shadow:
    inset 0 0 0 2px rgba(232, 197, 71, 0.45),
    inset 0 -6px 20px rgba(0, 0, 0, 0.75);
}
@keyframes win-pulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.06); box-shadow: 0 0 25px var(--accent-glow); }
}

/* ─── Win Line SVG ─── */
.win-line-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}
.win-line-svg line {
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  filter: drop-shadow(0 0 8px var(--accent-glow));
  stroke-dasharray: 500;
  stroke-dashoffset: 500;
  transition: stroke-dashoffset 0.6s ease;
}
.win-line-svg line.drawn {
  stroke-dashoffset: 0;
}

/* ─── Game Actions ─── */
.game-actions { display: flex; gap: 12px; }
.game-actions .btn { width: auto; padding: 12px 28px; }

/* ─── Chat ─── */
.chat-box {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  z-index: 50;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.chat-header {
  padding: 10px 14px;
  background: var(--surface2);
  font-weight: 600;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.chat-messages {
  height: 160px;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-msg {
  font-size: 13px;
  padding: 8px 11px;
  border-radius: 12px;
  max-width: 85%;
  word-break: break-word;
}
.chat-msg.own-msg {
  align-self: flex-end;
  background: rgba(212, 168, 75, 0.22);
  border: 1px solid rgba(212, 168, 75, 0.45);
  border-bottom-right-radius: 4px;
}
.chat-msg.other-msg {
  align-self: flex-start;
  background: var(--surface2);
  border: 1px solid rgba(212, 168, 75, 0.2);
  border-left: 3px solid var(--accent);
  border-bottom-left-radius: 4px;
}
.chat-msg .msg-sender { font-weight: 700; font-size: 11px; margin-bottom: 2px; color: rgba(255, 240, 210, 0.95); }
.chat-msg .msg-text { color: rgba(255, 240, 210, 0.9); }
.chat-input-row { display: flex; border-top: 1px solid var(--border); }
.chat-input-row input {
  flex: 1;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  outline: none;
}
.btn-send {
  background: var(--accent);
  border: none;
  color: white;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s;
}
.btn-send:hover { background: #a67c2a; }

/* ─── Result Overlay ─── */
.result-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.result-overlay.show {
  opacity: 1;
  pointer-events: all;
}
.result-card {
  text-align: center;
  animation: result-bounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 8px 12px;
}
.result-overlay.show .result-card {
  animation: result-bounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), result-glow 1.8s ease-in-out infinite alternate;
}
@keyframes result-glow {
  0% { filter: drop-shadow(0 0 8px rgba(212, 168, 75, 0.2)); }
  100% { filter: drop-shadow(0 0 22px rgba(212, 168, 75, 0.55)); }
}
.result-scores {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
  min-width: 220px;
}
.result-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(30, 24, 16, 0.72);
  border: 1px solid rgba(212, 175, 95, 0.22);
}
.result-score-row--winner {
  border-color: rgba(212, 175, 95, 0.7);
  background: rgba(212, 168, 75, 0.16);
  box-shadow: 0 0 18px rgba(212, 168, 75, 0.28);
}
.result-score-name {
  font-weight: 700;
  font-size: 15px;
  color: rgba(255, 240, 210, 0.95);
}
.result-score-val {
  font-family: 'Orbitron', sans-serif;
  font-size: 22px;
  font-weight: 900;
  color: var(--accent);
}
.player-card.score-winner-flash {
  animation: score-winner-pulse 1s ease-in-out infinite alternate;
}
@keyframes score-winner-pulse {
  0% { box-shadow: 0 0 12px rgba(212, 168, 75, 0.25); transform: scale(1); }
  100% { box-shadow: 0 0 28px rgba(212, 168, 75, 0.55); transform: scale(1.02); }
}
.win-flower-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99;
  overflow: hidden;
}
.win-flower {
  position: absolute;
  font-size: clamp(22px, 4vw, 38px);
  line-height: 1;
  opacity: 0;
  animation: win-flower-drift 3.6s ease-out forwards;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.35));
}
@keyframes win-flower-drift {
  0% { opacity: 0; transform: scale(0.25) rotate(0deg); }
  12% { opacity: 1; transform: scale(1) rotate(12deg); }
  100% { opacity: 0; transform: translate(var(--fx), var(--fy)) scale(1.15) rotate(380deg); }
}
@keyframes result-bounce {
  0% { transform: scale(0.3); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.result-icon { font-size: 72px; margin-bottom: 12px; }
.result-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 36px;
  font-weight: 900;
  margin-bottom: 8px;
  background: linear-gradient(90deg, var(--x-color), var(--accent), var(--o-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.result-sub { font-size: 18px; color: var(--text-dim); }

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface2);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 200;
  opacity: 0;
  transition: all 0.4s ease;
  pointer-events: none;
  box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ─── Tanzaverse: all games hub ─── */
.games-hub-wrap {
  max-width: 520px;
}
.games-hub-brand {
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 8px;
  text-align: center;
}
.games-hub-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(32px, 8vw, 44px);
  font-weight: 900;
  text-align: center;
  margin: 0 0 10px;
  background: linear-gradient(135deg, #fff8e0, var(--accent), #c9a227);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.games-hub-sub {
  text-align: center;
  color: var(--text-dim);
  font-size: 15px;
  margin: 0 0 28px;
}
.games-picker-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.game-picker-tile {
  display: block;
  width: 100%;
  text-align: left;
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(165deg, var(--surface2) 0%, var(--surface) 100%);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  font-family: inherit;
}
.game-picker-tile:hover {
  border-color: rgba(212, 175, 95, 0.55);
  box-shadow: 0 0 24px rgba(212, 175, 95, 0.18);
  transform: translateY(-2px);
}
.game-picker-icon {
  display: block;
  font-size: 28px;
  margin-bottom: 8px;
}
.game-picker-name {
  display: block;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 17px;
  margin-bottom: 4px;
  color: var(--accent);
}
.game-picker-desc {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.4;
}
.hub-back-to-all {
  margin-bottom: 16px;
  align-self: flex-start;
}

/* ─── Subgames (cards, checkers) ─── */
.subgame-wrap {
  max-width: 640px;
}
.cards-mp-wrap {
  max-width: min(1400px, calc(100vw - 24px));
}
.cards-mp-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px 16px;
  margin-bottom: 4px;
}
.cards-mp-title-block {
  flex: 1;
  min-width: 200px;
}
.cards-mp-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.cards-mp-page-title {
  margin: 0;
}
.cards-subgame-teaser {
  margin-top: 6px;
}
.cards-help-icon-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 95, 0.45);
  background: rgba(30, 26, 20, 0.9);
  color: var(--accent);
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
}
.cards-help-icon-btn:hover {
  background: rgba(212, 175, 95, 0.12);
  border-color: rgba(212, 175, 95, 0.7);
  transform: scale(1.04);
}
.cards-help-icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.cards-help-icon-svg {
  width: 22px;
  height: 22px;
}
.cards-lobby {
  margin-bottom: 8px;
}
.cards-lobby-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
@media (max-width: 520px) {
  .cards-lobby-grid {
    grid-template-columns: 1fr;
  }
}
.cards-lobby-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cards-field-label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.cards-input,
.cards-select {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.cards-input-code {
  max-width: 120px;
  text-transform: uppercase;
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 0.12em;
}
.cards-lobby-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.cards-join-inline {
  display: flex;
  gap: 8px;
  align-items: center;
}
.cards-open-rooms-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(212, 175, 95, 0.2);
}
.cards-open-rooms-heading {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 6px;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.cards-open-rooms-live {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.45;
  opacity: 0.9;
}
.cards-open-rooms-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 10px;
}
.cards-open-rooms-empty {
  margin: 0 0 12px;
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.45;
}
.cards-open-rooms-empty[hidden] {
  display: none !important;
}
.cards-open-room-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  transition: background 0.15s;
}
.cards-open-room-row:last-child {
  border-bottom: none;
}
.cards-open-room-row:hover {
  background: var(--surface2);
}
.cards-open-room-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  flex: 1 1 auto;
  position: relative;
  z-index: 1;
}
/* Dedicated control — do not use global .btn here (that rule sets width:100% and caused overlap). */
.cards-open-room-join-btn {
  flex: 0 0 auto;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 5.5rem;
  padding: 9px 20px;
  margin: 0;
  border-radius: 999px;
  border: 1px solid rgba(52, 211, 153, 0.65);
  background: linear-gradient(165deg, rgba(22, 101, 52, 0.55) 0%, rgba(6, 78, 59, 0.75) 100%);
  color: #ecfdf5;
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.35),
    0 0 18px rgba(34, 197, 94, 0.2);
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.15s ease;
}
.cards-open-room-join-btn:hover {
  border-color: rgba(110, 231, 183, 0.95);
  background: linear-gradient(165deg, rgba(34, 120, 72, 0.75) 0%, rgba(8, 95, 72, 0.9) 100%);
  box-shadow:
    0 3px 12px rgba(0, 0, 0, 0.4),
    0 0 22px rgba(52, 211, 153, 0.35);
  transform: translateY(-1px);
}
.cards-open-room-join-btn:active {
  transform: translateY(0);
}
.cards-open-room-join-btn:focus-visible {
  outline: 2px solid var(--success);
  outline-offset: 2px;
}
@media (max-width: 400px) {
  .cards-open-room-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .cards-open-room-join-btn {
    width: 100%;
    min-width: 0;
  }
}
.cards-open-room-code {
  display: block;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.16em;
  line-height: 1.2;
  color: var(--x-color);
  text-shadow: 0 0 24px rgba(232, 197, 71, 0.25);
}
.cards-open-room-meta {
  display: block;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-dim);
}
.cards-room-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(212, 175, 95, 0.32);
  background: rgba(0, 0, 0, 0.22);
  margin-bottom: 10px;
  font-size: 14px;
}
.cards-lobby-room-code {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(17px, 5vw, 22px);
  letter-spacing: 0.2em;
  color: var(--x-color);
}
@media (max-width: 720px) {
  .cards-announce-opt {
    min-width: 2.35rem;
    min-height: 38px;
    padding: 6px 8px;
    font-size: 11px;
  }
}
.cards-lobby-players-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 8px;
}
.cards-mp-player-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.cards-mp-player-li {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 95, 0.2);
  margin-bottom: 6px;
  font-size: 14px;
}
.cards-game-section {
  margin-top: 4px;
}
#playingCardsScreen.screen.active > .menu-container.cards-mp-wrap {
  /* Use most of the viewport on phones/tablets/desktops; cap width on ultra-wide monitors */
  width: min(1400px, calc(100vw - clamp(16px, 4vw, 48px)));
  max-width: min(1400px, calc(100vw - clamp(16px, 4vw, 48px)));
  max-height: 100dvh;
  height: 100dvh;
  padding-top: max(10px, env(safe-area-inset-top, 0px));
  padding-right: max(14px, env(safe-area-inset-right, 0px));
  padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
  padding-left: max(14px, env(safe-area-inset-left, 0px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  box-sizing: border-box;
}
#playingCardsScreen.screen.active .cards-lobby {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#cardsGameSection.cards-game-section:not([hidden]) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-top: 0;
}
.cards-game-fit {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 4px;
  overflow: hidden;
}
.cards-game-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px 14px;
  flex-shrink: 0;
}
.cards-mp-room-line--compact {
  margin-bottom: 0;
  font-size: 13px;
  line-height: 1.35;
  flex: 1 1 auto;
  min-width: 0;
}
.cards-mp-meta--compact {
  margin-bottom: 0;
}
.cards-spectator-bar--compact {
  margin: 0;
  padding: 6px 10px;
  font-size: 12px;
  flex-shrink: 0;
}
.cards-mp-opponents--compact {
  margin-bottom: 0;
  gap: 6px;
  flex-shrink: 0;
  max-height: 48px;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  justify-content: flex-start;
  padding-bottom: 2px;
}
.cards-mp-opponents--compact .cards-mp-opponent {
  min-width: 0;
  padding: 6px 10px;
  flex: 0 0 auto;
}
.cards-mp-opponents--compact .cards-mp-opponent-name {
  font-size: 12px;
}
.cards-mp-opponents--compact .cards-mp-opponent-count {
  font-size: 10px;
  margin-top: 2px;
}
.cards-mp-center--fit {
  flex: 1 1 0;
  min-height: 0;
  /* Fill space between top bar and hand; do not cap with vh here — that fought flex and clipped the 3D view */
  max-height: none;
  margin-bottom: 0;
  gap: 4px;
  /* Keep horizontal overflow clipped, but allow HUD content (like action buttons)
     to remain visible when the table top grows. */
  overflow-x: hidden;
  overflow-y: visible;
}
.cards-mp-table-stage {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  /* Must be able to shrink inside flex; vh-based mins caused “table cut in half” on phones */
  min-height: 0;
  max-height: none;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
}
@media (min-width: 900px) {
  .cards-mp-table-stage {
    min-height: 200px;
  }
}
/* 3D fills the stage; actions live in .cards-mp-action-dock below (mobile-friendly, no overlap). */
.cards-mp-table-stage > .cards-3d-host.cards-3d-host--fit {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  flex: none;
  min-height: 0 !important;
  max-height: none !important;
}
.cards-mp-table-stage--drop-hover {
  box-shadow: inset 0 0 0 3px rgba(52, 211, 153, 0.45);
}
.cards-play-hint--mobile {
  display: none;
}
@media (max-width: 720px) {
  .cards-play-hint--mobile:not([hidden]) {
    display: block;
    position: absolute;
    left: 5px;
    right: 5px;
    bottom: 5px;
    z-index: 4;
    margin: 0;
    padding: 6px 8px;
    font-size: 11px;
    line-height: 1.4;
    color: rgba(247, 236, 216, 0.9);
    text-align: center;
    pointer-events: none;
    background: rgba(8, 6, 4, 0.72);
    border-radius: 10px;
    border: 1px solid rgba(212, 175, 95, 0.28);
  }
}
.cards-mp-table-top.cards-mp-table-hud,
.cards-mp-action-dock {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: 2;
  flex-shrink: 0;
  width: 100%;
  max-height: none;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: visible;
  pointer-events: auto;
  -webkit-overflow-scrolling: touch;
}
.cards-mp-pile-view-row {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  min-width: 0;
  flex: 0 0 auto;
  border-radius: var(--radius);
  border: 1px solid rgba(212, 175, 95, 0.28);
  background: rgba(0, 0, 0, 0.22);
}
.cards-mp-pile-view-row[hidden] {
  display: none !important;
}
.cards-pile-view-label {
  flex-shrink: 0;
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(212, 175, 95, 0.75);
  line-height: 1.2;
}
.cards-table-action-btn--pile-turn {
  min-width: 36px;
  padding: 4px 8px;
  font-size: 15px;
  line-height: 1;
}
.cards-mp-table-top {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 10px 12px;
  background: linear-gradient(180deg, rgba(22, 18, 14, 0.98) 0%, rgba(12, 10, 8, 0.99) 100%);
  border: 1px solid rgba(212, 175, 95, 0.28);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
}
.cards-game-topbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}
.cards-mp-room-code-strong {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(15px, 4.2vw, 20px);
  letter-spacing: 0.18em;
  color: var(--x-color);
  text-shadow: 0 0 20px rgba(232, 197, 71, 0.35);
}
.cards-topbar-reshuffle-btn {
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  flex: 0 0 auto;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.55);
  background: linear-gradient(165deg, rgba(120, 53, 15, 0.75), rgba(55, 28, 8, 0.9));
  color: #fff7ed;
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}
.cards-topbar-reshuffle-btn:hover:not(:disabled) {
  border-color: rgba(253, 224, 71, 0.85);
  background: linear-gradient(165deg, rgba(146, 64, 14, 0.85), rgba(67, 32, 10, 0.95));
}
.cards-topbar-reshuffle-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.cards-lobby-cta {
  width: auto !important;
  min-width: min(100%, 220px);
  min-height: 48px;
  justify-content: center;
  text-align: center;
  padding-left: 20px;
  padding-right: 20px;
}
.cards-join-inline .cards-lobby-cta {
  min-width: 0;
  flex: 1 1 auto;
}
.cards-host-actions .cards-lobby-cta {
  min-width: min(100%, 200px);
}
body.cards-hand-drag-active {
  cursor: grabbing;
  user-select: none;
}
body.cards-hand-drag-active .cards-mp-hand-zone--fit {
  touch-action: none;
}
.playing-card--dragging {
  opacity: 0.35;
}
.playing-card--drag-ghost {
  position: fixed;
  z-index: 20050;
  pointer-events: none;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.65),
    0 0 0 2px rgba(212, 175, 95, 0.5);
  transform: scale(1.06) rotate(-2deg);
}
.cards-mp-table-top[hidden] {
  display: none !important;
}
.cards-mp-announce-strip {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(212, 175, 95, 0.28);
  background: rgba(0, 0, 0, 0.22);
}
.cards-announce-compact-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 8px;
  min-width: 0;
}
.cards-announce-strip-title {
  flex-shrink: 0;
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  line-height: 1.2;
}

/* Primary action buttons: match reference UI (big centered DRAW / ACCEPT PENALTY). */
.cards-primary-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px 0 6px;
}

.cards-primary-btn {
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  width: min(340px, 92vw);
  height: 56px;
  border-radius: 16px;
  border: 1px solid rgba(212, 175, 95, 0.7);
  background: linear-gradient(180deg, rgba(255, 209, 96, 0.95) 0%, rgba(206, 140, 40, 0.95) 100%);
  color: #201509;
  font-family: 'Orbitron', sans-serif;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
}

.cards-primary-btn:hover:not(:disabled) {
  filter: brightness(1.05);
}

.cards-primary-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.cards-primary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.cards-primary-btn--warn {
  border-color: rgba(255, 150, 100, 0.6);
  background: linear-gradient(180deg, rgba(255, 186, 120, 0.95) 0%, rgba(200, 70, 40, 0.95) 100%);
  color: #250c09;
}

.cards-primary-btn--pass {
  border-color: rgba(212, 175, 95, 0.35);
  background: linear-gradient(180deg, rgba(60, 44, 28, 0.95) 0%, rgba(26, 20, 13, 0.95) 100%);
  color: rgba(255, 246, 230, 0.95);
}
.cards-announce-help-tip {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 95, 0.45);
  background: rgba(0, 0, 0, 0.4);
  color: var(--accent);
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: help;
}
.cards-announce-help-tip:hover {
  border-color: rgba(212, 175, 95, 0.85);
  background: rgba(40, 32, 22, 0.75);
}
.cards-declare-panel--inline {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  flex: 1 1 120px;
  min-width: 0;
}
.cards-declare-banks {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  min-width: 0;
}
.cards-declare-bank {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}
.cards-declare-bank-lbl {
  flex-shrink: 0;
  width: 1.1rem;
  text-align: center;
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(212, 175, 95, 0.85);
}
.cards-declare-btns--inline {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 3px;
}
.cards-announce-opt {
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  min-width: 1.65rem;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid rgba(212, 175, 95, 0.4);
  background: rgba(0, 0, 0, 0.42);
  color: rgba(255, 246, 230, 0.95);
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  line-height: 1.15;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.1s ease;
}
.cards-announce-opt:hover:not(:disabled) {
  border-color: rgba(212, 175, 95, 0.75);
  background: rgba(35, 28, 20, 0.75);
}
.cards-announce-opt:active:not(:disabled) {
  transform: scale(0.96);
}
.cards-announce-opt:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.cards-announce-opt--accent {
  border-color: rgba(212, 175, 95, 0.65);
  color: var(--accent);
}
.cards-mp-table-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 6px;
}
.cards-mp-actions--table {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 6px;
  flex: 0 1 auto;
  max-width: 100%;
  margin: 0;
}
.cards-table-action-btn {
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  border: 1px solid rgba(212, 175, 95, 0.4);
  background: rgba(0, 0, 0, 0.5);
  color: rgba(255, 246, 230, 0.95);
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(10px, 2.8vw, 11px);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 999px;
  line-height: 1.25;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 2px 10px rgba(0, 0, 0, 0.35);
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease,
    transform 0.12s ease;
}
.cards-table-action-btn:hover:not(:disabled) {
  border-color: rgba(212, 175, 95, 0.75);
  background: rgba(30, 24, 18, 0.75);
}
.cards-table-action-btn:active:not(:disabled) {
  transform: scale(0.97);
}
.cards-table-action-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
.cards-table-action-btn--draw {
  border-color: rgba(212, 175, 95, 0.62);
  color: var(--accent);
}
.cards-table-action-btn--warn {
  border-color: rgba(255, 150, 100, 0.5);
  color: #ffc4a8;
}
.cards-table-action-btn--muted {
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--text-dim);
}
.cards-table-action-btn--ghost {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  color: rgba(210, 200, 185, 0.88);
}
.cards-table-action-btn--host {
  border-color: rgba(130, 190, 255, 0.38);
  color: #b8dcff;
}
.cards-table-hint--compact {
  margin: 0;
  font-size: 11px;
}
.cards-wild-suit--compact {
  margin: 0;
  font-size: 11px;
}
.cards-mp-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.cards-mp-actions--compact {
  flex: 1 1 auto;
  margin-bottom: 0;
  gap: 6px;
}
.cards-mp-actions--compact .btn-sm {
  padding: 8px 12px;
  font-size: 12px;
}
.cards-announce-chip {
  flex-shrink: 0;
  white-space: nowrap;
}
.cards-announcements--compact {
  margin-bottom: 0;
  padding: 6px 10px;
  max-height: 64px;
  overflow-y: auto;
  flex-shrink: 0;
}
.cards-mp-status--compact {
  margin: 0;
  font-size: clamp(13px, 3.6vw, 15px);
  line-height: 1.4;
  min-height: 0;
  flex-shrink: 0;
  padding: 4px 0;
}
.cards-mp-hand-zone--fit {
  margin-top: 0;
  flex-shrink: 1;
  flex-grow: 0;
  min-height: 0;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  max-height: min(32vh, 260px);
  padding-bottom: max(6px, env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}
.cards-zone-label--compact {
  margin-bottom: 6px;
  font-size: clamp(11px, 3vw, 12px);
  letter-spacing: 0.14em;
}
.cards-hand--fit {
  flex: 1 1 auto;
  min-height: 78px;
  max-height: min(22vh, 200px);
  overflow-x: auto;
  overflow-y: visible;
  flex-wrap: nowrap;
  align-items: flex-end;
  padding-bottom: 6px;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
}
.cards-hand--fit.cards-hand--dense {
  max-height: min(20vh, 190px);
}
.cards-mp-hand-zone--fit .cards-hand.cards-hand--fit {
  min-height: 78px;
  max-height: min(22vh, 200px);
  overflow-y: visible;
  overflow-x: auto;
  flex-wrap: nowrap;
  align-content: flex-end;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pinch-zoom;
}
.cards-mp-hand-zone--fit .playing-card--clickable {
  touch-action: manipulation;
}
@media (min-width: 768px) {
  .cards-mp-hand-zone--fit {
    max-height: min(28vh, 280px);
  }
  .cards-hand--fit,
  .cards-mp-hand-zone--fit .cards-hand.cards-hand--fit {
    max-height: min(26vh, 240px);
  }
}
@media (min-width: 1100px) {
  .cards-mp-hand-zone--fit {
    max-height: min(32vh, 320px);
  }
  .cards-hand--fit,
  .cards-mp-hand-zone--fit .cards-hand.cards-hand--fit {
    max-height: min(30vh, 300px);
  }
  #playingCardsScreen.screen.active .cards-mp-hand-zone--fit .playing-card {
    width: clamp(72px, 5.5vw, 96px);
  }
  #playingCardsScreen.screen.active .cards-mp-hand-zone--fit .playing-card-center {
    font-size: clamp(22px, 2.2vw, 30px);
  }
  #playingCardsScreen.screen.active .cards-mp-hand-zone--fit .playing-card-corner {
    font-size: clamp(10px, 0.95vw, 12px);
  }
}
.cards-3d-canvas-wrap canvas.cards-3d-canvas--drawable {
  cursor: pointer;
}

.cards-shuffle-overlay {
  position: fixed;
  inset: 0;
  z-index: 24000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(5px);
  padding: 20px;
  pointer-events: none;
}
.cards-shuffle-overlay--lobby {
  background: rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(3px);
  align-items: flex-start;
  padding-top: min(10vh, 72px);
}
.cards-shuffle-overlay[hidden] {
  display: none !important;
}
.cards-shuffle-panel {
  max-width: 380px;
  padding: 22px 26px;
  border-radius: 14px;
  border: 1px solid rgba(212, 175, 95, 0.5);
  background: linear-gradient(168deg, rgba(38, 32, 26, 0.97) 0%, rgba(10, 8, 6, 0.99) 100%);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  text-align: center;
}
.cards-shuffle-title {
  margin: 0 0 8px;
  font-family: 'Orbitron', sans-serif;
  font-size: 15px;
  color: var(--accent);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.cards-shuffle-sub {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-dim);
}
.cards-shuffle-progress {
  position: relative;
  height: 7px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.4);
}
.cards-shuffle-progress-track {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(212, 175, 95, 0.08), rgba(212, 175, 95, 0.18), rgba(212, 175, 95, 0.08));
}
.cards-shuffle-progress-bar {
  position: absolute;
  top: 0;
  left: -45%;
  width: 45%;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, rgba(212, 175, 95, 0.35), var(--accent), rgba(212, 175, 95, 0.35), transparent);
  animation: cards-shuffle-slide 0.95s ease-in-out infinite;
}
@keyframes cards-shuffle-slide {
  0% {
    left: -45%;
  }
  100% {
    left: 100%;
  }
}
.cards-declare-modal {
  z-index: 26000;
}
.cards-declare-modal-inner {
  position: relative;
  max-width: min(520px, 100%);
  max-height: min(85vh, 720px);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(165deg, #1e1a16 0%, #0d0b09 100%);
}
.cards-declare-modal-title {
  margin: 0;
  padding: 18px 48px 10px 20px;
  font-family: 'Orbitron', sans-serif;
  font-size: 15px;
  color: var(--accent);
  letter-spacing: 0.06em;
}
.cards-declare-modal-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 18px 18px;
  -webkit-overflow-scrolling: touch;
}
.cards-declare-panel--modal {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
}
.cards-declare-panel--modal .cards-declare-help {
  margin-top: 0;
}
.cards-spectator-bar {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(212, 175, 95, 0.4);
  background: rgba(80, 40, 20, 0.35);
  font-size: 13px;
  line-height: 1.45;
  color: var(--accent);
}
.cards-spectator-bar[hidden] {
  display: none !important;
}
.cards-mp-room-line {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.cards-mp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.cards-meta-chip {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 95, 0.35);
  color: var(--accent);
  font-family: 'Orbitron', sans-serif;
}
.cards-meta-effect {
  color: var(--text-dim);
  border-color: rgba(255, 255, 255, 0.12);
}
.cards-mp-opponents {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  justify-content: center;
}
.cards-mp-opponent {
  position: relative;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 95, 0.25);
  background: linear-gradient(165deg, var(--surface2) 0%, var(--surface) 100%);
  min-width: 120px;
  text-align: center;
}
.cards-mp-opponent--turn {
  border-color: rgba(212, 175, 95, 0.65);
  box-shadow: 0 0 16px rgba(212, 175, 95, 0.2);
}
.cards-mp-opponent-name {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--accent);
}
.cards-mp-opponent-count {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}
.cards-mp-turn-dot {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6d4;
  box-shadow: 0 0 8px rgba(102, 221, 68, 0.6);
}
.cards-mp-center {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 18px;
}
/* In-game column uses both classes; keep compact gap/margin (base .cards-mp-center comes later in file). */
.cards-mp-center.cards-mp-center--fit {
  gap: 4px;
  margin-bottom: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cards-3d-host {
  position: relative;
  width: 100%;
  min-height: 300px;
  max-height: min(42vh, 420px);
  border-radius: var(--radius);
  overflow: hidden;
  background: radial-gradient(ellipse 120% 80% at 50% 30%, #1a1510 0%, #0a0806 72%);
  border: 1px solid rgba(212, 175, 95, 0.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 12px 40px rgba(0, 0, 0, 0.55);
}

.cards-3d-canvas-wrap {
  position: absolute;
  inset: 0;
}

.cards-3d-canvas-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.cards-3d-overlays {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 14px;
  gap: 12px;
}
.cards-3d-badge {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-family: 'Orbitron', sans-serif;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.9);
}

.cards-3d-badge strong {
  color: var(--accent);
  font-weight: 600;
  margin-left: 4px;
}

.cards-discard-pile--3d {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.cards-mp-deck-zone {
  flex: 0 0 auto;
}
.cards-deck-static {
  cursor: default;
  pointer-events: none;
}
.cards-deck-static:hover {
  transform: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 6px 20px rgba(0, 0, 0, 0.5);
}
.cards-mp-discard-wrap {
  flex: 0 0 auto;
  min-width: 100px;
}
.cards-wild-suit {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--accent);
  font-family: 'Orbitron', sans-serif;
}
.cards-mp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.cards-announcements {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(212, 175, 95, 0.35);
  background: rgba(0, 0, 0, 0.22);
}
.cards-announcements[hidden] {
  display: none !important;
}
.cards-announcements-title {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  font-family: 'Orbitron', sans-serif;
}
.cards-announcements-list {
  margin: 0;
  padding-left: 1.25em;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}
.cards-announcement-li--you {
  color: var(--accent);
}
.cards-announce-title {
  margin: 0 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.cards-mp-status {
  min-height: 22px;
  font-size: 14px;
  color: var(--text-dim);
  margin: 0 0 12px;
}
.cards-mp-hand-zone {
  margin-top: 8px;
}
.cards-mp-hand-zone .cards-hand {
  max-height: 240px;
  overflow-x: auto;
  overflow-y: auto;
  padding-bottom: 8px;
  align-content: flex-start;
}
.cards-hand--dense .playing-card {
  width: 52px;
}
.cards-hand--dense .playing-card-center {
  font-size: 22px;
}
.cards-hand--dense .playing-card-corner {
  font-size: 10px;
}
.cards-hand--dense .playing-card-corner-tl {
  top: 4px;
  left: 4px;
}
.cards-hand--dense .playing-card-corner-br {
  bottom: 4px;
  right: 4px;
}
.cards-table-hint {
  font-size: 13px;
  color: var(--accent);
  margin: 0 0 10px;
  line-height: 1.4;
}
.cards-table-empty {
  display: block;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.4;
  max-width: 200px;
}
.cards-host-setup {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(212, 175, 95, 0.28);
  background: rgba(0, 0, 0, 0.22);
  margin-bottom: 16px;
}
.cards-host-setup-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.cards-deal-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.45;
}
.cards-in-room {
  margin-top: 8px;
}
.cards-flow-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin: 14px 0 8px;
}
.cards-steps {
  margin: 0 0 14px;
  padding-left: 1.25rem;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.55;
}
.cards-steps li {
  margin-bottom: 6px;
}
.cards-deck-status {
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
  font-family: 'Orbitron', sans-serif;
  line-height: 1.4;
}
.cards-deck-status--wait {
  border: 1px solid rgba(255, 180, 100, 0.35);
  background: rgba(60, 35, 10, 0.28);
  color: var(--text-dim);
}
.cards-deck-status--ready {
  border: 1px solid rgba(120, 200, 130, 0.45);
  background: rgba(15, 55, 28, 0.28);
  color: #9fdf9f;
}
.cards-lobby-table-label {
  margin: 0 0 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-dim);
  font-family: 'Orbitron', sans-serif;
}
.cards-3d-host.cards-3d-lobby-host {
  min-height: 200px;
  max-height: min(36vh, 320px);
  margin-bottom: 16px;
}
.cards-3d-overlays--lobby {
  padding-top: 10px;
}
.cards-role-badge {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 10px;
  font-family: 'Orbitron', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.cards-role-badge--host {
  border: 1px solid rgba(212, 175, 95, 0.55);
  color: var(--accent);
}
.cards-role-badge--guest {
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-dim);
}
.cards-host-label {
  margin: 0 0 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-family: 'Orbitron', sans-serif;
}
.cards-host-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
}
.cards-guest-lobby {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px dashed rgba(212, 175, 95, 0.32);
  margin-bottom: 16px;
  background: rgba(0, 0, 0, 0.15);
}
.cards-guest-lobby-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-dim);
}
.cards-declare-panel {
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(212, 175, 95, 0.28);
  margin-bottom: 14px;
  background: rgba(0, 0, 0, 0.18);
}

/* Ensure inline declare panel stays inside the compact announce strip. */
.cards-declare-panel.cards-declare-panel--inline {
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  flex: 1 1 120px;
  min-width: 0;
}
.cards-declare-help {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-dim);
}
.cards-declare-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 560px) {
  .cards-declare-tables {
    grid-template-columns: 1fr;
  }
}
.cards-declare-col-title {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 8px;
  font-family: 'Orbitron', sans-serif;
}
.cards-declare-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.playing-card--clickable {
  cursor: pointer;
  transition:
    transform 0.14s ease,
    box-shadow 0.18s ease;
}
.playing-card--clickable:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.32);
}
.playing-card--selected {
  outline: 2px solid rgba(212, 175, 95, 0.9);
  outline-offset: 2px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.playing-card-joker-corner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}
.playing-card-joker-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'DejaVu Sans', sans-serif;
  font-weight: 800;
  font-size: 7px;
  line-height: 0.92;
  letter-spacing: 0.02em;
  color: #0a0a0a;
  text-transform: uppercase;
}
.playing-card-joker-svg {
  width: 62%;
  height: 72%;
  max-width: 78px;
  max-height: 104px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.playing-card-joker-svg-inner {
  width: 100%;
  height: 100%;
  display: block;
}
.cards-winner-overlay {
  margin-top: 20px;
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid rgba(212, 175, 95, 0.45);
  background: rgba(10, 8, 6, 0.92);
  text-align: center;
}
.cards-winner-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 22px;
  color: var(--accent);
  margin: 0 0 16px;
}
.cards-winner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
}
.cards-modal {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.cards-modal[hidden] {
  display: none !important;
}
.cards-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}
.cards-modal-inner {
  position: relative;
  z-index: 1;
  padding: 24px 28px;
  border-radius: 16px;
  border: 1px solid rgba(212, 175, 95, 0.5);
  background: linear-gradient(165deg, #1e1a16 0%, #0d0b09 100%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  max-width: 360px;
  width: 100%;
}
.cards-modal-title {
  margin: 0 0 16px;
  font-family: 'Orbitron', sans-serif;
  font-size: 16px;
  color: var(--accent);
  text-align: center;
}
.cards-rules-modal {
  z-index: 25000;
}
.cards-rules-modal-inner {
  position: relative;
  max-width: min(720px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  background:
    linear-gradient(165deg, rgba(42, 34, 24, 0.97) 0%, rgba(18, 16, 13, 0.98) 55%, #0a0806 100%);
  border: 1px solid rgba(212, 175, 95, 0.4);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 24px 80px rgba(0, 0, 0, 0.65);
}
.cards-rules-modal-title {
  margin: 0;
  padding: 20px 52px 14px 24px;
  font-family: 'Orbitron', sans-serif;
  font-size: 18px;
  color: var(--accent);
  text-align: left;
  letter-spacing: 0.04em;
}
.cards-rules-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 24px 16px;
  -webkit-overflow-scrolling: touch;
}
.cards-rules-body {
  color: #e8dcc8;
  font-size: 14px;
  line-height: 1.55;
}
.cards-rules-body p {
  margin: 0 0 14px;
}
.cards-rules-body p:last-child {
  margin-bottom: 0;
}
.cards-rules-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cards-rules-close:hover {
  background: rgba(212, 175, 95, 0.15);
  color: var(--accent);
}
.cards-rules-room-line {
  margin: 0;
  padding: 12px 24px 20px;
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: 'Orbitron', sans-serif;
  border-top: 1px solid rgba(212, 175, 95, 0.15);
}
.cards-rules-room-line strong {
  color: var(--accent);
  font-weight: 600;
}
button.cards-modal-backdrop {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  appearance: none;
  font: inherit;
  color: transparent;
}
.cards-suit-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.subgame-title {
  margin-top: 8px;
}
.subgame-blurb {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0 0 20px;
  line-height: 1.45;
}
.cards-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}
.btn-sm {
  padding: 10px 16px;
  font-size: 13px;
}
.cards-layout {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
@media (min-width: 600px) {
  .cards-layout {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
  }
  .cards-pile-zone,
  .cards-discard-zone {
    flex: 0 0 auto;
    width: 140px;
  }
  .cards-hand-zone {
    flex: 1;
    min-width: 0;
  }
}
.cards-zone-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 10px;
}
.cards-deck-stack {
  width: 100%;
  max-width: 120px;
  aspect-ratio: 2.5 / 3.5;
  border-radius: 10px;
  border: 2px solid rgba(212, 175, 95, 0.55);
  background: linear-gradient(145deg, #1a1530 0%, #0a0908 50%, #1e1c18 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 6px 20px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-family: 'Orbitron', sans-serif;
  transition: transform 0.15s, box-shadow 0.2s;
}
.cards-deck-stack:hover {
  transform: scale(1.03);
  box-shadow: 0 0 20px rgba(212, 175, 95, 0.25);
}
.cards-deck-count {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}
.cards-deck-sub {
  font-size: 11px;
  opacity: 0.85;
  margin-top: 4px;
}
.cards-hand {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 120px;
  align-items: flex-end;
}
/* Hand cards: flat casino style — pure white face, solid red/black ink (no linen / paper grain). */
.playing-card {
  width: 72px;
  aspect-ratio: 2.5 / 3.5;
  border-radius: 6px;
  border: none;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
  isolation: isolate;
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    'Helvetica Neue',
    Arial,
    sans-serif;
  color: #0a0a0a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
  transform: translateZ(0);
}
.playing-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: 5px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.playing-card::after {
  display: none;
}
.playing-card--red {
  color: #d40026;
}
.playing-card--red::before {
  background: #ffffff;
}
.playing-card--back {
  color: #e8dcc8;
  font-family: 'Rajdhani', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 14px 32px rgba(0, 0, 0, 0.55),
    0 4px 10px rgba(0, 0, 0, 0.4),
    1px 2px 0 rgba(15, 10, 6, 0.35);
}
.playing-card--back::before {
  background:
    radial-gradient(ellipse 100% 80% at 50% 0%, rgba(80, 60, 120, 0.35) 0%, transparent 55%),
    linear-gradient(155deg, #1e3a5c 0%, #0f1f38 45%, #0a1528 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -2px 6px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(20, 35, 55, 0.6),
    0 0 0 2px rgba(201, 162, 39, 0.35);
}
.playing-card--back::after {
  border-color: rgba(201, 162, 39, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.playing-card-back-pattern {
  position: relative;
  z-index: 2;
  width: 70%;
  height: 78%;
  border-radius: 4px;
  border: 1px solid rgba(201, 162, 39, 0.45);
  background:
    repeating-conic-gradient(from 0deg at 50% 50%, transparent 0deg 8deg, rgba(201, 162, 39, 0.06) 8deg 16deg),
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 5px,
      rgba(255, 255, 255, 0.04) 5px,
      rgba(255, 255, 255, 0.04) 10px
    ),
    linear-gradient(145deg, rgba(30, 55, 90, 0.5) 0%, rgba(10, 25, 45, 0.85) 100%);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.25);
}
.playing-card-corner {
  position: absolute;
  z-index: 2;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.05;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-rendering: geometricPrecision;
  letter-spacing: -0.02em;
}
.playing-card--red .playing-card-corner {
  color: #d40026;
}
.playing-card-corner-tl {
  top: 5px;
  left: 5px;
}
.playing-card-corner-br {
  bottom: 5px;
  right: 5px;
  transform: rotate(180deg);
}
.playing-card-center {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  font-size: 34px;
  line-height: 1;
  font-family: 'Times New Roman', Times, 'Noto Serif', serif;
}
.playing-card--red .playing-card-center {
  color: #d40026;
}
.cards-hand--dense .playing-card-joker-stack {
  font-size: 5.5px;
  line-height: 0.9;
}
.cards-hand--dense .playing-card-joker-svg {
  max-width: 42px;
  max-height: 68px;
}
/* Ornate Ace of Spades — large black spade with inner cutout (flat vector). */
.playing-card-center.playing-card-ace-spades-svg {
  width: 46%;
  height: 52%;
  max-width: 34px;
  max-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.playing-card-center.playing-card-ace-spades-svg svg {
  width: 100%;
  height: 100%;
  display: block;
}
.playing-card--face .playing-card-center {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-weight: 900;
  font-size: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.playing-card--face .playing-card-center .playing-card-face-suit {
  font-family: 'Times New Roman', Times, serif;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}
.cards-discard-pile {
  min-height: 120px;
  position: relative;
  display: flex;
  align-items: flex-end;
}
.cards-discard-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: var(--accent);
  color: #0a0908;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  font-family: 'Orbitron', sans-serif;
}
.cards-empty-hint {
  color: var(--text-dim);
  font-size: 14px;
}

/* Checkers — full viewport + wood board (reference: polished wooden checkerboard) */
#checkersScreen.screen.active {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  /* Use dynamic viewport so the board fills the visible screen on mobile (toolbars, rotation) */
  width: 100%;
  min-height: 100vh;
  height: 100vh;
  max-height: 100vh;
  min-height: 100dvh;
  height: 100dvh;
  max-height: 100dvh;
  background:
    radial-gradient(ellipse 120% 80% at 50% 0%, rgba(45, 32, 22, 0.55), transparent 55%),
    linear-gradient(165deg, #1a1410 0%, #0d0a08 100%);
}

.checkers-app {
  flex: 1 1 auto;
  align-self: stretch;
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-width: 100%;
  overflow: hidden;
  /* Horizontal safe-area only on overlays + board fill — avoids shrinking the playfield twice */
  padding-left: 0;
  padding-right: 0;
}

/*
 * Square 8×8 board: side length = min(usable width, usable height). On wide landscape that
 * always leaves side bands unless squares are stretched (we don’t). We maximize size:
 * one inset, viewport cap, minimal edge padding so the wood rim stays visible.
 */
.checkers-board-fill {
  --board-edge: clamp(4px, 1.1vmin, 14px);
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding-top: max(var(--board-edge), env(safe-area-inset-top, 0px));
  padding-bottom: max(var(--board-edge), env(safe-area-inset-bottom, 0px));
  padding-left: max(var(--board-edge), env(safe-area-inset-left, 0px));
  padding-right: max(var(--board-edge), env(safe-area-inset-right, 0px));
  /* Grid + JS --checkers-board-side: avoids broken/unsupported container-query sizing in min() */
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  min-width: 0;
  min-height: 0;
}

.checkers-topbar--overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 8px 10px;
  padding-top: max(8px, env(safe-area-inset-top, 0px));
  padding-left: max(10px, env(safe-area-inset-left, 0px));
  padding-right: max(10px, env(safe-area-inset-right, 0px));
  border-bottom: none;
  background: linear-gradient(
    180deg,
    rgba(8, 6, 5, 0.94) 0%,
    rgba(8, 6, 5, 0.78) 55%,
    rgba(8, 6, 5, 0) 100%
  );
  pointer-events: none;
}

.checkers-topbar--overlay > * {
  pointer-events: auto;
}

.checkers-footer--overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  border-top: none;
  background: linear-gradient(
    0deg,
    rgba(8, 6, 5, 0.96) 0%,
    rgba(8, 6, 5, 0.82) 50%,
    rgba(8, 6, 5, 0) 100%
  );
  pointer-events: none;
}

.checkers-footer--overlay > * {
  pointer-events: auto;
}

#checkersScreen .checkers-back {
  margin-bottom: 0;
  padding: 6px 12px;
}

/* Not using global .btn here — that rule sets width:100% and looks like a text field */
.checkers-lobby-btn {
  flex: 0 0 auto;
  appearance: none;
  margin: 0;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 10px;
  border: 2px solid rgba(212, 175, 95, 0.65);
  background: rgba(28, 22, 18, 0.95);
  color: #f5e6d4;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.checkers-lobby-btn:hover {
  border-color: rgba(232, 200, 120, 0.9);
  background: rgba(40, 32, 26, 0.98);
}

.checkers-foot-btn {
  appearance: none;
  margin: 0;
  padding: 10px 16px;
  min-height: 44px;
  border-radius: 10px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid rgba(212, 175, 95, 0.45);
  white-space: nowrap;
}

.checkers-foot-btn--secondary {
  background: rgba(22, 18, 14, 0.92);
  color: #e8dcc8;
}

.checkers-foot-btn--primary {
  background: rgba(212, 175, 95, 0.22);
  border-color: rgba(212, 175, 95, 0.75);
  color: #fff4dd;
}

.checkers-back {
  flex: 0 0 auto;
}

.checkers-title {
  flex: 1 1 auto;
  margin: 0;
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(17px, 4vw, 22px);
  color: var(--accent);
  letter-spacing: 0.06em;
  text-align: center;
}

.checkers-mode-tabs {
  display: flex;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(212, 175, 95, 0.35);
  flex: 0 0 auto;
}

.checkers-mode-tab {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  border: none;
  background: rgba(20, 16, 12, 0.9);
  color: var(--text-dim);
  cursor: pointer;
  font-family: system-ui, sans-serif;
}

.checkers-mode-tab.is-active {
  background: rgba(212, 175, 95, 0.22);
  color: #f5e6d4;
}

/* Slide-over / bottom sheet — online controls (board stays full size behind) */
.checkers-drawer {
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
  visibility: hidden;
}

.checkers-drawer.is-open {
  pointer-events: auto;
  visibility: visible;
}

.checkers-drawer-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.22s ease;
  cursor: pointer;
}

.checkers-drawer.is-open .checkers-drawer-backdrop {
  opacity: 1;
}

.checkers-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
  width: min(380px, 100%);
  height: 100%;
  max-height: 100dvh;
  background: linear-gradient(180deg, #1e1814 0%, #12100e 100%);
  border-left: 1px solid rgba(212, 175, 95, 0.35);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.5);
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 14px 20px;
  padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checkers-drawer.is-open .checkers-drawer-panel {
  transform: translateX(0);
}

.checkers-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(212, 175, 95, 0.2);
}

.checkers-drawer-title {
  margin: 0;
  font-family: 'Orbitron', sans-serif;
  font-size: 15px;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.checkers-drawer-close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #e8dcc8;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.checkers-drawer-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 540px) {
  .checkers-drawer-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    max-height: min(58dvh, 420px);
    border-left: none;
    border-top: 1px solid rgba(212, 175, 95, 0.35);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.55);
  }

  .checkers-drawer.is-open .checkers-drawer-panel {
    transform: translateY(0);
  }
}

.checkers-online-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

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

.checkers-join-row {
  margin-bottom: 0;
  width: 100%;
}

.checkers-create-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.checkers-room-name-hint {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.35;
}

.checkers-room-name-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 2px solid rgba(212, 175, 95, 0.5);
  background: rgba(12, 10, 8, 0.95);
  color: #f5f0e8;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.checkers-room-name-input::placeholder {
  color: rgba(232, 220, 200, 0.35);
}

.checkers-room-name-input:focus {
  outline: none;
  border-color: rgba(232, 200, 120, 0.95);
  box-shadow: 0 0 0 3px rgba(212, 175, 95, 0.2);
}

.checkers-in-room-head {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 175, 95, 0.28);
}

.checkers-room-title {
  margin: 0 0 10px;
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(17px, 4.2vw, 22px);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
  line-height: 1.25;
  word-break: break-word;
}

.checkers-room-invite {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  font-size: 13px;
  color: var(--text-dim);
}

.checkers-invite-label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
}

.checkers-room-code-value {
  font-family: 'Orbitron', monospace;
  font-size: 16px;
  letter-spacing: 0.12em;
  color: #f5f0e8;
}

.checkers-join-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.checkers-code-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #e8dcc8;
  letter-spacing: 0.02em;
}

.checkers-code-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  max-width: none;
  min-height: 52px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 2px solid rgba(212, 175, 95, 0.5);
  background: rgba(12, 10, 8, 0.95);
  color: #f5f0e8;
  font-family: 'Orbitron', monospace;
  font-size: 18px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  box-sizing: border-box;
}

.checkers-code-input::placeholder {
  color: rgba(232, 220, 200, 0.35);
  letter-spacing: 0.08em;
}

.checkers-code-input:focus {
  outline: none;
  border-color: rgba(232, 200, 120, 0.95);
  box-shadow: 0 0 0 3px rgba(212, 175, 95, 0.2);
}

#checkersScreen .checkers-drawer-panel #btnCheckersCreateRoom {
  width: 100%;
  justify-content: center;
  text-align: center;
}

#checkersScreen .checkers-drawer-panel .checkers-join-row .btn {
  width: auto;
  flex: 0 0 auto;
  min-height: 52px;
  align-self: stretch;
}

.checkers-open-rooms {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(28vh, 200px);
  overflow-y: auto;
  font-size: 13px;
}

.checkers-open-rooms li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.04);
}

.checkers-open-rooms button {
  flex: 0 0 auto;
  width: auto !important;
  font-size: 12px;
  padding: 8px 12px;
  min-height: 40px;
}

.checkers-room-players {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  font-size: 13px;
  color: var(--text-dim);
}

.checkers-room-players li {
  padding: 2px 0;
}

.checkers-copy-code {
  margin-left: 6px;
  vertical-align: middle;
}

.checkers-status {
  color: #d4c4b0;
  font-size: clamp(12px, 2.8vw, 14px);
  margin: 0;
  line-height: 1.4;
  text-align: center;
  max-width: 56ch;
  text-wrap: balance;
}

.checkers-status--bar {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  font-size: clamp(11px, 2.6vw, 13px);
  line-height: 1.35;
  max-width: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.checkers-board-stage {
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
  padding: 0;
  aspect-ratio: 1;
  justify-self: center;
  align-self: center;
  /* Set by checkers.js ResizeObserver from #checkersBoardFill inner size */
  width: var(--checkers-board-side, min(80vmin, 80vw));
  height: var(--checkers-board-side, min(80vmin, 80vw));
  max-width: 100%;
  max-height: 100%;
}

/* Wood rim + grid: square stage fills the centered square */
.checkers-board-frame {
  --frame: clamp(3px, 1vmin, 14px);
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  padding: var(--frame);
  border-radius: 6px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.06) 0%, transparent 42%),
    repeating-linear-gradient(
      90deg,
      #2a1810 0px,
      #3e2312 2px,
      #2c160c 5px,
      #4a2a18 9px,
      #3e2312 14px,
      #251208 18px
    );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -2px 8px rgba(0, 0, 0, 0.45),
    0 0 0 3px #c9a574,
    0 0 0 5px #3d2618,
    0 12px 40px rgba(0, 0, 0, 0.55),
    0 4px 0 rgba(0, 0, 0, 0.35);
  border: 2px solid #2a150c;
}

.checkers-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.checkers-cell {
  position: relative;
  padding: 0;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  container-type: size;
  container-name: checkers-cell;
}

/* Light squares — honey oak */
.checkers-cell--light {
  cursor: default;
  background-color: #d29145;
  background-image:
    repeating-linear-gradient(
      105deg,
      rgba(255, 255, 255, 0.14) 0 1px,
      transparent 1px 8px
    ),
    repeating-linear-gradient(
      -40deg,
      rgba(120, 70, 25, 0.18) 0 2px,
      transparent 2px 12px
    ),
    linear-gradient(165deg, rgba(255, 255, 255, 0.22) 0%, transparent 42%, rgba(90, 45, 12, 0.15) 100%);
}

/* Dark squares — dark walnut / mahogany */
.checkers-cell--dark {
  background-color: #4a2612;
  background-image:
    repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.22) 0 1px,
      transparent 1px 5px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(20, 8, 4, 0.35) 0 2px,
      transparent 2px 9px
    ),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, transparent 35%, rgba(0, 0, 0, 0.28) 100%);
}

.checkers-cell--dark:hover:not(:disabled) {
  filter: brightness(1.1);
}

/* Last completed move (from = where piece left, to = where it landed) */
@keyframes checkersLastToPulse {
  0% {
    box-shadow:
      inset 0 0 0 2px rgba(90, 220, 180, 0.95),
      0 0 0 0 rgba(90, 220, 180, 0.55);
  }
  70% {
    box-shadow:
      inset 0 0 0 2px rgba(90, 220, 180, 1),
      0 0 0 10px rgba(90, 220, 180, 0);
  }
  100% {
    box-shadow:
      inset 0 0 0 2px rgba(90, 220, 180, 0.95),
      0 0 0 0 rgba(90, 220, 180, 0);
  }
}

@keyframes checkersLastToPiecePop {
  0% { transform: scale(0.9); }
  45% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.checkers-cell--last-from {
  box-shadow: inset 0 0 0 2px rgba(255, 200, 90, 0.92);
  z-index: 1;
}

.checkers-cell--last-to {
  box-shadow:
    inset 0 0 0 2px rgba(90, 220, 180, 0.95),
    0 0 16px rgba(90, 220, 180, 0.28);
  animation: checkersLastToPulse 1.2s ease-out infinite;
  z-index: 1;
}

.checkers-piece--last-to {
  animation: checkersLastToPiecePop 300ms ease-out 1;
}

.checkers-cell--selected {
  box-shadow: inset 0 0 0 3px rgba(255, 230, 160, 0.95);
  z-index: 2;
}

.checkers-cell--move {
  box-shadow: inset 0 0 0 3px rgba(120, 200, 255, 0.9);
  z-index: 2;
}

/* Stacked wood discs: size to square cell */
.checkers-piece {
  width: min(58cqmin, 92%);
  aspect-ratio: 1;
  max-width: 100%;
  max-height: 100%;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(9px, 14cqmin, 22px);
  font-weight: 700;
  line-height: 1;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.42)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

@supports not (width: 1cqmin) {
  .checkers-piece {
    width: 62%;
    font-size: clamp(10px, 4.2vmin, 20px);
  }
}

.checkers-piece--white {
  color: #2a2a2a;
  background:
    radial-gradient(
      circle at 50% 36%,
      rgba(255, 255, 255, 0.55) 0%,
      rgba(255, 255, 255, 0.06) 20%,
      transparent 23%
    ),
    radial-gradient(
      circle at 50% 40%,
      #f7f7f7 0%,
      #f2f2f2 30%,
      #c6c6c6 31%,
      #ededed 35%,
      #eaeaea 46%,
      #b8b8b8 47%,
      #e6e6e6 56%,
      #aeaeae 57%,
      #f5f5f5 68%,
      #cfcfcf 69%,
      #f5f5f5 100%
    );
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.85),
    inset 0 -5px 12px rgba(0, 0, 0, 0.07),
    inset 0 0 0 1px rgba(0, 0, 0, 0.07);
}

.checkers-piece--black {
  color: rgba(238, 238, 238, 0.95);
  background:
    radial-gradient(
      circle at 50% 36%,
      rgba(255, 255, 255, 0.14) 0%,
      rgba(255, 255, 255, 0.02) 18%,
      transparent 22%
    ),
    radial-gradient(
      circle at 50% 40%,
      #383838 0%,
      #333 29%,
      #101010 30%,
      #2a2a2a 34%,
      #282828 45%,
      #060606 46%,
      #2e2e2e 55%,
      #050505 56%,
      #1a1a1a 67%,
      #0a0a0a 68%,
      #1a1a1a 100%
    );
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.1),
    inset 0 -6px 14px rgba(0, 0, 0, 0.65),
    inset 0 0 0 1px rgba(0, 0, 0, 0.55);
}

.checkers-piece--king {
  width: min(52cqmin, 88%);
  font-size: clamp(12px, 22cqmin, 30px);
  font-weight: 800;
}

.checkers-piece--king.checkers-piece--white {
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.85),
    inset 0 -5px 12px rgba(0, 0, 0, 0.07),
    inset 0 0 0 1px rgba(0, 0, 0, 0.07),
    0 0 0 3px rgba(180, 140, 50, 0.95),
    0 0 0 5px rgba(60, 45, 20, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.35);
}

.checkers-piece--king.checkers-piece--black {
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.1),
    inset 0 -6px 14px rgba(0, 0, 0, 0.65),
    inset 0 0 0 1px rgba(0, 0, 0, 0.55),
    0 0 0 3px rgba(232, 200, 120, 0.9),
    0 0 0 5px rgba(20, 16, 12, 0.7),
    0 2px 10px rgba(0, 0, 0, 0.5);
}

.checkers-piece--white.checkers-piece--king {
  color: #6b4a0a;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6),
    0 -1px 0 rgba(0, 0, 0, 0.15);
}

.checkers-piece--black.checkers-piece--king {
  color: #e8c547;
  text-shadow:
    0 0 6px rgba(232, 197, 71, 0.45),
    0 1px 2px rgba(0, 0, 0, 0.9);
}

@supports not (width: 1cqmin) {
  .checkers-piece--king {
    font-size: clamp(12px, 5vmin, 28px);
  }
}

.checkers-footer {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px 12px;
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
}

.checkers-footer-actions {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
}

/* ─── Mini chat (used by cards + checkers) ─── */
.mini-chat {
  margin-top: 10px;
  border: 1px solid rgba(212, 175, 95, 0.35);
  background: rgba(12, 10, 8, 0.55);
  backdrop-filter: blur(6px);
  border-radius: 12px;
  overflow: hidden;
  max-width: 520px;
}
.mini-chat--cards {
  margin: 8px 0 14px 0;
  max-width: 620px;
}
.mini-chat-head {
  padding: 8px 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(255, 240, 210, 0.92);
  border-bottom: 1px solid rgba(212, 175, 95, 0.25);
}
.mini-chat-messages {
  padding: 8px 10px;
  height: 140px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  line-height: 1.35;
  color: rgba(255, 240, 210, 0.88);
}
.mini-chat-row {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid rgba(212, 175, 95, 0.2);
}
.mini-chat-input {
  flex: 1;
  min-width: 0;
  padding: 10px 10px;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 95, 0.25);
  background: rgba(0, 0, 0, 0.28);
  color: rgba(255, 240, 210, 0.92);
  outline: none;
}
.mini-chat-send {
  border: 1px solid rgba(212, 175, 95, 0.35);
  background: rgba(212, 175, 95, 0.16);
  color: rgba(255, 240, 210, 0.92);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}
.mini-chat-send:hover {
  background: rgba(212, 175, 95, 0.24);
}
.mini-chat-line {
  display: flex;
  flex-direction: column;
  margin: 0;
  max-width: 85%;
  word-break: break-word;
}
.mini-chat-line.is-own {
  align-self: flex-end;
  align-items: flex-end;
}
.mini-chat-line.is-other {
  align-self: flex-start;
  align-items: flex-start;
}
.mini-chat-bubble {
  padding: 8px 11px;
  border-radius: 12px;
}
.mini-chat-line.is-own .mini-chat-bubble {
  background: rgba(212, 175, 95, 0.28);
  border: 1px solid rgba(212, 175, 95, 0.5);
  border-bottom-right-radius: 4px;
}
.mini-chat-line.is-other .mini-chat-bubble {
  background: rgba(40, 35, 28, 0.88);
  border: 1px solid rgba(212, 175, 95, 0.22);
  border-left: 3px solid rgba(212, 175, 95, 0.6);
  border-bottom-left-radius: 4px;
}
.mini-chat-sender {
  display: block;
  font-weight: 700;
  font-size: 11px;
  margin-bottom: 2px;
}
.mini-chat-line.is-own .mini-chat-sender {
  color: rgba(255, 240, 210, 0.95);
}
.mini-chat-line.is-other .mini-chat-sender {
  color: rgba(255, 226, 170, 0.98);
}
.mini-chat-text {
  display: block;
  color: rgba(255, 240, 210, 0.92);
}
.mini-chat-ts {
  opacity: 0.55;
  font-size: 10px;
  margin-top: 3px;
}

/* ─── Voice box (Tic Tac Toe online) ─── */
.voice-box {
  position: absolute;
  left: 18px;
  bottom: 18px;
  width: 300px;
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(212, 175, 95, 0.35);
  border-radius: 16px;
  padding: 12px;
  backdrop-filter: blur(8px);
  z-index: 9;
}
.voice-header {
  font-weight: 700;
  margin-bottom: 8px;
  color: rgba(255, 240, 210, 0.92);
}
.voice-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.voice-btn {
  flex: 1;
  border: 1px solid rgba(212, 175, 95, 0.35);
  background: rgba(212, 175, 95, 0.16);
  color: rgba(255, 240, 210, 0.92);
  border-radius: 10px;
  padding: 10px 10px;
  cursor: pointer;
}
.voice-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.voice-btn--danger {
  border-color: rgba(255, 120, 120, 0.35);
  background: rgba(255, 120, 120, 0.12);
}
.voice-meta {
  font-size: 12px;
  color: rgba(255, 240, 210, 0.8);
  opacity: 0.9;
}

/* ─── Leaderboard modal bits ─── */
.leaderboard-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.leaderboard-tab {
  border: 1px solid rgba(212, 175, 95, 0.35);
  background: rgba(212, 175, 95, 0.12);
  color: rgba(255, 240, 210, 0.92);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
}
.leaderboard-tab.is-active {
  background: rgba(212, 175, 95, 0.22);
}
.leaderboard-subrow {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.leaderboard-hint {
  opacity: 0.75;
  font-size: 12px;
}
.leaderboard-table {
  font-size: 13px;
  line-height: 1.35;
}
.leaderboard-table table {
  width: 100%;
  border-collapse: collapse;
}
.leaderboard-table th,
.leaderboard-table td {
  padding: 8px 6px;
  border-bottom: 1px solid rgba(212, 175, 95, 0.18);
  text-align: left;
}
.leaderboard-table th {
  font-weight: 800;
  opacity: 0.9;
}

/* ─── Responsive ─── */
@media (max-width: 480px) {
  .menu-container { padding: 24px; }
  .game-logo { font-size: 48px; }
  .cell { font-size: clamp(14px, 3.5vw, 34px); }
  .board-zoom-viewport { max-height: 46vh; }
  .chat-box { width: 240px; bottom: 8px; right: 8px; }
  .players-bar { gap: 8px; }
  .player-card { padding: 8px 10px; gap: 6px; }
}
