/* Board Parlor tables (tables.js): the waiting room, name box, rejoin prompt and errors (#tables.bp-tables),
   and the end bar. Scoped to .bp-tables so a game's own .sheet/.btn styles can't clash. Colours follow
   the game's tutorial palette. The sheet sits under chat.js's panel (z 80) and banner (z 70), so chat
   works from the waiting room. */
.bp-tables {
  --tb-accent: var(--tut-accent, #ffcf5a);
  --tb-accent-ink: var(--tut-accent-ink, #2a1a08);
  --tb-panel: var(--tut-bubble, #fbf6ee);
  --tb-ink: var(--tut-ink, #1d1d24);
  --tb-muted: var(--tut-muted, #6d6878);
  --tb-line: rgba(0, 0, 0, .12);
  position: fixed; inset: 0; z-index: 65; display: flex; align-items: flex-end; justify-content: center;
  padding: 12px; background: rgba(10, 12, 20, .5);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.bp-tables[hidden] { display: none !important; }
@media (min-width: 560px) { .bp-tables { align-items: center; } }
.bp-tables .tables-sheet {
  width: min(100%, 420px); max-height: 92vh; overflow-y: auto; text-align: center;
  background: var(--tb-panel); color: var(--tb-ink); border-radius: 20px; padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 14px 44px rgba(0, 0, 0, .35); animation: bp-tables-up .18s ease-out;
}
.bp-tables h2 { margin: 0 0 4px; font-size: 20px; font-weight: 800; color: var(--tb-ink); }
.bp-tables .tables-text { margin: 4px 0 14px; font-size: 14px; color: var(--tb-muted); }
/* the kit's own class names (tb-…) so a game's .btn, .dot, .you or :hover rules can't reach them */
.bp-tables .tb-btn {
  min-height: 46px; padding: 0 16px; border-radius: 14px; border: 0; cursor: pointer; font: 700 15px/1 system-ui, -apple-system, sans-serif;
  background: rgba(0, 0, 0, .07); color: var(--tb-ink); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; transition: filter .15s, opacity .15s;
}
.bp-tables .tb-btn.tb-primary { background: var(--tb-accent); color: var(--tb-accent-ink); }
.bp-tables .tb-btn.tb-ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--tb-line); }
.bp-tables .tb-btn:hover:not(:disabled) { filter: brightness(.97); }
.bp-tables .tb-btn:disabled { opacity: .5; cursor: default; }
.bp-tables .tb-btn:active:not(:disabled) { transform: translateY(1px); }
.bp-tables .tables-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.bp-tables .tables-actions .tb-btn { flex: 1 1 auto; }
.bp-tables .tables-actions .tb-btn.tb-primary { flex: 2 1 auto; }

/* the name box (guests) */
.bp-tables .tables-namebox { text-align: left; margin: 0 0 4px; }
.bp-tables .tables-namebox label { display: block; font-size: 12px; font-weight: 700; color: var(--tb-muted); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 6px 2px; }
.bp-tables .tables-namebox input {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: 14px; border: 1.5px solid var(--tb-line); background: #fff; color: #1d1d24;
  font: 600 17px/1.2 system-ui, -apple-system, sans-serif;
}
.bp-tables .tables-namebox input:focus { outline: none; border-color: var(--tb-accent); box-shadow: 0 0 0 3px rgba(0, 0, 0, .06); }
.bp-tables .tables-name-err { margin: 6px 2px 0; font-size: 13px; color: #c0392b; font-weight: 600; }

/* the link */
.bp-tables .tables-link { display: grid; gap: 8px; }
.bp-tables .tables-url {
  padding: 11px 12px; border-radius: 12px; background: #fff; color: #1d1d24; border: 1.5px solid var(--tb-line);
  font: 600 14px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; text-align: left; user-select: all; cursor: text;
}
.bp-tables .tables-url:focus { outline: none; border-color: var(--tb-accent); }
.bp-tables .tables-url .q { white-space: nowrap; word-break: normal; }
.bp-tables .tables-share { display: flex; gap: 8px; }
.bp-tables .tables-share .tb-btn { flex: 1 1 0; }

/* the seats as they fill */
.bp-tables .tables-seatbox { margin: 16px 0 0; }
.bp-tables .tables-lbl { margin: 0 0 8px; font-size: 12px; font-weight: 700; color: var(--tb-muted); text-transform: uppercase; letter-spacing: .08em; }
.bp-tables .tables-seats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.bp-tables .tables-seats li {
  list-style: none; margin: 0;
  display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 4px 12px; border-radius: 12px; text-align: left;
  background: #fff; border: 1.5px solid var(--tb-line); font-weight: 700; min-width: 0;
}
.bp-tables .tables-seats .tb-dot { margin: 0; width: 9px; height: 9px; border-radius: 50%; background: rgba(0, 0, 0, .18); flex: none; }
.bp-tables .tables-seats li.tb-on .tb-dot { background: #2fb160; box-shadow: 0 0 0 3px rgba(47, 177, 96, .18); }
.bp-tables .tables-seats .tb-nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-tables .tables-seats .tb-nm small { margin-left: 6px; font-size: 11px; font-weight: 700; color: var(--tb-muted); }
.bp-tables .tables-seats li.tb-open { background: transparent; border-style: dashed; color: var(--tb-muted); font-weight: 600; }
.bp-tables .tables-seats li.tb-away { color: var(--tb-muted); }
.bp-tables .tables-seats li.tb-filled { animation: bp-tables-in .25s ease-out; }

.bp-tables .tables-wait { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 14px 0 0; font-size: 14px; color: var(--tb-muted); }
.bp-tables .tables-pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--tb-accent); animation: bp-tables-pulse 1.4s ease-in-out infinite; flex: none; }

/* friends to invite (signed in) */
.bp-tables .tables-friends { margin: 0 0 12px; }
.bp-tables .tables-flist { display: grid; gap: 6px; max-height: 156px; overflow-y: auto; }
.bp-tables .tables-friend {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 6px 12px;
  border: 1.5px solid var(--tb-line); border-radius: 12px; background: #fff; color: #1d1d24; text-align: left; cursor: pointer; font: inherit;
}
.bp-tables .tables-friend:disabled { cursor: default; }
.bp-tables .tables-friend .tb-dot { margin: 0; width: 9px; height: 9px; border-radius: 50%; background: rgba(0, 0, 0, .18); flex: none; }
.bp-tables .tables-friend.tb-on .tb-dot { background: #2fb160; box-shadow: 0 0 0 3px rgba(47, 177, 96, .18); }
.bp-tables .tables-friend .tb-fname { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.bp-tables .tables-friend .tb-fstate { font-size: 12px; color: #6d6878; font-weight: 600; }
.bp-tables .tables-friend .tb-fact { flex: none; font-size: 13px; font-weight: 800; color: #9a6a00; }
.bp-tables .tables-friend.tb-sent .tb-fact { color: #1f8a4a; }
.bp-tables .tables-friend.tb-no .tb-fact { color: #c0392b; }
.bp-tables .tables-or { margin: 10px 0 0; font-size: 12px; color: var(--tb-muted); text-transform: uppercase; letter-spacing: .08em; }
/* "List in Open games" (a signed-in host at level 2+; the level itself is never shown in a game) */
.bp-tables .tables-open { margin: 12px 0 0; }
.bp-tables .tb-sw {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 48px; margin: 0; padding: 6px 12px 6px 14px;
  border: 1.5px solid var(--tb-line); border-radius: 12px; background: #fff; color: #1d1d24; cursor: pointer; text-align: left;
  font: 700 15px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.bp-tables .tb-sw:disabled { cursor: default; opacity: .7; }
.bp-tables .tb-sw:focus-visible { outline: 2px solid var(--tb-accent); outline-offset: 2px; }
.bp-tables .tb-sw-track { position: relative; flex: none; width: 44px; height: 26px; border-radius: 13px; background: rgba(0, 0, 0, .2); transition: background .15s; }
.bp-tables .tb-sw-knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s; }
.bp-tables .tb-sw[aria-checked="true"] .tb-sw-track { background: #2fb160; }
.bp-tables .tb-sw[aria-checked="true"] .tb-sw-knob { transform: translateX(18px); }
.bp-tables .tables-open-note { margin: 6px 0 0; font-size: 13px; color: var(--tb-muted); }
/* Computer players (BOTS.md): the host's stepper, and a seat that says plainly it is a computer */
.bp-tables .tables-bots { margin: 12px 0 0; text-align: left; }
.bp-tables .tb-step {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px;
  padding: 6px 8px 6px 14px; border: 1.5px solid var(--tb-line); border-radius: 12px; background: #fff; color: #1d1d24;
  font: 700 15px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.bp-tables .tb-step-ctl { display: flex; align-items: center; gap: 4px; flex: none; }
.bp-tables .tb-step-btn {
  width: 40px; height: 40px; border: 0; border-radius: 11px; background: rgba(0, 0, 0, .07); color: var(--tb-ink);
  font: 800 20px/1 system-ui, -apple-system, sans-serif; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.bp-tables .tb-step-btn:disabled { opacity: .4; cursor: default; }
.bp-tables .tb-step-btn:focus-visible { outline: 2px solid var(--tb-accent); outline-offset: 2px; }
.bp-tables .tb-step-n { min-width: 28px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.bp-tables .tables-bots-note { margin: 6px 2px 0; font-size: 13px; color: var(--tb-muted); }
.bp-tables .tables-bots-note.tb-solo { font-style: italic; }
/* No computers taken yet: the row is an OFFER, not a setting. The whole sheet is about inviting
   people, so a grey "Computer players − 0 +" below the seats scans as a preference and a host
   hunting for computer opponents slides past it (reported 2026-09-15). With none yet, drop the − and
   the 0 and leave one bright + beside a verb; as soon as there is one it goes back to a stepper. */
.bp-tables .tables-bots.tb-offer .tb-step { box-shadow: inset 0 0 0 2px var(--tb-accent); background: rgba(217, 178, 90, .12); }
.bp-tables .tables-bots.tb-offer .tb-step-lbl { font-weight: 800; }
.bp-tables .tables-bots.tb-offer #tables-bots-less,
.bp-tables .tables-bots.tb-offer #tables-bots-n { display: none; }
.bp-tables .tables-bots.tb-offer #tables-bots-more { width: 44px; height: 44px; font-size: 22px; background: var(--tb-accent); border-color: var(--tb-accent); color: #23293a; }
.bp-tables .tables-seats li.tb-bot { border-style: dashed; }
.bp-tables .tables-seats li.tb-bot .tb-dot { background: var(--tb-muted); box-shadow: none; }
.bp-tables .tables-seats li.tb-bot .tb-nm { white-space: normal; overflow: visible; line-height: 1.2; }
/* A computer's name sits big, with what it is on its own line underneath ("computer · easy"), so a
   named opponent is never mistaken for a person (BOTS.md). */
.bp-tables .tables-seats li.tb-bot .tb-bot-kind { display: block; margin: 1px 0 0; font-size: 11px; font-weight: 700; color: var(--tb-muted); }

.bp-tables .tables-signin { margin: 12px 0 0; font-size: 13px; color: var(--tb-muted); }
.bp-tables .tables-signin a { color: inherit; font-weight: 800; text-decoration: underline; }

@keyframes bp-tables-up { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes bp-tables-in { from { transform: scale(.94); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes bp-tables-pulse { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.1); } }
@media (prefers-reduced-motion: reduce) { .bp-tables .tables-sheet, .bp-tables .tables-pulse, .bp-tables .tables-seats li { animation: none; } .bp-tables .tb-sw-track, .bp-tables .tb-sw-knob { transition: none; } }

/* After a finished game with the result card closed: Rematch / Leave stay in reach */
.bp-tables-endbar {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; border-radius: 18px; max-width: calc(100vw - 24px);
  background: var(--tut-bubble, #fbf6ee); color: var(--tut-ink, #1d1d24); box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  font: 700 14px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.bp-tables-endbar[hidden] { display: none !important; }
.bp-tables-endbar .bp-endbar-text { white-space: nowrap; margin-right: 4px; }
.bp-tables-endbar .bp-endbar-btn {
  min-height: 42px; padding: 0 16px; border: 0; border-radius: 13px; cursor: pointer; font: inherit;
  background: rgba(0, 0, 0, .07); color: var(--tut-ink, #1d1d24);
}
.bp-tables-endbar .bp-endbar-btn.primary { background: var(--tut-accent, #ffcf5a); color: var(--tut-accent-ink, #2a1a08); }
.bp-tables-endbar .bp-endbar-btn:disabled { opacity: .6; }
.bp-tables-endbar .bp-endbar-btn[hidden] { display: none; }
