@font-face {
  font-family: "Fredoka";
  src: url("fonts/fredoka-sub.woff") format("woff");
  font-weight: 300 700;
  font-display: swap;
}

:root, [data-swatch="classic"] {
  --night: #241a44;
  --night-2: #33265e;
  --night-3: #45357a;
  --ink: #fff8ec;
  --ink-2: #d9cff5;
  --dim: #a99cd0;
  --accent: #ffd166;
  --pink: #ff8fc7;
  --bad: #ff7a90;
  --sq-light: #ecdcbf;   /* parchment */
  --sq-dark: #8466ad;    /* heather */
  --sel: #ffd166;
  --last: rgba(255, 209, 102, .42);
  --radius: 14px;
  /* theme tokens (see Themes at the end): these are "classic" */
  --deep: #1b1436; --panel: #251b47; --raised: #3e2f72; --shade: #160f2e; --big-bot: #2b2052; --resume-top: #4a3a7e;
  --on-accent: #2c2050; --accent-shadow: #b0862e; --bar-bg: rgba(27, 20, 54, .7); --banner-bg: rgba(36, 26, 68, .94);
  --frame: #5a4592; --mvnum: #6f62a0; --sheen: rgba(255, 255, 255, .10); --sel-sq: rgba(255, 209, 102, .55);
  --coord-l: #8466ad; --coord-d: var(--sq-light);
  --dot-l: rgba(44, 32, 80, .38); --ring-l: rgba(44, 32, 80, .45); --dot-d: rgba(255, 244, 220, .45); --ring-d: rgba(255, 244, 220, .55);
  --w-fill: #fff4dc; --w-line: #2c2050; --w-mark: #e7a23a; --b-fill: #2b1d4d; --b-line: #d4c4fa; --b-mark: #ffd166;
  --sig-w: #fff4dc; --sig-b: #8f7bd0;
  --sky:
    radial-gradient(2px 2px at 12% 18%, #fff8 50%, transparent 51%),
    radial-gradient(2px 2px at 82% 9%, #fff9 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 66% 30%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 30% 6%, #fff5 50%, transparent 51%),
    radial-gradient(2px 2px at 92% 74%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 6% 88%, #fff5 50%, transparent 51%),
    radial-gradient(60% 40% at 50% 0%, #4b3a8a 0%, transparent 70%),
    radial-gradient(50% 35% at 100% 100%, #3b2a6a 0%, transparent 70%),
    linear-gradient(#2a1f50, #1d1538);
  --cw: clamp(38px, 12.4vw, 66px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--night);
  color: var(--ink);
  font-family: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  font-size: 17px;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  overflow-x: hidden;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; touch-action: manipulation; cursor: pointer; }
input { font: inherit; -webkit-user-select: text; user-select: text; }
[hidden] { display: none !important; }

/* a still night sky */
.sky {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--sky);
}

.app {
  max-width: 680px; margin: 0 auto; min-height: 100dvh;
  padding: max(8px, env(safe-area-inset-top)) 8px max(10px, env(safe-area-inset-bottom));
}
.screen { display: flex; flex-direction: column; min-height: calc(100dvh - 20px); }

/* ---------- Home ---------- */
#home { gap: 12px; padding: 8px 8px 0; }
.brand { text-align: center; margin-top: 4vh; }
.brand .logo { width: 84px; height: 84px; fill: var(--w-fill); stroke: var(--w-line); stroke-width: 2; stroke-linejoin: round; color: var(--accent);
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.45)); }
.brand h1 { margin: 2px 0 0; font-size: 40px; font-weight: 700; letter-spacing: .02em; color: var(--ink);
  text-shadow: 0 3px 0 var(--shade); }
.brand .tag { margin: 0; color: var(--dim); }

.big {
  display: block; width: 100%; text-align: left; border: 2px solid var(--night-3); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--night-2), var(--big-bot)); padding: 15px 18px; min-height: 64px;
  box-shadow: 0 4px 0 var(--shade);
}
.big b { display: block; font-size: 20px; font-weight: 600; }
.big small { display: block; color: var(--dim); font-size: 15px; margin-top: 2px; }
.big:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--shade); }
.big.resume { border-color: var(--accent); background: linear-gradient(180deg, var(--resume-top), var(--night-2)); }
.big.resume b { color: var(--accent); }
.modes { display: grid; gap: 12px; }
.home-foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: 10px; align-items: end; padding: 14px 0 6px; }
.sheet .namefield { margin-top: 8px; }
.namefield { flex: 1 1 100%; display: grid; gap: 4px; color: var(--dim); font-size: 14px; }
.namefield input { background: var(--deep); border: 2px solid var(--night-3); border-radius: 12px; color: var(--ink); padding: 11px 12px; font-size: 17px; }
.namefield input:focus { outline: none; border-color: var(--accent); }
.chip-btn { flex: 1; border: 2px solid var(--night-3); background: var(--deep); border-radius: 99px; padding: 10px 14px; min-height: 46px; }
.chip-btn[aria-pressed="false"] { color: var(--dim); }

