/* The Round Table: page chrome, the 2D scene and the action dock. brain.css styles the RL panels on top. */

:root {
  color-scheme: dark;
  --void: #050407;
  --stone: #2c313a;
  --stone-deep: #1a1e25;
  --steel: #6d7684;
  --bone: #d8cdb4;
  --bone-dim: rgba(216, 205, 180, 0.62);
  --banner: #1f6b43;
  --banner-deep: #0c2a1b;
  --spirit: #3ddc84;
  --spirit-hot: #c8ffd9;
  --blood: #c4524a;
  --ink: var(--bone);
  --muted: #9a9384;
  --line: rgba(216, 205, 180, 0.22);
  --panel: rgba(13, 15, 19, 0.92);
  --blackletter: "UnifrakturCook", "Old English Text MT", "Times New Roman", serif;
  --caps: "Cinzel", "Trajan Pro", Georgia, serif;
  --ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

button {
  font: inherit;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  color: var(--bone);
  font-family: var(--ui);
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, rgba(61, 220, 132, 0.07), transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 40%, transparent 40%, rgba(0, 0, 0, 0.85)),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.55) 0 2px, transparent 2px 46px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.4) 0 2px, transparent 2px 92px),
    linear-gradient(180deg, #14171c, #0a0b0e 70%, var(--void));
}

/* ---------- Page chrome ---------- */

.room {
  position: fixed;
  inset: 0;
  --dock-h: 74px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) var(--dock-h);
  gap: 8px;
  padding: 16px 22px 18px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  position: relative;
  z-index: 5;
}

.site-tabs {
  display: inline-flex;
  gap: 2px;
  margin-bottom: 10px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(8, 7, 10, 0.86);
  box-shadow: 0 0 0 1px #000;
}

.site-tabs a {
  padding: 7px 13px;
  border-radius: 2px;
  color: var(--bone-dim);
  font-family: var(--caps);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 160ms ease, background 160ms ease;
}

.site-tabs a:hover {
  color: var(--bone);
}

.site-tabs a[aria-current="page"] {
  color: var(--bone);
  background: rgba(31, 107, 67, 0.6);
  box-shadow: inset 0 -2px 0 var(--spirit);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--spirit);
  font-family: var(--caps);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: var(--blackletter);
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 2px 0 #000, 0 0 18px rgba(61, 220, 132, 0.25);
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
}

#modelStatus {
  font: 0.74rem ui-monospace, SFMono-Regular, Menlo, monospace;
}

.ghost-button {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--bone);
  background: rgba(8, 7, 10, 0.82);
  box-shadow: 0 0 0 1px #000;
  font-family: var(--caps);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.ghost-button:hover,
.ghost-button[aria-expanded="true"] {
  border-color: var(--spirit);
  color: var(--spirit-hot);
}

kbd {
  min-width: 20px;
  margin-left: 6px;
  padding: 1px 5px;
  border: 1px solid currentColor;
  border-radius: 2px;
  font: 700 0.68rem ui-monospace, SFMono-Regular, Menlo, monospace;
  opacity: 0.6;
}

/* ---------- Scene: a fixed-aspect stage centred in whatever room the chrome leaves ---------- */

.scene {
  position: relative;
  min-height: 0;
  container: scene / size;
}

/* With the internals panel open on a wide screen, the table moves over so the panel never covers it. */
@media (min-width: 900px) {
  body:has(#brain:not([hidden])) {
    --brain-w: min(372px, 32vw);
  }

  body:has(#brain:not([hidden])) .scene {
    margin-left: var(--brain-w);
  }

  body:has(#brain:not([hidden])) .win-banner:not(.docked) {
    left: calc(50% + var(--brain-w) / 2);
  }

  body:has(#brain:not([hidden])) .dock {
    width: min(760px, 100% - var(--brain-w));
    margin-left: calc(var(--brain-w) + max(0px, (100% - var(--brain-w) - 760px) / 2));
  }
}

.stage {
  --W: 1000;
  --H: 800;
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  width: min(100cqw, 125cqh);
  aspect-ratio: 1000 / 800;
  container: stage / inline-size;
  --card-w: calc(64 / var(--W) * 100cqw);
  --chip-w: calc(30 / var(--W) * 100cqw);
  --label: clamp(10px, 1.45cqw, 14px);
}

