/* Gamenook workspace. Root rules are scoped to .uwapp-root.uwapp-gamenook (the body carries .uwapp-gamenook too).
   Own light/dark tokens; the table felt stays green in both themes with light text on it. Card faces are always white
   (they are pictures of cards). Transitions only under prefers-reduced-motion: no-preference.
   Chrome follows the site design system (docs/DESIGN_SYSTEM.md, w43-appui3): slate surfaces, one teal accent, Funnel
   Sans; light references the site tokens, dark uses the --d-* dark constants (styles.css). The felt and table themes keep their own colours. */
.uwapp-root.uwapp-gamenook {
  --pc-bg: var(--canvas); --pc-surface: var(--surface); --pc-surface-2: var(--surface-2); --pc-ink: var(--ink); --pc-muted: var(--muted);
  --pc-line: var(--line); --pc-control: var(--control); --pc-accent: var(--primary); --pc-accent-ink: var(--primary-text); --pc-on-accent: var(--on-accent);
  --pc-red: #a3122a; --pc-warn: #8a2c0d; --pc-good: #166534; --pc-focus: var(--focus-color);
  --pc-felt: #1b5e34; --pc-felt-2: #154a29; --pc-felt-ink: #f3faf4; --pc-felt-muted: #cfe6d5;
  background: var(--pc-bg); color: var(--pc-ink); color-scheme: light;
  font-family: var(--font-sans, system-ui), system-ui, sans-serif;
}
:root[data-theme="dark"] .uwapp-root.uwapp-gamenook {
  --pc-bg: var(--d-canvas); --pc-surface: var(--d-surface); --pc-surface-2: var(--d-surface-2); --pc-ink: var(--d-ink); --pc-muted: var(--d-muted);
  --pc-line: var(--d-line); --pc-control: var(--d-control); --pc-accent: var(--d-primary); --pc-accent-ink: var(--d-primary); --pc-on-accent: var(--d-on-accent);
  --pc-red: #ff8a9b; --pc-warn: #fdba74; --pc-good: #86efac; --pc-focus: var(--d-focus);
  --pc-felt: #123d22; --pc-felt-2: #0d2e19; --pc-felt-ink: #eef8f0; --pc-felt-muted: #c3dccb;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .uwapp-root.uwapp-gamenook {
    --pc-bg: var(--d-canvas); --pc-surface: var(--d-surface); --pc-surface-2: var(--d-surface-2); --pc-ink: var(--d-ink); --pc-muted: var(--d-muted);
    --pc-line: var(--d-line); --pc-control: var(--d-control); --pc-accent: var(--d-primary); --pc-accent-ink: var(--d-primary); --pc-on-accent: var(--d-on-accent);
    --pc-red: #ff8a9b; --pc-warn: #fdba74; --pc-good: #86efac; --pc-focus: var(--d-focus);
    --pc-felt: #123d22; --pc-felt-2: #0d2e19; --pc-felt-ink: #eef8f0; --pc-felt-muted: #c3dccb;
    color-scheme: dark;
  }
}

/* Platform element defaults leak into app workspaces: reset them at zero specificity. */
:where(.pc-app) button { font: inherit; font-size: .92rem; font-weight: 600; padding: 0; border: 0; border-radius: 8px; background: none; color: inherit; cursor: pointer; width: auto; min-height: 0; }
:where(.pc-app) button:hover { background: none; }
:where(.pc-app) :is(input, select, textarea) { font: inherit; font-size: .95rem; color: var(--pc-ink); background: var(--pc-surface); border: 1px solid var(--pc-control); border-radius: 8px; padding: .4rem .55rem; box-sizing: border-box; min-height: 38px; margin: 0; max-width: 100%; }
:where(.pc-app) :is(input[type="checkbox"], input[type="radio"]) { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--pc-accent); flex: none; }
:where(.pc-app) table { border-collapse: collapse; width: 100%; margin: .4rem 0; font-size: .92rem; }
:where(.pc-app) :is(th, td) { text-align: start; padding: 6px 8px; border-bottom: 1px solid var(--pc-line); color: var(--pc-ink); }
:where(.pc-app) thead th { background: var(--pc-surface-2); color: var(--pc-ink); }
:where(.pc-app) kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; padding: 1px 6px; border: 1px solid var(--pc-control); border-bottom-width: 2px; border-radius: 5px; background: var(--pc-surface-2); color: var(--pc-ink); white-space: nowrap; }
:where(.pc-app) :is(h1, h2, h3) { color: var(--pc-ink); }
:where(.pc-app) a { color: var(--pc-accent-ink); }
:where(.pc-app) fieldset { min-width: 0; }

.pc-app { display: flex; flex-direction: column; flex: 1; min-height: 0; background: var(--pc-bg); color: var(--pc-ink); }
.pc-app :focus-visible { outline: 3px solid var(--pc-focus); outline-offset: 2px; }
.pc-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.pc-muted { color: var(--pc-muted); }
.pc-warn { color: var(--pc-warn); font-weight: 700; }
.pc-good { color: var(--pc-good); font-weight: 700; }
.pc-big { font-size: 1.12rem; font-weight: 700; }
.pc-label { font-size: .85rem; font-weight: 600; }

/* ---------- buttons */
.pc-btn { display: inline-flex; align-items: center; gap: .4rem; min-height: 40px; padding: .4rem .85rem; border: 1px solid var(--pc-control); border-radius: 9px; background: var(--pc-surface); color: var(--pc-ink); text-decoration: none; }
a.pc-btn { font-weight: 600; font-size: .92rem; }
.pc-btn:hover:not([disabled]) { background: var(--pc-surface-2); }
.pc-btn-primary, .pc-app button[type=submit].pc-btn-primary { background: var(--pc-accent); border-color: var(--pc-accent); color: var(--pc-on-accent); }
.pc-btn-primary:hover:not([disabled]), .pc-app button[type=submit].pc-btn-primary:hover:not([disabled]) { background: var(--pc-accent-ink); border-color: var(--pc-accent-ink); color: var(--pc-on-accent); }
.pc-btn-primary:active:not([disabled]), .pc-app button[type=submit].pc-btn-primary:active:not([disabled]) { background: var(--pc-accent-ink); color: var(--pc-on-accent); }
/* Disabled buttons (e.g. “Start the game” before every seat is filled): readable at rest AND on hover/focus/active in
   light and dark (≥ 4.5:1, no opacity). The zero-specificity hover reset above used to win over .pc-btn-primary on a
   disabled button and painted dark ink on the dark page (1.03:1 in dark mode). */
.pc-app .pc-btn[disabled], .pc-app .pc-btn[disabled]:is(:hover, :focus, :active), .pc-app button[type=submit].pc-btn[disabled]:is(:hover, :focus, :active) { opacity: 1; background: var(--pc-surface-2); border-color: var(--pc-control); border-style: dashed; color: var(--pc-muted); cursor: not-allowed; }
.pc-btn-big { min-height: 48px; padding: .55rem 1.2rem; font-size: 1.02rem; }
.pc-icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 1px solid transparent; border-radius: 8px; color: var(--pc-ink); flex: none; }
.pc-icon-btn:hover { background: var(--pc-surface-2); border-color: var(--pc-line); }

/* ---------- top bar + menus */
.pc-bar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; padding: .4rem .8rem; background: var(--pc-surface); border-bottom: 1px solid var(--pc-line); }
.pc-title { font-weight: 700; margin-inline-start: .3rem; }
.pc-statusline { color: var(--pc-muted); font-size: .88rem; }
/* music / sound effects / full screen / chat toggles: always in the bar; text labels on wide screens, icons + tooltip
   (and the same accessible name) below; aria-pressed = the mute or full screen is in effect */
