/* ITG — table styles. Single dark "card room" look on purpose. */
:root {
  color-scheme: dark;
  --felt: #172447;
  --felt-2: #20315e;
  --felt-deep: #0a1128;
  --rail: #070b17;
  --ink: #eceff7;
  --muted: #9ba6c6;
  --line: rgba(236, 239, 247, 0.12);
  --brass: #e2b35c;
  --brass-dim: rgba(226, 179, 92, 0.18);
  --paper: #fbfaf5;
  --paper-edge: #d9d6cc;
  --suit-black: #17191e;
  --suit-red: #c52f2c;
  --immune: #c7a6ff;
  --immune-dim: rgba(199, 166, 255, 0.14);
  --good: #74c8ff;
  --bad: #ff7a6b;
  --bet: #ffb36b;
  --display: "Big Shoulders Display", "Arial Narrow", "DejaVu Sans Condensed", Impact, sans-serif;
  --body: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --card-w: 62px;
  --card-h: 88px;
  --radius: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(120% 90% at 50% 20%, var(--felt-2) 0%, var(--felt) 45%, var(--felt-deep) 100%) fixed, var(--felt-deep);
  color: var(--ink);
  font: 15px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 16px;
  background: rgba(8, 13, 32, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--display); font-weight: 800; font-size: 28px; letter-spacing: 0.02em; line-height: 1; color: var(--brass); white-space: nowrap; }
.brand small { font-family: var(--body); font-weight: 500; font-size: 12px; letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase; margin-left: 8px; }
.tabs { display: flex; gap: 4px; margin-left: auto; }
.tab {
  background: none; border: 1px solid transparent; border-radius: 999px;
  padding: 6px 14px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--rail); background: var(--brass); }

main { padding-inline: 16px; padding-block: 16px 40px; max-width: 1280px; margin: 0 auto; }

/* ---------- play layout ---------- */
.play { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.table { display: grid; gap: 14px; min-width: 0; }

.hud {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.22);
  font-size: 13px; color: var(--muted);
}
.hud b { color: var(--ink); font-family: var(--mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.hud .spacer { flex: 1; }
.hud-info { display: contents; } /* its spans sit in the bar like before */
.phase-pill {
  font-family: var(--display); font-weight: 800; font-size: 18px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--rail); background: var(--brass); padding: 2px 12px 1px; border-radius: 6px;
}
.phase-pill.itg { background: var(--bad); }
.hud select { background: var(--rail); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; font-size: 13px; }
.btn-ghost { background: none; border: 1px solid var(--line); border-radius: 6px; padding: 3px 10px; cursor: pointer; color: var(--muted); font-size: 13px; }
.btn-ghost:hover { color: var(--ink); border-color: var(--muted); }

/* ---------- seats ---------- */
.opps { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.seat {
  position: relative; padding: 10px 12px 12px; border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.2); border: 1px solid var(--line);
  display: grid; gap: 8px; align-content: start; min-width: 0;
  transition: border-color .2s, box-shadow .2s;
}
.seat.turn { border-color: var(--brass); box-shadow: 0 0 0 1px var(--brass), 0 0 24px rgba(226, 179, 92, 0.25); }
.seat.folded, .seat.out { opacity: 0.45; }
.seat-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seat-name { font-weight: 700; font-size: 15px; }
.money { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--brass); margin-left: auto; }
.chip { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 1px 7px; border-radius: 999px; border: 1px solid currentColor; }
.chip.host { color: var(--brass); }
.chip-short { display: none; }
.chip.turn { color: var(--rail); background: var(--brass); border-color: var(--brass); }
.chip.fold { color: var(--bad); }
.chip.allin { color: var(--bet); }
.chip.out { color: var(--muted); }
.seat-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.seat-meta b { color: var(--ink); font-family: var(--mono); font-weight: 500; }
.last-action { font-size: 12px; color: var(--ink); background: rgba(255, 255, 255, 0.06); border-radius: 6px; padding: 2px 8px; justify-self: start; }
.last-action.none { visibility: hidden; } /* keeps the line's height before a bot has acted, so the table doesn't jump */
.zone-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.zone-label.imm { color: var(--immune); }

/* ---------- cards ---------- */
.cards { display: flex; flex-wrap: wrap; gap: 6px; min-height: calc(var(--card-h) * 0.62); align-items: flex-end; }
.cards.sm { --card-w: 36px; --card-h: 51px; gap: 4px; min-height: 0; }
.card {
  position: relative; width: var(--card-w); height: var(--card-h); flex: none;
  border-radius: 7px; background: var(--paper); border: 1px solid var(--paper-edge);
  color: var(--suit-black); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25), 0 6px 14px rgba(0, 0, 0, 0.25);
  font-family: var(--display); font-weight: 800; user-select: none;
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
.card.red { color: var(--suit-red); }
.card.joker { color: #6d4bb8; background: linear-gradient(160deg, #fffdf6, #f1ecff); }
.card .rk { position: absolute; top: 3px; left: 6px; font-size: calc(var(--card-h) * 0.24); line-height: 1; }
.card .st { position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--card-h) * 0.38); font-family: var(--body); padding-top: 8%; }
.card .val {
  position: absolute; right: 3px; bottom: 3px; font-family: var(--mono); font-weight: 700;
  font-size: calc(var(--card-h) * 0.14); line-height: 1; padding: 2px 3px; border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
}
.cards.sm .card .rk { left: 3px; top: 2px; }
.cards.sm .card .val { display: none; }
.card.back {
  background:
    repeating-linear-gradient(45deg, rgba(226, 179, 92, 0.28) 0 3px, transparent 3px 8px),
    repeating-linear-gradient(-45deg, rgba(226, 179, 92, 0.28) 0 3px, transparent 3px 8px),
    #233f86;
  border: 2px solid var(--paper);
}
.card.immune { box-shadow: 0 0 0 2px var(--immune), 0 6px 14px rgba(0, 0, 0, 0.3); }
.card.pickable { cursor: pointer; box-shadow: 0 0 0 2px var(--brass), 0 8px 18px rgba(0, 0, 0, 0.35); transform: translateY(-4px); }
.card.pickable:hover { transform: translateY(-9px); }
.card.dim { opacity: 0.35; }
/* keyboard: the card you're on is clearly marked */
.card.pickable:focus { outline: none; }
.card.pickable:focus-visible { box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px var(--brass), 0 8px 18px rgba(0, 0, 0, 0.35); transform: translateY(-9px); }
/* double discard: the first card you picked stays lifted with a gold ring */
.card.picked { box-shadow: 0 0 0 3px var(--brass), 0 0 16px rgba(226, 179, 92, 0.6); transform: translateY(-10px); opacity: 1; }
.card.burnhit { box-shadow: 0 0 0 3px var(--bad); }
.card.deal { animation: deal .35s ease-out; }
@keyframes deal { from { transform: translateY(-18px) rotate(-4deg); opacity: 0; } to { transform: none; opacity: 1; } }
.empty-zone { font-size: 12px; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; align-self: stretch; display: flex; align-items: center; }

