/* bunco/public/css/game.css — only what is specific to Bunco's table.
   Page chrome, seats, lobby, reveal screens and the settings sheet come from
   the shared kit stylesheets; the dice tray (.bd-*) is this game's own. */

/* Room reserved around the felt for the top bar, info strip and this game's
   tray (status row + the throwing table + button + hint). */
.table-felt { --tbl-felt-chrome: 350px; }

/* ── Felt centre: kept small — up to 12 seats are clamped around it ──── */
#table-center { align-items: center; }
.bc-center { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; color: var(--tbl-text); }
.bc-center-top { display: flex; align-items: center; gap: 8px; }
.bc-center-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
.bc-center-label { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--tbl-text-muted); }
.bc-center-round { font-family: var(--font-display); font-weight: 800; font-size: 1.9rem; color: var(--tbl-accent); }
.bc-center-round small { font-size: 0.8rem; color: var(--tbl-text-mid); font-weight: 700; }
.bc-target { font-size: 0.78rem; color: var(--tbl-text-mid); }
.bc-target b { color: var(--tbl-text); }
.bc-lead { font-size: 0.7rem; color: var(--tbl-text-mid); }
.bc-lead b { color: var(--tbl-accent); }
.bc-vs { display: flex; align-items: baseline; gap: 6px; font-size: 0.78rem; font-weight: 700; color: var(--tbl-text-mid); }
.bc-vs b { font-family: var(--font-display); font-size: 1.15rem; color: var(--tbl-text); }
.bc-vs .lead b { color: var(--tbl-accent); }
.bc-vs-a { color: #7cb8ff; }
.bc-vs-b { color: #ff9d80; }
.bc-vs-dash { color: var(--tbl-text-muted); }

/* the round's die face (pure CSS pips) */
.bc-face {
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  width: 30px; height: 30px; padding: 4px; box-sizing: border-box;
  background: #f6efe0; border-radius: 7px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.bc-face i { border-radius: 50%; margin: 1px; }
.bc-face i.on { background: #1d1d1d; }

/* ── Seat tokens ──────────────────────────────────────────────────────── */
.bc-pts { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; line-height: 1; color: var(--tbl-text); }
.tk-seat.sitting-out { opacity: 0.6; }
.tk-muted { font-size: 0.66rem; color: var(--tbl-text-muted); }
.tk-seat.bc-team-a { box-shadow: 0 0 0 2px rgba(124, 184, 255, 0.55); }
.tk-seat.bc-team-b { box-shadow: 0 0 0 2px rgba(255, 157, 128, 0.55); }
.tk-badge.bc-badge-a { background: #4f9bf2; color: #fff; }
.tk-badge.bc-badge-b { background: #f2704c; color: #fff; }
/* lobby pips */
.mgmt-seat-slot.bc-team-a .sn { color: #7cb8ff; }
.mgmt-seat-slot.bc-team-b .sn { color: #ff9d80; }
.bc-chip { color: var(--tbl-accent); font-weight: 700; }

/* ── Lobby panel (same look as Rummy's / Pitch's) ─────────────────────── */
.gm-panel { display: flex; flex-direction: column; gap: 12px; background: var(--tbl-panel-bg); border: 1px solid var(--tbl-panel-border); border-radius: 12px; padding: 12px 14px; }
.gm-panel-row { display: flex; flex-direction: column; gap: 6px; }
.gm-panel-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--tbl-text-muted); font-weight: 700; }
.bc-hint { font-size: 0.78rem; color: var(--tbl-text-mid); margin: 0; text-align: center; }
.toggle-row { display: flex; gap: 6px; flex-wrap: wrap; }
.toggle-btn {
  flex: 1; min-width: 60px;
  padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--tbl-panel-border); background: rgba(255, 255, 255, 0.04);
  color: var(--tbl-text-mid); font-family: var(--font-body); font-weight: 700; font-size: 0.82rem; cursor: pointer;
}
.toggle-btn.active { border-color: var(--tbl-accent); color: var(--tbl-accent); background: color-mix(in srgb, var(--tbl-accent) 12%, transparent); }

/* ── The pad in your tray ─────────────────────────────────────────────── */
/* Three dice rest in your hand; swipe up and they leave it. They land on the
   table (the .bt-* layer below), thrown from your seat. */
#bc-dice { width: 100%; max-width: 440px; margin: 0 auto 6px; padding: 0 4px; box-sizing: border-box; max-height: 400px; transition: max-height 0.45s ease, opacity 0.35s ease, margin 0.45s ease; }
#bc-dice.bc-folded { max-height: 0; opacity: 0; margin: 0 auto; overflow: hidden; pointer-events: none; }
.bd-arena {
  --bd-k: 1;
  position: relative;
  width: 100%;
  aspect-ratio: 360 / 135;
  overflow: hidden;
  border-radius: 16px;
  background:
    radial-gradient(120% 140% at 50% 30%, rgba(255, 255, 255, 0.10), rgba(0, 0, 0, 0.28) 100%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.025) 0 3px, rgba(0, 0, 0, 0.025) 3px 6px),
    var(--tbl-felt, #1c6b45);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.bd-arena.bd-can-throw { cursor: grab; }
.bd-arena.bd-holding { cursor: grabbing; }
.bd-arena.bd-round-over { opacity: 0.92; }
.bd-arena::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  border: calc(var(--bd-k) * 6px) solid #6b4423;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.55);
}
.bd-felt-num {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: calc(var(--bd-k) * 100px);
  color: rgba(255, 255, 255, 0.07); pointer-events: none;
}
.bd-pieces { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
/* when the hand is empty: whose throw it is */
.bd-wait {
  position: absolute; inset: 0; z-index: 2; display: none; align-items: center; justify-content: center; text-align: center;
  padding: 0 14%; pointer-events: none; color: rgba(255, 255, 255, 0.75); font-weight: 700; font-size: 0.9rem; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.bd-arena.bd-thrown .bd-wait:not(:empty) { display: flex; }

/* ── A die: its own little perspective, centred on it, around a cube ───── */
.bd-shadow {
  position: absolute; left: 0; top: 0; width: var(--bd-size, 40px); height: var(--bd-size, 40px);
  border-radius: 22%; background: rgba(0, 0, 0, 0.55); filter: blur(3px); will-change: transform;
}
.bd-shadow.match { background: rgba(255, 214, 90, 0.75); filter: blur(7px); }
.bd-die {
  position: absolute; left: 0; top: 0; width: var(--bd-size, 40px); height: var(--bd-size, 40px);
  perspective: calc(var(--bd-size, 40px) * 8); will-change: transform;
}
.bd-cube { position: absolute; inset: 0; transform-style: preserve-3d; will-change: transform; }
.bd-face {
  --h: calc(var(--bd-size, 40px) / 2);
  position: absolute; inset: 0; box-sizing: border-box;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  padding: 13%; border-radius: 16%;
  background: linear-gradient(145deg, #fffaf0, #e9dfc8);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18), inset 0 -3px 5px rgba(0, 0, 0, 0.12);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.bd-face i { border-radius: 50%; margin: 8%; }
.bd-face i.on { background: radial-gradient(circle at 35% 30%, #4a4a4a, #111 70%); }
.bd-f1 i.on { background: radial-gradient(circle at 35% 30%, #e8514a, #a8191a 75%); }
.bd-f1 { transform: translateZ(var(--h)); }
.bd-f6 { transform: rotateY(180deg) translateZ(var(--h)); }
.bd-f2 { transform: rotateY(90deg) translateZ(var(--h)); }
.bd-f5 { transform: rotateY(-90deg) translateZ(var(--h)); }
.bd-f3 { transform: rotateX(-90deg) translateZ(var(--h)); }
.bd-f4 { transform: rotateX(90deg) translateZ(var(--h)); }
.bd-die.match .bd-face { box-shadow: inset 0 0 0 2px rgba(255, 196, 0, 0.9), 0 0 10px 1px rgba(255, 214, 90, 0.8); background: linear-gradient(145deg, #fffbe6, #f3e2a0); }

/* the hand: the dice come to it when it is your throw, and leave it up the pad when thrown */
.bd-arena .bd-die, .bd-arena .bd-shadow { transition: translate 0.32s ease-out, scale 0.32s ease-out, opacity 0.3s ease-out; }
.bd-arena.bd-thrown .bd-die, .bd-arena.bd-thrown .bd-shadow { translate: 0 -80px; scale: 0.5; opacity: 0 !important; transition: translate 0.2s ease-in, scale 0.2s ease-in, opacity 0.2s ease-in; }

/* the nudge to throw */
.bd-hint {
  position: absolute; left: 0; right: 0; bottom: calc(var(--bd-k) * 8px + 2px); z-index: 3;
  display: none; flex-direction: column; align-items: center; pointer-events: none;
  color: rgba(255, 255, 255, 0.85); font-size: 0.74rem; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}
.bd-chev { font-size: 1.1rem; line-height: 0.6; animation: bd-bob 1.1s ease-in-out infinite; }
.bd-arena.bd-can-throw:not(.bd-holding) .bd-hint { display: flex; }
@keyframes bd-bob { 0%, 100% { transform: translateY(2px); opacity: 0.5; } 50% { transform: translateY(-5px); opacity: 1; } }

/* how hard the swipe is */
.bd-power { position: absolute; left: calc(var(--bd-k) * 14px); top: 16%; bottom: 14%; width: 6px; border-radius: 4px; background: rgba(0, 0, 0, 0.35); z-index: 3; opacity: 0; transition: opacity 0.12s; overflow: hidden; display: flex; align-items: flex-end; }
.bd-power i { display: block; width: 100%; height: 0; background: linear-gradient(0deg, #f6d046, #ff6a3d); border-radius: 4px; }
.bd-arena.bd-holding .bd-power { opacity: 1; }

/* ── The table: the dice fly across the felt oval from the thrower's seat ─ */
.bt-layer { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.5s ease; }
.bt-layer.on { opacity: 1; transition: opacity 0.08s; }
#table-overlay.bt-active { z-index: 30; }                 /* dice fly over the seat tokens (they rest beside them) */
#table-center { transition: opacity 0.35s ease; }
#table-center.bt-dim { opacity: 0.22; }
/* what the throw scored */
.bt-callout {
  position: absolute; left: 0; right: 0; top: 50%; z-index: 400; text-align: center; pointer-events: none;
  transform: translateY(-50%);
  font-family: var(--font-display); font-weight: 800; font-size: 1.9rem; letter-spacing: 0.02em; line-height: 1;
  color: #fff; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8); opacity: 0;
}
.bt-callout.hit { color: var(--tbl-accent, #ffe438); }
.bt-callout.none { color: rgba(255, 255, 255, 0.8); font-size: 1.2rem; }
.bt-callout.mini { color: #8be9fd; font-size: 1.5rem; }
.bt-callout.bunco { color: #ffd23f; font-size: 2.6rem; text-shadow: 0 0 18px rgba(255, 210, 63, 0.9), 0 3px 12px rgba(0, 0, 0, 0.7); }
.bt-callout.show { animation: bt-pop 1.7s ease-out forwards; }
.bt-callout.bunco.show { animation-duration: 2.4s; }
@keyframes bt-pop {
  0% { opacity: 0; transform: translateY(-30%) scale(0.6); }
  14% { opacity: 1; transform: translateY(-50%) scale(1.12); }
  26% { transform: translateY(-50%) scale(1); }
  76% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-80%) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .bd-chev { animation: none; opacity: 0.8; }
  .bt-callout.show { animation: none; opacity: 1; }
  .bd-arena .bd-die, .bd-arena .bd-shadow, .bd-arena.bd-thrown .bd-die, .bd-arena.bd-thrown .bd-shadow { transition: none; }
}

/* ── Round result, standings, scoreboard ──────────────────────────────── */
.bc-res { width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: 6px; margin: 0 auto; }
.bc-res-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 9px 14px; border-radius: 10px; font-weight: 600;
  background: var(--tbl-panel-bg); border: 1px solid var(--tbl-panel-border);
}
.bc-res-row.winner { border-color: #43a047; background: color-mix(in srgb, #43a047 14%, var(--tbl-panel-bg)); }
.bc-res-row small { color: var(--tbl-text-muted); font-weight: 600; }
.bc-res-pts { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; color: var(--tbl-accent); }
.bc-standings-title { margin: 14px auto 6px; text-align: center; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--tbl-text-muted); font-weight: 700; }
.bc-note { font-size: 0.78rem; color: var(--tbl-text-muted); margin: 8px auto 0; text-align: center; max-width: 480px; }
.bc-score-table { width: 100%; max-width: 560px; margin: 0 auto; border-collapse: collapse; font-size: 0.78rem; }
.bc-score-table th, .bc-score-table td { padding: 5px 6px; text-align: center; border-bottom: 1px solid var(--tbl-panel-border); }
.bc-score-table th:first-child, .bc-score-table td:first-child { text-align: left; font-weight: 700; }
.bc-score-table td.won { color: #6bd47a; font-weight: 800; }
.bc-score-table td.now { color: var(--tbl-accent); font-weight: 700; }
.bc-score-table td.total { font-weight: 800; color: var(--tbl-accent); }
.bc-score-table tr.leader td { color: var(--tbl-accent); font-weight: 800; }
.bc-score-table small { color: var(--tbl-text-muted); font-weight: 600; }
.bc-final td:nth-child(2), .bc-final th:nth-child(2) { text-align: left; }
.bc-final th:first-child, .bc-final td:first-child { text-align: center; }
.bc-modal-box { max-width: 560px; width: 92%; max-height: 80dvh; overflow: auto; }
.bc-modal-box h2 { margin: 0 0 10px; font-family: var(--font-display); font-size: 1.1rem; text-align: center; }
.bc-modal-body { margin-bottom: 14px; }

@media (max-width: 480px) {
  #bc-dice { padding: 0; }
  .bc-center-round { font-size: 1.5rem; }
  .bc-face { width: 24px; height: 24px; padding: 3px; }
  .bc-pts { font-size: 1rem; }
  .bt-callout { font-size: 1.5rem; }
  .bt-callout.bunco { font-size: 2.1rem; }
  .bc-score-table { font-size: 0.7rem; }
  .bc-score-table th, .bc-score-table td { padding: 4px 3px; }
}
/* The tray keeps one height whatever is going on, so the throwing table never
   moves under a finger (the hint changes text, never size). */
#waiting-hint, #waiting-hint:empty { display: block; min-height: 1.4em; margin: 2px 0 0; line-height: 1.4; font-size: 0.82rem; }
#my-status-row { min-height: 1.6em; }

/* "Just roll" — a throw without a swipe, tucked in the corner of the table */
.bd-quick {
  position: absolute; right: calc(var(--bd-k) * 12px); bottom: calc(var(--bd-k) * 12px); z-index: 5;
  display: none; padding: 5px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(0, 0, 0, 0.38); color: #fff;
  font-family: var(--font-body); font-weight: 700; font-size: 0.72rem; backdrop-filter: blur(2px);
}
.bd-arena.bd-can-throw:not(.bd-holding) .bd-quick { display: block; }