.pc-tools { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin-inline-start: auto; }
.pc-tool { position: relative; justify-content: center; min-width: 40px; padding: .3rem .6rem; }
.pc-tool-icon { display: inline-flex; line-height: 0; }
.pc-tool:is(.pc-tool-music, .pc-tool-sfx)[aria-pressed="true"] { color: var(--pc-warn); border-color: var(--pc-warn); border-style: dashed; }
.pc-tool-fs[aria-pressed="true"] { border-color: var(--pc-accent); box-shadow: inset 0 0 0 1px var(--pc-accent); }
.pc-tool[hidden] { display: none; }
.pc-chat-badge { display: inline-grid; place-items: center; min-width: 1.3rem; height: 1.3rem; padding: 0 .3rem; border-radius: 999px; background: var(--pc-ink); color: var(--pc-bg); font-size: .75rem; font-weight: 800; box-sizing: border-box; }
.pc-chat-badge[hidden] { display: none; }
@media (max-width: 1279px) {
  .pc-tool-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
  .pc-tool { padding: .3rem .45rem; }
}
.pc-menu-wrap { position: relative; }
.pc-menu-btn { display: inline-flex; align-items: center; gap: .2rem; min-height: 40px; padding: .3rem .65rem; border-radius: 8px; color: var(--pc-ink); }
.pc-menu-btn:hover, .pc-menu-btn[aria-expanded="true"] { background: var(--pc-surface-2); }
.pc-menu { position: absolute; inset-inline-start: 0; top: calc(100% + 4px); z-index: 30; min-width: 16rem; max-width: min(24rem, 92vw); padding: .3rem; background: var(--pc-surface); border: 1px solid var(--pc-line); border-radius: 10px; box-shadow: var(--shadow-2); }
.pc-menu[hidden] { display: none; }
.pc-menu-item { display: flex; justify-content: space-between; gap: 1rem; width: 100%; text-align: start; padding: .5rem .65rem; border-radius: 6px; font-weight: 500; color: var(--pc-ink); }
.pc-menu-item:is(:hover, :focus) { background: var(--pc-surface-2); }
.pc-menu-item[aria-disabled="true"] { color: var(--pc-muted); cursor: not-allowed; }
.pc-menu-key { color: var(--pc-muted); font-size: .8rem; }
.pc-menu-sep { height: 1px; margin: .3rem .2rem; background: var(--pc-line); }

/* ---------- stage: the table area (a size container: cards, seats and portraits scale with the space left under the
   bars, see .pc-table-wrap) and the docked chat beside it */
.pc-stage { position: relative; flex: 1; min-height: 0; display: flex; }
.pc-main { position: relative; flex: 1; min-width: 0; min-height: 0; overflow-y: auto; container: pc-main / size; }
/* full screen: Fullscreen API on the app area, or (no API, e.g. iPhone Safari) the app covers the page */
.uwapp-root.pc-app:fullscreen { width: 100%; height: 100%; background: var(--pc-bg); }
.uwapp-root.pc-app.pc-expanded { position: fixed; inset: 0; z-index: 200; }
:root.pc-page-expanded, :root.pc-page-expanded body { overflow: hidden; }