.stage > * {
  position: absolute;
  left: calc(var(--x) / var(--W) * 100%);
  top: calc(var(--y) / var(--H) * 100%);
  width: calc(var(--w, 0) / var(--W) * 100%);
  translate: -50% -50%;
}

.stage > .at,
.stage > .spot,
.stage > .dealer-button {
  width: auto;
}

.stage svg {
  display: block;
  height: auto;
}

.knight-body,
.banners {
  width: 100%;
}

.banners { --x: 500; --y: 110; --w: 1000; pointer-events: none; }
.knight { --x: 500; --y: 150; --w: 300; }
.table { --x: 500; --y: 490; --w: 880; height: calc(490 / var(--H) * 100%); }
.gauntlets { --x: 500; --y: 293; --w: 300; }
.c-left { --x: 140; --y: 440; --w: 20; }
.c-right { --x: 860; --y: 440; --w: 20; }
.deck { --x: 115; --y: 520; }
.muck { --x: 805; --y: 520; }
.hand-1 { --x: 500; --y: 338; }
.phase-at { --x: 500; --y: 401; }
.board { --x: 500; --y: 458; }
.pot { --x: 470; --y: 545; }
.pot-at { --x: 505; --y: 535; }
.hand-0 { --x: 500; --y: 605; }
.pile-1 { --x: 255; --y: 365; }
.pile-0 { --x: 745; --y: 640; }
.bet-1 { --x: 350; --y: 395; }
.bet-at-1 { --x: 350; --y: 418; }
.bet-0 { --x: 650; --y: 585; }
.bet-at-0 { --x: 650; --y: 608; }
.player { --x: 500; --y: 728; --w: 170; }
.seat-col-1 { --x: 340; --y: 222; }
.speech-at-1 { --x: 345; --y: 112; }
.seat-col-0 { --x: 610; --y: 745; }
.speech-at-0 { --x: 410; --y: 700; }
.fx { inset: 0; left: 0; top: 0; width: 100%; height: 100%; translate: none; pointer-events: none; z-index: 6; }

.seat-col-0,
.pot-at {
  translate: 0 -50%;
}

.seat-col-1,
.speech-at-0,
.speech-at-1 {
  translate: -100% -50%;
}

.seat-col-1 {
  justify-items: end;
}

@container scene (orientation: portrait) {
  .stage {
    --W: 620;
    --H: 1000;
    width: min(100cqw, 62cqh);
    aspect-ratio: 620 / 1000;
    --label: clamp(10px, 2.3cqw, 13px);
  }

  .stage .banners { display: none; }
  .knight { --x: 310; --y: 150; }
  .table { --x: 310; --y: 565; --w: 600; height: calc(540 / var(--H) * 100%); }
  .gauntlets { --x: 310; --y: 340; }
  .c-left { --x: 62; --y: 520; }
  .c-right { --x: 558; --y: 520; }
  .deck { --x: 548; --y: 615; }
  .muck { --x: 480; --y: 425; }
  .hand-1 { --x: 310; --y: 388; }
  .phase-at { --x: 310; --y: 452; }
  .board { --x: 310; --y: 515; }
  .pot { --x: 275; --y: 618; }
  .pot-at { --x: 310; --y: 608; }
  .hand-0 { --x: 310; --y: 700; }
  .pile-1 { --x: 105; --y: 625; }
  .pile-0 { --x: 480; --y: 775; }
  .bet-1 { --x: 150; --y: 420; }
  .bet-at-1 { --x: 150; --y: 445; }
  .bet-0 { --x: 455; --y: 680; }
  .bet-at-0 { --x: 455; --y: 705; }
  .player { --x: 310; --y: 915; --w: 190; }
  .seat-col-1 { --x: 6; --y: 40; translate: 0 -50%; justify-items: start; }
  .speech-at-1 { --x: 462; --y: 120; translate: 0 -50%; }
  .seat-col-0 { --x: 6; --y: 930; }
  .speech-at-0 { --x: 614; --y: 875; }
}

/* ---------- The knight ---------- */

.knight-body {
  overflow: visible;
  transform-origin: 50% 100%;
  transition: transform 500ms cubic-bezier(0.3, 0.7, 0.3, 1), filter 500ms ease;
}

.knight .helm {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transition: transform 450ms cubic-bezier(0.3, 0.7, 0.3, 1);
}

.knight .eyes {
  fill: var(--spirit);
  opacity: 0.85;
  transition: opacity 300ms ease, fill 300ms ease;
}

