/* Card Platform: the game screens' own layer (#tp-root). v0.1.9 (Task 9R): the invented felt / seat / card layouts are
   gone; the table itself is the old app's (css/cp-table.css, js/games/table/). This file keeps the portrait setup screens,
   the session / online screens and the small shared pieces (chip stack, bet meter, leave confirm, joker picker). */
html.tp-open, html.tp-open body { overflow: hidden; }
#tp-root { position: fixed; inset: 0; z-index: 900; display: flex; flex-direction: column; background: var(--c-bg); color: var(--text);
  font-family: var(--font-ui); padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#tp-root button { font: inherit; min-height: var(--tap-min); min-width: var(--tap-min); border-radius: var(--r-md); border: 1px solid var(--panel-line);
  background: var(--c-surface); color: var(--text); padding: 0 var(--sp-3); cursor: pointer; }
#tp-root button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: var(--fw-semibold); }
#tp-root button.danger { color: var(--c-card-red); }
#tp-root button.ghost { background: transparent; }
#tp-root button:disabled { opacity: .42; cursor: default; }
#tp-root .hidden { display: none !important; }
/* v0.1.10: the game setup is the old app's Play now modal (#modal-box.play-diff); these screens are the playlist / online session pages */
.tp-setup { margin: 0 auto; width: min(560px, 100%); max-width: 100%; max-height: 100%; overflow-x: hidden; overflow-y: auto; padding: var(--sp-5) var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); box-sizing: border-box; }
.tp-setup-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); min-width: 0; width: 100%; box-sizing: border-box; }
.tp-setup-head h2 { min-width: 0; flex: 1 1 auto; }
.tp-setup-head .badge-18 { flex: 0 0 auto; }
.tp-setup h2 { font-family: var(--font-display); font-size: var(--fs-p-h1); margin: 0; }
.tp-setup h2 small { display: block; font-family: var(--font-ui); font-size: var(--fs-p-small); color: var(--muted); font-weight: var(--fw-medium); }
.tp-field { display: flex; flex-direction: column; gap: var(--sp-1); font-weight: var(--fw-semibold); font-size: var(--fs-p-small); }
.tp-field select { font: inherit; font-weight: var(--fw-regular); font-size: var(--fs-p-body); min-height: var(--tap-min); border-radius: var(--r-md); border: 1px solid var(--panel-line); background: var(--c-surface-2); color: var(--text); padding: 0 var(--sp-2); }
.tp-hint, .tp-note { margin: 0; font-size: var(--fs-p-small); color: var(--muted); line-height: var(--lh-snug); }
.tp-error { margin: 0; min-height: 1.2em; color: var(--c-card-red); font-size: var(--fs-p-small); font-weight: var(--fw-semibold); }
.tp-row { display: flex; gap: var(--sp-2); justify-content: flex-end; flex-wrap: wrap; }
/* v0.1.4 chips (chip stack with its number), flying chips */
.tp-chips { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; font-weight: var(--fw-bold); }
.tp-pile { display: inline-flex; flex-direction: column-reverse; }
.tp-pile i, .tp-fly { display: block; width: 14px; height: 5px; margin-top: -2px; border-radius: 50%; background: #C9A44C; border: 1px solid #7a5a1e; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35); }
.tp-pile i:nth-child(2) { background: #B3382C; border-color: #6d1f18; } .tp-pile i:nth-child(3) { background: #1F5A9E; border-color: #123866; } .tp-pile i:nth-child(4) { background: #1E2A2C; border-color: #000; }
.tp-chips.stack b::before { content: none; }
.tp-stack::before { content: none; }
.tp-chips.stack .tp-pile i { width: 10px; height: 4px; margin-top: -1px; }
.tp-chips.stack .tp-pile i:nth-child(n+3) { display: none; }
.tp-fly { position: absolute; z-index: 4; width: 16px; height: 16px; border-radius: 50%; margin: 0; border: 2px dashed #fff8; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .tp-fly { display: none; } .tp-pop { animation: none !important; } }
/* v0.1.4 betting meter (v0.1.9: inside the table's bet sheet) */
.tp-meter { display: grid; grid-template-columns: auto 1fr auto auto auto; align-items: center; gap: 6px; width: min(100%, 520px); }
.tp-meter input[type=range] { width: 100%; min-height: 32px; accent-color: var(--accent); }
#tp-root .tp-q { min-width: 44px; padding: 0 6px; font-size: var(--fs-p-small); }
.tp-meter.off { opacity: .55; }
.tp-chipval { min-width: 56px; }
.tp-meter.q3 { grid-template-columns: auto 1fr auto auto auto auto; }
/* setup: table type, number fields */
#tp-root .tp-seg button.on { border: 2px solid var(--accent); font-weight: var(--fw-semibold); }
.tp-field input[type=number] { font: inherit; min-height: var(--tap-min); border-radius: var(--r-md); border: 1px solid var(--panel-line); background: var(--c-surface-2); color: var(--text); padding: 0 var(--sp-2); }
.tp-me { position: relative; }
.tp-emoji-panel { position: absolute; bottom: 100%; right: 8px; z-index: 6; background: var(--c-surface); border: 1px solid var(--panel-line); border-radius: var(--r-lg); padding: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); width: min(320px, calc(100% - 16px)); }
/* v0.1.5: leave confirm, joker picker */
#tp-root.hidden { display: none; }
.tp-confirm { position: absolute; inset: 0; z-index: 8; background: rgba(0, 0, 0, .45); display: grid; place-items: center; padding: var(--sp-4); }
.tp-confirm-box { background: var(--c-surface); border-radius: var(--r-lg); padding: var(--sp-4); max-width: 340px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.tp-confirm-box h3 { margin: 0 0 var(--sp-2); font-family: var(--font-display); }
.tp-confirm-box p { margin: 0 0 var(--sp-3); }
#tp-root .tp-jp { min-width: 44px; padding: 0 8px; }
#tp-root .tp-jp.on { border: 2px solid #C9A44C; background: #F6E8C3; color: #1E2A2C; }
/* v0.1.6 multi-game session: playlist setup, the in-table strip, the next-game screen, results */
.ss-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ss-entry { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--panel-line); border-radius: var(--r-md, 10px); background: var(--c-surface); }
.ss-entry select { min-height: 36px; max-width: 46%; }
.ss-n { font-weight: var(--fw-bold); min-width: 1.4em; }
.ss-rounds { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.ss-rounds input { width: 3.6em; min-height: 36px; }
.ss-tools { margin-left: auto; display: inline-flex; gap: 2px; }
.ss-tools button { min-width: 36px; min-height: 36px; padding: 0 6px; }
.ss-add { flex-wrap: wrap; }
.ss-check { flex-direction: row; align-items: center; gap: 8px; }
.ss-strip { margin: 0 var(--sp-2); padding: 2px 8px; border-radius: var(--r-pill); background: #1E2A2C; color: #F3EEE2; font-size: 12px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ss-table th, .ss-table td { padding: 6px 4px; border-bottom: 1px solid var(--panel-line); text-align: right; }
.ss-table th:first-child, .ss-table td:first-child { text-align: left; }
.ss-table tr.me td { font-weight: var(--fw-bold); }
.ss-table td.up { color: var(--accent); } .ss-table td.down { color: var(--c-card-red); }
.ss-tally { font-weight: var(--fw-bold); }
/* v0.1.7 online tables (flag onlineTables only): wallet, online session, the strip's Away button */
.ss-strip-away { display: flex; align-items: center; gap: 6px; padding-right: 2px; }
.ss-strip-away .ss-strip-t { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ss-strip-away.away { background: #5A4A1E; }
.ot-panel { border: 1px solid var(--panel-line); border-radius: 12px; padding: var(--sp-2); margin: var(--sp-2) 0; }
.ot-panel h3 { margin: 0 0 4px; font-size: 15px; }
.ot-playnow { border-top: 1px solid var(--panel-line); border-bottom: 1px solid var(--panel-line); padding: 8px 0; display: flex; flex-direction: column; gap: 12px; } /* v0.1.26 Play now */
.ot-playnow h4 { margin: 0; font-size: 16px; }
.ot-bank b { font-variant-numeric: tabular-nums; }
.ot-card { display: inline-block; min-width: 28px; padding: 2px 4px; margin: 0 2px; border-radius: 4px; background: #fff; color: #111; text-align: center; font-weight: var(--fw-bold); }
.ot-card.back { background: #1E2A2C; color: #F3EEE2; }
.ot-away { padding: 4px 8px; border-radius: 8px; background: #5A4A1E; color: #F3EEE2; }
/* v0.1.8 profile (chips flag only) */
.ot-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px var(--sp-2); margin: var(--sp-2) 0; }
.ot-stats div { border: 1px solid var(--panel-line); border-radius: 10px; padding: 6px 10px; }
.ot-stats dt { font-size: 12px; opacity: .8; } .ot-stats dd { margin: 0; font-size: 18px; font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }
.ot-stats dd.up { color: var(--accent); } .ot-stats dd.down { color: var(--c-card-red); }
.ot-profile h3 { font-size: 15px; margin: var(--sp-2) 0 4px; }
.ot-profile .ss-table small { opacity: .75; font-weight: normal; }
.ot-profile .ss-table td.live { color: inherit; font-style: italic; opacity: .8; }
/* v0.1.9 ad slots on the session screens (outside a hand only): in the page flow, fixed AdSense sizes */
.tp-setup .ad-slot.ss-ad { position: relative; inset: auto; margin: 10px auto 4px; width: 300px; max-width: 100%; }
.tp-setup .ss-ad-break { height: calc(250px + var(--ad-label-h, 16px)); }
.tp-setup .ad-reward-slot { height: calc(50px + var(--ad-label-h, 16px)); }
.tp-setup .ss-ad .ad-fill a { pointer-events: auto; }
/* v0.1.12: the 8px rule on the playlist and online session pages: every control >= 8px from the next control and from
   nearby text (the playlist rows, the up / down / remove tools, the Hands field, the labelled selects, the online panels) */
.ss-list, .ss-entry, .ss-rounds, .ss-tools { gap: 8px; }
.tp-field { gap: 8px; }
.ot-panel { display: flex; flex-direction: column; gap: 8px; }
.ot-panel > h3, .ot-panel > p, .ot-panel > .tp-row { margin: 0; }
.tp-setup .ad-slot.ss-ad { margin: 8px auto; }
.tp-setup .ad-slot.ss-ad .ad-label { margin-bottom: 8px; } /* the label text 8px clear of the ad under it: */
.tp-setup .ad-slot.ss-ad .ad-label { height: auto; min-height: var(--ad-label-h, 16px); line-height: 1.25; text-align: center; } /* a long label may wrap on a narrow phone */
.tp-setup .ss-ad-break, .tp-setup .ad-reward-slot { height: auto; }
.tp-setup .ss-ad-break .ad-fill { flex: none; height: 250px; }
.tp-setup .ad-reward-slot .ad-fill { flex: none; height: 50px; }
.tp-setup .tp-note, .tp-setup .tp-hint { line-height: 1.4; } /* a tight line box let the text run 1px into the 8px gap */

/* v0.1.31 ranking / leaderboard (current palette, no new theme) */
.ot-rank-view .ot-rank-game { margin: 0 0 1rem; }
.ot-rank-line { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ot-rank-sr { font-variant-numeric: tabular-nums; font-feature-settings: var(--num-features, "tnum" 1); }
.ot-rank-badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: var(--fs-p-caption, 0.75rem); background: var(--c-surface-3, #E4D9C6); color: var(--c-ink, #1E2A2C); }
.ot-rank-badge-jack, .ot-rank-badge-queen, .ot-rank-badge-king { background: var(--c-sage, #8FA98F); color: var(--c-ink, #1E2A2C); }
.ot-rank-badge-ace, .ot-rank-badge-royal, .ot-rank-badge-legend { background: var(--c-accent, #1F6B66); color: var(--c-on-accent, #FBF8F2); }

/* v0.1.32: the existing game tab control (Play now setup / How to play) also styles the leaderboard tabs in #tp-root */
#tp-root .cp-tabs, .tp-setup .cp-tabs {
  display: flex; gap: 8px; width: 100%; box-sizing: border-box; padding: 2px; margin: 8px 0;
  border-radius: 999px; background: var(--c-surface-2, rgba(255, 255, 255, .05)); border: 1px solid var(--c-border, rgba(255, 255, 255, .08));
}
#tp-root .cp-tabs .cp-tab, .tp-setup .cp-tabs .cp-tab {
  flex: 1 1 0; min-width: 0; min-height: 44px; padding: 0 6px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted, var(--c-text-2, #5C6B6D)); font: 600 13px/1.15 var(--font-ui, inherit);
  white-space: normal; overflow-wrap: anywhere; box-shadow: none;
}
#tp-root .cp-tabs .cp-tab[aria-selected="true"], #tp-root .cp-tabs .cp-tab.primary,
.tp-setup .cp-tabs .cp-tab[aria-selected="true"], .tp-setup .cp-tabs .cp-tab.primary {
  background: var(--c-primary, var(--accent, #1f6f63)); color: var(--c-on-primary, var(--accent-ink, #fff));
}

/* v0.1.33: leaderboard uses the existing Online tables sheet (tp-setup / tp-setup-head) and the same panel / list
   row-card pattern as the public-tables list and playlist rows (ot-panel, ot-pub-list / ss-entry). No new theme. */
.ot-leaderboard-view #ot-lb-board { margin: 0; }
.ot-lb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ot-lb-row { display: flex; align-items: center; gap: 8px; min-width: 0; box-sizing: border-box;
  height: 44px; padding: 0 12px; border: 1px solid var(--panel-line); border-radius: 10px; background: var(--c-surface); }
.ot-lb-place { flex: 0 0 auto; font-variant-numeric: tabular-nums; font-weight: var(--fw-semibold); min-width: 1.4em; }
.ot-lb-name { flex: 1 1 auto; min-width: 0; text-align: left; overflow-wrap: anywhere; }
.ot-lb-sr { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.ot-lb-events { flex: 0 0 auto; margin: 0; white-space: nowrap; }
.ot-lb-row.me { font-weight: var(--fw-bold); border: 1.5px solid #1F6B66; background: rgba(31,107,102,.07); }
/* B9 You card + A12 one-style tier pills */
.ot-you-card { margin: 0 0 14px; padding: 14px; }
.ot-you-place { font: 600 18px/1.2 var(--font-display, "Fraunces", serif); color: var(--c-ink, #1E2A2C); }
.ot-you-meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.ot-you-card .rd-bar { margin-top: 10px; }
.ot-rank-view .ot-rank-badge,
.ot-leaderboard-view .ot-rank-badge,
.ot-you-card .rd-rank {
  background: #EFE7D8;
  border: 1px solid #8A6A50;
  color: #1E2A2C;
}
.ot-leaderboard-view #lb-games, .ot-rank-view .rd-seg { margin: 0 0 14px; }
.ot-leaderboard-view #lb-games { display: flex; background: var(--c-surface-2, #EFE7D8); border-radius: 999px; padding: 4px; gap: 4px; }
.ot-leaderboard-view #lb-games .cp-tab { flex: 1; text-align: center; padding: 10px 6px; border-radius: 999px; }
.ot-leaderboard-view #lb-games .cp-tab.primary { background: var(--c-accent, #1F6B66); color: var(--c-on-accent, #FBF8F2); }
.ot-leaderboard-view #ot-leaderboard-page,
.ot-rank-view { display: flex; flex-direction: column; gap: 12px; }


.ot-lb-row .ot-rank-badge { flex: 0 0 auto; }
#tp-root { box-sizing: border-box; overflow-x: hidden; }
