:root {
  --bg: #0A1715;
  --bg-2: #10221F;
  --panel: #152B27;
  --panel-2: #1C3631;
  --line: rgba(237, 230, 214, .09);
  --felt: #0F4C45;
  --felt-hi: #156158;
  --felt-deep: #08302B;
  --rail: #2B1D17;
  --rail-hi: #4A3226;
  --brass: #D9A84E;
  --brass-hi: #F0C878;
  --brass-ink: #3A2A0E;
  --ivory: #F6F0E2;
  --ink: #1B2422;
  --red: #C8323C;
  --blue: #2D63B8;
  --green: #22874B;
  --text: #EDE6D6;
  --muted: #8FA49F;
  --danger: #E06A5C;
  --ok: #6CC596;
  --radius: 14px;
  --display: 'Unbounded', 'Manrope', system-ui, sans-serif;
  --body: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: var(--body); font-size: 15px; line-height: 1.45;
  overscroll-behavior: none; -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
}
input, textarea { user-select: text; -webkit-user-select: text; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.hidden { display: none !important; }

#app { height: 100%; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; position: relative; overflow: hidden; }

/* ───────── buttons & inputs ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 20px; border-radius: 14px; font-weight: 700; font-size: 16px;
  background: var(--panel-2); color: var(--text); transition: transform .08s, background .15s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn.primary { background: var(--brass); color: var(--brass-ink); }
.btn.primary:active { background: var(--brass-hi); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.danger { background: #3A1E1B; color: #F2B0A6; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.btn.block { width: 100%; }
.row { display: flex; gap: 10px; align-items: center; }
.row > .grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.input {
  width: 100%; min-height: 50px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); font: inherit; font-size: 17px;
}
.input:focus { outline: none; border-color: var(--brass); }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { padding: 10px 14px; border-radius: 11px; background: var(--bg-2); border: 1px solid var(--line); font-weight: 600; }
.seg button.on { background: var(--brass); color: var(--brass-ink); border-color: var(--brass); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.switch input { appearance: none; width: 48px; height: 28px; border-radius: 99px; background: var(--panel-2); position: relative; transition: background .15s; flex: none; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--text); transition: transform .15s; }
.switch input:checked { background: var(--brass); }
.switch input:checked::after { transform: translateX(20px); background: var(--brass-ink); }
.hint { color: var(--muted); font-size: 13px; }

/* ───────── home ───────── */
.screen { flex: 1; overflow-y: auto; padding: calc(var(--safe-top) + 20px) 20px calc(var(--safe-bot) + 24px); -webkit-overflow-scrolling: touch; }
.home-hero { position: relative; height: 300px; margin: -20px -20px 8px; overflow: hidden; }
.home-hero .felt-arc {
  position: absolute; left: -30%; right: -30%; top: -180px; height: 440px; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 70%, var(--felt-hi), var(--felt) 45%, var(--felt-deep) 80%);
  box-shadow: 0 0 0 12px var(--rail), 0 0 0 14px var(--rail-hi), 0 30px 60px rgba(0,0,0,.5);
}
.home-hero .fan { position: absolute; left: 50%; top: 120px; width: 0; height: 0; }
.home-hero .fan .card { position: absolute; left: -32px; top: 0; transform-origin: 50% 140%; }
.wordmark { font-family: var(--display); font-weight: 800; font-size: 46px; letter-spacing: -.03em; line-height: 1; margin: 0; }
.wordmark small { display: block; font-family: var(--body); font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-top: 10px; }
.home-actions { display: grid; gap: 10px; margin-top: 24px; }
.code-input { text-transform: uppercase; letter-spacing: .3em; font-family: var(--display); text-align: center; font-size: 22px; }
.recent { margin-top: 28px; }
.recent h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin: 0 0 8px; }
.recent-item { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 14px 16px; border-radius: 14px; background: var(--panel); margin-bottom: 8px; text-align: left; }
.recent-item .code { font-family: var(--display); color: var(--brass); letter-spacing: .12em; }
.page-title { font-family: var(--display); font-size: 26px; font-weight: 700; margin: 6px 0 20px; letter-spacing: -.02em; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; padding: 8px 0; }
.avatars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.avatars button { aspect-ratio: 1; font-size: 24px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.avatars button.on { border-color: var(--brass); background: var(--panel-2); box-shadow: 0 0 0 2px var(--brass) inset; }
.join-who { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 18px; }
.chip-tag { padding: 6px 10px; border-radius: 99px; background: var(--panel); font-size: 14px; }

/* ───────── table screen ───────── */
.topbar {
  display: flex; align-items: center; gap: 10px; padding: calc(var(--safe-top) + 8px) 12px 6px; min-height: 52px; z-index: 5;
}
.topbar .title { flex: 1; min-width: 0; }
.topbar .title b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title span { font-size: 12px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--panel); position: relative; flex: none; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; }
.banker-pill { display: flex; align-items: center; gap: 6px; padding: 0 12px; height: 42px; border-radius: 12px; background: var(--panel); font-size: 13px; font-weight: 700; max-width: 30%; min-width: 0; }
.banker-pill span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.banker-pill.none { color: var(--brass); }