.knight[data-mood="idle"] .knight-body {
  animation: breathe 4.5s ease-in-out infinite;
}

.knight[data-mood="thinking"] .helm {
  transform: rotate(-5deg);
}

.knight[data-mood="thinking"] .eyes {
  animation: ponder 1.1s steps(2, jump-none) infinite;
}

.knight[data-mood="happy"] .helm {
  transform: translateY(-4px) rotate(3deg);
}

.knight[data-mood="happy"] .eyes {
  fill: var(--spirit-hot);
  opacity: 1;
}

.knight[data-mood="sad"] .helm {
  transform: translateY(7px) rotate(-3deg);
}

.knight[data-mood="sad"] .eyes {
  opacity: 0.22;
}

.knight[data-mood="folded"] .knight-body {
  transform: translateY(-3%) scale(0.96);
  filter: brightness(0.65);
}

.knight[data-mood="folded"] .eyes {
  opacity: 0.35;
}

.gauntlets .fist {
  transform-box: fill-box;
}

/* ---------- The table ---------- */

.table-edge {
  position: absolute;
  left: 0;
  right: 0;
  top: 6%;
  height: 100%;
  border: 3px solid var(--void);
  border-radius: 50%;
  background:
    repeating-linear-gradient(115deg, rgba(0, 0, 0, 0.5) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #3a281a, #160e09);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(216, 205, 180, 0.08);
}

.table-top {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100% !important;
}

.candle-glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(ellipse 38% 46% at 9% 40%, rgba(61, 220, 132, 0.22), transparent 70%),
    radial-gradient(ellipse 38% 46% at 91% 40%, rgba(61, 220, 132, 0.22), transparent 70%),
    radial-gradient(ellipse 50% 40% at 50% 45%, rgba(200, 255, 217, 0.06), transparent 75%);
  mix-blend-mode: screen;
  pointer-events: none;
  animation: candleLight 3.2s ease-in-out infinite alternate;
}

.candle {
  aspect-ratio: 20 / 56;
  translate: -50% -100%;
  border: 2px solid var(--void);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.45) 0 30%, transparent 30% 70%, rgba(0, 0, 0, 0.6) 70%),
    linear-gradient(180deg, #e8dfc8, #b9ae94);
  box-shadow: 0 0 0 1px rgba(216, 205, 180, 0.15);
}

.candle::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -22%;
  width: 260%;
  aspect-ratio: 3 / 1;
  translate: -50% 0;
  z-index: -1;
  border: 2px solid var(--void);
  border-radius: 50%;
  background: #2c313a;
}

.flame {
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 110%;
  aspect-ratio: 1 / 2.1;
  translate: -50% 4%;
  border-radius: 50% 50% 46% 46% / 64% 64% 36% 36%;
  background: radial-gradient(ellipse 40% 50% at 50% 70%, var(--spirit-hot), var(--spirit) 55%, rgba(61, 220, 132, 0) 75%);
  filter: drop-shadow(0 0 6px var(--spirit)) drop-shadow(0 0 16px rgba(61, 220, 132, 0.7));
  transform-origin: 50% 90%;
  animation: flicker 1.6s ease-in-out infinite alternate;
}

.c-right .flame {
  animation-delay: -0.7s;
  animation-duration: 1.3s;
}

/* ---------- Cards ---------- */

.hand,
.board {
  display: flex;
  gap: calc(8 / var(--W) * 100cqw);
}

.board > i {
  display: block;
  width: var(--card-w);
  aspect-ratio: 5 / 7;
  border: 1px dashed rgba(216, 205, 180, 0.16);
  border-radius: 3px;
}

.board > i:has(.card2) {
  border-color: transparent;
}

.card2 {
  position: relative;
  width: var(--card-w);
  aspect-ratio: 5 / 7;
  transition: translate 220ms ease, filter 220ms ease, box-shadow 220ms ease;
}

.hand-0 .card2:first-child,
.hand-1 .card2:last-child {
  rotate: -4deg;
}

.hand-0 .card2:last-child,
.hand-1 .card2:first-child {
  rotate: 4deg;
}

.card2 .face,
.card2 .back {
  position: absolute;
  inset: 0;
  border: 2px solid var(--void);
  border-radius: 3px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.55), 0 8px 16px rgba(0, 0, 0, 0.45);
}

