/* casino-games-v2 (26 Oct 2026): Mayor Pinto's Tables (Twenty-One and Showdown) in the casino game family.
   PRESENTATION ONLY. Loaded after bean-tables.css (unchanged) and casino-games-v2.css, only by bean-machine/tables.html
   (body.tb2-page). The felt, the rim and the cards keep their own colours in every theme: they are the table.
   Everything around them takes the Night Room tokens (--cg-*), re-mapped onto the tables' own variables. */

/* ── the tables' variables, per theme (the page and its dialog both carry .tables-app) ── */
body.tb2-page .tables-app {
  --page: transparent; --panel: #160c2a; --panel-2: #1f1240; --line: #3a2766; --muted: #c9bce0; --cream: #f6eedf;
  --gold: #e2b955; --ink: #2a1a05; --turn: #ffd166; --ready: #8fd3ff;
  background: transparent; color: var(--cg-text); font: 15px/1.45 var(--cg-body);
}
body.tb2-page[data-theme="light"] .tables-app { --panel: #fffaf0; --panel-2: #f1e4c9; --line: #d9c49a; --muted: #4f3f6b; --cream: #1c1033; --gold: #8a6416; --ink: #fffaf0; --turn: #7a4a00; --ready: #1f5f8a; }
body.tb2-page[data-theme="dood"] .tables-app { --panel: #0b0b0b; --panel-2: #101a14; --line: rgba(0,255,160,.28); --muted: #a9dcc7; --cream: #effff8; --gold: #00ffa0; --ink: #00140c; --turn: #ffe29a; }
body.tb2-page dialog.tables-app { background: var(--cg-panel); color: var(--cg-text); border-color: var(--cg-rim-strong); }
body.tb2-page .tables-app.app { padding-top: 6px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }

/* the felt and everything on it keeps the dark-table palette in every theme */
body.tb2-page .tables-app .felt { --cream: #f6eedc; --muted: #d9ccb0; --turn: #ffd166; --ready: #8fd3ff; --ink: #1d1a14; color: #f6eedc; }

/* headings */
body.tb2-page .tables-app .h3 { font: 700 22px/1.1 var(--cg-display); color: var(--cg-gold-2); margin: 18px 0 8px; }
body.tb2-page .tables-app .h4 { font: 700 19px/1.1 var(--cg-display); color: var(--cg-gold-2); }
body.tb2-page .tables-app .table-head h1 { font: 400 clamp(22px, 4.6vw, 30px)/1.1 var(--cg-logo); color: var(--cg-gold-2); }
body.tb2-page[data-theme="light"] .tables-app .table-head h1 { color: #4b2690; }

/* ── buttons: pills; the gold "do it" buttons take the one Play colour ── */
body.tb2-page .tables-app button { border-radius: 999px; font-family: var(--cg-body); }
body.tb2-page .tables-app button.ghost { background: transparent; color: var(--cg-text); border: 1px solid var(--cg-rim); }
body.tb2-page .tables-app button.ghost:hover:not(:disabled) { background: var(--cg-hover); }
body.tb2-page .tables-app .game .row button:not(.ghost), body.tb2-page .tables-app .tcard .acts button:not(.ghost), body.tb2-page .tables-app .join-row button,
body.tb2-page .tables-app .gate button, body.tb2-page .tables-app .your-table button, body.tb2-page .tables-app .banner button, body.tb2-page .tables-app .inbox button,
body.tb2-page .tables-app .controls button:not(.ghost):not(.danger), body.tb2-page .tables-app .waiting button:not(.ghost):not(.danger), body.tb2-page .tables-app .seat.empty button, body.tb2-page .tables-app .seat button.small:not(.who):not(.mayorline) {
  background: var(--cg-play); color: var(--cg-play-ink); border: 0; box-shadow: 0 6px 18px var(--cg-play-glow);
}
body.tb2-page .tables-app button:disabled { box-shadow: none; }
body.tb2-page .tables-app .game .row button:disabled { background: var(--cg-panel-2); color: var(--cg-muted); border: 1px solid var(--cg-rim); }
body.tb2-page .tables-app .controls button { min-height: var(--cg-tap); padding: 0 22px; font-size: 16px; }
body.tb2-page .tables-app .seat .who, body.tb2-page .tables-app .seat .mayorline { border-radius: 8px; box-shadow: none; }
body.tb2-page .tables-app button:focus-visible, body.tb2-page .tables-app input:focus-visible, body.tb2-page .tables-app [tabindex]:focus-visible { outline: 3px solid var(--cg-gold-2); outline-offset: 2px; }

/* ── panels and cards ── */
body.tb2-page .tables-app .game, body.tb2-page .tables-app .tcard, body.tb2-page .tables-app .who-panel, body.tb2-page .tables-app .panel {
  background: var(--cg-panel); border: 1px solid var(--cg-rim); border-radius: var(--cg-r); color: var(--cg-text);
}
body.tb2-page .tables-app .tcard.yours, body.tb2-page .tables-app .your-table, body.tb2-page .tables-app .banner { border: 2px solid var(--cg-rim-strong); background: var(--cg-panel-2); box-shadow: 0 0 22px var(--cg-glow); color: var(--cg-text); }
body.tb2-page .tables-app .inbox { background: var(--cg-panel-2); border-color: var(--cg-rim-strong); color: var(--cg-text); }
body.tb2-page .tables-app .gate { background: var(--cg-glass); border: 1px solid var(--cg-rim-strong); border-radius: var(--cg-r); color: var(--cg-text); margin-bottom: 12px; }
body.tb2-page .tables-app .game b { font: 700 19px var(--cg-display); color: var(--cg-gold-2); }
body.tb2-page .tables-app .tcard b { font-size: 15.5px; }
body.tb2-page .tables-app .tcard .acts button { min-height: var(--cg-tap); padding: 0 18px; }
body.tb2-page .tables-app .pill { background: var(--cg-panel-2); color: var(--cg-text); border: 1px solid var(--cg-rim); }
body.tb2-page .tables-app .pill.you { background: var(--cg-play); color: var(--cg-play-ink); border: 0; }
body.tb2-page .tables-app .pill.house { background: #4a2f66; color: #f6e7ff; border: 0; }
body.tb2-page .tables-app .pilot { background: var(--cg-panel-2); color: var(--cg-muted); border: 1px solid var(--cg-rim); }
body.tb2-page .tables-app .join input { min-height: var(--cg-tap); padding: 0 16px; border-radius: 999px; border: 1px solid var(--cg-rim); background: var(--cg-field); color: var(--cg-text); font: 600 15px var(--cg-body); }
body.tb2-page .tables-app .join input::placeholder { color: var(--cg-muted); opacity: 1; }
body.tb2-page .tables-app .join label { font-weight: 600; }
body.tb2-page .tables-app .code-chip { background: var(--cg-panel-2); border-color: var(--cg-rim-strong); color: var(--cg-gold-2); font-family: var(--cg-num); }
body.tb2-page .tables-app .reactions button { background: var(--cg-panel-2); color: var(--cg-text); border: 1px solid var(--cg-rim); box-shadow: none; }
body.tb2-page .tables-app .msg { color: var(--cg-gold-2); font-weight: 600; }
body.tb2-page .tables-app .waiting .count { font: 700 30px var(--cg-num); color: var(--cg-gold-2); }
body.tb2-page .tables-app .badges span, body.tb2-page .tables-app .items label { background: var(--cg-panel-2); color: var(--cg-text); }

/* ── the lobby: the casino bar has Midway, the top bar has the name ── */
body.tb2-page .tables-app:has(> .csn) .home-link, body.tb2-page .tables-app .lobby-head .home-link { display: none; }
body.tb2-page .tables-app .lobby-head h1 { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body.tb2-page .tables-app .lobby-head p { margin: 0 0 6px; font-size: 14.5px; color: var(--cg-muted); }
body.tb2-page .tables-app .lobby-grid > div { display: flex; flex-direction: column; }
body.tb2-page .tables-app .lobby-grid > div > h2:nth-of-type(2) { order: -2; margin-top: 4px; }
body.tb2-page .tables-app .lobby-grid > div > #tables { order: -1; }
body.tb2-page .tables-app .lobby-grid > div > .tb2-empty { order: -3; }
/* signed out the lobby is empty: show the two tables instead of two bare headings */
body.tb2-page .tables-app .tb2-empty { display: none; }
body.tb2-page .tables-app .lobby-grid:has(#games:empty) .tb2-empty { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-top: 4px; }
body.tb2-page .tables-app .lobby-grid > div:has(#games:empty) > h2 { display: none; }
body.tb2-page .tables-app .tb2-game { display: grid; overflow: hidden; border-radius: var(--cg-r); border: 1px solid var(--cg-rim); background: var(--cg-panel); color: var(--cg-text); }
body.tb2-page .tables-app .tb2-game img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
body.tb2-page .tables-app .tb2-game span { display: grid; gap: 2px; padding: 10px 14px 12px; }
body.tb2-page .tables-app .tb2-game b { font: 700 20px var(--cg-display); color: var(--cg-gold-2); }
body.tb2-page .tables-app .tb2-game small { color: var(--cg-muted); font-size: 13px; }
body.tb2-page .tables-app .who-panel .h3 { margin-top: 0; }

/* ── the table: the felt is the stage, framed like the casino's cabinets ── */
body.tb2-page .tables-app .felt.twentyone, body.tb2-page .tables-app .felt.showdown { box-shadow: inset 0 0 0 3px var(--rim-hi), inset 0 0 60px #0008, 0 0 0 2px var(--cg-rim-strong), 0 16px 40px #0008, 0 0 40px var(--cg-glow); }
body.tb2-page .tables-app .felt .seat { background: #000000b0; }
body.tb2-page .tables-app .felt .seat.me { border-color: #f6d98b; }
body.tb2-page .tables-app .controls .spectator, body.tb2-page .tables-app .controls .muted { color: var(--cg-muted); }
body.tb2-page .tables-app .note { color: var(--cg-muted); }
body.tb2-page .tables-app .side .panel .small.muted { color: var(--cg-muted); }

@media (max-width: 760px) {
  body.tb2-page .tables-app.app { padding-left: 10px; padding-right: 10px; }
  body.tb2-page .tables-app .table-head { gap: 6px; margin-bottom: 8px; }
  /* the felt stays the first thing under the table's name; the controls follow it straight away */
  body.tb2-page .tables-app .felt.twentyone, body.tb2-page .tables-app .felt.showdown { padding: 8px; gap: 8px; }
  body.tb2-page .tables-app .mayor-img { width: 64px; height: 64px; }
}

/* ── motion: the system setting or the Motion switch ── */
body.tb2-page.still .tables-app .card.dealt, body.tb2-page.still .tables-app .bubble { animation: none; }
body.tb2-page.still .tables-app .timer i, body.tb2-page.still .tables-app .seat { transition: none; }

/* ── page width (bean-tables.css sizes ".tables-app .app", but on this page they are the same element) ── */
body.tb2-page .app.tables-app { max-width: 1320px; margin: 0 auto; padding: 6px 16px calc(24px + env(safe-area-inset-bottom)); }
body.tb2-page .tables-app .who-panel:has(#who:empty) { display: none; }
body.tb2-page .tables-app .lobby-grid:has(#who:empty) { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 760px) {
  /* phones: the tables first, the longer welcome after them */
  body.tb2-page .tables-app #view-lobby { display: flex; flex-direction: column; }
  body.tb2-page .tables-app #view-lobby > .lobby-head { order: 5; margin-top: 14px; }
}
@media (max-width: 560px) {
  body.tb2-page .tables-app .tb2-game { grid-template-columns: 112px minmax(0, 1fr); align-items: center; }
  body.tb2-page .tables-app .tb2-game img { height: 100%; aspect-ratio: auto; min-height: 84px; }
  body.tb2-page .tables-app .tb2-game span { padding: 8px 12px; }
  body.tb2-page .tables-app .tb2-game b { font-size: 18px; }
}
body.tb2-page .tables-app { overflow-x: clip; } /* lets the phone's control bar stick (overflow "hidden" made a scroll box) */
body.tb2-page[data-theme="light"] .tables-app .status.playing { background: #ffe9a6; color: #4a3200; }
body.tb2-page[data-theme="light"] .tables-app .status.ready { background: #d7ecfb; color: #0f3a57; }
body.tb2-page .tables-app .tb2-empty { max-width: 880px; }

/* Ready / Hit / Stand / Draw stay on screen: the control bar sticks to the bottom of the window while the felt is in
   view (lab-mobile.css gives every .table-wrap overflow:auto, which made it a scroll box; the felt needs no scrolling) */
body.tb2-page .tables-app .table-wrap { overflow: visible; }
body.tb2-page .tables-app .controls { position: sticky; bottom: max(8px, env(safe-area-inset-bottom)); z-index: 8; margin: 12px auto 6px; padding: 8px 12px; width: fit-content; max-width: 100%; border-radius: 999px; background: color-mix(in srgb, var(--cg-panel) 94%, transparent); border: 1px solid var(--cg-rim-strong); box-shadow: 0 -6px 24px #0006; }
body.tb2-page .tables-app .controls:empty { display: none; }
