/* Dealer Box — card room at night.
   Layout: casino table seen from above (dealer at the top, seat 1 on the dealer's left).
   Decisions appear on the felt; history, settings and rules sit under the table. */
:root {
  color-scheme: dark;
  --bg: #0b1210;
  --bg-2: #101a17;
  --panel: #141f1b;
  --panel-2: #1a2823;
  --panel-3: #22332c;
  --line: #2a3d35;
  --line-2: #36504a;
  --ink: #f1f3ec;
  --muted: #9cb0a5;
  --faint: #6f8479;

  --felt: #1f6a4c;
  --felt-hi: #2a7e5b;
  --felt-dark: #134432;
  --felt-print: rgba(240, 248, 236, .16);
  --wood: #6b3f22;
  --wood-hi: #9a6235;
  --rail: #2a1a12;
  --rail-hi: #4a2e1f;

  --brass: #e0b866;
  --brass-hi: #f0d08f;
  --brass-ink: #1e1505;
  --good: #5fd590;
  --good-bg: #133524;
  --bad: #ff7b6b;
  --bad-bg: #3d1c18;
  --warn: #f2c14e;
  --warn-bg: #3a2e12;
  --info: #7cb7ff;

  --card: #fdfcf7;
  --card-red: #c62f2a;
  --card-black: #16181a;
  --back-1: #8c2a24;
  --back-2: #b5392f;

  --c1: #f2efe6;   --c1e: #2f5fb5;
  --c5: #c8352e;   --c5e: #f6efe1;
  --c25: #23824a;  --c25e: #f6efe1;
  --c100: #1b1b1d; --c100e: #f6efe1;
  --c500: #6b3fa0; --c500e: #f2d67b;
  --c1000: #e3a722; --c1000e: #3b2405;

  --f-display: "Saira Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --f-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(224, 184, 102, .08), transparent 60%),
    radial-gradient(900px 500px at 100% 100%, rgba(31, 106, 76, .12), transparent 60%),
    var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--f-body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 env(safe-area-inset-bottom, 0px);
  -webkit-font-smoothing: antialiased;
}
body::before {
  /* Card-room carpet: faint repeating diamonds. */
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.012) 0 2px, transparent 2px 28px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.012) 0 2px, transparent 2px 28px);
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--f-display); letter-spacing: .01em; text-wrap: balance; margin: 0; line-height: 1.05; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.label { font-family: var(--f-display); text-transform: uppercase; letter-spacing: .1em; font-size: 12px; color: var(--muted); font-weight: 700; }
.hint { font-size: 13px; color: var(--muted); }
kbd { font: 700 11px var(--f-display); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--muted); background: var(--panel-2); }

/* ------------------------------------------------------------ chips (shared) */
.chip {
  --c: var(--c5); --e: var(--c5e);
  width: 1em; height: 1em; border-radius: 50%; display: inline-block; flex: none;
  background:
    radial-gradient(circle, var(--c) 0 46%, var(--e) 46% 50%, var(--c) 50% 64%, transparent 64%),
    repeating-conic-gradient(var(--e) 0 18deg, var(--c) 18deg 45deg);
  box-shadow: 0 1px 2px rgba(0,0,0,.5), inset 0 0 0 1px rgba(0,0,0,.25);
}
.chip.v1 { --c: var(--c1); --e: var(--c1e); }
.chip.v5 { --c: var(--c5); --e: var(--c5e); }
.chip.v25 { --c: var(--c25); --e: var(--c25e); }
.chip.v100 { --c: var(--c100); --e: var(--c100e); }
.chip.v500 { --c: var(--c500); --e: var(--c500e); }
.chip.v1000 { --c: var(--c1000); --e: var(--c1000e); }