.card2 .face {
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 6% 9%;
  color: #121014;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.25), transparent 40%),
    linear-gradient(180deg, #ece3cb, #cfc3a6);
  font-family: var(--caps);
  font-weight: 700;
  line-height: 1;
}

.card2 .face.red {
  color: #8e2b25;
}

.card2 .rank {
  font-size: calc(var(--card-w) * 0.36);
}

.card2 .pip {
  place-self: center;
  font-family: var(--ui);
  font-size: calc(var(--card-w) * 0.5);
}

.card2 .back {
  display: none;
  background:
    linear-gradient(45deg, transparent 46%, rgba(0, 0, 0, 0.55) 46% 54%, transparent 54%) 0 0 / 7px 7px,
    linear-gradient(-45deg, transparent 46%, rgba(0, 0, 0, 0.55) 46% 54%, transparent 54%) 0 0 / 7px 7px,
    var(--banner);
}

.card2 .back::before {
  content: "";
  position: absolute;
  inset: 10%;
  border: 1px solid rgba(216, 205, 180, 0.55);
  background:
    linear-gradient(var(--bone), var(--bone)) center / 14% 56% no-repeat,
    linear-gradient(var(--bone), var(--bone)) 50% 40% / 50% 10% no-repeat;
  opacity: 0.8;
}

.card2.down .face {
  display: none;
}

.card2.down .back {
  display: block;
}

.card2.win {
  translate: 0 -10%;
  filter: drop-shadow(0 0 8px rgba(61, 220, 132, 0.85));
}

.card2.dim {
  filter: brightness(0.5) saturate(0.6);
}

.deck {
  display: grid;
}

.deck .card2 {
  grid-area: 1 / 1;
}

.deck .card2:last-child {
  translate: 3px -3px;
}

.muck {
  display: grid;
  place-items: center;
}

.muck .card2 {
  grid-area: 1 / 1;
  opacity: 0.85;
}

/* Your turn: a green ring of candlelight under the hand that acts next. */
.hand.turn::before {
  content: "";
  position: absolute;
  inset: -16% -22%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(61, 220, 132, 0.28), transparent 70%);
  box-shadow: 0 0 0 2px rgba(61, 220, 132, 0.45);
  animation: turnPulse 1.6s ease-in-out infinite;
}

/* ---------- Chips ---------- */

.chips {
  display: flex;
  align-items: flex-end;
  gap: calc(var(--chip-w) * 0.12);
  translate: -50% -100%;
}

.column {
  display: flex;
  flex-direction: column-reverse;
}

.disc {
  display: block;
  width: var(--chip-w);
  height: calc(var(--chip-w) * 0.42);
  border: 1.5px solid var(--void);
  border-radius: 50%;
  background: radial-gradient(ellipse, var(--chip) 0 42%, var(--stripe) 43% 55%, var(--chip) 56%);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.7);
}

.column .disc + .disc {
  margin-bottom: calc(var(--chip-w) * -0.3);
}

.disc.flying {
  position: absolute;
  left: 0;
  top: 0;
  margin: calc(var(--chip-w) * -0.21) 0 0 calc(var(--chip-w) * -0.5);
}

.knock {
  position: absolute;
  width: calc(var(--card-w) * 2.4);
  aspect-ratio: 2 / 1;
  border: 2px solid var(--spirit);
  border-radius: 50%;
}

.dealer-button {
  display: grid;
  place-items: center;
  width: calc(var(--chip-w) * 1.15) !important;
  aspect-ratio: 1;
  border: 2px solid var(--void);
  border-radius: 50%;
  color: var(--void);
  background: radial-gradient(circle, #ece3cb 55%, #b9ae94);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.6);
  font-family: var(--caps);
  font-size: calc(var(--chip-w) * 0.55);
  font-weight: 700;
  transition: left 600ms cubic-bezier(0.4, 0, 0.2, 1), top 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.dealer-button[data-seat="0"] { --x: 382; --y: 615; }
.dealer-button[data-seat="1"] { --x: 618; --y: 352; }

@container scene (orientation: portrait) {
  .dealer-button[data-seat="0"] { --x: 200; --y: 700; }
  .dealer-button[data-seat="1"] { --x: 430; --y: 402; }
}

/* ---------- The player (swappable art: assets/player.svg) ---------- */

.player img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 -2px 10px rgba(0, 0, 0, 0.8));
}

/* ---------- Labels on the table ---------- */

