/* Nochips: same design language as Overpair. Paper and ink, one orange accent, hard 1.5px rules,
   Inter Tight for words and JetBrains Mono for every number. */
:root {
  --bg: #ffffff;
  --ink: #111111;
  --muted: #555555;
  --line: #d4d4d4;
  --hair: #e2e2e2;
  --tint: #f4f4f4;
  --accent: #ff5a1f;
  --red: #c41e16;
  --green: #17803f;
  --on-ink: #ffffff;
  --on-ink-dim: #cfcfcf;
  --dim: #767676;
  --accent-text: #c2410c; /* orange dark enough to read as small text on white */
  --warm: #fff1ea;
  --shade: rgba(17, 17, 17, 0.4);
  --rule: 1.5px solid var(--ink);
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light dark;
  font-family: 'Inter Tight', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --ink: #ededed;
    --muted: #a6a6a6;
    --line: #333333;
    --hair: #2a2a2a;
    --tint: #1c1c1c;
    --red: #ff5a52;
    --green: #3fbf6f;
    --on-ink: #121212;
    --on-ink-dim: #444444;
    --dim: #8c8c8c;
    --accent-text: #ff5a1f;
    --warm: #2e1a12;
    --shade: rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { overscroll-behavior: none; }
body { margin: 0; background: var(--bg); }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; padding: 0; }
button:disabled { opacity: 0.4; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* Buttons */
.btn { border: var(--rule); padding: 0 16px; min-height: 48px; font-size: 16px; font-weight: 600; display: inline-flex; align-items: center; justify-content: space-between; gap: 12px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #111; }
.btn.big { min-height: 64px; padding: 0 20px; font-size: 18px; width: 100%; }
.btn.centered { justify-content: center; }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; }
.icon-btn.boxed { border: var(--rule); }
.text-btn { font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }

/* Inputs */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field input, .input { border: var(--rule); background: var(--bg); padding: 12px; font: inherit; font-size: 16px; color: var(--ink); width: 100%; min-width: 0; border-radius: 0; outline: none; -webkit-appearance: none; }
.field input:focus, .input:focus { border-color: var(--accent); outline: none; }
.code-input { font-family: var(--mono); font-size: 28px !important; font-weight: 700; letter-spacing: 0.35em; text-transform: uppercase; text-align: center; padding: 10px 12px !important; }
.code-input::placeholder { letter-spacing: 0.35em; color: var(--dim); }
input::placeholder { color: var(--dim); }
input[type='number'], input[inputmode='decimal'] { font-family: var(--mono); }

/* Shell */
.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 0 16px; padding-top: env(safe-area-inset-top); min-height: 56px; border-bottom: var(--rule); position: sticky; top: 0; background: var(--bg); z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; color: inherit; text-decoration: none; }
.mark { width: 20px; height: 20px; flex: none; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.code-btn { height: 40px; padding: 0 12px; border: var(--rule); font-family: var(--mono); font-weight: 700; letter-spacing: 0.1em; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.code-btn svg.i { width: 16px; height: 16px; }

/* Home */
.home { flex: 1; display: flex; flex-direction: column; }
.hero { padding: 40px 20px 32px; border-bottom: var(--rule); }
.hero h1 { margin: 0; font-size: 52px; line-height: 0.98; letter-spacing: -0.035em; font-weight: 700; }
.hero p { margin: 18px 0 0; font-size: 19px; line-height: 1.4; color: var(--muted); max-width: 30ch; }
.block { padding: 24px 20px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.block h2 { margin: 0; font-size: 13px; font-weight: 500; color: var(--muted); }
.resume { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: var(--rule); background: var(--warm); font-weight: 600; width: 100%; text-align: left; }
.resume .num { font-weight: 700; letter-spacing: 0.06em; }
.pair { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.seg-ctl { display: flex; border: var(--rule); }
.seg-ctl button { flex: 1; padding: 12px 6px; font-family: var(--mono); font-size: 15px; font-weight: 500; }
.seg-ctl button + button { border-left: var(--rule); }
.seg-ctl button.on { background: var(--ink); color: var(--on-ink); }
.foot { padding: 20px; font-size: 13px; color: var(--muted); margin-top: auto; }
.back { display: flex; align-items: center; gap: 6px; font-size: 15px; min-height: 44px; }

/* Meta line */
.meta { display: flex; align-items: baseline; gap: 14px; padding: 10px 16px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); }
.meta b { color: var(--ink); font-weight: 600; }
.meta .street { margin-left: auto; color: var(--ink); font-weight: 600; }

/* Table */
.table { position: relative; flex: 1 1 auto; min-height: 420px; min-height: min(420px, 52dvh); } /* short phones: the table shrinks so your seat stays above the buttons */
.felt { position: absolute; inset: 9% 9% 11%; border-radius: 999px; border: var(--rule); }
.at { position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); transform: translate(-50%, -50%); }
.seat { display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--bg); padding: 4px 8px; z-index: 2; text-align: center; transition: opacity 0.2s; }
.seat-name { font-size: 14px; font-weight: 700; white-space: nowrap; max-width: min(96px, 24vw); overflow: hidden; text-overflow: ellipsis; position: relative; padding-bottom: 1px; }
.seat-name .pos { font-weight: 400; color: var(--muted); margin-left: 4px; }
.seat-sub { font-size: 13px; white-space: nowrap; }
.seat-note { font-size: 11px; color: var(--muted); white-space: nowrap; }
.seat.acting .seat-name { box-shadow: inset 0 -2px 0 var(--accent); }
.seat.out .seat-name, .seat.out .seat-sub { color: var(--muted); font-weight: 500; }
.seat.folded { border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.seat.folded .seat-sub { color: var(--muted); }
.seat .off { display: inline-block; width: 6px; height: 6px; border-radius: 50%; border: 1px solid var(--muted); margin-left: 5px; vertical-align: middle; }
.bet { display: flex; align-items: center; gap: 5px; font-size: 13px; border: 1.5px solid var(--ink); border-radius: 999px; padding: 1px 8px 1px 3px; background: var(--bg); white-space: nowrap; z-index: 1; animation: rise 0.22s var(--ease) both; }
.bet.won { border-color: var(--accent); color: var(--accent-text); font-weight: 700; }
.chip-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px dashed var(--ink); flex: none; }
.dealer { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--bg); display: grid; place-items: center; font-size: 12px; font-weight: 700; z-index: 1; transition: left 0.6s var(--ease), top 0.6s var(--ease); }
.center { position: absolute; left: 50%; top: 48%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; width: 62%; z-index: 0; }
.pot { font-size: 14px; color: var(--muted); white-space: nowrap; }
.pot .num { font-size: 30px; font-weight: 700; color: var(--accent); margin-left: 6px; letter-spacing: -0.02em; display: inline-block; }
.pot .num.pop { animation: pop 0.3s var(--ease); }
.news { font-size: 14px; font-weight: 600; line-height: 1.3; animation: rise 0.25s var(--ease) both;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
/* Crowded or narrow tables: smaller seats and chips so neighbours don't overlap. */
.seat.dense { padding: 2px 4px; }
.seat.dense .seat-name { font-size: 12.5px; max-width: min(84px, 22vw); }
.seat.dense .seat-sub { font-size: 12px; }
.seat.dense .seat-note { font-size: 10.5px; }
.bet.dense { font-size: 12px; padding: 0 6px 0 2px; }
.deal-hint { font-size: 13px; font-weight: 600; color: var(--accent-text); border: 1.5px solid var(--accent); padding: 3px 10px; border-radius: 999px; }
.lobby-code { font-family: var(--mono); font-size: 44px; font-weight: 700; letter-spacing: 0.15em; margin-right: -0.15em; line-height: 1; }
.lobby-sub { font-size: 13px; color: var(--muted); }

/* Bottom bar */
.bar { position: sticky; bottom: 0; z-index: 5; background: var(--bg); border-top: var(--rule); padding-bottom: env(safe-area-inset-bottom);
  max-height: 75dvh; overflow-y: auto; overscroll-behavior: contain; } /* a big showdown scrolls inside the bar */
.status { min-height: 64px; display: flex; align-items: center; justify-content: center; font-size: 15px; color: var(--muted); padding: 0 16px; text-align: center; }
.status b { color: var(--ink); }
.for { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; font-size: 13px; border-bottom: 1px solid var(--line); background: var(--warm); }
.sizes { display: flex; height: 56px; border-bottom: 1px solid var(--line); }
.size { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border-right: 1px solid var(--line); transition: background-color 0.15s, color 0.15s; }
.size:last-child { border-right: none; }
.size b { font-size: 16px; font-weight: 600; white-space: nowrap; }
.size span { font-size: 11px; color: var(--muted); font-family: var(--mono); white-space: nowrap; }
.size.on { background: var(--ink); color: var(--on-ink); }
.size.on span { color: var(--on-ink-dim); }
.acts { display: flex; height: 64px; }
.act { flex: 1 1 0; min-width: 0; font-size: 18px; font-weight: 600; border-right: var(--rule); display: flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; transition: background-color 0.15s, transform 0.1s; }
.act:last-child { border-right: none; }
.act.primary { background: var(--accent); color: #111; }
.act:active:not(:disabled) { transform: scale(0.97); }
.act .num { font-weight: 600; }
.deal { width: 100%; min-height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; background: var(--accent); color: #111; font-size: 18px; font-weight: 600; }

/* Raise panel */
.panel { position: absolute; left: 0; right: 0; bottom: 100%; display: flex; flex-direction: column; gap: 14px; padding: 14px 16px 16px; background: var(--bg); border-top: var(--rule); box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.08); }
.panel.enter { animation: rise 0.18s var(--ease) both; }
.panel-head { display: flex; align-items: baseline; gap: 12px; font-size: 14px; color: var(--muted); }
.panel-head .num { font-size: 28px; font-weight: 600; color: var(--ink); }
.panel-head .icon-btn { margin-left: auto; align-self: center; width: 44px; height: 44px; margin-block: -8px; }
.slider { display: flex; align-items: center; gap: 12px; }
.slider input { flex: 1; min-width: 0; height: 32px; accent-color: var(--ink); }
.step { width: 44px; height: 44px; border: var(--rule); font-size: 20px; flex: none; }

/* Showdown */
.pick { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; border-bottom: 1px solid var(--line); }
.pick-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--muted); }
.pick-head .num { color: var(--accent); font-size: 20px; font-weight: 700; }
.who { display: flex; flex-wrap: wrap; gap: 8px; }
.who button { border: var(--rule); padding: 10px 14px; font-weight: 600; font-size: 15px; transition: background-color 0.15s, color 0.15s; }
.who button.on { background: var(--ink); color: var(--on-ink); }

/* Sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.scrim { position: absolute; inset: 0; background: var(--shade); }
.scrim.enter { animation: fade 0.18s ease-out both; }
.sheet { position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--bg); border-left: var(--rule); overflow-y: auto; overscroll-behavior: contain; padding-bottom: env(safe-area-inset-bottom); }
.sheet.enter { animation: slide 0.2s var(--ease) both; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 20px; padding-top: env(safe-area-inset-top); min-height: 56px; border-bottom: var(--rule); position: sticky; top: 0; background: var(--bg); z-index: 1; }
.sheet-head h2 { margin: 0; font-size: 18px; }
.section { padding: 20px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.section h3 { margin: 0; font-size: 13px; font-weight: 500; color: var(--muted); }
.invite { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.invite .num { font-size: 34px; font-weight: 700; letter-spacing: 0.15em; }
.ledger { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; font-size: 15px; }
.ledger > * { padding: 9px 0; border-top: 1px solid var(--line); }
.ledger > .h { font-size: 12px; color: var(--muted); border-top: none; padding-top: 0; }
.ledger .r { text-align: right; padding-left: 18px; }
.ledger .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up { color: var(--green); font-weight: 700; }
.down { color: var(--red); font-weight: 700; }
.people { display: flex; flex-direction: column; }
.person { border-top: 1px solid var(--line); padding: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.person-top { display: flex; align-items: center; gap: 8px; }
.person-top .name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-top .tag { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 6px; }
.tools { display: flex; gap: 6px; flex-wrap: wrap; }
.mini { border: 1px solid var(--dim); min-height: 44px; padding: 6px 12px; font-size: 13px; font-weight: 500; }
.mini.danger { color: var(--red); }
.row-form { display: flex; gap: 8px; }
.row-form .btn { flex: none; }
.row-form .slash { align-self: center; color: var(--muted); font-family: var(--mono); }
.row-form .unit { align-self: center; color: var(--muted); font-size: 14px; white-space: nowrap; }
.note { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.4; }

/* QR invite */
.qr { width: 132px; height: 132px; color: #000; background: #fff; border-radius: 6px; display: block; }
.qr-lg { width: 148px; height: 148px; flex: none; }
.center.lobby { gap: 10px; }
.center.lobby .lobby-code { font-size: 34px; }
.invite { align-items: flex-start; }
.invite-side { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; min-width: 0; }
.meta .conn { color: var(--accent-text); }

/* Settle up */
.pays { display: flex; flex-direction: column; }
.pay { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; }
.pay:last-child { border-bottom: 1px solid var(--line); }
.pay .num { font-weight: 700; }
.ledger .tag { font-size: 12px; color: var(--muted); margin-left: 6px; }
/* Very narrow screens or very big numbers: names get their own line above the numbers. */
.ledger.tight { grid-template-columns: repeat(3, 1fr); }
.ledger.tight > .h:first-child { display: none; }
.ledger.tight .name { grid-column: 1 / -1; padding-bottom: 0; }
.ledger.tight .r { border-top: none; padding-top: 2px; }

/* Hand history */
.hands { display: flex; flex-direction: column; }
.hand { border-top: 1px solid var(--line); }
.hand:last-child { border-bottom: 1px solid var(--line); }
.hand summary { list-style: none; display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: baseline; padding: 11px 0; cursor: pointer; font-size: 15px; }
.hand summary::-webkit-details-marker { display: none; }
.hand[open] summary { box-shadow: inset 0 -1px 0 var(--hair); }
.hn { color: var(--muted); font-size: 13px; }
.hw { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp { color: var(--muted); font-size: 13px; }
.log { margin: 0; padding: 8px 0 12px 46px; list-style: none; font-size: 14px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.log .st { color: var(--ink); font-weight: 600; margin-top: 4px; }

/* Join requests and waiting */
.ask { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: var(--rule); background: var(--warm); font-size: 15px; animation: rise 0.2s var(--ease) both; }
.ask span { flex: 1; min-width: 0; }
.ask-yes { background: var(--accent); color: #111; font-weight: 600; min-height: 44px; padding: 7px 16px; font-size: 14px; }
.waiting { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--muted); padding: 4px 0 8px; }
.spin { animation: spin 1.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Legal pages */
.legal { padding: 28px 20px 40px; font-size: 16px; line-height: 1.6; color: var(--ink); }
.legal h1 { margin: 0; font-size: 36px; line-height: 1.05; letter-spacing: -0.03em; }
.legal .updated { margin: 8px 0 24px; font-size: 13px; color: var(--muted); }
.legal h2 { margin: 28px 0 8px; font-size: 18px; letter-spacing: -0.01em; }
.legal p, .legal ul { margin: 0 0 12px; }
.legal ul { padding-left: 20px; }
.legal li { margin-bottom: 6px; }
.legal a, .foot a, .sheet-legal a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.legal-foot { display: flex; flex-wrap: wrap; gap: 18px; padding: 20px; border-top: var(--rule); font-size: 14px; margin-top: auto; }
.legal-foot a { color: var(--muted); text-decoration: none; }
.legal-foot a:first-child { color: var(--ink); font-weight: 700; margin-right: auto; }
.legal-foot a[aria-current] { color: var(--ink); }
.foot-links { display: flex; gap: 16px; margin-top: 10px; }
.sheet-legal { display: flex; gap: 16px; padding: 16px 20px 24px; font-size: 13px; color: var(--muted); }

.toast:empty { display: none; }
.toast { position: fixed; left: 50%; top: calc(66px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--on-ink); padding: 10px 16px; font-weight: 600; font-size: 14px; max-width: calc(100% - 32px); animation: rise 0.2s var(--ease) both; }
.loading { flex: 1; display: grid; place-items: center; color: var(--muted); font-size: 14px; }

@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
@keyframes pop { from { transform: scale(1.3); } }
.bet.at { animation-name: rise-at; }
@keyframes rise-at { from { opacity: 0; transform: translate(-50%, calc(-50% + 4px)); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Read out by screen readers, not shown. */
.table { overflow-x: clip; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (orientation: landscape) { .app { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); } }
