@font-face { font-family: 'Bungee'; src: url(bungee.woff2) format('woff2'); font-display: swap; }

:root {
  --bar-h: 58px;
  --ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
body.theme-classic {
  --room: radial-gradient(ellipse at 50% 40%, #1f4a31 0%, #12301f 55%, #0a1c12 100%);
  --cloth: radial-gradient(ellipse at 50% 42%, #33a05a 0%, #24803f 48%, #175c2c 100%);
  --rail: linear-gradient(170deg, #8a4b25 0%, #6a3517 30%, #4a230d 62%, #6b3818 100%);
  --rail-hi: rgba(255, 220, 170, .35);
  --rail-line: rgba(0, 0, 0, .55);
  --race: rgba(255, 255, 255, .16);
  --logo: rgba(255, 255, 255, .13);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  --bar: rgba(6, 18, 11, .82);
  --bar-line: rgba(255, 255, 255, .08);
  --text: #f4f8f2;
  --muted: #b9d3c0;
  --btn: rgba(255, 255, 255, .12);
  --btn-hover: rgba(255, 255, 255, .2);
  --btn-text: #ffffff;
  --accent: #ffd34d;
  --plate: rgba(9, 16, 12, .9);
  --plate-line: rgba(255, 255, 255, .14);
  --plate-text: #ffffff;
  --chips-text: #ffd34d;
  --av-ring: #0c1a12;
  --turn: #ffd34d;
  --pill-bg: rgba(8, 14, 10, .82);
  --pill-text: #ffffff;
  --a-fold: #5d6670; --a-check: #2f6fb5; --a-call: #1f8a4c; --a-raise: #d9822b; --a-allin: #c8202f; --a-blind: #4b5a52;
  --btn-fold: #8a2d2d; --btn-call: #1f7a43; --btn-raise: #e0a21b; --btn-raise-text: #241900;
  --panel: #fbfcfa;
  --panel-text: #17221b;
  --panel-muted: #5a6b60;
  --pill: #1f7a43;
  --pill-text2: #ffffff;
  --pill-alt: #e9efe9;
  --pill-alt-text: #17221b;
  --title-font: var(--ui);
  --hi: #ffd84a;
}
body.theme-atomic {
  --room: radial-gradient(ellipse at 50% 38%, #fbf1da 0%, #f3e6c8 55%, #e6d3a8 100%);
  --cloth: radial-gradient(ellipse at 50% 40%, #93d3c0 0%, #69b5a1 50%, #3f8f7d 100%);
  --rail: linear-gradient(170deg, #3b4243 0%, #2b3031 45%, #1f2324 100%);
  --rail-hi: rgba(255, 246, 224, .18);
  --rail-line: #e2622a;
  --race: rgba(255, 246, 224, .4);
  --logo: rgba(43, 49, 50, .2);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .18 0 0 0 0 .14 0 0 0 0 .1 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  --bar: #2b3031;
  --bar-line: #e2622a;
  --text: #2b3031;
  --muted: #6c6556;
  --btn: #3c4344;
  --btn-hover: #4b5354;
  --btn-text: #f6ecd6;
  --accent: #f2a14a;
  --plate: #fff6e0;
  --plate-line: #2b3031;
  --plate-text: #2b3031;
  --chips-text: #c9441b;
  --av-ring: #2b3031;
  --turn: #e2622a;
  --pill-bg: #2b3031;
  --pill-text: #fff6e0;
  --a-fold: #7d7666; --a-check: #2a7f78; --a-call: #3f8f5e; --a-raise: #d9551f; --a-allin: #b8243a; --a-blind: #6c6556;
  --btn-fold: #6c6556; --btn-call: #2a7f78; --btn-raise: #e2622a; --btn-raise-text: #fff8ea;
  --panel: #f6ecd6;
  --panel-text: #2b3031;
  --panel-muted: #6c6556;
  --pill: #d9551f;
  --pill-text2: #fff8ea;
  --pill-alt: #e6d9bb;
  --pill-alt-text: #2b3031;
  --title-font: 'Bungee', var(--ui);
  --hi: #ff8a3d;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  position: fixed; inset: 0;
  font-family: var(--ui); color: var(--text);
  background: #12301f; background: var(--room);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none;
  background-image: var(--grain); opacity: .14; mix-blend-mode: multiply;
}
body.theme-atomic::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='460' height='460'%3E%3Cg fill='none' stroke='%232b3031' stroke-width='3' stroke-linecap='round' opacity='.13'%3E%3Cpath d='M70 50v40M50 70h40M56 56l28 28M84 56L56 84'/%3E%3Cpath d='M360 330v56M332 358h56M340 338l40 40M380 338l-40 40'/%3E%3Cellipse cx='330' cy='110' rx='34' ry='12'/%3E%3Cellipse cx='330' cy='110' rx='34' ry='12' transform='rotate(60 330 110)'/%3E%3Cellipse cx='330' cy='110' rx='34' ry='12' transform='rotate(-60 330 110)'/%3E%3Cpath d='M110 330q20 -24 40 0'/%3E%3C/g%3E%3Cg fill='%23e2622a' opacity='.22'%3E%3Ccircle cx='330' cy='110' r='5'/%3E%3Ccircle cx='220' cy='230' r='4'/%3E%3Ccircle cx='30' cy='260' r='3'/%3E%3C/g%3E%3C/svg%3E");
}

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
#app {
  position: absolute; inset: 0; z-index: 2;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: var(--bar-h) 1fr auto;
  grid-template-areas: "bar" "tbl" "ctl";
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#bar { grid-area: bar; background: var(--bar); border-bottom: 2px solid var(--bar-line); display: flex; align-items: center; gap: 10px; padding: 0 10px; min-width: 0; }
#info { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; line-height: 1.1; color: #fff; }
.theme-atomic #info { color: #f6ecd6; }
#tName { font: 800 20px/1.1 var(--title-font); white-space: nowrap; }
.theme-atomic #tName { font-weight: 400; letter-spacing: .5px; color: var(--accent); }
#tSub { font-size: 15px; font-weight: 600; color: #cfe0d4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.theme-atomic #tSub { color: #d8cdb4; }
#barR { display: flex; gap: 8px; }
#table { grid-area: tbl; position: relative; z-index: 1; overflow: hidden; touch-action: manipulation; }
#controls { grid-area: ctl; background: var(--bar); border-top: 2px solid var(--bar-line); display: flex; align-items: center; gap: 14px; padding: 10px 14px; min-height: 92px; color: #fff; position: relative; z-index: 5; }
.theme-atomic #controls { color: #f6ecd6; }

.tb {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 0 14px; border-radius: 12px;
  background: var(--btn); color: var(--btn-text);
  font-size: 17px; font-weight: 700; letter-spacing: .2px; white-space: nowrap;
  transition: background .15s, transform .1s;
}
.tb:hover { background: var(--btn-hover); }
.tb:active { transform: scale(.96); }
.tb svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tb.sq { padding: 0 10px; }
.tb .off { display: none; }
.muted .tb .on { display: none; }
.muted .tb .off { display: block; }

/* ---------- table ---------- */
#felt { position: absolute; border-radius: 50%; background: var(--rail); box-shadow: 0 14px 40px rgba(0,0,0,.45), inset 0 2px 0 var(--rail-hi); --railw: clamp(10px, calc(var(--av) * .26), 22px); }
#felt::before { content: ''; position: absolute; inset: var(--railw); border-radius: 50%; background: var(--cloth); box-shadow: inset 0 0 0 2px var(--rail-line), inset 0 6px 28px rgba(0,0,0,.45); }
#felt::after { content: ''; position: absolute; inset: calc(var(--railw) + clamp(12px, 3.2%, 26px)); border-radius: 50%; border: 2px solid var(--race); }
.theme-atomic #felt { box-shadow: 0 0 0 3px #2b3031, 7px 9px 0 3px rgba(43,49,50,.25), inset 0 2px 0 var(--rail-hi); }
.theme-atomic #felt::before { box-shadow: inset 0 0 0 3px var(--rail-line), inset 0 0 0 7px #2b3031, inset 0 8px 26px rgba(0,0,0,.25); }
#feltLogo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; color: var(--logo); pointer-events: none; z-index: 1; line-height: 1; white-space: nowrap; }
#feltLogo span { display: block; font: 400 clamp(16px, calc(var(--cw) * .36), 34px)/1 'Bungee', var(--ui); letter-spacing: 3px; }
#feltLogo small { display: block; font: 700 clamp(11px, calc(var(--cw) * .16), 15px)/1.4 var(--ui); letter-spacing: 4px; text-transform: uppercase; margin-top: 2px; }

/* seats */
.seat { position: absolute; left: 0; top: 0; width: var(--pw); display: flex; flex-direction: column; align-items: center; z-index: 20; transition: opacity .3s; }
.seat .av { position: relative; width: var(--av); height: var(--av); border-radius: 50%; z-index: 2; cursor: pointer; }
.seat .av img { width: 100%; height: 100%; border-radius: 50%; display: block; border: 3px solid var(--av-ring); box-shadow: 0 3px 10px rgba(0,0,0,.35); background: #ddd; }
.seat .ring { position: absolute; inset: -7px; border-radius: 50%; border: 4px solid var(--turn); opacity: 0; transition: opacity .2s; pointer-events: none; }
.seat.turn .ring { opacity: 1; animation: ringPulse 1.1s ease-in-out infinite; }
@keyframes ringPulse { 0%, 100% { box-shadow: 0 0 0 0 var(--turn); } 50% { box-shadow: 0 0 18px 4px var(--turn); } }
.seat .plate {
  position: relative; z-index: 3; margin-top: calc(var(--av) * -.16); min-width: var(--pw); max-width: calc(var(--pw) * 1.15);
  background: var(--plate); color: var(--plate-text); border: 2px solid var(--plate-line); border-radius: 12px;
  padding: 2px 10px 3px; text-align: center; line-height: 1.12; box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
.theme-atomic .seat .plate { border-width: 2.5px; box-shadow: 3px 3px 0 #2b3031; }
.seat .nm { display: block; font-size: var(--fs); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat .ch { display: block; font-size: var(--fc); font-weight: 800; color: var(--chips-text); font-variant-numeric: tabular-nums; min-height: 1.1em; }
.seat.turn .plate { border-color: var(--turn); box-shadow: 0 0 0 2px var(--turn), 0 4px 14px rgba(0,0,0,.35); }
.seat.folded .av img { filter: grayscale(.85) brightness(.8); }
.seat.folded .plate { opacity: .72; }
.seat.out { opacity: .38; }
.seat.out .av img { filter: grayscale(1); }
.seat.win .av img { border-color: var(--hi); box-shadow: 0 0 0 3px var(--hi), 0 0 26px 6px var(--hi); }
.seat.win .plate { border-color: var(--hi); }
.seat.allin .ch::after { content: ' ALL-IN'; font-size: .62em; letter-spacing: .5px; color: var(--a-allin); }
.seat .tag {
  position: absolute; z-index: 4; left: 50%; top: calc(var(--av) * -.08); transform: translate(-50%, -60%) scale(.6); opacity: 0;
  padding: 3px 11px; border-radius: 99px; font-size: var(--fs); font-weight: 800; white-space: nowrap; color: #fff;
  background: var(--a-blind); box-shadow: 0 3px 8px rgba(0,0,0,.35); transition: transform .2s cubic-bezier(.2,.9,.3,1.3), opacity .15s;
  pointer-events: none;
}
.seat .tag.show { opacity: 1; transform: translate(-50%, -60%) scale(1); }
.tag.fold { background: var(--a-fold); } .tag.check { background: var(--a-check); } .tag.call { background: var(--a-call); }
.tag.raise { background: var(--a-raise); } .tag.allin { background: var(--a-allin); } .tag.blind { background: var(--a-blind); }
.theme-atomic .seat .tag { border: 2px solid #2b3031; }
.seat .hn {
  position: absolute; z-index: 5; left: 50%; top: 100%; transform: translate(-50%, 4px); opacity: 0;
  background: var(--pill-bg); color: var(--pill-text); padding: 3px 10px; border-radius: 9px; font-size: var(--fs); font-weight: 700; white-space: nowrap;
  transition: opacity .25s; pointer-events: none;
}
.seat.top .hn { top: auto; bottom: 100%; transform: translate(-50%, -4px); }
.seat.top .tag { left: auto; right: calc(50% + var(--av) * .5 + 6px); top: calc(var(--av) * .5); transform: translate(0, -50%) scale(.6); }
.seat.top .tag.show { transform: translate(0, -50%) scale(1); }
.seat .hn.show { opacity: 1; }
.seat.edgeL .hn { left: 0; transform: translate(0, 4px); }
.seat.edgeR .hn { left: auto; right: 0; transform: translate(0, 4px); }
.seat.win .hn { background: var(--hi); color: #241900; }
.seat.me .hn { display: none; }
.seat.me .av { width: calc(var(--av) * .9); height: calc(var(--av) * .9); }

/* bets & chips */
.bet { position: absolute; left: 0; top: 0; z-index: 15; display: flex; align-items: center; gap: 4px; pointer-events: none; }
.bet .amt, #potLbl {
  background: var(--pill-bg); color: var(--pill-text); border-radius: 99px; padding: 2px 9px; font-weight: 800; font-size: var(--fs);
  font-variant-numeric: tabular-nums; white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.stk { display: flex; align-items: flex-end; gap: 1px; }
.stk .col { display: flex; flex-direction: column-reverse; }
.stk .chip { width: var(--chip); height: var(--chip); display: block; filter: drop-shadow(0 1.5px 0 rgba(0,0,0,.35)); }
.stk .col .chip + .chip { margin-bottom: calc(var(--chip) * -.84); }
.flychip { position: absolute; left: 0; top: 0; z-index: 40; width: var(--chip); height: var(--chip); pointer-events: none; }
.flychip svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
#pot { position: absolute; left: 0; top: 0; z-index: 14; display: flex; flex-direction: column; align-items: center; gap: 3px; transition: opacity .2s; pointer-events: none; }
#pot.empty { opacity: 0; }
#pot.side { margin-top: calc(var(--fs) * -0.75 - 4px); }
#potLbl { font-size: calc(var(--fs) * 1.08); padding: 3px 13px; }
#potLbl b { color: var(--accent); }
.theme-atomic #potLbl b { color: #f2a14a; }
#sidePots { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; }
#sidePots span { background: var(--pill-bg); color: var(--pill-text); border-radius: 99px; padding: 1px 9px; font-size: 14px; font-weight: 700; opacity: .92; }
#dealer {
  position: absolute; left: 0; top: 0; z-index: 16; width: calc(var(--chip) * 1.2); height: calc(var(--chip) * 1.2); border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffffff, #e4e4e4); color: #1a1a1a; border: 2px solid #9a9a9a;
  display: flex; align-items: center; justify-content: center; font: 900 calc(var(--chip) * .62)/1 var(--ui); box-shadow: 0 3px 6px rgba(0,0,0,.4);
  opacity: 0; transition: opacity .3s; pointer-events: none;
}
.theme-atomic #dealer { background: #fff6e0; border: 2.5px solid #2b3031; color: #d9551f; font-family: 'Bungee', var(--ui); font-weight: 400; }

/* cards */
.card { position: absolute; left: 0; top: 0; width: var(--cw); height: var(--ch); perspective: 900px; pointer-events: none; }
.ci { position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateY(180deg); transition: transform .38s ease; }
.card.up .ci { transform: rotateY(0deg); }
.fc, .bk {
  position: absolute; inset: 0; border-radius: calc(var(--cw) * .07);
  background-size: 100% 100%; background-repeat: no-repeat;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.35), 0 3px 8px rgba(0,0,0,.18);
  transition: box-shadow .25s, filter .25s;
}
.bk { transform: rotateY(180deg); background-image: var(--back); }
.card.hi .fc { box-shadow: 0 0 0 3px var(--hi), 0 0 20px 4px var(--hi); }
.card.dim .fc { filter: brightness(.55) saturate(.7); }
.card.mucked { opacity: .4; filter: grayscale(.5); }

#msg {
  position: absolute; left: 0; top: 0; z-index: 35; text-align: center; pointer-events: none;
  background: var(--pill-bg); color: var(--pill-text); padding: 8px 18px; border-radius: 14px; font-size: clamp(16px, calc(var(--fs) * 1.1), 21px); font-weight: 700; line-height: 1.25;
  opacity: 0; transition: opacity .25s; box-shadow: 0 6px 20px rgba(0,0,0,.35);
}
#msg.show { opacity: 1; }
#msg.good { box-shadow: 0 0 0 3px var(--hi), 0 6px 20px rgba(0,0,0,.35); }
.theme-atomic #msg { border: 2.5px solid #e2622a; }

/* ---------- controls ---------- */
#myHand { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
#handName { font-size: 22px; font-weight: 800; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#handName small { display: block; font-size: 14px; font-weight: 600; color: #b9d3c0; text-transform: uppercase; letter-spacing: .6px; }
.theme-atomic #handName small { color: #d8cdb4; }
#odds { font-size: 16px; font-weight: 600; color: #dbe9df; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.theme-atomic #odds { color: #e8dcc0; }
#odds b { color: var(--accent); font-size: 19px; }
#acts { display: flex; gap: 10px; flex: 0 0 auto; }
.act {
  min-height: 64px; min-width: 150px; padding: 0 20px; border-radius: 16px; font-size: 21px; font-weight: 800; color: #fff;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05;
  box-shadow: 0 4px 0 rgba(0,0,0,.35); transition: transform .08s, filter .15s, box-shadow .08s;
}
.act:hover { filter: brightness(1.08); }
.act:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.35); }
.act small { font-size: 18px; font-weight: 800; opacity: .95; font-variant-numeric: tabular-nums; }
.act small:empty { display: none; }
.act.fold { background: var(--btn-fold); }
.act.call { background: var(--btn-call); }
.act.raise { background: var(--btn-raise); color: var(--btn-raise-text); }
.act.alt { background: var(--btn); color: var(--btn-text); }
.act.ghost { background: transparent; color: var(--panel-text); box-shadow: inset 0 0 0 2px var(--panel-muted); }
.act.off, .act[disabled] { opacity: .35; filter: grayscale(.6); cursor: default; }
.act.allin { background: var(--a-allin); color: #fff; }
.theme-atomic .act { border: 2.5px solid #1f2324; box-shadow: 3px 3px 0 #1f2324; }
.theme-atomic .act:active { box-shadow: 0 0 0 #1f2324; transform: translate(3px, 3px); }
#wait { display: flex; align-items: center; gap: 12px; flex: 0 1 auto; justify-content: flex-end; min-width: 0; }
#waitText { font-size: 18px; font-weight: 600; color: #dbe9df; text-align: right; }
.theme-atomic #waitText { color: #e8dcc0; }
#waitBtns { display: flex; gap: 10px; }
#waitBtns .act { min-width: 0; padding: 0 22px; min-height: 58px; font-size: 19px; }

/* raise panel */
#raisePanel {
  position: absolute; right: 12px; bottom: calc(100% + 10px); z-index: 50; width: min(470px, calc(100% - 24px));
  background: var(--panel); color: var(--panel-text); border-radius: 20px; padding: 14px 16px 16px; box-shadow: 0 16px 50px rgba(0,0,0,.45);
  display: flex; flex-direction: column; gap: 12px; animation: pop .18s cubic-bezier(.2,.9,.3,1.2);
}
.theme-atomic #raisePanel { border: 3px solid #2b3031; box-shadow: 7px 7px 0 #2b3031; }
.rpTop { display: flex; align-items: baseline; justify-content: center; gap: 10px; }
.rpTop span { font-size: 18px; font-weight: 700; color: var(--panel-muted); }
.rpTop b { font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; }
.rpSlide { display: flex; align-items: center; gap: 12px; }
.rpStep { width: 54px; height: 54px; flex: none; border-radius: 50%; background: var(--pill-alt); color: var(--pill-alt-text); font-size: 32px; font-weight: 800; line-height: 1; }
.rpStep:active { transform: scale(.94); }
#rpRange { -webkit-appearance: none; appearance: none; flex: 1; height: 54px; background: transparent; min-width: 0; --p: 0%; }
#rpRange::-webkit-slider-runnable-track { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--pill) var(--p), var(--pill-alt) var(--p)); }
#rpRange::-moz-range-track { height: 12px; border-radius: 6px; background: var(--pill-alt); }
#rpRange::-moz-range-progress { height: 12px; border-radius: 6px; background: var(--pill); }
#rpRange::-webkit-slider-thumb { -webkit-appearance: none; width: 38px; height: 38px; border-radius: 50%; margin-top: -13px; background: #fff; border: 4px solid var(--pill); box-shadow: 0 2px 6px rgba(0,0,0,.35); }
#rpRange::-moz-range-thumb { width: 32px; height: 32px; border-radius: 50%; background: #fff; border: 4px solid var(--pill); }
.rpPre { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rpPre button { min-height: 50px; border-radius: 12px; background: var(--pill-alt); color: var(--pill-alt-text); font-size: 18px; font-weight: 800; }
.rpPre button:active { transform: scale(.96); }
.theme-atomic .rpPre button, .theme-atomic .rpStep { border: 2px solid #2b3031; }
.rpGo { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.rpGo .act { min-width: 0; min-height: 60px; flex-direction: row; gap: 8px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; top: calc(var(--bar-h) + 14px); transform: translate(-50%, -12px); z-index: 90;
  background: rgba(20, 24, 22, .94); color: #fff; padding: 12px 20px; border-radius: 14px;
  font-size: 18px; font-weight: 700; max-width: min(90vw, 520px); text-align: center; line-height: 1.35;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; box-shadow: 0 8px 30px rgba(0,0,0,.3);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.theme-atomic #toast { background: #2b3031; color: #f6ecd6; border: 2px solid #e2622a; }

/* ---------- modal ---------- */
#modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: rgba(5, 15, 10, .55); padding: 12px; animation: fadeIn .2s ease; }
#modal.clear { background: rgba(5, 15, 10, .25); }
@keyframes fadeIn { from { opacity: 0; } }
#panel:focus { outline: none; }
#panel {
  background: var(--panel); color: var(--panel-text); border-radius: 22px;
  width: min(640px, 100%); max-height: 100%; overflow: auto; padding: 22px 22px 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4); animation: pop .22s cubic-bezier(.2,.9,.3,1.2);
  font-size: 17px; line-height: 1.45; user-select: text; -webkit-user-select: text;
}
.theme-atomic #panel { border: 3px solid #2b3031; box-shadow: 8px 8px 0 #2b3031, 0 20px 60px rgba(0,0,0,.3); }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
#panel h1 { font: 800 30px/1.1 var(--title-font); margin: 0 0 4px; }
.theme-atomic #panel h1 { font-weight: 400; color: #d9551f; text-shadow: 2px 2px 0 #2b3031; letter-spacing: .5px; }
#panel h2 { font: 800 21px/1.2 var(--title-font); margin: 18px 0 8px; }
.theme-atomic #panel h2 { font-weight: 400; font-size: 19px; }
#panel p { margin: 6px 0; }
.sub { color: var(--panel-muted); margin: 0 0 14px; }
.center { text-align: center; }
.phead { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.xbtn { width: 48px; height: 48px; border-radius: 50%; font-size: 30px; line-height: 1; background: var(--pill-alt); color: var(--pill-alt-text); flex: none; }
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 20px; border-radius: 14px; font-size: 18px; font-weight: 700;
  background: var(--pill); color: var(--pill-text2); transition: filter .15s, transform .1s;
}
.pill:hover { filter: brightness(1.08); }
.pill:active { transform: scale(.97); }
.pill.alt { background: var(--pill-alt); color: var(--pill-alt-text); }
.theme-atomic .pill { border: 2px solid #2b3031; box-shadow: 3px 3px 0 #2b3031; }
.prow { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.prow .pill { flex: 1 1 160px; }
.mlist { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.mlist .pill { width: 100%; }
@media (max-width: 420px) { .mlist { grid-template-columns: 1fr; } }

.setrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid rgba(0,0,0,.08); flex-wrap: wrap; }
.setrow > span { font-weight: 700; }
.setrow small { display: block; color: var(--panel-muted); font-weight: 500; font-size: 15px; }
.setrow .hint { color: var(--panel-muted); font-weight: 500; font-size: 15px; }
.seg { display: inline-flex; background: var(--pill-alt); border-radius: 14px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { min-height: 44px; padding: 0 15px; border-radius: 11px; font-weight: 700; font-size: 16px; color: var(--pill-alt-text); }
.seg button.on { background: var(--pill); color: var(--pill-text2); }
.nseg button { min-width: 46px; padding: 0 10px; font-size: 18px; }
.gclink { display: inline-block; margin-top: 16px; color: var(--panel-muted); font-size: 15px; text-decoration: none; }
.gclink:hover { text-decoration: underline; }

/* picker */
.picker { display: grid; gap: 12px; margin-top: 12px; }
.gtile { display: grid; grid-template-columns: 74px 1fr; gap: 6px 14px; align-items: center; padding: 14px; border-radius: 18px; background: var(--pill-alt); }
.theme-atomic .gtile { border: 2px solid #2b3031; }
.gtile h3 { margin: 0; font: 800 23px/1.1 var(--title-font); }
.theme-atomic .gtile h3 { font-weight: 400; font-size: 21px; }
.gtile p { margin: 2px 0 0; color: var(--panel-muted); font-size: 16px; line-height: 1.35; }
.gico { position: relative; height: 70px; }
.gico svg { position: absolute; width: 46px; height: 46px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.3)); }
.gico svg:nth-child(1) { left: 0; top: 0; } .gico svg:nth-child(2) { left: 24px; top: 8px; } .gico svg:nth-child(3) { left: 10px; top: 26px; }
.gtile .opts { grid-column: 1 / -1; }
.gtile .opts .setrow { border-top-color: rgba(0,0,0,.08); padding: 6px 0; }
.gtile .seg { background: rgba(255,255,255,.7); }
.theme-atomic .gtile .seg { background: #fbf3e0; }
.gtile .pill.big { grid-column: 1 / -1; min-height: 56px; font-size: 20px; }
@media (min-width: 760px) {
  #panel.wide { width: min(940px, 100%); }
  #panel.wide .picker { grid-template-columns: 1fr 1fr; align-items: stretch; }
  #panel.wide .gtile { align-content: start; }
  #panel.wide .gtile p { min-height: 2.8em; }
}
@media (max-height: 560px) and (min-width: 700px) {
  #panel.wide { padding: 12px 16px; }
  #panel.wide h1 { font-size: 24px; }
  #panel.wide .sub { margin-bottom: 4px; font-size: 15px; }
  #panel.wide .gtile { padding: 8px 12px; gap: 2px 12px; }
  #panel.wide .gtile p { min-height: 0; font-size: 15px; }
  #panel.wide .gico { height: 50px; }
  #panel.wide .gico svg { width: 34px; height: 34px; }
  #panel.wide .seg button { min-height: 38px; }
  #panel.wide .gtile .pill.big { min-height: 46px; }
  #panel.wide .picker { margin-top: 6px; gap: 10px; }
}

/* stats, ranks, log, players */
.stgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 8px; }
.stbox { background: var(--pill-alt); border-radius: 14px; padding: 10px 12px; text-align: center; }
.stbox b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.stbox span { font-size: 15px; color: var(--panel-muted); font-weight: 600; }
.besthand { margin-top: 12px; background: var(--pill-alt); border-radius: 14px; padding: 12px; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; }
.besthand span { color: var(--panel-muted); font-weight: 600; font-size: 15px; }
.besthand b { font-size: 20px; grid-row: 2; }
.besthand .mini { grid-row: 1 / 3; grid-column: 2; }
.mini { display: flex; gap: 3px; }
.mini i { width: 44px; height: 61.6px; background-size: 100% 100%; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.3); display: block; }
.ranks { display: grid; gap: 8px; margin-top: 8px; }
@media (min-width: 760px) { #panel.wide .ranks { grid-template-columns: 1fr 1fr; } }
.rk { display: grid; grid-template-columns: 30px 1fr; grid-template-rows: auto auto; gap: 4px 10px; align-items: center; background: var(--pill-alt); border-radius: 14px; padding: 8px 10px; }
.rk .no { grid-row: 1 / 3; font-size: 22px; font-weight: 900; color: var(--panel-muted); text-align: center; }
.rkt b { font-size: 18px; display: block; }
.rkt span { font-size: 15px; color: var(--panel-muted); line-height: 1.25; display: block; }
.rk .mini { grid-column: 2; }
.log { display: grid; gap: 10px; margin-top: 6px; }
.log .hand { background: var(--pill-alt); border-radius: 14px; padding: 10px 14px; font-size: 16px; }
.log .hand p { margin: 2px 0; }
.log .hand.cur { box-shadow: inset 0 0 0 2px var(--pill); }
.log .live { display: inline-block; background: var(--pill); color: var(--pill-text2); border-radius: 99px; padding: 0 10px; font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.cs { font-weight: 800; white-space: nowrap; background: #fff; color: #16181d; border-radius: 5px; padding: 0 4px; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.cs.red { color: #c8102e; }
.plist { display: grid; gap: 10px; margin-top: 8px; }
.pl { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; background: var(--pill-alt); border-radius: 14px; padding: 10px; }
.pl img { width: 64px; height: 64px; border-radius: 50%; }
.pl b { font-size: 19px; } .pl em { display: block; font-style: normal; font-weight: 700; color: var(--pill); font-size: 15px; } .pl span { display: block; color: var(--panel-muted); font-size: 15px; line-height: 1.3; }
.howto ul { padding-left: 22px; margin: 6px 0; }
.howto li { margin: 5px 0; }
kbd { background: var(--pill-alt); border-radius: 6px; padding: 1px 7px; font: 700 15px var(--ui); }
.win h1 { font-size: 36px !important; }
.trophy { margin: 0 auto 4px; width: 110px; animation: pop .5s cubic-bezier(.2,.9,.3,1.4); }

#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 110; }

/* ---------- short landscape (phones on their side) ---------- */
@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  :root { --bar-h: 46px; }
  #app { grid-template-columns: 1fr 236px; grid-template-rows: var(--bar-h) 1fr; grid-template-areas: "bar ctl" "tbl ctl"; }
  #controls { flex-direction: column; align-items: stretch; justify-content: space-between; border-top: 0; border-left: 2px solid var(--bar-line); padding: 8px 10px; gap: 8px; min-height: 0; }
  #acts { flex-direction: column; gap: 8px; }
  .act { min-width: 0; width: 100%; min-height: 56px; font-size: 19px; flex-direction: row; gap: 8px; }
  .act small { font-size: 18px; }
  #wait { flex-direction: column; align-items: stretch; justify-content: flex-end; flex: 1; gap: 8px; }
  #waitText { text-align: center; font-size: 16px; }
  #waitBtns { flex-direction: column; }
  #waitBtns .act { min-height: 52px; font-size: 17px; padding: 0 10px; }
  #handName { font-size: 19px; white-space: normal; }
  #odds { white-space: normal; font-size: 15px; }
  #odds small { display: block; }
  .tb { min-height: 38px; font-size: 15px; padding: 0 10px; }
  .tb svg { width: 21px; height: 21px; }
  #btnLog span, #btnRanks span { display: none; }
  #tName { font-size: 17px; } #tSub { font-size: 14px; }
  #raisePanel { position: fixed; right: env(safe-area-inset-right); top: 0; bottom: 0; transform: none; width: 236px; border-radius: 0; padding: 8px 10px; gap: 6px; justify-content: space-between; }
  .theme-atomic #raisePanel { box-shadow: -4px 0 0 #2b3031; border-width: 0 0 0 3px; }
  .rpTop { flex-direction: column; align-items: center; gap: 0; }
  .rpTop span { font-size: 15px; } .rpTop b { font-size: 26px; }
  .rpStep { width: 44px; height: 44px; font-size: 26px; }
  .rpSlide { gap: 6px; }
  #rpRange { height: 44px; }
  .rpPre { grid-template-columns: 1fr 1fr; gap: 6px; }
  .rpPre button { min-height: 42px; font-size: 16px; }
  .rpGo { grid-template-columns: 1fr; gap: 6px; }
  .rpGo .act { min-height: 50px; }
  #rpCancel { order: 2; min-height: 40px; }
  #toast { top: 10px; }
  #sidePots { gap: 3px; max-width: 300px; }
  #sidePots span { font-size: 13px; padding: 1px 7px; }
  #controls > #msg { position: relative; transform: none; font-size: 17px; padding: 8px 10px; line-height: 1.22; background: #0b120d; }
  .theme-atomic #controls > #msg { background: #2b3031; }
}

/* ---------- portrait ---------- */
@media (max-aspect-ratio: 4/5) {
  :root { --bar-h: 56px; }
  #bar { padding: 0 8px; gap: 6px; }
  #btnMenu span, #btnLog span, #btnRanks span { display: none; }
  .tb { padding: 0 11px; }
  #barR { gap: 6px; }
  #controls { flex-direction: column; align-items: stretch; gap: 8px; padding: 8px 10px 10px; min-height: 0; }
  #myHand { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 10px; min-height: 44px; }
  #handName { font-size: 20px; }
  #odds { text-align: right; font-size: 15px; line-height: 1.2; }
  #odds small { display: block; }
  #acts { gap: 8px; }
  .act { flex: 1; min-width: 0; min-height: 66px; padding: 0 6px; font-size: 20px; }
  #wait { justify-content: center; flex-direction: row; flex-wrap: wrap; gap: 8px; min-height: 66px; }
  #waitText { text-align: center; font-size: 17px; flex: 1 1 140px; }
  #waitBtns:empty { display: none; }
  #waitText:empty { display: none; }
  #waitBtns { flex: 1 1 200px; }
  #waitBtns .act { flex: 1; min-height: 62px; }
  #raisePanel { position: fixed; left: 0; right: 0; bottom: 0; width: auto; transform: none; border-radius: 22px 22px 0 0; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); }
  .theme-atomic #raisePanel { box-shadow: 0 -5px 0 #2b3031; border-width: 3px 0 0; }
  #toast { top: calc(var(--bar-h) + 10px); }
  #controls > #msg { left: 8px; right: 8px; top: 6px; min-height: 50px; display: flex; align-items: center; justify-content: center; padding: 4px 12px; font-size: 17px; line-height: 1.18; background: #0b120d; }
  .theme-atomic #controls > #msg { background: #2b3031; }
}
@media (max-aspect-ratio: 4/5) and (min-width: 700px) {
  :root { --bar-h: 66px; }
  #controls > #msg { font-size: 23px; min-height: 64px; }
  .act { min-height: 78px; font-size: 24px; }
  .act small { font-size: 21px; }
  #handName { font-size: 26px; }
  #odds { font-size: 18px; }
  #btnLog span, #btnRanks span, #btnMenu span { display: inline; }
  #tName { font-size: 24px; } #tSub { font-size: 17px; }
  #raisePanel { left: 50%; right: auto; width: 600px; transform: translateX(-50%); }
}
@media (max-width: 360px) {
  .act { font-size: 18px; }
  #tSub { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  #panel, #modal, #raisePanel, .trophy { animation: none; }
  .ci { transition: none; }
  .seat.turn .ring { animation: none; box-shadow: 0 0 14px 3px var(--turn); }
}

#feltLogo { transition: opacity .4s; }
#table.hasBoard #feltLogo { opacity: 0; }
