/* Self-hosted fonts (SIL OFL, see fonts/*-OFL.txt). Variable files cover every weight used. */
@font-face {
  font-family: "Fraunces"; font-style: normal; font-weight: 600 800; font-display: swap;
  src: url(../fonts/fraunces-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces"; font-style: normal; font-weight: 600 800; font-display: swap;
  src: url(../fonts/fraunces-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(../fonts/inter-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(../fonts/inter-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --felt-1: #13704a;
  --felt-2: #0c5135;
  --felt-3: #072d1e;
  --ink: #f5f1e6;
  --muted: rgba(245, 241, 230, .7);
  --gold: #f2c35b;
  --gold-2: #c8912a;
  --red: #e5484d;
  --green: #3ddc84;
  --amber: #ffb224;
  --panel: rgba(4, 24, 16, .72);
  --panel-line: rgba(255, 255, 255, .09);
  --card-red: #c8222f;
  --card-black: #1b1d24;
  --cw-max: 116px;
  --cw: min(24vw, 116px, 15.5dvh);
  --ch: calc(var(--cw) * 1.4);
  --radius: 18px;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--felt-3);
  color: var(--ink);
  font-family: var(--font-ui);
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(120% 70% at 50% 38%, var(--felt-1) 0%, var(--felt-2) 52%, var(--felt-3) 100%);
  overflow: hidden;
}

/* Felt texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
  z-index: 0;
}

button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }

/* Keyboard focus: one visible ring for every control. */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
input { font: inherit; }

.app {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 720px;
  margin: 0 auto;
  padding-top: var(--safe-t);
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 4px;
}
.topbar-title { text-align: center; line-height: 1.05; }
.brand {
  display: block;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: .01em;
  background: linear-gradient(180deg, #fff3cf, var(--gold) 55%, var(--gold-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sub { font-size: 11px; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; }
.icon-btn {
  width: 42px; height: 42px;
  border-radius: 12px;
  border: 1px solid var(--panel-line);
  background: rgba(0,0,0,.18);
  display: grid; place-items: center;
  transition: transform .15s, background .2s;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn svg path:first-child { fill: none; }
#soundBtn .snd-off { display: none; }
#soundBtn.muted .snd-on { display: none; }
#soundBtn.muted .snd-off { display: block; }

/* ---------- Players strip ---------- */
.players {
  display: flex;
  gap: 8px;
  padding: 6px 12px 8px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.players::-webkit-scrollbar { display: none; }
.pill {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  scroll-snap-align: center;
  transition: transform .3s cubic-bezier(.2,.9,.3,1.2), box-shadow .3s, opacity .3s, border-color .3s;
  position: relative;
}
.pill.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(242,195,91,.25), 0 6px 18px rgba(0,0,0,.35);
  transform: translateY(-1px) scale(1.04);
}
.pill.out { opacity: .38; filter: grayscale(1); }
.pill .pname { font-weight: 700; font-size: 13px; max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill .pchips { font-size: 12px; color: var(--gold); font-weight: 700; display: flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.pill .meta { display: flex; flex-direction: column; line-height: 1.15; }

.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  background: var(--c, #555);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.25), 0 0 0 2px rgba(255,255,255,.15);
  text-shadow: 0 1px 1px rgba(0,0,0,.4);
}
.avatar.emoji {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 18px;
  font-weight: 400;
  text-shadow: none;
  line-height: 1;
}
.avatar.pick { border: 0; padding: 0; flex: none; width: 40px; height: 40px; font-size: 23px; cursor: pointer; }
.avatar.emoji.xl { font-size: 56px; }
.avatar.xl { width: 96px; height: 96px; font-size: 42px; margin: 6px auto 10px; box-shadow: inset 0 -6px 0 rgba(0,0,0,.25), 0 0 0 4px rgba(255,255,255,.2), 0 18px 40px rgba(0,0,0,.45); }

.chip-ico {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--gold) 0 34%, transparent 35%),
    repeating-conic-gradient(var(--gold) 0 30deg, #8a5a12 30deg 60deg);
  box-shadow: 0 0 0 1px rgba(0,0,0,.3);
  flex: none;
}

/* ---------- Table ---------- */
.table {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 10px;
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  place-items: center;
  container-type: size;
}
/* Cards scale to the room the table has left after the controls. */
.table > * { --cw: min(24vw, var(--cw-h, 31cqh), var(--cw-max)); --ch: calc(var(--cw) * 1.4); }
.felt-ring {
  position: absolute;
  inset: 4px 0;
  border-radius: 46% / 32%;
  border: 2px solid rgba(242,195,91,.18);
  box-shadow: inset 0 0 60px rgba(0,0,0,.35), 0 0 0 10px rgba(0,0,0,.08);
  pointer-events: none;
}
.rule-chips {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px;
  padding: 0 12px 4px;
}
.rule-chip {
  font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(0,0,0,.28);
  border: 1px solid var(--panel-line);
  color: var(--muted);
}

.deck {
  position: absolute;
  top: 6px; right: 4px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  z-index: 2;
}
.deck-stack { position: relative; width: calc(var(--cw) * .5); height: calc(var(--ch) * .5); }
.deck-stack .card { position: absolute; inset: 0; }
.deck-stack .card:nth-child(1) { transform: translate(-3px, 3px); }
.deck-stack .card:nth-child(2) { transform: translate(-1.5px, 1.5px); }
.deck-count { font-size: 11px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }

.pot {
  grid-row: 1;
  align-self: end;
  margin-bottom: 10px;
  display: flex; flex-direction: column; align-items: center;
  position: relative;
}
.pot-stack { --ps: 1; position: relative; width: calc(220px * var(--ps)); height: calc(60px * var(--ps)); }
.pot-stack .piles {
  position: absolute; left: 50%; bottom: 0;
  width: 220px; height: 60px; margin-left: -110px;
  transform: scale(var(--ps)); transform-origin: 50% 100%;
}
/* Soft shadow under the cluster */
.pot-stack .piles::before {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: -4px; height: 22px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0,0,0,.4), transparent);
}
/* One chip seen from the side: a striped edge with the face on top. */
.schip {
  position: absolute;
  width: 34px; height: 17px;
  border-radius: 50% / 6.5px;
  background:
    linear-gradient(90deg, rgba(0,0,0,.4), transparent 28%, transparent 68%, rgba(0,0,0,.35)),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--pc) 82%, #000) 0 5px, var(--pe, #efe8d8) 5px 8px);
  box-shadow: 0 1px 0 rgba(0,0,0,.4);
}
.schip::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 13px;
  border-radius: 50%;
  background:
    linear-gradient(rgba(255,255,255,.22), transparent 70%),
    radial-gradient(closest-side, transparent 0 46%, rgba(255,255,255,.8) 48% 54%, transparent 56%),
    radial-gradient(closest-side, var(--pc) 0 67%, transparent 69%),
    repeating-conic-gradient(var(--pc) 0 24deg, var(--pe, #efe8d8) 24deg 36deg);
}
.pot-amt {
  margin-top: 4px;
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(20px, 7cqh, var(--pot-max, 30px));
  color: #fff6dc;
  text-shadow: 0 2px 0 rgba(0,0,0,.35), 0 0 22px rgba(242,195,91,.35);
  font-variant-numeric: tabular-nums;
}
.pot-amt .chip-ico { width: 20px; height: 20px; }
.pot-label { font-size: 10px; letter-spacing: .3em; color: var(--muted); font-weight: 700; }
.pot.bump .pot-amt { animation: bump .45s cubic-bezier(.3,1.6,.5,1); }
@keyframes bump { 40% { transform: scale(1.18); } }

/* Poker chips */
.pchip {
  --pc: #d23b3b;
  width: 30px; height: 30px;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--pc) 0 40%, #fff 41% 45%, var(--pc) 46% 100%);
  box-shadow: 0 2px 0 rgba(0,0,0,.35), inset 0 0 0 1px rgba(0,0,0,.25);
  position: relative;
}
.pchip::after {
  content: "";
  position: absolute; inset: 2px;
  border-radius: 50%;
  border: 3px dashed rgba(255,255,255,.85);
}

/* Slots & cards */
.slots {
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 3vw, 22px);
  z-index: 1;
}
.slot {
  position: relative;
  width: var(--cw);
  height: var(--ch);
  border-radius: calc(var(--cw) * .09);
  border: 2px dashed rgba(255,255,255,.16);
  display: grid; place-items: center;
  perspective: 900px;
  transition: box-shadow .35s, border-color .35s;
}
.slot.mid { border-color: rgba(242,195,91,.35); transform: translateY(-4px); }
.slot-hint { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: rgba(255,255,255,.28); font-weight: 700; }
.slot.mid .slot-hint { font-family: var(--font-display); font-size: calc(var(--cw) * .45); letter-spacing: 0; color: rgba(242,195,91,.3); }
.slot.glow-win { box-shadow: 0 0 0 3px var(--green), 0 0 36px rgba(61,220,132,.65); border-color: transparent; }
.slot.glow-lose { box-shadow: 0 0 0 3px var(--red), 0 0 36px rgba(229,72,77,.55); border-color: transparent; }
.slot.glow-post { box-shadow: 0 0 0 3px var(--amber), 0 0 36px rgba(255,178,36,.7); border-color: transparent; }

.card {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  will-change: transform;
}
.card.mini { width: 100%; height: 100%; }
.card-inner {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.3,.7,.2,1.15);
}
.card.up .card-inner { transform: rotateY(180deg); }
.card-face {
  position: absolute; inset: 0;
  border-radius: calc(var(--cw) * .09);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.4);
}
.card.mini .card-face { border-radius: 6px; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.card-face.back {
  background:
    radial-gradient(circle at 50% 50%, rgba(242,195,91,.9) 0 7%, transparent 7.5%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.08) 0 4px, transparent 4px 10px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.08) 0 4px, transparent 4px 10px),
    linear-gradient(160deg, #a3242d, #6e1219);
  border: 4px solid #fbf7ee;
  outline: 1px solid rgba(0,0,0,.2);
}
.card-face.back::after {
  content: "";
  position: absolute; inset: 5%;
  border-radius: 6px;
  border: 1.5px solid rgba(242,195,91,.55);
}
.card-face.front {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, #fffdf7, #f1ebdc);
  color: var(--card-black);
}
.card-face.front.red { color: var(--card-red); }
.card-face svg { fill: currentColor; display: block; }

.corner {
  position: absolute;
  display: flex; flex-direction: column; align-items: center;
  line-height: .9;
  font-weight: 800;
  font-family: var(--font-ui);
}
.corner.tl { top: 5%; left: 6%; }
.corner.br { bottom: 5%; right: 6%; transform: rotate(180deg); }
.corner .r { font-size: calc(var(--cw) * .19); letter-spacing: -.05em; }
.corner.ten .r { font-size: calc(var(--cw) * .16); letter-spacing: -.12em; margin-left: -.12em; }
.corner svg { width: calc(var(--cw) * .13); height: calc(var(--cw) * .13); margin-top: 2px; }

.pips { position: absolute; inset: 0; }
.pip { position: absolute; width: calc(var(--cw) * .18); height: calc(var(--cw) * .18); transform: translate(-50%, -50%); }
.pip.small { width: calc(var(--cw) * .155); height: calc(var(--cw) * .155); }
.pip.flip { transform: translate(-50%, -50%) rotate(180deg); }
.pip.ace { width: calc(var(--cw) * .48); height: calc(var(--cw) * .48); filter: drop-shadow(0 2px 2px rgba(0,0,0,.15)); }

.face-art {
  position: absolute;
  inset: 16% 22%;
  border-radius: 6px;
  border: 1.5px solid currentColor;
  background:
    radial-gradient(circle at 50% 40%, rgba(242,195,91,.35), transparent 65%),
    repeating-linear-gradient(45deg, rgba(0,0,0,.035) 0 3px, transparent 3px 6px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2%;
}
.face-art::before {
  content: ""; position: absolute; inset: 3px; border-radius: 4px; border: 1px solid currentColor; opacity: .35;
}
.face-art .crown { width: 46%; height: auto; color: var(--gold-2); fill: var(--gold-2); filter: drop-shadow(0 1px 0 rgba(0,0,0,.2)); }
.face-art .big { font-family: var(--font-ui); font-weight: 800; font-size: calc(var(--cw) * .34); line-height: 1; letter-spacing: -.02em; }
.face-art .fsuit { width: 28%; height: auto; }

.ace-tag {
  position: absolute;
  left: 50%; bottom: -12px;
  transform: translateX(-50%);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: .12em;
  background: var(--gold);
  color: #3a2600;
  box-shadow: 0 4px 10px rgba(0,0,0,.4);
  z-index: 3;
  animation: pop .4s cubic-bezier(.3,1.6,.5,1);
}
@keyframes pop { from { transform: translateX(-50%) scale(0); } }

.betspot {
  grid-row: 3;
  align-self: start;
  margin-top: 14px;
  display: flex; flex-direction: column; align-items: center;
  animation: pop2 .35s cubic-bezier(.3,1.6,.5,1);
}
@keyframes pop2 { from { transform: scale(.4); opacity: 0; } }
.bet-chip {
  min-width: 54px; height: 54px; padding: 0 8px;
  border-radius: 999px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 17px;
  color: #3a2600;
  background:
    radial-gradient(circle, #ffe7a6 0 52%, transparent 53%),
    repeating-conic-gradient(var(--gold) 0 22.5deg, #fff4d6 22.5deg 45deg);
  box-shadow: 0 4px 0 #8a5a12, 0 10px 20px rgba(0,0,0,.4);
  font-variant-numeric: tabular-nums;
}
.bet-label { margin-top: 6px; font-size: 10px; letter-spacing: .3em; color: var(--muted); font-weight: 700; }

.banner {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  pointer-events: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(40px, 13vw, 76px);
  letter-spacing: .02em;
  white-space: nowrap;
  text-shadow: 0 4px 0 rgba(0,0,0,.35), 0 0 40px currentColor;
  animation: stamp .7s cubic-bezier(.2,1.5,.4,1) both;
}
.banner.win { color: var(--green); }
.banner.lose { color: #ff7a7e; }
.banner.post { color: var(--amber); }
.banner.info { color: #fff6dc; font-size: clamp(28px, 8vw, 46px); }
.banner.out { animation: unstamp .35s ease-in forwards; }
@keyframes stamp {
  from { transform: translate(-50%, -50%) scale(2.6) rotate(-8deg); opacity: 0; }
  60% { opacity: 1; }
  to { transform: translate(-50%, -50%) scale(1) rotate(-4deg); opacity: 1; }
}
@keyframes unstamp { to { transform: translate(-50%, -50%) scale(.6) rotate(-4deg); opacity: 0; } }

.shake { animation: shake .55s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-8px, 0, 0) rotate(-.5deg); }
  40%, 60% { transform: translate3d(8px, 0, 0) rotate(.5deg); }
}
.flash::after {
  content: ""; position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(circle, rgba(255,178,36,.0), rgba(229,72,77,.45));
  animation: flash .6s ease-out forwards;
  z-index: 50;
}
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

/* ---------- Controls ---------- */
.controls {
  padding: 10px 14px calc(12px + var(--safe-b));
  background: linear-gradient(180deg, rgba(3,20,13,0), rgba(3,20,13,.75) 22%);
  min-height: 150px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 10px;
}
.controls .msg {
  text-align: center;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.4;
}
.controls .msg b { color: var(--ink); }
.controls .msg.big { font-size: 18px; color: var(--ink); font-weight: 700; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.odds {
  display: flex; flex-direction: column; gap: 6px;
}
.odds-bar {
  display: flex; height: 8px; border-radius: 999px; overflow: hidden;
  background: rgba(255,255,255,.08);
}
.odds-bar span { display: block; height: 100%; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.odds-bar .w { background: var(--green); }
.odds-bar .p { background: var(--amber); }
.odds-bar .l { background: var(--red); }
.odds-legend { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.odds-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }

.bet-row { display: flex; align-items: center; gap: 10px; }
.bet-val {
  flex: 1;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 34px;
  line-height: 1;
  color: #fff6dc;
  font-variant-numeric: tabular-nums;
}
.bet-val small { display: block; font-family: var(--font-ui); font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--muted); margin-top: 4px; }
.round-btn {
  width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--panel-line);
  background: rgba(255,255,255,.07);
  font-size: 26px; font-weight: 600; line-height: 1;
  display: grid; place-items: center;
  transition: transform .12s, background .2s;
}
.round-btn:active { transform: scale(.9); background: rgba(255,255,255,.14); }
.round-btn:disabled { opacity: .3; }

input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 30px; background: transparent; margin: 0;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 8px; border-radius: 999px;
  background: linear-gradient(90deg, var(--gold) var(--fill, 0%), rgba(255,255,255,.12) var(--fill, 0%));
}
input[type=range]::-moz-range-track { height: 8px; border-radius: 999px; background: rgba(255,255,255,.12); }
input[type=range]::-moz-range-progress { height: 8px; border-radius: 999px; background: var(--gold); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 28px; height: 28px; border-radius: 50%; margin-top: -10px;
  background: radial-gradient(circle, #fff6dc 0 35%, var(--gold) 36%);
  box-shadow: 0 3px 8px rgba(0,0,0,.45), 0 0 0 3px rgba(242,195,91,.25);
}
input[type=range]::-moz-range-thumb {
  width: 28px; height: 28px; border-radius: 50%; border: 0;
  background: radial-gradient(circle, #fff6dc 0 35%, var(--gold) 36%);
  box-shadow: 0 3px 8px rgba(0,0,0,.45);
}

.quick { display: flex; gap: 8px; }
.quick button {
  flex: 1;
  padding: 8px 0;
  border-radius: 10px;
  border: 1px solid var(--panel-line);
  background: rgba(255,255,255,.06);
  font-size: 13px; font-weight: 700;
  transition: transform .12s, background .2s;
}
.quick button:active { transform: scale(.95); }
.quick button.on { background: rgba(242,195,91,.18); border-color: rgba(242,195,91,.5); color: var(--gold); }

.choice { display: flex; gap: 10px; }
.choice button {
  flex: 1;
  padding: 12px 8px;
  border-radius: 14px;
  border: 1.5px solid var(--panel-line);
  background: rgba(255,255,255,.06);
  font-weight: 800; font-size: 15px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: transform .12s, background .2s, border-color .2s;
}
.choice button small { font-weight: 600; font-size: 11px; color: var(--muted); }
.choice button.on { border-color: var(--gold); background: rgba(242,195,91,.16); color: #fff6dc; }
.choice button:disabled { opacity: .3; }

.ev { text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; }
.ev b.pos { color: var(--green); }
.ev b.neg { color: #ff8a8d; }

/* Buttons */
.btn {
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: .01em;
  transition: transform .12s, filter .2s, background .2s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn.primary {
  color: #2f1d00;
  background: linear-gradient(180deg, #ffe08e, var(--gold) 45%, var(--gold-2));
  box-shadow: 0 4px 0 #7b4f0e, 0 10px 24px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.6);
}
.btn.primary:active { box-shadow: 0 1px 0 #7b4f0e, 0 4px 10px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.6); transform: translateY(3px); }
.btn.secondary {
  background: rgba(255,255,255,.08);
  border: 1px solid var(--panel-line);
  color: var(--ink);
}
.btn.danger { background: rgba(229,72,77,.15); border: 1px solid rgba(229,72,77,.4); color: #ffb3b5; }
.btn.ghost { background: transparent; border: 1.5px dashed rgba(255,255,255,.2); color: var(--muted); width: 100%; }
.btn.link { background: none; color: var(--muted); font-weight: 600; padding: 10px; text-decoration: underline; text-underline-offset: 3px; }
.btn.big { width: 100%; padding: 17px 16px; font-size: 18px; }

/* ---------- Overlays ---------- */
.overlay {
  position: fixed; inset: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.overlay.setup {
  background:
    radial-gradient(120% 60% at 50% 0%, #13704a, #072d1e 70%);
  animation: fadeIn .35s ease;
}
.setup-inner {
  width: 100%; max-width: 480px;
  padding: calc(20px + var(--safe-t)) 16px calc(28px + var(--safe-b));
  display: flex; flex-direction: column; gap: 14px;
}
.logo { text-align: center; padding: 6px 0 4px; }
.logo h1 {
  margin: 10px 0 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 46px;
  line-height: 1;
  background: linear-gradient(180deg, #fff3cf, var(--gold) 55%, var(--gold-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,.3));
}
.logo .tag { margin: 6px 0 0; color: var(--muted); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
.logo-cards { position: relative; height: 104px; width: 180px; margin: 0 auto; }
.lc {
  position: absolute; bottom: 0; left: 50%;
  width: 62px; height: 88px; margin-left: -31px;
  border-radius: 8px;
  background: linear-gradient(160deg, #fffdf7, #efe7d4);
  box-shadow: 0 8px 18px rgba(0,0,0,.4);
  transform-origin: 50% 120%;
}
.lc1 { transform: rotate(-22deg) translateX(-14px); color: var(--card-black); animation: fanL 1s cubic-bezier(.2,1.3,.4,1) both; }
.lc2 { transform: rotate(22deg) translateX(14px); color: var(--card-red); animation: fanR 1s cubic-bezier(.2,1.3,.4,1) both; }
.lc3 {
  z-index: 2; color: var(--card-red);
  background: linear-gradient(160deg, #a3242d, #6e1219);
  border: 3px solid #fbf7ee;
  background:
    radial-gradient(circle, #f2c35b 0 9%, transparent 10%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.1) 0 3px, transparent 3px 8px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.1) 0 3px, transparent 3px 8px),
    linear-gradient(160deg, #a3242d, #6e1219);
  animation: rise 1.1s .25s cubic-bezier(.2,1.4,.4,1) both;
}
@keyframes fanL { from { transform: rotate(0) translateX(0); } }
@keyframes fanR { from { transform: rotate(0) translateX(0); } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  padding: 14px;
  backdrop-filter: blur(8px);
}
.panel h2 { margin: 0 0 10px; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; }
.muted { color: var(--muted); font-size: 13px; }

.player-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.player-list li { display: flex; align-items: center; gap: 10px; animation: slideIn .3s ease both; }
@keyframes slideIn { from { transform: translateY(-6px); opacity: 0; } }
.player-list input {
  flex: 1; min-width: 0;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--panel-line);
  background: rgba(255,255,255,.06);
  color: var(--ink);
  font: inherit;
  font-size: 16px; /* 16px or iOS zooms in on focus */
  font-weight: 600;
  outline: none;
  -webkit-user-select: text; user-select: text;
  transition: border-color .2s, background .2s;
}
.player-list input:focus { border-color: var(--gold); background: rgba(255,255,255,.1); }
.player-list input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.player-list .rm {
  width: 36px; height: 36px; border-radius: 10px; border: 0;
  background: rgba(255,255,255,.06); color: var(--muted); font-size: 20px;
}
.player-list .rm:disabled { opacity: .25; }

.field { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; }
.field-label { font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 4px; background: rgba(255,255,255,.06); border-radius: 12px; padding: 4px; border: 1px solid var(--panel-line); }
.stepper button { width: 36px; height: 36px; border: 0; border-radius: 9px; background: rgba(255,255,255,.08); font-size: 20px; }
.stepper button:active { background: rgba(255,255,255,.18); }
.stepper output { min-width: 60px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }

.toggle { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.toggle + .toggle { border-top: 1px solid var(--panel-line); padding-top: 12px; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  flex: none;
  width: 48px; height: 28px; border-radius: 999px;
  background: rgba(255,255,255,.14);
  position: relative;
  transition: background .25s;
  margin-top: 2px;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,.35);
  transition: transform .25s cubic-bezier(.3,1.4,.5,1);
}
.toggle input:checked + .switch { background: var(--gold-2); }
.toggle input:checked + .switch::after { transform: translateX(20px); }
.toggle input:focus-visible + .switch { outline: 2px solid var(--gold); outline-offset: 2px; }
.t-text { display: flex; flex-direction: column; gap: 3px; }
.t-text small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }

/* Handoff */
.overlay.handoff {
  align-items: center;
  background: radial-gradient(circle at 50% 40%, rgba(12,81,53,.96), rgba(3,18,12,.985));
  backdrop-filter: blur(10px);
  animation: fadeIn .3s ease;
}
.ho-menu {
  position: fixed;
  top: calc(8px + var(--safe-t));
  left: max(12px, calc(50% - 490px + 12px));
  z-index: 1;
}
.handoff-inner { text-align: center; padding: 24px; width: 100%; max-width: 380px; }
.handoff-inner .avatar { animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.handoff-inner h2 { font-family: var(--font-display); font-size: 40px; margin: 0; line-height: 1.1; word-break: break-word; }
.ho-chips { display: flex; justify-content: center; align-items: center; gap: 6px; font-weight: 800; font-size: 20px; color: var(--gold); margin: 8px 0 4px; }
.ho-chips .chip-ico { width: 16px; height: 16px; }
.handoff-inner .btn { margin-top: 22px; }
.ho-last {
  display: inline-block;
  margin: 0 0 28px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 15px;
  color: var(--muted);
  background: rgba(0,0,0,.25);
  border: 1px solid var(--panel-line);
  animation: pop2 .4s cubic-bezier(.3,1.6,.5,1);
}
.ho-last b { color: var(--ink); }
.ho-last.win { border-color: rgba(61,220,132,.45); }
.ho-last.win b:last-child { color: var(--green); }
.ho-last.post { border-color: rgba(255,178,36,.5); }
.ho-last.post b:last-child { color: var(--amber); }
.ho-last.lose { border-color: rgba(229,72,77,.45); }
.ho-last.lose b:last-child { color: #ff8a8d; }
.overlay.leaving { animation: fadeOut .25s ease forwards; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }

/* Modal sheet */
.overlay.modal {
  align-items: flex-end;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  animation: fadeIn .2s ease;
}
.sheet {
  width: 100%; max-width: 520px;
  max-height: 92dvh;
  overflow-y: auto;
  background: linear-gradient(180deg, #0f3a28, #08261a);
  border: 1px solid var(--panel-line);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  padding: 10px 18px calc(22px + var(--safe-b));
  box-shadow: 0 -20px 50px rgba(0,0,0,.5);
  animation: sheetUp .38s cubic-bezier(.2,1,.3,1);
}
.sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.2); margin: 0 auto 14px; }
@keyframes sheetUp { from { transform: translateY(100%); } }
.sheet h2 { margin: 0 0 6px; font-family: var(--font-display); font-size: 26px; text-align: center; }
.sheet p { color: var(--muted); line-height: 1.5; font-size: 14.5px; }
.sheet .stack { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.sheet .center { text-align: center; }
.sheet .rules h3 { margin: 18px 0 4px; color: var(--gold); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
.sheet .rules p, .sheet .rules li { color: rgba(245,241,230,.82); font-size: 14.5px; line-height: 1.5; }
.sheet .rules ul { padding-left: 18px; margin: 6px 0; }

.ace-pick { display: flex; gap: 12px; margin-top: 16px; }
.ace-pick button {
  flex: 1; padding: 18px 10px; border-radius: 18px;
  border: 1.5px solid var(--panel-line);
  background: rgba(255,255,255,.06);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: transform .12s, border-color .2s, background .2s;
}
.ace-pick button:active { transform: scale(.96); border-color: var(--gold); background: rgba(242,195,91,.14); }
.ace-pick .v { font-family: var(--font-display); font-weight: 800; font-size: 34px; color: #fff6dc; }
.ace-pick .k { font-weight: 800; letter-spacing: .14em; font-size: 13px; color: var(--gold); }
.ace-pick small { color: var(--muted); font-size: 12px; }

.standings { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 8px; }
.standings li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--panel-line);
  animation: slideIn .4s ease both;
}
.standings li.first { border-color: var(--gold); background: rgba(242,195,91,.12); }
.standings .rank { width: 22px; font-weight: 800; color: var(--muted); text-align: center; }
.standings .nm { flex: 1; font-weight: 700; }
.standings .ch { font-weight: 800; color: var(--gold); display: flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.trophy { font-size: 64px; text-align: center; line-height: 1; margin-top: 4px; animation: pop2 .6s cubic-bezier(.3,1.6,.5,1); }
.trophy svg { width: 92px; height: 92px; }

.btn-ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.install-steps { list-style: none; padding: 0; margin: 16px 0 6px; display: flex; flex-direction: column; gap: 10px; }
.install-steps li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 14px;
  background: rgba(255,255,255,.05); border: 1px solid var(--panel-line);
  font-size: 15.5px; line-height: 1.4;
}
.step-n {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--gold); color: #3a2600; font-weight: 800; font-size: 14px;
}
.ios-ico { width: 22px; height: 22px; vertical-align: -5px; fill: none; stroke: #4da3ff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sheet p.small { font-size: 13px; }

/* FX layer */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.fx .pchip { position: fixed; width: 24px; height: 24px; margin: -12px 0 0 -12px; }
.fx .confetti { position: fixed; width: 8px; height: 14px; border-radius: 2px; }
.fx .float {
  position: fixed;
  transform: translate(-50%, -50%);
  font-weight: 800; font-size: 20px;
  text-shadow: 0 2px 0 rgba(0,0,0,.4);
  white-space: nowrap;
}

.toast {
  position: fixed;
  left: 50%; top: calc(70px + var(--safe-t));
  transform: translateX(-50%);
  z-index: 45;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(3,18,12,.92);
  border: 1px solid rgba(242,195,91,.4);
  font-weight: 700; font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  white-space: nowrap;
  animation: toastIn .35s cubic-bezier(.2,1.3,.4,1);
}
@keyframes toastIn { from { transform: translate(-50%, -20px); opacity: 0; } }

/* Tablets and computers: a wider table and bigger cards. */
@media (min-width: 700px) and (min-height: 600px) {
  :root { --cw-max: 200px; --pot-max: 46px; }
  .table > * { --cw-h: 36cqh; }
  .app { max-width: 980px; }
  .controls { width: 100%; max-width: 640px; margin: 0 auto; }
  .pill .pname { max-width: 140px; }
  .pot-stack { --ps: 1.4; }
}

/* Short tables (phones while betting): smaller pot stacks so the cards keep their room. */
@container (max-height: 420px) { .pot-stack { --ps: .75; } }
@container (max-height: 300px) { .pot-stack { --ps: .58; } }

@media (min-height: 760px) {
  .controls { min-height: 180px; }
}
@media (max-height: 620px) {
  .controls { min-height: 130px; gap: 8px; }
  .bet-val { font-size: 28px; }
}

.noscript {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-content: center;
  padding: 24px; text-align: center;
  background: var(--felt-3); color: var(--ink);
}

/* Windows High Contrast and similar: keep switches, cards and the slider visible. */
@media (forced-colors: active) {
  .switch { forced-color-adjust: none; background: Canvas; border: 2px solid CanvasText; }
  .switch::after { background: CanvasText; box-shadow: none; top: 1px; left: 1px; }
  .toggle input:checked + .switch { background: Highlight; border-color: Highlight; }
  .toggle input:checked + .switch::after { background: HighlightText; }
  .card-face, .slot { border: 2px solid CanvasText; }
  input[type=range],
  input[type=range]::-webkit-slider-thumb,
  input[type=range]::-webkit-slider-runnable-track { -webkit-appearance: auto; appearance: auto; }
}

.fine { margin: 0; text-align: center; font-size: 13px; }
.fine a { color: var(--muted); text-underline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
