/* Mayor Pinto's Tables (release "Tables and Doodle", candidate): the milestone-3 preview stylesheet, every rule scoped
   under .tables-app so the site header and Beanville styles are untouched; preview-only rules (test bar) dropped. */
.tables-app {
  --felt: #0f5132; --felt-hi: #188052; --felt-dark: #083321; --rim: #6b3f1f; --rim-hi: #a0683a; --gold: #d4ab52; --cream: #f6eedc; --ink: #1d1a14;
  --page: #13110d; --panel: #1f1b14; --panel-2: #2a2419; --line: #3c3426; --muted: #b9ad94;
  --win: #7fd18b; --lose: #e58d80; --push: #e2c86a; --turn: #ffd166; --ready: #8fd3ff; --away: #9a9a9a;
  --seat-w: clamp(124px, 15vw, 162px);
}
.tables-app, .tables-app * { box-sizing: border-box; }
.tables-app [hidden] { display: none !important; }
.tables-app { -webkit-text-size-adjust: 100%; }
.tables-app { margin: 0; background: var(--page); color: var(--cream); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; overflow-x: hidden; }
.tables-app button, .tables-app select, .tables-app input { font: inherit; }
.tables-app button { background: var(--gold); color: var(--ink); border: 0; border-radius: 9px; padding: 8px 14px; font-weight: 700; cursor: pointer; min-height: 38px; }
.tables-app button.ghost { background: transparent; color: var(--cream); border: 1px solid #5a4f3c; }
.tables-app button.small { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.tables-app button.danger { background: #7a2f26; color: #fff; }
.tables-app button:disabled { opacity: .45; cursor: default; }
.tables-app button:focus-visible, .tables-app [tabindex]:focus-visible, .tables-app input:focus-visible, .tables-app select:focus-visible { outline: 3px solid var(--turn); outline-offset: 2px; }
.tables-app .muted { color: var(--muted); } .tables-app .small { font-size: 13px; }
.tables-app h1 { margin: 0; font-size: 24px; letter-spacing: .3px; }
.tables-app .h3 { font-size: 16px; color: var(--gold); margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tables-app .h4 { font-size: 14px; color: var(--gold); margin: 0 0 6px; }
.tables-app .tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; text-transform: uppercase; letter-spacing: .4px; }
.tables-app .tag.proposed { background: #3d3523; color: #e8d9a8; }
.tables-app .tag.sim { background: #233a4d; color: #bfe3ff; }
.tables-app .tag.proto { background: #4d2340; color: #ffc6ea; }

.tables-app .tools { position: absolute; top: 26px; right: 0; background: #fff6cc; padding: 10px; border-radius: 8px; box-shadow: 0 6px 18px #0005; width: min(320px, 90vw); display: grid; gap: 8px; }
.tables-app #bots label { display: flex; gap: 6px; align-items: center; margin: 3px 0; }
.tables-app .chk { display: inline-flex; gap: 4px; align-items: center; }

.tables-app .app { max-width: 1320px; margin: 0 auto; padding: 16px; }

/* ── lobby ── */
.tables-app .lobby-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.tables-app .lobby-head p { margin: 4px 0 0; max-width: 62ch; }
.tables-app .lobby-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; }
.tables-app .your-table, .tables-app .inbox, .tables-app .banner { margin-top: 14px; background: linear-gradient(90deg, #3a2f12, #2a2419); border: 2px solid var(--gold); border-radius: 14px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.tables-app .inbox { border-color: var(--ready); background: #16263a; display: grid; }
.tables-app .inbox .inv { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.tables-app .games { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.tables-app .game { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 6px; }
.tables-app .game .row { display: flex; gap: 8px; flex-wrap: wrap; }
.tables-app .table-list { display: grid; gap: 8px; }
.tables-app .tcard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.tables-app .tcard.yours { border: 2px solid var(--gold); background: #2b2412; }
.tables-app .tcard .acts { grid-row: span 2; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tables-app .tcard .meta { font-size: 13px; color: var(--muted); }
.tables-app .pill { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 8px; background: #3a3220; color: var(--cream); margin-left: 6px; vertical-align: 1px; }
.tables-app .pill.you { background: var(--gold); color: var(--ink); }
.tables-app .join { margin-top: 14px; display: grid; gap: 4px; }
.tables-app .join-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.tables-app .join input { min-width: 0; padding: 8px 10px; border-radius: 9px; border: 1px solid #5a4f3c; background: #0003; color: var(--cream); }
.tables-app .nights { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.tables-app .nights li { background: var(--panel); border: 1px dashed #5a4f3c; border-radius: 10px; padding: 8px 12px; display: grid; }
.tables-app .who-panel { background: var(--panel); border-radius: 14px; padding: 12px 14px; align-self: start; }
.tables-app .who-list { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.tables-app .who-list li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.tables-app .who-list img { width: 34px; height: 34px; }
.tables-app .who-list span { display: grid; min-width: 0; }
.tables-app .who-list b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── table header ── */
.tables-app .table-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; margin-bottom: 12px; }
.tables-app .table-head .title { min-width: 0; }
.tables-app .table-head h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tables-app .head-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tables-app .code-chip { font: 700 15px ui-monospace, Menlo, monospace; background: #0005; border: 1px solid var(--gold); border-radius: 8px; padding: 6px 10px; letter-spacing: 2px; }
.tables-app .table-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }

/* ── the felt ── */
.tables-app .felt { position: relative; width: 100%; color: var(--cream); }
.tables-app .felt.twentyone {
  aspect-ratio: 16 / 9.6; border-radius: 26px 26px 50% 50% / 26px 26px 100% 100%;
  background: radial-gradient(ellipse at 50% 8%, var(--felt-hi), var(--felt) 45%, var(--felt-dark));
  border: 14px solid var(--rim); box-shadow: inset 0 0 0 3px var(--rim-hi), inset 0 0 60px #0008, 0 10px 30px #0008;
}
.tables-app .felt.twentyone::after { content: "BLACKJACK PAYS 35 · MAYOR STANDS ON 17"; position: absolute; left: 50%; top: 31%; transform: translateX(-50%); font: 700 12px/1 system-ui; letter-spacing: 3px; color: #ffffff38; white-space: nowrap; pointer-events: none; }
.tables-app .felt.showdown {
  aspect-ratio: 16 / 10.4; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 45%, var(--felt-hi), var(--felt) 50%, var(--felt-dark));
  border: 16px solid var(--rim); box-shadow: inset 0 0 0 3px var(--rim-hi), inset 0 0 70px #0009, 0 10px 30px #0008;
}
.tables-app .dealer { position: absolute; left: 50%; top: 2%; transform: translateX(-50%); display: grid; justify-items: center; gap: 4px; width: min(360px, 60%); text-align: center; z-index: 2; }
.tables-app .felt.showdown .dealer { top: 4%; }
.tables-app .mayor-face { font-size: 30px; background: #0007; border: 3px solid var(--gold); border-radius: 50%; width: 58px; height: 58px; display: grid; place-items: center; box-shadow: 0 4px 12px #0007; }
.tables-app .dealer .lbl { font-weight: 800; letter-spacing: .3px; }
.tables-app .dealer .cards { justify-content: center; }
.tables-app .dealer .vs { font-size: 12px; color: #e7ffe9cc; }
.tables-app .center { position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%); width: min(300px, 42%); text-align: center; display: grid; gap: 6px; justify-items: center; z-index: 1; }
.tables-app .felt.showdown .center { top: 52%; width: min(320px, 40%); background: #0003; border: 1px solid #ffffff22; border-radius: 18px; padding: 10px 12px; }
.tables-app .center .big { font-size: 20px; font-weight: 800; color: var(--turn); }
.tables-app .center .info { font-size: 13px; color: #e7ffe9cc; }
.tables-app .center .guide { font-size: 11px; color: #e7ffe9aa; line-height: 1.35; }

.tables-app .seats { position: absolute; inset: 0; pointer-events: none; }
.tables-app .seat { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%); width: var(--seat-w); pointer-events: auto;
  background: #000a; border: 2px solid #ffffff2a; border-radius: 14px; padding: 7px 8px; display: grid; gap: 4px; align-content: start; z-index: 3; transition: border-color .2s, box-shadow .2s; }
.tables-app .seat.me { border-color: var(--gold); box-shadow: 0 0 0 3px #d4ab5255, 0 6px 16px #0008; }
.tables-app .seat.turn { border-color: var(--turn); box-shadow: 0 0 0 3px #ffd16688, 0 0 22px #ffd16655; }
.tables-app .seat.focus { outline: 2px dashed #ffffff66; outline-offset: 3px; }
.tables-app .seat.empty { border-style: dashed; background: #0004; justify-items: center; text-align: center; color: var(--muted); min-height: 76px; align-content: center; }
.tables-app .seat .who { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 6px; align-items: center; background: none; border: 0; padding: 0; color: inherit; text-align: left; min-height: 0; font-weight: 400; cursor: pointer; border-radius: 8px; }
.tables-app .seat .who img { width: 38px; height: 38px; border-radius: 50%; background: #fff1; }
.tables-app .seat .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.tables-app .seat .who .sub { display: block; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tables-app .status { justify-self: start; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; border-radius: 99px; padding: 1px 7px; }
.tables-app .status.waiting { background: #3a3220; color: #e8d9a8; } .tables-app .status.ready { background: #16405c; color: var(--ready); }
.tables-app .status.playing { background: #5c4a10; color: var(--turn); } .tables-app .status.finished { background: #1f4a2a; color: var(--win); } .tables-app .status.away { background: #333; color: #ccc; }
.tables-app .seat .line { font-size: 12px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tables-app .seat .total { font-weight: 800; font-size: 15px; }
.tables-app .seat .mayorline { font-size: 11px; color: #e7ffe9cc; background: none; border: 0; padding: 0; min-height: 0; text-align: left; font-weight: 400; cursor: pointer; text-decoration: underline dotted; }
.tables-app .badge { display: inline-block; border-radius: 6px; padding: 1px 7px; font-weight: 800; font-size: 12px; background: #333; }
.tables-app .badge.win, .tables-app .badge.blackjack { background: #2d6a3a; color: #dfffe4; } .tables-app .badge.lose { background: #6a2d2d; color: #ffe1dc; } .tables-app .badge.push, .tables-app .badge.tie { background: #6a5a2d; color: #fff3cf; }
.tables-app .badge.practice { background: #2f3f6a; color: #dfe8ff; }
.tables-app .bubble { position: absolute; left: 50%; top: -14px; transform: translate(-50%, -100%); background: #fff; color: var(--ink); border-radius: 12px; padding: 4px 9px; font-size: 12.5px; font-weight: 700; white-space: nowrap; box-shadow: 0 4px 12px #0007; animation: tbl-pop 3.2s ease forwards; z-index: 6; }
.tables-app .bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); border: 6px solid transparent; border-top-color: #fff; border-bottom: 0; }
@keyframes tbl-pop { 0% { opacity: 0; transform: translate(-50%, -80%) scale(.8); } 8% { opacity: 1; transform: translate(-50%, -100%) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; } }

.tables-app .cards { display: flex; gap: 3px; flex-wrap: wrap; }
.tables-app .card { width: 30px; height: 42px; border-radius: 5px; background: #fffdf6; color: #111; display: grid; place-items: center; font: 800 12.5px/1 system-ui; box-shadow: 0 2px 4px #0006; position: relative; user-select: none; }
.tables-app .dealer .card { width: 34px; height: 48px; font-size: 14px; }
.tables-app .felt.showdown .seat .card { width: 26px; height: 37px; font-size: 11.5px; }
.tables-app .card.red { color: #c0262d; }
.tables-app .card.back { background: repeating-linear-gradient(45deg, #7a1f2b 0 5px, #93283a 5px 10px); border: 2px solid #fff; }
.tables-app .card.held { outline: 3px solid var(--turn); transform: translateY(-5px); }
.tables-app .card[role="button"] { cursor: pointer; }
.tables-app .card i { position: absolute; bottom: -13px; font: 800 8px/1 system-ui; color: var(--turn); font-style: normal; }
.tables-app .card.dealt { animation: tbl-deal .35s ease-out; }
@keyframes tbl-deal { from { transform: translateY(-30px) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
.tables-app .timer { height: 5px; border-radius: 3px; background: #ffffff22; overflow: hidden; }
.tables-app .timer i { display: block; height: 100%; background: var(--turn); transition: width .9s linear; }
.tables-app .center .timer { width: 100%; }

.tables-app .controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; margin: 14px 0 6px; min-height: 40px; }
.tables-app .controls .spectator { color: var(--muted); }
.tables-app .reactions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.tables-app .reactions button { background: var(--panel-2); color: var(--cream); border: 1px solid var(--line); padding: 4px 9px; min-height: 32px; font-weight: 600; font-size: 13px; }
.tables-app .msg { min-height: 1.4em; text-align: center; color: var(--turn); margin: 8px 0 0; }

/* ── side panels ── */
.tables-app .side { display: grid; gap: 12px; }
.tables-app .panel { background: var(--panel); border-radius: 14px; padding: 12px 14px; }
.tables-app .waiting h2 { margin: 0 0 6px; }
.tables-app .waiting .count { font-size: 28px; font-weight: 900; color: var(--turn); }
.tables-app .waiting ul { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 4px; }
.tables-app .waiting li { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.tables-app .waiting .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.tables-app .chat-toggle { width: 100%; display: flex; gap: 6px; align-items: center; background: none; color: var(--gold); padding: 0; min-height: 28px; text-align: left; }
.tables-app .unread { background: #e05a47; color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; margin-left: auto; }
.tables-app .chat-log { list-style: none; padding: 0; margin: 8px 0; max-height: 260px; overflow-y: auto; display: grid; gap: 5px; align-content: start; }
.tables-app .chat-log li { font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px; }
.tables-app .chat-log li b { color: var(--gold); }
.tables-app .chat-log li .mod { opacity: .4; display: flex; gap: 2px; }
.tables-app .chat-log li:hover .mod, .tables-app .chat-log li:focus-within .mod { opacity: 1; }
.tables-app .chat-log .mod button { background: none; color: var(--muted); border: 0; padding: 0 3px; min-height: 0; font-size: 12px; }
.tables-app .chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.tables-app .chat-form input { min-width: 0; padding: 7px 9px; border-radius: 9px; border: 1px solid #5a4f3c; background: #0003; color: var(--cream); }
.tables-app .handlog { padding-left: 18px; margin: 0; font-size: 12.5px; color: var(--muted); }

/* ── dialog ── */
.tables-app dialog { background: var(--panel); color: var(--cream); border: 2px solid var(--gold); border-radius: 16px; padding: 18px; width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); }
.tables-app dialog::backdrop { background: #000a; }
.tables-app .prof { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; align-items: center; }
.tables-app .prof img { width: 96px; height: 96px; border-radius: 16px; background: #fff1; }
.tables-app .prof h2 { margin: 0; font-size: 20px; }
.tables-app .badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.tables-app .badges span { background: #3a3220; border-radius: 99px; padding: 2px 9px; font-size: 12.5px; }
.tables-app .dlg-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.tables-app .dlg-acts .wide { grid-column: 1 / -1; }
.tables-app .note { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }
.tables-app .items { display: grid; gap: 6px; margin: 10px 0; }
.tables-app .items label { display: flex; gap: 8px; align-items: center; background: var(--panel-2); border-radius: 10px; padding: 8px 10px; }
.tables-app .items label.off { opacity: .5; }

/* ── gallery ── */
.tables-app .gal-group { margin-bottom: 16px; }
.tables-app .gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tables-app .ach { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 3px; }
.tables-app .ach.earned { border-color: var(--gold); background: #2b2412; }
.tables-app .ach.locked { opacity: .7; }
.tables-app .ach .ic { font-size: 26px; }
.tables-app .prize { border-style: dashed; }

/* ── responsive ── */
@media (max-width: 1100px) {
  .tables-app .table-wrap, .tables-app .lobby-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .tables-app .app { padding: 10px; }
  .tables-app h1 { font-size: 20px; }
  .tables-app .table-head { grid-template-columns: minmax(0, 1fr); }
  .tables-app .table-head .back { justify-self: start; }
  .tables-app .head-actions { justify-content: flex-start; }
  /* the felt keeps its colour and rim but the seats flow into a grid: nothing is cut off and nothing scrolls sideways */
  .tables-app .felt.twentyone, .tables-app .felt.showdown { aspect-ratio: auto; border-radius: 22px 22px 40px 40px; border-width: 8px; padding: 10px; display: grid; gap: 10px; }
  .tables-app .felt.showdown { border-radius: 40px; }
  .tables-app .felt.twentyone::after { display: none; }
  .tables-app .dealer, .tables-app .center, .tables-app .felt.showdown .center { position: static; transform: none; width: 100%; }
  .tables-app .center { order: 2; }
  .tables-app .seats { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; order: 3; }
  .tables-app .seat { position: relative; left: auto; top: auto; transform: none; width: auto; }
  .tables-app .seat.me { grid-column: 1 / -1; order: -1; }
  .tables-app .card { width: 28px; height: 40px; }
  .tables-app .dlg-acts { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .tables-app .card.dealt, .tables-app .bubble { animation: none; } .tables-app .timer i { transition: none; } }
.tables-app .seat .cards:has(.held) { margin-bottom: 9px; }

/* Developer and test tools are hidden unless the page is opened with ?qa=1 (remembered; ?qa=0 turns it off). */
.tables-app .home-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-decoration: none; color: inherit; opacity: .85; margin-bottom: 6px; }
.tables-app .home-link:hover { opacity: 1; text-decoration: underline; }

.tables-app .mayor-img { width: 92px; height: 92px; object-fit: cover; object-position: 50% 8%; border-radius: 50%; border: 2px solid #d4b06a; background: #0f4a35; display: block; margin: 0 auto 4px; }

/* the button the casino's "Create your own table" pointed at */
.tables-app .suggest { outline: 2px solid #f6d98b; outline-offset: 3px; box-shadow: 0 0 0 6px #e2b95533; }

.tables-app .gate { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.tables-app .pilot { display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: #233a4d; color: #bfe3ff; text-transform: uppercase; letter-spacing: .4px; vertical-align: middle; }
/* Tables Live: the Mayor's Regulars (house players) */
.tables-app .badge.house { background: #5a3a7a; color: #f3e6ff; letter-spacing: .04em; }
.tables-app .pill.house { background: #4a2f66; color: #f6e7ff; }
.tables-app .seat.npc { border-style: dashed; }
.tables-app .seat.npc .who img { filter: saturate(.9); }
.tables-app .seat.npc .sub .badge.house { font-size: 10px; padding: 0 6px; margin-right: 2px; }

/* Tables Live: the shared Casino bar (js/casino-nav.mjs + css/casino-skin.css, from the arcade redesign) on this page.
   casino-skin.css scopes its colours to body.bm-page.cas-skin; this page keeps its own look, so the bar's tokens are set here. */
body.tables-casino {
  --bg: #13110d; --text: #f6eedf; --muted: #bcaed6; --accent-soft: #e2b9551f;
  --f-display: "Cormorant Garamond", Georgia, serif; --f-body: "Outfit", "Poppins", system-ui, sans-serif;
  --cs-gold: #e2b955; --cs-gold-2: #f6d98b; --cs-gold-ink: #2a1a05; --cs-panel: #1b1712; --cs-panel-2: #221d16; --cs-rim: #e2b95566;
}
body.tables-casino .tables-app.bm-wrap > .csn { position: static; margin: 0 0 12px; } /* not sticky here: the felt needs the room */
body.tables-casino .tables-app:has(> .csn) .home-link { display: none; }