.seat-col {
  display: grid;
  justify-items: start;
  gap: 5px;
  z-index: 4;
}

.seat-meta {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(8, 7, 10, 0.88);
  box-shadow: 0 0 0 1px #000, 0 8px 20px rgba(0, 0, 0, 0.6);
  font-size: var(--label);
  white-space: nowrap;
  transition: border-color 200ms ease, box-shadow 200ms ease, opacity 200ms ease;
}

.seat-meta.active {
  border-color: var(--spirit);
  box-shadow: 0 0 0 1px #000, 0 0 16px rgba(61, 220, 132, 0.45);
}

.seat-meta.folded {
  opacity: 0.55;
}

.seat-meta.winner {
  border-color: var(--spirit-hot);
  animation: winnerPulse 900ms ease 2;
}

.name {
  font-family: var(--caps);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stack {
  color: var(--spirit);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hand-label {
  color: var(--bone);
  font-family: var(--caps);
  font-size: calc(var(--label) * 0.9);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 1px 0 #000, 0 0 8px #000;
}

.hand-label:empty {
  display: none;
}

.hand-label.win {
  color: var(--spirit-hot);
}

.speech-at {
  z-index: 5;
}

.speech {
  display: none;
  align-items: center;
  min-height: 2.2em;
  padding: 0.45em 0.8em;
  border: 2px solid var(--void);
  border-radius: 2px;
  color: #121014;
  background: linear-gradient(180deg, #ece3cb, #cfc3a6);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.75);
  font-family: var(--caps);
  font-size: var(--label);
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.speech.show {
  display: flex;
  animation: speechPop 180ms ease-out both;
}

.speech.thinking-bubble {
  color: #4b463d;
}

.pill {
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--spirit);
  background: rgba(8, 7, 10, 0.85);
  font: 700 calc(var(--label) * 0.92) ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pill.empty {
  visibility: hidden;
}

.pot-pill span {
  margin-right: 6px;
  color: var(--muted);
  font-family: var(--caps);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.phase-pill {
  color: var(--bone-dim);
  font-family: var(--caps);
  font-size: calc(var(--label) * 0.82);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 1px 0 #000, 0 0 6px #000;
}

.phase-pill #phase {
  color: var(--spirit-hot);
}

/* ---------- Action dock ---------- */

/* The dock's row is a fixed height; the raise tray grows it upward over the scene instead of resizing the table. */
.dock {
  grid-row: 3;
  align-self: end;
  width: min(760px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(10, 11, 14, 0.9);
  box-shadow: 0 0 0 1px #000, 0 18px 50px rgba(0, 0, 0, 0.6);
  position: relative;
  z-index: 5;
}

.dock-status[hidden],
.dock-actions[hidden] {
  display: none;
}

.dock-status {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

#turnStatus {
  color: var(--bone);
  font-weight: 700;
}

#turnStatus.error {
  color: var(--blood);
}

#turnStatus.shake {
  animation: shake 300ms ease;
}

.win {
  color: var(--spirit);
}

.loss {
  color: var(--blood);
}

.dock-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
}

.action {
  flex: 1 1 0;
  max-width: 250px;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 2px solid var(--void);
  border-radius: 3px;
  color: var(--bone);
  background: var(--stone);
  box-shadow: 0 0 0 1px var(--line), 0 4px 0 #000;
  font-family: var(--caps);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.action:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.12);
  box-shadow: 0 0 0 1px var(--line), 0 6px 0 #000;
}

.action:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 0 0 1px var(--line), 0 1px 0 #000;
}

