/* Texas Hold'em (Brief 15): the table for Solo practice and friends tables. An oval felt with up
   to 8 seats placed round it by holdem.js (left / top, each centred on its point), you at the bottom
   centre with your cards large; the board and the pots in the middle; your actions in a bar under
   the felt (never over your cards or the board). Everything sizes itself from the felt (container
   units) times --fit, which holdem.js steps down while anything runs into anything else. */

/* ---------- The page ---------- */
.table.hd {
  display: flex;
  flex-direction: column;
  max-width: none;
  gap: 4px;
  padding: 4px clamp(6px, 1.4vw, 24px) calc(6px + env(safe-area-inset-bottom));
  overflow: clip;
}
.hd-felt { position: relative; flex: 1 1 0; width: 100%; min-height: 0; container: felt / size; }
.hd.paused :is(.hd-stage, .hd-foot, .hd-controls) { opacity: 0.25; pointer-events: none; }

/* Panels over the felt (the room, setup, places), as on the other tables. */
.hd .panel-card {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 20;
  translate: -50% -50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(440px, calc(100% - 16px));
  max-height: calc(100% - 8px);
  overflow-y: auto;
  padding: 22px 20px;
  text-align: center;
  border-radius: 20px;
  background: rgba(3, 22, 13, 0.96);
  border: 1px solid rgba(217, 180, 90, 0.45);
  box-shadow: var(--shadow);
  animation: hd-card-in 0.3s var(--ease);
}
@keyframes hd-card-in { from { opacity: 0; scale: 0.96; } }
.hd .panel-card h2 { margin: 0; font-family: var(--font-display); font-size: 1.5rem; color: var(--gold-2); }
.hd .seg { margin: 0; padding: 0; border: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.hd .seg legend { width: 100%; margin-bottom: 8px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.hd .seg label { position: relative; }
.hd .seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.hd .seg span {
  display: inline-grid;
  place-items: center;
  min-width: 48px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 700;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.hd .seg input:checked + span { color: #2b1c04; border-color: transparent; background: linear-gradient(180deg, var(--gold-2), var(--gold)); }
.hd .seg input:focus-visible + span { outline: 2px solid var(--gold-2); outline-offset: 3px; }
.mode-badge.online { color: #2b1c04; background: linear-gradient(180deg, var(--gold-2), var(--gold)); }
.hd-styles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; width: 100%; }
.hd-styles label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--ink-3); text-align: left; }
.hd-styles select { min-height: 44px; padding: 0 10px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.06); color: var(--ink); font: inherit; }
.hd-styles option { color: #111; }
.hd-places { margin: 0; padding: 0; list-style: none; width: 100%; display: flex; flex-direction: column; gap: 6px; }
.hd-places li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); }
.hd-places li.me { outline: 1px solid var(--gold); }
.hd-places .place { min-width: 88px; font-weight: 800; color: var(--gold-2); text-align: left; }
.hd-over-you { margin: 0; font-size: 1.15rem; color: var(--ink); }

/* Ranked (server-run), as Go Fish's. */
.rank-pill { padding: 0 14px; color: var(--gold-2); text-decoration: none; }
.rank-pill:hover { border-color: rgba(217, 180, 90, 0.55); }
.hd .lock-panel { align-self: center; margin: auto 0; }
.ranked-start p { margin: 0; }
.ranked-terms { font-size: 1.05rem; line-height: 1.5; color: var(--ink-2); }
.ranked-terms strong { color: var(--gold-2); font-size: 1.1rem; }
.ranked-note { font-size: 0.88rem; line-height: 1.4; color: var(--ink-3); }
.ranked-balance { font-weight: 600; color: var(--ink-2); }
.ranked-balance strong, .over-balance strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.ranked-next { color: var(--ink-2); }
.claim-btn .coin { width: 20px; height: 20px; }
.ranked-start.broke h2 { color: var(--lose); }
.over-prize { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; color: var(--gold-2); }
.over-prize.none { font-family: inherit; font-weight: 600; font-size: 1rem; color: var(--ink-2); }
.over-balance { margin: 0; color: var(--ink-2); }
@media (max-width: 480px) { .rank-pill { padding: 0 9px; } }

/* ---------- The stage ---------- */
.hd-stage {
  --fit: 1;
  /* Sizes from the felt (phones first). */
  --board-w: max(30px, calc(min(12.6cqw, 13.4cqh, 100px) * var(--fit)));
  --me-w: max(44px, calc(min(18cqw, 18.3cqh, 128px) * var(--fit)));
  --hole-w: max(20px, calc(min(6cqw, 8.4cqh, 50px) * var(--fit)));
  --shown-w: max(32px, calc(min(9cqw, 11cqh, 68px) * var(--fit)));
  --plate-w: clamp(76px, calc(min(30cqw, 222px) * var(--fit)), 230px);
  --avatar: max(26px, calc(min(9.6cqw, 7.3cqh, 46px) * var(--fit)));
  --fs: max(12px, calc(min(4.1cqw, 2.95cqh, 17px) * var(--fit)));
  --chip: calc(var(--hole-w) * 0.55);
  --rail-w: max(10px, calc(var(--chip) * 0.8));
  --wood-w: max(4px, calc(var(--chip) * 0.24));
  --dealer: max(30px, calc(min(8cqw, 9cqh, 54px) * var(--fit)));
  /* Dex: the biggest figure at the table, well over a seat's cards and plate (others' seats).
     --dex-fit: holdem.js shrinks him first when the table is tight (never below 0.7). */
  --dex-fit: 1;
  --dex-h: calc((var(--hole-w) * 1.4 + var(--fs) * 2.3 + 6px) * 1.75 * var(--dex-fit));
  position: absolute;
  inset: 0;
  overflow: hidden;
}
/* holdem.js reads the chip size (width) and how far the table reaches past the rail's middle
   (height) from this. */
