/* ZomBabieZ Poker: dark, frosted glass, phone first. */
:root {
  --bg: #0b0712; --bg2: #160e22; --ink: #f4effa; --muted: #a99fbb; --faint: #6f6582;
  --glass: rgba(28, 20, 40, 0.62); --glass-strong: rgba(36, 26, 52, 0.86); --edge: rgba(255, 255, 255, 0.10);
  --lime: #b4ff22; --pink: #ff64c8; --gold: #ffd05a; --red: #ff4d5e; --mint: #64f5cc;
  --felt1: #1f7a52; --felt2: #0d3a28; --rail: #3b1f4f;
  --card: #f7f3e8; --card-red: #d0213f; --card-black: #16121c;
  --display: 'Bungee', system-ui, sans-serif; --body: 'Figtree', system-ui, -apple-system, sans-serif;
  --radius: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: radial-gradient(ellipse at 50% -10%, #2a1838 0%, var(--bg) 60%) fixed, var(--bg); color: var(--ink); font: 16px/1.45 var(--body); -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; }
a { color: var(--lime); }
.hidden { display: none !important; }
.glass { background: var(--glass); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3); border: 1px solid var(--edge); border-radius: var(--radius); }
.brand { font-family: var(--display); letter-spacing: 0.02em; color: var(--lime); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 16px; border-radius: 12px; background: var(--glass-strong); border: 1px solid var(--edge); font-weight: 600; }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--lime); color: #0b0712; border-color: transparent; }
.btn.pink { background: var(--pink); color: #0b0712; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.45; cursor: default; }
label.field { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
label.field input, label.field select { width: 100%; min-width: 0; background: rgba(0,0,0,0.35); border: 1px solid var(--edge); border-radius: 10px; padding: 10px 12px; min-height: 44px; color: var(--ink); }
label.field input:focus, label.field select:focus { outline: 2px solid var(--lime); outline-offset: 1px; }
.tip { font-size: 12px; color: var(--faint); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { width: 20px; height: 20px; accent-color: var(--lime); margin-top: 2px; }

/* ---------- home ---------- */
.home { max-width: 560px; margin: 0 auto; padding: 28px 16px 48px; display: grid; gap: 18px; }
.home h1 { font-family: var(--display); font-size: clamp(30px, 9vw, 44px); line-height: 1.05; margin: 0; }
.home h1 span { color: var(--lime); }
.home .lead { font-size: 17px; color: var(--muted); margin: 0; }
.home form { padding: 18px; display: grid; gap: 14px; }
.home .row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.home .err { color: var(--red); font-size: 14px; min-height: 1em; }
.home .notes { padding: 16px 18px; display: grid; gap: 8px; font-size: 14px; color: var(--muted); }
.home .notes b { color: var(--ink); }

/* ---------- table page ---------- */
.app { height: 100svh; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
.top { display: flex; align-items: center; gap: 8px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); border-bottom: 1px solid var(--edge); background: rgba(11,7,18,0.7); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); z-index: 5; }
.top .title { min-width: 0; flex: 1; display: grid; }
.top .title b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .title span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .icon { min-width: 40px; min-height: 40px; padding: 6px 8px; border-radius: 10px; background: var(--glass-strong); border: 1px solid var(--edge); font-size: 13px; font-weight: 600; position: relative; }
.top .icon .dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--pink); }

.stage { position: relative; min-height: 0; display: grid; place-items: center; padding: 8px; container-type: size; }
.felt { position: relative; width: min(100%, 66svh * 0.62, 520px); aspect-ratio: 0.62; border-radius: 999px; background: radial-gradient(ellipse at 50% 42%, var(--felt1), var(--felt2) 75%); border: 12px solid var(--rail); box-shadow: 0 0 0 2px rgba(180,255,34,0.35), 0 30px 60px rgba(0,0,0,0.55), inset 0 0 50px rgba(0,0,0,0.45); }
.felt .logo { position: absolute; left: 50%; top: 66%; transform: translate(-50%, -50%); font-family: var(--display); font-size: clamp(13px, 4vw, 20px); color: rgba(180,255,34,0.16); white-space: nowrap; pointer-events: none; }
@media (min-aspect-ratio: 1/1) { .felt { width: min(92%, 980px, 120svh); aspect-ratio: 1.9; } .felt .logo { top: 70%; } }
/* the table always fits the space left between the top bar and the dock (the raise box grows the dock) */
@container (min-width: 1px) { .felt { width: min(100cqw - 70px, (100cqh - 90px) * 0.62, 520px); } }
@media (min-aspect-ratio: 1/1) { @container (min-width: 1px) { .felt { width: min(100cqw - 160px, (100cqh - 150px) * 1.9, 980px); } } }