/* ---------- center strip ---------- */
.center {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: stretch;
  padding: 14px; border-radius: 16px;
  background: rgba(0, 0, 0, 0.16); border: 1px solid var(--line);
}
.stack { display: grid; justify-items: center; gap: 6px; text-align: center; align-content: start; }
.stack .zone-label { margin-bottom: 2px; }
.stack .count { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.pile { position: relative; width: var(--card-w); height: var(--card-h); }
.pile .card { position: absolute; left: 0; top: 0; }
.potbox { display: grid; place-items: center; align-content: center; gap: 2px; }
.pot-amount { font-family: var(--display); font-weight: 800; font-size: 44px; line-height: 1; color: var(--brass); font-variant-numeric: tabular-nums; }
.pot-sub { font-size: 12px; color: var(--muted); }
.burnt-row { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 0 rgba(255, 122, 107, 0.9); transform: scale(1.12) rotate(-3deg); } 100% { box-shadow: 0 0 0 14px rgba(255, 122, 107, 0); transform: none; } }

/* ---------- my seat ---------- */
.me { padding: 14px; border-radius: 16px; background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line); display: grid; gap: 12px; }
.me.turn { border-color: var(--brass); box-shadow: 0 0 0 1px var(--brass); }
.me .cards { --card-w: 74px; --card-h: 105px; }
.me-zones { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; }
.me-zones > div { display: grid; gap: 6px; align-content: start; min-width: 0; }
.total { display: flex; align-items: baseline; gap: 8px; }
.total .num { font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.total .num.good { color: var(--good); }
.total .num.bad { color: var(--bad); }
.total .hint { font-size: 12px; color: var(--muted); }
/* special hand (Classic style): badge in my seat + gold glow on the hand */
.special-badge { font-size: 12.5px; font-weight: 700; color: var(--rail); background: var(--brass); border-radius: 999px; padding: 3px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; animation: sp-pulse 1.6s ease-in-out infinite; }
.special-badge .short { display: none; }
@keyframes sp-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(226, 179, 92, 0.7); } 50% { box-shadow: 0 0 0 6px rgba(226, 179, 92, 0); } }
.me.has-special #my-hand .card { box-shadow: 0 0 0 2px var(--brass), 0 0 14px rgba(226, 179, 92, 0.55); }
/* Specials dropdown (HUD) */
.specials-pop { position: fixed; z-index: 60; overflow-y: auto; background: var(--rail); border: 1px solid var(--brass); border-radius: 12px; padding: 12px 14px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); font-size: 13px; color: var(--muted); }
.specials-pop[hidden] { display: none; }
.sp-head { display: grid; gap: 4px; margin-bottom: 8px; }
.sp-head > b { color: var(--brass); font-family: var(--display); font-size: 17px; letter-spacing: 0.04em; }
.sp-head span b, .specials-pop p b { color: var(--ink); }
.sp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sp-list li { display: grid; gap: 5px; padding: 8px 0 0; border-top: 1px solid var(--line); }
.sp-list p { margin: 0; }
.sp-name { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.sp-name b { color: var(--ink); font-size: 14px; }
.sp-name small { font-size: 11.5px; }
.sp-rank { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--brass); color: var(--rail); font-size: 11px; font-weight: 800; }
.specials-pop .cards.sm { --card-w: 34px; --card-h: 48px; display: flex; gap: 4px; }
.sp-order { margin: 0 0 6px; padding: 4px 10px; border-radius: 8px; background: rgba(226, 179, 92, 0.12); color: var(--ink); font-size: 12.5px; }
.sp-order b { color: var(--brass); }
.sp-tag { font-size: 10.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.sp-tag.best { background: var(--brass); border-color: var(--brass); color: var(--rail); }
.sp-foot { margin: 8px 0 0; font-size: 12px; }
#btn-specials { color: var(--brass); border-color: rgba(226, 179, 92, 0.5); }
.res-special { display: block; font-family: var(--body, inherit); font-size: 11.5px; font-weight: 700; color: var(--brass); white-space: nowrap; }
.gp-win { margin-top: 8px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--brass); background: rgba(226, 179, 92, 0.12); color: var(--ink); font-size: 13.5px; }
.gp-win b { color: var(--brass); }