/* ---------- home */
.pc-home { max-width: 64rem; margin: 0 auto; padding: 1rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.pc-h1 { font-family: var(--font-display, inherit); font-weight: 600; font-size: 1.6rem; margin: .2rem 0; }
.pc-tabs { display: flex; flex-wrap: wrap; gap: .3rem; border-bottom: 2px solid var(--pc-line); }
/* games menu: families with a filter box */
.pc-picker { display: grid; gap: .5rem; }
.pc-picker-h { margin: 0; font-size: 1.15rem; }
.pc-filter { max-width: 22rem; }
.pc-game-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: .5rem .9rem; }
.pc-game-family { min-width: 0; }
.pc-family-h { margin: .2rem 0 .3rem; font-size: .85rem; font-weight: 600; color: var(--pc-muted); }
.pc-game-list { display: flex; flex-wrap: wrap; gap: .3rem; }
.pc-game-btn { min-height: 40px; padding: .35rem .75rem; border: 1px solid var(--pc-control); border-radius: 9px; background: var(--pc-surface); color: var(--pc-ink); }
.pc-game-btn:hover { background: var(--pc-surface-2); }
.pc-game-btn[aria-pressed="true"] { background: color-mix(in srgb, var(--pc-accent) 14%, var(--pc-surface)); border-color: var(--pc-accent); color: var(--pc-accent-ink); }
.pc-tab { padding: .55rem 1rem; border-radius: 9px 9px 0 0; color: var(--pc-muted); border: 1px solid transparent; border-bottom: 0; min-height: 44px; }
.pc-tab[aria-selected="true"] { color: var(--pc-ink); background: var(--pc-surface); border-color: var(--pc-line); box-shadow: inset 0 3px 0 var(--pc-accent); }
.pc-panel { background: var(--pc-surface); border: 1px solid var(--pc-line); border-radius: 14px; padding: 1rem 1.1rem; }
.pc-panel h2 { margin: 0 0 .4rem; font-family: var(--font-display, inherit); font-weight: 600; font-size: 1.25rem; }
.pc-lede { margin: 0 0 .6rem; }
.pc-links { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
/* groups inside the set-up panel are separated by a rule, not boxed again (no card inside a card) */
.pc-fieldset { border: 0; border-top: 1px solid var(--pc-line); border-radius: 0; padding: .6rem 0 0; margin: .9rem 0 .4rem; min-width: 0; }
.pc-home p, .pc-home li, .pc-dlg p, .pc-dlg li { text-wrap: pretty; }
.pc-fieldset legend { font-weight: 700; padding: 0 .3rem 0 0; }
.pc-modes { display: grid; gap: .35rem; }
.pc-radio, .pc-check-row { display: flex; align-items: center; gap: .5rem; min-height: 32px; }
.pc-radio label { display: inline-flex; align-items: center; gap: .4rem; }
.pc-field { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .7rem; margin: .35rem 0; }
.pc-field label { min-width: 10rem; }
.pc-seat-edit { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; padding: .3rem 0; border-bottom: 1px dashed var(--pc-line); }
.pc-seat-edit input[type="text"] { width: 12rem; }
.pc-seat-no { font-weight: 700; min-width: 4.5rem; }
.pc-start { margin-top: .8rem; }
.pc-join-form { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .7rem; }
.pc-join-form p { flex-basis: 100%; margin: .2rem 0 0; }
.pc-code-input { width: 9rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .2em; text-transform: uppercase; font-size: 1.1rem; }
.pc-recent, .pc-templates, .pc-lobby-seats { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.pc-recent li, .pc-lobby-seats li { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.pc-lobby-ctl { display: inline-flex; flex-wrap: wrap; gap: .4rem; margin-inline-start: auto; }
.pc-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 2rem; letter-spacing: .25em; color: var(--pc-accent-ink); }
.pc-invite input[readonly] { width: min(36rem, 100%); }

/* ---------- table */
/* The table fills the stage: width and height. Card, hand-card and portrait sizes come from the stage size
   (container units of .pc-main), so a 1920×1080 screen gets big cards and a phone small ones — no JS layout. */
.pc-table-wrap {
  --pc-cw: clamp(3rem, min(9cqw, 12cqh), 9rem);
  --pc-hw: calc(var(--pc-cw) * 1.1);
  /* portraits: about 130 px at 1920×1080, 87 px at 1366×768; the ring, dealer chip and bubble scale with them */
  --pc-pw: clamp(2.75rem, min(13cqh, 8.5cqw), 10rem);
  max-width: 130rem; min-height: 100%; box-sizing: border-box; margin: 0 auto; padding: .7rem;
  display: flex; flex-direction: column; gap: .6rem; font-size: clamp(.95rem, .55rem + 1cqh, 1.15rem);
}
.pc-seats { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .45rem; }
.pc-seat { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; padding: .4rem .65rem; border: 1px solid var(--pc-line); border-radius: 10px; background: var(--pc-surface); font-size: .9rem; }
.pc-seat-me { border-color: var(--pc-accent); }
.pc-seat-turn { box-shadow: 0 0 0 3px var(--pc-focus); }
.pc-seat-name { font-weight: 700; display: inline-flex; gap: .3rem; align-items: center; }
.pc-seat-info { color: var(--pc-muted); }
.pc-tag { display: inline-block; padding: 0 .45rem; border-radius: 999px; border: 1px solid var(--pc-control); font-size: .8rem; font-weight: 700; color: var(--pc-ink); }
.pc-tag-turn { border-color: var(--pc-focus); }
.pc-tag-good { border-color: var(--pc-good); color: var(--pc-good); }
.pc-tag-warn { border-color: var(--pc-warn); color: var(--pc-warn); }
.pc-felt { background: radial-gradient(circle at 50% 30%, var(--pc-felt), var(--pc-felt-2)); color: var(--pc-felt-ink); border-radius: 18px; padding: clamp(.7rem, 1.6cqh, 1.4rem); min-height: calc(var(--pc-cw, 4.2rem) * 2.1); box-sizing: border-box; display: flex; flex-direction: column; justify-content: center; }
.pc-felt .pc-muted { color: var(--pc-felt-muted); }
.pc-felt .pc-warn { color: #ffd38a; }
.pc-felt .pc-good { color: #b7f5c8; }
.pc-felt .pc-tag { color: var(--pc-felt-ink); border-color: var(--pc-felt-muted); }
.pc-felt details summary { cursor: pointer; }
.pc-felt :focus-visible { outline-color: #fbbf24; }
/* tables on the felt (score tables of the trick games): light ink on the dark cloth */
.pc-felt .pc-table :is(th, td) { color: var(--pc-felt-ink); border-bottom-color: rgb(255 255 255 / .25); }
.pc-felt .pc-table thead th { background: rgb(0 0 0 / .28); }
.pc-felt .pc-table caption { text-align: start; font-weight: 700; }
.pc-felt .pc-sides { font-size: .9rem; }
.pc-felt .pc-sides :is(th, td) { padding: 4px 6px; }
.pc-center { display: flex; flex-wrap: wrap; gap: 1rem 1.4rem; align-items: flex-start; }
.pc-center-bj { flex-direction: column; }
.pc-pile { display: flex; flex-direction: column; gap: .3rem; align-items: flex-start; }
.pc-count { font-size: .85rem; color: var(--pc-felt-muted); }
.pc-status-box { flex: 1 1 14rem; min-width: 0; }
.pc-status-box p { margin: .2rem 0; }
.pc-contract { font-weight: 700; }
.pc-trick { display: flex; flex-wrap: wrap; gap: .6rem; min-height: calc(var(--pc-cw, 4.2rem) * 1.45); align-items: flex-end; }
.pc-trick p { margin: 0; }
.pc-played { margin: 0; display: flex; flex-direction: column; align-items: center; gap: .2rem; font-size: .82rem; }
.pc-mini-cards { display: inline-flex; flex-wrap: wrap; gap: .25rem; }
.pc-backs { display: inline-flex; }
.pc-backs .pc-card + .pc-card { margin-inline-start: calc(var(--pc-cw, 4.2rem) * -.48); }
.pc-card { display: inline-block; width: var(--pc-cw, 4.2rem); aspect-ratio: 60 / 86; flex: none; line-height: 0; }
.pc-card-svg { width: 100%; height: 100%; display: block; }
.pc-card-mini { width: calc(var(--pc-cw, 4.2rem) * .69); }
.pc-card-big { width: calc(var(--pc-cw, 4.2rem) * 1.29); }
.pc-dealer { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.pc-total { font-weight: 700; }
.pc-bj-seats { display: flex; flex-wrap: wrap; gap: .8rem; }
.pc-bj-seat { background: rgb(0 0 0 / .18); border-radius: 12px; padding: .5rem .7rem; min-width: 14rem; }
.pc-bj-seat h2.pc-bj-name { color: var(--pc-felt-ink); font-size: 1rem; margin: 0 0 .3rem; }
.pc-bj-seat.pc-seat-me { outline: 2px solid var(--pc-felt-muted); }
.pc-bj-hand { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; padding: .25rem; border-radius: 8px; }
.pc-bj-hand.pc-current { outline: 3px solid #fbbf24; }
.pc-tokens { display: flex; flex-wrap: wrap; gap: .35rem; min-height: 2rem; }
.pc-token { width: 1.8rem; height: 1.8rem; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3c4, #e0a800); border: 2px solid #7a5600; }
.pc-turn { margin: 0; font-weight: 600; }
/* turn line and move buttons share one row (saves height for the bigger table) */
.pc-turnbar { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .9rem; }
.pc-turnbar > .pc-actions { flex: 1 1 auto; min-width: 0; }
.pc-actions { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.pc-actions .pc-hint { flex-basis: 100%; margin: .2rem 0; padding: .4rem .6rem; border-radius: 8px; background: var(--pc-surface-2); }
.pc-wish { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.pc-wish[hidden] { display: none; }
.pc-inline { font-weight: 600; }
.pc-check { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; }
.pc-grab { min-height: 52px; font-size: 1.1rem; }
.pc-hand-area { background: var(--pc-surface); border: 1px solid var(--pc-line); border-radius: 14px; padding: .6rem; container-type: inline-size; position: sticky; inset-block-end: 0; z-index: 3; }
/* the turn line is the tray's header row, so the sticky tray never hides it */
.pc-hand-area > .pc-turnbar { margin-block-end: .5rem; }
.pc-continue[hidden], .pc-saved-note:empty { display: none; }
.pc-saved-note { padding-inline: .5rem; }
/* Hand fan: app.js sets --pc-n (cards in the row). Cards keep their size and overlap just enough to fit one row
   (the corner index of each card stays visible); only below a 1.25rem step does the row wrap. Left to right in every
   language like real cards (the arrow keys follow the row direction). */
.pc-hand {
  --pc-step: clamp(1.25rem, (100cqw - var(--pc-hw, 4.6rem) - .75rem) / max(1, var(--pc-n, 1) - 1), var(--pc-hw, 4.6rem) + .35rem);
  display: flex; flex-wrap: wrap; gap: .5rem 0; direction: ltr; padding-block-start: 12px;
  padding-inline-start: max(0px, var(--pc-hw, 4.6rem) - var(--pc-step));
}
.pc-hand > .pc-card-btn { margin-inline-start: calc(var(--pc-step) - var(--pc-hw, 4.6rem)); }
.pc-hand > .pc-card-btn:is(:hover, :focus-visible, .pc-selected) { z-index: 2; }
.pc-hand > p { unicode-bidi: plaintext; }
.pc-card-btn { position: relative; border-radius: 8px; padding: 0; width: var(--pc-hw, 4.6rem); }
.pc-card-btn[aria-disabled="true"] { filter: grayscale(.25) brightness(.8); }
.pc-card-btn.pc-playable { box-shadow: 0 0 0 2px var(--pc-accent); }
.pc-card-btn.pc-selected { transform: translateY(-10px); box-shadow: 0 0 0 3px var(--pc-red); }
.pc-privacy { text-align: center; padding: 1.4rem .6rem; }
.pc-result { background: var(--pc-surface); border: 2px solid var(--pc-accent); border-radius: 14px; padding: .8rem 1rem; }
.pc-result h2 { margin: 0 0 .3rem; }
.pc-shown summary, .pc-log summary { cursor: pointer; font-weight: 600; }
.pc-shown-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .3rem 0; }
.pc-log { background: var(--pc-surface); border: 1px solid var(--pc-line); border-radius: 10px; padding: .4rem .7rem; }
.pc-log ol { margin: .4rem 0; padding-inline-start: 1.4rem; max-height: 14rem; overflow-y: auto; }
.pc-last { margin-top: .3rem; }

/* ---------- dialogs, toast */
.pc-dialog { width: min(34rem, 94vw); max-height: 88vh; padding: 0; border: 1px solid var(--pc-line); border-radius: 14px; background: var(--pc-surface); color: var(--pc-ink); box-shadow: var(--shadow-3); }
.pc-dialog-wide { width: min(50rem, 94vw); }
.pc-dialog::backdrop { background: rgb(8 20 12 / .55); }
.pc-dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .75rem 1rem .4rem; }
.pc-dialog-head h2 { font-family: var(--font-display, inherit); font-weight: 600; font-size: 1.15rem; margin: 0; }
.pc-dialog-lede { margin: 0 1rem .4rem; color: var(--pc-muted); }
.pc-dialog-body { padding: .3rem 1rem 1rem; overflow-y: auto; }
.pc-dialog-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.pc-rules-sec h3 { font-size: 1.02rem; margin: .8rem 0 .2rem; }
.pc-rules-sec p, .pc-rules-sec li { line-height: 1.5; }
.pc-toast { position: fixed; inset-inline: 0; bottom: 1rem; margin: 0 auto; width: max-content; max-width: 92vw; padding: .6rem 1rem; border-radius: 10px; background: var(--pc-ink); color: var(--pc-bg); z-index: 50; font-weight: 600; }
.pc-toast[hidden] { display: none; }
.pc-toast-bad { background: #7f1d1d; color: #ffffff; }


/* ---------- table themes: seats around the felt, portraits, chips, speech bubbles (themes-ui.js sets the custom
   properties on .pc-table-wrap through the CSSOM: --pc-felt*, --pc-t-accent*, --pc-chip-*, --pc-felt-img) */
.pc-table-wrap { --pc-t-accent: var(--pc-accent); --pc-t-accent2: var(--pc-focus); --pc-chip-fill: #f4d58d; --pc-chip-ring: #7a5600; --pc-chip-ink: #1f1300; }
.pc-arena { flex: 1 0 auto; display: grid; grid-template-columns: minmax(0, clamp(9rem, 17cqw, 20rem)) repeat(3, minmax(0, 1fr)) minmax(0, clamp(9rem, 17cqw, 20rem)); grid-template-rows: auto minmax(0, 1fr) minmax(0, 1fr) auto; gap: .5rem; align-items: start; }
.pc-arena .pc-felt { grid-column: 2 / 5; grid-row: 2 / 4; min-width: 0; align-self: stretch; }
.pc-arena.pc-arena-plain { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
.pc-arena.pc-arena-plain:not(:has(> .pc-seats)) { grid-template-rows: minmax(0, 1fr); }
.pc-arena.pc-arena-plain .pc-felt { align-self: stretch; }
.pc-arena.pc-arena-plain .pc-felt { grid-column: 1; grid-row: auto; }
.pc-arena.pc-arena-plain > .pc-seats { grid-column: 1; }
.pc-seats.pc-seats-ring { display: contents; }
.pc-at-me { grid-column: 1 / 6; grid-row: 4; justify-self: center; }
.pc-at-tc { grid-column: 2 / 5; grid-row: 1; justify-self: center; }
.pc-at-t1 { grid-column: 2; grid-row: 1; justify-self: center; }
.pc-at-t2 { grid-column: 3; grid-row: 1; justify-self: center; }
.pc-at-t3 { grid-column: 4; grid-row: 1; justify-self: center; }
.pc-at-l { grid-column: 1; grid-row: 2 / 4; align-self: center; }
.pc-at-l1 { grid-column: 1; grid-row: 3; }
.pc-at-l2 { grid-column: 1; grid-row: 2; }
.pc-at-r { grid-column: 5; grid-row: 2 / 4; align-self: center; }
.pc-at-r1 { grid-column: 5; grid-row: 2; }
.pc-at-r2 { grid-column: 5; grid-row: 3; }
.pc-seats-ring > .pc-seat { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .5rem; min-width: 0; max-width: 100%; border-color: var(--pc-line); }
.pc-seats-ring > .pc-seat.pc-seat-me { border-color: var(--pc-t-accent); }
.pc-seats-ring > .pc-seat.pc-seat-turn { box-shadow: 0 0 0 3px var(--pc-focus); }
.pc-seat-body { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .45rem; min-width: 0; }
.pc-seat-body .pc-seat-name { overflow-wrap: break-word; min-width: 0; }
/* narrow stages (tablet portrait): the side seats put the portrait above the text so names do not break mid-word */
@container pc-main (min-width: 600px) and (max-width: 1250px) {
  .pc-seats-ring > .pc-seat:is(.pc-at-l, .pc-at-l1, .pc-at-l2, .pc-at-r, .pc-at-r1, .pc-at-r2) { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .pc-seats-ring > .pc-seat:is(.pc-at-l, .pc-at-l1, .pc-at-l2, .pc-at-r, .pc-at-r1, .pc-at-r2) .pc-seat-body { justify-content: center; }
}
/* wide stages: a side seat with a long fan (7+ cards) also stacks, otherwise the fan squeezes the text column and words break */
.pc-seats-ring > .pc-seat:is(.pc-at-l, .pc-at-l1, .pc-at-l2, .pc-at-r, .pc-at-r1, .pc-at-r2):has(.pc-fan-card:nth-child(7)) { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
.pc-seats-ring > .pc-seat:is(.pc-at-l, .pc-at-l1, .pc-at-l2, .pc-at-r, .pc-at-r1, .pc-at-r2):has(.pc-fan-card:nth-child(7)) .pc-seat-body { justify-content: center; }
.pc-seat-face { position: relative; display: inline-flex; flex: none; }
.pc-portrait { display: inline-block; width: var(--pc-pw, 3.5rem); height: var(--pc-pw, 3.5rem); border-radius: clamp(10px, calc(var(--pc-pw, 3.5rem) * .2), 26px); overflow: hidden; flex: none; line-height: 0; box-shadow: 0 0 0 2px var(--pc-t-accent); background: var(--pc-surface-2); }
.pc-portrait-svg, img.pc-portrait { width: 100%; height: 100%; display: block; object-fit: cover; }
img.pc-portrait { width: var(--pc-pw, 3.5rem); height: var(--pc-pw, 3.5rem); }
.pc-portrait-sm, img.pc-portrait-sm { width: 2.2rem; height: 2.2rem; border-radius: 9px; box-shadow: none; vertical-align: middle; }
.pc-seat-turn .pc-portrait { box-shadow: 0 0 0 max(3px, calc(var(--pc-pw, 3.5rem) * .04)) var(--pc-focus), 0 0 0 max(6px, calc(var(--pc-pw, 3.5rem) * .08)) var(--pc-t-accent); }
.pc-seats-ring .pc-portrait { box-shadow: 0 0 0 max(2px, calc(var(--pc-pw, 3.5rem) * .025)) var(--pc-t-accent); }
.pc-seats-ring > .pc-seat.pc-seat-turn .pc-portrait { box-shadow: 0 0 0 max(3px, calc(var(--pc-pw, 3.5rem) * .04)) var(--pc-focus), 0 0 0 max(6px, calc(var(--pc-pw, 3.5rem) * .08)) var(--pc-t-accent); }
.pc-seats-ring .pc-seat-face { margin: max(4px, calc(var(--pc-pw, 3.5rem) * .06)); }
.pc-seats-ring > .pc-seat { font-size: clamp(.9rem, calc(var(--pc-pw, 3.5rem) * .12), 1.1rem); }
.pc-seats-ring .pc-seat-name { font-size: clamp(.95rem, calc(var(--pc-pw, 3.5rem) * .15), 1.25rem); }
.pc-seats-ring .pc-dealer-chip { width: max(1.45rem, calc(var(--pc-pw, 3.5rem) * .26)); height: max(1.45rem, calc(var(--pc-pw, 3.5rem) * .26)); font-size: max(.75rem, calc(var(--pc-pw, 3.5rem) * .12)); }
.pc-seats-ring .pc-bubble { max-width: max(11rem, calc(var(--pc-pw, 3.5rem) * 1.7)); font-size: clamp(.82rem, calc(var(--pc-pw, 3.5rem) * .13), 1.15rem); padding: .25em .7em; }
.pc-bj-name .pc-portrait-sm { margin-inline-end: .4rem; }
/* the other players' hands (app.js handFan): face-down cards in the theme's back under the portrait, fanned; the
   overlap step comes from hands-ui.js fanShape (13+ cards stay compact), the tell lifts one card for a moment */
.pc-seat-col { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.pc-fan { --pc-fan-w: max(.85rem, calc(var(--pc-pw, 3.5rem) * .34)); display: flex; justify-content: center; padding-block: calc(var(--pc-fan-w) * .3) 2px; margin-block-start: -2px; }
.pc-fan-card { flex: none; display: block; width: var(--pc-fan-w); aspect-ratio: 60 / 86; line-height: 0; rotate: var(--pc-fan-a, 0deg); transform-origin: 50% 130%; filter: drop-shadow(0 1px 1.5px rgb(0 0 0 / .35)); }
.pc-fan-card + .pc-fan-card { margin-inline-start: calc(var(--pc-fan-w) * (var(--pc-fan-step, .5) - 1)); }
.pc-fan-card > svg { display: block; width: 100%; height: 100%; }
.pc-fan-card.pc-fan-lift { translate: 0 calc(var(--pc-fan-w) * -.34); rotate: calc(var(--pc-fan-a, 0deg) - 4deg); }
.pc-seat-col:has(.pc-dealer-chip) .pc-fan { padding-block-start: max(.6rem, calc(var(--pc-fan-w) * .3)); }
@media (prefers-reduced-motion: no-preference) {
  .pc-fan-card { transition: translate .25s ease-out, rotate .25s ease-out; }
}
.pc-field > .pc-muted { flex-basis: 100%; margin: 0; }
.pc-label-like { min-width: 10rem; }
.pc-dealer-chip { position: absolute; inset-block-end: -5px; inset-inline-end: -7px; display: grid; place-items: center; width: 1.45rem; height: 1.45rem; font-size: .75rem; font-weight: 800; color: var(--pc-chip-ink); background: var(--pc-chip-fill); border: 2px solid var(--pc-chip-ring); border-radius: 50%; }
.pc-chip-square .pc-dealer-chip { border-radius: 4px; }
.pc-chip-hex .pc-dealer-chip { border-radius: 30%; }
.pc-chip-star .pc-dealer-chip, .pc-chip-gear .pc-dealer-chip { border-style: dashed; }
.pc-chip-shield .pc-dealer-chip { border-radius: 4px 4px 50% 50%; }
.pc-table-wrap .pc-token { background: radial-gradient(circle at 35% 35%, #ffffff, var(--pc-chip-fill)); border-color: var(--pc-chip-ring); }
.pc-bubble { position: absolute; inset-block-end: calc(100% + .35rem); inset-inline-start: -.3rem; z-index: 5; max-width: 11rem; width: max-content; padding: .2rem .55rem; border-radius: 12px; background: var(--pc-surface); color: var(--pc-ink); border: 2px solid var(--pc-t-accent); font-size: .82rem; font-weight: 700; line-height: 1.25; box-shadow: 0 4px 12px rgb(0 0 0 / .18); pointer-events: none; }
.pc-bubble::after { content: ''; position: absolute; inset-block-start: 100%; inset-inline-start: 1.1rem; border: 6px solid transparent; border-block-start-color: var(--pc-t-accent); }
:is(.pc-at-tc, .pc-at-t1, .pc-at-t2, .pc-at-t3) .pc-bubble { inset-block-end: auto; inset-block-start: calc(100% + .35rem); }
:is(.pc-at-tc, .pc-at-t1, .pc-at-t2, .pc-at-t3) .pc-bubble::after { inset-block-start: auto; inset-block-end: 100%; border-block-start-color: transparent; border-block-end-color: var(--pc-t-accent); }
/* “Thinking…” bubble of a computer seat (app.js thinkBubble): a little smaller and italic; the dots hop in turn
   with full motion (.pc-dots-live), otherwise they simply stand there */
.pc-bubble.pc-bubble-think { font-style: italic; font-weight: 600; white-space: nowrap; unicode-bidi: plaintext; }
.pc-dots { display: inline-flex; }
.pc-dots > span { display: inline-block; }
.pc-theme-row .pc-muted { flex-basis: auto; }
.pc-seat-edit .pc-portrait-sm { margin-inline-end: .1rem; }
.pc-lobby-seats .pc-portrait-sm { margin-inline-end: .2rem; }
.pc-set-h { font-size: 1rem; margin: 1rem 0 .3rem; }
/* felt textures (drawn with gradients, no images) and the optional felt picture from the art step */
.pc-tex-noise .pc-felt { background-image: radial-gradient(rgb(255 255 255 / .05) 1px, transparent 1px), radial-gradient(circle at 50% 30%, var(--pc-felt), var(--pc-felt-2)); background-size: 5px 5px, auto; }
.pc-tex-stripes .pc-felt { background-image: repeating-linear-gradient(170deg, rgb(255 255 255 / .05) 0 10px, transparent 10px 24px), radial-gradient(circle at 50% 30%, var(--pc-felt), var(--pc-felt-2)); }
.pc-tex-grid .pc-felt { background-image: linear-gradient(rgb(255 255 255 / .05) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / .05) 1px, transparent 1px), radial-gradient(circle at 50% 30%, var(--pc-felt), var(--pc-felt-2)); background-size: 22px 22px, 22px 22px, auto; }
.pc-tex-dots .pc-felt { background-image: radial-gradient(rgb(255 255 255 / .07) 2px, transparent 2.5px), radial-gradient(circle at 50% 30%, var(--pc-felt), var(--pc-felt-2)); background-size: 18px 18px, auto; }
.pc-tex-pixel .pc-felt { background-image: linear-gradient(45deg, rgb(255 255 255 / .04) 25%, transparent 25%, transparent 75%, rgb(255 255 255 / .04) 75%), linear-gradient(45deg, rgb(255 255 255 / .04) 25%, transparent 25%, transparent 75%, rgb(255 255 255 / .04) 75%), radial-gradient(circle at 50% 30%, var(--pc-felt), var(--pc-felt-2)); background-size: 16px 16px, 16px 16px, auto; background-position: 0 0, 8px 8px, 0 0; }
.pc-tex-wood .pc-felt { background-image: repeating-linear-gradient(92deg, rgb(255 255 255 / .035) 0 3px, transparent 3px 11px, rgb(0 0 0 / .06) 11px 13px, transparent 13px 27px), radial-gradient(circle at 50% 30%, var(--pc-felt), var(--pc-felt-2)); }
.pc-tex-stars .pc-felt { background-image: radial-gradient(1.2px 1.2px at 20% 30%, rgb(255 255 255 / .5), transparent), radial-gradient(1px 1px at 70% 60%, rgb(255 255 255 / .4), transparent), radial-gradient(1.4px 1.4px at 45% 80%, rgb(255 255 255 / .35), transparent), radial-gradient(circle at 50% 30%, var(--pc-felt), var(--pc-felt-2)); background-size: 120px 90px, 150px 110px, 90px 130px, auto; }
.pc-tex-waves .pc-felt { background-image: radial-gradient(circle at 50% 100%, transparent 9px, rgb(255 255 255 / .04) 10px, transparent 11px), radial-gradient(circle at 50% 30%, var(--pc-felt), var(--pc-felt-2)); background-size: 24px 12px, auto; }
.pc-has-felt-img .pc-felt { background-image: linear-gradient(rgb(0 0 0 / .5), rgb(0 0 0 / .5)), var(--pc-felt-img); background-size: cover; background-position: center; }
/* animation layer: ghosts and confetti float over the table and never take clicks */
/* ---------- table chat (chat.js): docked beside the table on wide screens, a corner sheet at the top on narrow ones
   (never over the hand); plain text only */
.pc-chat { flex: none; width: clamp(16rem, 21vw, 21rem); box-sizing: border-box; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: .45rem; padding: .6rem .7rem; background: var(--pc-surface); color: var(--pc-ink); border-inline-start: 1px solid var(--pc-line); }
.pc-chat[hidden] { display: none; }
.pc-chat-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.pc-chat-head h2 { margin: 0; font-size: 1.02rem; }
.pc-chat-log { list-style: none; margin: 0; padding: .4rem .5rem; flex: 1 1 auto; min-height: 5rem; overflow-y: auto; display: flex; flex-direction: column; gap: .3rem; border: 1px solid var(--pc-line); border-radius: 10px; background: var(--pc-bg); }
.pc-chat-log[hidden], .pc-chat-empty[hidden] { display: none; }
.pc-chat-empty { margin: 0; flex: 1 1 auto; }
.pc-chat-msg { line-height: 1.35; font-size: .92rem; overflow-wrap: anywhere; }
.pc-chat-name { font-weight: 700; }
.pc-chat-mine .pc-chat-name { color: var(--pc-accent-ink); }
.pc-chat-reaction .pc-chat-text { font-size: 1.1rem; font-weight: 700; }
.pc-chat-reacts { display: flex; flex-wrap: wrap; gap: .3rem; }
.pc-chat-react { min-height: 36px; min-width: 40px; padding: .2rem .5rem; justify-content: center; }
.pc-chat-form { display: flex; gap: .35rem; }
.pc-chat-form input { flex: 1; min-width: 0; }
.pc-chat-err { margin: 0; color: var(--pc-warn); font-weight: 600; }
.pc-chat-err:empty { display: none; }
.pc-chat-help { margin: 0; font-size: .82rem; }
.pc-chat-mute summary { cursor: pointer; font-weight: 600; min-height: 28px; }
@media (max-width: 899px) {
  .pc-chat { position: absolute; z-index: 35; inset-block-start: .5rem; inset-inline-end: .5rem; width: min(22rem, calc(100% - 1rem)); max-height: min(62%, 28rem); border: 1px solid var(--pc-line); border-radius: 14px; box-shadow: var(--shadow-3); }
}
.pc-fx { position: fixed; inset: 0; z-index: 40; pointer-events: none; overflow: hidden; }
.pc-ghost { position: fixed; margin: 0; display: block; }
.pc-confetti { position: fixed; inset: 0; width: 100%; height: 100%; }

/* ---------- phones */
@media (max-width: 640px) {
  .pc-home, .pc-table-wrap { padding: .5rem; }
  .pc-table-wrap { --pc-pw: 2.75rem; }
  .pc-field label, .pc-field .pc-label-like { min-width: 0; flex-basis: 100%; }
  .pc-seat-edit input[type="text"] { width: 100%; }
  .pc-bj-seat { min-width: 0; flex: 1 1 100%; }
  .pc-code { font-size: 1.5rem; }
  .pc-statusline { flex-basis: 100%; }
  .pc-arena { display: flex; flex-wrap: wrap; gap: .35rem; }
  .pc-arena .pc-felt { flex: 1 1 100%; order: 1; }
  .pc-seats-ring > .pc-seat { flex: 1 1 calc(50% - .35rem); order: 0; padding: .3rem .45rem; gap: .35rem; font-size: .84rem; }
  .pc-seats-ring > .pc-seat.pc-at-me { order: 2; flex-basis: 100%; }
  .pc-portrait, img.pc-portrait { border-radius: 10px; }
  .pc-bubble, .pc-seats-ring .pc-bubble, :is(.pc-at-tc, .pc-at-t1, .pc-at-t2, .pc-at-t3) .pc-bubble { max-width: 8.5rem; font-size: .76rem; inset-block-end: auto; inset-block-start: calc(100% + .3rem); }
  .pc-bubble::after { inset-block-start: auto; inset-block-end: 100%; border-block-start-color: transparent; border-block-end-color: var(--pc-t-accent); }
}

@media (prefers-reduced-motion: no-preference) {
  .pc-card-btn { transition: transform .12s ease, box-shadow .12s ease; }
  .pc-card-btn.pc-playable:hover { transform: translateY(-4px); }
  .pc-seat-turn .pc-portrait { animation: pc-turn-pulse 1.6s ease-in-out infinite; }
  .pc-bubble { animation: pc-bubble-in .22s ease-out both; }
  @keyframes pc-turn-pulse { 50% { transform: scale(1.06); } }
  @keyframes pc-bubble-in { from { opacity: 0; transform: translateY(6px) scale(.9); } to { opacity: 1; transform: none; } }
}
.pc-lobby-seats .pc-tag { margin-inline-start: .45rem; }
@media (prefers-reduced-motion: no-preference) {
  /* thinking: the dots hop one after the other, the portrait sways and glances aside (only with the Animations
     setting on: moods.js sets .pc-moves; a cheer/frown mood keeps its own movement) */
  .pc-dots-live .pc-dots > span { animation: pc-dot 1.2s ease-in-out infinite both; }
  .pc-dots-live .pc-dots > span:nth-child(2) { animation-delay: .2s; }
  .pc-dots-live .pc-dots > span:nth-child(3) { animation-delay: .4s; }
  .pc-seat-thinking .pc-portrait-live.pc-moves:not([data-mood="cheer"], [data-mood="frown"]) > * { animation: pc-think 2.6s ease-in-out infinite; }
  @keyframes pc-dot { 0%, 70%, 100% { transform: none; } 35% { transform: translateY(-.3em); } }
  @keyframes pc-think { 0%, 100% { transform: scale(1.05) rotate(0); } 25% { transform: scale(1.05) translateX(-3%) rotate(-3deg); } 55% { transform: scale(1.05) translateX(2%) rotate(2deg); } 75% { transform: scale(1.06) translateY(-2%) rotate(0); } }
}

/* Shedding games (games-shed.js): Durak table pairs, Sevens rows, Kings Corners layout */
.pc-dur-cards { display: inline-flex; align-items: flex-start; }
.pc-dur-cards .pc-dur-beat { margin-inline-start: calc(var(--pc-cw, 4.2rem) * -.57); margin-block-start: calc(var(--pc-cw, 4.2rem) * .26); }
.pc-dur-talon { display: inline-flex; align-items: center; gap: .3rem; }
.pc-sv-layout { display: flex; flex-direction: column; gap: .35rem; min-width: 0; flex: 2 1 18rem; }
.pc-sv-row { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; min-height: 2.2rem; }
.pc-sv-row .pc-mini-cards { flex-wrap: nowrap; gap: 0; direction: ltr; }
.pc-sv-row .pc-card-mini + .pc-card-mini { margin-inline-start: calc(var(--pc-cw, 4.2rem) * -.37); }
.pc-sv-suit { min-width: 5.5rem; }
.pc-kc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; flex: 2 1 18rem; min-width: 0; max-width: 30rem; }
.pc-kc-pile { display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .3rem; border-radius: 10px; background: rgb(0 0 0 / .14); min-height: 5.6rem; min-width: 0; }
.pc-kc-corner { background: rgb(0 0 0 / .24); }
.pc-kc-pile .pc-muted { font-size: .78rem; text-align: center; }

/* Collecting games (collect.js): Rommé melds on the table (cards overlap so long runs fit a phone) */
.pc-melds { flex: 2 1 18rem; min-width: 0; }
.pc-plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .45rem .9rem; }
.pc-plain-list > li { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.pc-meld-owner { font-size: .78rem; color: var(--pc-felt-muted); flex-basis: 100%; }
.pc-melds .pc-mini-cards { flex-wrap: nowrap; gap: 0; direction: ltr; }
.pc-melds .pc-card-mini + .pc-card-mini { margin-inline-start: calc(var(--pc-cw, 4.2rem) * -.31); }

/* Theme backdrop, portrait moods and idle movements (themes-ui.js, moods.js). The backdrop picture sits behind the
   whole table under a veil of the page colour (84 %), slightly blurred, so text on it keeps AA contrast in light and
   dark mode; small screens load the 960 px file; reduced data → no picture, reduced transparency → a stronger veil. */
.pc-table-wrap.pc-has-bg { position: relative; isolation: isolate; }
.pc-table-wrap.pc-has-bg::before {
  content: ''; position: absolute; inset: 0; z-index: -1; border-radius: 16px; pointer-events: none;
  background: linear-gradient(color-mix(in srgb, var(--pc-bg) 84%, transparent), color-mix(in srgb, var(--pc-bg) 84%, transparent)), var(--pc-bg-img-sm) center / cover no-repeat;
  filter: blur(1.5px) saturate(1.1);
}
@media (min-width: 961px) {
  .pc-table-wrap.pc-has-bg::before { background-image: linear-gradient(color-mix(in srgb, var(--pc-bg) 84%, transparent), color-mix(in srgb, var(--pc-bg) 84%, transparent)), var(--pc-bg-img); }
}
@media (prefers-reduced-transparency: reduce) {
  .pc-table-wrap.pc-has-bg::before { background-image: linear-gradient(color-mix(in srgb, var(--pc-bg) 95%, transparent), color-mix(in srgb, var(--pc-bg) 95%, transparent)), var(--pc-bg-img-sm); filter: none; }
}
@media (prefers-reduced-data: reduce) {
  .pc-table-wrap.pc-has-bg::before { background-image: none; }
}
.pc-portrait-live { position: relative; }
.pc-portrait-live > .pc-portrait-img, .pc-portrait-live > .pc-portrait-svg, .pc-portrait-mood { width: 100%; height: 100%; display: block; object-fit: cover; }
.pc-portrait-mood { position: absolute; inset: 0; opacity: 0; }
.pc-portrait-live[data-mood="cheer"] .pc-mood-cheer, .pc-portrait-live[data-mood="frown"] .pc-mood-frown { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .pc-portrait-mood { transition: opacity .35s ease; }
  /* movements only while motion is allowed and the Animations setting is on (moods.js sets .pc-moves) */
  .pc-portrait-live.pc-moves > * { transform-origin: 50% 85%; }
  .pc-portrait-live.pc-moves[data-mood="cheer"] > * { animation: pc-cheer .9s ease-in-out 2; }
  .pc-portrait-live.pc-moves[data-mood="frown"] > * { animation: pc-frown 1.4s ease-in-out 1 both; }
  .pc-portrait-live.pc-moves.pc-idle-breathe > * { animation: pc-breathe 2.2s ease-in-out 1; }
  .pc-portrait-live.pc-moves.pc-idle-tilt > * { animation: pc-tilt 2.2s ease-in-out 1; }
  .pc-portrait-live.pc-moves.pc-idle-bob > * { animation: pc-bob 1.6s ease-in-out 1; }
  @keyframes pc-cheer { 0%, 100% { transform: scale(1.04); } 30% { transform: translateY(-7%) scale(1.1); } 60% { transform: translateY(1%) scale(1.05) rotate(2deg); } }
  @keyframes pc-frown { 0% { transform: scale(1.04); } 25% { transform: translateX(-3%) scale(1.06) rotate(-2deg); } 50% { transform: translateX(3%) scale(1.06) rotate(2deg); } 100% { transform: translateY(3%) scale(1.06); } }
  @keyframes pc-breathe { 0%, 100% { transform: scale(1.02); } 50% { transform: scale(1.07); } }
  @keyframes pc-tilt { 0%, 100% { transform: scale(1.08) rotate(0); } 35% { transform: scale(1.08) rotate(-4deg); } 70% { transform: scale(1.08) rotate(2deg); } }
  @keyframes pc-bob { 0%, 100% { transform: scale(1.05); } 40% { transform: translateY(-4%) scale(1.06); } }
}

/* ---- Cribbage, Briscola, Belote, Canasta (w33 games-c) ---- */
.pc-pegboard { margin: 0; flex: 1 1 100%; min-width: 0; max-width: 44rem; }
.pc-pegboard-svg { display: block; width: 100%; height: auto; }
.pc-peg-wood { fill: #8a5a2b; stroke: #5b3a19; stroke-width: 2; }
.pc-peg-hole { fill: #2b1a0b; }
.pc-peg-front, .pc-peg-rear { stroke: #1b1b1b; stroke-width: 1.2; }
.pc-peg-s0 { fill: #e8f1ff; background: #e8f1ff; }
.pc-peg-s1 { fill: #ffd34d; background: #ffd34d; }
.pc-peg-rear { opacity: .75; }
.pc-pegboard figcaption { margin-top: .3rem; }
.pc-peg-text { list-style: none; margin: .2rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .2rem 1.2rem; }
.pc-peg-key { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; border: 1px solid var(--pc-ink); margin-inline-end: .35rem; vertical-align: -.1rem; }
.pc-crib-series { flex: 1 1 14rem; }
.pc-canasta-melds { display: flex; flex-wrap: wrap; gap: .6rem 1rem; flex: 1 1 100%; min-width: 0; }
.pc-canasta-side { flex: 1 1 16rem; min-width: 0; }
.pc-canasta-h { font-size: 1rem; margin: .2rem 0; font-weight: 700; }
.pc-meld { display: inline-flex; flex-direction: column; gap: .15rem; margin: 0 .5rem .4rem 0; vertical-align: top; }
.pc-meld-done { outline: 2px solid var(--pc-good); outline-offset: 2px; border-radius: .3rem; }

/* ---- Schwimmen, Elfer raus!, Schnapsen/66, Watten (w33 games-a) ---- */
.pc-sw-lives { display: inline-flex; align-items: center; gap: .2rem; flex-wrap: wrap; }
.pc-sw-coin { display: inline-block; width: .85rem; height: .85rem; border-radius: 50%; border: 2px solid currentColor; box-sizing: border-box; }
.pc-sw-coin-on { background: radial-gradient(circle at 35% 35%, #fff3b0 0 18%, #e0b23a 19% 100%); }
.pc-sw-coin-off { background: transparent; opacity: .55; }
.pc-sw-wave { font-size: .78rem; font-weight: 700; font-style: italic; padding-inline-start: .15rem; }
.pc-sw-wave::before { content: "\2248\00a0"; font-style: normal; }
.pc-sw-center { align-items: stretch; }
.pc-sw-middle { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.pc-sw-mid-cards { display: flex; flex-wrap: wrap; gap: .4rem; padding-top: .7rem; }
.pc-sw-mid-cards > .pc-card-btn { width: var(--pc-cw, 4.2rem); }
.pc-sw-mid-cards > .pc-card { width: var(--pc-cw, 4.2rem); }
.pc-sw-knock { display: flex; align-items: center; gap: .5rem; margin: .2rem 0 .4rem; padding: .35rem .6rem; border: 2px solid currentColor; border-radius: .5rem; font-weight: 800; background: rgba(0, 0, 0, .22); }
.pc-sw-knock-mark { display: inline-flex; line-height: 1; }
.pc-sw-knockbtn[aria-pressed="true"] { outline: 3px solid var(--pc-focus); outline-offset: 2px; }
.pc-sw-loser th, .pc-sw-loser td { font-weight: 700; }
.pc-sw-loser th::after { content: " \2193"; }
.pc-table .pc-mini-cards { flex-wrap: nowrap; }
.pc-er-range { display: inline-flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.pc-er-gap { font-weight: 800; }
.pc-sn-stack { display: inline-flex; align-items: center; gap: .2rem; }
.pc-sn-turnup { transform: rotate(-90deg); margin-inline: .6rem; }
.pc-wa-hidden { padding: .6rem 0; }
@media (prefers-reduced-motion: no-preference) {
  .pc-sw-knock-mark { animation: pc-sw-knock 0.9s ease-in-out 3; display: inline-block; }
  .pc-sw-swimming .pc-sw-wave { animation: pc-sw-bob 2.4s ease-in-out infinite; display: inline-block; }
}
@keyframes pc-sw-knock { 0%, 100% { transform: none; } 30% { transform: translateX(-3px) rotate(-12deg); } 60% { transform: translateX(3px) rotate(10deg); } }
@keyframes pc-sw-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }

/* ---------------------------------------------------------------- board games (board-ui.js, boards1.js) */
.pc-bd-table { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: .6rem 1.2rem; width: 100%; }
.pc-bd-status { margin: 0; font-weight: 700; text-align: center; flex-basis: 100%; }
.pc-board-wrap { width: min(100%, 30rem, 54vh); min-width: min(100%, 16rem); }
.pc-board { position: relative; width: 100%; aspect-ratio: var(--pc-board-ratio, 1 / 1); border-radius: 10px; overflow: hidden; box-shadow: 0 6px 18px rgb(0 0 0 / .35); }
.pc-board-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pc-board-keys { position: absolute; inset: 0; }
.pc-bd-cell { position: absolute; margin: 0; padding: 0; border: 0; background: transparent; cursor: pointer; border-radius: 4px; -webkit-tap-highlight-color: transparent; }
.pc-bd-cell:hover { box-shadow: inset 0 0 0 2px rgb(255 255 255 / .55); }
.pc-bd-cell:focus-visible { outline: 3px solid #fbbf24; outline-offset: -3px; box-shadow: inset 0 0 0 5px rgb(0 0 0 / .55); }
.pc-bd-light-sq { fill: #ecdcbc; }
.pc-bd-dark-sq { fill: #8b5a36; }
.pc-bd-dark-sq.pc-bd-path { fill: #a06a3c; }
.pc-bd-dark-sq.pc-bd-last { fill: #b9792f; }
.pc-bd-num { font: 600 2.1px system-ui, sans-serif; fill: rgb(255 255 255 / .6); pointer-events: none; }
.pc-board-reversi .pc-bd-num { fill: rgb(255 255 255 / .75); }
.pc-bd-shadow { fill: rgb(0 0 0 / .35); }
.pc-bd-light .pc-bd-disc, circle.pc-bd-light { fill: #f6f1e6; stroke: #6d5b45; stroke-width: .45; }
.pc-bd-dark .pc-bd-disc, circle.pc-bd-dark { fill: #2a2422; stroke: #000; stroke-width: .45; }
.pc-bd-ring { fill: none; stroke-width: .45; }
.pc-bd-light .pc-bd-ring { stroke: #b8a588; }
.pc-bd-dark .pc-bd-ring { stroke: #6b5d57; }
.pc-bd-crown { fill: #e0a526; stroke: #5b3d05; stroke-width: .3; }
.pc-bd-lift .pc-bd-disc { stroke: #fbbf24; stroke-width: 1; }
.pc-bd-dot { fill: #fbbf24; stroke: #1f2937; stroke-width: .3; pointer-events: none; }
.pc-bd-captured { stroke: #fca5a5; stroke-width: .9; stroke-linecap: round; fill: none; }
.pc-bd-frame { fill: #2f6b4f; }
.pc-bd-hole { fill: #10251c; }
.pc-bd-four0 { fill: #f28c28; stroke: #7a3d06; stroke-width: .4; }
.pc-bd-four1 { fill: #8146b8; stroke: #34124f; stroke-width: .4; }
.pc-bd-mark { fill: none; stroke: rgb(255 255 255 / .7); stroke-width: .5; }
.pc-bd-markdot { fill: rgb(255 255 255 / .85); }
.pc-bd-win circle:first-child { stroke: #fde68a; stroke-width: 1.1; }
.pc-bd-colnum { font: 700 2.4px system-ui, sans-serif; fill: #e5f3ea; text-anchor: middle; pointer-events: none; }
.pc-bd-felt { fill: #1d6646; }
.pc-bd-grid { stroke: rgb(0 0 0 / .5); stroke-width: .35; }
.pc-bd-star { fill: rgb(0 0 0 / .55); }
rect.pc-bd-last { fill: rgb(251 191 36 / .28); }
.pc-bd-chip { width: 1em; height: 1em; vertical-align: -.15em; margin-inline-end: .3em; }
.pc-bd-colour { display: inline-flex; align-items: center; }
.pc-bd-moves { width: min(100%, 14rem); }
@media (max-width: 760px) { .pc-bd-moves { width: 100%; } }
.pc-bd-movelist { margin: .3rem 0 0; padding-inline-start: 2.4rem; font-variant-numeric: tabular-nums; max-height: min(24rem, 40vh); overflow: auto; }
.pc-bd-movelist li span { display: inline-block; min-width: 4.2rem; }
.pc-bd-choice-label { font-weight: 700; }
@media (prefers-reduced-motion: no-preference) {
  .pc-bd-drop { animation: pc-bd-drop .32s cubic-bezier(.3, 0, .6, 1); }
  .pc-bd-moved, .pc-bd-flip { animation: pc-bd-pop .3s ease-out; transform-box: fill-box; transform-origin: center; }
}
@keyframes pc-bd-drop { from { transform: translateY(-40px); } to { transform: none; } }
@keyframes pc-bd-pop { from { transform: scale(.82); } to { transform: none; } }
@media (forced-colors: active) {
  .pc-bd-cell:focus-visible { outline: 3px solid Highlight; }
}

/* ---------------------------------------------------------------- Contract Bridge (bridge.js) */
.pc-br-box { display: grid; gap: .4rem; }
.pc-br-row { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.pc-br-level, .pc-br-strain { min-width: 2.75rem; min-height: 2.75rem; padding: .25rem .5rem; justify-content: center; font-weight: 700; }
.pc-br-level.pc-br-on, .pc-br-level[aria-pressed="true"] { background: var(--pc-accent); color: var(--pc-on-accent); border-color: transparent; }
.pc-br-level[disabled], .pc-br-strain[disabled], .pc-br-x[disabled] { opacity: .45; cursor: not-allowed; }
.pc-br-strain .pc-suit { display: block; }
.pc-br-hint { margin: 0; max-width: 40rem; }
.pc-br-call { display: inline-flex; align-items: center; gap: .1rem; font-weight: 700; white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
.pc-br-auction { width: 100%; max-width: 26rem; table-layout: fixed; }
.pc-br-auction th, .pc-br-auction td { text-align: center; padding: .2rem .25rem; overflow-wrap: anywhere; }
.pc-br-next { font-weight: 700; }
.pc-br-auction-wrap { display: grid; gap: .3rem; justify-items: center; }
.pc-br-notes ul { margin: .3rem 0; padding-inline-start: 1.1rem; text-align: start; max-width: 32rem; }
.pc-br-dummy { display: grid; gap: .15rem; padding: .4rem .5rem; border-radius: .5rem; border: 1px solid var(--pc-line); background: var(--pc-surface); color: var(--pc-ink); max-width: 100%; }
.pc-br-dummy-live { box-shadow: 0 0 0 3px var(--pc-focus); }
.pc-br-dummy .pc-label { margin: 0 0 .15rem; }
.pc-br-suit { display: flex; align-items: center; gap: 0; direction: ltr; min-height: 1.6rem; }
.pc-br-suit-ico { display: inline-flex; flex: none; }
.pc-br-suit .pc-card-mini { width: calc(var(--pc-cw, 4.2rem) * .55); flex: none; }
.pc-br-suit .pc-card-mini + .pc-card-mini { margin-inline-start: calc(var(--pc-cw, 4.2rem) * -.2); }
.pc-br-dcard { padding: 0; border: 0; background: none; cursor: pointer; border-radius: .3rem; }
/* declarer's turn in the dummy: bigger cards and less overlap, so every card is a comfortable target */
.pc-br-dummy-live .pc-br-suit .pc-card-mini { width: max(2.6rem, calc(var(--pc-cw, 4.2rem) * .6)); }
.pc-br-dummy-live .pc-br-suit .pc-card-mini + .pc-card-mini { margin-inline-start: -1rem; }
.pc-br-dummy-live .pc-br-suit { flex-wrap: wrap; row-gap: .2rem; }
.pc-br-dcard[aria-disabled="true"] { cursor: not-allowed; filter: grayscale(.5) brightness(.85); }
.pc-br-dcard.pc-playable:hover, .pc-br-dcard.pc-playable:focus-visible { transform: translateY(-6px); }
.pc-br-dcard:focus-visible { outline: 3px solid var(--pc-focus); outline-offset: 2px; }
.pc-br-sheet { width: 100%; max-width: 48rem; }
.pc-br-sheet td.pc-num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pc-br-sheet .pc-br-group { text-align: start; text-transform: uppercase; font-size: .8em; letter-spacing: .04em; }
.pc-br-below .pc-br-group { border-top: 3px solid currentColor; }
.pc-br-sheet .pc-br-game { text-align: start; font-weight: 400; font-style: italic; }
.pc-br-info p { margin: .15rem 0; }
/* suit icons use the card inks (made for white card faces): always on a card-paper chip, light and dark theme */
.pc-br-call, .pc-br-suit-ico { background: #fbfaf6; color: #1b1b1b; padding: 0 .3rem; border-radius: .3rem; }
.pc-br-suit-ico { padding: .1rem; width: auto; margin-inline-end: .3rem; }
.pc-br-strain:not([disabled]) { background: #fbfaf6; color: #1b1b1b; border-color: #5f6368; }
.pc-br-strain[disabled] { background: #e9e7e0; color: #1b1b1b; }
.pc-felt .pc-br-dummy :is(.pc-muted, .pc-label) { color: var(--pc-ink); }
@media (max-width: 640px) {
  .pc-br-level, .pc-br-strain { min-width: 2.6rem; }
  .pc-br-suit .pc-card-mini { width: calc(var(--pc-cw, 4.2rem) * .5); }
  .pc-br-sheet { font-size: .85em; }
}
@media (prefers-reduced-motion: reduce) {
  .pc-br-dcard.pc-playable:hover, .pc-br-dcard.pc-playable:focus-visible { transform: none; }
}
@media (forced-colors: active) {
  .pc-br-level[aria-pressed="true"] { outline: 3px solid Highlight; }
}
.pc-bd-import { display: flex; flex-direction: column; gap: .35rem; margin: .5rem 0; }
.pc-bd-import label { font-weight: 600; margin-block-start: .4rem; }
.pc-bd-import textarea { width: 100%; box-sizing: border-box; font-family: ui-monospace, monospace; min-height: 8rem; }
.pc-bd-error { color: #b91c1c; font-weight: 600; margin: .2rem 0; }
.pc-bd-error:empty { display: none; }
:root[data-theme="dark"] .pc-bd-error { color: #fca5a5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pc-bd-error { color: #fca5a5; } }
/* Board games part 2: Nine Men's Morris, Mancala (Kalah, Oware), Go — own board art */
.pc-bd2-stack { display: flex; flex-direction: column; align-items: center; gap: .35rem; width: min(100%, 30rem, 54vh); min-width: min(100%, 16rem); }
.pc-bd2-stack .pc-board-wrap { width: 100%; }
.pc-bd2-stack:has(.pc-board-kalah), .pc-bd2-stack:has(.pc-board-oware) { width: min(100%, 42rem); }
.pc-bd2-stack:has(.pc-board-go) { width: min(100%, 34rem, 62vh); }
.pc-bd2-info { width: 100%; font-size: .92rem; text-align: center; }
.pc-bd2-info p { margin: .15rem 0; }
.pc-bd2-wood { fill: #c99a5b; }
.pc-bd2-line { stroke: #3d2812; stroke-width: .7; fill: none; }
.pc-bd2-point { fill: #3d2812; }
.pc-bd2-trail { stroke: #fbbf24; stroke-width: .9; stroke-dasharray: 1.4 1.1; fill: none; }
.pc-bd2-mill { fill: none; stroke: #b45309; stroke-width: .8; }
.pc-bd2-remove { stroke: #dc2626; stroke-width: .9; stroke-linecap: round; fill: none; }
.pc-bd2-store, .pc-bd2-pit { fill: #8a5a2b; stroke: #4a2c10; stroke-width: .4; }
.pc-bd2-pit.pc-bd2-canpit { stroke: #fde68a; stroke-width: .7; }
.pc-bd2-pit.pc-bd2-lastpit { fill: #a86f35; }
.pc-bd2-seed { stroke: rgb(0 0 0 / .35); stroke-width: .15; }
.pc-bd2-seed0 { fill: #e9e2d0; }
.pc-bd2-seed1 { fill: #c8b48e; }
.pc-bd2-seed2 { fill: #f4efe4; }
.pc-bd2-count { font: 700 2.6px system-ui, sans-serif; fill: #fff7e6; text-anchor: middle; pointer-events: none; paint-order: stroke; stroke: #3d2812; stroke-width: .5; }
.pc-bd2-goban { fill: #dcb36b; }
.pc-bd2-goline { stroke: #3b2a10; stroke-width: .35; fill: none; }
.pc-bd2-gostar { fill: #3b2a10; }
.pc-bd2-gocoord { font: 600 2.6px system-ui, sans-serif; fill: #3b2a10; text-anchor: middle; pointer-events: none; }
.pc-board-go .pc-bd-disc { stroke-width: .3; }
.pc-bd2-lastw { fill: none; stroke: #f6f1e6; stroke-width: .6; }
.pc-bd2-lastb { fill: none; stroke: #2a2422; stroke-width: .6; }
.pc-bd2-dead { opacity: .5; }
.pc-bd2-terrb { fill: #2a2422; }
.pc-bd2-terrw { fill: #f6f1e6; stroke: #6d5b45; stroke-width: .25; }