.center { position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 8px; width: 92%; }
.board { display: flex; gap: 4px; justify-content: center; min-height: calc(var(--cw) * 1.4); --cw: clamp(34px, 11vw, 56px); }
@media (min-aspect-ratio: 1/1) { .board { --cw: clamp(38px, 5vw, 64px); } }
.pot { font-weight: 700; font-size: 14px; background: rgba(0,0,0,0.45); padding: 4px 12px; border-radius: 999px; color: var(--gold); white-space: nowrap; }
.pot:empty { display: none; }
.status { font-size: 13px; color: var(--ink); background: rgba(0,0,0,0.4); padding: 4px 10px; border-radius: 10px; text-align: center; max-width: 100%; }
.status:empty { display: none; }

/* cards */
.card { width: var(--cw, 40px); aspect-ratio: 0.714; border-radius: calc(var(--cw, 40px) * 0.1); background: var(--card); color: var(--card-black); display: grid; grid-template-rows: auto 1fr; padding: calc(var(--cw, 40px) * 0.07) calc(var(--cw, 40px) * 0.1); box-shadow: 0 3px 8px rgba(0,0,0,0.4); font-weight: 800; line-height: 1; position: relative; user-select: none; }
.card .r { font-size: calc(var(--cw, 40px) * 0.42); }
.card .s { font-size: calc(var(--cw, 40px) * 0.5); align-self: end; justify-self: end; }
.card.red { color: var(--card-red); }
.card.back { background: repeating-linear-gradient(45deg, #2a1538 0 6px, #331a45 6px 12px); border: 2px solid var(--card); }
.card.back::after { content: 'ZB'; position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); color: var(--lime); font-size: calc(var(--cw, 40px) * 0.3); opacity: 0.8; }
.card.dim { filter: brightness(0.55); }
.card.win { box-shadow: 0 0 0 2px var(--lime), 0 0 16px rgba(180,255,34,0.6); }
.card.deal { animation: deal 0.28s ease-out both; }
@keyframes deal { from { transform: translateY(-14px) scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }

/* seats */
.seat { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%); width: clamp(70px, 22vw, 112px); display: grid; justify-items: center; gap: 2px; z-index: 2; }
.seat .plate { width: 100%; padding: 5px 6px; border-radius: 12px; background: var(--glass-strong); border: 1px solid var(--edge); text-align: center; position: relative; overflow: hidden; }
.seat .plate b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat .plate span { display: block; font-size: 12px; color: var(--gold); font-variant-numeric: tabular-nums; }
.seat.turn .plate { border-color: var(--lime); box-shadow: 0 0 0 1px var(--lime), 0 0 18px rgba(180,255,34,0.35); }
.seat.folded .plate, .seat.out .plate { opacity: 0.55; }
.seat.me .plate { border-color: rgba(255,100,200,0.6); }
.seat .timer { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--lime); width: var(--t, 0%); transition: width 0.25s linear; }
.seat .timer.bank { background: var(--pink); }
.seat .tag { font-size: 10px; font-weight: 800; letter-spacing: 0.06em; padding: 1px 6px; border-radius: 6px; background: rgba(0,0,0,0.6); color: var(--muted); text-transform: uppercase; }
.seat .tag.allin { color: var(--pink); }
.seat .tag.win { color: var(--lime); }
.seat .hole { display: flex; gap: 2px; --cw: clamp(22px, 7vw, 32px); height: calc(var(--cw) * 1.4); }
.seat .hole .card { --cw: inherit; }
.seat .shown { font-size: 11px; color: var(--lime); text-align: center; line-height: 1.2; }
.seat .bet { position: absolute; left: 50%; top: 50%; transform: translate(calc(-50% + var(--bx)), calc(-50% + var(--by))); background: rgba(0,0,0,0.55); color: var(--gold); font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.seat .bet::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--pink); box-shadow: inset 0 0 0 2px rgba(255,255,255,0.6); }
.seat .dealer { position: absolute; right: -8px; bottom: 30%; width: 22px; height: 22px; border-radius: 50%; background: var(--card); color: var(--card-black); font-weight: 900; font-size: 12px; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,0.5); }
.seat.empty .sit { min-height: 40px; padding: 6px 12px; border-radius: 12px; background: rgba(0,0,0,0.35); border: 1px dashed rgba(255,255,255,0.25); color: var(--muted); font-size: 13px; font-weight: 600; }
.seat.empty .sit:hover { border-color: var(--lime); color: var(--lime); }