.hd-probe { position: absolute; width: var(--chip); height: calc(var(--rail-w) / 2 + var(--wood-w)); visibility: hidden; pointer-events: none; }

/* ---------- The dealer: top centre, facing you, with the deck and the chip tray ---------- */
.hd-dealer {
  position: absolute;
  left: 50%;
  top: var(--dealer-y, 4px); /* holdem.js: his waist on the rail's top */
  translate: -50% 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: calc(var(--dealer) * 0.24);
  pointer-events: none;
  transition: opacity 0.25s ease-out;
}
/* A panel too tall to sit under him (holdem.js: dexRoom): he steps away until it closes. */
.hd-dealer.away { opacity: 0; }
/* The deck and the tray sit on the felt just in front of Dex, inside the rail, by his hands. */
.hd-dealer > .hd-deck, .hd-dealer > .hd-tray { position: relative; z-index: 1; margin-top: calc(var(--dex-h) * 0.88 + var(--wood-w) + var(--rail-w) + 3px); }
.hd-dealer > .hd-deck { margin-right: calc(var(--dex-h) * -0.1); }
.hd-dealer > .hd-tray { margin-left: calc(var(--dex-h) * -0.12); }

/* Dex himself, his outfits and his moods: assets/css/dex.css. His size here: --dex-h, above. */

/* "Maya tipped Dex": a short line under Dex (holdem.js: dexNote). */
.hd-dex-note {
  position: absolute;
  left: 50%;
  top: calc(var(--dealer-y, 4px) + var(--dex-h) + 4px);
  translate: -50% 0;
  z-index: 7;
  margin: 0;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(3, 22, 13, 0.86);
  border: 1px solid rgba(244, 220, 149, 0.35);
  color: var(--gold-2);
  font: 700 max(12px, calc(var(--fs) * 0.9)) / 1.4 var(--font-ui);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease-out;
}
.hd-dex-note.show { opacity: 1; }
.hd-dex-note:empty { display: none; }

/* Tip Dex: a small, quiet button beside your seat for a few seconds after you win (holdem.js). */
.hd-tip {
  position: absolute;
  z-index: 7;
  translate: 0 -50%;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(244, 220, 149, 0.45);
  background: rgba(3, 22, 13, 0.82);
  color: var(--ink);
  font: 600 max(12px, calc(var(--fs) * 0.85)) / 1 var(--font-ui);
  white-space: nowrap;
  cursor: pointer;
  animation: hd-tip-in 0.25s ease-out both;
}
.hd-tip:hover, .hd-tip:focus-visible { border-color: var(--gold-2); color: var(--gold-2); }
.hd-tip-amt { margin-left: 4px; color: var(--ink-2); font-weight: 700; }
.hd-tip-amt::before { content: '· '; }
@keyframes hd-tip-in { from { opacity: 0; } to { opacity: 1; } }
/* The deck: a squared-up pile of backs (cards are dealt from here). */
.hd-deck {
  width: calc(var(--dealer) * 0.6);
  height: calc(var(--dealer) * 0.84);
  border-radius: calc(var(--dealer) * 0.06);
  border: 2px solid #fbfaf5;
  background:
    radial-gradient(circle at 50% 50%, rgba(244, 220, 149, 0.35) 0 12%, transparent 13%),
    repeating-linear-gradient(45deg, var(--card-back-1) 0 3px, var(--card-back-2) 3px 6px);
  box-shadow: 1px 1px 0 #e9e4d6, 2px 2px 0 #d6d0bf, 3px 3px 0 #c4bda9, 3px 5px 8px rgba(0, 0, 0, 0.45);
  rotate: -8deg;
}
/* The chip tray: a slot of each colour, the chips seen edge on. */
.hd-tray {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 6px;
  background: linear-gradient(180deg, #05130c, #0d2a1b);
  border: 1px solid rgba(217, 180, 90, 0.5);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6), 0 3px 8px rgba(0, 0, 0, 0.35);
}
.hd-tray i {
  width: calc(var(--dealer) * 0.17);
  height: calc(var(--dealer) * 0.6);
  border-radius: 3px;
  background: repeating-linear-gradient(180deg, var(--k) 0 2px, var(--s) 2px 3px, var(--k) 3px 4px, rgba(0, 0, 0, 0.4) 4px 5px);
}