.actions { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.prompt { font-size: 14px; color: var(--ink); }
.prompt strong { color: var(--brass); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn {
  display: inline-grid; gap: 1px; text-align: left; align-content: center; /* label centred vertically */
  background: var(--felt-2); border: 1px solid rgba(236, 239, 247, 0.22); border-radius: 10px;
  padding: 8px 14px; cursor: pointer; font-weight: 700; font-size: 14px; min-height: 44px;
}
.btn small { font-weight: 500; font-size: 11px; color: var(--muted); }
.btn:hover:not(:disabled) { border-color: var(--brass); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn.primary { background: var(--brass); color: var(--rail); border-color: var(--brass); }
.btn.primary small { color: rgba(11, 15, 14, 0.7); }
.btn.danger { border-color: rgba(255, 122, 107, 0.5); color: var(--bad); }
.btn.danger.armed { background: var(--bad); color: var(--rail); }
.btn.danger.armed small { color: rgba(7, 11, 23, 0.85); font-weight: 600; } /* readable on coral (was muted grey, ~1:1) */
.btn.itg { background: var(--bad); color: var(--rail); border-color: var(--bad); font-family: var(--display); font-size: 22px; letter-spacing: 0.06em; padding: 8px 26px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid rgba(236, 239, 247, 0.22); border-radius: 10px; overflow: hidden; min-height: 44px; }
.stepper button { background: none; border: 0; width: 36px; align-self: stretch; cursor: pointer; font-size: 18px; color: var(--ink); }
/* raise: amount stepper + Raise button framed together as one control */
.raise-group { display: inline-flex; align-items: stretch; gap: 4px; }
.raise-group .stepper { min-height: 0; border-color: rgba(226, 179, 92, 0.45); border-radius: 8px; }
.raise-group .stepper button { width: 24px; font-size: 15px; padding: 0; }
.raise-amt { display: grid; justify-items: center; align-content: center; min-width: max-content; line-height: 1.05; padding: 0 2px; cursor: text; }
.raise-amt small { white-space: nowrap; font-size: 8px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--brass); }
.raise-amt > span { display: inline-flex; align-items: baseline; gap: 1px; font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--ink); }
.raise-group .raise-amt input { -moz-appearance: textfield; width: 3ch; padding: 0; font-size: 13px; font-weight: 700; text-align: left; border-bottom: 1px dashed rgba(226, 179, 92, 0.6); }
.raise-group .raise-amt input:focus { outline: none; border-bottom: 1px solid var(--brass); }
.raise-amt input::-webkit-outer-spin-button, .raise-amt input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.raise-group .btn[data-act="raise"] { white-space: nowrap; }
#raise-show { font-family: var(--mono); }
.stepper input { width: 64px; background: transparent; border: 0; color: var(--ink); text-align: center; font-family: var(--mono); font-size: 15px; }
.waiting { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.dots::after { content: "…"; animation: dots 1.2s steps(3) infinite; display: inline-block; width: 1.2em; overflow: hidden; vertical-align: bottom; }
@keyframes dots { from { width: 0; } to { width: 1.2em; } }

/* ---------- log ---------- */
.log {
  position: sticky; top: 76px;
  border: 1px solid var(--line); border-radius: var(--radius); background: rgba(0, 0, 0, 0.3);
  display: grid; grid-template-rows: auto 1fr; max-height: calc(100vh - 100px); min-height: 300px;
}
.log h3 { margin: 0; padding: 10px 12px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); }
.log ol { list-style: none; margin: 0; padding: 6px 0; overflow-y: auto; font-size: 13px; }
.log li { padding: 4px 12px; color: #c9d0e3; border-left: 2px solid transparent; }
.log li.big { color: var(--ink); font-weight: 700; border-left-color: var(--brass); }
.log li.phase { color: var(--brass); }
.log li.bad { color: var(--bad); }
.log li.good { color: var(--good); }
.log li.bet { color: var(--bet); }
.log li.you { color: var(--immune); }

/* ---------- title screen ---------- */
.title-screen { display: grid; place-items: center; padding-block: 40px; }
.title-card { max-width: 640px; text-align: center; display: grid; gap: 18px; justify-items: center; }
/* byline under the title: "— by ITG —" in the display font, ITG in gold */
.title-card .by { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 10px 0 0; font-family: var(--display); font-weight: 700; font-size: clamp(18px, 4.6vw, 24px); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); opacity: 0.9; }
.title-card .by b { color: var(--brass); font-weight: 900; letter-spacing: 0.1em; }
.title-card .by::before, .title-card .by::after { content: ""; width: clamp(28px, 8vw, 56px); height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--brass)); }
.title-card .by::after { background: linear-gradient(90deg, var(--brass), transparent); }
.title-card h1 { margin: 0; font-family: var(--display); font-weight: 900; font-size: clamp(52px, 12.5vw, 104px); white-space: nowrap; line-height: 0.85; letter-spacing: 0.02em; color: var(--brass); text-shadow: 0 6px 0 rgba(0, 0, 0, 0.35); }
.title-card p { margin: 0; color: var(--muted); max-width: 46ch; }
/* Extreme menu: a flat cartoon "EXTREME" stamp slapped on the title, red accents on the byline */
.title-wrap { position: relative; display: inline-block; }
.xstamp { position: absolute; right: -0.5em; bottom: -1.05em; transform: rotate(-9deg); font-family: var(--display); font-weight: 900; font-size: clamp(20px, 5vw, 34px); letter-spacing: 0.08em; text-transform: uppercase; line-height: 1; color: var(--rail); background: var(--bad); padding: 0.14em 0.45em 0.1em; border: 3px solid var(--rail); border-radius: 8px; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.4); animation: xstamp-in 0.35s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
@keyframes xstamp-in { from { transform: rotate(-9deg) scale(1.8); opacity: 0; } to { transform: rotate(-9deg) scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .xstamp { animation: none; } }
.title-card.extreme .by { margin-top: 30px; }
.title-card.extreme .by b { color: var(--bad); }
.title-card.extreme .by::before { background: linear-gradient(90deg, transparent, var(--bad)); }
.title-card.extreme .by::after { background: linear-gradient(90deg, var(--bad), transparent); }
.fan { display: flex; justify-content: center; height: 120px; margin-top: 4px; }
.fan .card { --card-w: 72px; --card-h: 102px; margin: 0 -14px; transform-origin: 50% 120%; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.facts span { font-size: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; color: var(--muted); }
.facts b { color: var(--ink); font-family: var(--mono); font-weight: 500; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(4, 7, 20, 0.75); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal { width: min(760px, 100%); background: #111b3a; border: 1px solid rgba(226, 179, 92, 0.4); border-radius: 18px; padding: 20px; display: grid; gap: 14px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
.modal h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1; letter-spacing: 0.02em; text-wrap: balance; }
.modal .sub { color: var(--muted); margin: -6px 0 0; }
.results { display: grid; gap: 8px; }
.res-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 64px 130px; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.22); }
.res-row.win { box-shadow: inset 0 0 0 1px var(--good); }
.res-name { font-weight: 700; }
.res-total { font-family: var(--display); font-weight: 800; font-size: 26px; text-align: right; font-variant-numeric: tabular-nums; }
.res-tag { font-size: 12px; font-weight: 700; text-align: right; }
.res-tag.good { color: var(--good); } .res-tag.bad { color: var(--bad); } .res-tag.mut { color: var(--muted); }
.pots { font-size: 13px; color: var(--muted); display: grid; gap: 2px; }
.pots b { color: var(--ink); }

/* ---------- rulebook ---------- */
.doc { max-width: 820px; margin: 0 auto; display: grid; gap: 8px; }
.doc h1 { font-family: var(--display); font-weight: 900; font-size: 56px; line-height: 0.95; margin: 8px 0 0; color: var(--brass); letter-spacing: 0.01em; }
.doc .lede { color: var(--muted); font-size: 16px; max-width: 62ch; margin: 0 0 8px; }
.doc h2 { font-family: var(--display); font-weight: 800; font-size: 28px; letter-spacing: 0.02em; margin: 26px 0 4px; padding-top: 14px; border-top: 1px solid var(--line); text-wrap: balance; }
.doc h3 { font-size: 16px; margin: 14px 0 0; color: var(--brass); }
.doc p, .doc li { max-width: 68ch; }
.doc p { margin: 4px 0; }
.doc ul, .doc ol { margin: 4px 0; padding-left: 22px; display: grid; gap: 4px; }
/* rulebook: design notes hidden unless "Show design notes" is ticked */
.doc:not(.show-dev) .dev { display: none; }
.doc code, .var { font-family: var(--mono); font-size: 12.5px; background: rgba(0, 0, 0, 0.3); padding: 1px 5px; border-radius: 4px; color: var(--immune); }
.doc .num { font-family: var(--mono); color: var(--brass); font-weight: 600; }
.note { border: 1px solid rgba(255, 179, 107, 0.35); background: rgba(255, 179, 107, 0.07); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.note .tag { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--bet); margin-right: 6px; }
.note.assume { border-color: rgba(226, 179, 92, 0.45); background: var(--brass-dim); }
.note.assume .tag { color: var(--brass); }
.table-wrap { overflow-x: auto; }
.doc table { border-collapse: collapse; font-size: 13.5px; width: 100%; }
.doc th, .doc td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.doc td.v { font-family: var(--mono); color: var(--brass); white-space: nowrap; }
.toc { display: flex; flex-wrap: wrap; gap: 6px; }
.toc a { font-size: 13px; color: var(--muted); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.toc a:hover { color: var(--ink); border-color: var(--muted); }

/* ---------- flow ---------- */
.flow-steps { display: grid; gap: 0; margin-top: 10px; }
.fstep { display: grid; grid-template-columns: 56px minmax(0, 1fr) 250px; gap: 18px; align-items: start; position: relative; padding-bottom: 28px; }
.fstep .node { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 20px; background: var(--felt-2); border: 2px solid var(--brass); color: var(--brass); position: relative; z-index: 1; }
.fstep::before { content: ""; position: absolute; left: 21px; top: 44px; bottom: 0; width: 2px; background: var(--line); }
.fstep:last-child::before { display: none; }
.fstep.loop .node { border-color: var(--immune); color: var(--immune); }
.fstep.end .node { border-color: var(--bad); color: var(--bad); }
.fstep h3 { margin: 6px 0 4px; font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: 0.02em; color: var(--ink); }
.fstep .kicker { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; color: var(--muted); }
.fstep.loop .kicker { color: var(--immune); }
.fstep ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 3px; font-size: 14px; color: #d3d9ea; }
.branch { margin-top: 8px; font-size: 13px; border-left: 2px solid var(--bad); padding: 2px 0 2px 10px; color: var(--muted); }
.branch b { color: var(--ink); }
.phone { width: 100%; max-width: 250px; border-radius: 30px; padding: 8px; background: #04060d; box-shadow: 0 0 0 1px #2a3150, 0 18px 40px rgba(0, 0, 0, 0.5); justify-self: end; }
.phone img { display: block; width: 100%; border-radius: 23px; }
.phone figcaption { font-size: 11px; color: var(--muted); text-align: center; padding: 6px 4px 2px; }
.loop-box { border: 1px dashed rgba(199, 166, 255, 0.5); border-radius: 18px; padding: 18px 14px 0; margin: 0 0 28px; position: relative; }
.loop-box > .loop-title { position: absolute; top: -12px; left: 16px; background: var(--felt); padding: 0 8px; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--immune); }
.desk-shot { border-radius: 12px; border: 1px solid var(--line); overflow: hidden; margin: 8px 0 20px; }
.desk-shot img { display: block; width: 100%; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .play { grid-template-columns: minmax(0, 1fr); }
  .log { position: static; max-height: 320px; }
}
@media (max-width: 640px) {
  :root { --card-w: 46px; --card-h: 66px; }
  main { padding-inline: 10px; }
  .topbar { flex-wrap: nowrap; gap: 8px; padding: 8px 10px; }
  .brand { font-size: 21px; }
  .brand small { display: block; margin: 1px 0 0; font-size: 9px; letter-spacing: 0.14em; } /* phones: "by ITG" under the name */
  .tab .long { display: none; }
  .tab { padding: 5px 10px; font-size: 13px; }
  .opps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .seat { padding: 7px; gap: 5px; }
  .seat-name { font-size: 13px; }
  .money { font-size: 12px; margin-left: 0; }
  .seat .chip { font-size: 9px; padding: 0 5px; }
  .seat-meta { display: none; }
  .seat .cards { --card-w: 14px; --card-h: 20px; gap: 2px; min-height: 0; }
  .seat .cards .card { box-shadow: none; border-radius: 3px; border-width: 1px; }
  .seat .cards.sm { --card-w: 26px; --card-h: 36px; }
  .seat .cards.sm .card .rk { font-size: 10px; left: 2px; top: 1px; }
  .seat .cards.sm .card .st { font-size: 13px; padding-top: 30%; }
  .last-action { font-size: 11px; padding: 1px 5px; }
  .center { grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 8px; gap: 4px; }
  .pot-amount { font-size: 30px; }
  .stack .count, .pot-sub { font-size: 11px; }
  .me { padding: 10px; gap: 8px; }
  .me .cards { --card-w: 50px; --card-h: 72px; gap: 4px; }
  .me-zones { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .total .num { font-size: 28px; }
  .btn { padding: 6px 10px; font-size: 13px; min-height: 40px; }
  .hud { gap: 4px 10px; padding: 8px 10px; font-size: 12px; }
  .phase-pill { font-size: 15px; }
  .res-row { grid-template-columns: 80px minmax(0, 1fr) 44px; }
  .res-row .res-tag { grid-column: 1 / -1; text-align: left; }
  .fstep { grid-template-columns: 44px minmax(0, 1fr); }
  .fstep .node { width: 36px; height: 36px; font-size: 16px; }
  .fstep::before { left: 17px; top: 36px; }
  .phone { grid-column: 2; justify-self: start; max-width: 230px; }
  .doc h1 { font-size: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- version label + report form ---------- */
.brand .ver { font-family: var(--mono); font-weight: 500; font-size: 11px; letter-spacing: 0; color: var(--muted); margin-left: 8px; vertical-align: middle; }
.report-btn { flex: none; }
.modal.report { width: min(560px, 100%); }
.modal.report h2 { font-size: 30px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: 14px; }
.seg input:checked + span { background: var(--brass); border-color: var(--brass); color: var(--rail); }
.seg input:focus-visible + span { outline: 2px solid var(--brass); outline-offset: 2px; }
.fld { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
.fld small { font-weight: 400; color: var(--muted); }
.fld input, .fld textarea { font: 15px/1.4 var(--body); color: var(--ink); background: var(--rail); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%; resize: vertical; }
.fld input:focus, .fld textarea:focus { outline: none; border-color: var(--brass); }
.chk { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); cursor: pointer; }
.chk input { accent-color: var(--brass); width: 16px; height: 16px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; }
.rp-msg { margin: 0; min-height: 1.2em; font-size: 13px; color: var(--muted); }
.rp-msg.bad { color: var(--bad); }
@media (max-width: 640px) {
  .brand .ver { display: none; }
  .report-btn .long { display: none; }
  .report-btn { padding: 5px 8px; }
  .modal.report h2 { font-size: 24px; }
}

/* ---------- tutorial coach ---------- */
.coach {
  display: grid; gap: 10px; padding: 12px 14px; border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(226, 179, 92, 0.14), rgba(226, 179, 92, 0.06));
  border: 1px solid rgba(226, 179, 92, 0.55);
  animation: coach-in 0.25s ease-out;
}
@keyframes coach-in { from { opacity: 0; transform: translateY(6px); } }
.coach-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.coach-tag { font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--rail); background: var(--brass); padding: 1px 9px 0; border-radius: 5px; }
.coach-step { font-size: 13px; font-weight: 600; color: var(--muted); }
.coach-head .btn-ghost { margin-left: auto; }
.coach-bar { height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.coach-bar i { display: block; height: 100%; background: var(--brass); transition: width 0.3s; }
.coach-body { font-size: 15px; line-height: 1.55; max-width: 72ch; }
.coach-body p { margin: 0 0 8px; }
.coach-body p:last-child, .coach-body ul:last-child { margin-bottom: 0; }
.coach-body ul { margin: 0 0 8px; padding-left: 20px; }
.coach-body b { color: var(--brass); font-weight: 700; }
.coach-body .cn { color: var(--ink); font-family: var(--mono); font-weight: 600; white-space: nowrap; }
.coach-hint { color: var(--bet); font-weight: 600; }
.tut-focus { outline: 2px solid var(--brass); outline-offset: 3px; border-radius: 8px; animation: tut-pulse 1.4s ease-in-out infinite; }
@keyframes tut-pulse { 50% { outline-color: rgba(226, 179, 92, 0.25); } }
.tut-recap { font-size: 14px; color: var(--muted); }
.tut-recap h3 { margin: 0 0 6px; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.tut-recap ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.tut-recap b { color: var(--ink); }
@media (max-width: 640px) {
  .coach { padding: 10px 12px; }
  .coach-body { font-size: 14px; }
}

/* ---------- phase ladder (left of the table; a strip on phones) ---------- */
.play { grid-template-columns: 176px minmax(0, 1fr) 280px; }
.ladder {
  position: sticky; top: 76px;
  border: 1px solid var(--line); border-radius: var(--radius); background: rgba(0, 0, 0, 0.3);
  padding: 12px 10px; display: grid; gap: 10px;
}
.lad-head { display: grid; gap: 2px; padding: 0 4px 10px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.lad-head b { color: var(--ink); font-family: var(--mono); }
.lad-round { font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: 0.04em; color: var(--ink); text-transform: uppercase; line-height: 1.1; }
.lad-round b { color: var(--brass); font-family: var(--display); }
.ladder ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; position: relative; }
.ladder li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 8px; border-radius: 8px; color: var(--muted); font-size: 14px; font-weight: 600; transition: background 0.3s, color 0.3s; }
.lad-dot { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-family: var(--mono); border: 1px solid var(--line); background: var(--rail); }
.lad-name { display: grid; gap: 1px; line-height: 1.25; padding-top: 2px; }
.lad-name small { font-size: 11px; font-weight: 500; color: var(--muted); }
.ladder li.done { color: #c9d0e3; }
.ladder li.done .lad-dot { color: var(--brass); border-color: rgba(226, 179, 92, 0.5); }
.ladder li.skip, .ladder li.locked { opacity: 0.55; }
.ladder li.locked .lad-dot { font-size: 10px; }
.ladder li.now { background: var(--brass); color: var(--rail); box-shadow: 0 0 20px rgba(226, 179, 92, 0.3); }
.ladder li.now .lad-dot { background: var(--rail); color: var(--brass); border-color: var(--rail); }
.ladder li.now small { color: rgba(7, 11, 23, 0.8); font-weight: 600; }
body[data-phase="itg"] .ladder li.now { background: var(--bad); box-shadow: 0 0 20px rgba(255, 122, 107, 0.3); }

/* ---------- action line + "just acted" pulse ---------- */
.now-bar {
  min-height: 42px; padding: 9px 14px; border-radius: var(--radius);
  border: 1px solid var(--line); border-left: 4px solid var(--muted);
  background: rgba(0, 0, 0, 0.28); font-size: 15px; font-weight: 600; color: var(--ink);
}
.now-bar:empty { display: none; }
.now-bar.phase, .now-bar.big { border-left-color: var(--brass); color: var(--brass); }
.now-bar.bet { border-left-color: var(--bet); }
.now-bar.bad { border-left-color: var(--bad); }
.now-bar.good { border-left-color: var(--good); }
.now-bar.you { border-left-color: var(--immune); }
.now-bar.pop { animation: now-pop 0.45s ease-out; }
@keyframes now-pop { from { background: rgba(226, 179, 92, 0.22); transform: translateY(-3px); } }
.seat.acted, .me.acted { animation: acted 0.9s ease-out; }
@keyframes acted { 0% { box-shadow: 0 0 0 3px var(--brass), 0 0 30px rgba(226, 179, 92, 0.5); } 100% { box-shadow: 0 0 0 0 rgba(226, 179, 92, 0); } }
.seat.turn .last-action { background: var(--brass-dim); color: var(--brass); font-weight: 600; }
.last-action { font-size: 13px; }

@media (max-width: 1180px) {
  .play { grid-template-columns: 150px minmax(0, 1fr); }
  .play .log { grid-column: 1 / -1; position: static; max-height: 320px; }
}
@media (max-width: 980px) {
  .play { grid-template-columns: minmax(0, 1fr); }
  .ladder { position: static; padding: 8px; gap: 6px; grid-template-columns: auto minmax(0, 1fr); align-items: center; }
  .lad-head { border: 0; padding: 0 6px 0 2px; }
  .lad-head > span:first-child { display: none; }
  .lad-round { font-size: 20px; white-space: nowrap; }
  .ladder ol { display: flex; gap: 3px; overflow-x: auto; scrollbar-width: none; }
  .ladder li { padding: 5px 7px; gap: 5px; font-size: 12px; flex: none; align-items: center; }
  .ladder li:not(.now) small { display: none; }
  .ladder li .lad-name { padding-top: 0; }
  .lad-dot { width: 18px; height: 18px; font-size: 10px; }
  .ladder li.skip { display: none; }
}
@media (max-width: 640px) {
  .ladder li:not(.now) .lad-name { display: none; }
  .ladder li.now small { font-size: 10px; }
  .now-bar { font-size: 13px; min-height: 36px; padding: 7px 10px; }
  .last-action { font-size: 11px; }
}

/* ---------- card flights (draw / discard / burn) ---------- */
.flight { position: fixed; z-index: 40; pointer-events: none; transform-origin: 0 0; will-change: transform; }
.flight .card { width: 100%; height: 100%; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45); }

/* =====================================================================
   FIT THE GAME SCREEN TO THE VIEWPORT (no page scrolling while playing)
   body[data-view="game"] is set by ui.js while the Play table is shown.
   ===================================================================== */
body[data-view="game"] { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body[data-view="game"] main { flex: 1; min-height: 0; width: 100%; padding-block: 10px; overflow: auto; }
body[data-view="game"] #tab-play, body[data-view="game"] .play { height: 100%; }

.play { grid-template-columns: 176px minmax(0, 1fr) 280px; gap: 12px; align-items: stretch; }
.ladder { position: static; align-self: start; }
.log { position: static; top: auto; max-height: none; min-height: 0; grid-template-rows: auto auto minmax(0, 1fr); }
.log h3 { display: flex; align-items: center; justify-content: space-between; }
.log-close, .log-btn { display: none; }
#coach-side:not(:empty) { padding: 10px; border-bottom: 1px solid var(--line); }
#coach-side .coach-body { font-size: 14px; }
.table { gap: 8px; align-content: start; }

.hud { padding: 5px 12px; gap: 4px 14px; }
.hud select { padding: 2px 4px; }
.now-bar { min-height: auto; padding: 6px 12px; font-size: 14px; line-height: 1.35; }
.hud .short { display: none; }

/* opponents: one fanned row of cards, immune cards on the same row */
.opps { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.seat { padding: 7px 10px 8px; gap: 4px; }
.seat-name { font-size: 14px; }
.seat-meta { font-size: 11px; }
.seat-cards { display: flex; align-items: flex-end; gap: 10px; min-height: var(--seat-h, 57px); }
.seat .cards { --card-w: 40px; --card-h: 57px; flex-wrap: nowrap; gap: 0; min-height: 0; }
.seat .cards .card + .card { margin-left: -22px; }
.seat, .seat-cards { min-width: 0; }
.seat-head { flex-wrap: nowrap; min-width: 0; }
.seat-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat .cards.sm { --card-w: 30px; --card-h: 43px; }
.seat .cards.sm .card + .card { margin-left: -16px; }
.imm-row { padding-left: 8px; border-left: 2px solid rgba(199, 166, 255, 0.45); }
.last-action { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 1px 8px; }

/* center strip */
.center { --card-w: 50px; --card-h: 71px; padding: 8px 12px; gap: 8px; border-radius: 14px; }
.stack { gap: 3px; }
.stack .zone-label { margin: 0; }
.stack .count { font-size: 12px; }
.pot-amount { font-size: 36px; }
.burn-stack { grid-template-columns: auto auto; justify-content: center; column-gap: 8px; }
.burn-stack > .zone-label { grid-column: 1 / -1; }
.burn-stack .burnt-row { --card-w: 22px; --card-h: 31px; flex-direction: column; flex-wrap: nowrap; gap: 0; align-self: start; }
.burn-stack .burnt-row .card + .card { margin-top: -18px; }
.burn-stack .burnt-row .card .st { display: none; }

/* my seat */
.me { padding: 8px 12px 10px; gap: 6px; border-radius: 14px; }
.me .cards { --card-w: 62px; --card-h: 88px; gap: 5px; min-height: var(--card-h); }
.me-zones { gap: 12px; }
.me-zones > div { gap: 3px; }
.me .empty-zone { min-height: var(--card-h); font-size: 11px; line-height: 1.35; }
.total { flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.total .num { font-size: 28px; }
.actions { padding-top: 6px; gap: 6px; }
.prompt { font-size: 13px; line-height: 1.35; }
.btn { min-height: 40px; padding: 5px 12px; }
.btn.itg { padding: 5px 22px; font-size: 20px; }
.stepper { min-height: 40px; }
.coach { padding: 9px 12px; gap: 7px; }
.coach-body { font-size: 14px; line-height: 1.45; }
.coach-body p { margin-bottom: 5px; }

/* total breakdown: "= 13 + 5 − 3 + 9" */
.calc { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 2px 4px; font-family: var(--mono); font-size: 14px; color: var(--muted); }
.calc .op { color: var(--muted); }
.calc .t { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; font-weight: 700; color: var(--ink); padding: 2px 4px 1px; border-radius: 5px; background: rgba(255, 255, 255, 0.05); }
.calc .t small { font-family: var(--body); font-size: 9px; font-weight: 600; margin-top: 2px; opacity: 0.85; }
.calc .t.red { color: #ff9b8f; }
.calc .t.imm { color: var(--immune); box-shadow: inset 0 0 0 1px rgba(199, 166, 255, 0.5); }
.calc .t.jk { color: #c7a6ff; }
.total .hint { flex-basis: auto; }

/* taller screens: bigger cards */
@media (min-height: 860px) and (min-width: 981px) {
  .seat .cards { --card-w: 46px; --card-h: 65px; }
  .seat-cards { --seat-h: 65px; }
  .center { --card-w: 58px; --card-h: 82px; }
  .me .cards { --card-w: 72px; --card-h: 102px; }
  .table { gap: 10px; }
}

/* medium: ladder + table; log opens as a panel */
@media (max-width: 1180px) {
  .play { grid-template-columns: 150px minmax(0, 1fr); }
  .play .log {
    display: none; position: fixed; z-index: 45; top: 64px; right: 12px; bottom: 12px; width: min(360px, calc(100vw - 24px));
    grid-column: auto; max-height: none; background: #0d1531; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  }
  body[data-log="open"] .play .log { display: grid; }
  .log-close, .log-btn { display: inline-block; }
}

/* phones and narrow tablets: one column, ladder strip on top */
@media (max-width: 980px) {
  .play { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 6px; }
  .table { gap: 6px; }
}
@media (max-width: 640px) {
  body[data-view="game"] main { padding: 6px 8px; }
  .play .log { top: 56px; right: 8px; left: 8px; bottom: 8px; width: auto; }
  .ladder { padding: 5px 6px; }
  .lad-round { font-size: 17px; }
  .ladder li { padding: 3px 6px; }
  .hud { padding: 4px 8px; gap: 2px 10px; font-size: 12px; }
  .hud .long, .actions .long { display: none; }
  .hud .short { display: inline; }
  /* the small top-bar buttons get a 44px-tall tap area without taking more room */
  .hud .btn-ghost, .hud select { position: relative; min-height: 32px; }
  .hud .btn-ghost::after { content: ""; position: absolute; inset: -6px -3px; }
  /* Speed: the dropdown itself is 44px tall but transparent; its 32px pill is drawn on the label */
  .hud label:has(#speed) { display: inline-flex; align-items: center; height: 32px; border: 1px solid var(--line); border-radius: 6px; background: var(--rail); }
  .hud #speed { height: 44px; min-height: 44px; margin: -6px 0; border: 0; background: transparent; }
  /* bot seats: a one-letter host badge and no Turn badge (the seat's gold border shows the turn), so names fit */
  .opps .chip.host .chip-long { display: none; }
  .opps .chip.host .chip-short { display: inline; }
  .opps .chip.host { padding: 0 5px; }
  .opps .chip.turn { display: none; }
  /* a folded bot shows it by the dimmed seat and its "Folded" tag, so the name keeps its room */
  .opps .chip.fold { display: none; }
  .special-badge .long { display: none; }
  .special-badge .short { display: inline; }
  .opps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hud select { font-size: 12px; }
  .now-bar { font-size: 12px; padding: 4px 8px; border-left-width: 3px; }
  /* one line only, so a long message can't push the table down (full text in the Log) */
  .now-bar { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .opps { gap: 5px; }
  .seat { padding: 5px 6px; gap: 3px; }
  .seat-head { gap: 4px; }
  .seat-name { font-size: 12px; }
  .money { font-size: 11px; }
  .seat-cards { gap: 4px; min-height: 28px; --seat-h: 28px; }
  .seat .cards { --card-w: 20px; --card-h: 28px; }
  .seat .cards .card + .card { margin-left: -11px; }
  .seat .cards.sm { --card-w: 20px; --card-h: 28px; }
  .seat .cards.sm .card + .card { margin-left: -11px; }
  .seat .cards .card .rk { font-size: 9px; left: 2px; top: 1px; }
  .seat .cards .card .st { font-size: 11px; padding-top: 35%; }
  .imm-row { padding-left: 4px; }
  .last-action { font-size: 10px; padding: 1px 4px; }
  .center { --card-w: 38px; --card-h: 54px; padding: 5px 6px; gap: 4px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .center .zone-label { font-size: 9px; }
  .stack .count { font-size: 10px; }
  .pot-amount { font-size: 26px; }
  .pot-sub { font-size: 10px; }
  .burn-stack { column-gap: 4px; }
  .burn-stack .burnt-row { --card-w: 16px; --card-h: 23px; }
  .burn-stack .burnt-row .card + .card { margin-top: -14px; }
  .burn-stack .burnt-row .card .rk { font-size: 8px; left: 1px; top: 1px; }
  .me { padding: 6px 8px 8px; gap: 5px; }
  .me .cards { --card-w: 46px; --card-h: 66px; gap: 3px; }
  .me-zones { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .me-zones > div:last-child { min-width: 74px; }
  .me .empty-zone { font-size: 0; padding: 0; }
  .me .empty-zone::after { content: "none yet"; font-size: 10px; margin: auto; }
  #my-immune .card + .card { margin-left: -24px; }
  .total .num { font-size: 22px; }
  .calc { font-size: 12px; gap: 1px 3px; }
  .calc .t small { font-size: 8px; }
  .total .hint { font-size: 11px; }
  .prompt { font-size: 12px; }
  .actions .btn-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; }
  .actions .btn { min-height: 44px; padding: 4px 6px; font-size: 12px; text-align: center; justify-items: center; }
  .actions .btn small { font-size: 9.5px; line-height: 1.15; }
  .actions .stepper { min-height: 44px; }
  .actions .stepper button { width: 24px; }
  .actions .stepper input { width: 34px; font-size: 13px; }
  /* phones: Stay/Call | raise control | Fold on one row, the raise control only as wide as it needs */
  .actions .btn-row:has(.raise-group) { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); grid-auto-columns: auto; }
  .actions .raise-group { gap: 3px; }
  .actions .raise-group .stepper button { width: 20px; }
  .actions .raise-group .btn { padding: 4px 6px; }
  .btn.itg { font-size: 17px; padding: 4px 8px; }
  .coach { padding: 7px 9px; gap: 5px; }
  .coach-body { font-size: 12.5px; line-height: 1.4; max-height: 34vh; overflow-y: auto; }
  .coach-body ul { padding-left: 16px; }
  body[data-tutorial="on"] .now-bar { display: none; }
}

/* tablets: tutorial coach sits beside my hand instead of under it */
@media (min-width: 641px) and (max-width: 1180px) {
  .me:has(> .coach) {
    grid-template-columns: minmax(0, 1fr) minmax(250px, 42%);
    grid-template-areas: "head head" "zones coach" "total coach" "actions coach";
    align-items: start;
  }
  .me:has(> .coach) > .seat-head { grid-area: head; }
  .me:has(> .coach) > .me-zones { grid-area: zones; }
  .me:has(> .coach) > .total { grid-area: total; }
  .me:has(> .coach) > .coach { grid-area: coach; }
  .me:has(> .coach) > .actions { grid-area: actions; }
  .me:has(> .coach) .coach-body { max-height: 26vh; overflow-y: auto; }
  .me:has(> .coach) .coach-body > p:last-child { position: sticky; bottom: 0; margin: 0; padding-top: 4px; background: #1d2134; box-shadow: 0 -8px 8px -4px #1d2134; }
  body[data-tutorial="on"] .now-bar { display: none; }
}
@media (max-width: 640px) {
  #my-hand { flex-wrap: nowrap; }
  #my-hand .card + .card { margin-left: -6px; }
  .total { gap: 2px 6px; }
  .calc { font-size: 11px; gap: 1px 2px; }
  .calc .t { padding: 1px 3px 1px; }
  .calc .t small { display: none; }
  .total .hint { font-size: 10px; }
  body[data-tutorial="on"] .hud { display: none; }
}
@media (max-width: 640px) and (max-height: 720px) {
  .coach-body { max-height: 24vh; }
}
@media (max-width: 640px) {
  #my-hand[data-n="5"] .card + .card { margin-left: -14px; }
  #my-hand[data-n="6"] .card + .card { margin-left: -22px; }
  #my-hand[data-n="7"] .card + .card { margin-left: -27px; }
  body[data-tutorial="on"] .actions .prompt, body[data-tutorial="on"] .coach-bar { display: none; }
}
@media (max-width: 640px) and (max-height: 720px) {
  .coach-body { max-height: 21vh; }
}
@media (max-width: 640px) and (max-height: 700px) {
  .coach-body { max-height: 16vh; }
  .me { gap: 4px; }
}
@media (max-width: 640px) and (max-height: 700px) {
  .coach-tag { font-size: 12px; padding: 0 6px; }
  .coach-step { font-size: 11px; }
  .coach-head .btn-ghost { padding: 1px 8px; font-size: 12px; }
  .coach { padding: 5px 8px; gap: 3px; }
  .ladder { padding: 3px 6px; }
  body[data-view="game"] main { padding-block: 4px; }
}
@media (max-width: 640px) {
  /* the instruction (last line of the coach text) stays visible; the explanation above scrolls */
  .coach-body > p:last-child { position: sticky; bottom: 0; margin: 0; padding-top: 4px; background: #1d2134; box-shadow: 0 -8px 8px -4px #1d2134; }
}

/* ---------- level picker ---------- */
.levels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.level {
  display: grid; gap: 4px; align-content: start; text-align: left; cursor: pointer;
  padding: 12px 14px; border-radius: 12px; background: var(--felt-2); color: var(--ink);
  border: 1px solid rgba(236, 239, 247, 0.18); font: inherit;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}
.level:hover, .level:focus-visible { border-color: var(--brass); transform: translateY(-2px); }
.level.last { border-color: rgba(226, 179, 92, 0.6); }
.lv-head { display: flex; align-items: center; gap: 8px; }
.lv-num { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brass); }
.lv-tag { margin-left: auto; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--rail); background: var(--brass); padding: 1px 7px; border-radius: 999px; }
.lv-name { font-family: var(--display); font-weight: 800; font-size: 24px; line-height: 1.05; letter-spacing: 0.02em; }
.level ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 3px; font-size: 13px; line-height: 1.35; }
.level li { position: relative; padding-left: 18px; }
.level li::before { position: absolute; left: 0; top: 0; font-weight: 700; }
.level li.on::before { content: "✓"; color: var(--brass); }
.level li.off { color: var(--muted); }
.level li.off::before { content: "–"; color: var(--muted); }
.lv-new { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--rail); background: var(--immune); padding: 0 6px; border-radius: 999px; vertical-align: 1px; }
.lad-level { font-size: 11px; font-weight: 700; color: var(--brass); letter-spacing: 0.06em; }
@media (max-width: 640px) {
  .levels { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .level { padding: 8px 10px; gap: 2px; }
  .lv-name { font-size: 19px; }
  .level ul { font-size: 12px; gap: 1px; }
}
@media (max-width: 980px) {
  .lad-head .lad-level { display: none; }
}
@media (max-width: 640px) {
  .modal:has(.levels) { padding: 12px; gap: 8px; }
  .modal:has(.levels) h2 { font-size: 26px; }
  .modal:has(.levels) .sub { margin: 0; font-size: 13px; }
  .level { padding: 6px 10px; }
  .lv-name { font-size: 17px; }
  .level ul { font-size: 11.5px; line-height: 1.3; margin-top: 2px; }
  .level li { padding-left: 14px; }
}
.me-zones.no-immune { grid-template-columns: minmax(0, 1fr); }

/* ---------- Universal card (optional rule) ---------- */
.center.has-universal { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.card.universal { box-shadow: 0 0 0 2px var(--immune), 0 0 16px rgba(199, 166, 255, 0.45); }
.calc .t.uni { color: var(--rail); background: var(--immune); }

/* =====================================================================
   FIRE (cartoon style): flat three-layer flames with an ink outline that
   wobble like a flip-book. No blur, no soft glows.
   ===================================================================== */
.flames { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.flames i {
  position: absolute; left: var(--x); bottom: 0; display: block;
  width: calc(var(--card-w) * 0.4 * var(--s, 1)); aspect-ratio: 32 / 44;
  margin-left: calc(var(--card-w) * -0.2 * var(--s, 1));
  transform-origin: 50% 100%;
}
.flames svg { display: block; width: 100%; height: 100%; overflow: visible; }
.flames .fl-out { fill: #ef4a2b; stroke: #2a0f08; stroke-width: 2.2; stroke-linejoin: round; }
.flames .fl-mid { fill: #ff9f1c; }
.flames .fl-in { fill: #ffe45c; }
@keyframes wobble {
  0%   { transform: scale(1, 1); }
  25%  { transform: scale(-1, 1.1); }
  50%  { transform: scale(1, 0.92); }
  75%  { transform: scale(-1, 1.03); }
}

/* older burnt cards: flat scorched look */
.burnt-row .card { filter: grayscale(0.55) brightness(0.72); }

/* a card taken by the burn: shakes, is swallowed by flames, chars, goes poof */
.fire-ghost { position: fixed; z-index: 41; pointer-events: none; }
.fire-ghost > .card { width: 100%; height: 100%; box-shadow: 0 0 0 2px #2a0f08; animation: poof var(--dur) linear var(--delay) both; }
@keyframes poof {
  0%   { transform: none; filter: none; opacity: 1; }
  6%   { transform: translate(-3px, 0) rotate(-3deg); }
  12%  { transform: translate(3px, 0) rotate(3deg); }
  18%  { transform: translate(-2px, 0) rotate(-2deg); }
  24%  { transform: none; filter: none; }
  34%  { filter: brightness(0.3) grayscale(1); }
  60%  { transform: scale(1.08); filter: brightness(0.22) grayscale(1); opacity: 1; }
  68%  { transform: scale(0.25); opacity: 0.6; }
  74%, 100% { transform: scale(0); opacity: 0; }
}
.fire-ghost .flames.burning i {
  bottom: -4%; scale: 0;
  width: calc(var(--card-w) * 0.62 * var(--s, 1)); margin-left: calc(var(--card-w) * -0.31 * var(--s, 1));
  animation: wobble 0.3s steps(1) infinite, engulf var(--dur) ease-out var(--delay) both;
}
@keyframes engulf {
  0%        { scale: 0; }
  14%       { scale: 0.7; }
  30%, 56%  { scale: 1.35; }
  68%, 100% { scale: 0; }
}
.fire-ghost .puff {
  position: absolute; left: var(--x); top: var(--y);
  width: calc(var(--card-w) * 0.42 * var(--s, 1)); aspect-ratio: 1; margin: calc(var(--card-w) * -0.21 * var(--s, 1));
  border-radius: 50%; background: #9ea7bd; border: 2px solid #2a2f45; box-shadow: inset -3px -3px 0 rgba(42, 47, 69, 0.35);
  scale: 0; animation: puff var(--dur) ease-out var(--delay) both;
}
@keyframes puff {
  0%, 62% { scale: 0; opacity: 1; translate: 0 0; }
  74%     { scale: 1.1; opacity: 1; }
  100%    { scale: 1.35; opacity: 0; translate: var(--dx) calc(var(--card-h) * -0.45); }
}
.fire-ghost .spark {
  position: absolute; left: 50%; top: 45%; width: 12px; height: 12px; margin: -6px;
  background: #ffe45c; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  scale: 0; animation: spark var(--dur) ease-out var(--delay) both;
}
@keyframes spark {
  0%, 62% { scale: 0; translate: 0 0; rotate: 0deg; }
  70%     { scale: 1.2; }
  100%    { scale: 0; translate: var(--dx) var(--dy); rotate: 180deg; }
}

@media (prefers-reduced-motion: reduce) {
  .flames i { animation: none !important; }
}
.stack .zone-label { position: relative; z-index: 1; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9); }
/* a card being burned keeps its slot (so nothing shifts) while its fire plays on top */
body.fx .card.burning-slot { visibility: hidden; }
body:not(.fx) .card.burning-slot { box-shadow: 0 0 0 3px #ff9f1c, 0 0 0 5px #2a0f08; filter: grayscale(0.6) brightness(0.7); }
.burn-stack > .zone-label { z-index: 3; text-shadow: 0 0 2px #2a0f08, 0 1px 3px #000, 0 0 6px rgba(0, 0, 0, 0.9); }

/* ---------- account button + forms ---------- */
.acct-btn { display: inline-flex; align-items: center; gap: 6px; flex: none; max-width: 190px; }
.acct-btn .acct-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-btn.signed-in { color: var(--brass); border-color: rgba(226, 179, 92, 0.5); }
.acct-form { display: grid; gap: 12px; }
.rp-msg.good { color: var(--good); }
@media (max-width: 640px) {
  .acct-btn { padding: 5px 8px; max-width: 110px; }
  .acct-btn:not(.signed-in) .acct-name { display: none; }
}
/* dialogs never wider than the screen */
.modal-bg { grid-template-columns: minmax(0, 1fr); }
.modal-bg > .modal { justify-self: center; max-width: 100%; min-width: 0; }
@media (max-width: 640px) {
  .acct-btn .acct-name { display: none; }               /* icon only; your name is on your seat */
  .acct-btn, .report-btn { padding: 5px 7px; }
  .topbar { gap: 6px; }
  .tabs { gap: 0; }
  .tab { padding: 5px 8px; }
}

/* ---------- Classic / Casino switch on the main menu ---------- */
.style-switch { justify-content: center; }
.style-switch span { font-size: 13px; padding: 6px 16px; }

/* =====================================================================
   TOURNAMENT: bracket (right column; the Bracket panel on small screens)
   ===================================================================== */
#bracket-side:not(:empty) { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.bracket { display: grid; gap: 8px; }
.br-head { display: grid; gap: 1px; }
.br-title { font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brass); line-height: 1; }
.br-sub { font-size: 11px; color: var(--muted); }
.br-stages { list-style: none; margin: 0; padding: 0 0 0 12px; display: grid; gap: 6px; position: relative; }
.br-stages::before { content: ""; position: absolute; left: 21px; top: 12px; bottom: 18px; width: 2px; background: var(--line); }
.br-stages li { position: relative; display: grid; gap: 3px; padding: 6px 8px 6px 0; }
.br-stage { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.br-stage small { margin-left: auto; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.br-dot { position: relative; z-index: 1; flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font: 700 11px var(--mono); background: var(--rail); border: 2px solid var(--line); color: var(--muted); }
.br-match { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; padding-left: 28px; font-size: 12px; color: var(--muted); }
.br-you { color: var(--ink); font-weight: 700; }
.br-vs { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.br-bot { color: #c9d0e3; }
.br-bot em { font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--brass); }
.br-bot.out { text-decoration: line-through; color: var(--muted); opacity: 0.7; }
.br-stages li.now { background: var(--brass-dim); border-radius: 8px; }
.br-stages li.now .br-dot { background: var(--brass); border-color: var(--brass); color: var(--rail); }
.br-stages li.now .br-stage b { color: var(--brass); }
.br-stages li.done .br-dot { border-color: var(--brass); color: var(--brass); }
.br-stages li.lost .br-dot { border-color: var(--bad); color: var(--bad); }
.br-stages li.next { opacity: 0.6; }
.br-champ { display: flex !important; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.br-champ .trophy { width: 22px; height: 22px; margin-left: -1px; position: relative; z-index: 1; filter: grayscale(1) brightness(0.7); }
.br-champ.done { color: var(--brass); }
.br-champ.done .trophy { filter: none; }
/* between stages / end of the tournament */
.tour-end { display: grid; gap: 12px; }
.tour-end .bracket { background: rgba(0, 0, 0, 0.2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.tour-end.champ > .trophy { width: 84px; height: 84px; justify-self: center; animation: trophy-pop 0.6s steps(4) both; }
@keyframes trophy-pop { from { transform: scale(0.3) rotate(-12deg); } to { transform: none; } }
.tour-money { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }
.tour-money span { border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; color: #c9d0e3; }
.tour-money span.out { opacity: 0.55; text-decoration: line-through; }
.tour-money b { font-family: var(--mono); color: var(--brass); }
@media (max-width: 640px) {
  .tour-end .bracket { padding: 8px; }
  .tour-end.champ > .trophy { width: 64px; height: 64px; }
}
/* right column: bracket, coach, log heading, log list (the list takes the rest) */
.log { grid-template-rows: auto auto auto minmax(0, 1fr); }

/* ---------- main pot + side pots ---------- */
.potbox.split { gap: 3px; align-content: center; justify-items: center; width: 100%; text-align: center; }
.pot-line { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 0 8px; width: 100%; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line); font-size: 12px; color: var(--muted); text-align: center; }
.pot-line b { font-family: var(--display); font-size: 20px; line-height: 1; color: var(--ink); }
.pot-line small { flex-basis: 100%; font-size: 10px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pot-line.mine { border-color: var(--brass); background: var(--brass-dim); color: var(--brass); }
.pot-line.mine b { color: var(--brass); }
.pot-you { font-size: 12px; color: var(--ink); text-align: center; }
.pot-you b { color: var(--brass); font-family: var(--mono); }
.pot-you.none { color: var(--muted); }
@media (max-width: 640px) {
  .pot-line { padding: 1px 4px; font-size: 9px; column-gap: 3px; }
  .pot-line b { font-size: 14px; }
  .pot-line small { display: none; }
  .pot-you { font-size: 9px; line-height: 1.2; }
}
.save-hint { margin: 0; font-size: 12px; color: var(--muted); }
@media (min-width: 641px) and (max-width: 1180px) {
  body[data-tutorial="on"] .actions .prompt { display: none; } /* the coach beside it says what to do */
}
@media (max-width: 640px) {
  .hud { gap: 2px 6px; }
  .hud .btn-ghost { padding: 3px 7px; font-size: 12px; }
  .hud select { padding: 2px 2px; }
}

/* ---------- game pot (Classic style) ---------- */
.potbox.gamepot .pot-amount { color: var(--immune); }
.potbox.gamepot .zone-label { color: var(--immune); }
@media (max-width: 640px) {
  .potbox.gamepot .pot-amount { font-size: 22px; }
}
