/* ═══════════════════════════════════════════════════════════════════════════
   new-games.css — shared UI additions, RTL support and the six newer games
   (chess, backgammon, poker, UNO, Hokm, Spy). Everything is local: no web fonts, no CDN.
═══════════════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/vazirmatn.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --font-ui: 'Segoe UI', system-ui, -apple-system, Roboto, 'Noto Sans', sans-serif;
  --card-w: 64px;
  --card-h: 92px;
}
:root[lang='fa'] {
  --font-ui: 'Vazirmatn', Tahoma, 'Segoe UI', system-ui, sans-serif;
}
html, body { font-family: var(--font-ui); }
button, input, select, textarea { font-family: inherit; }

/* ── language toggle, connection banner ───────────────────────────────────── */

.lang-toggle { font-size: 12px; }
.auth-lang { position: absolute; top: 10px; inset-inline-end: 10px; }
#auth-screen { position: relative; }

.conn-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 70;
  padding: 6px 12px;
  text-align: center;
  background: var(--warning);
  color: #1a1a1a;
  font-weight: 600;
  font-size: 13px;
}

.spectator-count {
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 12px;
  align-self: center;
}

/* ── lobby additions ──────────────────────────────────────────────────────── */

.game-options { margin: 8px 0 4px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: 8px; }
.game-options .opt-title { margin-bottom: 6px; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.game-options .form-group { margin-bottom: 8px; }
.game-options select { width: 100%; }
.bot-controls { margin: 12px 0; }
.remove-bot-btn { margin-inline-start: auto; }
.players-waiting-list li { display: flex; align-items: center; gap: 8px; }

.lb-table { margin-top: 12px; max-height: 60vh; overflow: auto; }
.lb { width: 100%; border-collapse: collapse; }
.lb th, .lb td { padding: 6px 10px; text-align: start; border-bottom: 1px solid var(--border); }
.lb th { color: var(--text-muted); font-weight: 600; font-size: 12px; }

.game-over-extra { margin: 10px 0; }
.rematch-status { color: var(--text-muted); font-size: 13px; min-height: 18px; }
.modal-footer { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ── RTL adjustments for the shared chrome ────────────────────────────────── */

[dir='rtl'] .game-sidebar { border-left: none; border-right: 1px solid var(--border); }
[dir='rtl'] .chat-form { flex-direction: row; }
@media (max-width: 700px) {
  [dir='rtl'] .game-sidebar { border-right: none; border-top: 1px solid var(--border); }
}

/* ── shared playing cards (poker, hokm) ───────────────────────────────────── */

.pcard {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: 7px;
  background: #fbfbf6;
  border: 1px solid #b9b9ad;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45);
  color: #151515;
  flex: 0 0 auto;
  user-select: none;
  font-family: 'Segoe UI', system-ui, sans-serif;
  direction: ltr;
}
.pcard-sm { --card-w: 44px; --card-h: 63px; }
.pcard-red { color: #c62828; }
.pcard-rank { position: absolute; top: 4px; left: 6px; font-weight: 700; font-size: calc(var(--card-w) * 0.3); line-height: 1; }
.pcard-suit { position: absolute; top: calc(var(--card-w) * 0.34); left: 6px; font-size: calc(var(--card-w) * 0.24); line-height: 1; }
.pcard-big { position: absolute; right: 7px; bottom: 3px; font-size: calc(var(--card-w) * 0.55); line-height: 1; }
.pcard-back {
  background: repeating-linear-gradient(45deg, #1d3d8f 0 6px, #254aa8 6px 12px);
  border: 2px solid #f2f2f2;
}
.pcard-slot { background: rgba(255, 255, 255, 0.07); border: 1px dashed rgba(255, 255, 255, 0.25); box-shadow: none; }
.pcard[role='button'] { cursor: pointer; transition: transform 0.12s ease; }
.pcard[role='button']:hover, .pcard[role='button']:focus-visible { transform: translateY(-8px); outline: none; }
.pcard-disabled { filter: brightness(0.6); }
.pcard-hl { box-shadow: 0 0 0 2px #ffd54f, 0 3px 8px rgba(0, 0, 0, 0.5); }

/* ── chess ────────────────────────────────────────────────────────────────── */

.chess-wrap { display: flex; gap: 16px; align-items: flex-start; justify-content: center; width: 100%; --chess-size: min(calc(100vw - 340px), calc(100vh - 230px), 640px); }
.chess-main { display: flex; flex-direction: column; gap: 6px; width: var(--chess-size); }
.chess-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: var(--chess-size);
  height: var(--chess-size);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.55);
  touch-action: manipulation;
}
.chess-sq { position: relative; display: flex; align-items: center; justify-content: center; }
.chess-light { background: #ecd9b0; }
.chess-dark { background: #a8774a; }
.chess-piece { font-size: calc(var(--chess-size) / 8 * 0.8); line-height: 1; cursor: default; pointer-events: none; font-family: 'DejaVu Sans', 'Segoe UI Symbol', 'Noto Sans Symbols 2', 'Apple Symbols', sans-serif; }
.chess-w { color: #fffdf4; text-shadow: 0 0 2px #000, 0 0 1px #000, 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000; }
.chess-b { color: #1b1b1b; text-shadow: 0 0 1px rgba(255, 255, 255, 0.4); }
.chess-movable { cursor: pointer; }
.chess-selected { background: #f6e05e !important; }
.chess-last::after { content: ''; position: absolute; inset: 0; background: rgba(255, 235, 59, 0.35); pointer-events: none; }
.chess-check::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, rgba(229, 57, 53, 0.9) 0%, rgba(229, 57, 53, 0) 70%); }
.chess-dot { position: absolute; width: 30%; height: 30%; border-radius: 50%; background: rgba(20, 20, 20, 0.28); pointer-events: none; }
.chess-dot-cap { width: 88%; height: 88%; background: transparent; border: 4px solid rgba(200, 40, 40, 0.55); }
.chess-coord { position: absolute; font-size: calc(var(--chess-size) / 8 * 0.17); font-weight: 700; opacity: 0.7; pointer-events: none; }
.chess-coord-rank { top: 2px; left: 3px; }
.chess-coord-file { bottom: 1px; right: 4px; }
.chess-light .chess-coord { color: #a8774a; }
.chess-dark .chess-coord { color: #ecd9b0; }
.chess-bar { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 6px; background: var(--surface2); border: 1px solid var(--border); min-height: 36px; direction: ltr; }
.chess-bar-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.chess-name { font-weight: 600; }
.chess-badge { font-size: 18px; font-family: 'DejaVu Sans', 'Segoe UI Symbol', sans-serif; }
.chess-captured { color: var(--text-muted); font-size: 14px; letter-spacing: -2px; font-family: 'DejaVu Sans', 'Segoe UI Symbol', sans-serif; }
.chess-clock { margin-inline-start: auto; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 18px; padding: 2px 8px; border-radius: 5px; background: #111; color: #eee; }
.chess-clock-low { background: #b71c1c; color: #fff; }
.chess-status { min-height: 22px; text-align: center; font-weight: 600; }
.chess-status-over { color: #ffd54f; }
.chess-controls { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.chess-moves { width: 170px; max-height: var(--chess-size); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px; direction: ltr; }
.chess-moves-title { margin-bottom: 6px; color: var(--text-muted); font-size: 12px; text-transform: uppercase; }
.chess-move-list { list-style: decimal inside; font-size: 13px; }
.chess-move-list li { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 1px 0; }
.chess-san { font-variant-numeric: tabular-nums; }
.chess-promo { position: absolute; inset: 0; margin: auto; width: fit-content; height: fit-content; z-index: 20; background: var(--surface); border: 2px solid var(--accent); border-radius: 10px; padding: 12px; text-align: center; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6); }
.chess-wrap { position: relative; }
.chess-promo-row { display: flex; gap: 8px; margin: 8px 0; justify-content: center; }
.chess-promo-btn { width: 56px; height: 56px; font-size: 38px; border-radius: 8px; border: 1px solid var(--border); background: #a8774a; cursor: pointer; font-family: 'DejaVu Sans', 'Segoe UI Symbol', sans-serif; }
.chess-promo-btn:hover { background: #c28f5c; }
.chess-shake { animation: chess-shake 0.35s; }
@keyframes chess-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.chess-over-text { font-weight: 600; }
@media (max-width: 820px) {
  .chess-wrap { flex-direction: column; align-items: center; --chess-size: min(calc(100vw - 24px), calc(100vh - 260px), 560px); }
  .chess-moves { width: var(--chess-size); max-height: 110px; }
  .chess-move-list li { display: inline-grid; grid-template-columns: auto auto; margin-inline-end: 10px; }
}

/* ── backgammon ───────────────────────────────────────────────────────────── */

.bg-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; --bg-w: min(calc(100vw - 340px), 860px); --bg-h: min(calc(var(--bg-w) * 0.62), calc(100vh - 290px)); }
.bg-info { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: var(--bg-w); flex-wrap: wrap; }
.bg-score { display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface2); }
.bg-score-active { border-color: var(--accent); }
.bg-score-pts { font-weight: 800; font-size: 18px; }
.bg-score-pip { color: var(--text-muted); font-size: 12px; }
.bg-match { display: flex; gap: 10px; align-items: center; color: var(--text-muted); font-size: 12px; flex-wrap: wrap; justify-content: center; }
.bg-crawford { color: var(--warning); font-weight: 700; }
.bg-token { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #777; }
.bg-token-w { background: #f4efe2; }
.bg-token-b { background: #2c2c2c; border-color: #999; }
.bg-board {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: var(--bg-w);
  height: var(--bg-h);
  padding: 8px 40px 8px 8px;
  background: #5b3a1e;
  border: 6px solid #3a2410;
  border-radius: 8px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.55);
  user-select: none;
}
.bg-row { display: flex; height: 46%; align-items: stretch; }
.bg-point { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; cursor: default; }
.bg-row-top .bg-point { justify-content: flex-start; }
.bg-row-bottom .bg-point { justify-content: flex-end; flex-direction: column-reverse; }
.bg-point::before { content: ''; position: absolute; inset: 0 8% 0 8%; z-index: 0; opacity: 0.95; }
.bg-row-top .bg-point::before { clip-path: polygon(0 0, 100% 0, 50% 100%); }
.bg-row-bottom .bg-point::before { clip-path: polygon(50% 0, 0 100%, 100% 100%); }
.bg-point-a::before { background: #d9b382; }
.bg-point-b::before { background: #8a2f2a; }
.bg-point-num { position: absolute; font-size: 10px; color: rgba(255, 255, 255, 0.6); z-index: 2; pointer-events: none; }
.bg-row-top .bg-point-num { top: -2px; }
.bg-row-bottom .bg-point-num { bottom: -2px; }
.bg-stack { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; width: 100%; padding: 10px 0 4px; gap: 0; }
.bg-row-bottom .bg-stack { padding: 4px 0 10px; }
.bg-row-bottom .bg-stack { flex-direction: column-reverse; }
.bg-checker { display: flex; align-items: center; justify-content: center; width: min(88%, calc(var(--bg-h) * 0.078)); aspect-ratio: 1; border-radius: 50%; font-size: 11px; font-weight: 800; box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5); margin: -1px 0; }
.bg-checker-w { background: radial-gradient(circle at 35% 30%, #fffdf6, #d8cfb8); color: #333; border: 2px solid #b8ad92; }
.bg-checker-b { background: radial-gradient(circle at 35% 30%, #555, #151515); color: #eee; border: 2px solid #000; }
.bg-source .bg-checker:last-child, .bg-source.bg-bar .bg-checker { outline: 2px solid #ffd54f; outline-offset: 1px; }
.bg-source { cursor: pointer; }
.bg-selected::after { content: ''; position: absolute; inset: 0; background: rgba(255, 235, 59, 0.22); z-index: 1; pointer-events: none; }
.bg-target { cursor: pointer; }
.bg-target::after { content: ''; position: absolute; inset: 0; background: rgba(76, 175, 80, 0.42); z-index: 1; border: 2px solid #81c784; pointer-events: none; }
.bg-bar { width: 6%; min-width: 26px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: #3a2410; border-inline: 3px solid #26170a; }
.bg-off { position: absolute; top: 8px; bottom: 8px; right: 8px; width: 26px; display: flex; align-items: center; justify-content: center; background: #3a2410; border-radius: 4px; writing-mode: vertical-rl; font-size: 11px; color: #d9b382; }
.bg-off.bg-target { cursor: pointer; background: #2e7d32; color: #fff; }
.bg-off.bg-target::after { display: none; }
.bg-side { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: center; }
.bg-dice { display: flex; gap: 8px; min-height: 44px; align-items: center; }
.bg-open { display: flex; gap: 6px; align-items: center; }
.bg-die { display: inline-grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); width: 42px; height: 42px; padding: 5px; border-radius: 8px; background: #fbfbf6; border: 1px solid #aaa; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5); gap: 1px; }
.bg-die-empty { place-items: center; color: #777; font-weight: 800; font-size: 20px; }
.bg-die-used { opacity: 0.35; }
.bg-pip { width: 100%; height: 100%; border-radius: 50%; background: #111; transform: scale(0.8); }
.bg-nopip { display: block; }
.bg-cube-slot { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--text-muted); }
.bg-cube { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 6px; background: #fff8e1; color: #222; font-weight: 800; font-size: 18px; border: 2px solid #c9a227; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5); }
.bg-trays { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.bg-tray { display: flex; gap: 6px; align-items: center; }
.bg-timer { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 60px; }
.bg-timer-low { color: #ff7043; }
.bg-status { min-height: 22px; font-weight: 600; text-align: center; }
.bg-controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
@media (max-width: 820px) {
  .bg-wrap { --bg-w: calc(100vw - 20px); --bg-h: min(calc(var(--bg-w) * 1.1), calc(100vh - 330px)); }
  .bg-board { padding-right: 34px; }
  .bg-point-num { font-size: 8px; }
  .bg-checker { font-size: 9px; }
}

/* ── poker ────────────────────────────────────────────────────────────────── */

.pk-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; --tw: min(calc(100vw - 340px), 900px); --th: clamp(280px, min(calc(var(--tw) * 0.56), calc(100vh - 330px)), 560px); }
.pk-table { position: relative; width: var(--tw); height: var(--th); margin: 50px 0 36px; --pk-rx: 43%; --pk-ry: 39%; }
.pk-felt { position: absolute; inset: 7% 5%; border-radius: 50%; background: radial-gradient(ellipse at center, #1f7a45 0%, #14532d 70%, #0d3b1f 100%); border: 10px solid #5b3a1e; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6), inset 0 0 40px rgba(0, 0, 0, 0.5); }
.pk-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 2; --card-w: min(52px, calc(var(--tw) * 0.07)); --card-h: calc(var(--card-w) * 1.43); }
.pk-board { display: flex; gap: 5px; }
.pk-pot { display: flex; gap: 6px; align-items: baseline; padding: 3px 12px; border-radius: 14px; background: rgba(0, 0, 0, 0.45); }
.pk-pot strong { font-size: 18px; color: #ffd54f; }
.pk-meta, .pk-sidepots { font-size: 11px; color: rgba(255, 255, 255, 0.75); text-align: center; }
.pk-seats { position: absolute; inset: 0; }
.pk-seat { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 92px; z-index: 3; --card-w: min(44px, calc(var(--tw) * 0.055)); --card-h: calc(var(--card-w) * 1.43); }
.pk-me { --card-w: min(60px, calc(var(--tw) * 0.075)); --card-h: calc(var(--card-w) * 1.43); }
.pk-hole { display: flex; gap: 3px; min-height: calc(var(--card-h) * 0.9); }
.pk-info { position: relative; padding: 3px 10px; border-radius: 10px; background: rgba(15, 20, 15, 0.88); border: 2px solid #3a4a3a; text-align: center; font-size: 12px; max-width: 130px; }
.pk-active .pk-info { border-color: #ffd54f; box-shadow: 0 0 10px rgba(255, 213, 79, 0.7); }
.pk-winner .pk-info { border-color: #69f0ae; box-shadow: 0 0 12px rgba(105, 240, 174, 0.8); }
.pk-folded { opacity: 0.45; }
.pk-out { opacity: 0.3; }
.pk-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.pk-chips { color: #ffd54f; font-weight: 700; font-variant-numeric: tabular-nums; }
.pk-tags { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.pk-tag { font-size: 10px; padding: 0 5px; border-radius: 8px; background: #555; }
.pk-tag-allin { background: #c62828; font-weight: 700; }
.pk-dealer { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: #fff; color: #111; font-size: 11px; font-weight: 800; }
.pk-handname { font-size: 11px; color: #69f0ae; }
.pk-timer { font-size: 12px; font-weight: 700; color: #ffd54f; min-height: 14px; }
.pk-timer-low { color: #ff7043; }
.pk-bet { position: absolute; left: 50%; transform: translateX(-50%); bottom: -22px; padding: 1px 8px; border-radius: 10px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 11px; font-weight: 700; white-space: nowrap; }
.pk-banner { min-height: 22px; text-align: center; font-weight: 600; }
.pk-banner-win { color: #69f0ae; }
.pk-next { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.pk-actions { display: flex; flex-direction: row; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: center; width: min(var(--tw), 100%); }
.pk-row, .pk-bet-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.pk-slider { width: 200px; }
.pk-amount { width: 90px; text-align: center; }
.pk-quick { display: flex; gap: 4px; }
.pk-standings { text-align: start; margin: 8px auto; width: fit-content; }
@media (max-width: 820px) {
  .pk-wrap { --tw: calc(100vw - 12px); --th: clamp(300px, min(calc(var(--tw) * 1.1), calc(100vh - 360px)), 560px); }
  .pk-table { margin: 44px 0 30px; --pk-rx: 34%; --pk-ry: 40%; }
  .pk-hole .pcard-sm { --card-w: 36px; --card-h: 52px; }
  .pk-seat { min-width: 70px; }
  .pk-info { font-size: 10px; padding: 2px 6px; }
  .pk-name { max-width: 70px; }
  .pk-slider { width: 150px; }
}

/* ── UNO ──────────────────────────────────────────────────────────────────── */

.uno-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; --uw: 74px; --uh: 108px; }
.uno-opponents { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.uno-opp { padding: 6px 10px; border-radius: 10px; border: 2px solid var(--border); background: var(--surface2); text-align: center; min-width: 96px; }
.uno-opp-active { border-color: #ffd54f; box-shadow: 0 0 10px rgba(255, 213, 79, 0.6); }
.uno-opp-out { opacity: 0.4; }
.uno-opp-name { font-weight: 700; font-size: 13px; }
.uno-opp-cards { display: flex; justify-content: center; margin: 4px 0; padding-inline-start: 10px; }
.uno-mini { width: 14px; height: 20px; margin-inline-start: -8px; border-radius: 3px; background: #1a1a1a; border: 1px solid #fff; }
.uno-opp-count { font-size: 11px; color: var(--text-muted); }
.uno-called { color: #69f0ae; font-weight: 800; font-size: 12px; }
.uno-vuln { color: #ff7043; font-weight: 800; font-size: 12px; animation: uno-blink 1s infinite; }
@keyframes uno-blink { 50% { opacity: 0.4; } }
.uno-timer { font-size: 12px; font-weight: 700; color: #ffd54f; min-height: 14px; }
.uno-table { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; padding: 10px 0; }
.uno-pile { position: relative; }
.uno-pile-click { cursor: pointer; }
.uno-pile-click .uno-card { box-shadow: 0 0 0 3px #ffd54f, 0 3px 8px rgba(0, 0, 0, 0.5); }
.uno-pile-count { position: absolute; bottom: -8px; right: -8px; background: #000; color: #fff; padding: 0 6px; border-radius: 10px; font-size: 11px; }
.uno-colour { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #fff; }
.uno-colour-red { background: #d32f2f; }
.uno-colour-yellow { background: #fbc02d; }
.uno-colour-green { background: #388e3c; }
.uno-colour-blue { background: #1976d2; }
.uno-dir { font-size: 26px; opacity: 0.85; }
.uno-stack { background: #c62828; padding: 2px 10px; border-radius: 12px; font-weight: 800; }
.uno-scores { width: 100%; text-align: center; font-size: 12px; color: var(--text-muted); }
.uno-card { position: relative; flex: 0 0 auto; width: var(--uw); height: var(--uh); border-radius: 10px; border: 4px solid #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5); color: #fff; user-select: none; direction: ltr; transition: transform 0.12s ease; }
.uno-red { background: #d32f2f; }
.uno-yellow { background: #f9a825; }
.uno-green { background: #2e7d32; }
.uno-blue { background: #1565c0; }
.uno-wild { background: conic-gradient(#d32f2f 0 25%, #f9a825 0 50%, #2e7d32 0 75%, #1565c0 0); }
.uno-back { background: #161616; display: flex; align-items: center; justify-content: center; }
.uno-back-logo { color: #ef5350; font-weight: 900; font-style: italic; font-size: 20px; text-shadow: 1px 1px 0 #ffd54f; }
.uno-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: calc(var(--uw) * 0.55); font-weight: 900; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45); }
.uno-corner { position: absolute; font-size: calc(var(--uw) * 0.2); font-weight: 800; text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4); }
.uno-tl { top: 3px; left: 5px; }
.uno-br { bottom: 3px; right: 5px; transform: rotate(180deg); }
.uno-hand { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 14px 4px; min-height: calc(var(--uh) + 24px); }
.uno-hand .uno-card[role='button'] { cursor: pointer; }
.uno-playable { box-shadow: 0 0 0 3px #ffd54f, 0 3px 10px rgba(0, 0, 0, 0.5); transform: translateY(-8px); }
.uno-dim { filter: brightness(0.55); }
.uno-hand-count { width: 100%; text-align: center; color: var(--text-muted); font-size: 12px; }
.uno-banner { font-weight: 700; min-height: 20px; text-align: center; }
.uno-prompt { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.uno-prompt-title { font-weight: 600; }
.uno-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.uno-pick { width: 52px; height: 52px; border-radius: 50%; border: 3px solid #fff; cursor: pointer; }
.uno-pick:hover { transform: scale(1.1); }
.uno-uno-btn { font-weight: 900; font-size: 18px; background: #c62828; }
@media (max-width: 700px) {
  .uno-wrap { --uw: 60px; --uh: 88px; }
}

/* ── Hokm ─────────────────────────────────────────────────────────────────── */

.hk-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.hk-score { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: stretch; }
.hk-team { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface2); }
.hk-team-mine { border-color: var(--accent); }
.hk-team-names { font-weight: 700; font-size: 13px; }
.hk-team-nums { font-size: 12px; color: var(--text-muted); }
.hk-trump { padding: 6px 14px; border-radius: 8px; background: #111; font-weight: 700; display: flex; align-items: center; }
.hk-red { color: #ef5350; }
.hk-table { position: relative; width: min(560px, calc(100vw - 20px)); height: min(360px, 60vw); min-height: 280px; border-radius: 50%/ 38%; background: radial-gradient(ellipse at center, #1f7a45, #14532d 75%); border: 8px solid #5b3a1e; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55); --card-w: 54px; --card-h: 77px; }
.hk-seat { position: absolute; text-align: center; padding: 3px 10px; border-radius: 10px; background: rgba(15, 20, 15, 0.85); border: 2px solid #3a4a3a; font-size: 12px; }
.hk-seat-bottom { bottom: 4px; left: 50%; transform: translateX(-50%); }
.hk-seat-top { top: 4px; left: 50%; transform: translateX(-50%); }
.hk-seat-left { left: 4px; top: 50%; transform: translateY(-50%); }
.hk-seat-right { right: 4px; top: 50%; transform: translateY(-50%); }
.hk-active { border-color: #ffd54f; box-shadow: 0 0 10px rgba(255, 213, 79, 0.7); }
.hk-me { border-color: var(--accent); }
.hk-seat-name { font-weight: 700; }
.hk-seat-count { color: var(--text-muted); font-size: 11px; }
.hk-timer { font-size: 12px; font-weight: 700; color: #ffd54f; min-height: 14px; }
.hk-trick { position: absolute; inset: 0; }
.hk-play { position: absolute; }
.hk-play-bottom { bottom: 22%; left: 50%; transform: translateX(-50%); }
.hk-play-top { top: 22%; left: 50%; transform: translateX(-50%); }
.hk-play-left { left: 22%; top: 50%; transform: translateY(-50%); }
.hk-play-right { right: 22%; top: 50%; transform: translateY(-50%); }
.hk-hand { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; padding: 12px 4px; --card-w: 62px; --card-h: 89px; min-height: 110px; }
.hk-banner { font-weight: 700; min-height: 20px; text-align: center; }
.hk-prompt { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hk-suit-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.hk-suit-btn { padding: 10px 16px; border-radius: 8px; font-size: 18px; font-weight: 700; background: #fbfbf6; color: #111; border: 2px solid #999; cursor: pointer; }
.hk-suit-btn.hk-red { color: #c62828; }
.hk-suit-btn:hover { border-color: #ffd54f; }
@media (max-width: 700px) {
  .hk-table { --card-w: 40px; --card-h: 57px; height: 300px; }
  .hk-play-left { left: 27%; }
  .hk-play-right { right: 27%; }
  .hk-seat { font-size: 11px; padding: 2px 6px; }
  .hk-hand { --card-w: 46px; --card-h: 66px; }
}

/* ── Spy ──────────────────────────────────────────────────────────────────── */

.spy-wrap { display: flex; flex-direction: column; gap: 12px; width: min(760px, 100%); margin: 0 auto; padding: 4px; }
.spy-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.spy-round { font-weight: 700; }
.spy-clock { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; direction: ltr; }
.spy-clock-low { color: #ff7043; }
.spy-paused { padding: 2px 10px; border-radius: 10px; background: var(--warning); color: #111; font-size: 12px; font-weight: 700; }
.spy-identity { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.spy-card { width: min(380px, 100%); padding: 16px; border-radius: 14px; text-align: center; background: linear-gradient(135deg, #1b5e20, #2e7d32); border: 2px solid #81c784; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); }
.spy-card-spy { background: linear-gradient(135deg, #4a148c, #7b1fa2); border-color: #ce93d8; }
.spy-card-hidden { background: #263238; border-color: #546e7a; }
.spy-card-title { font-size: 22px; font-weight: 800; }
.spy-card-sub { margin-top: 4px; opacity: 0.9; }
.spy-players { display: flex; flex-direction: column; gap: 4px; }
.spy-player { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; background: var(--surface2); border: 1px solid var(--border); flex-wrap: wrap; }
.spy-player-me { border-color: var(--accent); }
.spy-player-spy { border-color: #ce93d8; background: #2b1a33; }
.spy-pname { font-weight: 700; }
.spy-pscore { color: #ffd54f; font-weight: 700; }
.spy-asks { color: #4fc3f7; font-size: 12px; font-weight: 700; }
.spy-afk, .spy-waiting { color: var(--text-muted); font-size: 12px; }
.spy-voted { color: #69f0ae; }
.spy-pbtns { margin-inline-start: auto; display: flex; gap: 6px; }
.spy-phase { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.spy-accuse-title, .spy-reveal-title { font-size: 18px; font-weight: 800; }
.spy-hint { color: var(--text-muted); font-size: 12px; }
.spy-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.spy-loc-title { margin-bottom: 6px; color: var(--text-muted); font-size: 12px; text-transform: uppercase; }
.spy-loc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.spy-loc { padding: 8px 6px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-size: 13px; }
.spy-loc:hover { border-color: var(--accent); }
.spy-loc-crossed { text-decoration: line-through; opacity: 0.4; }
.spy-loc-picked { border-color: #ce93d8; background: #3b2a45; box-shadow: 0 0 0 2px #ce93d8; }
.spy-loc-secret { border-color: #69f0ae; background: #1b3a26; font-weight: 700; }

/* ── very small screens ───────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .board-wrapper { padding: 6px; }
  .game-header { padding: 6px 8px; flex-wrap: wrap; gap: 4px; }
  .game-header-right { flex-wrap: wrap; }
  .lobby-body { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ── stacked (phone) layout: the board keeps its natural height, the page scrolls ───────────────────────── */

@media (max-width: 700px) {
  #game-screen.active { height: auto; min-height: 100vh; overflow: visible; }
  .game-layout { overflow: visible; flex-direction: column; }
  .board-wrapper { flex: 0 0 auto; overflow: visible; padding: 6px 4px; min-height: 0; align-items: flex-start; }
  .game-sidebar { width: 100%; overflow: visible; flex: 0 0 auto; }
  .game-header { position: sticky; top: 0; z-index: 30; }
}
/* Phones held sideways: stack like portrait, but size every board by the (short) viewport height */
@media (max-height: 520px) and (orientation: landscape) {
  #game-screen.active { height: auto; min-height: 100vh; overflow: visible; }
  .game-layout { overflow: visible; flex-direction: column; }
  .board-wrapper { flex: 0 0 auto; overflow: visible; padding: 4px; min-height: 0; align-items: flex-start; }
  .game-sidebar { width: 100%; overflow: visible; flex: 0 0 auto; border-left: none; border-top: 1px solid var(--border); }
  .game-header { position: sticky; top: 0; z-index: 30; padding: 4px 10px; }
  .chess-wrap { --chess-size: min(calc(100vh - 110px), 60vw); flex-direction: row; }
  .chess-moves { width: 120px; max-height: var(--chess-size); }
  .bg-wrap { --bg-w: min(calc(100vw - 16px), 820px); --bg-h: calc(100vh - 150px); }
  .pk-wrap { --tw: min(calc(100vw - 16px), 820px); --th: calc(100vh - 140px); }
  .pk-table { margin: 40px 0 26px; --pk-rx: 40%; --pk-ry: 38%; }
  .pk-hole .pcard-sm { --card-w: 30px; --card-h: 43px; }
  .pk-seat.pk-me { --card-w: 38px; --card-h: 54px; }
  .pk-center { --card-w: 32px; --card-h: 46px; gap: 2px; }
  .pk-center .pk-meta { display: none; }
  .uno-wrap { --uw: 52px; --uh: 76px; }
  .hk-table { height: 250px; --card-w: 38px; --card-h: 54px; }
  .hk-hand { --card-w: 44px; --card-h: 63px; }
}
