/* Small Blind — smallblindpoker.com */

/* Archivo (SIL Open Font License), self-hosted. Variable weight 100–900 and width 62–125%. */
@font-face {
  font-family: 'Archivo'; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url(/fonts/archivo-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Archivo'; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url(/fonts/archivo-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --chalk: #EAEEE7;
  --paper: #FFFFFF;
  --ink: #142620;
  --ink-2: #4D5E57;
  --ink-3: #7D8B85;
  --line: #D3DBD2;
  --line-2: #E3E8E1;
  --felt: #1E5E47;
  --felt-hover: #184F3B;
  --felt-deep: #163A2E;
  --felt-wash: #DCE9E1;
  --red: #C8372D;
  --red-hover: #AE2D24;
  --brass: #E3A93B;
  --brass-deep: #B9821C;
  --blue: #2D6BAD;
  --good: #1C8A54;
  --bad: #C8372D;

  --room: #0E241C;
  --room-2: #13302A;
  --rail: #3A2A1E;
  --felt-table: #276D53;
  --felt-table-2: #1D5641;
  --on-dark: #F1F4EF;
  --on-dark-2: #A9BAB2;
  --on-dark-3: #6F857B;

  --suit-s: #15211C;
  --suit-h: #C8372D;
  --suit-d: #C8372D;
  --suit-c: #15211C;

  --radius-panel: 16px;
  --radius-input: 10px;
  --shadow-panel: 0 1px 0 rgba(20, 38, 32, .04), 0 8px 24px -12px rgba(20, 38, 32, .18);
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
body.four-color { --suit-d: #2D6BAD; --suit-c: #1C7A45; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--ink);
  background: var(--chalk); font-variation-settings: 'wdth' 100;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
body.dark-page { background: var(--room); color: var(--on-dark); }
a { color: var(--felt); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
h1, h2, h3 { margin: 0; line-height: 1.1; letter-spacing: -0.02em; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

/* ───────── Buttons & inputs ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 999px; border: 0; cursor: pointer;
  font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap;
  background: var(--felt); color: #fff; transition: background .15s, transform .05s, opacity .15s;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { background: var(--felt-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.red { background: var(--red); }
.btn.red:hover { background: var(--red-hover); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost:hover { background: rgba(20, 38, 32, .05); }
.btn.quiet { background: transparent; color: var(--ink-2); padding: 0 12px; }
.btn.quiet:hover { background: rgba(20, 38, 32, .06); color: var(--ink); }
.btn.small { min-height: 34px; padding: 0 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.light { background: #fff; color: var(--ink); }
.btn.light:hover { background: #F2F5F1; }

.field { display: grid; gap: 6px; }
.field > span { font-size: 14px; font-weight: 650; color: var(--ink); }
.field small { color: var(--ink-3); font-size: 13px; }
.input, select.input {
  width: 100%; min-height: 46px; padding: 0 14px; border-radius: var(--radius-input);
  border: 1.5px solid var(--line); background: var(--paper); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--felt); box-shadow: 0 0 0 3px rgba(30, 94, 71, .18); }
.input.invalid { border-color: var(--red); }
.form-error { color: var(--red); font-size: 14px; font-weight: 600; min-height: 0; }
.form-error:empty { display: none; }

.segmented { display: flex; background: var(--line-2); border-radius: 999px; padding: 4px; gap: 4px; }
.segmented button {
  flex: 1; min-height: 38px; border: 0; border-radius: 999px; background: transparent; cursor: pointer;
  font-weight: 650; color: var(--ink-2);
}
.segmented button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.switch-row:first-child { border-top: 0; }
.switch-row b { display: block; font-weight: 650; font-size: 15px; }
.switch-row span { color: var(--ink-2); font-size: 13.5px; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: #C3CCC5; transition: background .15s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + i { background: var(--felt); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 3px solid var(--brass); outline-offset: 2px; }

/* ───────── Brand ───────── */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-word { font-weight: 800; font-size: 19px; letter-spacing: -0.03em; font-variation-settings: 'wdth' 118; }

/* ───────── App shell ───────── */
.topbar {
  position: sticky; top: 0; z-index: 20; background: rgba(234, 238, 231, .9); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line); padding-top: var(--safe-t);
}
.topbar-inner { max-width: 1120px; margin: 0 auto; padding: 0 20px; height: 62px; display: flex; align-items: center; gap: 24px; }
.topnav { display: flex; gap: 4px; margin-left: 12px; }
.topnav a { padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--ink-2); font-weight: 650; font-size: 15px; position: relative; }
.topnav a:hover { color: var(--ink); background: rgba(20,38,32,.05); }
.topnav a[aria-current="page"] { color: var(--ink); background: var(--paper); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.topbar .spacer { flex: 1; }
.me-btn { display: flex; align-items: center; gap: 10px; border: 0; background: none; cursor: pointer; padding: 4px 6px 4px 4px; border-radius: 999px; font-weight: 650; }
.me-btn:hover { background: rgba(20,38,32,.06); }
.badge-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }

.tabbar { display: none; }
.page { max-width: 1120px; margin: 0 auto; padding: 32px 20px 64px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head h1 { font-size: clamp(28px, 4vw, 38px); font-weight: 800; font-variation-settings: 'wdth' 112; }
.page-head p { color: var(--ink-2); margin-top: 6px; }

.panel { background: var(--paper); border-radius: var(--radius-panel); box-shadow: var(--shadow-panel); padding: 24px; }
.panel h2 { font-size: 20px; font-weight: 750; margin-bottom: 4px; }
.panel .lede { color: var(--ink-2); font-size: 15px; margin-bottom: 18px; }
.empty { color: var(--ink-2); font-size: 15px; padding: 8px 0; }

@media (max-width: 760px) {
  .topnav, .topbar .me-name { display: none; }
  .topbar-inner { height: 56px; }
  .tabbar {
    display: flex; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; padding-bottom: var(--safe-b);
    background: rgba(255,255,255,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  }
  .tabbar a { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 8px 0 7px; text-decoration: none; color: var(--ink-3); font-size: 11.5px; font-weight: 650; position: relative; }
  .tabbar a svg { width: 24px; height: 24px; }
  .tabbar a[aria-current="page"] { color: var(--felt); }
  .tabbar .badge-dot { top: 6px; right: calc(50% - 16px); }
  .page { padding: 22px 16px calc(96px + var(--safe-b)); }
  .panel { padding: 20px; }
}

/* ───────── Avatars ───────── */
.avatar { position: relative; flex: none; border-radius: 50%; overflow: hidden; display: grid; place-items: center; color: #fff; font-weight: 800; user-select: none; }
.avatar svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.avatar b { position: relative; font-variation-settings: 'wdth' 110; line-height: 1; }

/* ───────── Landing ───────── */
.landing { min-height: 100vh; display: flex; flex-direction: column; background: var(--chalk); }
.landing-top { max-width: 1180px; width: 100%; margin: 0 auto; padding: calc(18px + var(--safe-t)) 24px 0; display: flex; align-items: center; justify-content: space-between; }
.landing-top nav { display: flex; gap: 8px; }
.hero { max-width: 1180px; width: 100%; margin: 0 auto; padding: 56px 24px 40px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 48px; align-items: center; }
.hero h1 {
  font-size: clamp(44px, 7.4vw, 96px); font-weight: 850; letter-spacing: -0.045em; line-height: .92;
  font-variation-settings: 'wdth' 122;
}
.hero-copy p { font-size: 19px; color: var(--ink-2); margin: 24px 0 32px; max-width: 30em; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-actions .btn { min-height: 52px; padding: 0 26px; font-size: 16px; }
.hero-note { margin-top: 18px; font-size: 14px; color: var(--ink-3); }
.hero-table { position: relative; aspect-ratio: 1.45; }
.how { max-width: 1180px; width: 100%; margin: 0 auto; padding: 24px 24px 80px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.how li { list-style: none; border-top: 2px solid var(--ink); padding-top: 16px; }
.how ol { display: contents; }
.how b { display: block; font-size: 15px; font-weight: 800; margin-bottom: 6px; font-variation-settings: 'wdth' 110; }
.how b span { color: var(--red); margin-right: 8px; font-variant-numeric: tabular-nums; }
.how p { color: var(--ink-2); font-size: 15.5px; max-width: 26em; }
.landing-foot { margin-top: auto; border-top: 1px solid var(--line); }
.landing-foot div { max-width: 1180px; margin: 0 auto; padding: 22px 24px calc(22px + var(--safe-b)); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--ink-3); font-size: 14px; }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 32px; gap: 36px; }
  .hero-copy p { font-size: 17px; }
  .how { grid-template-columns: 1fr; gap: 22px; padding-bottom: 56px; }
}

/* Decorative table on the landing page */
.demo-table { position: absolute; inset: 0; }
.demo-felt {
  position: absolute; inset: 9% 6%; border-radius: 999px;
  background: radial-gradient(ellipse at 50% 42%, #2F7C5E 0%, var(--felt-table) 45%, var(--felt-table-2) 100%);
  box-shadow: 0 0 0 10px #2D1F15, 0 0 0 12px #4A3524, 0 30px 60px -20px rgba(14, 36, 28, .55), inset 0 0 40px rgba(0,0,0,.35);
}
.demo-felt::after { content: ''; position: absolute; inset: 7%; border-radius: 999px; border: 1.5px solid rgba(255,255,255,.08); }
.demo-board { position: absolute; left: 50%; top: 47%; transform: translate(-50%, -50%); display: flex; gap: 5px; }
.demo-pot { position: absolute; left: 50%; top: 32%; transform: translate(-50%, -50%); color: var(--on-dark); font-weight: 700; font-size: 13px; background: rgba(0,0,0,.28); border-radius: 999px; padding: 3px 12px; }
.demo-seat { position: absolute; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 4px; }
.demo-seat .nameplate { background: #fff; color: var(--ink); border-radius: 10px; padding: 3px 10px; font-size: 12px; text-align: center; box-shadow: 0 4px 10px -4px rgba(0,0,0,.4); line-height: 1.25; }
.demo-seat .nameplate b { display: block; font-size: 12.5px; }
.demo-seat .nameplate span { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.demo-seat.turn .avatar { box-shadow: 0 0 0 3px var(--brass); }
.demo-chip { position: absolute; transform: translate(-50%, -50%); }

/* ───────── Auth ───────── */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px calc(32px + var(--safe-b)); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand { margin-bottom: 28px; }
.auth-card h1 { font-size: 30px; font-weight: 800; font-variation-settings: 'wdth' 112; margin-bottom: 6px; }
.auth-card .sub { color: var(--ink-2); margin-bottom: 24px; }
.auth-card form { display: grid; gap: 16px; }
.auth-alt { margin-top: 20px; color: var(--ink-2); font-size: 15px; text-align: center; }
.auth-links { display: flex; justify-content: flex-end; margin-top: -6px; }
.auth-links a { font-size: 14px; }

/* ───────── Lobby ───────── */
.lobby { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.lobby-main { display: grid; gap: 20px; }
.lobby-side { display: grid; gap: 20px; }
.join-row { display: flex; gap: 10px; }
.code-input {
  flex: 1; min-width: 0; min-height: 58px; text-transform: uppercase; text-align: center;
  font-size: 26px; font-weight: 800; letter-spacing: .32em; padding-left: .32em;
  font-variation-settings: 'wdth' 110; font-variant-numeric: tabular-nums;
}
.code-input::placeholder { color: #BAC5BE; letter-spacing: .32em; }
.join-row .btn { min-height: 58px; padding: 0 26px; }
.open-panel { background: var(--felt-deep); color: var(--on-dark); position: relative; overflow: hidden; }
.open-panel h2 { color: #fff; }
.open-panel .lede { color: var(--on-dark-2); }
.open-panel { display: flex; align-items: flex-end; gap: 16px; }
.open-panel .open-copy { flex: 1; min-width: 0; }
.open-panel .lede { text-wrap: pretty; }
.open-panel .chips-art { flex: none; margin: 0 4px -6px 0; pointer-events: none; }
.open-panel .chips-art svg { width: 202px; height: auto; }
@media (max-width: 640px) { .open-panel .chips-art svg { width: 116px; } .open-panel .chips-art { margin-right: -6px; } }
@media (max-width: 360px) { .open-panel .chips-art { display: none; } }
.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.list-item:first-child { border-top: 0; padding-top: 4px; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .meta { color: var(--ink-2); font-size: 14px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #B9C3BD; flex: none; }
.status-dot.on { background: var(--good); box-shadow: 0 0 0 3px rgba(28,138,84,.16); }
@media (max-width: 900px) { .lobby { grid-template-columns: 1fr; } }
.bots-form { display: grid; gap: 16px; }
.bot-count { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.bot-count button {
  min-height: 44px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--paper); cursor: pointer;
  font-weight: 750; font-size: 16px; font-variant-numeric: tabular-nums; color: var(--ink-2);
}
.bot-count button:hover { border-color: var(--felt); color: var(--ink); }
.bot-count button[aria-pressed="true"] { background: var(--felt); border-color: var(--felt); color: #fff; }
@media (max-width: 560px) { .bots-form .grid-2 { grid-template-columns: 1fr; } }

/* ───────── Sheets / modals ───────── */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(10, 22, 18, .5); display: grid; place-items: center; padding: 16px; animation: fade .15s ease-out; }
.sheet {
  width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; background: var(--paper); color: var(--ink);
  border-radius: 20px; box-shadow: 0 24px 60px -20px rgba(0,0,0,.45); animation: rise .2s cubic-bezier(.2,.8,.2,1);
}
.sheet-head { position: sticky; top: 0; background: var(--paper); z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 12px 24px; }
.sheet-head h2 { font-size: 21px; font-weight: 800; font-variation-settings: 'wdth' 110; }
.sheet-body { padding: 4px 24px 24px; display: grid; gap: 18px; }
.sheet-foot { position: sticky; bottom: 0; background: var(--paper); padding: 14px 24px calc(18px + var(--safe-b)); border-top: 1px solid var(--line-2); display: flex; gap: 10px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 0; background: transparent; cursor: pointer; color: inherit; flex: none; }
.icon-btn:hover { background: rgba(127,127,127,.14); }
.icon-btn svg { width: 22px; height: 22px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.group-label { font-size: 14px; font-weight: 750; color: var(--ink); margin-bottom: -6px; }
@media (max-width: 640px) {
  .scrim { place-items: end center; padding: 0; }
  .sheet { max-width: none; border-radius: 20px 20px 0 0; max-height: 92vh; animation: slideup .22s cubic-bezier(.2,.8,.2,1); }
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes slideup { from { transform: translateY(100%); } }

/* ───────── Toasts ───────── */
#toasts { position: fixed; z-index: 90; left: 50%; transform: translateX(-50%); top: calc(14px + var(--safe-t)); display: grid; gap: 8px; width: min(440px, calc(100% - 24px)); pointer-events: none; }
.toast {
  pointer-events: auto; background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 14px 12px 16px;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.45); display: flex; align-items: center; gap: 12px; font-size: 15px; animation: rise .2s ease-out;
}
.toast.error { background: var(--red); }
.toast .grow { flex: 1; }
.toast .btn { min-height: 34px; padding: 0 14px; font-size: 14px; }

/* ───────── Playing cards ───────── */
.card {
  --w: 46px; width: var(--w); height: calc(var(--w) * 1.4); border-radius: calc(var(--w) * .12);
  background: #FFFEFB; position: relative; flex: none; box-shadow: 0 1px 0 rgba(0,0,0,.08), 0 3px 8px -2px rgba(0,0,0,.4);
  font-weight: 800; line-height: 1; user-select: none;
}
.card .r { position: absolute; left: 8%; top: 6%; font-size: calc(var(--w) * .46); letter-spacing: -0.05em; font-variation-settings: 'wdth' 85; }
.card .s { position: absolute; left: 9%; top: 44%; width: 38%; }
.card .s2 { position: absolute; right: 7%; bottom: 6%; width: 52%; }
.card[data-suit="s"] { color: var(--suit-s); }
.card[data-suit="h"] { color: var(--suit-h); }
.card[data-suit="d"] { color: var(--suit-d); }
.card[data-suit="c"] { color: var(--suit-c); }
.card.back {
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,.18) 0 18%, transparent 19%),
    repeating-linear-gradient(45deg, #A93028 0 4px, #B9372E 4px 8px);
  box-shadow: inset 0 0 0 2px #F6EFE6, inset 0 0 0 3px #A93028, 0 3px 8px -2px rgba(0,0,0,.45);
}
.card.empty-slot { background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.12); }
.card.dim { filter: brightness(.55) saturate(.6); }
.card.win { box-shadow: 0 0 0 2.5px var(--brass), 0 6px 14px -4px rgba(0,0,0,.5); transform: translateY(-4px); }
.card.deal-in { animation: dealin .28s cubic-bezier(.2,.8,.2,1) both; }
@keyframes dealin { from { opacity: 0; transform: translateY(-14px) rotate(-6deg) scale(.9); } }

/* Card flip: the back turns over to show the face. Sized by the same --w as .card. */
.flip { --w: 46px; position: relative; flex: none; width: var(--w); height: calc(var(--w) * 1.4); perspective: 600px; }
.flip > .flip-inner { position: absolute; inset: 0; transform-style: preserve-3d; animation: cardflip .52s cubic-bezier(.3,.7,.3,1) both; }
.flip > .flip-inner > .card { --w: inherit; position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flip > .flip-inner > .card:last-child { transform: rotateY(180deg); }
@keyframes cardflip {
  0% { transform: rotateY(0deg); }
  60% { transform: translateY(-5px) rotateY(200deg); }
  100% { transform: translateY(0) rotateY(180deg); }
}
/* A freshly dealt card stays hidden until its turn and drops onto the felt while it turns over.
   The outer box moves, the two faces fade in (fading the 3D element itself would flatten the flip),
   and the empty slot outline on the outer box stays visible while it waits. */
.flip > .flip-inner, .flip.dealt, .flip.dealt > .flip-inner > .card { animation-delay: var(--d, 0ms); }
.flip.dealt { animation: carddrop .62s ease-out both; animation-delay: var(--d, 0ms); }
.flip.dealt > .flip-inner { animation-duration: .62s; }
.flip.dealt > .flip-inner > .card { animation: cardfade .62s linear both; animation-delay: var(--d, 0ms); }
@keyframes carddrop { from { transform: translateY(-16px); } to { transform: translateY(0); } }
@keyframes cardfade { 0% { opacity: 0; } 18%, 100% { opacity: 1; } }
.board .flip { border-radius: calc(var(--w) * .12); background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.12); }
}

/* ───────── Chips ───────── */
.chipstack { display: inline-flex; align-items: center; gap: 6px; }
.chip-ico { width: 18px; height: 18px; flex: none; }

/* ───────── Table screen ───────── */
.table-screen {
  position: fixed; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); color: var(--on-dark);
  background: radial-gradient(ellipse 120% 80% at 50% 45%, #1A3D31 0%, var(--room) 60%, #0A1C16 100%);
  overflow: hidden;
}
.t-head { display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-t)) 14px 8px; position: relative; z-index: 5; }
.t-head .icon-btn { color: var(--on-dark); }
.t-title { min-width: 0; flex: 1; }
.t-title b { display: block; font-size: 16px; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-title span { display: block; font-size: 13px; color: var(--on-dark-2); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 14px; border-radius: 999px; border: 0; cursor: pointer;
  background: rgba(255,255,255,.1); color: var(--on-dark); font-weight: 800; letter-spacing: .14em; font-variation-settings: 'wdth' 110;
}
.code-chip:hover { background: rgba(255,255,255,.16); }
.code-chip svg { width: 16px; height: 16px; opacity: .8; }
.t-head .host-pill { font-size: 12px; font-weight: 750; padding: 3px 8px; border-radius: 999px; background: var(--brass); color: #2B1E05; }

.t-stage { position: relative; min-height: 0; }
.felt-wrap { position: absolute; inset: 4% 3% 6%; }
.felt {
  position: absolute; inset: 7% 9%; border-radius: 999px;
  background: radial-gradient(ellipse at 50% 40%, #2F7C5E 0%, var(--felt-table) 42%, var(--felt-table-2) 100%);
  box-shadow: 0 0 0 12px #2A1D13, 0 0 0 14px #4A3524, 0 0 0 15px rgba(0,0,0,.4), 0 40px 80px -30px rgba(0,0,0,.7), inset 0 0 60px rgba(0,0,0,.35);
}
.felt::after { content: ''; position: absolute; inset: 6%; border-radius: 999px; border: 1.5px solid rgba(255,255,255,.07); pointer-events: none; }
.felt-logo { position: absolute; left: 50%; top: 70%; transform: translate(-50%, -50%); opacity: .14; font-weight: 850; font-size: 20px; letter-spacing: -0.03em; font-variation-settings: 'wdth' 122; white-space: nowrap; pointer-events: none; }
.center { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 10px; z-index: 2; width: 80%; }
.pot { display: inline-flex; align-items: center; gap: 7px; padding: 4px 14px 4px 6px; border-radius: 999px; background: rgba(0,0,0,.3); font-weight: 750; font-size: 15px; font-variant-numeric: tabular-nums; }
.pot small { color: var(--on-dark-2); font-weight: 600; }
.board { display: flex; gap: 6px; justify-content: center; }
.board .card, .board .flip { --w: clamp(38px, 5.2vw, 58px); }
.board-run2 { margin-top: -2px; }
.board-label { font-size: 11px; font-weight: 700; color: var(--on-dark-2); }
.center-msg { font-size: 14px; color: var(--on-dark); background: rgba(0,0,0,.28); padding: 5px 14px; border-radius: 999px; text-align: center; font-weight: 600; }
.center-msg.win { background: var(--brass); color: #2B1E05; font-weight: 750; }

.seat { position: absolute; transform: translate(-50%, -50%); z-index: 3; width: 112px; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; }
.seat .cards { display: flex; margin-bottom: -16px; position: relative; z-index: 0; height: 46px; }
.seat .cards .card, .seat .cards .flip { --w: 34px; }
.seat .cards > :not(:first-child) { margin-left: -14px; transform: rotate(6deg) translateY(1px); }
.seat .cards > :first-child { transform: rotate(-5deg); }
.seat.folded .cards { opacity: 0; }
.seat .plate {
  position: relative; z-index: 1; width: 100%; background: #F8F6F0; color: var(--ink); border-radius: 12px;
  padding: 5px 8px 5px 5px; display: flex; align-items: center; gap: 7px; box-shadow: 0 6px 14px -6px rgba(0,0,0,.6);
}
.seat .plate .info { min-width: 0; line-height: 1.15; }
/* Bot badge sits on the plate's corner so it never squeezes the name. */
.seat .plate .bot-tag { position: absolute; right: -5px; top: -8px; z-index: 3; padding: 1px 5px; border-radius: 999px; background: #2D3B35; color: #fff; font-size: 9.5px; font-weight: 800; letter-spacing: .05em; line-height: 1.4; }
.player-row .bot-tag { margin-left: 6px; padding: 1px 6px; border-radius: 4px; background: var(--line-2); color: var(--ink-2); font-size: 11px; font-weight: 800; }
.seat .plate b { display: block; font-size: 12.5px; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat .plate .stack { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 650; }
.seat.me .plate { background: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.5), 0 6px 14px -6px rgba(0,0,0,.6); }
.seat.turn .plate { box-shadow: 0 0 0 2.5px var(--brass), 0 0 22px rgba(227,169,59,.45); }
.seat.folded .plate, .seat.out .plate { opacity: .55; }
.seat.winner .plate { box-shadow: 0 0 0 2.5px var(--brass), 0 0 28px rgba(227,169,59,.6); }
.seat .tag {
  position: absolute; left: 50%; top: 100%; transform: translate(-50%, 4px); z-index: 2; white-space: nowrap;
  font-size: 11.5px; font-weight: 750; padding: 2px 9px; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff;
}
.seat .tag.allin { background: var(--red); }
.seat .tag.won { background: var(--brass); color: #2B1E05; }
.seat .tag.hand { background: #fff; color: var(--ink); }
.seat .plate .offline { position: absolute; right: -4px; top: -8px; z-index: 3; font-size: 10.5px; font-weight: 750; background: #3B4A44; color: #fff; padding: 1px 6px; border-radius: 999px; }
.seat .timer { position: absolute; left: 6px; right: 6px; bottom: -5px; height: 4px; border-radius: 4px; background: rgba(0,0,0,.25); overflow: hidden; z-index: 2; }
.seat .timer i { position: absolute; inset: 0; transform-origin: left; background: var(--brass); }
.seat .timer.bank i { background: var(--red); }
.seat .plate .host-crown { position: absolute; left: -5px; top: -7px; z-index: 3; width: 18px; height: 18px; border-radius: 50%; background: var(--brass); display: grid; place-items: center; }
.seat .plate .host-crown svg { width: 11px; height: 11px; }
.seat-empty {
  position: absolute; transform: translate(-50%, -50%); z-index: 3; width: 64px; height: 64px; border-radius: 50%;
  border: 1.5px dashed rgba(255,255,255,.28); background: rgba(0,0,0,.12); color: var(--on-dark-2); font-weight: 750; font-size: 13px; cursor: pointer;
}
.seat-empty:hover { border-color: var(--brass); color: #fff; background: rgba(0,0,0,.22); }
.seat-empty[disabled] { cursor: default; opacity: .45; border-style: dotted; }
.seat-empty[disabled]:hover { border-color: rgba(255,255,255,.28); color: var(--on-dark-2); background: rgba(0,0,0,.12); }

.bet { position: absolute; transform: translate(-50%, -50%); z-index: 2; display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 750; font-variant-numeric: tabular-nums; background: rgba(0,0,0,.32); padding: 2px 9px 2px 3px; border-radius: 999px; }
.dealer { position: absolute; transform: translate(-50%, -50%); z-index: 2; width: 22px; height: 22px; border-radius: 50%; background: #FFFEFB; color: var(--ink); font-size: 11px; font-weight: 850; display: grid; place-items: center; box-shadow: 0 2px 5px rgba(0,0,0,.45), inset 0 0 0 2px #E2DED2; transition: left .35s, top .35s; }
.reaction { position: absolute; transform: translate(-50%, -110%); z-index: 6; font-size: 34px; pointer-events: none; animation: react 2.4s ease-out forwards; filter: drop-shadow(0 4px 6px rgba(0,0,0,.4)); }
@keyframes react { 0% { opacity: 0; transform: translate(-50%, -80%) scale(.6); } 12% { opacity: 1; transform: translate(-50%, -120%) scale(1.1); } 80% { opacity: 1; transform: translate(-50%, -150%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -170%) scale(1); } }

/* Bottom: my cards + actions */
.t-foot { position: relative; z-index: 5; padding: 0 14px calc(12px + var(--safe-b)); display: grid; gap: 10px; }
.my-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; min-height: 0; }
.my-cards { display: flex; gap: 6px; }
.my-cards .card, .my-cards .flip { --w: 58px; }
.my-hand-name { font-size: 13px; color: var(--on-dark-2); font-weight: 650; margin-top: 4px; }
.status-line { font-size: 14px; color: var(--on-dark-2); }
.actions { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 8px; }
.act {
  min-height: 54px; border-radius: 14px; border: 0; cursor: pointer; font-weight: 800; font-size: 16px; line-height: 1.1;
  display: grid; place-items: center; padding: 6px; color: #fff; font-variant-numeric: tabular-nums; transition: filter .12s, transform .05s;
}
.act small { display: block; font-size: 12.5px; font-weight: 650; opacity: .85; }
.act:active { transform: translateY(1px); }
.act:hover { filter: brightness(1.08); }
.act:disabled { opacity: .4; cursor: not-allowed; filter: none; }
.act.fold { background: #3B4A44; }
.act.check { background: var(--blue); }
.act.raise { background: var(--red); }
.act.ghost { background: rgba(255,255,255,.1); }
.raise-panel { background: rgba(8, 22, 17, .92); border-radius: 16px; padding: 12px; display: grid; gap: 10px; box-shadow: 0 -8px 30px -10px rgba(0,0,0,.6); }
.raise-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.raise-presets button { min-height: 36px; border-radius: 10px; border: 0; background: rgba(255,255,255,.1); color: #fff; font-weight: 700; font-size: 13.5px; cursor: pointer; }
.raise-presets button:hover { background: rgba(255,255,255,.18); }
.raise-line { display: flex; align-items: center; gap: 10px; }
.raise-line input[type="range"] { flex: 1; accent-color: var(--red); height: 32px; }
.raise-amt { width: 110px; min-height: 42px; border-radius: 10px; border: 1.5px solid rgba(255,255,255,.2); background: rgba(255,255,255,.06); color: #fff; text-align: center; font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.raise-amt:focus { outline: none; border-color: var(--brass); }
.prompt-bar { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.prompt-bar .btn { min-height: 46px; }

/* Side panel: chat */
.side { position: fixed; z-index: 40; top: 0; bottom: 0; right: 0; width: min(380px, 100%); background: #F8F7F2; color: var(--ink); display: grid; grid-template-rows: auto 1fr auto auto; box-shadow: -20px 0 40px -20px rgba(0,0,0,.5); animation: slidein .2s cubic-bezier(.2,.8,.2,1); }
@keyframes slidein { from { transform: translateX(100%); } }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: calc(12px + var(--safe-t)) 10px 8px 18px; border-bottom: 1px solid var(--line); }
.side-head h2 { font-size: 18px; font-weight: 800; }
.chat-log { overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { font-size: 14.5px; line-height: 1.4; overflow-wrap: anywhere; }
.chat-msg b { font-weight: 750; margin-right: 6px; }
.chat-msg.sys { color: var(--ink-3); font-size: 13px; }
.chat-msg time { color: var(--ink-3); font-size: 12px; margin-left: 4px; }
.react-row { display: flex; gap: 2px; padding: 6px 10px; border-top: 1px solid var(--line); overflow-x: auto; }
.react-row button { font-size: 22px; border: 0; background: none; padding: 4px 6px; border-radius: 8px; cursor: pointer; }
.react-row button:hover { background: rgba(0,0,0,.06); }
.chat-form { display: flex; gap: 8px; padding: 10px 12px calc(12px + var(--safe-b)); }
.chat-form .input { min-height: 42px; border-radius: 999px; }
.chat-badge { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; border-radius: 999px; background: var(--red); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; padding: 0 4px; }

.overlay-card { position: absolute; z-index: 30; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(380px, calc(100% - 32px)); background: #FFFEFB; color: var(--ink); border-radius: 20px; padding: 24px; text-align: center; box-shadow: 0 30px 60px -20px rgba(0,0,0,.6); animation: rise .2s ease-out; }
.overlay-card h2 { font-size: 24px; font-weight: 850; font-variation-settings: 'wdth' 115; margin-bottom: 8px; }
.overlay-card p { color: var(--ink-2); margin-bottom: 18px; }
.overlay-card .row { display: flex; gap: 10px; justify-content: center; }
.places { text-align: left; display: grid; gap: 6px; margin: 4px 0 18px; }
.places div { display: flex; gap: 12px; align-items: center; padding: 8px 12px; border-radius: 10px; background: var(--chalk); font-weight: 650; }
.places div:first-child { background: #F6E7C3; }
.places span { width: 26px; font-weight: 850; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.menu-list { display: grid; }
.menu-list button, .menu-list a {
  display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 0 4px; border: 0; background: none; border-top: 1px solid var(--line-2);
  text-align: left; cursor: pointer; font-weight: 650; font-size: 16px; color: var(--ink); text-decoration: none;
}
.menu-list button:first-child { border-top: 0; }
.menu-list button:hover { color: var(--felt); }
.menu-list .danger { color: var(--red); }
.menu-list svg { width: 22px; height: 22px; color: var(--ink-2); }
.menu-list .note { margin-left: auto; color: var(--ink-3); font-weight: 600; font-size: 14px; }

.player-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.player-row:first-child { border-top: 0; }
.player-row .grow { flex: 1; min-width: 0; }
.player-row .grow b { display: block; }
.player-row .grow span { color: var(--ink-2); font-size: 14px; font-variant-numeric: tabular-nums; }
.player-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.request-box { background: #FCF4E2; border-radius: 12px; padding: 12px 14px; display: grid; gap: 10px; }

/* Desktop table sizing */
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .felt-wrap { inset: 2% 6% 4%; }
  .seat { width: 150px; }
  .seat .cards .card, .seat .cards .flip { --w: 42px; }
  .seat .cards { height: 56px; margin-bottom: -18px; }
  .seat .plate b, .seat .plate .stack { font-size: 13.5px; }
  .t-foot { max-width: 760px; width: 100%; margin: 0 auto; }
  .my-cards .card, .my-cards .flip { --w: 66px; }
}
@media (max-width: 520px) {
  .code-chip { height: 32px; padding: 0 10px; font-size: 14px; letter-spacing: .1em; }
  .t-head { gap: 4px; padding-left: 6px; padding-right: 6px; }
  .actions { gap: 6px; }
  .act { min-height: 52px; font-size: 15.5px; }
  .my-cards .card, .my-cards .flip { --w: 52px; }
}
/* Phones in portrait: tall table */
@media (max-aspect-ratio: 4/5) {
  .felt { inset: 8% 14% 6%; }
  .felt-wrap { inset: 2% 0 2%; }
  .seat { width: 108px; }
  .seat .plate .avatar { width: 24px !important; height: 24px !important; font-size: 11px !important; }
  .seat .plate b, .seat .plate .stack { font-size: 12px; }
  .seat .plate { padding: 4px 6px 4px 4px; gap: 5px; }
  .center { top: 44%; }
  .felt-logo { top: 74%; font-size: 16px; }
}
@media (max-height: 560px) and (orientation: landscape) {
  .my-cards .card, .my-cards .flip { --w: 42px; }
  .act { min-height: 44px; }
  .seat .cards { display: none; }
}

/* ───────── Friends / hands / profile ───────── */
.add-friend { display: flex; gap: 10px; }
.add-friend .input { flex: 1; }
.cols-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .cols-2 { grid-template-columns: 1fr; } }

.hand-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; padding: 14px 4px; border-top: 1px solid var(--line-2); text-decoration: none; color: inherit; }
.hand-row:first-child { border-top: 0; }
.hand-row:hover { background: rgba(20, 38, 32, .03); }
.hand-row .mini-cards { display: flex; gap: 3px; }
.hand-row .mini-cards .card { --w: 30px; }
.hand-row .board-mini { display: flex; gap: 2px; margin-top: 4px; }
.hand-row .board-mini .card { --w: 22px; }
.hand-row .title { font-weight: 700; }
.hand-row .meta { color: var(--ink-2); font-size: 14px; }
.net { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.net.up { color: var(--good); }
.net.down { color: var(--bad); }
.net.flat { color: var(--ink-3); }

.profile-head { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.profile-head h1 { font-size: clamp(30px, 5vw, 44px); font-weight: 850; font-variation-settings: 'wdth' 115; letter-spacing: -0.035em; }
.profile-head p { color: var(--ink-2); }
.profile-head .actions-r { margin-left: auto; display: flex; gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border-radius: var(--radius-panel); overflow: hidden; box-shadow: var(--shadow-panel); }
.stat { background: var(--paper); padding: 20px; }
.stat dt { color: var(--ink-2); font-size: 14px; font-weight: 600; }
.stat dd { margin: 6px 0 0; font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; font-variation-settings: 'wdth' 90; }
.stat dd.net { text-align: left; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat dd { font-size: 26px; } .profile-head .actions-r { margin-left: 0; width: 100%; } }

.avatar-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; }
.avatar-grid button { border: 0; padding: 0; background: none; border-radius: 50%; cursor: pointer; aspect-ratio: 1; display: grid; place-items: center; }
.avatar-grid button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--felt); }
@media (max-width: 520px) { .avatar-grid { grid-template-columns: repeat(4, 1fr); } }
.settings-stack { display: grid; gap: 20px; max-width: 640px; }
.settings-stack form { display: grid; gap: 14px; }

/* Replay */
.replay { background: var(--room); color: var(--on-dark); border-radius: var(--radius-panel); overflow: hidden; }
.replay-stage { position: relative; aspect-ratio: 1.6; min-height: 320px; }
.replay-stage .felt-wrap { inset: 6% 4% 8%; }
.replay-controls { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: rgba(0,0,0,.25); }
.replay-controls .icon-btn { color: var(--on-dark); }
.replay-controls input[type="range"] { flex: 1; accent-color: var(--brass); }
.replay-caption { padding: 14px 18px; font-size: 15px; min-height: 52px; border-top: 1px solid rgba(255,255,255,.06); }
.replay-meta { display: flex; gap: 20px; flex-wrap: wrap; color: var(--ink-2); font-size: 14px; margin-bottom: 14px; }
@media (max-width: 640px) { .replay-stage { aspect-ratio: .9; } }

.loading { display: grid; place-items: center; min-height: 60vh; color: var(--ink-3); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(127,127,127,.25); border-top-color: currentColor; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