.table-wrap { flex: 1; position: relative; min-height: 0; }
.felt {
  position: absolute; left: 10%; right: 10%; top: 8%; bottom: 10%;
  border-radius: 46% / 32%;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(255,255,255,.07), transparent 55%),
    radial-gradient(ellipse at 50% 50%, var(--felt-hi) 0%, var(--felt) 50%, var(--felt-deep) 100%);
  box-shadow:
    inset 0 0 0 2px rgba(217,168,78,.18),
    inset 0 0 60px rgba(0,0,0,.45),
    0 0 0 14px var(--rail),
    0 0 0 15px var(--rail-hi),
    0 18px 50px rgba(0,0,0,.55);
}
.felt::after {
  content: ''; position: absolute; inset: 16px; border-radius: inherit; border: 1px solid rgba(246,240,226,.07);
}
.felt-logo { position: absolute; left: 50%; top: 66%; transform: translate(-50%, -50%); font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: .02em; color: rgba(246,240,226,.07); pointer-events: none; white-space: nowrap; }

.center { position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 10px; width: 78%; }
.pot { display: flex; flex-direction: column; align-items: center; min-height: 40px; }
.pot .amount { font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--ivory); text-shadow: 0 2px 10px rgba(0,0,0,.4); }
.pot .label { font-size: 11px; color: rgba(246,240,226,.6); font-weight: 600; }
.pot .sidepots { font-size: 11px; color: rgba(246,240,226,.7); }
.board { display: flex; gap: 5px; height: 66px; }
.board .slot { width: 46px; height: 66px; border-radius: 7px; border: 1px dashed rgba(246,240,226,.10); }
.table-msg { font-size: 13px; color: rgba(246,240,226,.8); text-align: center; min-height: 18px; font-weight: 600; max-width: 100%; }
.table-msg.win { color: var(--brass-hi); font-family: var(--display); font-size: 14px; }