/* SVG chips: side-view stacks for bets and the pot, top-view chips for markers. */
.stacks { display: flex; gap: 1px; align-items: flex-end; }
.cs { width: var(--cw, 26px); height: calc(var(--cw, 26px) * var(--k)); display: block; filter: drop-shadow(0 2px 2px rgba(0,0,0,.55)); }
.tc { width: 1em; height: 1em; display: inline-block; flex: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,.5)); }
.brand .tc { font-size: 34px; }
.eyebrow .tc { font-size: 18px; }
.who-p .stk .tc { font-size: 13px; }
/* Legacy CSS chips (rack). */
.stacks { display: flex; gap: 2px; align-items: flex-end; }
.col { display: flex; flex-direction: column-reverse; }
.sc {
  --c: var(--c5); --e: var(--c5e);
  width: 20px; height: 5px; border-radius: 50% / 50%; margin-top: -1px;
  background: linear-gradient(90deg, var(--c) 0 14%, var(--e) 14% 24%, var(--c) 24% 44%, var(--e) 44% 56%, var(--c) 56% 76%, var(--e) 76% 86%, var(--c) 86%);
  box-shadow: 0 1px 0 rgba(0,0,0,.45);
}
.sc.v1 { --c: var(--c1); --e: var(--c1e); }
.sc.v25 { --c: var(--c25); --e: var(--c25e); }
.sc.v100 { --c: var(--c100); --e: var(--c100e); }
.sc.v500 { --c: var(--c500); --e: var(--c500e); }
.sc.v1000 { --c: var(--c1000); --e: var(--c1000e); }

/* ------------------------------------------------------------ cards */
.card {
  --w: 44px;
  width: var(--w); height: calc(var(--w) * 1.4); border-radius: calc(var(--w) * .1);
  background: linear-gradient(160deg, #fff, var(--card) 60%, #efece2);
  color: var(--card-black); position: relative; flex: none;
  box-shadow: 0 2px 5px rgba(0,0,0,.45), inset 0 0 0 1px rgba(0,0,0,.08);
  font-family: var(--f-display); line-height: 1;
}
.card.red { color: var(--card-red); }
.card .ix { position: absolute; left: 7%; top: 5%; display: grid; justify-items: center; }
.card .ix b { font-size: calc(var(--w) * .38); font-weight: 800; letter-spacing: -.04em; }
.card .ix i { font-style: normal; font-size: calc(var(--w) * .3); margin-top: -1px; }
.card .pip { position: absolute; right: 8%; bottom: 6%; font-size: calc(var(--w) * .58); }
.card.flip { animation: flip .45s cubic-bezier(.2,.8,.3,1.2) both; }
@keyframes flip { from { transform: rotateY(90deg) translateY(-6px); opacity: .2; } }
.back {
  --w: 18px;
  width: var(--w); height: calc(var(--w) * 1.4); border-radius: 3px; flex: none;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 30%, rgba(255,255,255,.12) 31% 34%, transparent 35%),
    repeating-linear-gradient(45deg, var(--back-1) 0 2px, var(--back-2) 2px 4px);
  border: 2px solid #f6efe1; box-shadow: 0 1px 3px rgba(0,0,0,.5);
}

/* ------------------------------------------------------------ top bar */
.top {
  display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap;
  padding-block: calc(12px + env(safe-area-inset-top, 0px)) 12px;
  border-bottom: 1px solid var(--line);
  max-width: 1320px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; }
