/* Texas Hold'em — styles. Palette from the Board & Card Games hub so this
   reads as a sibling of Cribbage, Catan and the rest. */
:root {
  --bg: #0f1117;
  --bg-soft: #161923;
  --card: #1a1e2b;
  --card-hover: #212636;
  --line: #2a3042;
  --text: #e8eaf0;
  --muted: #969db4;
  --accent: #6ea8fe;
  --accent-warm: #f0b354;
  --good: #6ee7a8;
  --bad: #f08c8c;
  --felt: #1d5a43;
  --felt-dark: #123a2c;
  --rail: #3a2a1f;
  --radius: 12px;
  --tabh: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --c-club: #16181f;
  --c-diamond: #c0392b;
  --c-heart: #c0392b;
  --c-spade: #16181f;
}
body.four-color { --c-club: #1f8a4c; --c-diamond: #2c6fd1; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
input[type=number], input[type=text], select {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 10px; font-size: 16px; min-width: 0;
}
select {
  -webkit-appearance: none; appearance: none; padding-right: 28px; color: var(--text);
  background: var(--bg-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23969db4'/%3E%3C/svg%3E") no-repeat right 10px center;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

#app {
  height: 100vh; height: 100dvh; display: grid;
  grid-template-rows: 44px 1fr calc(var(--tabh) + var(--safe-b));
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "top" "main" "tabs";
}
header.top {
  grid-area: top; display: flex; align-items: center; gap: 10px; padding: 0 14px;
  border-bottom: 1px solid var(--line); background: var(--bg);
}
header.top h1 { font-size: 16px; margin: 0; letter-spacing: .01em; }
.home-link { color: var(--muted); text-decoration: none; font-size: 20px; width: 28px; }
.spacer { flex: 1; }
.top-info { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; display: flex; align-items: center; min-width: 0; }
/* late tournament blinds on a narrow phone: the line shortens, Menu always stays */
.top-info .ti { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.top-info .btn { flex: none; }
header.top h1 { flex: none; }

main#views { grid-area: main; position: relative; overflow: hidden; min-height: 0; }
.view { position: absolute; inset: 0; display: none; overflow: hidden; }
.view.active { display: flex; flex-direction: column; }

/* ------------------------------------------------------------------ tabs */
nav.tabs {
  grid-area: tabs; display: flex; border-top: 1px solid var(--line);
  background: #12151d; padding-bottom: var(--safe-b);
}
nav.tabs button {
  flex: 1; background: none; border: 0; color: var(--muted); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 600;
  transition: color .15s, transform .08s;
}
nav.tabs button:active { transform: scale(.94); }
nav.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
nav.tabs button.on { color: var(--accent); }
nav.tabs button:not(.hub) svg { margin: 3px 0; }
nav.tabs button.hub svg { width: 28px; height: 28px; }
nav.tabs button.hub.on { color: var(--accent-warm); }
nav.tabs button span { white-space: nowrap; }
@media (max-width: 359px) { nav.tabs button { font-size: 10px; } }

@media (min-width: 900px) {
  #app { grid-template-columns: 92px 1fr; grid-template-rows: 48px 1fr; grid-template-areas: "tabs top" "tabs main"; }
  nav.tabs { flex-direction: column; border-top: 0; border-right: 1px solid var(--line); padding: 10px 0; justify-content: flex-start; gap: 4px; }
  nav.tabs button { flex: 0 0 72px; font-size: 12px; }
  nav.tabs button.hub { order: -1; }
}

/* --------------------------------------------------------------- common */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; font-weight: 650; min-height: 44px;
  transition: background .12s, border-color .12s, transform .07s, opacity .12s;
}
.btn:hover:not(:disabled) { background: var(--card-hover); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .35; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0d1424; }
.btn.warm { background: var(--accent-warm); border-color: var(--accent-warm); color: #231703; }
.btn.danger { background: #3a1f24; border-color: #5c2a31; color: #ffc9c9; }
.btn.small { min-height: 34px; padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.ghost { background: transparent; }
/* keep coloured buttons coloured on hover (and on iPhone's sticky hover after a tap) */
.btn.primary:hover:not(:disabled) { background: #8dbbff; }
.btn.warm:hover:not(:disabled) { background: #f5c477; }
.btn.danger:hover:not(:disabled) { background: #4a252c; }.muted { color: var(--muted); }
.qm {
  display: inline-flex; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line);
  align-items: center; justify-content: center; font-size: 11px; color: var(--muted); background: var(--bg-soft);
  cursor: pointer; vertical-align: 2px; margin-left: 4px; flex: none; font-weight: 700; padding: 0; position: relative;
}
.qm::before { content: ""; position: absolute; inset: -11px; }
.nw { white-space: nowrap; }
.seg { display: flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: none; border-radius: 7px; padding: 7px 6px; font-size: 13px; font-weight: 650; color: var(--muted); min-height: 34px; white-space: nowrap; }
.seg button.on { background: var(--card-hover); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg-soft); }
.stepper button { width: 38px; height: 36px; border: 0; background: none; font-size: 18px; }
.stepper button:active { background: var(--card-hover); }
.stepper b { min-width: 30px; text-align: center; font-variant-numeric: tabular-nums; }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #2a3042; border-radius: 14px; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #e8eaf0; transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; scrollbar-width: thin; }
.label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.good { color: var(--good); } .bad { color: var(--bad); } .warm { color: var(--accent-warm); }

/* ------------------------------------------------------------- playing cards */
/* Real poker-size cards (63 x 88) on the shared table kit (css/table.css: paper, edge, sheen, backs).
   Face like a casino "jumbo index" deck: rank + suit in two corners, the real pip layout in the middle.
   Small cards (< 46 px) keep one corner index and one big suit so they stay readable on a phone. */
body { --back: #1f4e8c; }
.cd {
  --w: 40px; --card-w: var(--w); width: var(--w); aspect-ratio: 63 / 88;
  position: relative; flex: none; color: var(--c-spade); user-select: none;
  font-family: Georgia, "Times New Roman", serif; font-weight: 700; line-height: 1;
  container-type: inline-size; overflow: hidden;
}
.cd .ix { position: absolute; left: 6%; top: 4%; display: flex; flex-direction: column; align-items: center; font-size: calc(var(--w) * .46); letter-spacing: -.06em; }
.cd .ix i { font-style: normal; font-size: calc(var(--w) * .36); margin-top: 1px; }
.cd .ix.b { display: none; left: auto; top: auto; right: 6%; bottom: 4%; transform: rotate(180deg); }
.cd .pip { position: absolute; right: 8%; bottom: 5%; font-size: calc(var(--w) * .44); }
.cd .pp { display: none; position: absolute; inset: 13% 24%; }
.cd .pp .tbl-pip { font-size: calc(var(--w) * .36); }
.cd .pp .tbl-pips b { font-size: calc(var(--w) * .16); }
.cd .pp .tbl-court { inset: 2% 0; }
.cd .pp .tbl-court em { font-size: calc(var(--w) * .15); }
@container (min-width: 46px) {
  .cd .ix { font-size: calc(var(--w) * .25); }
  .cd .ix i { font-size: calc(var(--w) * .21); }
  .cd .ix.b { display: flex; }
  .cd .pip { display: none; }
  .cd .pp { display: block; }
}
.cd.s0 { color: var(--c-club); } .cd.s1 { color: var(--c-diamond); } .cd.s2 { color: var(--c-heart); } .cd.s3 { color: var(--c-spade); }
.cd.back { overflow: visible; }
.cd.slot { background: rgba(255,255,255,.035); border: 1.5px dashed rgba(255,255,255,.16); border-radius: calc(var(--w) * .075); }
.cd.dim { filter: brightness(.55) saturate(.6); }
.cd.win { outline: 2px solid var(--accent-warm); outline-offset: 1px; }
/* dealt from the deck (start = on top of the deck; play.js measures --dx/--dy) */
.cd.deal { animation: deal .42s cubic-bezier(.2,.8,.25,1) both; }
@keyframes deal { from { transform: translate(var(--dx, 0px), var(--dy, -40px)) rotate(-30deg) scale(.9); } to { transform: none; } }
/* dealt face down, then turned over with a 3-D turn (your cards, the board) */
.cd.dealflip { animation: dealflip .7s cubic-bezier(.2,.8,.25,1) both; }
@keyframes dealflip {
  0% { transform: translate(var(--dx, 0px), var(--dy, -40px)) rotate(-30deg) perspective(300px) rotateY(180deg) scale(.9); }
  55% { transform: translate(0, 0) rotate(0) perspective(300px) rotateY(180deg); animation-timing-function: linear; }
  100% { transform: translate(0, 0) rotate(0) perspective(300px) rotateY(0); }
}
/* turned up at showdown */
.cd.flip { animation: flip .45s linear both; }
@keyframes flip { 0% { transform: perspective(300px) rotateY(180deg); } 100% { transform: perspective(300px) rotateY(0); } }
/* the card's back, shown until the turn passes edge-on */
.cd.dealflip::before, .cd.flip::before {
  content: ""; position: absolute; inset: -1px; z-index: 5; border-radius: inherit; pointer-events: none;
  background-color: var(--back);
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.3) 0 1px, transparent 1px 6px), repeating-linear-gradient(-45deg, rgba(255,255,255,.3) 0 1px, transparent 1px 6px);
  box-shadow: inset 0 0 0 calc(var(--w) * .07) #f7f4ec, inset 0 0 0 calc(var(--w) * .07 + 1px) rgba(0,0,0,.25);
  animation: backoff .7s both; animation-delay: inherit; animation-duration: inherit;
}
.cd.flip::before { animation-name: backoff2; }
@keyframes backoff { 0%, 77% { opacity: 1; } 78%, 100% { opacity: 0; } }
@keyframes backoff2 { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* ------------------------------------------------------------- chips */
.chip {
  width: 16px; height: 16px; border-radius: 50%; display: inline-block; flex: none;
  background: radial-gradient(circle, var(--cc) 0 42%, #fff 43% 50%, var(--cc) 51%);
  border: 2px dashed rgba(255,255,255,.75); box-shadow: 0 1px 2px rgba(0,0,0,.5);
}
/* a bet on the felt: the chips pushed out, with the amount beside them */
.bet { display: inline-flex; align-items: flex-end; gap: 3px; white-space: nowrap; --chip-size: 14px; }
.bet .amt, .pot .amt { font-size: 11px; font-weight: 800; color: #fff3d6; background: rgba(0,0,0,.38); padding: 0 5px; border-radius: 7px; line-height: 16px; font-variant-numeric: tabular-nums; }
.tbl-stacks { gap: 1px; }
/* phone: chips over the amount, so neighbours' bets never overlap */
@media (max-width: 899px) { .bet { flex-direction: column; align-items: center; gap: 1px; } }

/* ================================================================ PLAY */
#view-play { padding: 0; }
.play-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.play-main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
/* the room around the table: dim, lit from above */
.table-area { flex: 1; position: relative; min-height: 0; background: radial-gradient(ellipse 80% 70% at 50% 46%, #1d212c 0, #12141b 60%, var(--bg) 100%); }
/* padded leather arm rail, wooden racetrack, then the felt with its printed betting line */
.rail {
  position: absolute; left: calc(7% - 13px); right: calc(7% - 13px); top: calc(13% - 13px); bottom: calc(17% - 13px);
  border-radius: 50% / 46%;
  background: radial-gradient(ellipse 60% 40% at 50% 8%, rgba(255,255,255,.16), transparent 70%), radial-gradient(ellipse at 50% 50%, #2a221d 60%, #120e0b 100%);
  box-shadow: 0 12px 28px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.12), inset 0 -3px 6px rgba(0,0,0,.6);
}
.felt {
  position: absolute; left: 7%; right: 7%; top: 13%; bottom: 17%; border-radius: 50% / 46%;
  box-shadow: 0 0 0 3px #7a5432, 0 0 0 4px #3b2716, inset 0 6px 18px rgba(0,0,0,.55), inset 0 0 0 1px rgba(0,0,0,.4);
}
.felt .line { position: absolute; inset: 15% 11%; border-radius: 50%; border: 1.5px solid rgba(255,236,190,.2); pointer-events: none; }
.center { position: absolute; left: 50%; top: 47%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 5px; width: 76%; z-index: 1; }
.board { display: flex; gap: 4px; justify-content: center; }
.center { --bw: clamp(34px, 10.4vw, 54px); }
.board .cd { --w: var(--bw); }
/* dealer's spot: deck, muck and the pot */
.dealer-spot { display: flex; align-items: flex-end; justify-content: center; gap: 12px; min-height: 30px; --card-w: 19px; }
.dealer-spot .pot { order: 1; } .dealer-spot .muck { order: 2; }
.dealer-spot .tbl-deck { rotate: -8deg; }
.dealer-spot .tbl-deck.is-empty { border-width: 1px; }
.muck { --card-w: 19px; rotate: 6deg; }
.muck .cd { --w: 19px; }
.muck.tbl-pile:empty { visibility: hidden; }
.pot { display: flex; gap: 4px; align-items: flex-end; min-height: 20px; --chip-size: 17px; }
.result-line { font-size: 12.5px; font-weight: 700; text-align: center; color: #ffe2a8; min-height: 18px; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
/* a long winner line wraps under the board instead of running over the end seats (and never moves the board) */
@media (max-width: 899px) { .result-line { height: 18px; max-width: calc(5 * var(--bw) + 12px); line-height: 16px; } }

/* each player's place on the felt: chip stack + two cards turned to face them */
.spot { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: flex-end; gap: 4px; pointer-events: none; }
.spot.r { flex-direction: row-reverse; }
.spot .hole { display: flex; }
.spot .hole .cd { --w: 21px; }
.spot .hole .cd:first-child { rotate: -5deg; }
.spot .hole .cd + .cd { margin-left: calc(var(--w) * -.42); rotate: 6deg; }
.spot .hole.up .cd { --w: 27px; }
.spot .hole.up .cd + .cd { margin-left: calc(var(--w) * -.3); }
.spot.folded .hole { opacity: .6; }
.stk { --chip-size: 12px; }

.seat { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; width: 82px; transition: opacity .25s; z-index: 2; }
.seat .plate {
  background: linear-gradient(#2c2219, #18120d); border: 1px solid #8a6a3a; border-radius: 9px; padding: 3px 7px 3px 3px;
  display: flex; align-items: center; gap: 5px; min-width: 78px; position: relative; z-index: 2;
  box-shadow: inset 0 1px 0 rgba(255,220,150,.18), 0 2px 5px rgba(0,0,0,.55);
  transition: border-color .2s, box-shadow .2s;
}
.seat .av {
  width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #0d1424; flex: none;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.55), transparent 55%), var(--lv);
  box-shadow: inset 0 -2px 2px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.5);
}
.seat .nm { font-size: 11px; font-weight: 700; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50px; }
.seat .st { font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--accent-warm); font-weight: 700; line-height: 1.1; }
.seat.turn .plate { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(110,168,254,.25); }
.seat.folded { opacity: .45; }
.seat.out { opacity: .25; }
.seat .tag { position: absolute; top: -16px; right: -6px; font-size: 9.5px; font-weight: 800; padding: 1px 5px; border-radius: 6px; background: var(--card); border: 1px solid var(--line); z-index: 3; white-space: nowrap; }
.seat .tag.win { background: var(--accent-warm); color: #231703; border-color: var(--accent-warm); }
/* showdown tags sit under the plate so they never cover the cards just turned over */
.seat:not(.hero) .tag.sd { top: auto; bottom: -15px; right: 50%; transform: translateX(50%); }
/* seats on the right: the action tag hangs off the inner (left) corner, so it never leaves the screen */
.seat.rt:not(.hero) .tag:not(.sd) { right: auto; left: -6px; }
/* (play.js adds .flip when the tag would cover the board) */
.seat:not(.hero):not(.rt) .tag.flip:not(.sd) { right: auto; left: -6px; }
.seat.rt:not(.hero) .tag.flip:not(.sd) { left: auto; right: -6px; }
.seat.hero { width: 120px; }
/* you sit at the bottom edge whatever the screen height */
.table-area .seat.hero { top: auto !important; bottom: 2px; transform: translateX(-50%); }
.seat.hero .dealer { left: calc(100% + 18px); top: 8px; transform: none; }
/* your two cards lie in front of you, a little askew, turned up (you've peeked) */
.seat.hero .hole { display: flex; height: auto; margin-bottom: -8px; position: relative; z-index: 1; }
.seat.hero .hole .cd { --w: clamp(42px, 11.5vw, 58px); }
.seat.hero .hole .cd:first-child { rotate: -6deg; }
.seat.hero .hole .cd + .cd { margin-left: calc(var(--w) * -.12); rotate: 5deg; translate: 0 2px; }
.seat.hero .stk.mine { position: absolute; right: calc(100% - 40px); bottom: 100px; --chip-size: 15px; }
.seat.hero .tag { top: 50%; right: auto; left: calc(100% + 6px); transform: translateY(-50%); }
.seatbet { position: absolute; transform: translate(-50%, -50%); transition: left .3s, top .3s, opacity .3s; z-index: 1; }
/* the dealer button: a thick white puck */
.dealer {
  position: absolute; width: 20px; height: 20px; border-radius: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; z-index: 1;
  color: #1b1b1b; font: 900 10px/1 system-ui, sans-serif; letter-spacing: .02em;
  background: radial-gradient(circle at 38% 30%, #fff, #efebe1 55%, #d6cfbe);
  box-shadow: inset 0 0 0 2px #f8f6f0, inset 0 0 0 3px rgba(0,0,0,.12), 0 2px 0 #9f978a, 0 3px 5px rgba(0,0,0,.55);
  transition: left .4s, top .4s;
}
.think { position: absolute; bottom: -14px; left: 50%; transform: translateX(-50%); display: flex; gap: 3px; }
.think i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); animation: blink 1s infinite; }
.think i:nth-child(2) { animation-delay: .2s; } .think i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }

.hud { display: flex; align-items: center; gap: 8px; padding: 6px 12px; min-height: 40px; border-top: 1px solid var(--line); background: var(--bg-soft); font-size: 13px; }
.hud .eqbar { flex: 1; height: 8px; border-radius: 4px; background: #2a3042; overflow: hidden; position: relative; min-width: 40px; }
.hud .eqbar b { position: absolute; inset: 0 auto 0 0; border-radius: 4px; transition: width .35s; }
.hud .eqbar .need { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #fff; }
.hud .big { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hud .hname { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.actions { padding: 8px 10px 10px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; border-top: 1px solid var(--line); background: #12151d; }
.sizer { display: flex; gap: 5px; align-items: center; height: 40px; min-width: 0; }
.sizer .btn.small { padding: 6px 8px; min-width: 38px; min-height: 40px; }
.sizer input[type=range] { flex: 1; min-width: 60px; height: 34px; -webkit-appearance: none; appearance: none; background: transparent; margin: 0; }
.sizer input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: #3a4258; }
.sizer input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: #3a4258; }
.sizer input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: var(--accent-warm); border: 3px solid #fff3dc; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.sizer input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-warm); border: 3px solid #fff3dc; }
.sizer input[type=range]:active::-webkit-slider-thumb { transform: scale(1.12); }
.sizer .amt { min-width: 52px; flex: none; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.sizer .btn { flex: none; }
.act-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1.25fr); gap: 8px; }
.act-row .btn { white-space: nowrap; overflow: hidden; }
.act-row .btn { min-height: 48px; font-size: 15px; }
.act-row .btn small { font-weight: 600; opacity: .8; font-size: 12px; }
.hint-pop { font-size: 13px; color: var(--text); background: rgba(110,168,254,.12); border: 1px solid rgba(110,168,254,.35); border-radius: 9px; padding: 6px 10px; }

.side { display: none; }
@media (min-width: 900px) {
  .play-wrap { flex-direction: row; }
  .play-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
  .side { display: flex; flex-direction: column; width: 340px; border-left: 1px solid var(--line); background: var(--bg-soft); min-height: 0; }
  .side h3 { margin: 0; padding: 12px 14px 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
  .seat { width: 124px; } .seat .plate { min-width: 118px; padding: 5px 10px 5px 5px; gap: 8px; }
  .seat .av { width: 34px; height: 34px; font-size: 14px; } .seat .nm { font-size: 14px; max-width: 72px; } .seat .st { font-size: 15px; }
  .spot .hole .cd { --w: 36px; } .spot .hole.up .cd { --w: 48px; }
  .stk { --chip-size: 20px; }
  .seat.hero .stk.mine { --chip-size: 22px; bottom: 64px; right: calc(100% + 4px); }
  .bet { --chip-size: 20px; } .pot { --chip-size: 24px; }
  .bet .amt, .pot .amt { font-size: 13px; line-height: 19px; padding: 0 7px; }
  .dealer-spot { --card-w: 30px; gap: 20px; min-height: 46px; } .muck { --card-w: 30px; } .muck .cd { --w: 30px; }
  .rail { left: calc(7% - 20px); right: calc(7% - 20px); top: calc(13% - 20px); bottom: calc(17% - 20px); border-radius: 30% / 50%; }
  .felt { border-radius: 30% / 50%; } .felt .line { border-radius: 30% / 50%; inset: 13% 8%; }
  .seat .tag { font-size: 11.5px; }
  .seat:not(.hero) .tag.sd { bottom: -20px; }
  .dealer { width: 44px; height: 44px; font-size: 8px; letter-spacing: .06em; }
  .seat.hero .hole .cd { --w: clamp(64px, 5.4vw, 80px); }
  .center { --bw: clamp(64px, 5.4vw, 80px); }
  .board { gap: 6px; }
  .pot { font-size: 16px; }
  .result-line { font-size: 16px; min-height: 22px; }
  .actions { grid-template-columns: 1fr; max-width: 760px; width: 100%; margin: 0 auto; border-top: 0; background: transparent; }
  .play-main .actions-wrap { border-top: 1px solid var(--line); background: #12151d; }
}
.log { padding: 4px 14px 14px; font-size: 13px; }
.log div { padding: 3px 0; border-bottom: 1px solid rgba(42,48,66,.5); }
.log .st { color: var(--accent-warm); font-weight: 700; margin-top: 6px; }

/* setup */
.setup { flex: 1; display: flex; flex-direction: column; padding: 10px 16px; gap: 10px; max-width: 560px; width: 100%; margin: 0 auto; }
.setup h2 { margin: 0; font-size: 21px; }
@media (min-width: 900px) and (min-height: 700px) { .setup { justify-content: center; gap: 14px; } .setup h2 { font-size: 26px; } }
.field { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.field > .label { flex: none; }
.field .seg { flex: 1; max-width: 330px; }
.lvl-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.lvl-grid button { border: 1px solid var(--line); background: var(--bg-soft); border-radius: 10px; padding: 8px 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.lvl-grid button small { display: block; font-weight: 600; font-size: 11px; margin-top: 2px; }
.lvl-grid button.on { border-color: var(--accent); color: var(--text); background: rgba(110,168,254,.12); }

/* ================================================================ ODDS */
.odds-wrap { flex: 1; display: grid; grid-template-rows: auto auto 1fr; grid-template-columns: minmax(0, 1fr); min-height: 0; min-width: 0; }
.odds-top { padding: 10px 14px 8px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; border-bottom: 1px solid var(--line); }
.bignum { font-size: 40px; font-weight: 850; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.bignum small { font-size: 16px; font-weight: 700; color: var(--muted); margin-left: 4px; }
.subnums { display: flex; gap: 12px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.subnums b { color: var(--text); font-variant-numeric: tabular-nums; }
.slots { padding: 6px 14px; display: grid; gap: 4px; }
.slot-row { display: flex; align-items: center; gap: 8px; min-height: 48px; min-width: 0; }
.slot-row .label { width: 54px; flex: none; }
.slot-row .cards { display: flex; gap: 4px; flex-wrap: nowrap; }
.slot-row .cd { --w: 33px; cursor: pointer; }
.slot-row .cd.sel { outline: 2px solid var(--accent); outline-offset: 2px; }
.slot-row .cd.slot.sel { border-color: var(--accent); background: rgba(110,168,254,.12); }
.slot-row .tail { margin-left: auto; display: flex; gap: 6px; align-items: center; min-width: 0; }
/* seen cards fan out (overlap) when there are many, so the row never gets wider than the screen */
.slot-row .seen { display: flex; min-width: 0; flex: 0 1 auto; padding-right: 2px; }
.slot-row .seen > span { flex: 0 1 26px; min-width: 9px; }
.picker { display: grid; grid-template-columns: repeat(13, 1fr); gap: 3px; padding: 4px 10px; align-content: start; }
.pk { aspect-ratio: .74; border-radius: 5px; border: 1px solid #d8d1c2; background: #f6f2e9; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; line-height: 1; padding: 0; max-height: 52px; }
.pk i { font-style: normal; font-size: 12px; }
.pk.s0 { color: var(--c-club); } .pk.s1 { color: var(--c-diamond); } .pk.s2 { color: var(--c-heart); } .pk.s3 { color: var(--c-spade); }
.pk.used { opacity: .18; }
.pk:active { transform: scale(.94); }
.odds-extra { padding: 4px 14px 6px; display: grid; gap: 4px; align-content: start; flex: 1; min-height: 0; overflow-y: auto; }
.potodds { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; }
.potodds input { width: 80px; }
.verdict { font-weight: 750; }
.outs-line { font-size: 13px; color: var(--muted); }
.outs-line b { color: var(--text); }
.odds-low { display: flex; flex-direction: column; min-height: 0; }
@media (min-width: 900px) {
  .odds-wrap { grid-template-columns: minmax(380px, 1fr) minmax(420px, 1.2fr); grid-template-rows: auto auto 1fr; }
  .odds-low { display: contents; }
  .picker { grid-column: 2; grid-row: 2 / 4; }
  .odds-extra { grid-column: 1; grid-row: 3; overflow: visible; }
  .odds-top { grid-column: 1 / -1; padding: 16px 24px; }
  .bignum { font-size: 56px; }
  .slots { padding: 16px 24px; align-content: start; }
  .slot-row .cd { --w: 58px; }
  .slot-row { min-height: 90px; }
  .picker { padding: 16px 24px 8px; gap: 5px; }
  .pk { font-size: 19px; max-height: 84px; border-radius: 7px; } .pk i { font-size: 17px; }
  .outs-line { font-size: 15px; }
  .odds-extra { gap: 10px; }
  .odds-extra { padding: 8px 24px 16px; }
}

/* ================================================================ STUDY */
.study-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.hand-list { min-height: 0; }
.hrow { display: grid; grid-template-columns: 34px auto 1fr auto; gap: 8px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.hrow:hover { background: var(--card); }
.hrow.on { background: var(--card-hover); }
.hrow .cards { display: flex; gap: 2px; }
.hrow .cd { --w: 24px; }
.hrow .net { font-weight: 800; font-variant-numeric: tabular-nums; }
.hand-detail { padding: 10px 14px 16px; }
.hd-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.hd-board { display: flex; gap: 4px; }
.hd-board .cd { --w: 34px; }
.players-tbl { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0 10px; }
.players-tbl td { padding: 4px 4px; border-bottom: 1px solid rgba(42,48,66,.6); vertical-align: middle; }
.players-tbl .cards { display: flex; gap: 2px; }
.players-tbl .cd { --w: 22px; }
.players-tbl .cd.dim { filter: brightness(.75) saturate(.7); }
.dec { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }
.dec .row1 { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
.dec table { width: 100%; font-size: 12.5px; border-collapse: collapse; margin-top: 4px; }
.dec td { padding: 2px 4px; font-variant-numeric: tabular-nums; }
.dec td:first-child { padding-left: 0; }
.dec tr.chosen td { font-weight: 800; }
.lost { font-weight: 800; }
.study-tabs { padding: 8px 14px; border-bottom: 1px solid var(--line); }
.eqgraph { max-width: 100%; height: auto; display: block; }
.luck { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.luck div { background: var(--card); border-radius: 10px; padding: 6px 8px; }
.luck b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.luck span { font-size: 11px; color: var(--muted); }
.empty { color: var(--muted); padding: 30px 20px; text-align: center; }
@media (min-width: 900px) {
  .study-wrap { display: grid; grid-template-columns: 360px 1fr; grid-template-rows: auto auto 1fr; }
  .study-tabs, .luck { grid-column: 1 / -1; }
  .hand-list { border-right: 1px solid var(--line); }
  .hand-detail { padding: 14px 24px; }
  .hd-board .cd { --w: 46px; }
  .players-tbl .cd { --w: 30px; }
  /* keep name, cards and hand together instead of spreading over 1000px */
  .players-tbl td:first-child, .players-tbl td:nth-child(2) { width: 1%; white-space: nowrap; padding-right: 18px; }
  .players-tbl { font-size: 14px; }
  .luck b { font-size: 24px; }
  .luck span { font-size: 12px; }
  .hrow .cd { --w: 28px; }
  .hrow { padding: 10px 16px; }
}

/* starting-hand chart */
.chart-wrap { padding: 8px 10px 14px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.hgrid { display: grid; grid-template-columns: repeat(13, 1fr); gap: 2px; width: 100%; max-width: 640px; margin: 0 auto; }
.hgrid div { aspect-ratio: 1; border-radius: 3px; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 750; color: #0d1117; cursor: pointer; }
.hgrid div.on { outline: 2px solid #fff; }
@media (min-width: 900px) { .hgrid div { font-size: 12px; } }

/* ================================================================ HOME */
.home-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.home-tabs { padding: 8px 14px; border-bottom: 1px solid var(--line); }
.timer { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 12px; min-height: 0; }
.timer .lvl { font-size: 14px; color: var(--muted); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.timer .blinds { font-size: clamp(40px, 13vw, 96px); font-weight: 850; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.timer .clock { font-size: clamp(56px, 22vw, 150px); font-weight: 300; line-height: 1; font-variant-numeric: tabular-nums; }
.timer .clock.low { color: var(--bad); }
.timer .next { color: var(--muted); font-size: 14px; }
.timer .ctrls { display: flex; gap: 12px; align-items: center; }
.timer .ctrls .btn { min-width: 56px; }
.timer .ctrls .play { min-width: 96px; min-height: 56px; font-size: 18px; }
.tbar { width: min(520px, 90%); height: 6px; background: #2a3042; border-radius: 3px; overflow: hidden; }
.tbar b { display: block; height: 100%; background: var(--accent-warm); transition: width .9s linear; }
.plist { padding: 4px 0; }
.prow { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.prow input.nm { background: transparent; border: 0; padding: 4px 0; font-weight: 700; width: 100%; }
.prow input.ch { width: 92px; text-align: right; }
.home-foot { padding: 10px 14px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.settle-tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.settle-tbl th { text-align: left; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 6px 6px; }
.settle-tbl td { padding: 6px 6px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.settle-tbl input { width: 70px; padding: 6px; }
.settle-tbl td:first-child { padding-left: 14px; }
.settle-tbl td:last-child { padding-right: 14px; }
.transfer { padding: 8px 14px; font-size: 15px; display: flex; gap: 6px; align-items: center; border-bottom: 1px solid var(--line); }
.transfer b { font-variant-numeric: tabular-nums; }
@media (min-width: 900px) {
  .timer .ctrls .btn { min-height: 52px; min-width: 64px; }
  .timer .ctrls .play { min-width: 120px; min-height: 60px; font-size: 20px; }
  .home-body.split { display: grid; grid-template-columns: 1fr 1fr; min-height: 0; flex: 1; }
}

/* ================================================================ SETTINGS */
.settings { padding: 8px 0 20px; max-width: 640px; width: 100%; margin: 0 auto; }
.srow { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.srow .t { flex: 1; }
.srow .t small { display: block; color: var(--muted); font-size: 12.5px; }
.sgroup { padding: 16px 16px 4px; }
/* Sound & effects rows (js/fx.js renderSettings) drawn like the rows above */
.fx-set .fx-row { gap: 12px; padding: 12px 16px; border-top: 0; border-bottom: 1px solid var(--line); min-height: 0; }
.fx-set .fx-lab { flex: 1; }
.fx-set .seg { width: 210px; }
.fx-set .seg button[aria-pressed="true"] { background: var(--card-hover); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.fx-set .q { display: inline-flex; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); align-items: center; justify-content: center; font-size: 11px; color: var(--muted); background: var(--bg-soft); margin-left: 4px; font-weight: 700; padding: 0; position: relative; }
.fx-set .q::before { content: ""; position: absolute; inset: -11px; }
.fx-set .fx-why { padding: 0 16px 10px; border-bottom: 1px solid var(--line); }
.fx-set .fx-test { min-height: 34px; padding: 6px 10px; font-size: 13px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); font-weight: 650; }
.fx-set .fx-vol { flex: 0 1 150px; accent-color: var(--accent); }
.fx-set .switch { width: 46px; height: 28px; }
.fx-set .switch span { background: #2a3042; border-radius: 14px; }
.fx-set .switch span::after { top: 3px; left: 3px; width: 22px; height: 22px; background: #e8eaf0; }
.fx-set .switch input:checked + span { background: var(--accent); }
.fx-set .seg button { flex: 1; padding: 7px 6px; font-size: 13px; min-height: 34px; }
/* table effects: fade in what the runout would give away; Animations off / Fast */
@keyframes fxin { from { opacity: 0; } }
body.fx-noanim .cd.deal, body.fx-noanim .cd.dealflip, body.fx-noanim .cd.flip { animation: none; }
body.fx-noanim .cd::before { display: none; }
body.fx-fast .cd.deal { animation-duration: .23s; }
body.fx-fast .cd.dealflip { animation-duration: .39s; }
body.fx-fast .cd.flip { animation-duration: .25s; }

/* sheet (pop-up): bottom sheet on phone, centred card on laptop */
.sheet { position: fixed; inset: 0; background: rgba(5,7,12,.6); display: flex; align-items: flex-end; justify-content: center; z-index: 50; animation: fade .15s; }
.sheet[hidden] { display: none; }
.sheet-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px 16px 0 0; width: 100%; max-width: 520px; max-height: 85dvh; overflow-y: auto; padding: 16px 18px calc(16px + var(--safe-b)); animation: up .2s ease; }
.sheet-card h3 { margin: 0 0 8px; font-size: 17px; }
.sheet-card p { margin: 6px 0; color: #cfd3df; font-size: 14px; }
.sheet-card .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
@media (min-width: 900px) { .sheet { align-items: center; } .sheet-card { border-radius: 16px; max-width: 460px; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: .5; } }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabh) + var(--safe-b) + 12px); transform: translateX(-50%); background: #2a3042; padding: 8px 14px; border-radius: 10px; font-size: 14px; z-index: 60; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.toast[hidden] { display: none; }
.ver { color: var(--muted); font-size: 12px; padding: 14px 16px; }
.online .field input { flex: 1; max-width: 260px; }
.ocard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 8px; }
.ocard p { margin: 0; font-size: 13px; }
.ocode-wrap { text-align: center; display: grid; gap: 4px; padding: 6px 0; }
.ocode-wrap .muted { font-size: 13px; }
.ocode { font-size: 44px; font-weight: 800; letter-spacing: 8px; color: var(--accent-warm); line-height: 1.1; }
.ocode-top { color: var(--accent-warm); letter-spacing: 1px; }
.oseats { display: grid; gap: 6px; }
.oseat { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; min-height: 44px; }
.oseat.human .nm { color: var(--accent); font-weight: 600; }
.oseat.empty { border-style: dashed; background: transparent; }
.oseat .muted { font-size: 12px; }
table.strength { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0; }
table.strength th { color: var(--muted); font-weight: 600; font-size: 12px; text-align: right; padding: 4px 6px; }
table.strength td { text-align: right; padding: 5px 6px; border-top: 1px solid var(--line); }
table.strength td:first-child, table.strength th:first-child { text-align: left; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ================================================================ ODD SCREENS */
/* iPhone SE width (or an SE on its side): smaller name plates so nine seats fit round the table */
@media (max-width: 359px), (max-width: 899px) and (max-height: 359px) {
  .seat { width: 74px; }
  .seat .plate { min-width: 70px; padding: 2px 5px 2px 2px; gap: 4px; }
  .seat .av { width: 20px; height: 20px; font-size: 10px; }
  .seat .nm { font-size: 10.5px; max-width: 44px; }
  .seat .st { font-size: 10.5px; }
  .seat.hero { width: 110px; }
  .center { --bw: 30px; }
}
/* phone on its side: the table takes the full height, odds and buttons move to a column on the right */
@media (max-width: 899px) and (orientation: landscape) and (max-height: 520px) {
  /* a short screen: slimmer title bar and tab bar (icon beside its label), so the table gets the height */
  :root { --tabh: 40px; }
  #app { grid-template-rows: 36px 1fr calc(var(--tabh) + var(--safe-b)); }
  nav.tabs button { flex-direction: row; gap: 6px; }
  nav.tabs button:not(.hub) svg { margin: 0; width: 20px; height: 20px; }
  nav.tabs button.hub svg { width: 22px; height: 22px; }
  .top-info .btn { min-height: 28px !important; }
  .play-main { display: grid; grid-template-columns: minmax(0, 1fr) 236px; grid-template-rows: auto minmax(0, 1fr); }
  .play-main .table-area { grid-column: 1; grid-row: 1 / 3; }
  .play-main .hud { grid-column: 2; grid-row: 1; border-top: 0; border-left: 1px solid var(--line); gap: 5px; padding: 6px 8px; }
  .hud .eqbar { min-width: 16px; }
  .hud .btn.small { padding: 6px 8px; }
  .play-main .actions-wrap { grid-column: 2; grid-row: 2; border-left: 1px solid var(--line); background: #12151d; display: flex; flex-direction: column; justify-content: flex-end; min-height: 0; }
  .actions { border-top: 0; padding: 6px 8px 8px; gap: 6px; }
  .sizer { flex-wrap: wrap; height: auto; min-height: 34px; gap: 4px; }
  .sizer .btn.small { min-height: 32px; min-width: 0; flex: 1 1 20%; padding: 4px; }
  .sizer input[type=range] { flex: 1 1 calc(100% - 70px); height: 28px; }
  .sizer .amt { min-width: 0; }
  .act-row { grid-template-columns: 1fr 1fr !important; gap: 6px; }
  .act-row #raiseBtn { grid-column: 1 / -1; }
  .act-row .btn { min-height: 40px; }
  .center { --bw: clamp(30px, calc((100vw - 236px) * .095), 40px); gap: 3px; }
  .seat.hero .hole .cd { --w: 38px; }
  .seat.hero .stk.mine { bottom: 70px; }
  .dealer-spot { min-height: 24px; }
  /* who won moves off the crowded felt into the column, above this hand's result */
  .table-area .result-line { display: none; }
  .play-main .hud { flex-wrap: wrap; align-content: center; }
  .hud .hud-res { display: block; flex: 1 0 100%; font-size: 14px; font-weight: 700; color: #ffe2a8; line-height: 1.3; }
}
.hud-res { display: none; }
/* iPhone SE on its side: a slimmer column, so the table gets the width */
@media (max-width: 899px) and (orientation: landscape) and (max-height: 359px) {
  .play-main { grid-template-columns: minmax(0, 1fr) 208px; }
}