/* cards */
.card {
  width: 46px; height: 66px; border-radius: 7px; background: var(--ivory); color: var(--ink);
  position: relative; box-shadow: 0 2px 6px rgba(0,0,0,.35), inset 0 0 0 1px rgba(0,0,0,.06); flex: none;
  font-family: var(--display); overflow: hidden;
}
.card .r { position: absolute; left: 5px; top: 3px; font-size: 18px; font-weight: 700; line-height: 1; letter-spacing: -.04em; }
.card .s { position: absolute; left: 5px; top: 22px; font-size: 14px; line-height: 1; }
.card .big { position: absolute; right: 3px; bottom: 1px; font-size: 28px; line-height: 1; }
.card.red { color: var(--red); }
.deck4 .card.d { color: var(--blue); }
.deck4 .card.c { color: var(--green); }
.card.back {
  background:
    repeating-linear-gradient(45deg, rgba(217,168,78,.22) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(-45deg, rgba(217,168,78,.22) 0 2px, transparent 2px 7px),
    var(--felt);
  box-shadow: 0 2px 6px rgba(0,0,0,.35), inset 0 0 0 2px var(--ivory), inset 0 0 0 4px var(--felt-deep);
}
.card.lg { width: 70px; height: 100px; border-radius: 10px; }
.card.lg .r { font-size: 28px; left: 7px; top: 5px; }
.card.lg .s { font-size: 21px; left: 7px; top: 34px; }
.card.lg .big { font-size: 44px; right: 5px; bottom: 2px; }
.card.sm { width: 30px; height: 42px; border-radius: 5px; }
.card.sm .r { font-size: 13px; left: 3px; top: 2px; }
.card.sm .s { font-size: 10px; left: 3px; top: 15px; }
.card.sm .big { display: none; }
.card.dim { filter: brightness(.45) saturate(.6); }
.card.hl { box-shadow: 0 0 0 2px var(--brass), 0 4px 14px rgba(217,168,78,.45); transform: translateY(-4px); }
.card.flip { animation: flip .38s cubic-bezier(.2,.8,.3,1) both; }
@keyframes flip { from { transform: rotateY(90deg) scale(.9); opacity: .2; } to { transform: none; opacity: 1; } }
.card.dealt { animation: dealt .32s cubic-bezier(.2,.8,.3,1) both; }
@keyframes dealt { from { transform: translateY(-40px) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* seats */
.seat { position: absolute; width: 76px; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; z-index: 2; transition: opacity .2s; }
.seat .ava-wrap { position: relative; width: 52px; height: 52px; }
.seat .ring { position: absolute; inset: -4px; border-radius: 50%; background: conic-gradient(var(--brass) calc(var(--p, 0) * 1turn), transparent 0); opacity: 0; transition: opacity .2s; }
.seat.active .ring { opacity: 1; }
.seat.active.urgent .ring { background: conic-gradient(var(--danger) calc(var(--p, 0) * 1turn), transparent 0); }
.seat .ava { position: absolute; inset: 0; border-radius: 50%; background: var(--panel-2); display: grid; place-items: center; font-size: 26px; box-shadow: 0 0 0 2px var(--rail), 0 4px 10px rgba(0,0,0,.4); }
.seat.active .ava { box-shadow: 0 0 0 2px var(--bg), 0 0 18px rgba(217,168,78,.5); }
.seat .plate { margin-top: -6px; background: rgba(10,23,21,.92); border-radius: 9px; padding: 3px 8px 4px; text-align: center; min-width: 70px; position: relative; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.seat .name { font-size: 11px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 82px; }
.seat .stack { font-family: var(--display); font-size: 12px; color: var(--brass-hi); line-height: 1.2; }
.seat .act-tag { position: absolute; left: 50%; top: -26px; transform: translateX(-50%); background: var(--ivory); color: var(--ink); font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 6px; white-space: nowrap; z-index: 3; animation: pop .25s both; }
.seat .act-tag.fold { background: #3B4744; color: #B9C4C1; }
.seat .act-tag.raise, .seat .act-tag.bet { background: var(--brass); color: var(--brass-ink); }
.seat .act-tag.allin { background: var(--red); color: #fff; }
@keyframes pop { from { transform: translateX(-50%) scale(.6); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
.seat .mini-cards { position: absolute; top: 4px; left: 44px; display: flex; z-index: -1; }
.seat .mini-cards .card { width: 22px; height: 31px; border-radius: 4px; }
.seat .mini-cards .card + .card { margin-left: -12px; transform: rotate(8deg); }
.seat .mini-cards .card:first-child { transform: rotate(-4deg); }
.seat.right .mini-cards { left: auto; right: 44px; }
.seat .show-cards { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; z-index: 4; }
.seat .show-cards .card + .card { margin-left: 0; }
.seat .hand-name { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 3px; font-size: 10px; font-weight: 700; color: var(--brass-hi); white-space: nowrap; background: rgba(10,23,21,.9); padding: 1px 6px; border-radius: 6px; }
.seat.folded { opacity: .45; }
.seat.sitout .ava { filter: grayscale(1) brightness(.6); }
.seat.offline .ava::after { content: ''; position: absolute; right: 0; bottom: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--bg); }
.seat.winner .ava { box-shadow: 0 0 0 3px var(--brass), 0 0 26px rgba(240,200,120,.7); animation: glow 1.2s ease-in-out 2; }
@keyframes glow { 50% { box-shadow: 0 0 0 3px var(--brass-hi), 0 0 40px rgba(240,200,120,.9); } }
.seat.empty .ava { background: transparent; border: 1.5px dashed rgba(246,240,226,.22); box-shadow: none; font-size: 22px; color: rgba(246,240,226,.45); }
.seat.empty .plate { background: transparent; box-shadow: none; }
.seat.empty .name { color: rgba(246,240,226,.5); font-weight: 600; }
.seat.empty.can-sit .ava { border-color: var(--brass); color: var(--brass); }
.seat.me .plate { box-shadow: 0 0 0 1px rgba(217,168,78,.45), 0 2px 8px rgba(0,0,0,.4); }
.seat .badge { position: absolute; width: 20px; height: 20px; border-radius: 50%; font-size: 10px; font-weight: 800; display: grid; place-items: center; z-index: 3; }
.seat .badge.d { background: var(--ivory); color: var(--ink); box-shadow: 0 2px 4px rgba(0,0,0,.5); }

.bet { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 4px; z-index: 1; transition: opacity .2s; pointer-events: none; }
.bet .amt { font-family: var(--display); font-size: 12px; font-weight: 600; color: var(--ivory); background: rgba(8,48,43,.85); padding: 1px 7px; border-radius: 8px; }
.chip { width: 18px; height: 18px; border-radius: 50%; flex: none; background: radial-gradient(circle, var(--c, var(--brass)) 0 42%, #fff 43% 50%, var(--c, var(--brass)) 51%); box-shadow: 0 1px 0 rgba(0,0,0,.4), inset 0 0 0 1.5px rgba(255,255,255,.35); }
.chip.c1 { --c: #E8E2D2; } .chip.c2 { --c: #C8323C; } .chip.c3 { --c: #2D63B8; } .chip.c4 { --c: #22874B; } .chip.c5 { --c: #1B2422; } .chip.c6 { --c: #8B4FC9; }
.flying { position: absolute; z-index: 20; pointer-events: none; transition: transform .5s cubic-bezier(.3,.7,.3,1), opacity .5s; }
.dealer-btn { position: absolute; width: 22px; height: 22px; border-radius: 50%; background: var(--ivory); color: var(--ink); font-size: 11px; font-weight: 800; display: grid; place-items: center; transform: translate(-50%, -50%); box-shadow: 0 2px 5px rgba(0,0,0,.5); z-index: 2; transition: left .5s, top .5s; font-family: var(--display); }

.react-float { position: absolute; font-size: 34px; z-index: 30; pointer-events: none; animation: floatup 1.8s ease-out forwards; transform: translate(-50%, -50%); }
@keyframes floatup { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.5); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -170%) scale(1); } }

/* hero / actions */
.hero { padding: 6px 14px calc(var(--safe-bot) + 12px); position: relative; z-index: 4; }
.hero-cards { display: flex; align-items: flex-end; gap: 12px; min-height: 104px; }
.hero-cards .mine { display: flex; }
.hero-cards .mine .card:first-child { transform: rotate(-5deg); }
.hero-cards .mine .card + .card { margin-left: -14px; transform: rotate(5deg) translateY(2px); }
.hero-cards .mine.folded .card { filter: brightness(.45) saturate(.5); }
.hero-info { flex: 1; min-width: 0; padding-bottom: 6px; }
.hero-info .best { font-family: var(--display); font-size: 14px; line-height: 1.25; font-weight: 600; color: var(--brass-hi); }
.hero-info .sub { font-size: 13px; color: var(--muted); }
.hero-tools { display: flex; gap: 8px; padding-bottom: 6px; }
.actions { display: grid; grid-template-columns: 1fr 1.25fr 1.25fr; gap: 8px; margin-top: 10px; }
.actions .btn { min-height: 58px; flex-direction: column; gap: 0; line-height: 1.1; padding: 0 8px; }
.actions .btn small { font-family: var(--display); font-size: 13px; font-weight: 600; opacity: .85; }
.btn.fold { background: #2A2F2E; color: #D6D0C3; }
.btn.call { background: var(--felt-hi); color: var(--ivory); }
.btn.raise { background: var(--brass); color: var(--brass-ink); }
.raise-panel { margin-top: 10px; background: var(--panel); border-radius: 16px; padding: 12px; animation: slideup .2s ease-out both; }
@keyframes slideup { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.raise-panel .amount-row { display: flex; align-items: center; gap: 10px; }
.raise-panel .amount { flex: 1; text-align: center; font-family: var(--display); font-size: 30px; font-weight: 700; color: var(--brass-hi); }
.raise-panel .step { width: 46px; height: 46px; border-radius: 12px; background: var(--panel-2); font-size: 24px; font-weight: 700; }
.raise-panel input[type=range] { width: 100%; margin: 14px 0 10px; accent-color: var(--brass); height: 28px; }
.presets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.presets button { padding: 9px 0; border-radius: 10px; background: var(--panel-2); font-size: 12px; font-weight: 700; }
.wait-row { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.toggle-pre { flex: 1; min-height: 46px; border-radius: 12px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; color: var(--muted); }
.toggle-pre.on { border-color: var(--brass); color: var(--brass-hi); background: rgba(217,168,78,.08); }
.notice { background: var(--panel); border-radius: 14px; padding: 14px; margin-top: 10px; }
.notice b { display: block; margin-bottom: 4px; }

/* request banner for banker */
.requests { position: absolute; top: calc(var(--safe-top) + 58px); left: 10px; right: 10px; z-index: 15; display: flex; flex-direction: column; gap: 8px; }
.req { background: var(--ivory); color: var(--ink); border-radius: 14px; padding: 10px 10px 10px 14px; display: flex; align-items: center; gap: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: slideup .25s both; }
.req .t { flex: 1; font-size: 14px; line-height: 1.3; }
.req .t b { font-family: var(--display); }
.req .btn.small { min-height: 40px; }
.req .ok { background: var(--felt); color: var(--ivory); }
.req .no { background: #E4DCCB; color: var(--ink); }

/* sheets */
.scrim { position: absolute; inset: 0; background: rgba(4,10,9,.6); z-index: 40; animation: fade .2s both; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88%; background: var(--bg-2); border-radius: 22px 22px 0 0; z-index: 41; display: flex; flex-direction: column; animation: sheetup .28s cubic-bezier(.2,.8,.3,1) both; box-shadow: 0 -10px 40px rgba(0,0,0,.5); }
@keyframes sheetup { from { transform: translateY(100%); } }
.sheet .grab { width: 40px; height: 5px; border-radius: 99px; background: var(--panel-2); margin: 8px auto 4px; flex: none; }
.sheet .sheet-head { display: flex; align-items: center; padding: 6px 16px 10px; gap: 10px; }
.sheet .sheet-head h2 { flex: 1; margin: 0; font-family: var(--display); font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.sheet .tabs { display: flex; gap: 4px; padding: 0 12px 10px; overflow-x: auto; flex: none; scrollbar-width: none; }
.sheet .tabs button { padding: 9px 14px; border-radius: 99px; font-weight: 700; font-size: 14px; color: var(--muted); white-space: nowrap; position: relative; }
.sheet .tabs button.on { background: var(--panel-2); color: var(--text); }
.sheet .tabs button .dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.sheet .body { overflow-y: auto; padding: 4px 16px calc(var(--safe-bot) + 20px); -webkit-overflow-scrolling: touch; flex: 1; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .ava-sm { width: 40px; height: 40px; border-radius: 50%; background: var(--panel-2); display: grid; place-items: center; font-size: 20px; flex: none; position: relative; }
.list-item .ava-sm.on::after { content: ''; position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px var(--bg-2); }
.list-item .main { flex: 1; min-width: 0; }
.list-item .main b { display: block; }
.list-item .main span { font-size: 13px; color: var(--muted); }
.tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--panel-2); color: var(--muted); margin-left: 6px; vertical-align: 1px; }
.tag.brass { background: rgba(217,168,78,.18); color: var(--brass-hi); }
.pos { color: var(--ok); } .neg { color: var(--danger); }
.card-box { background: var(--panel); border-radius: 16px; padding: 14px; margin-bottom: 12px; }
.card-box h4 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 700; }
.banker-box { background: linear-gradient(135deg, #2A2214, #1A1A12); border: 1px solid rgba(217,168,78,.3); }
.banker-box .who { display: flex; align-items: center; gap: 12px; }
.banker-box .who .ava-sm { width: 48px; height: 48px; font-size: 26px; }
.banker-box .who b { font-family: var(--display); font-size: 18px; color: var(--brass-hi); }
.note-text { white-space: pre-wrap; word-break: break-word; margin-top: 10px; padding: 10px 12px; background: rgba(0,0,0,.25); border-radius: 10px; user-select: text; -webkit-user-select: text; }
table.ledger { width: 100%; border-collapse: collapse; font-size: 14px; }
table.ledger th { text-align: right; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 4px; }
table.ledger th:first-child, table.ledger td:first-child { text-align: left; }
table.ledger td { padding: 9px 4px; text-align: right; border-top: 1px solid var(--line); font-family: var(--display); font-size: 13px; }
table.ledger td:first-child { font-family: var(--body); font-weight: 600; font-size: 14px; }
.transfer { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.transfer .who { flex: 1; font-size: 14px; }
.transfer .amt { font-family: var(--display); font-weight: 700; }
.transfer.paid .who, .transfer.paid .amt { opacity: .45; text-decoration: line-through; }
.check { width: 30px; height: 30px; border-radius: 9px; border: 1.5px solid var(--line); display: grid; place-items: center; flex: none; }
.check.on { background: var(--ok); border-color: var(--ok); color: var(--bg); }
.hist { padding: 12px 0; border-bottom: 1px solid var(--line); }
.hist .top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.hist .top .grow { flex: 1; }
.hist .board-mini { display: flex; gap: 3px; }
.hist .line { font-size: 14px; margin-top: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chat-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px; }
.msg { max-width: 82%; padding: 8px 12px; border-radius: 14px; background: var(--panel); align-self: flex-start; }
.msg.mine { align-self: flex-end; background: var(--felt); }
.msg .from { font-size: 12px; color: var(--brass-hi); font-weight: 700; }
.msg.sys { align-self: center; background: none; color: var(--muted); font-size: 12px; text-align: center; padding: 2px 8px; }
.chat-input { display: flex; gap: 8px; padding: 10px 16px calc(var(--safe-bot) + 12px); border-top: 1px solid var(--line); }
.emoji-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.emoji-bar button { font-size: 26px; width: 48px; height: 48px; border-radius: 12px; background: var(--panel); }
.react-pop { position: absolute; bottom: calc(100% + 8px); right: 0; background: var(--panel); border-radius: 16px; padding: 8px; display: grid; grid-template-columns: repeat(4, 44px); gap: 4px; box-shadow: 0 10px 30px rgba(0,0,0,.5); z-index: 30; animation: slideup .15s both; }
.react-pop button { font-size: 26px; height: 44px; border-radius: 10px; }
.react-pop button:active { background: var(--panel-2); }

/* overlays */
.overlay { position: absolute; inset: 0; z-index: 60; background: rgba(4,10,9,.86); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; animation: fade .25s both; }
.draw-title { font-family: var(--display); font-size: 20px; color: var(--muted); margin-bottom: 18px; }
.reel { height: 84px; width: 100%; max-width: 320px; overflow: hidden; position: relative; border-radius: 18px; background: var(--panel); box-shadow: inset 0 0 0 2px rgba(217,168,78,.35); }
.reel::before, .reel::after { content: ''; position: absolute; left: 0; right: 0; height: 22px; z-index: 2; }
.reel::before { top: 0; background: linear-gradient(var(--panel), transparent); }
.reel::after { bottom: 0; background: linear-gradient(transparent, var(--panel)); }
.reel .strip { position: absolute; left: 0; right: 0; top: 0; }
.reel .strip div { height: 84px; display: flex; align-items: center; justify-content: center; gap: 12px; font-family: var(--display); font-size: 24px; font-weight: 700; }
.draw-result { margin-top: 22px; min-height: 90px; }
.draw-result b { display: block; font-family: var(--display); font-size: 28px; color: var(--brass-hi); animation: pop2 .4s both; }
@keyframes pop2 { from { transform: scale(.6); opacity: 0; } }
.toast { position: absolute; left: 50%; bottom: calc(var(--safe-bot) + 150px); transform: translateX(-50%); background: var(--ivory); color: var(--ink); padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 14px; z-index: 80; box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: slideup .2s both; max-width: 90%; text-align: center; }
.toast.err { background: #F2C9C2; color: #4A1410; }
.conn { position: absolute; top: calc(var(--safe-top) + 56px); left: 50%; transform: translateX(-50%); background: #3A1E1B; color: #F2B0A6; padding: 6px 12px; border-radius: 99px; font-size: 12px; font-weight: 700; z-index: 50; }
.lobby-cta { position: absolute; left: 50%; top: 47%; transform: translate(-50%, -50%); width: 60%; display: flex; flex-direction: column; gap: 8px; z-index: 3; align-items: stretch; }
.lobby-cta .hint { text-align: center; color: rgba(246,240,226,.7); }
.final { width: 100%; max-width: 420px; text-align: left; max-height: 100%; overflow-y: auto; }
.final h2 { font-family: var(--display); font-size: 26px; margin: 0 0 4px; text-align: center; }

@media (min-height: 760px) {
  .card.lg { width: 76px; height: 108px; }
}
@media (max-height: 640px) {
  .hero-cards { min-height: 80px; }
  .card.lg { width: 56px; height: 80px; }
  .card.lg .r { font-size: 22px; } .card.lg .s { font-size: 16px; top: 28px; } .card.lg .big { font-size: 32px; }
  .actions .btn { min-height: 50px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.seat.edge-l .hand-name { left: -4px; transform: none; }
.seat.edge-r .hand-name { left: auto; right: -4px; transform: none; }
.seat .ava-wrap .badge.d { position: absolute; }
.seat.edge-l .show-cards { left: 4px; transform: none; }
.seat.edge-r .show-cards { left: auto; right: 4px; transform: none; }
.seat.edge-l .hand-name, .seat.edge-r .hand-name { white-space: normal; width: 96px; text-align: center; }
.seat.edge-r .hand-name { right: 0; }
.seat.edge-l .hand-name { left: 0; }

.people-pill { display: flex; align-items: center; gap: 5px; padding: 0 10px; height: 42px; border-radius: 12px; background: var(--panel); font-size: 13px; font-weight: 700; flex: none; }
.people-pill .num { font-size: 13px; }
.lobby-who { background: rgba(8,48,43,.75); border-radius: 14px; padding: 10px; margin-bottom: 4px; }
.lobby-who-title { font-size: 12px; color: rgba(246,240,226,.7); font-weight: 700; margin-bottom: 6px; text-align: center; }
.lobby-chips { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; max-height: 112px; overflow-y: auto; }
.lchip { font-size: 12px; font-weight: 600; background: rgba(246,240,226,.1); padding: 4px 8px; border-radius: 99px; white-space: nowrap; }
.lchip i { font-style: normal; color: var(--brass-hi); font-size: 11px; }
.lchip.off { opacity: .45; }
.people-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.people-sum > div { background: var(--panel); border-radius: 14px; padding: 10px; text-align: center; }
.people-sum b { display: block; font-size: 22px; }
.people-sum span { font-size: 12px; color: var(--muted); }
.lobby-cta { width: 70%; }

.recent-row { display: flex; gap: 8px; align-items: stretch; margin-bottom: 8px; }
.recent-row .recent-item { margin-bottom: 0; flex: 1; min-width: 0; }
.recent-x { width: 52px; border-radius: 14px; background: var(--panel); color: var(--muted); font-size: 15px; font-weight: 700; flex: none; }
.recent-x[data-armed] { width: auto; padding: 0 12px; background: #3A1E1B; color: #F2B0A6; font-size: 13px; }

.update-bar { position: fixed; left: 10px; right: 10px; bottom: calc(var(--safe-bot) + 10px); z-index: 90; max-width: 540px; margin: 0 auto; background: var(--ivory); color: var(--ink); border-radius: 16px; padding: 10px 10px 10px 14px; display: flex; align-items: center; gap: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.55); animation: slideup .25s both; }
.update-bar .t { flex: 1; min-width: 0; font-size: 13px; line-height: 1.3; }
.update-bar .t b { display: block; font-size: 14px; }
.update-bar .t span { color: #5b6664; }
.update-bar .btn.ghost { border-color: rgba(0,0,0,.15); color: var(--ink); }
.update-bar a.btn { text-decoration: none; }

.chat-pops { position: absolute; top: calc(var(--safe-top) + 58px); left: 10px; right: 10px; z-index: 16; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.chat-pop { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; text-align: left; background: rgba(21,43,39,.96); border: 1px solid rgba(217,168,78,.35); border-radius: 14px; padding: 9px 12px; box-shadow: 0 10px 30px rgba(0,0,0,.45); animation: slideup .22s both; transition: opacity .3s, transform .3s; }
.chat-pop.out { opacity: 0; transform: translateY(-8px); }
.chat-pop .ava-xs { font-size: 20px; line-height: 1; margin-top: 1px; }
.chat-pop .tx { flex: 1; min-width: 0; font-size: 14px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.chat-pop .tx b { display: block; font-size: 12px; color: var(--brass-hi); }
.seat.me { cursor: pointer; }

.vbadge { position: absolute; left: -4px; bottom: -2px; width: 20px; height: 20px; border-radius: 50%; background: var(--ok); color: var(--bg); display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg); z-index: 3; }
.vbadge svg { width: 12px; height: 12px; }
.vbadge.muted { background: #4a3a38; color: #F2B0A6; }
.seat.speaking .ava { box-shadow: 0 0 0 3px var(--ok), 0 0 18px rgba(108,197,150,.75); }
.voice-btn.live { background: var(--ok); color: var(--bg); }
.voice-btn.muted { background: #3A1E1B; color: #F2B0A6; }
.icon-btn .dot.ok { background: var(--ok); color: var(--bg); }
.voice-list { display: flex; flex-direction: column; gap: 6px; }
.vrow { display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 12px; padding: 10px 12px; }
.vrow b { flex: 1; }
.vrow .ava-xs { font-size: 20px; }
.vrow .vstate svg { width: 18px; height: 18px; color: var(--ok); }
.voice-tap { position: absolute; left: 50%; top: calc(var(--safe-top) + 60px); transform: translateX(-50%); z-index: 70; background: var(--ok); color: var(--bg); font-weight: 800; padding: 12px 18px; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }

.side-tools { position: absolute; right: 8px; bottom: 6px; display: flex; gap: 6px; z-index: 6; }
.side-tools .icon-btn { width: 40px; height: 40px; background: rgba(21,43,39,.92); box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.side-tools .icon-btn.voice-btn.live { background: var(--ok); }
.side-tools .icon-btn.voice-btn.muted { background: #3A1E1B; }
.side-tools .react-pop { right: 0; bottom: calc(100% + 8px); }