.brand .chip { font-size: 32px; }
.brand h1 { font-size: 24px; font-weight: 900; letter-spacing: .02em; }
.brand h1 span { color: var(--brass); }
.sign {
  display: grid; border-radius: 6px; overflow: hidden; border: 1px solid #000;
  box-shadow: 0 2px 8px rgba(0,0,0,.4); background: #f4efe2; color: #18120a; min-width: 150px;
}
.sign .sh { background: #a8261f; color: #fff; font: 800 11px var(--f-display); letter-spacing: .16em; text-transform: uppercase; padding: 2px 10px; text-align: center; }
.sign .sb { font: 800 16px/1.1 var(--f-display); padding: 3px 10px 4px; text-align: center; }
.sign .sb small { display: block; font-weight: 600; font-size: 11px; color: #5b4c34; letter-spacing: .04em; }
.lvl { font: 800 12px var(--f-display); letter-spacing: .12em; text-transform: uppercase; padding: 4px 10px; border-radius: 99px; border: 1px solid; }
.lvl.l1 { color: #8fe0ad; border-color: #2c6b46; background: #12301f; }
.lvl.l2 { color: #ffd479; border-color: #6b5426; background: #2f2612; }
.lvl.l3 { color: #ff9c8c; border-color: #74362d; background: #331815; }
.spacer { flex: 1; }
.net { font-size: 13px; padding: 4px 12px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); display: inline-flex; align-items: center; gap: 8px; }
.net::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.net.ok { color: var(--good); }
.net.wait { color: var(--warn); }
.net.err { color: var(--bad); }
.scorebox { display: flex; align-items: center; gap: 10px; }
.ring {
  --p: 0; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--good) calc(var(--p) * 1%), var(--panel-3) 0);
}
.ring b { width: 34px; height: 34px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font: 800 13px var(--f-display); }
.scorebox .st { display: grid; line-height: 1.15; }
.scorebox .st b { font: 800 18px var(--f-display); }
.scorebox .st span { font-size: 12px; color: var(--muted); }
.streak { font: 800 13px var(--f-display); color: var(--warn); }

/* ------------------------------------------------------------ buttons & fields */
.btn {
  border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 10px; padding: 9px 14px;
  font-weight: 700; transition: background .15s, border-color .15s, transform .08s; display: inline-flex; align-items: center; gap: 8px; justify-content: center;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, var(--brass-hi), var(--brass)); color: var(--brass-ink); border-color: #a9853e; box-shadow: 0 2px 0 #8a6a2c, 0 6px 16px rgba(224,184,102,.18); }
.btn.good { background: linear-gradient(180deg, #1d4a32, var(--good-bg)); border-color: var(--good); color: #c9f5d9; }
.btn.bad { background: linear-gradient(180deg, #552620, var(--bad-bg)); border-color: var(--bad); color: #ffd5cf; }
.btn.big { padding: 14px 20px; font-size: 17px; border-radius: 12px; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn kbd { margin-left: 4px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.field { display: grid; gap: 6px; min-width: 0; }
.input, .field select, textarea {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; width: 100%;
}
textarea { min-height: 64px; resize: vertical; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 9px; padding: 7px 12px; font-weight: 700; font-size: 14px; }
.seg button.on { border-color: var(--brass); color: var(--brass-hi); background: #2b2414; }
.seg button.next { box-shadow: inset 0 -3px 0 var(--brass); }
.seg button:disabled { opacity: .3; }

/* ------------------------------------------------------------ panels */
.panel { background: linear-gradient(180deg, var(--panel), var(--bg-2)); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 12px; min-width: 0; }
.panel > h3, details.panel > summary { font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.panel h3 .label { margin-left: auto; }
details.panel > summary { cursor: pointer; list-style: none; font-family: var(--f-display); }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: "+"; margin-left: auto; color: var(--muted); font-size: 20px; }
details.panel[open] > summary::after { content: "–"; }

/* ------------------------------------------------------------ home */
.home { max-width: 1120px; margin: 0 auto; padding-block: 28px 56px; display: grid; gap: 32px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 32px; align-items: center; }
.eyebrow { font: 800 13px var(--f-display); letter-spacing: .2em; text-transform: uppercase; color: var(--brass); display: flex; align-items: center; gap: 10px; }
.eyebrow .chip { font-size: 16px; }
.hero h2 { font-size: clamp(42px, 6.4vw, 76px); font-weight: 900; line-height: .92; margin-top: 12px; text-transform: uppercase; }
.hero h2 em { font-style: normal; color: var(--brass); }
.hero p.lead { color: var(--muted); max-width: 48ch; font-size: 17px; margin-top: 16px; }
.hero .facts-row { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 20px; }
.hero .facts-row div { display: grid; }
.hero .facts-row b { font: 900 28px var(--f-display); }
.hero .facts-row span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.resume { background: var(--warn-bg); border: 1px solid #6b5426; border-radius: 12px; padding: 12px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.builder { display: grid; gap: 22px; background: linear-gradient(180deg, var(--panel), var(--bg-2)); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.builder > h3 { font-size: 28px; font-weight: 900; text-transform: uppercase; }
.step { display: grid; gap: 10px; }
.step-h { display: flex; align-items: baseline; gap: 10px; }
.step-h .n { font: 900 14px var(--f-display); color: var(--brass-ink); background: var(--brass); border-radius: 50%; width: 22px; height: 22px; display: inline-grid; place-items: center; }
.step-h h4 { font-size: 19px; font-weight: 800; }
.step-h .hint { margin-left: auto; }
.games { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.family { display: grid; gap: 6px; align-content: start; }
.family .label { padding-left: 2px; }
.gbtn { text-align: left; border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 10px; padding: 9px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gbtn b { font: 800 17px var(--f-display); }
.gbtn small { color: var(--muted); font-size: 12px; }
.gbtn.on { border-color: var(--brass); background: #2b2414; box-shadow: inset 0 0 0 1px var(--brass); }
.gbtn.on small { color: var(--brass-hi); }
.players { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; }
.stepper button { width: 44px; height: 48px; border: 0; background: var(--panel-2); font-size: 22px; font-weight: 700; }
.stepper button:disabled { opacity: .3; }
.stepper output { min-width: 70px; text-align: center; font: 900 30px var(--f-display); }
.mini-table { position: relative; width: 170px; height: 86px; flex: none; }
.mini-table .mt { position: absolute; inset: 14px 18px; border-radius: 50%; background: radial-gradient(ellipse, var(--felt-hi), var(--felt-dark)); box-shadow: 0 0 0 4px var(--wood), 0 0 0 7px var(--rail); }
.mini-table .dot { position: absolute; width: 14px; height: 14px; border-radius: 50%; transform: translate(-50%, -50%); background: var(--brass); border: 2px solid var(--bg); }
.mini-table .dot.dl { background: #f4efe2; width: 22px; height: 9px; border-radius: 3px; }
.levels, .stack-opts, .modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.opt { text-align: left; border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 12px; padding: 12px 14px; display: grid; gap: 4px; align-content: start; }
.opt b { font: 800 18px var(--f-display); }
.opt span { font-size: 13px; color: var(--muted); }
.opt.on { border-color: var(--brass); background: #2b2414; box-shadow: inset 0 0 0 1px var(--brass); }
.mode { text-align: left; border: 1px solid var(--line-2); background: linear-gradient(180deg, var(--panel-3), var(--panel-2)); border-radius: 14px; padding: 16px; display: grid; gap: 8px; align-content: start; transition: border-color .15s, transform .15s; }
.mode:hover { border-color: var(--brass); transform: translateY(-2px); }
.mode .ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--bg); border: 1px solid var(--line-2); }
.mode .ic svg { width: 22px; height: 22px; stroke: var(--brass); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mode h4 { font-size: 21px; font-weight: 800; }
.mode p { color: var(--muted); font-size: 14px; }
.join { display: flex; gap: 8px; }
.join input { text-transform: uppercase; letter-spacing: .3em; font: 800 20px var(--f-display); width: 8ch; text-align: center; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 6px; }
.how { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.how div { border-top: 2px solid var(--line-2); padding-top: 12px; display: grid; gap: 4px; }
.how b { font: 800 18px var(--f-display); }
.how p { color: var(--muted); font-size: 14px; }

/* ------------------------------------------------------------ game layout */
.game { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; padding-block: 18px 48px; max-width: 1320px; margin: 0 auto; }
.main { min-width: 0; display: grid; gap: 16px; align-content: start; }
.side { min-width: 0; display: grid; gap: 14px; align-content: start; }

/* ------------------------------------------------------------ the table */
.table-wrap { container-type: inline-size; padding: 46px 58px 54px; position: relative; }
.rail {
  --ar: 2.05;
  position: relative; aspect-ratio: var(--ar); width: min(100%, calc(60vh * var(--ar))); margin-inline: auto;
  border-radius: 50%; padding: 4%;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255,255,255,.08), transparent 60%),
    radial-gradient(ellipse at 50% 50%, var(--rail-hi), var(--rail) 75%);
  box-shadow: 0 30px 60px rgba(0,0,0,.6), 0 0 0 1px #000, inset 0 2px 0 rgba(255,255,255,.08), inset 0 -6px 14px rgba(0,0,0,.5);
}
.rail::before { /* stitching on the leather */
  content: ""; position: absolute; inset: 1.4%; border-radius: 50%; border: 1.5px dashed rgba(255, 230, 200, .16); pointer-events: none;
}
.wood {
  position: absolute; inset: 4%; border-radius: 50%; padding: 1.5%;
  background: linear-gradient(135deg, var(--wood-hi), var(--wood) 40%, #4a2a15 70%, var(--wood-hi));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.4);
}
.felt {
  position: absolute; inset: 1.5%; border-radius: 50%; overflow: hidden;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 50% 42%, var(--felt-hi) 0%, var(--felt) 48%, var(--felt-dark) 100%);
  box-shadow: inset 0 0 40px rgba(0,0,0,.45);
}
.felt .line { position: absolute; inset: 17% 14%; border-radius: 50%; border: 2px solid var(--felt-print); }
.felt .print { position: absolute; left: 50%; transform: translateX(-50%); text-align: center; color: var(--felt-print); font-family: var(--f-display); pointer-events: none; white-space: nowrap; }
.felt .print.logo { bottom: 9%; font-weight: 900; font-size: clamp(14px, 3.2cqi, 30px); letter-spacing: .3em; }
.felt .print.limits { top: 9.5%; font-weight: 700; font-size: clamp(9px, 1.4cqi, 13px); letter-spacing: .22em; text-transform: uppercase; }
.table { position: absolute; inset: 0; }
.tray {
  position: absolute; left: 50%; top: 0; transform: translate(-50%, -62%); z-index: 3;
  display: flex; align-items: flex-end; gap: 10px;
}
.rack { display: flex; gap: 2px; padding: 4px 6px 5px; background: linear-gradient(180deg, #2b2f33, #15181b); border: 1px solid #000; border-radius: 6px; box-shadow: 0 4px 10px rgba(0,0,0,.5); }
.rack .slot { width: 13px; height: 24px; border-radius: 3px; background: repeating-linear-gradient(180deg, var(--c) 0 3px, rgba(0,0,0,.35) 3px 4px); }
.deck { position: relative; width: 22px; height: 30px; }
.deck .back { position: absolute; inset: 0; --w: 22px; }
.deck .back:nth-child(2) { transform: translate(2px, -2px); }
.deck .back:nth-child(3) { transform: translate(4px, -4px); }
.dealer-tag { position: absolute; left: 50%; top: calc(100% + 4px); transform: translateX(-50%); font: 800 10px var(--f-display); letter-spacing: .24em; color: rgba(255,255,255,.55); }

.center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 8px; width: 62%; z-index: 1; }
.street { font: 800 12px var(--f-display); letter-spacing: .22em; text-transform: uppercase; color: rgba(255,255,255,.78); background: rgba(0,0,0,.28); padding: 2px 12px; border-radius: 99px; }
.board { display: flex; gap: 6px; min-height: 62px; align-items: center; }
.board .slot-empty { width: 44px; height: 62px; border-radius: 5px; border: 1.5px dashed rgba(255,255,255,.14); }
.pot { display: flex; align-items: center; gap: 10px; }
.pot .stacks { --cw: 34px; }
.pot .amt { font: 800 16px var(--f-display); background: rgba(0,0,0,.42); border-radius: 99px; padding: 2px 12px; border: 1px solid rgba(255,255,255,.1); }
.pot .amt.hidden { color: rgba(255,255,255,.65); font-weight: 600; font-size: 13px; }

.seat {
  position: absolute; transform: translate(-50%, -50%); width: 128px; z-index: 2;
  display: grid; justify-items: center; transition: opacity .25s;
}
.seat .hand { display: flex; justify-content: center; height: 24px; margin-bottom: -6px; position: relative; z-index: 1; }
.seat .hand .back { --w: 17px; margin-left: -5px; transform-origin: 50% 120%; }
.seat .hand .back:first-child { margin-left: 0; }
.seat .hand.deal .back { animation: deal .5s cubic-bezier(.2,.7,.3,1) both; }
.seat .hand.deal .back:nth-child(2) { animation-delay: .06s; }
.seat .hand.deal .back:nth-child(3) { animation-delay: .12s; }
.seat .hand.deal .back:nth-child(4) { animation-delay: .18s; }
@keyframes deal { from { transform: translateY(-40px) scale(.6) rotate(-20deg); opacity: 0; } }
.plate {
  width: 100%; display: flex; align-items: center; gap: 7px; padding: 6px 8px 6px 6px;
  background: linear-gradient(180deg, #1d2a25, #111a17); border: 1.5px solid var(--line-2); border-radius: 12px;
  box-shadow: 0 6px 14px rgba(0,0,0,.5); position: relative;
}
.avatar {
  --h: 140; width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center; position: relative;
  background: radial-gradient(circle at 50% 35%, hsl(var(--h) 45% 52%), hsl(var(--h) 50% 26%));
  font: 800 13px var(--f-display); color: #fff; border: 2px solid rgba(255,255,255,.3);
}
.avatar svg { width: 100%; height: 100%; border-radius: 50%; }
.avatar .sn {
  position: absolute; right: -5px; bottom: -4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px;
  background: #0d0d0d; border: 1.5px solid var(--brass); color: var(--brass-hi); font: 800 10px/14px var(--f-display); text-align: center;
}
.who-p { display: grid; min-width: 0; line-height: 1.1; text-align: left; }
.who-p .nm { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-p .nm em { font-style: normal; color: var(--faint); font-weight: 600; }
.who-p .stk { font: 800 17px var(--f-display); font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 4px; }
.who-p .stk .chip { font-size: 11px; }
.marks { position: absolute; top: -9px; right: -8px; display: flex; gap: 3px; }
.mk { font: 900 10px var(--f-display); border-radius: 99px; min-width: 21px; height: 21px; display: inline-grid; place-items: center; padding: 0 4px; box-shadow: 0 2px 4px rgba(0,0,0,.5); }
.mk.d { background: radial-gradient(circle, #fff 0 60%, #ddd 61%); color: #111; border: 1px solid #999; }
.mk.sb { background: #3a62c9; color: #fff; }
.mk.bb { background: #f0b92b; color: #2a1d02; }
.ribbon { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); font: 900 10px var(--f-display); letter-spacing: .14em; padding: 1px 8px; border-radius: 4px; text-transform: uppercase; white-space: nowrap; line-height: 1.5; }
.seat.folded { opacity: .42; }
.seat.folded .ribbon { background: #3a3f3d; color: #cfd6d2; }
.seat.allin .plate { border-color: var(--warn); }
.seat.allin .ribbon { background: var(--warn); color: #2a1d02; }
.seat.turn .plate { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(224,184,102,.28), 0 0 22px rgba(224,184,102,.35); }
.seat.acting .plate { border-color: #fff; }
.bubble {
  position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); z-index: 5;
  background: #fffdf6; color: #141414; font: 900 15px var(--f-display); white-space: nowrap;
  padding: 5px 12px; border-radius: 10px; text-transform: uppercase; letter-spacing: .02em;
  box-shadow: 0 6px 16px rgba(0,0,0,.5); animation: pop .2s ease-out;
}
.bubble small { display: block; font: 700 10px var(--f-body); text-transform: none; color: #6a6253; letter-spacing: 0; }
.bubble::after { content: ""; position: absolute; left: 50%; top: 100%; transform: translateX(-50%); border: 7px solid transparent; border-top-color: #fffdf6; }
.bubble.below { bottom: auto; top: calc(100% + 8px); }
.bubble.below::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: #fffdf6; }
/* Seats near the left/right edge open their bubble inward so it stays on screen. */
.bubble.bl { left: 0; transform: none; }
.bubble.bl::after { left: 24px; }
.bubble.br { left: auto; right: 0; transform: none; }
.bubble.br::after { left: auto; right: 12px; transform: none; }
.bubble.bl, .bubble.br { animation-name: pop2; }
@keyframes pop { from { transform: translateX(-50%) scale(.7); opacity: 0; } }
@keyframes pop2 { from { transform: scale(.7); opacity: 0; } }

.bet { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: flex-end; gap: 5px; z-index: 1; --cw: 30px; }
.bet b { font: 800 14px var(--f-display); background: rgba(0,0,0,.55); border-radius: 99px; padding: 0 8px; font-variant-numeric: tabular-nums; border: 1px solid rgba(255,255,255,.12); }

@container (max-width: 560px) {
  .table-wrap { padding: 40px 36px 46px; }
  .rail { --ar: .78; width: min(100%, calc(64vh * var(--ar)), 430px); padding: 4.2%; }
  .felt .line { inset: 13% 15%; }
  .seat { width: 86px; }
  .plate { padding: 4px 5px; gap: 4px; border-radius: 10px; }
  .avatar { width: 26px; height: 26px; font-size: 10px; }
  .avatar .sn { min-width: 14px; height: 14px; font-size: 9px; line-height: 11px; right: -4px; bottom: -3px; }
  .who-p .nm { font-size: 10px; }
  .who-p .nm em { display: none; }
  .who-p .stk { font-size: 14px; }
  .who-p .stk .tc { display: none; }
  .table-wrap { padding-top: 64px; }
  .tray { transform: translate(-50%, -128%); }
  .ribbon { font-size: 9px; padding: 0 5px; letter-spacing: .08em; bottom: -8px; }
  .seat .hand { height: 19px; }
  .seat .hand .back { --w: 13px; margin-left: -4px; }
  .card { --w: 31px; }
  .board { min-height: 44px; gap: 3px; }
  .board .slot-empty { width: 31px; height: 44px; }
  .center { width: 86%; }
  .bubble { font-size: 12px; padding: 3px 8px; }
  .bet b { font-size: 12px; }
  .bet { --cw: 21px; }
  .pot .stacks { --cw: 23px; }
  .mk { min-width: 17px; height: 17px; font-size: 9px; }
  .rack .slot { width: 10px; height: 18px; }
}

/* ------------------------------------------------------------ dealer console */
.console { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line-2); border-radius: 16px; padding: 18px 20px; display: grid; gap: 14px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.console::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, transparent, var(--brass), transparent); opacity: .7; }
.console .who { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tagp { font: 800 11px var(--f-display); letter-spacing: .12em; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; background: var(--panel-3); color: var(--muted); }
.console .say { font: 900 clamp(28px, 4.4vw, 40px)/1 var(--f-display); text-transform: uppercase; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.console .say .avatar { width: 52px; height: 52px; font-size: 15px; }
.console .prompt { font: 800 24px/1.2 var(--f-display); }
.decide { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.answer { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
.answer input { font: 900 30px var(--f-display); width: 7ch; text-align: center; background: var(--bg); border: 1px solid var(--line-2); border-radius: 12px; padding: 6px 10px; font-variant-numeric: tabular-nums; }
.keypad { display: grid; grid-template-columns: repeat(5, 46px); gap: 6px; }
.keypad button { height: 42px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel-3); font: 800 18px var(--f-display); }
.reasons { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.reason { text-align: left; border: 1px solid var(--line-2); background: var(--panel-3); border-radius: 10px; padding: 9px 12px; font-size: 14px; font-weight: 600; }
.reason.on { border-color: var(--bad); background: var(--bad-bg); color: #ffd5cf; }
.rulings { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.ruling { text-align: left; border: 1px solid var(--line-2); background: var(--panel-3); border-radius: 12px; padding: 12px 14px; display: grid; gap: 2px; }
.ruling b { font: 800 19px var(--f-display); }
.ruling span { font-size: 12px; color: var(--muted); }
.ruling:hover { border-color: var(--brass); }
.result { border-radius: 14px; padding: 12px 16px; display: grid; gap: 4px; border: 1px solid; animation: slidein .25s ease-out; }
@keyframes slidein { from { transform: translateY(-6px); opacity: 0; } }
.result.good { background: var(--good-bg); border-color: #2f7a4f; }
.result.bad { background: var(--bad-bg); border-color: #8a3a31; }
.result.warn { background: var(--warn-bg); border-color: #7a6025; }
.result b { font: 800 19px var(--f-display); display: flex; gap: 8px; align-items: center; }
.result.good b::before { content: "✓"; color: var(--good); }
.result.bad b::before { content: "✗"; color: var(--bad); }
.result.warn b::before { content: "!"; color: var(--warn); }
.result p { font-size: 14px; opacity: .92; }
.wait { color: var(--muted); display: flex; align-items: center; gap: 10px; }
.dots::after { content: "…"; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.thinking { display: inline-flex; gap: 4px; }
.thinking i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: bounce 1s infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; }
.thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 50% { transform: translateY(-5px); opacity: .5; } }
.summary { display: grid; gap: 6px; }
.summary .pt { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 10px; background: var(--panel-3); }
.summary .pt b { font: 800 18px var(--f-display); }

/* ------------------------------------------------------------ side column */
.stats { display: grid; gap: 10px; }
.bar { display: grid; gap: 4px; }
.bar .bl { display: flex; justify-content: space-between; font-size: 13px; }
.bar .bl b { font: 800 15px var(--f-display); }
.bar .bt { height: 7px; border-radius: 99px; background: var(--panel-3); overflow: hidden; }
.bar .bt i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--good), #9be7b8); }
.log { display: grid; gap: 8px; max-height: 460px; overflow: auto; padding-right: 4px; }
.entry { border-left: 3px solid var(--line-2); padding: 3px 0 3px 10px; font-size: 14px; }
.entry.good { border-color: var(--good); }
.entry.bad { border-color: var(--bad); }
.entry.warn { border-color: var(--warn); }
.entry.info { border-color: var(--info); }
.entry .meta { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; }
.entry p { margin-top: 2px; color: var(--muted); font-size: 13px; }
.entry .said { color: var(--ink); font-style: italic; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font: 800 17px var(--f-display); font-variant-numeric: tabular-nums; text-align: right; }
.facts dd.small { font: 600 13px var(--f-body); }
.amount { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.amount input { width: 8ch; font: 900 22px var(--f-display); text-align: center; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 6px; }
.trick { border-color: #74362d !important; color: #ffc2b8; }
.rules { display: grid; gap: 12px; font-size: 14px; color: var(--muted); }
.rules b { color: var(--ink); }
.rules h4 { font-size: 15px; color: var(--brass); text-transform: uppercase; letter-spacing: .1em; }
.toggle { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.toggle input { width: 18px; height: 18px; accent-color: var(--brass); }
.share { display: flex; gap: 8px; align-items: center; background: var(--bg); border: 1px dashed var(--line-2); border-radius: 10px; padding: 8px 10px; }
.share code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13px; color: var(--muted); }
.bigcode { font: 900 44px var(--f-display); letter-spacing: .25em; color: var(--brass); text-align: center; }

@media (max-width: 1020px) {
  .game { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .how { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .games, .levels, .stack-opts, .modes { grid-template-columns: minmax(0, 1fr); }
  .how { grid-template-columns: minmax(0, 1fr); }
  .builder { padding: 16px; }
  .scorebox .st span { display: none; }
  .sign { min-width: 0; }
  .keypad { grid-template-columns: repeat(5, 1fr); width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------ play screen: one column, decisions on the felt */
.play { max-width: 1180px; margin: 0 auto; padding-block: 8px 48px; display: grid; gap: 14px; }
.play .table-wrap { padding-top: 54px; }
.under { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.under .console { grid-column: 1 / -1; }
.center.has-hud { z-index: 4; gap: 6px; }
.hud {
  width: min(100%, 440px); display: grid; gap: 8px; justify-items: center; text-align: center;
  background: rgba(8, 14, 12, .86); border: 1px solid rgba(255,255,255,.14); border-radius: 16px; padding: 12px 14px;
  box-shadow: 0 12px 30px rgba(0,0,0,.55); backdrop-filter: blur(3px); animation: slidein .2s ease-out;
}
.hud .btn { width: 100%; }
.hq { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.hq .avatar { width: 30px; height: 30px; }
.hs { font: 900 26px/1 var(--f-display); text-transform: uppercase; }
.hs.small { font-size: 18px; line-height: 1.1; }
.hl { font: 800 12px var(--f-display); letter-spacing: .12em; text-transform: uppercase; color: var(--brass-hi); display: flex; align-items: center; gap: 8px; }
.hl.wait { color: var(--muted); }
.hp { font: 700 17px/1.2 var(--f-display); }
.hp.good { color: var(--good); }
.hp.bad { color: var(--bad); font: 600 13px/1.35 var(--f-body); }
.hb { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.hb .btn { padding: 12px 10px; font-size: 16px; }
.hopts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; width: 100%; }
.hopt { font-size: 14px; padding: 9px 8px; background: var(--panel-3); }
.hopt:hover { border-color: var(--brass); }
.hans { display: flex; gap: 8px; width: 100%; }
.hans input { flex: 1; min-width: 0; font: 900 24px var(--f-display); text-align: center; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 4px 8px; }
.hans .btn { width: auto; padding-inline: 18px; }
.hud .summary { width: 100%; }
.hud .summary .pt { padding: 6px 10px; font-size: 14px; }
.sheet { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 12px; background: rgba(5, 9, 8, .62); backdrop-filter: blur(2px); }
.sheet-in { width: min(100%, 620px); max-height: 100%; overflow: auto; display: grid; gap: 10px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.sheet .reasons { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
@container (max-width: 560px) {
  .center.has-hud { width: 68%; gap: 4px; }
  .center.has-hud .pot .amt.hidden { display: none; }
  .center.has-hud .board { min-height: 34px; }
  .center.has-hud .card { --w: 24px; }
  .center.has-hud .board .slot-empty { width: 24px; height: 34px; }
  .hud { padding: 8px; gap: 6px; border-radius: 12px; }
  .hs { font-size: 19px; }
  .hs.small { font-size: 14px; }
  .hp { font-size: 14px; }
  .hq { font-size: 11px; }
  .hq .avatar { width: 22px; height: 22px; }
  .hq .avatar .sn { display: none; }
  .hb { gap: 5px; }
  .hb .btn { padding: 9px 4px; font-size: 13px; white-space: nowrap; }
  .hopts { grid-template-columns: 1fr; }
  .hopt { font-size: 12px; padding: 6px; }
  .hud kbd { display: none; }
  .hans input { font-size: 19px; }
  .center.has-hud .pot .stacks { --cw: 16px; }
  .center.has-hud .street { font-size: 10px; padding: 1px 8px; }
}
