/* Call Bridge's shared look: theme colours and the playing cards, used by
   home.html, board.html (TV) and player.html (phone), on top of /shared.css.
   Card classes are .cb-* — /shared.css already styles .card-face, .cell,
   .chip and .corner for the board-grid games. */

:root {
  --cb-bg: #1b3d5e;
  --cb-bg-top: #2c5d8a;
  --cb-bg-dark: #0b1b2c;
  --cb-felt: #1f6b4f;
  --cb-felt-dark: #0f3f2e;
  --cb-line: rgba(255, 255, 255, 0.14);
  --cb-muted: #a9bdd0;
  --cb-red: #d0312d;
  --cb-ink: #1d2733;
  --cb-good: #45dd9e;
  --cb-bad: #ff8a8a;
}

.hidden { display: none !important; }
.muted { color: var(--cb-muted); }
.bot-tag { font-size: 0.68rem; font-weight: 800; padding: 1px 5px; border-radius: 4px; background: rgba(255, 255, 255, 0.16); color: #dfe8f1; vertical-align: 1px; }
.dealer-chip {
  display: inline-flex; align-items: center; justify-content: center; width: 1.35em; height: 1.35em; border-radius: 50%;
  background: #fff; color: var(--cb-ink); font-size: 0.72em; font-weight: 900; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.pts-good { color: var(--cb-good); }
.pts-bad { color: var(--cb-bad); }

/* ===================================================================== */
/* Playing cards                                                         */
/* ===================================================================== */
.cb-card {
  --w: 72px;
  position: relative;
  flex: none;
  width: var(--w);
  height: calc(var(--w) * 1.4);
  border-radius: calc(var(--w) * 0.09);
  background: #fdfdfb;
  color: var(--cb-ink);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  font-weight: 800;
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.cb-card.red { color: var(--cb-red); }
.cb-card .ix {
  position: absolute; top: calc(var(--w) * 0.06); left: calc(var(--w) * 0.07);
  display: flex; flex-direction: column; align-items: center;
  font-size: calc(var(--w) * 0.2);
}
.cb-card .ix b { font-size: calc(var(--w) * 0.26); letter-spacing: -0.04em; }
.cb-card .ix.br { top: auto; left: auto; bottom: calc(var(--w) * 0.06); right: calc(var(--w) * 0.07); transform: rotate(180deg); }
.cb-card .mid {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--w) * 0.5);
}
.cb-card .mid.face {
  top: 22%; right: 22%; bottom: 22%; left: 22%;
  flex-direction: column; gap: 2%;
  border: calc(var(--w) * 0.025) solid currentColor; border-radius: calc(var(--w) * 0.06);
  font-size: calc(var(--w) * 0.24);
  background: linear-gradient(160deg, rgba(242, 193, 78, 0.28), rgba(242, 193, 78, 0.08));
}
.cb-card .mid.face b { font-size: calc(var(--w) * 0.32); }
.cb-card.back {
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.18) 0 18%, transparent 19%),
    repeating-linear-gradient(45deg, #2c5d8a 0 5px, #234d76 5px 10px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35), inset 0 0 0 calc(var(--w) * 0.05) #fdfdfb;
}

/* A fan of backs: how many cards a player holds. Each card is turned a few
   degrees about a point below the fan (cards.js sets the angles). */
.fan { position: relative; width: 60px; height: 40px; }
.fan .cb-card { --w: 22px; position: absolute; left: 50%; bottom: 0; margin-left: -11px; transform-origin: 50% 150%; }

/* The trick on the table: one card per seat, pushed toward whoever played it. */
.trick { position: relative; }
.trick .slot { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 4px; transform: translate(-50%, -50%); }
.trick .slot.pos-0 { left: 50%; top: 72%; }
.trick .slot.pos-1 { left: 24%; top: 50%; }
.trick .slot.pos-2 { left: 50%; top: 28%; }
.trick .slot.pos-3 { left: 76%; top: 50%; }
/* Only the card just played slides in (cards.js leaves the trick's markup alone
   when nothing changed, so a state push doesn't replay it). */
.trick:not(.old) .slot:last-child .cb-card { animation: card-in 0.25s ease-out; }
.trick .slot.win .cb-card { box-shadow: 0 0 0 3px var(--gold), 0 0 18px 4px rgba(242, 193, 78, 0.7); }
.trick.old .slot:not(.win) .cb-card { opacity: 0.55; }
.trick .slot .who { font-size: 0.78rem; font-weight: 700; opacity: 0.85; white-space: nowrap; max-width: 9em; overflow: hidden; text-overflow: ellipsis; }
@keyframes card-in { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* A round's scores: calls, tricks and points per player. */
.round-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.round-table th, .round-table td { padding: 5px 8px; text-align: center; border-bottom: 1px solid var(--cb-line); }
.round-table th { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.7; }
.round-table td:first-child, .round-table th:first-child { text-align: left; }
.round-table td:first-child { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 10em; }
.round-table .tot { font-weight: 900; }

/* Toast (phone and board) */
.toast {
  position: fixed; left: 50%; top: 12px; transform: translateX(-50%);
  background: #c0392b; color: #fff; padding: 12px 18px; border-radius: 10px; font-weight: 700;
  z-index: 100; box-shadow: var(--shadow); max-width: 90vw; text-align: center;
}
.toast.good { background: #1f8a55; animation: toast-pop 0.3s ease; }
@keyframes toast-pop { 0% { transform: translateX(-50%) scale(0.8); opacity: 0; } 100% { transform: translateX(-50%) scale(1); opacity: 1; } }