.action-fold {
  color: #f0b4ae;
  background: linear-gradient(180deg, #3b1715, #241010);
  box-shadow: 0 0 0 1px rgba(196, 82, 74, 0.55), 0 4px 0 #000;
}

.action-check,
.action-call,
.action-deal {
  color: #121014;
  background: linear-gradient(180deg, #ece3cb, #c9bd9f);
}

.action-raise,
.action-allin {
  color: var(--spirit-hot);
  background: linear-gradient(180deg, var(--banner), var(--banner-deep));
  box-shadow: 0 0 0 1px rgba(61, 220, 132, 0.45), 0 4px 0 #000;
}

.thinking-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  align-self: center;
  padding: 12px 20px;
  color: var(--muted);
  font-family: var(--caps);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dots {
  display: inline-flex;
  gap: 4px;
}

.dots i {
  width: 6px;
  height: 6px;
  background: currentColor;
  rotate: 45deg;
  animation: dotPulse 1.1s ease-in-out infinite;
}

.dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.dots i:nth-child(3) {
  animation-delay: 0.3s;
}

.raise-tray {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "readout presets presets"
    "slider slider buttons";
  align-items: center;
  gap: 12px 16px;
  padding: 12px;
  border: 1px solid rgba(61, 220, 132, 0.28);
  border-radius: 3px;
  background: rgba(12, 42, 27, 0.55);
  animation: trayUp 160ms ease-out both;
}

.raise-tray[hidden] {
  display: none;
}

.raise-readout {
  grid-area: readout;
  display: grid;
}

.raise-readout span {
  color: var(--muted);
  font-family: var(--caps);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.raise-readout strong {
  color: var(--spirit-hot);
  font: 700 1.6rem ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

.presets {
  grid-area: presets;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.presets button {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--bone);
  background: transparent;
  font-family: var(--caps);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.presets button:hover,
.presets button.selected {
  border-color: var(--spirit);
  color: var(--spirit-hot);
}

#raiseSlider {
  grid-area: slider;
  width: 100%;
  height: 6px;
  appearance: none;
  border: 1px solid #000;
  border-radius: 0;
  background: linear-gradient(90deg, var(--spirit) var(--fill, 0%), rgba(216, 205, 180, 0.15) var(--fill, 0%));
  cursor: pointer;
}

#raiseSlider::-webkit-slider-thumb {
  width: 18px;
  height: 22px;
  appearance: none;
  border: 2px solid var(--void);
  border-radius: 1px;
  background: var(--bone);
}

#raiseSlider::-moz-range-thumb {
  width: 14px;
  height: 18px;
  border: 2px solid var(--void);
  border-radius: 1px;
  background: var(--bone);
}

.tray-actions {
  grid-area: buttons;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.tray-cancel {
  padding: 0 14px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-family: var(--caps);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.tray-actions .action {
  flex: 0 1 240px;
  min-height: 46px;
}

/* ---------- Result banner ---------- */

.win-banner {
  position: fixed;
  left: 50%;
  top: 46%;
  z-index: 8;
  min-width: 320px;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 20px 34px 26px;
  border: 2px solid var(--void);
  border-radius: 2px;
  background:
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.18) 0 2px, transparent 2px 6px),
    linear-gradient(180deg, #232830, #101317);
  box-shadow: 0 0 0 1px rgba(216, 205, 180, 0.4), 0 30px 80px rgba(0, 0, 0, 0.75);
  transform: translate(-50%, -50%);
  text-align: center;
  cursor: pointer;
}

.win-banner[hidden] {
  display: none;
}

.win-banner.you {
  background:
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.18) 0 2px, transparent 2px 6px),
    linear-gradient(180deg, var(--banner), var(--banner-deep));
  box-shadow: 0 0 0 1px var(--spirit), 0 30px 80px rgba(0, 0, 0, 0.75), 0 0 60px rgba(61, 220, 132, 0.3);
}

.win-eyebrow {
  margin: 0;
  color: var(--bone-dim);
  font-family: var(--caps);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.win-banner h2 {
  margin: 0;
  font-family: var(--blackletter);
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.05;
  text-shadow: 0 2px 0 #000;
}

.win-banner.you h2 {
  color: var(--spirit-hot);
}

.win-amount {
  font: 700 1.35rem ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

.win-banner.you .win-amount {
  color: var(--spirit);
}

.win-banner.bot .win-amount {
  color: var(--blood);
}

.win-hand {
  color: var(--bone);
  font-family: var(--caps);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.win-cards {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.win-cards:empty {
  display: none;
}

.win-vs {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--caps);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.win-vs[hidden] {
  display: none;
}

.win-vs .win-cards {
  margin-top: 0;
  opacity: 0.75;
}

/* Flat cards in the banner. */
.card {
  width: 44px;
  height: 62px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 5px;
  border: 2px solid var(--void);
  border-radius: 3px;
  color: #121014;
  background: linear-gradient(180deg, #ece3cb, #cfc3a6);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.6);
  font-family: var(--caps);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}

.card.red {
  color: #8e2b25;
}

.card .center {
  place-self: center;
  font-family: var(--ui);
  font-size: 1.3rem;
}

.card .suit {
  justify-self: end;
  font-family: var(--ui);
}

.win-vs .win-cards .card {
  width: 34px;
  height: 48px;
  padding: 4px;
  font-size: 0.66rem;
}

.win-vs .card .center {
  font-size: 0.9rem;
}

/* DOM chips only appear in the win celebration burst. */
.chip {
  --chip: #3ddc84;
  --stripe: #050407;
  width: 24px;
  height: 24px;
  border: 2px solid var(--void);
  border-radius: 50%;
  background: radial-gradient(circle, var(--chip) 0 44%, var(--stripe) 45% 56%, var(--chip) 57%);
}

.chip.flying {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 40;
  pointer-events: none;
}

/* ---------- Hand log drawer ---------- */

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  width: min(380px, 100vw);
  display: grid;
  grid-template-rows: auto auto 1fr;
  align-content: start;
  gap: 18px;
  padding: 20px;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: rgba(10, 11, 14, 0.97);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.6);
  animation: drawerIn 180ms ease-out both;
}

.drawer[hidden] {
  display: none;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer h2 {
  margin: 0;
  font-family: var(--blackletter);
  font-size: 1.5rem;
}

.drawer h3 {
  margin: 0 0 10px;
  color: var(--spirit);
  font-family: var(--caps);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.log {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.88rem;
}

.log .street {
  margin-top: 8px;
  color: var(--muted);
  font-family: var(--caps);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.log .you {
  color: var(--bone);
}

.log .bot {
  color: var(--spirit);
}

.history {
  display: grid;
  gap: 8px;
}

.history-item {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(26, 30, 37, 0.7);
}

.history-item summary {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 0.86rem;
}

.summary-text {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-body {
  display: grid;
  gap: 6px;
  padding: 0 12px 12px;
  font-size: 0.84rem;
}

.card-text {
  font-weight: 800;
}

.card-text.red {
  color: #e0857d;
}

.muted,
.empty-note {
  color: var(--muted);
}

/* ---------- Motion ---------- */

@keyframes breathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(1.2%); }
}

@keyframes ponder {
  0% { opacity: 0.95; }
  100% { opacity: 0.4; }
}

@keyframes flicker {
  0% { transform: scale(1, 1) rotate(-2deg); opacity: 0.95; }
  40% { transform: scale(0.92, 1.08) rotate(2deg); opacity: 1; }
  70% { transform: scale(1.05, 0.94) rotate(-1deg); opacity: 0.85; }
  100% { transform: scale(0.96, 1.04) rotate(1deg); opacity: 1; }
}

@keyframes candleLight {
  from { opacity: 0.8; }
  to { opacity: 1; }
}

@keyframes turnPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes winnerPulse {
  0%, 100% { box-shadow: 0 0 0 1px #000, 0 0 0 rgba(61, 220, 132, 0); }
  50% { box-shadow: 0 0 0 1px #000, 0 0 28px rgba(61, 220, 132, 0.6); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-6px); }
  65% { transform: translateX(5px); }
}

@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

@keyframes trayUp {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes drawerIn {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes speechPop {
  from { transform: translateY(4px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ---------- Phones ---------- */

@media (max-width: 720px) {
  .room {
    --dock-h: 66px;
    padding: 10px 16px 12px;
    gap: 6px;
  }

  .topbar {
    flex-direction: column;
    gap: 6px;
  }

  .site-tabs {
    margin-bottom: 6px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .eyebrow,
  #modelStatus,
  .ghost-button kbd {
    display: none;
  }

  .status-strip {
    justify-content: flex-start;
    gap: 6px;
  }

  .ghost-button {
    padding: 7px 9px;
    font-size: 0.62rem;
    letter-spacing: 0.08em;
  }

  .seat-meta {
    gap: 8px;
    padding: 4px 8px;
  }

  .win-banner {
    min-width: 260px;
    padding: 16px 20px 20px;
  }

  .win-banner h2 {
    font-size: 1.9rem;
  }

  .dock {
    padding: 8px;
  }

  .dock-actions {
    gap: 8px;
  }

  .action {
    min-height: 48px;
    padding: 0 8px;
    font-size: 0.74rem;
    letter-spacing: 0.06em;
  }

  .action kbd {
    display: none;
  }

  .raise-tray {
    grid-template-columns: 1fr;
    grid-template-areas:
      "readout"
      "presets"
      "slider"
      "buttons";
  }

  .presets {
    justify-content: flex-start;
  }
}