/* ---------- Chips: columns of discs, the top one face up (the value sets the colour) ---------- */
.k1 { --k: #ece8dc; --s: #2f6fd1; }
.k5 { --k: #c8372d; --s: #f4f1e8; }
.k25 { --k: #23955a; --s: #f4f1e8; }
.k100 { --k: #2a2c30; --s: #f4f1e8; }
.k500 { --k: #7b3fb8; --s: #f4f1e8; }
.k1000 { --k: #e2b33c; --s: #6b4a10; }
.k5000 { --k: #e2752c; --s: #f4f1e8; }
.k25000 { --k: #2a63c9; --s: #f4dc95; }
.hd-chips { display: flex; align-items: flex-end; justify-content: center; }
.hd-col { --c: var(--chip); display: flex; flex-direction: column-reverse; width: var(--c); flex: none; }
.hd-col + .hd-col { margin-left: calc(var(--c) * -0.06); }
.hd-col i {
  display: block;
  width: var(--c);
  height: calc(var(--c) * 0.5);
  border-radius: 50%;
  /* The edge: the chip's colour with a few light dashes, every other chip turned a little. */
  background: repeating-linear-gradient(90deg, var(--k) 0 calc(var(--c) * 0.3), var(--s) calc(var(--c) * 0.3) calc(var(--c) * 0.42)) calc(var(--c) * 0.05) 0;
  box-shadow: inset 0 calc(var(--c) * -0.07) 0 rgba(0, 0, 0, 0.32), 0 1px 1px rgba(0, 0, 0, 0.35);
}
.hd-col i:nth-child(even) { background-position: calc(var(--c) * 0.26) 0; }
.hd-col i + i { margin-bottom: calc(var(--c) * -0.33); }
.hd-col i:last-child {
  background:
    radial-gradient(closest-side, var(--k) 0 50%, var(--s) 53% 59%, transparent 62%),
    repeating-conic-gradient(var(--k) 0 22.5deg, var(--s) 22.5deg 45deg);
  box-shadow: inset 0 calc(var(--c) * -0.07) 0 rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.45);
}
/* The number with the chips: bold, on a dark pill, readable on a phone. */
.hd-num, .hd-amt {
  display: inline-block;
  padding: 0.03em 0.45em;
  border-radius: 999px;
  font-size: max(12px, calc(var(--fs) * 1.05));
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 0.01em;
  color: var(--gold-2);
  background: rgba(3, 14, 8, 0.84);
  border: 1px solid rgba(248, 224, 160, 0.32);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.hd-num { margin-top: 2px; }
.hd-num:empty { visibility: hidden; }
.hd-num:empty::before { content: '0'; }
/* The table, seen from above, in the room (base.css: body.room): green felt, a padded leather rail
   and a thin polished wood edge outside it, with a soft shadow under it all. holdem.js sets its box
   (the middle of the rail runs through the seats) and how square it is. --rail-w and --wood-w grow
   with the chips; the probe tells holdem.js how far the table reaches past that line. */
.hd-oval {
  position: absolute;
  left: calc(var(--oval-x, 8%) - var(--rail-w) / 2);
  top: calc(var(--oval-y, 10%) - var(--rail-w) / 2);
  width: calc(var(--oval-w, 84%) + var(--rail-w));
  height: calc(var(--oval-h, 80%) + var(--rail-w));
  border-radius: var(--oval-r, 50%);
  border: var(--rail-w) solid transparent;
  background:
    radial-gradient(ellipse at 50% 42%, var(--table-felt-1), var(--table-felt-2) 62%, var(--table-felt-3)) padding-box,
    linear-gradient(180deg, var(--leather-1), var(--leather-2) 55%, var(--leather-3)) border-box;
  box-shadow:
    inset 0 0 0 1.5px rgba(0, 0, 0, 0.5), inset 0 0 calc(var(--rail-w) * 1.6) rgba(0, 0, 0, 0.42),
    0 0 0 1px #0d0704, 0 0 0 2.5px var(--wood-hi), 0 0 0 var(--wood-w) var(--wood-2), 0 0 0 calc(var(--wood-w) + 1px) var(--wood-3),
    0 calc(var(--rail-w) * 0.9) calc(var(--rail-w) * 2.2) rgba(0, 0, 0, 0.7);
  pointer-events: none;
}
/* The rail's padding: a soft light along its middle, and a stitched seam where it meets the felt. */
.hd-oval::before, .hd-oval::after {
  content: '';
  position: absolute;
  border-radius: inherit;
  pointer-events: none;
}
.hd-oval::before {
  inset: calc(var(--rail-w) * -0.78);
  border: calc(var(--rail-w) * 0.5) solid rgba(255, 236, 214, 0.07);
  filter: blur(calc(var(--rail-w) * 0.14));
}
.hd-oval::after { inset: -3px; border: 1px dashed rgba(255, 236, 214, 0.16); }

/* The middle: the blind level, the pots, the board. */
.hd-centre {
  position: absolute;
  left: 50%;
  top: var(--centre-y, 46%);
  translate: -50% -50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}
/* The board's cards are on top of the felt (the middle lets taps through around them). */
.hd-board .card { pointer-events: auto; }
/* The blind level wraps to the board's width, so it never makes the middle wider than the board. */
.hd-level { margin: 0; max-width: calc(var(--board-w) * 5.32); font-size: var(--fs); font-weight: 700; line-height: 1.25; color: var(--ink-2); text-align: center; text-wrap: balance; }
/* The pot: a pile of chips under the board with its amount; side pots smaller beside it. */
.hd-pots { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 14px; min-height: calc(var(--chip) * 1.65 + 4px); }
.hd-pot { display: inline-flex; align-items: center; gap: 6px; }
.hd-pot .hd-col { --c: calc(var(--chip) * 1.05); }
.hd-pot.side .hd-col { --c: calc(var(--chip) * 0.8); }
.hd-pot .hd-amt { font-size: max(13px, calc(var(--fs) * 1.15)); }
.hd-pot.side .hd-amt { font-size: max(12px, var(--fs)); }
.hd-pot small { font-weight: 700; color: var(--ink-2); font-size: 0.82em; letter-spacing: 0.02em; }
.hd-board { display: flex; gap: calc(var(--board-w) * 0.08); min-height: calc(var(--board-w) * 1.4); }
.hd-board .card { --w: var(--board-w); }
.hd-board .slot { width: var(--board-w); height: calc(var(--board-w) * 1.4); border-radius: calc(var(--board-w) * 0.085); border: 1px dashed rgba(244, 220, 149, 0.16); }
.card.best .card-face { box-shadow: 0 0 0 3px var(--gold-2), 0 0 18px rgba(244, 220, 149, 0.7); }
.hd-board.dim .card:not(.best) .card-face, .hd-seat.dim .card:not(.best) .card-face { filter: brightness(0.62); }

/* ---------- Seats ---------- */
.hd-seats { margin: 0; padding: 0; list-style: none; }
.hd-seat {
  position: absolute;
  translate: -50% -50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: max-content;
  min-width: var(--plate-w);
  z-index: 2;
}
/* In front of the plate: the cards, and the chip stack on the side toward the middle. */
.hd-front { display: flex; align-items: flex-end; justify-content: center; gap: calc(var(--chip) * 0.35); }
.hd-seat.face-l .hd-front { flex-direction: row-reverse; }
.hd-pile { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: calc(var(--chip) * 2.9); }
.hd-pile .hd-chips { height: calc(var(--chip) * 1.35 + 2px); }
.hd-seat.empty .hd-pile { visibility: hidden; }
.hd-seat .seat-plate {
  gap: 6px;
  width: 100%;
  min-height: calc(var(--fs) * 2.3 + 6px);
  padding: 3px 8px 3px 3px;
  font-size: var(--fs);
}
.hd-seat .avatar { width: var(--avatar); height: var(--avatar); font-size: calc(var(--avatar) * 0.46); flex: none; }
.hd-seat .seat-who { min-width: 0; flex: 1 1 auto; }
.hd-seat .seat-name { font-size: var(--fs); }
.hd-seat .bot-chip { font-size: 12px; padding: 0.05em 0.4em; }
.hd-line2 { display: flex; align-items: center; gap: 4px; min-width: 0; }
.hd-seat .hd-stack { font-size: 12px; font-weight: 700; color: var(--ink-3); white-space: nowrap; }
.hd-seat .hd-stack:empty { display: none; }
.hd-seat .guest-tag { font-size: 12px; margin-left: 4px; }
.hd-seat .seat-tag { font-size: 12px; letter-spacing: 0.04em; }
.hd-hole { display: flex; justify-content: center; min-height: calc(var(--hole-w) * 1.4); }
/* The big letter on a picture card never under 12px, however small the card. */
.hd .card .court { font-size: max(12px, calc(var(--w) * 0.36)); }
.hd-hole .card { --w: var(--hole-w); }
.hd-hole .card + .card { margin-left: calc(var(--hole-w) * -0.35); }
.hd-hole.shown .card { --w: var(--shown-w); }
.hd-hole.shown { min-height: calc(var(--shown-w) * 1.4); }
.hd-hole.shown .card + .card { margin-left: calc(var(--shown-w) * -0.15); }
.hd-seat.folded .hd-hole { opacity: 0.28; }
.hd-seat.folded .seat-plate, .hd-seat.out .seat-plate, .hd-seat.sitting .seat-plate { opacity: 0.55; }
.hd-tag {
  min-height: calc(var(--fs) * 1.3);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}
.hd-tag.blank { visibility: hidden; }
.hd-tag .tg-hand { display: none; }
.hd-tag.raise, .hd-tag.bet, .hd-tag.allin { color: var(--gold-2); }
.hd-tag.fold { color: var(--ink-3); }
.hd-tag.win { color: var(--win); }
.hd-handname { max-width: 100%; font-size: 12px; font-weight: 700; line-height: 1.15; color: var(--gold-2); text-align: center; overflow-wrap: anywhere; }
.hd-handname.blank { display: none; }
.hd-seat.empty { opacity: 0.5; }
.hd-seat.empty .seat-plate { justify-content: center; padding: 6px; border-style: dashed; background: transparent; box-shadow: none; }
.hd-seat .bubble { bottom: 100%; }

/* Your seat: your cards large, your hand's name under them. */
.hd-seat.me { width: auto; z-index: 3; }
.hd-seat.me .hd-hole .card { --w: var(--me-w); }
.hd-seat.me .hd-hole { min-height: calc(var(--me-w) * 1.4); }
.hd-seat.me .hd-hole .card + .card { margin-left: calc(var(--me-w) * 0.06); }
.hd-seat.me .seat-plate { width: auto; min-width: var(--plate-w); max-width: 260px; }
.hd-seat.me .hd-mine { font-size: var(--fs); font-weight: 700; color: var(--gold-2); min-height: calc(var(--fs) * 1.3); white-space: nowrap; }
.hd-seat.me .hd-equity { font-size: 12px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }

/* The turn clock round the avatar (online.css), and the turn glow on the plate (below, "Lively"). */
.hd-seat.turn .seat-plate { border-color: var(--gold-2); }
.hd-seat.turn .avatar { animation: none; }

/* Bets in front of each seat, the dealer button and blind markers (placed by holdem.js). */
.hd-bet {
  position: absolute;
  translate: -50% -50%;
  z-index: 1;
  pointer-events: none;
}
/* The dealer button and blind marker on the plate's corner. */
.hd-marks { position: absolute; top: -7px; right: -6px; display: flex; gap: 2px; pointer-events: none; }
/* A bet: a few small chips and the amount. */
.hd-bet { display: inline-flex; align-items: center; gap: 3px; }
.hd-bet .hd-col { --c: calc(var(--chip) * 0.8); }
.hd-bet .hd-amt { color: #fffaf0; }
.hd-bet:empty, .hd-bet[data-amount='0'] { display: none; }
/* A chip on its way (bets to the pot, the pot to a winner): a little stack. */
.hd-fly {
  position: fixed;
  z-index: 50;
  width: 18px;
  height: 9px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(closest-side, #c8372d 0 50%, #f4f1e8 53% 59%, transparent 62%), repeating-conic-gradient(#c8372d 0 22.5deg, #f4f1e8 22.5deg 45deg);
  box-shadow: 0 2px 0 #8a2018, 0 4px 0 #c8372d, 0 6px 0 #8a2018, 0 7px 5px rgba(0, 0, 0, 0.45);
}
.hd-btn {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #e8e2cf 70%);
  color: #222;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}
.hd-btn.blind { width: auto; padding: 0 5px; border-radius: 999px; background: rgba(255, 255, 255, 0.82); }

.hd-stage .toast {
  position: absolute;
  left: 50%;
  top: calc(var(--centre-y, 46%) - var(--board-w) * 1.6);
  translate: -50% -50%;
  z-index: 30;
  max-width: calc(100% - 16px);
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 700;
  text-align: center;
  color: var(--ink);
  background: rgba(2, 14, 8, 0.9);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  opacity: 0;
  scale: 0.9;
  pointer-events: none;
  transition: opacity 0.25s, scale 0.3s var(--ease);
}
.hd-stage .toast.show { opacity: 1; scale: 1; }
.hd-stage .toast.lose { color: var(--lose); border-color: rgba(255, 114, 114, 0.4); }
.hd-stage .toast.gold { color: #2b1c04; background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-color: transparent; }

/* ---------- Under the felt: the status line, the bar, your actions ---------- */
.hd-foot { flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.hd-status { margin: 0; min-height: 1.3em; font-size: 0.9rem; font-weight: 600; color: var(--ink-2); text-align: center; }
.hd-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.hd-bar .btn { min-height: 40px; padding: 0 14px; }
.hd-bar .btn[aria-pressed='true'] { color: #2b1c04; background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-color: transparent; }

.hd-controls { flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; }
/* One row of buttons is always kept (your turn, act in advance, Rebuy, or none): the felt keeps its
   size as they come and go. */
.hd-controls { min-height: 46px; justify-content: flex-end; }
.hd-actions, .hd-pre, .hd-misc, .hd-presets, .hd-confirm { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; width: 100%; }
.hd-actions .btn, .hd-pre .btn, .hd-misc .btn, .hd-confirm .btn { min-height: 46px; flex: 1 1 0; max-width: 200px; padding: 0 10px; white-space: nowrap; }
.hd-actions .btn:disabled { opacity: 0.35; }
.hd-pre .btn[aria-pressed='true'] { color: #2b1c04; background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-color: transparent; }
.hd-presets .btn { min-height: 44px; flex: 1 1 0; max-width: 110px; padding: 0 6px; font-size: 0.9rem; }
.hd-sizer { display: flex; flex-direction: column; gap: 6px; width: min(640px, 100%); }
.hd-amount { display: flex; align-items: center; gap: 10px; }
.hd-amount input[type='range'] { flex: 1 1 auto; min-width: 0; min-height: 44px; accent-color: var(--gold); }
.hd-amount input[type='number'] {
  width: 104px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font: 700 1rem var(--font-ui);
  text-align: right;
}
.hd-confirm { align-items: center; }
.hd-confirm span { width: 100%; text-align: center; font-weight: 700; color: var(--gold-2); }

/* ---------- Hand history ---------- */
.hd-hist { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.hd-hist li { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); }
.hd-hist h4 { margin: 0 0 4px; display: flex; justify-content: space-between; gap: 10px; color: var(--ink); font-size: 0.95rem; }
.hd-hist h4 .won { color: var(--win); }
.hd-hist h4 .lost { color: var(--lose); }
.hd-hist p { margin: 2px 0; font-size: 0.85rem; color: var(--ink-2); }
.hd-hist .cards-line { color: var(--ink); font-weight: 700; }
.hd-hist .red { color: #ff8a8a; }
.hd-hist-empty { margin: 0; }

/* ---------- Phones on their side and other short windows: the actions beside the felt ---------- */
/* Quick reactions open from the button's left edge: the button sits at the left of the bar. */
.hd-bar .react-menu { right: auto; left: 0; }
/* Dex's outfit picker: one row per outfit you own. */
.hd-outfit-menu { grid-template-columns: 1fr; }
.hd-outfit-menu .btn { justify-content: flex-start; gap: 8px; }
.hd-outfit-menu .btn[aria-pressed="true"] { color: #2b1c04; background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-color: transparent; }
.hd-outfit-menu p { margin: 4px; color: var(--ink-3); font-size: 0.85rem; }
.hd-outfit-menu .hd-menu-head { margin: 2px 4px 0; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
/* A dealer's button shows them, small: their head and shoulders. */
.hd-outfit-menu .btn .dex { --dex-h: 30px; flex: none; margin: -4px 0 -6px; filter: none; }
/* Phones: the Dex button sits mid-bar, so its picker opens centred on it (from its left edge it ran
   off the screen). */
@media (max-width: 600px) { .hd-bar .react-menu.hd-outfit-menu { left: 50%; right: auto; translate: -50% 0; width: 200px; } }

@media (orientation: landscape) and (max-height: 500px) {
  .table.hd {
    display: grid;
    grid-template-columns: 1fr minmax(172px, 28%);
    grid-template-rows: 1fr auto;
    grid-template-areas: "felt controls" "felt foot";
    column-gap: 8px;
  }
  .hd-felt { grid-area: felt; }
  .hd-foot { grid-area: foot; }
  .hd-controls { grid-area: controls; justify-content: flex-end; }
  .hd-actions .btn, .hd-pre .btn, .hd-misc .btn, .hd-confirm .btn { flex: 1 1 calc(50% - 6px); max-width: none; min-height: 44px; }
  .hd-presets .btn { flex: 1 1 calc(33% - 6px); }
  .hd-amount { gap: 6px; }
  .hd-amount input[type='number'] { width: 64px; }
  .hd-bar .btn { min-height: 40px; padding: 0 10px; }
  .hd-status { font-size: 0.85rem; }
  /* No room for both: while you size a bet, the bar under it steps aside (Escape brings it back). */
  .table.hd:has(.hd-sizer:not([hidden])) .hd-foot { display: none; }
  /* The bar is at the right edge here: reactions open to the left. */
  .hd-bar .react-menu { left: auto; right: 0; }
}
/* Phones: while you size a bet, the bar steps aside to leave the table its room (Escape brings it back). */
@media (max-width: 600px) {
  .table.hd:has(.hd-sizer:not([hidden])) .hd-foot { display: none; }
}
@media (max-width: 480px) {
  .hd-actions .btn { padding: 0 6px; font-size: 0.95rem; }
  .hd-bar .btn { padding: 0 10px; }
}


/* ---------- The header on phones (as the other game pages) ---------- */
@media (max-width: 640px) {
  .topbar { gap: 8px; }
  .topbar .brand { display: none; }
  .topbar-title { border-left: none; padding-left: 4px; font-size: 1.05rem; color: var(--ink); }
  .pill { padding-right: 12px; }
}
@media (max-width: 480px) {
  .topbar { padding-inline: 12px; gap: 6px; }
  .topbar-heading { flex-direction: column; align-items: flex-start; gap: 3px; }
  .topbar-title { font-size: 1rem; line-height: 1.1; padding-left: 0; }
  .mode-badge { padding: 2px 7px; font-size: 0.75rem; letter-spacing: 0.04em; }
  .topbar .btn-icon { width: 36px; height: 36px; min-height: 36px; }
  .pill { gap: 6px; height: 36px; padding: 0 10px 0 6px; font-size: 0.92rem; }
  .pill .coin { width: 20px; height: 20px; }
}
@media (max-width: 400px) {
  .topbar .pill .coin { display: none; }
}

/* ---------- Seats: the info column (plate, your hand's name, the last action) ---------- */
.hd-info { display: flex; flex-direction: column; align-items: center; gap: 2px; width: var(--plate-w); min-width: 0; }
.hd-seat.me .hd-info { width: auto; }
.hd-line2 { flex-wrap: wrap; }

/* A narrow felt (phones upright, phones on their side): the others' plates drop the avatar so
   the name has the room, and their turn clock is a bar under the plate. */
@container felt (max-width: 600px) {
  /* Others' hand names, short, in the tag's place (no extra lines); a winner's in the win colour. */
  .hd-seat:not(.me) .hd-tag.has-hand { visibility: visible; white-space: nowrap; }
  .hd-seat:not(.me) .hd-tag.has-hand .tg-act { display: none; }
  .hd-seat:not(.me) .hd-tag.has-hand .tg-hand { display: inline; text-transform: none; letter-spacing: 0; }
  .hd-seat:not(.me) .hd-tag.has-hand:not(.win) .tg-hand { color: var(--gold-2); }
  .hd-seat:not(.me) .hd-handname { display: none; }
  .hd-seat:not(.me) .avatar { display: none; }
  .hd-seat:not(.me) .seat-plate { padding: 3px 7px; position: relative; }
  .hd-seat.clock:not(.me) .seat-plate::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: calc(var(--left, 1) * (100% - 24px));
    margin-left: 12px;
    border-radius: 2px;
    background: var(--clock-color, var(--gold-2));
  }
  .hd-seat.clock.hurry { --clock-color: var(--lose); }
}
/* A short felt (phones on their side, short windows): cards beside the plate, not above it. */
@container felt (max-height: 420px) {
  /* Others' hand names, short, in the tag's place (no extra lines); a winner's in the win colour. */
  .hd-seat:not(.me) .hd-tag.has-hand { visibility: visible; white-space: nowrap; }
  .hd-seat:not(.me) .hd-tag.has-hand .tg-act { display: none; }
  .hd-seat:not(.me) .hd-tag.has-hand .tg-hand { display: inline; text-transform: none; letter-spacing: 0; }
  .hd-seat:not(.me) .hd-tag.has-hand:not(.win) .tg-hand { color: var(--gold-2); }
  .hd-seat:not(.me) .hd-handname { display: none; }
  /* A shown hand's name is a label over the bottom of the cards (the corners stay clear), not a line. */
  .hd-seat:not(.me) .hd-tag.has-hand {
    position: absolute;
    bottom: 1px;
    left: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 0;
    padding: 0 5px;
    border-radius: 6px;
    background: rgba(3, 22, 13, 0.88);
    line-height: 1.4;
    z-index: 1;
  }
  /* Shown cards overlap more here (the first card's corner still shows): the seat stays narrow. */
  .hd-hole.shown .card + .card { margin-left: calc(var(--shown-w) * -0.42); }
  .hd-seat { flex-direction: row; width: auto; gap: 4px; }
  .hd-seat.face-l:not(.me) { flex-direction: row-reverse; }
  .hd-seat .hd-info { width: var(--plate-w); }
  .hd-seat.me .hd-info { width: var(--plate-w); }
  .hd-seat.me .seat-plate { max-width: var(--plate-w); }
  .hd-hole { min-height: 0; }
}


/* ---------- Lively: a warmer table, rounder plates, bouncier motion, the win and all-in touches ----------
   Only transform and opacity ever animate. The one thing that runs all the time is the glow round
   the seat whose turn it is. With reduced motion: no bounces, pulses or bursts, just fades. */
:root {
  --felt-1: #1a7349;
  --felt-2: #0c4c31;
  --felt-3: #052719;
  --gold: #e3b752;
  --gold-2: #f9e2a2;
  --gold-3: #a8802c;
}
.hd .panel-card { border-radius: 26px; }

/* Rounder, softer seat plates. */
.hd-seat .seat-plate {
  border: 1.5px solid rgba(248, 224, 160, 0.3);
  background: linear-gradient(180deg, rgba(18, 54, 35, 0.94), rgba(4, 20, 12, 0.94));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 6px 16px rgba(0, 0, 0, 0.34);
}
.hd-seat .avatar { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 0 2px rgba(248, 224, 160, 0.5); }
.hd-seat.turn .seat-plate { background: linear-gradient(180deg, rgba(52, 50, 20, 0.95), rgba(20, 22, 8, 0.95)); }
/* The ring the turn glow and the win glow draw on. */
.hd-seat .seat-plate::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 0 0 2.5px var(--gold-2), 0 0 20px 4px rgba(249, 226, 162, 0.5);
}
.hd-seat.turn .seat-plate::before { opacity: 1; animation: hd-turn 1.5s ease-in-out infinite alternate; }
@keyframes hd-turn {
  from { opacity: 0.4; transform: scale(0.995); }
  to { opacity: 1; transform: scale(1.035); }
}

/* Chunkier, rounder action buttons that press in. */
.hd-actions .btn, .hd-pre .btn, .hd-misc .btn, .hd-confirm .btn {
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 3px 0 rgba(0, 0, 0, 0.3), 0 6px 14px rgba(0, 0, 0, 0.22);
}
.hd-actions .btn:active:not(:disabled), .hd-pre .btn:active, .hd-misc .btn:active, .hd-confirm .btn:active { transform: translateY(2px) scale(0.97); }

/* Cards turn over with a little overshoot (the same time as before). */
.hd .card-inner { transition-timing-function: cubic-bezier(0.3, 1.15, 0.45, 1); }
/* A hole card laid in its place before the deal reaches it (holdem.js: layHoles). */
.hd .card.undealt { opacity: 0; }

/* A win: the glow on the winner's plate. Green and small for a split pot; gold and bigger for a
   pot won alone; biggest for you. */
.hd-seat.won .seat-plate::before {
  box-shadow: 0 0 0 2px var(--win), 0 0 14px 3px rgba(95, 211, 148, 0.45);
  animation: hd-won-small 1.1s ease-out both;
}
.hd-seat.won-big .seat-plate::before {
  box-shadow: 0 0 0 3px var(--gold-2), 0 0 26px 8px rgba(249, 226, 162, 0.6);
  animation: hd-won 1.2s ease-out both;
}
.hd-seat.me.won-big .seat-plate::before { box-shadow: 0 0 0 3px var(--gold-2), 0 0 40px 14px rgba(249, 226, 162, 0.65); }
.hd-seat.won-big .hd-tag { animation: hd-tag-pop 0.5s cubic-bezier(0.3, 1.5, 0.5, 1); }
@keyframes hd-won {
  0% { opacity: 0; transform: scale(0.92); }
  22% { opacity: 1; transform: scale(1.07); }
  45% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}
@keyframes hd-won-small {
  0% { opacity: 0; }
  25% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes hd-tag-pop { from { transform: scale(0.6); opacity: 0.3; } }

/* The sparkle burst at the winner's chips (holdem.js: cheer). */
.hd-pile { position: relative; }
.hd-burst {
  --r: calc(var(--chip) * 2.3);
  --s: calc(var(--chip) * 0.8);
  position: absolute;
  left: 50%;
  top: 38%;
  width: 0;
  height: 0;
  z-index: 5;
  pointer-events: none;
}
.hd-burst.me { --r: calc(var(--chip) * 3.8); --s: calc(var(--chip) * 1.05); }
.hd-burst::before {
  content: '';
  position: absolute;
  left: calc(var(--r) * -0.7);
  top: calc(var(--r) * -0.7);
  width: calc(var(--r) * 1.4);
  height: calc(var(--r) * 1.4);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 240, 190, 0.85), rgba(249, 226, 162, 0.4) 55%, transparent);
  animation: hd-flash 0.6s ease-out both;
}
.hd-burst i {
  position: absolute;
  left: calc(var(--s) * -0.5);
  top: calc(var(--s) * -0.5);
  width: var(--s);
  height: var(--s);
  background: radial-gradient(circle, #fffbe8 0 8%, var(--gold-2) 22%, var(--gold) 60%, #c8922e);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  opacity: 0;
  animation: hd-spark 0.85s cubic-bezier(0.2, 0.8, 0.3, 1) var(--t, 0ms) both;
}
@keyframes hd-flash {
  from { opacity: 0; transform: scale(0.3); }
  30% { opacity: 1; }
  to { opacity: 0; transform: scale(1.2); }
}
@keyframes hd-spark {
  0% { opacity: 0; transform: rotate(var(--a)) translateY(0) scale(0.3); }
  20% { opacity: 1; }
  65% { opacity: 1; transform: rotate(var(--a)) translateY(calc(var(--r) * var(--d) * -1)) scale(1) rotate(45deg); }
  100% { opacity: 0; transform: rotate(var(--a)) translateY(calc(var(--r) * var(--d) * -1.15)) scale(0.2) rotate(90deg); }
}

/* "All in", stamped on the seat for about a second (holdem.js: stamp). */
.hd-stamp {
  position: absolute;
  left: 50%;
  top: calc(var(--hole-w) * 0.7);
  translate: -50% -50%;
  z-index: 6;
  padding: 0.12em 0.6em;
  border-radius: 12px;
  border: 2px solid var(--gold-2);
  color: var(--gold-2);
  background: rgba(110, 20, 34, 0.92);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  font: 900 max(13px, calc(var(--fs) * 1.05)) / 1.2 var(--font-ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  animation: hd-stamp 1.1s ease-out both;
}
.hd-seat.me .hd-stamp { top: calc(var(--me-w) * 0.7); font-size: max(15px, calc(var(--fs) * 1.3)); }
@keyframes hd-stamp {
  0% { opacity: 0; transform: rotate(-14deg) scale(1.8); }
  16% { opacity: 1; transform: rotate(-8deg) scale(0.94); }
  26% { transform: rotate(-8deg) scale(1.05); }
  34% { transform: rotate(-8deg) scale(1); }
  78% { opacity: 1; transform: rotate(-8deg) scale(1); }
  100% { opacity: 0; transform: rotate(-8deg) scale(0.96); }
}

/* Calm mode: the turn glow stays still, the stamp and the win glow only fade, no sparkles. (base.css
   cuts every animation short under reduced motion; these fades are let through on purpose.) */
@keyframes hd-fade {
  0% { opacity: 0; }
  20% { opacity: 1; }
  75% { opacity: 1; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .hd-seat.turn .seat-plate::before { animation: none !important; opacity: 1; }
  .hd .hd-stamp { animation: hd-fade 1.1s ease-out both !important; transform: rotate(-8deg); }
  .hd .hd-seat.won .seat-plate::before { animation: hd-fade 1.1s ease-out both !important; }
  .hd-seat.won-big .hd-tag { animation: none !important; }
  .hd-burst { display: none; }
}
/* A narrow felt (phones): the number pills a little slimmer, so a showdown still fits. */
@container felt (max-width: 600px) {
  .hd-num, .hd-amt { padding-inline: 0.3em; letter-spacing: -0.01em; }
}
/* A wide felt: your plate beside your cards, not under them. The table's height is what limits it
   on a computer, and this gives the cards and plates about a fifth more room (holdem.js centres
   your cards under the board). */
@container felt (min-width: 700px) {
  .hd-seat.me { flex-direction: row; align-items: center; gap: calc(var(--fs) * 0.8); }
  .hd-seat.me .hd-info { align-items: flex-start; }
  .hd-seat.me .hd-mine, .hd-seat.me .hd-equity, .hd-seat.me .hd-tag { padding-left: calc(var(--fs) * 0.6); }
}