/* ---------- Sheets (bottom drawers) ---------- */
.sheet-bg { position: fixed; inset: 0; background: var(--scrim, rgba(10, 6, 24, .6)); z-index: 20; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-width: 680px; margin: 0 auto;
  background: var(--night-2); border-radius: 22px 22px 0 0; border-top: 2px solid var(--night-3);
  padding: 18px 16px max(18px, env(safe-area-inset-bottom)); max-height: 92dvh; overflow-y: auto;
  animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet h2 { margin: 0 0 6px; font-size: 22px; font-weight: 600; }
.label { color: var(--dim); font-size: 14px; margin: 14px 0 6px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg.two { grid-template-columns: 1fr 1fr; }
.seg.four { grid-template-columns: repeat(4, 1fr); }
.seg button {
  background: var(--panel); border: 2px solid var(--night-3); border-radius: 12px; padding: 10px 6px; min-height: 52px; text-align: center;
}
.seg button b { display: block; font-weight: 600; }
.seg button small { display: block; color: var(--dim); font-size: 13px; line-height: 1.2; }
.seg button[aria-pressed="true"] { border-color: var(--accent); background: var(--raised); }
.go {
  display: block; width: 100%; margin-top: 18px; min-height: 56px; border: 0; border-radius: 14px;
  background: var(--accent); color: var(--on-accent); font-size: 20px; font-weight: 600; box-shadow: 0 4px 0 var(--accent-shadow);
}
.go:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--accent-shadow); }
.go.small { width: auto; margin: 0; padding: 0 22px; font-size: 18px; }
.go.ghost { background: var(--night-3); color: var(--ink); box-shadow: 0 4px 0 var(--shade); }
.joinrow { display: flex; gap: 8px; }
.joinrow input {
  flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .3em; text-align: center; font-size: 24px; font-weight: 600;
  background: var(--deep); border: 2px solid var(--night-3); border-radius: 14px; color: var(--ink); padding: 8px;
}
.joinrow input:focus { outline: none; border-color: var(--accent); }
.or { text-align: center; color: var(--dim); font-size: 14px; margin: 16px 0 0; }
.err { color: var(--bad); min-height: 1.2em; margin: 10px 0 0; text-align: center; }
.howto { color: var(--ink-2); line-height: 1.45; margin: 8px 0; }

.playmoney { text-align: center; color: var(--dim); font-size: 14px; margin: 2px 0 0; }

/* ---------- Setup ---------- */
.money-card { margin-top: 12px; padding: 4px 12px 12px; border-radius: 16px; background: var(--panel); border: 2px solid var(--night-3); }
.money-card .label { display: flex; align-items: center; justify-content: space-between; }
.money-row { display: grid; grid-template-columns: 1fr 76px; gap: 8px; }
.text { background: var(--deep); border: 2px solid var(--night-3); border-radius: 12px; color: var(--ink); padding: 10px 12px; font-size: 17px; min-width: 0; }
.text:focus { outline: none; border-color: var(--accent); }
.text.sym { text-align: center; font-size: 22px; padding: 6px; }
.picks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.picks button { min-width: 42px; height: 42px; border-radius: 12px; border: 2px solid var(--night-3); background: var(--deep); font-size: 21px; padding: 0 6px; }
.picks button[aria-pressed="true"] { border-color: var(--accent); background: var(--raised); }
.picks.colors button { width: 38px; min-width: 38px; height: 38px; border-radius: 50%; padding: 0; background: var(--c); }
.picks.colors button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--deep), 0 0 0 5px var(--accent); }
.preview { margin-top: 10px; display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 15px; flex-wrap: wrap; }
.mini { border: 2px solid var(--night-3); background: var(--deep); border-radius: 99px; padding: 4px 12px; font-size: 14px; min-height: 34px; }
.mini.wide { width: 100%; margin-top: 8px; min-height: 42px; }
.seg.seven { grid-template-columns: repeat(7, 1fr); gap: 5px; }
.seg.seven button { padding: 8px 0; min-height: 46px; }
.names { display: grid; gap: 6px; }
.names .nrow { display: flex; gap: 6px; }
.names .nrow input { flex: 1; }
.names .nrow button { width: 46px; border-radius: 12px; border: 2px solid var(--night-3); background: var(--deep); }
.stakes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stakes label { display: grid; gap: 4px; color: var(--dim); font-size: 13px; }
.stakes input { background: var(--deep); border: 2px solid var(--night-3); border-radius: 12px; color: var(--ink); padding: 9px 8px; font-size: 17px; width: 100%; min-width: 0; }
#sheet-leader .go.ghost { margin-top: 10px; min-height: 48px; font-size: 17px; }
#sheet-leader h2 { display: flex; align-items: center; gap: 8px; }
.crown { width: 24px; height: 24px; color: var(--accent); }
.howto.small { font-size: 15px; margin-top: 0; }
.lplayers { display: grid; gap: 8px; }
.lp { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; background: var(--panel); border: 2px solid var(--night-3); border-radius: 14px; padding: 8px 10px; }
.lp .who { min-width: 0; }
.lp .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp .who small { color: var(--dim); }
.lp .btns { display: flex; gap: 5px; }
.lp .btns button { border: 2px solid var(--night-3); background: var(--deep); border-radius: 10px; padding: 6px 9px; font-size: 14px; min-height: 38px; }
.lp .btns button.kick { color: var(--bad); }
.lp .topup { grid-column: 1 / -1; display: flex; gap: 6px; }
.lp .topup input { flex: 1; min-width: 0; }
.lp .topup button { border-radius: 10px; border: 0; background: var(--accent); color: var(--on-accent); padding: 0 14px; font-weight: 600; min-height: 42px; }

