/* Phone first. Everything is sized for a thumb, and the table never scrolls sideways. */
:root {
  --bg: #121413; --panel: #1c1f1d; --panel-2: #262a27; --line: #39403b;
  --text: #f4efe3; --muted: #a8ad9f; --gold: #d6b35f; --gold-ink: #231b05;
  --felt: #125239; --felt-edge: #0b3626; --danger: #d9534f; --ok: #6fce92;
  --tap: 48px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
body { font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select { font: inherit; color: inherit; touch-action: manipulation; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 8px; }
p { margin: 8px 0; }
a { color: var(--gold); }
ul { list-style: none; padding: 0; margin: 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.err { color: #ffb3ae; margin: 6px 0; font-size: 15px; }
.ok { color: var(--ok); margin: 6px 0; }
.selectable { user-select: all; }

.page { max-width: 560px; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.page.narrow { max-width: 400px; min-height: 100dvh; justify-content: center; }
.brand { text-align: center; margin-bottom: 8px; }
.brand img { border-radius: 16px; }
.brand h1 { font-size: 30px; color: var(--gold); margin-top: 8px; }
.under { text-align: center; color: var(--muted); }
.top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; min-height: var(--tap); }
.top > :last-child { justify-self: end; }
.top > :first-child { justify-self: start; }
.top h1:first-child { color: var(--gold); }
.foot { display: flex; justify-content: center; gap: 24px; margin-top: 12px; }
.section { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; margin: 12px 0 0; }

.btn { min-height: var(--tap); padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); font-weight: 600; cursor: pointer; }
.btn:active:not(:disabled) { filter: brightness(1.2); }
.btn:disabled { opacity: .45; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.btn.big { min-height: 56px; width: 100%; font-size: 18px; }
.btn.small { min-height: 40px; padding: 0 12px; font-size: 14px; }
.btn.icon { width: 40px; padding: 0; font-size: 18px; }
.link { background: none; border: 0; color: var(--gold); min-height: var(--tap); padding: 0 4px; cursor: pointer; font-size: 16px; }
.notice { display: block; width: 100%; padding: 12px 14px; border-radius: 10px; background: #3a300f; border: 1px solid var(--gold); color: var(--gold); font-weight: 600; text-align: left; cursor: pointer; }
.notice.static { cursor: default; margin: 0 0 10px; }
.count { display: inline-block; min-width: 20px; height: 20px; padding: 0 5px; margin-left: 6px; border-radius: 10px; background: var(--gold); color: var(--gold-ink); font-size: 13px; line-height: 20px; text-align: center; }

.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
/* 16px stops iPhones zooming the page when an input gets focus. */
input:not([type=checkbox]):not([type=range]):not([type=color]), select { width: 100%; min-height: var(--tap); padding: 0 12px; font-size: 16px; color: var(--text); background: #0e100f; border: 1px solid var(--line); border-radius: 10px; }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.toggle { display: flex; align-items: center; gap: 10px; min-height: var(--tap); }
.toggle input { width: 22px; height: 22px; accent-color: var(--gold); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card.center { text-align: center; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { flex: 1; min-height: var(--tap); background: transparent; border: 0; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--gold); color: var(--gold-ink); }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.preview { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.join-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.join-row input { text-transform: uppercase; letter-spacing: .15em; }
.rows { display: flex; flex-direction: column; gap: 8px; }
.row-btn { display: block; width: 100%; text-align: left; padding: 12px 14px; min-height: 60px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.row-btn.current { border-color: var(--gold); }
.game-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.row-delete { color: #ffb3ae; padding: 0 12px; font-size: 14px; }
.danger { color: #ffb3ae !important; }
.link.wide { display: block; width: 100%; text-align: center; }
.row-main { display: block; font-weight: 600; }
.row-sub { display: block; font-size: 13px; color: var(--muted); }
.row-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.seat-row { flex-direction: row; align-items: center; justify-content: space-between; }
.seat-name { min-width: 0; flex: 1; }
.seat-name .row-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-tools { display: flex; align-items: center; gap: 4px; }
input.mini { width: 74px !important; min-height: 40px !important; padding: 0 6px !important; text-align: right; }
.sticky-foot { position: sticky; bottom: 0; padding: 10px 0 calc(6px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 25%); }

.levels { display: flex; flex-direction: column; gap: 4px; }
.lvl { display: grid; grid-template-columns: 24px repeat(3, minmax(0, 1fr)); gap: 6px; align-items: center; }
.lvl.head { font-size: 12px; color: var(--muted); }
.lvl input { min-height: 40px !important; padding: 0 8px !important; }
.denoms { display: flex; flex-direction: column; gap: 8px; }
.denoms li { display: grid; grid-template-columns: 40px 80px 1fr; gap: 8px; align-items: center; }
.colour { width: 40px; height: 40px; border-radius: 50%; border: 3px dashed rgba(255,255,255,.55); overflow: hidden; }
.colour input { opacity: 0; width: 100%; height: 100%; }

.invite { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.code { font: 700 36px/1 ui-monospace, Menlo, monospace; letter-spacing: .14em; color: var(--gold); margin: 4px 0 0; user-select: all; }
.qr { background: #fff; border-radius: 10px; }

/* --- The table: one screen, no scrolling --- */
.table-page { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; padding-top: env(safe-area-inset-top); max-width: 560px; margin: 0 auto; }
.bar { display: flex; align-items: center; gap: 6px; padding: 4px 8px; flex: none; }
.bar .link { font-size: 28px; padding: 0 8px; }
.bar-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.bar-title .muted { font-size: 12px; }
.ribbon { flex: none; display: flex; justify-content: center; align-items: center; gap: 10px; padding: 6px 10px; background: #3a300f; color: var(--gold); font-size: 14px; text-align: center; }

.felt-wrap { position: relative; flex: 1; min-height: 0; margin: 2px 6px; container-type: size; }
.felt { position: absolute; inset: 7% 6%; border-radius: 50%; background: radial-gradient(ellipse at center, #1a6b4b, var(--felt) 60%, var(--felt-edge)); border: 5px solid #3a2a16; box-shadow: inset 0 0 0 2px rgba(214,179,95,.3), 0 6px 18px rgba(0,0,0,.5); }
.centre { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 52%; text-align: center; pointer-events: none; }
.pot-label { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: #c9dccf; }
.pot { font-size: 38px; font-weight: 800; line-height: 1.05; color: var(--gold); font-variant-numeric: tabular-nums; }
.side-pots { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 8px; font-size: 12px; color: #e6efe8; }
.side-pots .paid { text-decoration: line-through; opacity: .6; }
.blinds { font-size: 13px; color: #c9dccf; }
.clock { font-size: 12px; color: var(--gold); font-variant-numeric: tabular-nums; }

.seat { position: absolute; transform: translate(-50%, -50%); width: 86px; padding: 3px 5px 4px; border-radius: 10px; background: rgba(17,19,18,.93); border: 1px solid var(--line); text-align: center; line-height: 1.15; z-index: 2; }
.seat.mine { border-color: var(--gold); }
.seat.turn { border-color: #ffe08a; box-shadow: 0 0 0 2px #ffe08a, 0 0 18px 5px rgba(255,214,102,.75); z-index: 3; }
.seat.folded { opacity: .5; }
.seat-top { display: flex; align-items: center; justify-content: center; gap: 4px; }
.seat-who { font-size: 12px; }
.seat-chips { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.seat-tag { font-size: 10px; color: var(--gold); text-transform: uppercase; letter-spacing: .03em; }
.seats-many .seat { width: 76px; padding: 2px 3px 3px; }
.seats-many .seat-chips { font-size: 15px; }
.dot { flex: none; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #6d6f6a; }
.dot.on { background: var(--ok); }
.button-puck { position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%; background: #f4efe3; color: #111; font-size: 12px; font-weight: 800; line-height: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.6); }
.bet { position: absolute; left: 50%; top: 50%; padding: 1px 7px; border-radius: 10px; background: #0b2b1f; border: 1px solid var(--gold); color: var(--gold); font-size: 13px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; z-index: 4; }

.fly { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 2px dashed rgba(255,255,255,.75); z-index: 5; animation: fly .42s ease-in forwards; pointer-events: none; }
@keyframes fly { to { transform: translate(var(--tx), var(--ty)); opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .fly { display: none; } }

.dock { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 6px 10px calc(10px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); }
.me-line { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; min-height: 30px; }
.me-chips { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.undo-row { display: flex; gap: 6px; }
.undo { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; text-align: left; color: var(--gold); }
.undo span { font-weight: 400; color: var(--text); }
.waiting { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: var(--muted); padding: 4px 0; font-size: 15px; }
.waiting strong { color: var(--text); }
.waiting .btn { color: var(--text); }
.waiting.row { flex-direction: row; justify-content: center; gap: 10px; min-height: 40px; padding: 0; }
.winner { font-size: 20px; color: var(--gold) !important; }
.banner { text-align: center; font-weight: 700; color: var(--gold); padding: 2px 0; }
.banner.yours { background: var(--gold); color: var(--gold-ink); border-radius: 8px; padding: 5px 0; font-size: 17px; }
.controls { display: grid; grid-template-columns: 1fr 1.35fr 1fr 1fr; gap: 6px; }
.ctl { min-height: 62px; padding: 0 2px; border-radius: 12px; border: 0; font-size: 16px; font-weight: 700; cursor: pointer; color: #fff; }
.ctl:disabled { opacity: .32; }
.ctl:active:not(:disabled) { filter: brightness(1.2); }
.fold { background: #6a2c2a; }
.call { background: #1f6e49; }
.raise { background: #8a6d1f; }
.allin { background: #5b2f7a; }
.award { display: flex; flex-direction: column; gap: 8px; }
.award-title { text-align: center; }
.award-names { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.pick { min-height: var(--tap); padding: 0 16px; border-radius: 24px; border: 1px solid var(--line); background: var(--panel-2); font-weight: 600; cursor: pointer; }
.pick.on { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }

.stack { display: flex; align-items: flex-end; gap: 3px; min-width: 0; overflow: hidden; }
.col { display: flex; flex-direction: column-reverse; align-items: center; }
.disc { display: block; width: 24px; height: 8px; margin-top: -3px; border-radius: 50%/45%; border: 1.5px dashed rgba(255,255,255,.7); box-shadow: 0 1px 0 rgba(0,0,0,.6); }
.times { font-size: 11px; color: var(--muted); line-height: 1.1; order: 9; margin-bottom: 2px; }
.rem { font-size: 12px; color: var(--muted); }
.stack-sm .disc { width: 20px; height: 7px; }

.sheet-wrap { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.55); }
.sheet { width: 100%; max-width: 560px; max-height: 88dvh; display: flex; flex-direction: column; background: var(--panel); border-radius: 18px 18px 0 0; border: 1px solid var(--line); border-bottom: 0; animation: rise .16s ease-out; }
@keyframes rise { from { transform: translateY(24px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 4px 16px; }
.sheet-head h2 { margin: 0; font-size: 18px; }
.close { width: var(--tap); height: var(--tap); background: none; border: 0; font-size: 28px; color: var(--muted); cursor: pointer; }
.sheet-body { padding: 4px 16px calc(16px + env(safe-area-inset-bottom)); overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 10px; }
.menu button { width: 100%; min-height: 54px; padding: 0 4px; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); font-size: 17px; cursor: pointer; }
.raise-amount input { font-size: 36px !important; font-weight: 800; min-height: 64px !important; text-align: center; color: var(--gold) !important; }
.slider { width: 100%; height: 36px; accent-color: var(--gold); }
.chip-pad { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip-btn { width: 54px; height: 54px; border-radius: 50%; border: 3px dashed rgba(255,255,255,.75); color: #fff; font-size: 14px; font-weight: 700; text-shadow: 0 1px 2px #000; cursor: pointer; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.quick .btn { padding: 0; }
.sheet-wrap.follow .sheet { height: min(72dvh, 100%); max-height: 100%; }
.sheet-wrap.follow .sheet-body { flex: 1; min-height: 0; overflow: hidden; }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 6px; padding: 2px 0; }
.chat-msg { align-self: flex-start; max-width: 84%; padding: 6px 10px; border-radius: 12px; background: var(--panel-2); display: flex; flex-direction: column; overflow-wrap: anywhere; }
.chat-msg.mine { align-self: flex-end; background: #3a300f; }
.chat-name { font-size: 12px; font-weight: 700; color: var(--gold); }
.chat-time { font-size: 11px; color: var(--muted); align-self: flex-end; }
.chat-form { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.chat-toast { flex: none; display: flex; gap: 6px; align-items: center; min-height: 36px; padding: 0 12px; background: #3a300f; border: 0; color: var(--text); font-size: 14px; text-align: left; cursor: pointer; }
.chat-toast b { flex: none; color: var(--gold); }
.feed li { padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; font-size: 15px; }
.feed small { color: var(--muted); }
.feed .undone span { text-decoration: line-through; color: var(--muted); }

.ledger { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ledger-row { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(4, minmax(0, 1fr)); gap: 4px; padding: 10px; font-size: 14px; font-variant-numeric: tabular-nums; border-top: 1px solid var(--line); text-align: right; }
.ledger-row > :first-child { text-align: left; font-weight: 600; }
.ledger-row.head { background: var(--panel); color: var(--muted); font-size: 12px; border-top: 0; }
.up { color: var(--ok); }
.down { color: #ffb3ae; }

/* Short phones: tighter still, so the buttons stay on screen. */
@media (max-height: 640px) {
  .pot { font-size: 30px; }
  .ctl { min-height: 50px; }
  .me-line { min-height: 0; }
  .me-line .stack { display: none; }
  .me-chips { font-size: 18px; }
  .seat-tag { display: none; }
  .bar { padding: 0 6px; }
}
/* The smallest phones with a full table. */
@media (max-width: 340px) {
  .seats-many .seat { width: 66px; padding: 1px 2px 2px; }
  .seats-many .seat-who { font-size: 11px; }
  .seats-many .seat-chips { font-size: 14px; }
  .pot { font-size: 28px; }
  .btn.small { padding: 0 8px; }
  .bar { gap: 3px; }
  .bar .btn.small { padding: 0 6px; font-size: 13px; }
}
