:root {
  --bg0: #0c1210;
  --bg1: #152019;
  --ink: #e8f0ea;
  --muted: #8fa396;
  --accent: #3dcf7a;
  --line: rgba(232, 240, 234, 0.14);
  --card: rgba(255, 255, 255, 0.04);
  --warn: #e8c56b;
  --danger: #ff8a7a;
  --light: #d7eccf;
  --dark: #2a5a3d;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(165deg, var(--bg0), var(--bg1) 55%, #090d0b);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
a { color: inherit; text-decoration: none; }
.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
}
.brand { font-family: "Bebas Neue", sans-serif; letter-spacing: 0.04em; font-size: 1.35rem; }
.brand span { color: var(--accent); }
.nav { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.nav a {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
}
.nav a.on { color: var(--ink); border: 1px solid var(--line); background: var(--card); }

.game {
  width: min(1680px, 100%);
  margin: 0 auto;
  padding: 0.7rem 1.1rem 2.2rem;
  flex: 1;
}
.lede { margin: 0 0 1rem; color: var(--muted); font-size: 0.92rem; line-height: 1.45; }
h1 {
  font-family: "Bebas Neue", sans-serif;
  letter-spacing: 0.04em;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  margin: 0 0 0.2rem;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
}
.actions { display: grid; gap: 0.7rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
input[type="text"] {
  flex: 1;
  min-width: 8rem;
  background: #0b1410;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  font: inherit;
}
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #1a2a20;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.7rem 1.05rem;
  font-weight: 700;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #062214; border-color: transparent; }
.btn.small { padding: 0.45rem 0.75rem; font-size: 0.82rem; }
.msg { margin: 0.6rem 0 0; color: var(--warn); font-size: 0.9rem; }
.cpu-row { display: grid; gap: 0.4rem; }
.cpu-label { color: var(--muted); font-size: 0.85rem; }
.cpu-picks { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.cpu-pick {
  appearance: none;
  border: 1px solid var(--line);
  background: #0b1410;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-weight: 700;
  cursor: pointer;
}
.cpu-pick.on { background: var(--accent); color: #062214; border-color: transparent; }
.style-picks .cpu-pick { font-size: 0.82rem; }

.table { display: grid; gap: 0.85rem; }
#lobby[hidden], #table[hidden], #promo[hidden], #shareRow[hidden] { display: none !important; }
@media (min-width: 900px) {
  .table { grid-template-columns: minmax(0, 1fr) 300px; align-items: stretch; }
}

.table .chess-stage {
  width: 100% !important;
  max-width: none !important;
  margin: 0;
}
.table .chess-canvas-wrap {
  position: relative;
  aspect-ratio: 16 / 12;
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 0%, #7ec8e8 0%, #c9d96a 55%, #6b8f2e 100%);
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.play-col {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.4rem;
  margin: 0.65rem 0;
}
.dot.O { background: #ef6c00; }
.dot.P { background: #7b1fa2; }
.cpu-6 { display: none; }
body.is-6p .cpu-6 { display: inline-flex; }
body.is-6p .styles-4 { display: none; }
body.is-6p .styles-6 { display: grid !important; }
.styles-6[hidden] { display: none !important; }
.scoreboard .seat {
  background: #0b1410;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.45rem 0.55rem;
  font-size: 0.78rem;
}
.scoreboard .seat.lead { border-color: var(--accent); }
.scoreboard .seat b { display: block; font-size: 0.9rem; }
.continue-row { display: none; justify-content: center; margin: 0.7rem 0; }
.continue-row.show { display: flex; }
.hud, .players {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.hud-block {
  background: #0b1410;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  min-width: 5.5rem;
}
.hud-block .label {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.dot.white { background: #d4dce6; border: 1px solid #0004; }
.dot.black { background: #e0b040; }
.dot.R { background: #c62828; }
.dot.G { background: #2e7d32; }
.dot.Y { background: #f9a825; }
.dot.B { background: #1565c0; }
.table .chess-canvas-wrap canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
}
/* Old floating turn/score HUD — killed (duplicated room status + overlapped scores) */
.chess-hud-overlay {
  display: none !important;
}
.chess-hud-overlay .btn-roll {
  display: none !important;
}
/* One stacked chrome: room → players → scores → race line. No absolute pile-ups. */
.board-chrome {
  position: absolute;
  top: 10px;
  left: 10px;
  right: calc(10px + 72px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  pointer-events: none;
  max-height: min(42%, 280px);
  overflow: hidden;
}
.in-game-info {
  position: static;
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  pointer-events: none;
  transform: none;
}
.igi-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  align-items: stretch;
}
.igi-block {
  pointer-events: none;
  min-width: 4.5rem;
  padding: 0.35rem 0.6rem;
  border-radius: 12px;
  background: rgba(8, 14, 12, 0.92);
  border: 1px solid rgba(232, 240, 234, 0.16);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
  color: #f2f7f3;
}
.igi-block.igi-status { flex: 1 1 12rem; min-width: min(100%, 12rem); }
.igi-label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.1rem;
}
.igi-block strong {
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.2;
}
.igi-copy {
  pointer-events: auto;
  align-self: center;
  padding: 0.45rem 0.75rem !important;
  font-size: 0.78rem !important;
  background: rgba(8, 14, 12, 0.92) !important;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}
.igi-players {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
}
.igi-seat {
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: rgba(8, 14, 12, 0.88);
  border: 1px solid rgba(232, 240, 234, 0.14);
  color: #e8f0ea;
  font-size: 0.74rem;
  font-weight: 700;
}
.igi-seat.empty { opacity: 0.55; }
.igi-seat.you { border-color: var(--accent); }
.game-menu-room {
  margin: 0.45rem 0 0;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 800;
}
.score-strip {
  position: static;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  pointer-events: none;
  width: 100%;
  max-width: 720px;
}
.score-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(8, 14, 12, 0.88);
  border: 1px solid rgba(232, 240, 234, 0.16);
  color: #f2f7f3;
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}
.score-chip.lead {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent);
}
.score-chip .dot { margin: 0; }
.how-win {
  position: static;
  margin: 0;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: rgba(8, 14, 12, 0.78);
  color: #d7e6db;
  font-size: 0.72rem;
  font-weight: 600;
  pointer-events: none;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: none;
}
.game-over {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(4, 8, 6, 0.55);
  backdrop-filter: blur(4px);
}
.game-over[hidden] { display: none !important; }
.game-over-card {
  width: min(420px, 94%);
  background: #101a14;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.15rem 1.2rem 1.25rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  text-align: center;
}
.game-over-kicker {
  margin: 0 0 0.25rem;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.game-over-card h2 {
  margin: 0 0 0.35rem;
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(2rem, 5vw, 2.6rem);
  letter-spacing: 0.03em;
  color: var(--accent);
}
.game-over-card #gameOverSub {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.game-over-standings {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.35rem;
  text-align: left;
}
.game-over-standings li {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  background: #0b1410;
  border: 1px solid var(--line);
  font-size: 0.88rem;
}
.game-over-standings li.winner {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}
.game-over-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}
.game-over-actions .btn { min-width: 8.5rem; }

/* Chat + log docked inside the 3D canvas */
.in-game-side {
  position: absolute;
  top: 118px;
  right: 10px;
  bottom: 72px;
  width: min(260px, 34%);
  z-index: 17;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  pointer-events: none;
}
.in-game-side > * { pointer-events: auto; }
.in-game-log,
.in-game-chat {
  background: rgba(8, 14, 12, 0.9);
  border: 1px solid rgba(232, 240, 234, 0.16);
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}
.in-game-log {
  flex: 0 1 28%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.45rem 0.5rem 0.35rem;
}
.in-game-chat {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0;
  max-height: none;
}
.in-game-side h2 {
  margin: 0;
  padding: 0.15rem 0.25rem 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  flex-shrink: 0;
}
.in-game-log .moves {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  margin: 0;
  padding: 0 0.25rem 0.25rem 1.1rem;
  overflow: auto;
  font-size: 0.72rem;
}
.in-game-chat .chat-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
}
.in-game-chat .chat-form {
  flex-shrink: 0;
  padding: 0.35rem;
  border-top: 1px solid rgba(232, 240, 234, 0.12);
  background: rgba(0, 0, 0, 0.2);
}
.in-game-chat .chat-form .btn {
  padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
}
.analytics-chip {
  position: absolute;
  top: auto;
  bottom: 72px;
  left: 10px;
  z-index: 18;
  max-width: min(52%, 280px);
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(8, 14, 12, 0.9);
  border: 1px solid rgba(61, 207, 122, 0.35);
  color: #e8f0ea;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
.analytics-chip .analytics-kicker {
  display: block;
  color: var(--accent);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.1rem;
}
.analytics-chip strong { color: #fff; }
.game-menu-analytics {
  margin: 0.45rem 0 0;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  background: rgba(61, 207, 122, 0.1);
  border: 1px solid rgba(61, 207, 122, 0.25);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
}
.btn-game-menu {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 18;
  appearance: none;
  border: 1px solid rgba(232, 240, 234, 0.22);
  background: rgba(8, 14, 12, 0.9);
  color: #f2f7f3;
  font: inherit;
  font-weight: 800;
  font-size: 0.82rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4);
}
.btn-game-menu:hover { border-color: var(--accent); }
.game-menu {
  position: absolute;
  z-index: 28;
  min-width: min(280px, 86%);
  max-width: min(360px, 92%);
  padding: 0.7rem;
  border-radius: 14px;
  background: rgba(10, 16, 13, 0.96);
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}
.game-menu[hidden] { display: none !important; }
.game-menu-title {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink);
}
.game-menu-title span { color: var(--muted); font-weight: 600; }
.game-menu-styles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}
.game-menu-styles .cpu-pick {
  font-size: 0.72rem;
  padding: 0.32rem 0.6rem;
}
.game-menu-sep {
  height: 1px;
  margin: 0.45rem 0;
  background: var(--line);
}
.game-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.55rem 0.45rem;
  border-radius: 8px;
  cursor: pointer;
}
.game-menu-item:hover { background: rgba(61, 207, 122, 0.12); }
.game-menu-hint {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.68rem;
}

/* Controls live ON the 3D canvas — not in a bar above the game */
.board-actions {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 16;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.45rem;
  width: min(96%, 560px);
  pointer-events: none;
}
.board-actions .btn {
  pointer-events: auto;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}
.btn-reset-cam {
  min-height: 2.5rem;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  font-weight: 700;
  background: rgba(12, 20, 16, 0.92);
}
.btn-roll-bar {
  min-width: 9.5rem;
  font-size: 1.1rem;
  padding: 0.75rem 1.35rem;
  border-radius: 999px;
}
.btn-leave-in {
  font-size: 0.8rem;
  padding: 0.55rem 0.85rem;
  background: rgba(12, 20, 16, 0.88);
}
.roll-row { display: none !important; }
.btn-roll {
  position: static;
  left: auto;
  bottom: auto;
  transform: none;
  z-index: 12;
  appearance: none;
  border: 0;
  background: #ffd21a;
  color: #1a1200;
  font-family: inherit;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(0,0,0,.4);
  cursor: pointer;
}
.btn-roll[hidden] { display: none !important; }
#btnRoll:disabled, #btnRollBar:disabled {
  opacity: 0.38;
  cursor: default;
  filter: grayscale(0.55);
  box-shadow: none;
  animation: none !important;
}
@keyframes rollPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.btn-roll:not(:disabled), .btn-roll-bar:not(:disabled) { animation: rollPulse 1.05s ease-in-out infinite; }

.chat-box {
  display: flex;
  flex-direction: column;
  min-height: 180px;
  max-height: 280px;
  margin-top: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b1410;
  overflow: hidden;
}
.chat-log {
  flex: 1;
  overflow: auto;
  padding: 0.55rem 0.7rem;
  font-size: 0.82rem;
  line-height: 1.35;
}
.chat-line { margin: 0 0 0.4rem; color: var(--ink); }
.chat-line b { color: var(--accent); }
.chat-line[data-c="w"] b { color: #d4dce6; }
.chat-line[data-c="b"] b { color: #e0b040; }
.chat-form {
  display: flex;
  gap: 0.35rem;
  padding: 0.4rem;
  border-top: 1px solid var(--line);
}
.chat-form input {
  flex: 1;
  min-width: 0;
  text-transform: none;
  letter-spacing: 0;
  padding: 0.45rem 0.6rem;
  font-size: 0.85rem;
}
.lobby-chat { margin-top: 1rem; }

.stage {
  perspective: 1200px;
  padding: 1.2rem 0 1.6rem;
}
.board3d {
  width: min(100%, 480px);
  margin: 0 auto;
  aspect-ratio: 1;
  transform: rotateX(18deg);
  transform-style: preserve-3d;
  position: relative;
  filter: drop-shadow(0 18px 16px rgba(0,0,0,.4));
}
.board {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border: 8px solid #1a2e22;
  border-radius: 6px;
  transform-style: preserve-3d;
  touch-action: manipulation;
  user-select: none;
}
.sq {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.35rem, 6vw, 2.35rem);
  cursor: pointer;
  border: 0;
  transform-style: preserve-3d;
}
.sq.light { background: var(--light); color: #163; }
.sq.dark { background: var(--dark); color: #f4fff6; }
.sq::before {
  content: "";
  position: absolute;
  inset: auto 0 -4px 0;
  height: 4px;
  background: inherit;
  filter: brightness(0.6);
  transform: translateZ(-1px);
}
.sq.selected { outline: 3px solid #7dffb3; outline-offset: -3px; z-index: 2; }
.sq.last { box-shadow: inset 0 0 0 999px rgba(232, 197, 107, 0.28); }
.sq.legal::after {
  content: "";
  width: 26%;
  height: 26%;
  border-radius: 50%;
  background: #3dcf7acc;
  position: absolute;
}
.sq.legal.capture::after {
  width: 76%;
  height: 76%;
  background: transparent;
  border: 3px solid #3dcf7acc;
}
.piece {
  display: block;
  transform: rotateX(-18deg) translateZ(10px);
  text-shadow: 0 3px 0 rgba(0,0,0,.28);
  line-height: 1;
  pointer-events: none;
}
.sq.piece-w .piece { color: #f7fff8; filter: drop-shadow(0 2px 1px #000a); }
.sq.piece-b .piece { color: #121612; }

.turn {
  text-align: center;
  font-weight: 700;
  margin: 0;
  color: var(--accent);
}
.turn.warn { color: var(--warn); }
.turn.danger { color: var(--danger); }
.share { display: flex; gap: 0.5rem; }
.share input { text-transform: none; font-size: 0.8rem; }
.promo {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  align-items: center;
}
.promo button {
  background: #1a2a20;
  border: 1px solid var(--accent);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
}
.moves {
  max-height: 220px;
  overflow: auto;
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.85rem;
  columns: 1;
}
.side h2 { font-size: 0.95rem; margin: 0 0 0.5rem; color: var(--muted); }

.open-rooms {
  display: grid;
  gap: 0.55rem;
  margin: 0 0 1rem;
  padding: 0.85rem;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.open-rooms h2 { font-size: 1.05rem; margin: 0; color: var(--ink); }
.open-room {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.28);
}
.open-room .meta { flex: 1; min-width: 0; }
.open-room strong { display: block; }
.open-room span { color: var(--muted); font-size: 0.82rem; }
.open-rooms .empty { color: var(--muted); font-size: 0.88rem; margin: 0; }

.dice-overlay {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.dice-who {
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(18, 24, 20, 0.72);
  color: #f4efe4;
}
.dice-cube {
  width: 78px;
  height: 78px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 2.6rem;
  line-height: 1;
  color: #1a1410;
  background:
    radial-gradient(circle at 30% 28%, #fff 0%, #f3ebe0 42%, #d9cbb8 100%);
  box-shadow:
    0 16px 32px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 #fff8,
    inset 0 -6px 10px rgba(80, 50, 20, 0.18);
  animation: dice-tumble 0.9s cubic-bezier(0.18, 0.7, 0.32, 1) both;
}
@keyframes dice-tumble {
  0% { transform: rotateX(-40deg) rotateY(18deg) rotateZ(0) scale(0.35); opacity: 0; }
  35% { transform: rotateX(220deg) rotateY(160deg) rotateZ(40deg) scale(1.12); opacity: 1; }
  70% { transform: rotateX(480deg) rotateY(300deg) rotateZ(-12deg) scale(1); }
  100% { transform: rotateX(720deg) rotateY(360deg) rotateZ(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .board3d { transform: none; filter: none; }
  .piece { transform: none; }
  .sq::before { display: none; }
  .dice-cube { animation: none; }
}

/* Ludo-only extras on top of shared fit-viewport.css */
html.fit-viewport body.is-playing .cpu-row { gap: 0.15rem; flex-shrink: 0; }
html.fit-viewport body.is-playing .cpu-label {
  font-size: 0.68rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html.fit-viewport body.is-playing .style-picks .cpu-pick {
  font-size: 0.7rem;
  padding: 0.28rem 0.55rem;
}
html.fit-viewport body.is-playing .scoreboard {
  margin: 0;
  gap: 0.25rem;
  flex-shrink: 0;
}
html.fit-viewport body.is-playing .scoreboard .seat {
  padding: 0.22rem 0.4rem;
  font-size: 0.68rem;
}
html.fit-viewport body.is-playing .scoreboard .seat b { font-size: 0.78rem; }
html.fit-viewport body.is-playing .turn { display: none; }
html.fit-viewport body.is-playing .continue-row { display: none !important; }
html.fit-viewport body.is-playing .hud,
html.fit-viewport body.is-playing .players,
html.fit-viewport body.is-playing .cpu-row,
html.fit-viewport body.is-playing .scoreboard,
html.fit-viewport body.is-playing .share {
  display: none !important;
}
html.fit-viewport body.is-playing #table.table {
  grid-template-columns: 1fr !important;
}
html.fit-viewport body.is-playing .btn-game-menu {
  right: calc(10px + min(260px, 34%) + 8px);
}
@media (max-width: 720px) {
  .in-game-side {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 64px;
    width: auto;
    max-height: 34%;
  }
  html.fit-viewport body.is-playing .btn-game-menu { right: 10px; }
  .board-actions { bottom: 8px; }
}
html.fit-viewport body.is-playing.game-finished .board-actions .btn-roll-bar {
  display: none;
}
@media (max-width: 900px) {
  .board-chrome {
    right: 10px;
    max-height: min(38%, 240px);
  }
  .analytics-chip { bottom: 118px; }
}