/* ---------- Money ---------- */
.amt { white-space: nowrap; font-variant-numeric: tabular-nums; }
.amt .sym { font-style: normal; margin-right: .12em; }
.chip { width: 1.05em; height: 1.05em; vertical-align: -.16em; fill: var(--chip, #ffd166); flex: none; }

/* ---------- Game ---------- */
#game { gap: 6px; }
.topbar { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 46px; height: 46px; border-radius: 12px; border: 2px solid var(--night-3); background: var(--deep); display: grid; place-items: center; padding: 0; flex: none; font-size: 24px; }
.icon-btn svg { width: 24px; height: 24px; }
#leader-btn svg { color: var(--accent); }
.mode-label { flex: 1; min-width: 0; text-align: center; color: var(--ink-2); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: none; border: 0; padding: 4px; min-height: 46px; }
.mode-label b { color: var(--ink); font-weight: 600; }

.table { position: relative; flex: 1 1 auto; min-height: 330px; margin: 30px 10px 34px; }
.felt { position: absolute; inset: 0; border-radius: 120px / 100px;
  background: radial-gradient(70% 55% at 50% 42%, var(--felt-hi), var(--felt) 60%, var(--felt-lo));
  box-shadow: 0 0 0 7px var(--rail), 0 0 0 9px var(--rail-edge), 0 18px 36px rgba(0,0,0,.45), inset 0 0 40px rgba(0,0,0,.35); }
.felt::after { content: ""; position: absolute; inset: 10px; border-radius: 110px / 90px; border: 1.5px dashed var(--stitch); pointer-events: none; }
.center { position: absolute; left: 6%; right: 6%; top: 50%; transform: translateY(-58%); display: grid; justify-items: center; gap: 8px; z-index: 2; }
.board { display: flex; gap: 4px; min-height: calc(var(--cw) * 1.4); }
.table.many .center { --cw: clamp(34px, 10.4vw, 52px); left: 18%; right: 18%; }
.board .slot { width: var(--cw); height: calc(var(--cw) * 1.4); border-radius: calc(var(--cw) * .12); border: 1.5px dashed var(--stitch); opacity: .7; }
.pot { display: flex; align-items: center; gap: 6px; background: var(--pot-bg); padding: 3px 12px; border-radius: 99px; font-weight: 600; min-height: 28px; font-size: 16px; }
.pot:empty { visibility: hidden; }
.pot small { font-weight: 400; color: var(--ink-2); }
.result { text-align: center; background: var(--banner-bg); border: 2px solid var(--accent); border-radius: 14px; padding: 6px 10px; font-size: 15px; max-width: 100%; }
.result b { color: var(--accent); font-weight: 600; }
.lobby { text-align: center; display: grid; gap: 8px; justify-items: center; max-width: 92%; }
.lobby p { margin: 0; color: var(--ink-2); }
.lobby .go { margin: 0; min-height: 50px; font-size: 18px; padding: 0 20px; width: auto; }
.lobby .roomcode { font-size: 34px; margin: 0; }

/* Cards: parchment faces, rank and suit drawn big enough to read across a table */
.card { position: relative; display: inline-block; width: var(--cw); height: calc(var(--cw) * 1.4); border-radius: calc(var(--cw) * .12); flex: none; }
.card.face { background: linear-gradient(160deg, var(--card-face), var(--card-face-2)); color: var(--card-ink); box-shadow: 0 2px 4px rgba(0,0,0,.35), inset 0 0 0 1px rgba(0,0,0,.12); }
.card.face.red { color: var(--card-red); }
.card.face b { position: absolute; left: 9%; top: 3%; font-size: calc(var(--cw) * .46); font-weight: 700; line-height: 1; letter-spacing: -.04em; }
.card.face svg { position: absolute; fill: currentColor; }
.card.face svg.s1 { left: 9%; top: 37%; width: 30%; height: 22%; }
.card.face svg.s2 { right: 7%; bottom: 6%; width: 52%; height: 38%; }
.card.back svg { width: 100%; height: 100%; display: block; fill: var(--back); color: var(--back-ink); filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); }
.card.dim { filter: brightness(.55) saturate(.6); }
.card.best { box-shadow: 0 0 0 3px var(--accent), 0 4px 10px rgba(0,0,0,.4); transform: translateY(-4px); }
.card.new { animation: deal .35s ease-out both; }
@keyframes deal { from { transform: translateY(-30px) rotate(-8deg); opacity: 0; } }

/* Seats round the rail */
.seat { position: absolute; transform: translate(-50%, -50%); width: 86px; z-index: 3; display: grid; justify-items: center; --mc: 26px; }
.seat .pod { position: relative; z-index: 2; width: 100%; background: var(--pod-bg); border: 2px solid var(--night-3); border-radius: 14px; padding: 3px 4px 4px; text-align: center; line-height: 1.15;
  box-shadow: 0 4px 10px rgba(0,0,0,.35); transition: border-color .2s, opacity .2s; }
.seat .nm { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat .stk { font-size: 13px; color: var(--ink-2); }
.seat.turn .pod { border-color: var(--accent); box-shadow: 0 0 0 3px var(--turn-glow), 0 4px 10px rgba(0,0,0,.35); }
.seat.folded .pod, .seat.out .pod { opacity: .5; }
.seat.win .pod { border-color: var(--accent); background: var(--raised); }
.seat.away .nm::after { content: " · away"; color: var(--dim); font-weight: 400; }
.seat .mini-cards { display: flex; gap: 2px; margin-bottom: -5px; position: relative; z-index: 1; height: calc(var(--mc) * 1.4); --cw: var(--mc); }
.seat.shown { --mc: 34px; width: 96px; }
.seat .mini-cards .card.face b { font-size: calc(var(--cw) * .5); }
.seat .tag { position: absolute; top: 100%; margin-top: 2px; font-size: 12px; padding: 1px 7px; border-radius: 99px; background: var(--deep); color: var(--ink-2); white-space: nowrap; z-index: 4; }
.seat .tag:empty { display: none; }
.seat .tag.allin { background: var(--bad); color: #fff; font-weight: 600; }
.seat .tag.won { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.seat .tbar { height: 3px; border-radius: 2px; background: var(--accent); margin-top: 3px; transition: width .25s linear; }
.seat .dealer { position: absolute; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--night); font-size: 12px; font-weight: 700;
  display: grid; place-items: center; box-shadow: 0 2px 3px rgba(0,0,0,.4); right: -8px; bottom: -8px; z-index: 4; }
.seat.east .dealer { right: auto; left: -8px; }
.seat .lead { position: absolute; left: -8px; top: -8px; width: 20px; height: 20px; color: var(--accent); z-index: 4; filter: drop-shadow(0 1px 1px rgba(0,0,0,.6)); }
.bet { position: absolute; transform: translate(-50%, -50%); z-index: 2; display: flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 600;
  background: var(--pot-bg); padding: 1px 7px 1px 3px; border-radius: 99px; }
.bet .chip { width: 17px; height: 17px; }

/* You */
.me { display: flex; align-items: center; gap: 10px; min-height: calc(var(--hc) * 1.4); padding: 0 4px; --hc: clamp(56px, 17vw, 84px); }
.hole { display: flex; gap: 6px; --cw: var(--hc); }
.hole .card:nth-child(1) { transform: rotate(-4deg); } .hole .card:nth-child(2) { transform: rotate(4deg) translateY(2px); }
.hole .card.best { transform: translateY(-6px); }
.me-info { flex: 1; min-width: 0; }
.hand-name { font-weight: 600; font-size: 17px; color: var(--accent); min-height: 1.2em; }
.my-stack { color: var(--ink-2); font-size: 16px; }
.my-stack b { color: var(--ink); }

.status { min-height: 24px; color: var(--ink-2); text-align: center; font-size: 16px; }
.status b { color: var(--accent); font-weight: 600; }
.raise { background: var(--night-2); border: 2px solid var(--night-3); border-radius: 16px; padding: 8px; display: grid; gap: 8px; }
.raise-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.raise-quick button { min-height: 40px; border-radius: 10px; border: 2px solid var(--night-3); background: var(--deep); font-size: 15px; }
.raise-row { display: flex; align-items: center; gap: 8px; }
.raise-row input { flex: 1; accent-color: var(--accent); height: 34px; }
.actions { display: grid; grid-template-columns: 1fr 1.25fr 1.25fr; gap: 8px; margin-top: auto; padding-top: 4px; }
.act { min-height: 56px; border-radius: 14px; border: 2px solid var(--night-3); background: var(--night-2); font-size: 17px; font-weight: 600; padding: 4px; line-height: 1.1; }
.act small { display: block; font-weight: 400; font-size: 14px; }
.act.raise-b, .act.call.hot { background: var(--accent); color: var(--on-accent); border-color: var(--accent); box-shadow: 0 3px 0 var(--accent-shadow); }
.act:disabled { opacity: .35; box-shadow: none; }
.act:active:not(:disabled) { transform: translateY(2px); }

/* Pass and play curtain */
.curtain { position: fixed; inset: 0; z-index: 45; background: var(--sky); background-color: var(--night); display: grid; place-content: center; justify-items: center; gap: 10px; padding: 24px; text-align: center; }
.curtain .card-big svg { width: 110px; height: 154px; fill: var(--back); color: var(--back-ink); filter: drop-shadow(0 10px 20px rgba(0,0,0,.5)); }
.curtain h3 { margin: 8px 0 0; font-size: 26px; font-weight: 600; }
.curtain p { margin: 0; color: var(--ink-2); max-width: 320px; }
.curtain .go { min-width: 260px; }

/* Home logo: a card back, an ace of hearts and a chip */
.brand .logo { position: relative; width: 120px; height: 92px; margin: 0 auto; --cw: 52px; }
.brand .lc { position: absolute; top: 4px; width: 52px; height: 73px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.45)); }
.brand .lc1 { left: 18px; transform: rotate(-12deg); fill: var(--back); color: var(--back-ink); }
.brand .lc2 { left: 50px; transform: rotate(9deg); }
.brand .lchip { position: absolute; left: 38px; top: 58px; width: 34px; height: 34px; fill: var(--accent); filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); }
/* ---------- Modals ---------- */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: var(--scrim, rgba(10, 6, 24, .62)); padding: 16px; }
.modal .card { width: min(100%, 380px); background: var(--night-2); border: 2px solid var(--night-3); border-radius: 20px; padding: 20px 18px; text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,.5); animation: up .2s ease-out; }
.modal h3 { margin: 0 0 6px; font-size: 24px; font-weight: 600; }
.modal p { margin: 0 0 8px; color: var(--ink-2); }
.modal-buttons { display: grid; gap: 10px; margin-top: 14px; }
.modal-buttons .go { margin: 0; }
.roomcode { font-size: 52px; font-weight: 700; letter-spacing: .22em; margin: 2px 0 6px; padding-left: .22em; color: var(--accent); }