/* bottom: my cards and actions */
.dock { padding: 8px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); display: grid; gap: 8px; background: linear-gradient(180deg, rgba(11,7,18,0), rgba(11,7,18,0.92) 30%); z-index: 4; }
.mine { display: flex; align-items: center; gap: 12px; min-height: 0; }
.mine .hole { display: flex; gap: 6px; --cw: clamp(52px, 16vw, 72px); }
.mine .info { display: grid; gap: 2px; font-size: 14px; }
.mine .info b { color: var(--lime); }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.actions .btn { min-height: 52px; font-size: 16px; flex-direction: column; gap: 0; line-height: 1.1; }
.actions .btn small { font-size: 12px; font-weight: 600; opacity: 0.85; }
.actions .fold { background: #2a1d37; }
.actions .call { background: var(--lime); color: #0b0712; }
.actions .raise { background: var(--pink); color: #0b0712; }
.raisebox { display: grid; gap: 8px; padding: 10px; }
.raisebox .presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.raisebox .presets .btn { min-height: 38px; padding: 6px; font-size: 13px; }
.raisebox .line { display: flex; gap: 8px; align-items: center; }
.raisebox input[type=range] { flex: 1; accent-color: var(--pink); height: 32px; }
.raisebox input[type=number] { width: 110px; background: rgba(0,0,0,0.35); border: 1px solid var(--edge); border-radius: 10px; padding: 8px; min-height: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.banner { padding: 10px 12px; display: flex; gap: 10px; align-items: center; justify-content: space-between; font-size: 14px; }

/* drawers */
.drawer { position: fixed; inset: auto 0 0 0; max-height: 78svh; z-index: 20; display: grid; grid-template-rows: auto 1fr auto; border-radius: 20px 20px 0 0; background: var(--glass-strong); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); border: 1px solid var(--edge); box-shadow: 0 -20px 50px rgba(0,0,0,0.5); transform: translateY(105%); transition: transform 0.22s ease; }
.drawer.open { transform: none; }
@media (min-width: 900px) { .drawer { inset: 64px 12px auto auto; width: 380px; max-height: calc(100svh - 80px); border-radius: 18px; transform: translateX(110%); } .drawer.open { transform: none; } }
.drawer header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--edge); }
.drawer header b { font-size: 16px; }
.drawer .body > * { min-width: 0; }
.drawer .body { overflow-x: hidden; overflow-y: auto; padding: 12px 16px; display: grid; gap: 10px; align-content: start; }
.drawer footer { padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--edge); display: flex; gap: 8px; }
.drawer footer input { flex: 1; min-height: 44px; background: rgba(0,0,0,0.35); border: 1px solid var(--edge); border-radius: 10px; padding: 8px 12px; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 15; }
.msg { font-size: 14px; }
.msg b { color: var(--pink); }
.msg.sys { color: var(--muted); font-style: italic; }
.req { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 12px; background: rgba(0,0,0,0.25); }
.req div { flex: 1; font-size: 14px; }
.req .btn { min-height: 38px; padding: 6px 12px; }
.sec { display: grid; gap: 10px; padding: 12px; border-radius: 14px; background: rgba(0,0,0,0.22); }
.sec h4 { margin: 0; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.seatrow { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.seatrow span { flex: 1; }
.seatrow input { width: 96px; min-height: 38px; background: rgba(0,0,0,0.35); border: 1px solid var(--edge); border-radius: 8px; padding: 6px 8px; }
.seatrow .btn { min-height: 38px; padding: 6px 10px; font-size: 13px; }
.hand { padding: 10px; border-radius: 12px; background: rgba(0,0,0,0.25); display: grid; gap: 6px; font-size: 13px; }
.hand .cards { display: flex; gap: 3px; --cw: 26px; }
.hand .ok { color: var(--lime); }
.hand .bad { color: var(--red); }
.toast { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); z-index: 30; padding: 10px 16px; border-radius: 12px; background: var(--glass-strong); border: 1px solid var(--edge); font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 10px 30px rgba(0,0,0,0.4); }
.toast.win { border-color: var(--lime); }
.toast.err { border-color: var(--red); }
.sheet { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,0.45); }
.sheet .box { width: min(100%, 380px); padding: 18px; display: grid; gap: 12px; }
.sheet h3 { margin: 0; }
@media (prefers-reduced-motion: reduce) { .card.deal { animation: none; } .drawer { transition: none; } }