.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: var(--night); padding: 10px 16px; border-radius: 12px; font-weight: 600; pointer-events: none;
  opacity: 0; transition: opacity .2s; max-width: 90vw; text-align: center; }
.toast.on { opacity: 1; }

.modal .amt { color: var(--accent); }

/* Landscape phones and desktop: the table on the left, you and your buttons beside it */
@media (min-aspect-ratio: 6/5) and (min-width: 560px) {
  :root { --cw: clamp(40px, 5.2vw, 74px); }
  .app { max-width: 1180px; }
  #game { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 330px); grid-template-rows: auto auto auto auto 1fr auto; column-gap: 26px; row-gap: 8px; }
  #game .topbar { grid-column: 1 / -1; grid-row: 1; }
  #game .table { grid-column: 1; grid-row: 2 / span 5; min-height: 0; height: calc(100dvh - 150px); margin: 34px 50px; }
  #game .me { grid-column: 2; grid-row: 2; }
  #game .status { grid-column: 2; grid-row: 3; }
  #game .raise { grid-column: 2; grid-row: 4; }
  #game .actions { grid-column: 2; grid-row: 6; }
  .seat { width: 104px; --mc: 32px; } .seat.shown { width: 112px; --mc: 40px; }
  .seat .nm, .seat .stk { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (orientation: landscape) and (max-height: 540px) {
  :root { --cw: clamp(30px, 8.4vh, 52px); }
  .app { padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: max(6px, env(safe-area-inset-bottom));
    padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
  .screen { min-height: calc(100dvh - 12px); }
  #game .table { height: calc(100dvh - 128px); margin: 20px 46px 24px; }
  .me { --hc: 44px; }
  .act { min-height: 46px; }
  .seat { width: 84px; --mc: 22px; }
  #home { display: grid; grid-template-columns: 1fr 1.25fr; grid-template-rows: auto 1fr; column-gap: 20px; row-gap: 10px; align-content: center; }
  #home .brand { grid-column: 1; grid-row: 1; margin-top: 0; align-self: end; }
  #home .brand h1 { font-size: 32px; }
  #home .home-foot { grid-column: 1; grid-row: 2; margin-top: 0; align-self: start; padding-top: 4px; }
  #home #resume, #home .modes, #home .playmoney { grid-column: 2; }
  .big { padding: 10px 16px; min-height: 56px; }
}
/* Short portrait phones: smaller cards so it all fits */
@media (orientation: portrait) and (max-height: 700px) {
  .table { min-height: 280px; margin: 24px 8px 28px; }
  .me { --hc: 52px; }
  .act { min-height: 50px; }
}

/* ---------- Table colours (classic: a moss-green felt on a plum rail) ---------- */
:root, [data-swatch="classic"] {
  --felt: #1f4c45; --felt-hi: #2c6a5f; --felt-lo: #143530; --rail: #3e2f72; --rail-edge: #5a4592; --stitch: rgba(255, 209, 102, .35);
  --card-face: #fff8ec; --card-face-2: #efe2c6; --card-ink: #2c2050; --card-red: #c2304f; --back: #4b2f8a; --back-ink: #ffd166;
  --pod-bg: rgba(27, 20, 54, .92); --pot-bg: rgba(10, 20, 18, .55); --turn-glow: rgba(255, 209, 102, .3);
}
/* ---------- Themes ----------
   Each theme is a set of colour tokens on <html data-theme="...">. "classic" is the :root values above.
   theme.js applies the saved one before the page is drawn; the picker is the Theme sheet on the home screen. */
:root[data-theme="midnight"], [data-swatch="midnight"] {
  --night: #0e0f14; --night-2: #1a1c24; --night-3: #2c2f3b; --ink: #eef0f5; --ink-2: #c9ccd6; --dim: #9599a8;
  --accent: #8fb8ff; --on-accent: #0e1626; --accent-shadow: #4f6fa8; --bad: #ff7a85;
  --deep: #08090d; --panel: #15171e; --raised: #263147; --shade: #000; --big-bot: #14161c; --resume-top: #22283a;
  --bar-bg: rgba(20, 22, 30, .85); --banner-bg: rgba(14, 15, 20, .95); --frame: #3a4152; --mvnum: #6b7080;
  --sky: radial-gradient(60% 40% at 50% 0%, #1d2233 0%, transparent 70%), linear-gradient(#111319, #0a0b0f);
  --sq-light: #b9bfcc; --sq-dark: #5b6377; --coord-l: #4b5266; --coord-d: #e3e7ee;
  --w-fill: #f2f2ee; --w-line: #15171e; --w-mark: #5f8fe0; --b-fill: #1c1e26; --b-line: #e6e8ef; --b-mark: #8fb8ff;
  --sig-w: #f2f2ee; --sig-b: #9aa3b8; --last: rgba(143, 184, 255, .42); --sel-sq: rgba(143, 184, 255, .6);
}
:root[data-theme="wood"], [data-swatch="wood"] {
  color-scheme: light;
  --night: #f3ead8; --night-2: #fffaf0; --night-3: #d8c7a4; --ink: #2e2214; --ink-2: #4a3a26; --dim: #6b573d;
  --accent: #a84a24; --on-accent: #fffaf0; --accent-shadow: #6e2f14; --bad: #b3261e;
  --deep: #fffdf8; --panel: #f7eedd; --raised: #f0dcc0; --shade: #c9b48e; --big-bot: #f5ead6; --resume-top: #fff3df;
  --bar-bg: rgba(255, 250, 240, .85); --banner-bg: rgba(255, 250, 240, .97); --frame: #6b4423; --mvnum: #9a8464;
  --sky: radial-gradient(60% 40% at 50% 0%, #fff7e6 0%, transparent 70%), linear-gradient(#f6eedd, #eadcc0);
  --sq-light: #f0d9b5; --sq-dark: #b58863; --coord-l: #8a6445; --coord-d: #3b2616; --sheen: rgba(255, 255, 255, .14);
  --w-fill: #fffaf0; --w-line: #2e2214; --w-mark: #c4862f; --b-fill: #3b2616; --b-line: #f6e6cc; --b-mark: #e0a84a;
  --sig-w: #c4862f; --sig-b: #3b2616; --last: rgba(214, 170, 40, .45); --sel-sq: rgba(214, 170, 40, .62);
}
:root[data-theme="neon"], [data-swatch="neon"] {
  --night: #0a0618; --night-2: #160d2e; --night-3: #3a1d6e; --ink: #f4f1ff; --ink-2: #d6ccff; --dim: #a596d8;
  --accent: #2af5d2; --on-accent: #04201b; --accent-shadow: #0f8f7a; --bad: #ff4f8b;
  --deep: #07041a; --panel: #120a28; --raised: #2a1460; --shade: #000; --big-bot: #110a26; --resume-top: #26135a;
  --bar-bg: rgba(16, 8, 40, .85); --banner-bg: rgba(10, 6, 24, .95); --frame: #ff3fd4; --mvnum: #7a68b8;
  --sky: radial-gradient(50% 35% at 15% 0%, rgba(255, 63, 212, .32) 0%, transparent 70%), radial-gradient(50% 35% at 90% 100%, rgba(42, 245, 210, .22) 0%, transparent 70%), linear-gradient(#0d0722, #06030f);
  --sq-light: #cfc9ff; --sq-dark: #4b2a8c; --coord-l: #4b2a8c; --coord-d: #e9e5ff;
  --w-fill: #effffc; --w-line: #0a0618; --w-mark: #ff3fd4; --b-fill: #1a0638; --b-line: #2af5d2; --b-mark: #ff3fd4;
  --sig-w: #effffc; --sig-b: #2af5d2; --last: rgba(42, 245, 210, .36); --sel-sq: rgba(42, 245, 210, .52);
}
:root[data-theme="tournament"], [data-swatch="tournament"] {
  --night: #12241a; --night-2: #1b3426; --night-3: #2f5240; --ink: #f1f5ec; --ink-2: #d4e2cf; --dim: #a3bca6;
  --accent: #f2c14e; --on-accent: #22301f; --accent-shadow: #a8812a; --bad: #ff8a7a;
  --deep: #0c1a12; --panel: #17301f; --raised: #2c4a36; --shade: #07110b; --big-bot: #16301f; --resume-top: #2a4a35;
  --bar-bg: rgba(12, 26, 18, .8); --banner-bg: rgba(18, 36, 26, .96); --frame: #4a6b3a; --mvnum: #6f8f74;
  --sky: radial-gradient(60% 40% at 50% 0%, #2c5238 0%, transparent 70%), linear-gradient(#173023, #0d1b13);
  --sq-light: #eeeed2; --sq-dark: #769656; --coord-l: #5f7d45; --coord-d: #f4f4de;
  --w-fill: #ffffff; --w-line: #1f2a1f; --w-mark: #d9a43a; --b-fill: #2a2a2a; --b-line: #f4f4e8; --b-mark: #f2c14e;
  --sig-w: #ffffff; --sig-b: #8fb08f; --last: rgba(246, 246, 105, .5); --sel-sq: rgba(246, 246, 105, .65);
}
:root[data-theme="ocean"], [data-swatch="ocean"] {
  --night: #0b2236; --night-2: #12324d; --night-3: #24557a; --ink: #eef7ff; --ink-2: #cfe4f5; --dim: #9dbdd4;
  --accent: #ffb86b; --on-accent: #2b1a08; --accent-shadow: #b0753a; --bad: #ff8a8a;
  --deep: #081a2a; --panel: #0f2b43; --raised: #1f4a6e; --shade: #04121e; --big-bot: #0f2c45; --resume-top: #1d4668;
  --bar-bg: rgba(8, 26, 42, .8); --banner-bg: rgba(11, 34, 54, .96); --frame: #6fa3c7; --mvnum: #6a90ad;
  --sky: radial-gradient(60% 40% at 50% 0%, #1f5580 0%, transparent 70%), linear-gradient(#0f2c45, #071724);
  --sq-light: #e8eef2; --sq-dark: #7d9bb0; --coord-l: #55778f; --coord-d: #0b2236;
  --w-fill: #ffffff; --w-line: #0b2236; --w-mark: #f0963c; --b-fill: #13283b; --b-line: #e6f1fa; --b-mark: #ffb86b;
  --sig-w: #ffffff; --sig-b: #6fa3c7; --last: rgba(255, 184, 107, .45); --sel-sq: rgba(255, 184, 107, .62);
}
:root[data-theme="pastel"], [data-swatch="pastel"] {
  color-scheme: light;
  --night: #f7f1fb; --night-2: #ffffff; --night-3: #dccdf0; --ink: #3a2b52; --ink-2: #4f3f6a; --dim: #6a5a86;
  --accent: #f7b6d2; --on-accent: #3a2b52; --accent-shadow: #d98bb0; --bad: #b42848;
  --deep: #ffffff; --panel: #f3ebfa; --raised: #f8dcec; --shade: #d8c8ea; --big-bot: #f6effc; --resume-top: #fde8f2;
  --bar-bg: rgba(255, 255, 255, .85); --banner-bg: rgba(255, 255, 255, .97); --frame: #b8a2e0; --mvnum: #9f8fbb;
  --sky: radial-gradient(50% 40% at 10% 0%, #ffe3ef 0%, transparent 70%), radial-gradient(50% 40% at 90% 100%, #dff3ee 0%, transparent 70%), linear-gradient(#f9f3fd, #f1eafa);
  --sq-light: #fdf3f7; --sq-dark: #9d86d0; --coord-l: #7d69b0; --coord-d: #fdf3f7;
  --w-fill: #ffffff; --w-line: #4a3a68; --w-mark: #f28cb8; --b-fill: #4a3a68; --b-line: #ffffff; --b-mark: #ffd36e;
  --sig-w: #f28cb8; --sig-b: #4a3a68; --last: rgba(242, 140, 184, .38); --sel-sq: rgba(242, 140, 184, .55);
}
:root[data-theme="contrast"], [data-swatch="contrast"] {
  --night: #000; --night-2: #000; --night-3: #fff; --ink: #fff; --ink-2: #fff; --dim: #e6e6e6;
  --accent: #ffe500; --on-accent: #000; --accent-shadow: #8a7c00; --bad: #ff6b6b;
  --deep: #000; --panel: #000; --raised: #333; --shade: #000; --big-bot: #000; --resume-top: #1a1a1a;
  --bar-bg: #000; --banner-bg: #000; --frame: #fff; --mvnum: #c8c8c8; --sky: linear-gradient(#000, #000);
  --sq-light: #ffffff; --sq-dark: #1f5fc8; --coord-l: #000; --coord-d: #fff; --sheen: transparent;
  --dot-l: rgba(0, 0, 0, .6); --ring-l: rgba(0, 0, 0, .7); --dot-d: rgba(255, 255, 255, .8); --ring-d: rgba(255, 255, 255, .85);
  --w-fill: #ffffff; --w-line: #000; --w-mark: #000; --b-fill: #000; --b-line: #fff; --b-mark: #ffe500;
  --sig-w: #fff; --sig-b: #ffe500; --last: rgba(255, 229, 0, .55); --sel-sq: rgba(255, 229, 0, .78);
}
:root[data-theme="contrast"] .pc { stroke-width: 2.8; }
:root[data-theme="contrast"] .big, :root[data-theme="contrast"] .seg button, :root[data-theme="contrast"] .act { border-color: #fff; }
:root[data-theme="midnight"], [data-swatch="midnight"] { --felt: #1c2230; --felt-hi: #27304a; --felt-lo: #11151f; --rail: #2c2f3b; --rail-edge: #3a4152; --stitch: rgba(143, 184, 255, .3);
  --back: #263147; --back-ink: #8fb8ff; --pod-bg: rgba(20, 22, 30, .94); --turn-glow: rgba(143, 184, 255, .3); --card-ink: #15171e; --card-red: #c23a4a; }
:root[data-theme="wood"], [data-swatch="wood"] { --felt: #2f5e3a; --felt-hi: #3f7a4c; --felt-lo: #224629; --rail: #6b4423; --rail-edge: #8a5a30; --stitch: rgba(255, 240, 200, .35);
  --back: #a84a24; --back-ink: #fff3df; --pod-bg: rgba(255, 250, 240, .95); --pot-bg: rgba(255, 250, 240, .85); --turn-glow: rgba(168, 74, 36, .3); --card-ink: #2e2214; --card-red: #b3261e; }
:root[data-theme="neon"], [data-swatch="neon"] { --felt: #160d38; --felt-hi: #241460; --felt-lo: #0a0620; --rail: #3a1d6e; --rail-edge: #ff3fd4; --stitch: rgba(42, 245, 210, .4);
  --back: #1a0638; --back-ink: #2af5d2; --pod-bg: rgba(16, 8, 40, .94); --turn-glow: rgba(42, 245, 210, .35); --card-red: #e0207a; --card-ink: #0a0618; }
:root[data-theme="tournament"], [data-swatch="tournament"] { --felt: #1f6b3a; --felt-hi: #2a8a4c; --felt-lo: #154d29; --rail: #3b2a1a; --rail-edge: #5a4028; --stitch: rgba(242, 193, 78, .35);
  --back: #8a1f2a; --back-ink: #f2c14e; --pod-bg: rgba(12, 26, 18, .92); --turn-glow: rgba(242, 193, 78, .3); --card-face: #ffffff; --card-face-2: #f1f1ec; --card-ink: #1f2a1f; --card-red: #c8202e; }
:root[data-theme="ocean"], [data-swatch="ocean"] { --felt: #134a6a; --felt-hi: #1d6690; --felt-lo: #0b3048; --rail: #24557a; --rail-edge: #6fa3c7; --stitch: rgba(255, 184, 107, .35);
  --back: #0f2b43; --back-ink: #ffb86b; --pod-bg: rgba(8, 26, 42, .92); --turn-glow: rgba(255, 184, 107, .3); --card-ink: #0b2236; --card-red: #d0453a; }
:root[data-theme="pastel"], [data-swatch="pastel"] { --felt: #b9e3d6; --felt-hi: #d3f0e6; --felt-lo: #9fd2c3; --rail: #b8a2e0; --rail-edge: #9d86d0; --stitch: rgba(74, 58, 104, .3);
  --back: #f7b6d2; --back-ink: #4a3a68; --pod-bg: rgba(255, 255, 255, .94); --pot-bg: rgba(255, 255, 255, .8); --turn-glow: rgba(242, 140, 184, .35); --card-ink: #3a2b52; --card-red: #c2305f; }
:root[data-theme="contrast"], [data-swatch="contrast"] { --felt: #003d1f; --felt-hi: #004d27; --felt-lo: #002612; --rail: #fff; --rail-edge: #000; --stitch: rgba(255, 229, 0, .7);
  --back: #000; --back-ink: #ffe500; --pod-bg: #000; --pot-bg: #000; --turn-glow: rgba(255, 229, 0, .6); --card-face: #fff; --card-face-2: #fff; --card-ink: #000; --card-red: #d40000; }
:root[data-theme="contrast"] .seat .pod, :root[data-theme="contrast"] .act { border-color: #fff; }

/* the picker: one swatch per theme, a corner of its felt with its card back */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 10px; }
.themes button { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 8px 10px; text-align: left;
  border-radius: 14px; border: 2px solid var(--night-3); background: var(--panel); color: var(--ink); }
.themes button[aria-pressed="true"] { border-color: var(--accent); background: var(--raised); }
.themes .sw { flex: none; width: 44px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--felt); box-shadow: 0 0 0 3px var(--rail); }
.themes .sw svg { width: 20px; height: 28px; fill: var(--back); color: var(--back-ink); }
