:root {
  color-scheme: dark;
  --bg: #10131a;
  --surface: #1a1e27;
  --surface-2: #232936;
  --border: #2b3241;
  --text: #f1f4f8;
  --muted: #8d97ab;
  --accent: #4f9dff;
  --accent-text: #061120;
  --danger: #e5533d;
  --felt: #142720;
  --card-bg: #f8f7f2;
  --card-text: #1b1f24;
  --card-red: #c0392b;
  /* *nit (direct user request): "the cards need borders." They HAD one -
     `1px solid #d9d9d3` - which reads fine where a card sits against the
     dark felt, and is nearly invisible where it matters most: card ON
     card. In a fan or an overlapped stack every internal edge is cream
     against cream, so seven cards read as one pale blob with pips on it.
     A card's edge is a real, load-bearing affordance here (it's the
     click target, and the only cue for how many cards are in a spread),
     so it gets a token and a colour with actual contrast against
     `--card-bg`, not a hairline that only works over felt. */
  --card-border: #6f6c60;
  /* *nit (direct user request): "make the stacking angles consistent wrt
     cards and chips (same perspective)", then "tighten the stacking
     angle... and give a slight diagonal from lower left to upper right".
     ONE step for every stacked thing - the deck's depth layers and a
     chip stack's offset - so a table never shows two viewpoints at once.

     `--stack-step` is the vertical rise per item, `--stack-step-x` the
     sideways drift. Deeper items sit DOWN and LEFT of the one above, so
     a stack climbs toward the upper right.

     The drift is deliberately much smaller than the rise - "slight" was
     the word, and a first pass at 2px read as a real lean rather than a
     hint of one. Both stacks share these two numbers, so the angle is
     changed here and nowhere else. */
  --stack-step: 2.5px;
  --stack-step-x: 1px;
  /* The deepest a stack ever draws (`deckDepth`'s cap, ui.js). Used to
     RESERVE room so a deck panel is sized for a full deck at all times
     - direct user request, "give the deck panel more room for when the
     deck gets big". Reserving the maximum rather than the current depth
     also stops the panel resizing on every single draw, which made the
     whole row twitch as cards came off. */
  --stack-max-depth: 5;
  /* Card geometry lives here so the stack/overlap offsets, the deck
     stack and the card itself can't drift apart. `--card-w` is a
     *minimum*: a card grows past it if the browser enlarges its text
     (e.g. a user's minimum-font-size setting), rather than clipping. */
  /* D51 (table-unification pass): reverted the viewport-height-adaptive
     `clamp(...svh...)` sizing from the 44px touch-target fix (D-entries
     around 2026-08-20) back to a flat size, and bigger than the
     pre-shrink baseline (3rem/4.1rem) too - explicit user direction,
     this pass is DESKTOP-ONLY (no mobile-fit chase), so the whole reason
     for shrinking cards on short viewports no longer applies here. If a
     real mobile pass ever resumes, this needs its own reasoned re-visit,
     not just re-adding the old clamp. */
  /* UX follow-up (direct user request): -25% off the D51 desktop size
     (3.6rem/4.9rem -> 2.7rem/3.675rem). Rounded to 2 decimal places so
     the exact -25% ratio survives, not eyeballed. */
  /* *fix (direct user report): "rtg deck pile's cards too small and
     don't match the top card" - `--card-w`/`--card-h` are no longer a
     fixed constant. Direct user correction: don't give RtG (or any
     other deck) its own separate sizing tokens/CSS - every card
     measurement in this file (`.card`, `.deck-stack`,
     `.deck-stack-layer`, `.deck-stack-card`, hand fan spread, ...)
     already reads THESE two tokens, so a preset that needs bigger cards
     (`presets.js`'s `cardSize`) reconfigures them for the whole table
     instead (`ui.js`'s `applyCardSize`) - every rule below picks that
     up automatically, with no per-face override anywhere. These are
     therefore the values below only until a game with its own
     `cardSize` is running; JS sets an inline override on `:root`
     (`document.documentElement.style`) at that point, which always
     outranks this stylesheet rule for the same property. */
  --card-w: 2.7rem;
  --table-min-h: 30rem;
  --card-h: 3.68rem;
  /* Unitless width/height ratio, kept in step with the two tokens above
     (`ui.js`'s `applyCardSize` sets all three together for a preset
     with its own `cardSize`) - `aspect-ratio` needs a plain number pair,
     not lengths, so this exists alongside `--card-w`/`--card-h` rather
     than being computed from them in CSS (dividing two lengths isn't
     something `calc()` can do). Used by `.rtg-inspect-art` so the
     inspect overlay crops the same card art at the same ratio the
     resting face already does, instead of an unrelated fixed box. */
  --card-aspect: 2.7 / 3.68;
  --card-gap: 0.5rem;
  --radius-sm: 0.45rem;
  --radius-md: 0.75rem;
  --radius-lg: 1.1rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.4;
}

.screen {
  max-width: 480px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* The game screen benefits from more room (cards, roster, hand) on
   anything wider than a phone - Smith UX audit finding #4. */
/* The setup/join screens keep the generous 2rem/4rem padding above -
   they're short, one-shot forms with room to spare. The GAME screen is
   the one this whole fix is about, and 6rem of top+bottom padding was
   real fixed cost on exactly the axis that was overflowing, so it gets
   its own much tighter padding, laid out as a column that fills the
   viewport instead of stacking to whatever height its content wants. */
#screen-game {
  max-width: 760px;
  position: relative;
  padding: 0.5rem 1.25rem 0.5rem;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* US-116 (New Game) bug, found live: the id selector's own `display:
   flex` above outranks the UA stylesheet's `[hidden] { display: none }`
   (same specificity gotcha already fixed for `.btn-row[hidden]`/
   `.deck-choices[hidden]`) - harmless while `#screen-game` only ever
   went from hidden to shown ONCE per table, but New Game navigates back
   to `#screen-host` mid-game, and without this the live table stayed
   visible (forced `display: flex`) underneath the host form. */
#screen-game[hidden] { display: none; }

/* `gap` above is now what spaces the game screen's direct children -
   their own `margin-bottom` (`.panel`'s 1.25rem, `.game-code-bar`'s
   0.6rem) would otherwise stack ON TOP of the gap, double-spacing every
   boundary and costing exactly the kind of few-tens-of-pixels that tips
   a snug mobile layout back into scrolling. */
#screen-game > * { margin-bottom: 0; }

/* Short viewports (real devices - iPhone SE-class and smaller, not just
   narrow ones): after the toolbar packing above, what's left is generic
   `.panel` padding and heading margins that were sized for a page that
   used to scroll. Trimmed here rather than globally, so every OTHER
   screen (host setup, join) keeps its normal breathing room - this is
   the one screen with a hard "no scroll" requirement. Card size already
   self-adjusts via the `--card-w`/`--card-h` clamp(); this is the rest
   of the chrome following the same principle. */
/* Two tiers, WIDER one first: a `max-height` query is a ceiling, not a
   band, so both can match at once at very short heights - CSS then picks
   whichever rule is LAST in the file for equal-specificity selectors.
   The tighter (700px) tier has to come second, or its smaller padding
   would lose to the looser 850px tier's at any height under 700px,
   which is backwards (found by testing, not assumed - it initially
   shipped in the wrong order and made the shortest viewport WORSE). */
@media (max-height: 850px) {
  /* 44px buttons (design-lint fix, 2026-08-20) added real fixed height
     to every btn-row, reopening page scroll specifically in the
     720-850px WINDOW-height range common on laptops with browser
     chrome/taskbars eating vertical space - real sizes, not synthetic
     (1280x800, 1024x768). D51: bigger cards (--card-w/--card-h) raised
     the base desktop floor from 34rem to 36rem to keep the ring clear of
     the bigger pot (measured live via lint:design). A genuinely short
     window (720px) still overflows by 32px even at this tier's trimmed
     chrome padding - tried lowering `--table-min-h` back down for this
     tier specifically, measured live that it does NOT help (the overflow
     isn't floor-bound at this exact height, something else is the
     binding constraint) and reverted that attempt rather than leave dead
     CSS. Disclosed, not chased further: real but narrow (a 720px-tall
     desktop window specifically), same "disclose, don't force" precedent
     as this project's other residual design-lint items. */
  #screen-game { padding: 0.2rem 1rem; }
  #screen-game > .panel { padding: 0.3rem 0.5rem; }
  #screen-game h2 { margin: 0 0 0.2rem; font-size: 0.9rem; }
  #screen-game .btn-row { margin-top: 0.2rem; gap: 0.3rem; }
  .game-code-bar { margin-bottom: 0.1rem; }
  .layout-controls { margin-bottom: 0.1rem; }
  fan-pile { padding-top: 0.1rem; }
}

@media (max-height: 700px) {
  /* 28rem, not lower: live-bisected against 375x667's own pot/ring
     overlap - below this the ring touches the pot regardless of how
     much padding is trimmed elsewhere, since padding only affects the
     panels AROUND the ring, not the ring's own geometry. Scroll cost is
     paid down instead through the heavier padding cuts below. */
  :root { --table-min-h: 28rem; }
  #screen-game { padding: 0.3rem 0.6rem; }
  #screen-game > .panel { padding: 0.4rem 0.5rem; }
  #screen-game h2 { margin: 0 0 0.25rem; font-size: 0.9rem; }
  #screen-game .btn-row { margin-top: 0.25rem; gap: 0.25rem; }
  fan-pile { padding-top: 0.2rem; }
  .game-code-bar { margin-bottom: 0; font-size: 0.75rem; }
  .layout-controls { margin-bottom: 0; }
}

/* The table panel is the one that should GROW to fill whatever room is
   left; the hand panel below it takes only what its own content needs.
   `min-height: 0` overrides flexbox's default of never shrinking a flex
   item below its content size - without it, a big hand or a tall roster
   would push the table panel's natural height right back past the
   viewport, which is the exact scrolling bug this fix removes. */
#screen-game > .table-section {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  /* *fix (direct user request, 2026-09-17): the table-zoom wheel moved
     onto the right edge of the table itself - `position: relative`
     here is what makes `.table-zoom-controls`' own `position: absolute`
     anchor to THIS box, not the page. */
  position: relative;
}

#screen-game > .table-section .table-surface {
  flex: 1 1 auto;
  /* NOT 0. This selector's own specificity (id + 2 classes) already beats
     the plain `.table-surface { min-height: var(--table-min-h) }` rule
     below, so writing a literal 0 here didn't just UNLOCK shrinking past
     content size (the intent) - it silently deleted the floor entirely,
     for every screen size, regardless of what --table-min-h was set to.
     That's what let the personal-zone ring collapse into the shared pot:
     the two are laid out by percentage radius within this box, so a
     floor of 0 shrank the ring's real pixel clearance to whatever
     leftover flex space happened to remain. Redeclaring the variable
     here keeps the actual intent - shrinkable, but not below the seat
     ring's safety floor - instead of removing the floor altogether. */
  min-height: var(--table-min-h);
}



/* Desktop table width (US-31, D20; widened further D51 per direct user
   request - "make the UX expand to fill the window"): seat/zone
   geometry in src/seating.js is already purely percentage-based, so
   widening this container is sufficient on its own - no JS change
   needed. D20's original fixed pixel caps (1240px/1600px) left visible
   unused window on anything bigger than a laptop; `calc(100vw - Nrem)`
   genuinely fills the window instead, with a small fixed margin so
   content never touches the browser edge. */
@media (min-width: 1024px) {
  #screen-game { max-width: calc(100vw - 3rem); }
}

/* Found live (D52 follow-up): a bigger 4rem margin here, on its own,
   made the window narrower right at 1440px than it was a moment before
   at 1439px under the 3rem tier (100vw-4rem < 100vw-3rem at the same
   viewport width, by construction) - a real, small step BACKWARD while
   continuously resizing through the breakpoint, exactly the class of
   bug this project's own Gate-2 continuous-resize sweep exists to
   catch (D20). `max()` against what the 3rem tier would already give
   at this exact viewport keeps the wider margin's intent (more
   breathing room on very wide screens, once the window is wide enough
   to afford it) without ever shrinking on the way in. */
@media (min-width: 1440px) {
  #screen-game { max-width: max(calc(100vw - 4rem), calc(1440px - 3rem)); }
}

h1 {
  font-weight: 700;
  font-size: 1.7rem;
  margin: 0 0 0.5rem;
}

h2 {
  font-weight: 700;
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Groups related content visually instead of leaving screens as a flat
   stack of same-background elements - Smith UX audit finding #2. */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.panel-felt { background: var(--felt); }

/* Visually hides content while keeping it for screen readers - the
   "Table" heading is now self-evident from the table-surface visual
   (US-26), but a heading still belongs in the DOM for a11y. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.9rem;
  font-size: 0.9rem;
  color: var(--muted);
}

input, select {
  font-size: 1rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

/* --- Buttons: a real hierarchy instead of one identical blue everywhere
   (Smith UX audit finding #1). Default = neutral/secondary. --- */
/* min-height/min-width here, not just on `.icon-btn` and a handful of
   others: design-lint's first real run (2026-08-20) found 70 buttons
   under the documented 44px floor - the base rule never actually
   guaranteed it, only specific selectors opted in one at a time as
   defects were found by hand. Flex-centered so the extra height reads
   as a normal button, not text stuck to the top of a taller box.
   `.card` is exempt (`tests/designLint.check.mjs`): it's a playing
   card, not a UI control, and the user explicitly authorized shrinking
   its dimensions to fit ("make cards smaller if you need to"). */
button {
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0.6rem 1rem;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}

/* D51 finding: this exempted `<button class="card">` (hand cards -
   `cardEl()` in ui.js) from the base `button{}` rule's 44px touch-target
   floor (design-lint fix, 2026-08-20) - correct, cards are authorized
   to be smaller than a button's minimum touch target. But zeroing
   min-width/min-height to 0 didn't just remove the 44px floor, it beat
   `.card`'s OWN `min-width: var(--card-w)` / `min-height: var(--card-h)`
   too (`button.card`'s element+class specificity outranks plain
   `.card`), leaving every hand card purely content-sized - shrunk to
   whatever its corner/pip text needed, nowhere near `--card-w`/`--card-h`.
   This is the actual root cause of "tiny cards" the user flagged, not
   the `--card-w` value itself (measured live: cards rendered ~25px wide
   with `--card-w` set to 57.6px). Restoring the card-specific size here
   - still opted OUT of the 44px button floor, just not zeroed past it. */
button.card {
  min-height: var(--card-h);
  min-width: var(--card-w);
  display: block;
}

button:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

/* The hand panel's two toolbar rows (sort/pass/play-as, then
   draw/reshuffle/reset-scores) are 4 and 3 controls respectively. On a
   real small phone - iPhone SE-class, 375x667 and smaller, not a
   synthetic size - they wrap to 2-3 rows each, and each row carries the
   44px height floor (ARCHITECTURE.md UI Conventions) that CANNOT shrink
   without failing the same accessibility check this project has
   regressed on before (Sprint 2). Height stays fixed; only horizontal
   padding and the gap between buttons are tightened, so more controls
   fit per row and fewer rows are needed - the actual lever for whether
   this whole screen fits without scrolling on a short phone. */
#screen-game > .panel:last-of-type .btn-row {
  gap: 0.35rem;
}

#screen-game > .panel:last-of-type .btn-row button,
#screen-game > .panel:last-of-type .btn-row select {
  padding-left: 0.6rem;
  padding-right: 0.6rem;
  font-size: 0.85rem;
}

/* A class selector's `display: flex` outranks the UA stylesheet's
   `[hidden] { display: none }`, so a `.btn-row` marked hidden would stay
   visible - caught for real when the host-only deck controls showed up
   on a guest's screen. Applies to any hidden row, not just that one. */
.btn-row[hidden] { display: none; }

.banner {
  background: var(--danger);
  color: white;
  text-align: center;
  padding: 0.75rem;
  font-weight: 600;
}

/* Smith HCI finding (live, US-116): a neutral status notice (New Game
   started) styled identically to the "lost the host"/"session ended"
   banners above reads as an alarm for something that isn't a problem. */
.banner.banner-info {
  background: var(--accent);
  color: var(--accent-text);
}

.share-code {
  font-size: 1.9rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  word-break: break-all;
  margin-bottom: 0.75rem;
  text-align: center;
}

.card-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--card-gap);
  min-height: calc(var(--card-h) + 0.2rem);
}

/* Corner-index playing card, closer to a real card's layout than a bare
   concatenated string (Smith UX audit finding #3). */
.card {
  position: relative;
  background: var(--card-bg);
  color: var(--card-text);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  min-width: var(--card-w);
  min-height: var(--card-h);
  padding: 0.15rem 0.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
}

/* Chips and Tokens (sprint pileObjects, US-102, D107).

   Reached ENTIRELY through the class a Pileable contributes to the card
   shell - the same hook `card-red` and `card-rtg` already use. Smith's
   Gate 1 ruling: `cardElement` does not learn about types, so shape
   lives here and nowhere else.

   A chip is round and card-height square, so it reads as a different
   KIND of object at a glance rather than as a card with odd contents. */
.card.card-chip {
  min-width: var(--card-h);
  width: var(--card-h);
  border-radius: 50%;
  border-width: 3px;
  border-style: dashed;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45), inset 0 0 0 4px rgba(255, 255, 255, 0.35);
}

/* Smith Gate 1 condition A: a supply of identical discs gives a player
   no way to tell whether their action did anything, and makes this
   sprint's only visible output read as broken. Colour is the
   distinguisher - PRESENTATIONAL only, nothing orders or sums it (the
   Pileable's `sortActions` is empty, which is what enforces that). */
.card-chip.chip-red { background: #b5342a; border-color: #7d211a; }
.card-chip.chip-blue { background: #2f5fa8; border-color: #1d3d6e; }
.card-chip.chip-green { background: #2f7d4f; border-color: #1c5133; }
.card-chip.chip-black { background: #2b2b2b; border-color: #101010; }
.card-chip.chip-white { background: #ececec; border-color: #a8a8a8; }

/* A token is a magical glass BEAD - *nit (direct user request):
   "tokens should look like magical glass beads. make them round"
   (following up "they don't need denominations" / "make the gems
   smaller"). Reverses the faceted-gem design: a real bead is round,
   not cut, so `border-radius: 50%` replaces the earlier `clip-path`
   polygon outright. Colour alone is still the whole identity - no
   printed content (`TokenPileable.render` is a no-op) - and a token
   stays tellable apart from both a card (rectangular) and a chip (also
   round, but flat-coloured and dashed-bordered, see `.card-chip` above)
   by its glassy, glowing finish rather than by shape alone. */
.card.card-token {
  min-width: calc(var(--card-h) * 0.6);
  width: calc(var(--card-h) * 0.6);
  min-height: calc(var(--card-h) * 0.6);
  padding: 0;
  border-width: 1px;
  border-style: solid;
  border-radius: 50%;
  /* Outer drop shadow (sits on the table like any other piece) plus an
     INSET pair - a bright rim catching light at the top edge, a dark
     rim receding at the bottom - which is what actually reads as
     "glass", not just "a coloured circle". A flat fill never gets that
     without a real 3D highlight system on top of it. */
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.5),
    inset 0 1px 2px rgba(255, 255, 255, 0.55),
    inset 0 -3px 4px rgba(0, 0, 0, 0.4);
}

/* Three layers, not one flat fill: a tiny sharp SPECULAR glint (the
   single bright point a real curved glass surface catches), a broader
   soft highlight beneath it (light actually passing through the glass,
   not just bouncing off it - what makes it read as translucent rather
   than opaque and shiny), and the base colour as a radial gradient of
   its own (glass is never one flat shade - it's palest at the "thin"
   edge nearest the light and deepens toward the far side). */
.card-token.token-red {
  background:
    radial-gradient(circle at 32% 24%, #fff 0%, transparent 8%),
    radial-gradient(circle at 38% 30%, #ffb3a3 0%, transparent 40%),
    radial-gradient(circle at 55% 60%, #e8574a 0%, #7a1f16 85%);
  border-color: rgba(255, 180, 160, 0.4);
}
.card-token.token-green {
  background:
    radial-gradient(circle at 32% 24%, #fff 0%, transparent 8%),
    radial-gradient(circle at 38% 30%, #b8f0c8 0%, transparent 40%),
    radial-gradient(circle at 55% 60%, #4fb873 0%, #14421f 85%);
  border-color: rgba(180, 240, 200, 0.4);
}

/* US-147: the ad-hoc "jumble them up in a pile" decoration that used to
   live here - a small FIXED `nth-child`-cycled rotate+drift, composed
   on top of whatever the pile's real position already was - is deleted
   outright, no back-compat. It was exactly the render-mechanics special
   case this project's own standing principle argues against (model the
   domain, not the pixels): a real `JUMBLE` stack style now exists
   (`Stackable.js`, `TokenPile.stackStyle`) that positions AND rotates
   each token FOR REAL, per its own deterministic per-index hash, the
   same way every other style already does - nothing token-specific
   left to compose here at all. */

/* A chip tray (direct user correction: "stacked chips should be in
   separate piles by denomination. currently you are drawing them in an
   overlapping row which doesn't make sense with chips").

   One COLUMN per denomination, laid out left to right; within a column
   the chips stack UPWARD the way a real stack of chips does. The
   columns are the pile's structure, so they get the gap; the stacking
   inside one is what `--pile-spread` (Tighten/Loosen) controls. */
.chip-tray {
  display: flex;
  align-items: flex-end;
  gap: 0.55rem;
  flex-wrap: wrap;
}

/* D129: a stack POSITIONS its own pieces - `<chip-tray>` writes each
   one's `--stack-x`/`--stack-y` from `Stack.layout()`, and the only
   arithmetic left here is turning those unitless stride multipliers
   into lengths. Every piece is placed from its OWN index, absolutely,
   so nothing chains: the "3 cards cascades weird" family of bugs (a
   third card landing at the second one's offset) is unrepresentable
   rather than fixed.

   This REPLACED a flex `column-reverse` whose overlap came from
   margins. Margins were the whole problem: the same property was a
   cross-axis margin in a card row and a main-axis margin here, with
   opposite baselines and opposite signs, so the two contexts needed
   two different hand-written formulas that inevitably disagreed.

   The column must reserve the space its stack really uses, or an
   absolutely-positioned stack collapses to zero and every tray below
   rides up - `--stack-extent-*` is the LAST piece's offset (from the
   same `layout()` the pieces themselves use, never recomputed from the
   count), plus the one piece itself. */
.card-stack {
  position: relative; /* the stack's own origin, and anchors `.chip-stack-badge` */
  width: calc(var(--stack-extent-x, 0) * (var(--card-w) + var(--card-gap)) + var(--card-w));
  height: calc(var(--stack-extent-y, 0) * (var(--card-h) + var(--card-gap)) + var(--card-h));
  flex: none;
  /* *nit (direct user request): "add a hint... so it's easy to tell the
     stack boundaries." Every stack gets one, not just piles with more
     than one - a direct follow-up correction after an earlier pass
     here scoped it to multi-stack piles only. */
  outline: 1px solid rgba(255, 255, 255, 0.12);
  outline-offset: 2px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
}

/* Every pileable in every pile is placed here, from its own index
   within its own stack. There is no other overlap rule in this file -
   `stack`/`overlap`/`column`/tray each used to have their own, with
   different baselines and even different signs, which is why they
   disagreed. */
.card-stack > .middle-card {
  position: absolute;
  margin: 0;
  left: calc(var(--stack-x, 0) * (var(--card-w) + var(--card-gap)));
  top: calc(var(--stack-y, 0) * (var(--card-h) + var(--card-gap)));
  /* A fan's lean (and a jumble's tilt, US-147) comes from the layout,
     through the SAME `--raise-base` seam the hover-raise already
     composes on top of - so a raised card in a hand keeps its angle
     instead of snapping upright. Not a fan-specific rule, because a fan
     is a stack layout like any other now; `--stack-rotate` is simply
     absent (and the default applies) for the two layouts that do not
     rotate. */
  --raise-base: rotate(var(--stack-rotate, 0deg));
  /* US-147, found live (twice - once for the token pile's own earlier
     ad-hoc fix, now generalized): setting the custom property alone
     does nothing - only `.fan-row .middle-card` (below) ever actually
     APPLIED it as a real `transform`, so jumble's rotation computed
     correctly but never painted for a plain (non-fan) row, the exact
     same gap the deleted token-specific rule used to patch one kind at
     a time. Applying it HERE, universally, is the actual fix - any
     style that reports a rotation now paints one, not just fan's. */
  transform: var(--raise-base, none);
}

/* Which END a stack grows from. Everything grows down/right, except a
   chip tray: chips pile UP from the tray's bottom edge, the way a
   physical stack sits on a table (`GroupedPile.stacksDownward` opts
   `LandsPile` back out, because a cascade of cards reads top-down).
   Only the edge the SAME offsets are measured from differs - anchoring
   rather than reversing the flow keeps DOM order = visual order either
   way, so the first piece is always the first child. */
.chip-tray:not(.chip-tray-downward) .card-stack > .middle-card {
  top: auto;
  bottom: calc(var(--stack-y, 0) * (var(--card-h) + var(--card-gap)));
}

/* *nit (direct user request, "align cascades to the top"): the opt-in
   flip (`GroupedPile.stacksDownward`, `LandsPile` only) - top-aligned
   columns that grow DOWNWARD, the way a cascade already reads (first
   card at the top, later ones cascading below it), instead of chips'
   own bottom-aligned/grows-up physical-stack metaphor. */
.chip-tray-downward {
  align-items: flex-start;
}

/* D129 (direct user request): the gear emblem every stack carries -
   "since this is universal for stacks use an additional emblem using
   the gear symbols to pull up the stack action menu".

   Universal, unlike `.chip-stack-badge` beside it, which is one pile
   kind's opt-in decoration - so it takes the opposite corner and the
   two never collide.

   Sized to the badge (1.3rem), NOT to the 44px interactive floor. A
   card is about 43px wide, so a 44px control anchored to a stack
   covers the entire stack and swallows every click meant for the
   cards under it - which is exactly what happened: five card-menu
   tests went from passing to 30-second timeouts. The floor is
   enforced on `.pile-action-btn`/`.pile-action-menu-item` (see the
   design-lint selector), and this UI pass is mouse-only by standing
   decision, so a pointer-sized emblem is the right call here; revisit
   if touch parity is ever taken on. */
/* BELOW the stack, and this position was arrived at by elimination -
   an interactive emblem anchored anywhere else covers something that
   has to stay clickable:

   - INSIDE the stack box (any corner): it sits on the cards' own hit
     area, and the hover-raise then fights the cursor - the card
     lifts, the pointer lands on the gear, the card drops back.
     Playwright reported "element never became visible, enabled and
     stable" and every card-menu test timed out at 30 seconds.
   - ABOVE it (`bottom: 100%`): straight over the pile's own action
     header, where it intercepted the clicks meant for Loosen All and
     Make change.

   Below is the pile's own empty space, so it covers neither. The
   unclickable-card bug this control exists to help with must not be
   reintroduced BY it, which is what both earlier placements did. */
.stack-gear {
  position: absolute;
  /* *fix (queued 2026-09-10, direct user report: "move the gear to
     the top right of the stack"): was `top: calc(100% + 0.15rem)`
     (below the stack) - moved to hang off the top corner instead,
     mirroring `.chip-stack-badge`'s own proven "pin outside the card,
     never on top of it" pattern (top: -0.6rem) rather than inventing a
     new one. Still never overlaps the card face itself (the whole
     reason the first two placements - ON the card, then on the pile
     HEADER - were rejected), so hover-raise/click-through concerns
     from those two do not apply here.
     *nit (2026-09-29, direct user request: "move stack gear icon to
     upper left corner of stack"): top-right -> top-left.
     *nit (2026-09-30, direct user request: "move stack gear back to
     upper right corner of the stack"): reverted, left -> right. Still
     the same top-edge hang-off, so the battlefield row's own
     top-padding reservation ([data-kind='battlefield'] .card-row,
     below) needs no change - it accounts for the gear's footprint
     above the row, not which side it hangs from. */
  top: -0.6rem;
  right: -0.3rem;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.3rem;
  height: 1.3rem;
  /* *fix (queued 2026-09-10, "No Gears on RTG stacks?"): the comment
     above already documented "sized to the badge, not the 44px floor",
     but never actually added the override needed to defeat the global
     `button { min-height/min-width: 44px }` rule - so this rendered at
     44px all along (confirmed via getBoundingClientRect), 3.4x its
     intended footprint, which is what pushed it far enough past its
     own stack to get clipped by a battlefield's scrollable card-row
     (see that rule's own comment). Actually applying the stated intent
     fixes both: right-sized AND back inside its reserved space. */
  min-width: 1.3rem;
  min-height: 1.3rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(12, 16, 26, 0.75);
  font-size: 0.7rem;
  line-height: 1;
  color: var(--ink-dim, #cfd6e4);
  opacity: 0.5;
  cursor: pointer;
}

.card-stack:hover .stack-gear,
.stack-gear:hover,
.stack-gear:focus-visible {
  opacity: 1;
}

/* *nit (direct user request): "display the total manacount in a cool
   way, when tapping" - one per colour column (`LandsPile.groupBadge`,
   `<chip-tray>`), pinned above the stack it describes. Reuses the SAME
   mana-pip colour classes (`.pip-w` etc, RtgCardFace.js's `PIP_CLASS`)
   the cost line and cast picker already use, so a column's own colour
   identity reads the same way everywhere in the app, not a second
   palette invented just for this badge. Absent for chips/tokens
   (`GroupedPile`'s default `groupBadge` is undefined) - opt-in, not a
   new universal decoration. */
.chip-stack-badge {
  position: absolute;
  top: -0.6rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  color: #1a1a1a;
  border: 1px solid rgba(0, 0, 0, 0.5);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* The diagonal (direct user request: "a slight diagonal from lower left
   to upper right"). A flex margin cannot express this - margins do not
   accumulate down a column, so every chip after the first would shift by
   the SAME amount instead of progressively. `--stack-index` is each
   chip's position in its own stack, set by `<chip-tray>`, and the
   transform turns it into a per-chip drift using the same token the
   deck's layers use. */
.chip-tray .card-stack .middle-card {
  transform: translateX(calc(var(--stack-index, 0) * var(--stack-step-x)));
}

/* A chip's value, CENTRED (direct user request). It was top-left while
   chips rendered as a row, so covered chips still showed a number; in a
   real stack only the top chip is readable, so the centre is right. */
.chip-denom {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: -0.02em;
  color: #f6f6f3;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.card-chip.chip-white .chip-denom { color: #1b1f24; text-shadow: none; }

/* Display-only cards (table/other players) are informational, not
   unavailable - don't dim them like a disabled action button. */
.card:disabled { opacity: 1; cursor: default; }

/* *nit (direct user request): rank stacked above suit, not side by
   side - a fanned/overlapped card only shows a narrow strip of its left
   edge, and the widest LINE in that strip is what has to fit, not the
   widest combined glyph run. */
.card-corner {
  position: absolute;
  top: 0.2rem;
  left: 0.3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-weight: 700;
  line-height: 1.05;
  text-align: center;
}

.card-corner-rank { font-size: 0.8rem; }
.card-corner-suit { font-size: 0.7rem; }

.card-pip {
  font-size: 1.35rem;
  font-weight: 700;
}

.card-red { color: var(--card-red); }

/* A real card back rather than a grey placeholder: same silhouette as a
   face-up card (border, radius, shadow) with a woven two-tone pattern,
   so a face-down card reads as a *card* at a glance instead of an empty
   slot. */
/* Recard-branded card back (direct user request). The woven two-tone
   CSS gradient this replaced read as "a placeholder for a card back";
   the branded art reads as an actual deck. Shared by EVERY preset, not
   just Recard the Gathering - the mark belongs to the app, not one game.

   `background-size: cover` on a portrait image, so the same asset works
   at both card sizes (43x59 standard, 70x98 RtG) without distortion.
   The gradient fallback stays underneath: if the asset is ever missing,
   a face-down card still reads as a card rather than a blank hole. */
.card-back {
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: 0;
  background-color: #16341f;
  background-image:
    image-set(url("assets/brand/card-back.webp") type("image/webp")),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0 2px, transparent 2px 6px);
  background-size: cover;
  background-position: center;
  border: 1px solid #0c1d12;
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.35), 0 2px 5px rgba(0, 0, 0, 0.35);
  opacity: 1;
}

/* UX follow-up (direct user request): "create WebComponents for the
   different pile types... fix the fan layout issue by implementing
   FanPile." `<fan-pile>` (`src/components/FanPile.js`) replaces the
   old `renderHand`/`#hand-area`/`.hand-card`-specific rendering this
   block used to style - `.middle-card` (the ONE wrapper class every
   pile's cards use now, `renderZoneCards`) already provides the base
   flex/gap/position layout, so this only adds what a FANNED row needs
   on top of that. */
.fan-row .middle-card {
  /* Fan pivot (US-30): rotates from the bottom, like cards actually held
     in a hand, not around the wrapper's own center - every OTHER style
     (including jumble, US-147) keeps the default origin (dead center),
     which is the only thing fan-specific left here now that `transform:
     var(--raise-base, none)` itself is the universal `.card-stack >
     .middle-card` rule's own job, not restated per style. */
  transform-origin: bottom center;
}

/* D129: the generic row overlap rule that used to live here is GONE.
   A row's spacing is no longer a margin at all - a pile is a row of
   `Stack`s and every pileable is positioned from its own index by
   `.card-stack > .middle-card` above. `--pile-spread` still drives how
   much they overlap; it now reaches the layout through
   `Stackable.offsetIn` (unit-tested JS) instead of through a `calc()`
   nobody could test. */

/* D91: the Split picker (`PileElement`'s split picker) - a `fan-row` used
   OUTSIDE a hand's own `.seat-zone` (any pile can be split, not just a
   hand), so it needs its own nowrap/clearance rather than relying on
   `.seat-zone .fan-row.card-row` below. `position: relative` anchors
   the guide/highlight overlays DIRECTLY to this row (not the
   `.pile-section` container, which also spans the header above it) -
   a real UX bug found live: guides/highlight used to anchor to the
   container, so they stretched from behind the title bar down through
   the cards, reading as stray residual lines unrelated to the pointer.
   Anchoring to the row itself, exactly the cards' own box, fixed it. */
.split-picker-row {
  position: relative;
  flex-wrap: nowrap;
  overflow: visible;
  padding-bottom: 0.9rem;
  cursor: pointer;
}

/* A disabled `<button class="card">` (`PileElement`'s split picker's cards are
   all non-interactive while picking) never fires `click` at all in a
   browser, disabled elements are excluded from activation behavior
   entirely - so a click landing ON a card, not the gap between two,
   would silently do nothing instead of reaching `.split-picker-row`'s
   own click listener. `pointer-events: none` removes the card from hit-
   testing altogether, so every pointer/click event passes straight
   through to the row underneath it - the picker's real target either
   way, card or gap. */
.split-picker-card .card { pointer-events: none; }

/* Faint vertical marks at the 25/50/75% points along the row, purely a
   visual guide - the real hit-test is `nearestGap` (ui.js), computed
   from the actual card positions, not these fixed percentages. */
.split-picker-guides {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.split-picker-guide {
  position: absolute;
  /* `bottom: 0`, not a positive offset: `.split-picker-row`'s own
     `padding-bottom` already reserves the fan's droop clearance, and
     an absolutely positioned child's `inset` is relative to the
     PADDING box - stacking a second bottom offset on top of that one
     would double-subtract it, leaving the guide short of the row's
     real bottom edge. */
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
  opacity: 0.5;
}

/* The nearest-gap indicator, following the pointer - a solid accent
   line so the exact commit point (a click anywhere on the row) is
   never ambiguous. */
.split-picker-highlight {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  margin-left: -1.5px;
  background: var(--accent);
  border-radius: 2px;
  pointer-events: none;
}

/* Headroom for the fan's rotation/arc (US-30) so rotated card corners
   and the lowest dipped card don't get clipped by the container edge.
   A fan reads as one continuous arc - wrapping a big hand onto a second
   row (the plain .card-row behavior) broke that into two disconnected-
   looking rows once rotation was applied, so scroll horizontally
   instead of wrapping (real cards in a big hand fan out sideways past
   the edge of your view too, not stack into rows).
   `.fan-row.card-row` (two classes, not one): `<fan-pile>` carries BOTH
   (`FanPile.js`), and `.seat-zone .card-row { flex-wrap: wrap; overflow:
   visible; }` (below, and its 1024/1440px media-query duplicates) is the
   SAME specificity as a bare `.fan-row` would be - this needs to
   outrank it unconditionally, not win-by-declaration-order against
   three separate copies of that rule. */
.seat-zone .fan-row.card-row {
  /* UX follow-up (direct user request): "fan-pile needs to adjust
     height for a fanned cards" - the fan droops DOWN (`renderZoneCards`'s
     `opts.fan` branch sets a positive `translateY`, pivoting from
     `transform-origin: bottom center`), so the row's own bottom edge is
     what needs the real clearance, not the top - a bare `min-height`
     sized to one flat card (`.card-row`'s own base rule) clipped the
     lowest-dipped outer cards otherwise. 1.75rem covers the current
     droop formula (`Math.abs(offset) * 0.35rem`) for a hand up to
     ~10 cards with room to spare - re-check this if that multiplier
     changes again.
     UX follow-up (earlier, still true): "nothing should have
     scrollbars... the zone must expand to fit its piles" - dropped the
     `overflow-x: auto` scroll this used to fall back to (`renderHand`'s
     original reasoning: a fan can't wrap onto a second row without
     breaking the single-arc look). `.seat-zone`'s own `width: max-
     content` already grows to fit an un-wrapped row instead of clipping
     it now that it has real room to (`min(94vw, 48rem)`, not the old
     9rem cap) - scrolling is no longer needed to reach a card that
     doesn't fit, because the row isn't clipped in the first place.
     `flex-wrap: nowrap` stays: wrapping is still the wrong failure mode
     for a fan specifically (a second row reads as two disconnected
     fans, not one continuous arc). */
  padding: 0.4rem 0.4rem 1.75rem;
  flex-wrap: nowrap;
  overflow: visible;
}

.middle-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  max-width: 8.5rem;
  /* Anchor for the hover action row (D25). */
  position: relative;
}

/* Design-lint fix, 2026-08-20: the D25 popup's own z-index (6) only
   ranks it against siblings WITHIN this card's own stacking context -
   it says nothing about a DIFFERENT zone's `.card-row` a few pixels
   away, which paints on top by plain DOM order if that zone happens to
   come later in the markup. 44px buttons made every popup taller, so
   this - previously a narrow miss - became a real, repeated e2e
   click-interception failure at several different points in a longer
   game (not one isolated spot; the same mechanism, a card near a zone
   boundary, recurs whenever the state changes). Promoting the whole
   hovered/focused card onto a new stacking layer is the general fix:
   it now outranks every sibling zone regardless of DOM order, not just
   its own popup relative to its own card. */
/* D51 (table-unification pass): "raise it off the table" - the user's
   own description of what hovering an actionable card/pile should look
   like, shared by every `.pile-hover-host` (cards, the deck, the hand
   zone - see `ui.js`'s `renderActionRow`) via one rule below, layered
   on top of this existing z-index escalation rather than replacing it.
   Built on `--raise-base` (defaults to `none`) rather than a bare
   `transform: translateY(...)`: `.seat-zone` (the hand zone included -
   D51 gave it that class too) already uses `transform` for its OWN
   positioning (`translate(-50%, -50%)`, centering it on its `left`/`top`
   percentage anchor). A second rule setting `transform` outright doesn't
   compose with that - it replaces it outright, which would make the
   hand zone visibly JUMP to the wrong spot on hover. Composing through
   one custom property is what lets a positioned element and a raised
   element be the same element. */
.middle-card:hover,
.middle-card:focus-within,
.pile-hover-host:hover,
.pile-hover-host:focus-within {
  transform: var(--raise-base, none) translateY(-0.35rem) scale(1.02);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.5);
}

.middle-card:hover,
.middle-card:focus-within {
  /* *fix (queued 2026-09-10, direct user report: "hover over stack
     Effect has some weird shadows that look weirdly overlapped"):
     `position: relative` here used to unconditionally win over
     `.card-stack > .middle-card`'s `position: absolute` (D129) on
     hover, for any card that's a member of a multi-card stack (which
     is every card on the table now, post-D129) - both selectors have
     equal specificity, so it came down to source order, and this rule
     comes later. That took the hovered card OUT of the stack's
     absolute-positioning layout and back into `.card-row`'s normal
     flex flow, where its width resolved against `.middle-card`'s own
     `max-width: 8.5rem` instead of its actual ~44px card content - a
     136px-wide invisible box whose `box-shadow` (below) then painted
     as a large, disconnected-looking dark smudge, confirmed via
     getBoundingClientRect (fell right in normal flow, not `absolute`).
     `position` is dropped from this rule entirely: a stack member
     keeps its `position: absolute` through hover (which still
     satisfies the ORIGINAL reason this existed - see the two comments
     above - `z-index` needs any non-`static` position, and `absolute`
     already qualifies), and every other `.middle-card` already gets
     `position: relative` from its own base rule regardless. */
  z-index: 7;
}

/* Discoverability (user's own finding): a hoverable pile needs a visual
   cue that it's a thing you can act on, not just empty table space -
   without this, "hover the deck to see Draw" is invisible until you
   stumble onto it. A subtle border, not a button-like fill: piles are
   the surface, not controls sitting on it. (Consolidated from two
   `no-duplicate-selectors`-violating blocks - `lint:style`, found while
   fixing e2e for D52 - same selectors, no behavior change.) */
.pile-hover-host {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.3rem;
  transition: border-color 0.15s ease;
}

.pile-hover-host:hover,
.pile-hover-host:focus-within {
  z-index: 8;
  border-color: var(--accent);
}

/* UX follow-up (direct user request): "remove the transparent border
   effect from the cards." The discoverability border above was built
   for piles/zones/the deck - things with no border of their own that
   otherwise don't look interactive at rest. A `.middle-card` wrapper
   (every pile's cards, fanned or not, since `renderHand`'s dedicated
   `.hand-card` class was retired) carries `.pile-hover-host` too (for
   the shared hover-raise behavior below, via `attachActionRow`), but
   the actual `.card` inside it already has its own opaque border - the
   wrapper's own border sat just outside that, on an unfilled
   background, reading as a faint transparent-looking ring around every
   card at rest, not just an interactive-piles cue. Opted card wrappers
   out of the border/padding only - the hover raise/z-index escalation
   is unaffected, and the wrapper never relied on this padding for
   spacing (it already sets its own `gap`/`position: relative`). */
.middle-card.pile-hover-host {
  border: none;
  padding: 0;
}

/* UX follow-up (direct user request): "just have table-surface -> zone"
   - every pile/zone panel (shared, personal, deck) is now a direct
   child of one flat `#zones` container, no `#table-center` wrapper
   trapping shared zones in their own local stacking context (it used
   to get one via `transform`, D24's desktop centring). The whole
   `:has()` z-index-escalation dance that lived here existed ONLY to
   promote that wrapper past `#seat-zones`/`.roster li.seat` whenever a
   descendant was hovered - with no wrapper (and no `transform`) left to
   trap anything, `.middle-card`/`.pile-hover-host`'s own z-index
   (7/8, below) ranks directly against those siblings in one shared
   stacking context, which is all this was ever really deciding. */

/* Drag cursor affordance (US-28, Smith Sprint 4 close-out finding #1):
   the only visual hint a mouse user has that a card is draggable at all
   - every `.middle-card` (hand cards included, now that they're plain
   `.middle-card`s too) only where MOVE's own authorization allows
   it (the `[draggable="true"]` attribute selector already tracks that
   exactly, no separate condition needed). */
.middle-card[draggable='true'] {
  cursor: grab;
}

.middle-card[draggable='true']:active {
  cursor: grabbing;
}

/* Smith close-out finding, D57 (bloop: piles are Movable) - same
   affordance rule as the card cursor above, applied here for real: a
   reparentable pile's own title bar became a native drag source with
   no visual hint at all that it's draggable (`cursor: auto`, verified
   live before this fix). `[draggable="true"]` already tracks the exact
   authorization (`isReparentable`, `ui.js`) - no separate condition
   needed, same pattern this project already established for cards. */
.pile-title[draggable='true'] {
  cursor: grab;
}

.pile-title[draggable='true']:active {
  cursor: grabbing;
}

/* D67, direct user request ("drag from the card like all piles do... use
   the same mechanism as all other piles") - same affordance rule as the
   two above, for the deck's own single top-card visual, a genuine
   per-card drag source now via the generic mechanism (not a pile-level
   action). Targets `.card`, same selector shape `.middle-card` uses
   above - `.deck-stack` itself is no longer draggable, only its one
   card child is. */
/* *nit: the deck's own depth. Inert layers stacked under the one real
   card - `pointer-events: none` so they can never be grabbed, which is
   what the D66/D67 correction ("I should only see 1 card") was actually
   protecting: one DRAGGABLE card, not one visible edge.

   *nit (direct user request): the same angle a chip stack uses, so the
   whole table reads as one viewpoint - down and to the LEFT as the stack
   goes deeper, which is the same as saying it climbs to the upper right.
   `--stack-step`/`--stack-step-x` are shared by both, which is what
   keeps them honest: change the angle in one place and both follow. */
.deck-stack-layer {
  position: absolute;
  top: calc(var(--layer) * var(--stack-step));
  left: calc(var(--deck-drift, 0px) - var(--layer) * var(--stack-step-x));
  width: var(--card-w);
  height: var(--card-h);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: #16341f;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.deck-stack-card[draggable='true'] {
  cursor: grab;
}

.deck-stack-card[draggable='true']:active {
  cursor: grabbing;
}

/* Phase 55 (T55.1): same affordance rule as the drag cursor above - a
   revealable card's own class already tracks its authorization exactly
   (`actionsForCard`), so this needs no separate condition either.
   Applies to BOTH shapes a still-hidden card can render as: a redacted
   `.card-back` (everyone else's view of a shared face-down card) or the
   owner's own real `.card` face (`redactMiddleCard`, D7, never redacts
   a card from its own owner - see the T55.1 comment in ui.js). */
.revealable {
  cursor: pointer;
}

/* *nit (2026-08-26): same affordance rule as `.revealable` above, for
   the new tap-to-rotate trigger that replaced the card hover-popup's
   Rotate button ("cards are Movable not Actionable"). */
.rotatable {
  cursor: pointer;
}

/* D129: `data-layout` is gone from the DOM and from state. It was a
   per-card field meaning "overlap onto whoever precedes me", and the
   four inconsistent formulas keyed off it (a fixed `--card-peek` for
   `stack`, a fixed `1.7rem` for `overlap`, a `--pile-spread`-driven
   `--column-depth`-chained one for `column`, and a bespoke one for the
   chip tray) are what this whole rewrite replaced. A drop's direction
   hint now becomes stack membership plus that stack's direction, and
   `.card-stack > .middle-card` above is the only rule that positions
   anything. */

/* Overlapping necessarily covers the buried cards' own Pick up / Move
   to… controls. Raising the hovered/focused card (and its controls)
   above its neighbours keeps every card individually operable, so the
   44px touch-target floor still holds in practice and not just on paper.
   `:focus-within` carries the same escape hatch to keyboard users. */
/* D129: "is this card overlapped?" is now "does its stack hold more
   than one card?" - which is the honest question, and one that stays
   true for the FIRST card of a stack too (the old `data-layout` was
   absent on it by construction, so it never got these). */
.card-stack:has(> .middle-card ~ .middle-card) > .middle-card:hover,
.card-stack:has(> .middle-card ~ .middle-card) > .middle-card:focus-within {
  z-index: 4;
}

/* Without this, a pile's stacked cards each render their own owner tag
   at full width underneath, which collides into an unreadable smear
   (measured, not guessed - see the Phase 31 screenshot). Still one
   hover/focus away, and the cards' own overlap already communicates
   that they're a group. */
.card-stack:has(> .middle-card ~ .middle-card) > .middle-card > :not(.card) {
  display: none;
}

.card-stack:has(> .middle-card ~ .middle-card) > .middle-card:hover > :not(.card),
.card-stack:has(> .middle-card ~ .middle-card) > .middle-card:focus-within > :not(.card) {
  display: revert;
}

/* D48/D40: Card.orientation as a visible rotation. A first cut, not a
   full landscape-aware layout - the wrapper's own box doesn't resize to
   the rotated footprint, so a landscape card can visually lean into a
   neighbour at tight spacing. Disclosed rather than chased further:
   real layout math for this belongs to whichever pile type/mechanic
   actually needs landscape cards for real (D38's Run/Set is the
   likely first), not to this sprint's "does the state exist and
   render at all" scope. */
.middle-card[data-orientation='landscape'] > .card {
  transform: rotate(90deg);
}

/* Live drop-mode affordance (Smith Gate 1, Nielsen #1/#6): native
   drag-and-drop shows nothing until release, so which mode a drop is
   about to use has to be visible mid-drag or it can't be discovered.
   *fix (direct user report): "I expect to see the overlap targets
   ACTUALLY overlap the card so one can SEE where the card will go
   before they select that target" - four separate decorations (a
   glow, a bar, two kinds of line) named which zone you were in but
   never showed the actual outcome, so telling "will overlap" from
   "will sit beside" apart under a moving cursor was still guesswork.
   One reusable ghost card (ui.js's `showDropPreview`) replaces all
   four: inserted as a REAL sibling with the SAME `data-layout` a real
   drop would set, it renders through the exact same CSS rules a real
   card would - "will this overlap or sit beside it" is answered by
   literally seeing a card-shaped outline do exactly that. */
.middle-card.drop-ghost {
  pointer-events: none;
}

.card.card-ghost {
  background: rgba(79, 157, 255, 0.22);
  border: 2px dashed var(--accent);
  box-shadow: none;
}

/* A named zone (US-19) - its own bordered sub-panel so it reads as a
   distinct area on the table, not just a blob of cards (Smith Gate 1:
   zone names must always be visible as labels). */
.zone {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.5rem;
  background: rgba(0, 0, 0, 0.15);
  /* UX follow-up: a containing block for `.panel-resize-handle`
     (`right: 0; bottom: 0`) - every zone type needs this now that
     resize is a base zone feature (`renderZonePanel`), not just
     personal zones (`.seat-zone` already sets `position: absolute`,
     which still wins over this for that case - later in the cascade,
     same specificity). */
  position: relative;
  /* UX follow-up: explicit now that a zone-shaped panel isn't always a
     plain `<div>` - a custom element (`<score-zone>`,
     `src/components/ScoreZone.js`) defaults to `display: inline`
     otherwise, which silently breaks its box (padding/border still
     apply, but it sizes to a text line instead of its content). Every
     existing `.zone` is already a `<div>` (block by default), so this
     changes nothing for them. */
  display: block;
}

.zone:last-child { margin-bottom: 0; }

/* Drop-target affordance (US-28, Smith Gate 1 - Nielsen #1): a zone
   needs to visibly say "droppable here" while a drag is over it, since
   native drag-and-drop otherwise gives no feedback at all until release.
   UX follow-up (direct user request): "zone is one thing, pile is
   another" - a card is always dropped onto a specific PILE now
   (`<pile-panel>`), never generically "the zone", so a Pile's own
   drop-over needs the same feedback a Zone's does. D90: one shared,
   level-neutral class (`.drag-over`) rather than a Pile borrowing a
   class literally named after the Zone entity - applies identically to
   `.zone` and `.pile-section`, same visual either way. */
.zone.drag-over,
.pile-section.drag-over {
  border-color: var(--accent);
  background: rgba(79, 157, 255, 0.12);
}

.zone-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.25rem;
}

/* UX follow-up (real bug, found live): a Zone's title bar - `.panel-
   title`, the ONE shared heading class every Movable Zone type uses
   (`renderZonePanel`, `<score-zone>`) - must be draggable across its
   FULL visual width, the same for every zone regardless of its own
   layout mode. Without this, `.zone`'s default `display: block` happens
   to stretch a block child to full width for free, but `.seat-zone`'s
   `display: flex; align-items: flex-start` (needed so the zone itself
   sizes to its widest child, the hand row) shrinks EVERY flex child,
   heading included, to its own content width instead - only the
   player's name text was actually draggable, not the visible bar beside
   it. `width: 100%` covers the block case, `align-self: stretch`
   overrides `align-items: flex-start` for the flex case - one rule on
   the one shared class, not a per-zone-type fix. */
.panel-title {
  width: 100%;
  align-self: stretch;
}

/* *nit (2026-08-26): rename affordance - a dashed underline hints
   "double-click me" the way a text input's own affordance normally
   would, without needing a visible pencil icon competing with the
   pile/zone action buttons already crowding this same header. */
.zone-name-text.renamable {
  cursor: text;
  border-bottom: 1px dashed transparent;
}
.zone-name-text.renamable:hover {
  border-bottom-color: var(--muted);
}
.zone-name-edit {
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0 0.2rem;
  min-width: 4rem;
  max-width: 10rem;
}

/* Top-down table surface (US-26, D18): one visual "table" instead of
   separate stacked Table/Players panels. Rounded rather than a strict
   oval/circle so it can still grow to fit a variable amount of zone
   content (Phase 23 moves personal zones out to seats, which will make
   this read even more table-like) - seats are positioned as a % of
   this container regardless of its actual height, so "around the edge"
   holds up either way. */
.table-surface {
  position: relative;
  /* Scales with player count (--seat-count, set by main.js) so seats
     have more physical room to spread around as more players join -
     positions are already percentage-based, so a taller surface directly
     increases the pixel distance between seats with no math changes.
     Confirmed necessary, not just theoretical: an 8-player table at a
     fixed height badly overlapped seat cards on a 390px screen (Smith's
     Gate 1 density flag for this sprint, caught for real at T26.3). */
  /* Sized by the space the viewport actually has, not by a rem floor.
     This used to be `clamp(26rem, ...)` - and 40rem/42rem at the desktop
     breakpoints - which is a 640-672px MINIMUM regardless of window
     height, so a 900px-tall window overflowed by ~300px and you could
     never see the table and your own hand at once. The seat ring is
     positioned in percentages, so it follows the height it is given. */
  flex: 1 1 auto;
  min-height: var(--table-min-h);
  margin: 0 3rem 0.75rem;
  padding: 1rem 0.5rem;
  border-radius: 999px / 12%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  /* *nit "use that nice dark green for the table top color" - the felt
     tint (`--felt`, already used for the surrounding `.panel-felt`
     table SECTION) is now the table SURFACE's own background too, not
     just a faint inherited tint through the highlight gradient sitting
     on top of it. */
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.06), transparent 70%), var(--felt);
}

/* UX follow-up (direct user request - *nit "consistent semantics for
   all zone types"): `#game-deck-area`'s own rule (`position: relative;
   margin: 0 auto;`) used to live here, but the deck panel carries the
   `.zone` class too (`main.js`) and gets both from there now like every
   other zone type - `#zones`'s `justify-content: center` (below) is
   what actually centers it, the same as any other in-flow panel. An
   ID-scoped rule duplicating what the shared class already provides is
   exactly the inconsistent-semantics case this removed. */

/* UX follow-up (direct user request): "just have table-surface -> zone"
   / "remove all the *-area elements" - one flat container now, direct
   child of `#table-surface`, holding EVERY pile/zone panel (shared,
   personal, the deck) as its own direct child - no `#table-center`/
   `#table-area`/`#seat-zones` split. It does two jobs at once, which
   used to be two separate elements: a normal flex-wrap flow for
   in-flow (unmoved) panels, same as `#table-area` did, AND the
   positioning context for absolutely-positioned ones (any panel once
   dragged/resized, `.panel-moved` - and every personal zone by
   default, same ring math `#seat-zones` used to host).
   UX follow-up (real bug, found live): `width/height: 100%` here does
   NOT do that - `#table-surface` has no explicit `height`, only a
   `min-height` floor, and a percentage height only resolves against a
   DEFINITE parent height (the exact same quirk `attachPanelResize`'s
   own comment already documents for zone resize). The visible result:
   `#zones`'s real box collapsed to its in-flow CONTENT height (~100px)
   instead of the surface's real height (~700px), so every personal
   zone's ring percentage (`seatPosition`'s topPct 24%/76%) resolved
   against that tiny box and landed right on top of the shared zones -
   confirmed live with 2 players, invisible with 1 (nothing else to
   overlap). `position: absolute; inset: 0;` is what `#seat-zones` used
   for this exact purpose before the flattening and it worked - matching
   that here instead of a percentage size sidesteps the question
   entirely, same fix shape as the pixel-based resize one. */
/* D132 revised (direct user request, 2026-09-17): `#zones` used to be
   `inset: 0` (fills whatever `.table-surface` happens to be, which
   varies by viewport). That made the seat ring (`seating.js`,
   percentage-of-this-box) and every preset's fixed-pixel shared-panel
   coordinates (`presets.js`) resolve DIFFERENTLY relative to each
   other at different viewport sizes - the two coordinate systems only
   agreed at the exact size the layout was calibrated against, and
   drifted into the `lint:design` "Table Zone overlaps Bob/You"
   findings everywhere else. `#zones` is now a FIXED local canvas
   (`--table-canvas-w`/`-h`, set once from `TABLE_CANVAS_SIZE` in
   `tableZoom.js` - that file is the source of truth, these are
   fallbacks only), centered in `.table-surface`; `main.js` computes a
   default zoom (`computeFitZoom`) that scales this fixed canvas down
   to fit whatever surface is actually available, so the SAME relative
   geometry (verified overlap-free at canvas size) survives at every
   real viewport instead of being recomputed differently each time. */
#zones {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--table-canvas-w, 1280px);
  height: var(--table-canvas-h, 1050px);
  margin: calc(var(--table-canvas-h, 1050px) / -2) 0 0 calc(var(--table-canvas-w, 1280px) / -2);
  /* NO max-height / overflow-y here, again - REVERSED a second time,
     2026-08-20, same day as the first reversal, and the reason is the
     44px button fix (design-lint) that came right after the first one.
     `overflow-y: auto` clips based on the box's RENDERED height, which
     tracks in-flow content (the cards) - NOT max-height when that
     content is already smaller than the cap. The D25 hover-action
     popup is `position: absolute; top: 100%`, extending below the card
     by its own height, and got clipped by this same rule - unreachable,
     a real e2e click-interception failure, not a style nit. Reserving
     the popup's height as padding was tried first and made it WORSE for
     any card whose zone WAS already at the cap (padding adds to
     scrollHeight too, so it just moved which card got clipped).
     The overlap risk this cap existed for (D22/US-32 stacking has no
     card-count ceiling) is real but NOT exercised by anything shipped -
     the actual e2e's own SPLIT_DECK scenario (US-36, split-count 3, run
     against `--table-min-h` now re-tuned to 28-34rem for the button fix)
     passes clean without it. A pot deliberately maxed far beyond that
     (splitting the entire remaining deck into one giant pile) is a
     known, narrower, disclosed residual risk - see ARCHITECTURE.md. */
  /* Zones flow side by side: a Split makes N piles at once, and stacking
     them vertically buried everything past the first behind this
     element's own scroll - you could create four piles and see one. */
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  /* UX follow-up (real bug, found live): `#zones` fills the FULL
     surface now (personal zones' percentage ring math needs that), not
     a small `max-width`-clamped box the old `#table-center` VERTICALLY
     centered via `top: 50%; transform: translate(-50%, -50%)`. Left at
     `flex-start` (this rule's own pre-flattening value, when the
     in-flow content WAS that small centered box), the shared-zone
     cluster pinned to the TOP of the now-full-height container instead
     - directly into personal zones ringed near the top of the surface
     (`seatPosition`'s own topPct ~24% for an opposite-seat player).
     `center` is what actually reproduces the old visual center point;
     the design-lint zone-overlap check that should have caught this
     immediately was itself silently broken (querying two ids the same
     flattening pass had already removed) until fixed alongside this. */
  align-content: center;
  /* Centers the in-flow (unmoved shared/deck) panels as a cluster,
     since the container itself now fills the full surface width rather
     than a `max-width`-clamped "pot" the way `#table-area` was -
     `.panel-moved` panels are absolutely positioned and ignore this
     entirely, same as they ignore every other flex property here. */
  justify-content: center;
  /* UX follow-up (real bug, found live): missing here, so flex's
     default `align-items: stretch` applied - two zones sharing the same
     wrapped flex LINE (Deck and Table are exactly this at common widths)
     stretched to match whichever was TALLEST, so playing enough cards
     to wrap Table's own card-row visibly grew/moved the Deck panel too,
     though nothing was ever added to it ("zones move weirdly when
     moving a card"). `flex-start` is the same normalized convention
     `.own-zone` already uses for its own flex column (it never had this
     bug) - every zone's height comes from its own content only now,
     never a sibling's. */
  align-items: flex-start;
  /* US-117 phase 111 (D132, direct user correction - no auto-fit): the
     table zoom is fully manual now, set by the dial/preset controls in
     `#table-zoom-controls` (`main.js`'s `wireTableZoomControls`), not
     computed from content. `top center` so zooming reads as the table
     pulling back from/toward the player, not sliding toward a corner.
     NOTE for phase 113: this transform makes `#zones` a containing
     block for any `position: fixed` descendant (CSS Transforms spec) -
     the D131 focus-zoom overlay must be appended to `<body>`, same as
     `.rtg-inspect` already is, never nested inside `#zones`, or it
     would be clipped to the table's own box instead of escaping to the
     full viewport. */
  /* Drag-to-pan (direct user request, 2026-09-16): `translate` OUTSIDE
     `scale` (applied to the already-scaled result, in real on-screen
     pixels) so a drag of N screen pixels moves the table by N screen
     pixels regardless of current zoom - `scale` alone inside would make
     a fixed pan value read as a bigger or smaller move depending on
     zoom, which is not how dragging something should feel. */
  transform: translate(var(--table-pan-x, 0), var(--table-pan-y, 0)) scale(var(--table-zoom, 1));
  /* *fix (D134, 2026-09-18): was `top center`, matching the OLD
     `#zones { inset: 0 }` (filled the whole surface, so scaling from
     its top edge read as "the table pulling back from the player").
     `#zones` is now a FIXED-size box independently centered in
     `.table-surface` via `top/left: 50%` + a negative margin (see
     `#zones`'s own rule) - `scale`'s pivot has to be that SAME center,
     or the two centering mechanisms fight: `scale` shifts the already-
     centered box around `top center` instead of in place, and the
     mismatch grows with the canvas' own height (all but invisible at
     the shared 1050-tall default, badly visible at War's 1300-tall
     canvas - `#zones` rendered 177px above the visible surface
     entirely, confirmed live). `center` makes `scale` a pure zoom
     in/out from wherever the box already sits. */
  transform-origin: center;
}

/* US-117 phase 111 (D132): the manual table-zoom control. Every player
   has their own (not host-gated, unlike `.layout-controls` above it) -
   local view state, D130.
   *fix (direct user request, 2026-09-17): "put it on the right side of
   the table" - pinned to the table-section's own right edge (that
   section is `position: relative` specifically for this), vertically
   centered, rather than a control bar living above the table. z-index
   above `#zones`' own content (piles/zones never carry a z-index of
   their own) so it's never occluded by a panel dragged near the edge. */
.table-zoom-controls {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.table-zoom-label {
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* *fix (direct user request, 2026-09-16): "like the zoom wheel on a
   mouse" as its own control, drag-the-tread-up-to-zoom-in.
   *fix (direct user request, 2026-09-17): "tall and thin" - was a
   short/wide bar (2.5rem x 44px); now a real vertical wheel. Width
   still clears the 44px touch-target floor. */
.table-zoom-wheel {
  width: 2.75rem;
  height: 12rem;
  min-width: 44px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--accent);
  cursor: ns-resize;
  overflow: hidden;
  touch-action: none;
}

/* The "tread": horizontal ridges reading as a wheel's grippy surface,
   not a flat track - a `repeating-linear-gradient` needs no image
   asset and scales with the control's own size. */
.table-zoom-wheel-tread {
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    to bottom,
    var(--accent) 0,
    var(--accent) 2px,
    transparent 2px,
    transparent 8px
  );
  opacity: 0.6;
}

/* US-117 phase 113 (D131): grow a Pile in place on hover/click. Applied
   to the pile's OWN element after it's reparented to `<body>`
   (`main.js`'s `applyFocusZoom`) - appending to `<body>` rather than
   leaving it inside `#zones` is required, not a style choice: `#zones`
   carries a `transform` (the table-zoom rule above), which makes it a
   containing block for any `position: fixed` descendant per the CSS
   Transforms spec, so a fixed-position pile left inside `#zones` would
   be constrained to the TABLE's box instead of escaping to the full
   viewport - the same reasoning `.rtg-inspect` already documents for
   the same reason (escaping a pile's own overflow/stacking context).
   `--focus-left`/`--focus-top` are real fixed-position screen
   coordinates (already clamped on-screen, `focusZoom.js`); the GROWTH
   itself is a `scale()` from `top left` so the pile visibly grows from
   the point it was anchored at, not from its own center. */
.pile-section.focus-zoomed {
  position: fixed;
  left: var(--focus-left);
  top: var(--focus-top);
  transform: scale(var(--focus-scale, 1));
  transform-origin: top left;
  transition: left 0.15s ease, top 0.15s ease, transform 0.15s ease;
  /* Above every table layer (all <= 15), BELOW every body-level overlay
     (`.overlay`/`.card-context-menu` 20, `.touch-drag-ghost` 30,
     `.rtg-inspect` 9000). It used to be 9500, which put a zoomed pile on
     top of its OWN right-click and stack-gear menus - they opened under
     the pile and could not be clicked. */
  z-index: 19;
}

/* An invisible spacer left behind in the pile's normal flex position
   while it's reparented to `<body>` above - without this, removing the
   pile from `#zones`'s flow would let siblings reflow to fill the gap,
   which would violate "the rest of the table stays untouched" (D131). */
.focus-zoom-placeholder {
  visibility: hidden;
}


/* US-124: a spectator is on the roster but has no seat in the ring -
   drawn as a plain row, quieter than a seat, and never absolutely
   positioned (renderRoster passes `seated: false` for them). */
.roster-player.roster-spectator {
  opacity: 0.8;
  font-style: italic;
}

/* Seats (roster rows) positioned around the table surface's edge instead
   of stacked in a plain list - same content as the pre-redesign roster
   list, just relocated (Smith Gate 1: WHERE it's drawn changes, not
   WHAT it shows). */
.table-surface .roster {
  position: absolute;
  inset: 0;
  display: block;
  /* The <ul> itself is just a positioning frame spanning the whole
     surface - without this it silently intercepts clicks meant for
     zone controls underneath it (a real bug caught by the e2e suite,
     not just eyeballed). Individual seats opt back in below. */
  pointer-events: none;
}

.table-surface .roster li.seat {
  position: absolute;
  transform: translate(-50%, -50%);
  width: max-content;
  max-width: 20rem;
  padding: 0.3rem 0.4rem;
  font-size: 0.8rem;
  margin: 0;
  z-index: 2;
  pointer-events: auto;
  /* [-] info [+] on one line - see renderRoster. Keeps both 44px score
     targets inside the card instead of hanging off its edge, and makes
     the seat wide-and-short, which is the axis the table has spare. */
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.seat-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  min-width: 0;
}

/* The viewer's own seat needs an explicit marker beyond position alone
   (Smith Gate 1) - the "You" text tag is the actual requirement; this
   border is a secondary visual reinforcement, not the only signal. */
.table-surface .roster li.seat-you {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.seat-zone .card-row { flex-wrap: wrap; overflow: visible; }

/* UX follow-up (direct user request): "let's not conflate Piles and
   Zones. Piles are a collection of 1+ cards within a Zone. The zone
   must expand to fit its piles, and nothing should have scrollbars."
   `.seat-zone` IS the zone a hand pile lives in - it needs the exact
   room the old `.own-zone` (retired along with `buildOwnPanel`) already
   had to earn the hard way, since every seat now holds real cards the
   D17 personal zone never did (that was empty of hand cards by design).
   Folded `.own-zone`'s width/anchor/z-index fixes in here rather than
   leaving them stranded on a class nothing applies any more. */
.seat-zone {
  position: absolute;
  /* UX follow-up (real regression, confirmed live, same fix `.own-zone`
     already proved): centering a box on its anchor point in BOTH axes
     means a TALL box grows upward too, straight into whatever's above
     it (the bottom seat sits near the ring's lower edge, seatPosition's
     topPct 50+radius). Anchoring the TOP-CENTER instead makes it grow
     downward only, into the table surface's own empty margin below the
     ring, never up into a neighbor. */
  --raise-base: translate(-50%, 0%);
  transform: var(--raise-base);
  width: max-content;
  /* "The zone must expand to fit its piles": no tight cap here any
     more - `min(94vw, 48rem)` only exists so a big hand can never force
     page-level horizontal scroll (design-lint's own "no forced scroll"
     check), not to shrink-and-clip a pile that fits well within it. */
  max-width: min(94vw, 48rem);
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  /* D52 follow-up, found live (`.own-zone`'s own history): a wide/tall
     seat genuinely overlaps other panels once enough cards exist -
     one level above the highest hover escalation
     (`.pile-hover-host:hover`'s own z-index: 8) so this panel always
     wins regardless of what else is hovered. */
  z-index: 9;
  pointer-events: auto;
}

/* UX follow-up (direct user request): "get rid of own-zone-content and
   all other non-zone elements from #zones" - Score is a real sibling
   `<score-zone>` Web Component now (`src/components/ScoreZone.js`,
   `main.js`), not a nested pseudo-zone inside the own-panel, so it
   picks up `.zone`'s own border/padding/background for free instead of
   duplicating them here.
   *nit (2026-08-27), direct user request ("save space"): ONE panel now
   lists every seated player - `.score-value`'s single centered number
   is gone with the one-panel-per-player design; `.score-rows`/
   `.score-zone-row` (below) is what replaced it. */
.score-rows {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.score-zone-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.score-row-name {
  flex: 1 1 auto;
  font-size: 0.85rem;
  color: var(--text);
  /* A long name shouldn't push the +/-10 buttons off the panel's own
     content-sized width - same "readable, not clipped" floor
     `.zone-body > .pile-section`'s `min-width` gives a pile. */
  min-width: 4rem;
}

/* Sized like `.pile-action-btn` (same small/square/non-44px-floor
   control), but auto-width instead of a fixed 1.3rem square - "-10"/
   "+10" don't fit a one-glyph icon box. Exempted from
   `tests/designLint.check.mjs`'s 44px touch-target check for the same
   reason `.pile-action-btn` already is (direct user request: small
   controls sized to their content, not the touch-target floor). */
.score-adjust-btn {
  min-width: 0;
  min-height: 0;
  padding: 0.1rem 0.35rem;
  font-size: 0.7rem;
  line-height: 1;
  background: var(--surface-2);
  border-color: var(--accent);
  border-radius: 0.15rem;
}

.score-input {
  width: 3.2rem;
  text-align: center;
  font-size: 0.85rem;
  padding: 0.1rem 0.2rem;
}

/* Visual deck stack (US-20) instead of a bare "N cards left" line.
   UX follow-up: now a COLUMN (the action header row, then this original
   row) instead of the row itself directly - see `ui.js`'s `renderDeck`
   and `.deck-area-row` below. Widened so a 5-button header (Draw/Deal/
   Reshuffle & deal/Shuffle/Split) has room to wrap onto 2-3 lines
   instead of 1-per-line. */
/* UX follow-up: also carries the `.zone` class now (border/padding/
   background/margin-bottom/position:relative all come from there, same
   as every other table panel) - this rule only adds what's specific to
   the deck: its own internal column layout (a stack visualization, not
   a `.card-row`) and content-sized width instead of the flex-grow every
   other zone type gets from `#zones > .zone:not(.seat-zone)`. */
.deck-area {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  /* Sizes to its content now (the action header, or the stack+count-
     inputs row, whichever is wider) instead of a fixed column width -
     a fixed width was exactly what forced the header's icon buttons to
     wrap onto extra rows before they needed to. */
  width: max-content;
  max-width: min(90vw, 20rem);
}

/* The stack + its persistent count inputs (Deal's cards-per-player,
   Split's pile count), side by side - this is `.deck-area`'s entire
   layout before the action header existed, just scoped one level in
   now so widening the outer column for the header doesn't stretch
   these apart from each other too. */
.deck-area-row {
  display: flex;
  align-items: center;
  /* *fix (direct user report): "rtg deck pile's cards too small and
     don't match the top card" - was a flat `3.7rem`, tuned for the
     standard `--card-h` (3.68rem) alone. `.deck-stack` (its child) is
     genuinely taller than that while an RtG game reconfigures
     `--card-h` for the whole table (`applyCardSize`) - with a fixed
     height here, `align-items: center` centered the now-taller stack
     around this row's own too-short box, overflowing it (and the
     action header above) equally on both sides. Reading the same token
     keeps this row exactly as tall as the stack it holds, whatever size
     that currently is. */
  height: var(--card-h);
}

/* UX follow-up (real bug, found live): `.deck-stack-card`'s `position:
   absolute` was always relative to `.deck-area` (the nearest positioned
   ancestor) - harmless while `.deck-area` was one flat row (its origin
   WAS the stack's intended position), but once the action header became
   a flow child above the stack (same follow-up), that origin moved and
   the stack rendered on top of the header instead of below it. Scoping
   the positioning context to `.deck-stack` itself - where it visually
   lives - fixes it at the actual cause. */
/* *nit (2026-08-26), real bug found live: `.deck-stack-card` (the
   actual card-back visuals, `var(--card-h)` tall) is `position:
   absolute`, so it never contributes to `.deck-stack`'s own auto
   height - the box only grew to fit the in-flow `.deck-count-badge`
   span (~1.3rem). `.deck-area-row`'s `align-items: center` then
   centered that too-short box, leaving the actual card images
   starting well below the row's own top and hanging out past the
   pile-panel's bottom border by several px - confirmed via measured
   `getBoundingClientRect()`, not just eyeballed. An explicit height
   matching the real card art is what was missing. */
.deck-stack {
  position: relative;
  /* *nit (direct user request): "a full deck needs a little more room
     then an empty one". The depth layers are absolutely positioned, so
     they contribute nothing to height and a full deck's lowest layers
     were clipped by the panel. `--deck-depth` is set per-render from the
     actual layer count (`renderDeckStack`), so the box grows with the
     deck and shrinks back as it empties. */
  /* Always sized for the DEEPEST stack this can draw, not the current
     one (direct user request: "a 42 card deck overlaps both the buttons
     and the bottom of the panel"). Using the live depth let a big deck
     grow into the action buttons above and past the panel below; a
     constant box cannot, and it also stops the row twitching as cards
     come off. */
  height: calc(var(--card-h) + var(--stack-max-depth) * var(--stack-step));
  min-height: calc(var(--card-h) + var(--stack-max-depth) * var(--stack-step));
  /* Clearance from the action header above, so the top card never sits
     against the buttons however deep the stack draws. */
  margin-top: 0.35rem;
  /* Room for the leftward drift is made by OFFSETTING every layer right
     by the full drift (below), not by padding this box.
     `.deck-stack-card` is `position: absolute` with no `left`, so it
     sits at its STATIC position - after any padding - while the layers
     use an explicit `left`, which is measured from the padding box and
     ignores padding-left entirely. Padding therefore moved the real card
     6px away from the layer directly beneath it and broke the stack at
     exactly the point a player looks: "the top few deck cards are off".
     One coordinate system for both, and the deepest layer lands at 0. */
  /* US-107/Phase 108 (tech-debt sprint, direct fix of a real bug Trin
     found running the full `npm run lint` pipeline): this used to be
     TWO separate `min-width` declarations, a stylelint duplicate-
     property error - the second (flat `5.2rem`, added later for the
     badge-clearance fix below) silently won the cascade, leaving the
     depth-based one dead. Both constraints are real and independent
     (drift room grows with `--stack-max-depth`; badge room is a flat
     card-relative constant), so `max()` keeps both alive instead of
     one silently overriding the other - whichever is currently larger
     wins, and that can change as either input does.
     *nit fix, found live while widening `.pile-anchor-count`: the badge
     is `position: relative; left: 2.9rem` (a corner-badge stamped on
     the card, not a normal-flow sibling) - since the card itself is
     `position: absolute` (contributes 0 to auto-width), `.deck-stack`'s
     own flex-item width was sized from the badge's UNSHIFTED box alone,
     letting its shifted, visible position spill past this box's own
     right edge into whatever sits next in the row. Reserving real width
     here is what was missing - not something the input's own width
     caused, just what finally made it visible. */
  min-width: max(calc(var(--card-w) + var(--stack-max-depth) * var(--stack-step-x)), 5.2rem);
}

/* Explicitly placed, not left to its static position - see
   `.deck-stack`'s note. The top card is the shallowest thing in the
   stack, so it sits at the full drift, one `--stack-step-x` right of
   layer 1, exactly like every other pair. */
.deck-stack-card {
  position: absolute;
  top: 0;
  left: var(--deck-drift, 0);
  width: var(--card-w);
  height: var(--card-h);
}

.deck-count-badge {
  position: relative;
  left: 2.9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
}

/* D95 (direct user request: "make card counts a feature for all
   Piles... upper left corner... like a badge") - universal, every pile
   kind, one mechanism (`PileElement`, ui.js). `position: absolute`
   against `.pile-section` itself (already `position: relative`), so it
   sits in the same corner regardless of whether the pile below it
   renders as a flat row, a fan, or a stack - never anchored to any one
   card the way `.deck-count-badge` is to the deck's single stack card
   (that badge is suppressed inside a real pile now, `renderDeckStack`'s
   own comment - only the standalone pre-game preview screen, which
   never reaches `PileElement` at all, still uses it). `z-index`
   above the header/cards so it's never covered by either. */
.pile-count-badge {
  position: absolute;
  top: -0.5rem;
  left: -0.5rem;
  z-index: 2;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  pointer-events: none;
}

/* Compact "closed hand" fan for other players (US-21) - capped visual
   count so it never explodes with 3+ players x 10+ cards (Smith Gate 1). */
.mini-hand {
  display: inline-flex;
  align-items: center;
  margin-top: 0.3rem;
  margin-left: 0.5rem; /* Sprint 3 close-out fix: was flush against the
    roster row's own text with zero gap (Smith finding) */
}

.mini-card-back {
  width: 1rem;
  height: 1.4rem;
  border-radius: 0.15rem;
  /* Deliberately lighter than the roster row it sits on (--surface-2) -
     using that same color made these invisible against their own
     background (Smith Gate-close-style finding, caught in visual
     verification before shipping, not after). */
  background: #465066;
  border: 1px solid #5a6684;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.deck-config { color: var(--muted); font-size: 0.9rem; }
.error-text { color: var(--danger); font-size: 0.9rem; margin-top: 0.5rem; }

/* US-110: one checkbox per RtG catalog deck. *nit (direct user
   request): "use a grid so they line up nicely" - a GRID, not a
   wrapping flex row, so every column's checkbox/art/name lines up
   across rows instead of each label just claiming its own content
   width. Border/padding match `.panel`'s own vocabulary rather than
   inventing a second "grouped content" look. */
.deck-choices {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
}
/* *nit (direct user request): "group decks by color" - a heading
   spans every column so a group reads as its own row, not a stray grid
   cell fighting the deck labels around it for a column. */
.deck-choice-group-heading {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.4rem;
}
.deck-choice-group-heading:first-child { margin-top: 0; }
/* Same fix as `.btn-row[hidden]` above, same reason: a class selector's
   `display: flex` outranks the UA stylesheet's `[hidden] { display:
   none }`, so a hidden `.deck-choices` (every preset but RtG) would
   stay visible - caught live, not just by re-reading the other rule. */
.deck-choices[hidden] { display: none; }
.deck-choices legend { padding: 0 0.4rem; color: var(--muted); font-size: 0.85rem; }
/* `flex-direction: row` is explicit, not the default, because the base
   `label { flex-direction: column }` rule (this file, for stacked
   form-field labels like "Your name" above) otherwise wins - `.deck-
   choice` outranks it on SPECIFICITY for `display`/`gap`, but never
   declared `flex-direction` itself, so nothing overrode that ONE
   property and the checkbox/art/name stacked vertically instead of
   forming one row. Caught live, not by the unit tests (which never
   touch layout). */
/* `align-items: start` (not `center`, US-110's original) - a grid
   column is narrower than the old flex row's content-hugging width, so
   a longer deck name now wraps to 2 lines instead of overflowing
   (`white-space: nowrap` dropped for the same reason). */
.deck-choice { display: flex; flex-direction: row; align-items: start; gap: 0.4rem; font-size: 0.9rem; }
.deck-choice-name { flex: 1 1 auto; min-width: 0; }

/* Direct follow-up request: "use an image from one of the powerful
   cards in each deck and show the deck colors" - the thumbnail's own
   `rtg-c-*` classes (style.css, same ones a dealt card with missing art
   falls back to) paint this gradient underneath the real art, so a
   deck's colours show even before/if its signature card's image loads. */
.deck-choice-art {
  display: block;
  flex: none;
  width: 2.2rem;
  height: 3rem;
  border-radius: 0.2rem;
  overflow: hidden;
  background: linear-gradient(160deg, var(--rtg-fallback-a, #4a4a4a), var(--rtg-fallback-b, #1d1d1d));
}
.deck-choice-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.deck-choice-colors { flex: none; }

.rules-toggle {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 10;
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--bg);
  overflow-y: auto;
  padding: 1.5rem 1.25rem 3rem;
}

.overlay-close {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
}

.rules-entry {
  max-width: 480px;
  margin: 0 auto 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.rules-entry:last-child { border-bottom: none; }

.rules-entry h3 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.rules-entry dt {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 0.6rem;
}

.rules-entry dd {
  margin: 0.15rem 0 0;
}

.score-row {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 0.5rem;
}

/* Real touch target (~44px) - same Smith Gate-close finding as .fd-btn. */
.score-btn {
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0.3rem 0.5rem;
  font-size: 1rem;
  background: var(--surface-2);
  /* UX follow-up (direct user request): "de-blob the score buttons" -
     same override as `.pile-action-btn`/`.card-action-btn`: the base
     `button{}` rule's `border-radius: var(--radius-md)` (0.75rem) reads
     as a rounded pill on a small control, not a crisp square. */
  border-radius: 0.15rem;
}

.roster {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.roster li {
  padding: 0.55rem 0.7rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
}

.roster-connecting { color: var(--muted); font-style: italic; }
.roster-disconnected { color: var(--danger); }

/* Card-lift cue (US-22): a light, cosmetic-only highlight - never
   changes layout/size, so it can't be mistaken for a real state change. */
.card-lifted {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  transform: translateY(-3px);
  transition: transform 0.1s ease-out;
}

/* Live remote cursor (US-22): light and labeled, not visually heavy even
   with several players moving things at once (Smith Gate 1).
   US-146/D168: the transition itself already existed (0.08s linear, tuned
   to smooth jittery raw-coordinate updates) - widened to 0.2s ease-out
   per Smith's Gate 1 condition ("quick, not showy") now that it carries
   real meaning: a glide onto the pile the cursor entered, not just
   smoothing between two nearby points. Same mechanism, better target. */
.remote-cursor {
  position: absolute;
  z-index: 5;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 999px;
  background: var(--accent);
  pointer-events: none;
  transition: left 0.2s ease-out, top 0.2s ease-out;
}

.remote-cursor-label {
  position: absolute;
  left: 0.6rem;
  top: -0.5rem;
  font-size: 0.8rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  padding: 0.05rem 0.3rem;
  white-space: nowrap;
  color: var(--text);
}

/* Live card-drag ghost (US-29, D19) - same normalized-position/transition
   pattern as .remote-cursor, sized to actually show the card it carries
   (real face or anonymous back, decided by the sender - see D19). */
.card-drag-ghost {
  position: absolute;
  z-index: 6;
  transform: translate(-50%, -50%) scale(0.8);
  pointer-events: none;
  transition: left 0.08s linear, top 0.08s linear;
  opacity: 0.85;
}

/* The surface has to get *taller* too, not just let the pot grow. Seat
   and zone rings are a percentage of the surface (D18), and `top` is a
   percentage of its height - so on a 26rem-tall surface the 26% zone
   ring sits only ~108px above centre, which a taller pot overruns
   immediately. Measured, not assumed: growing the pot alone put both
   personal zones on top of it at every desktop width. */
@media (min-width: 1024px) {
  /* 35rem. Measured against the pot at its own hard-capped maximum
     (max-height: 9rem, restored above) - a FIXED, known worst case, not
     a moving target - and 34rem is where the seat ring genuinely clears
     it; this keeps a small margin above that.
     Close to the ORIGINAL 40rem this tier carried before this fix, and
     that is a real finding, not a failure to improve: at current card
     and zone dimensions, ~34rem is roughly the true geometric minimum
     for a 2-seat ring to clear a maxed shared pot, so the original value
     was closer to necessary than accidental. The actual regression this
     fix removes is that the old floor was WIDTH-gated only (`min-width:
     1024px`) with no HEIGHT awareness at all - fixed at 40rem on a
     1280x720 laptop window exactly the same as on a 1280x1400 one - and
     that a clamp() meant to let it shrink on short viewports had an
     inverted min/max that made it permanently un-shrinkable. This value
     is a correct floor, not a workaround; further reduction needs to
     shrink the ring/pot's actual footprint (fewer permanently-visible
     per-card controls), which is a design change, not a CSS number. */
  /* 34rem, RE-tuned 2026-08-20 after the design-lint 44px button fix.
     28rem was correct for the shorter (~36px) buttons this floor was
     first measured against; making every button >=44px (design-lint,
     same date) pushed the deck-controls-strip and other pot-adjacent
     controls taller too, so the ring needs more clearance to stay clear
     of the pot at the same width. Re-binary-searched live at 1024x768,
     the real e2e's own scenario (not a synthetic worst case): 32rem
     still overlaps by 3px, 34rem clears with margin. This number is a
     property of the current fixed-footprint card/zone/button design,
     not a CSS tuning problem - the actual fix is shrinking that
     footprint (fewer permanently-reserved per-card controls), which is
     the pile-actions redesign already flagged as separate, larger work. */
  .table-surface { --table-min-h: max(36rem, calc(100vh - 14.5rem)); } /* D51: bigger cards need more ring clearance; also grow with a tall window, not just cap at a fixed rem (direct user request) */
  /* Wide and short: cards run across instead of wrapping downward, so a
     zone costs the table width (which it has) rather than height (which
     it doesn't). min-width matters as much as max - without it an empty
     or single-card zone collapses to a tall narrow box, the one shape
     the table has least room for. Desktop-only: below 1024px the ring
     has no spare room at all (D24). */
  /* UX follow-up (direct user request): "the zone must expand to fit
     its piles" - `max-width` dropped here (the base `.seat-zone` rule's
     `min(94vw, 48rem)` already covers every breakpoint; this used to
     cap a seat SMALLER than that at desktop widths, exactly the
     shrink-and-clip behavior the user asked to stop). `min-width`
     stays - an empty/single-card seat still shouldn't collapse to a
     tall narrow box, the one shape the table has least room for. */
  .seat-zone { min-width: 14rem; }
  .seat-zone .card-row { flex-wrap: wrap; overflow: visible; }
}

@media (min-width: 1440px) {
  .table-surface { --table-min-h: max(36rem, calc(100vh - 14.5rem)); } /* D51: bigger cards need more ring clearance; also grow with a tall window, not just cap at a fixed rem (direct user request) */
  .seat-zone { min-width: 16rem; }
  .seat-zone .card-row { flex-wrap: wrap; overflow: visible; }
}

/* US-36 follow-through: with several zones (a Split makes N piles at
   once) stacking them vertically buried everything past the first one
   behind the pot's own scroll - you could create four piles and see one.
   Flowing them side by side spends D24's new width on the thing that
   needed it. Zones keep their own labels/borders, so this changes
   arrangement only, not what a zone is (Smith Gate 1, US-19).
   `:not(.seat-zone)` - a personal zone has its own, different sizing
   (`.seat-zone`'s own rule, below) and must not be widened/flex-grown
   the way a shared/deck panel is; `#zones > .zone` alone would win that
   fight by specificity (id+class beats a single class) regardless of
   source order without this.
   *nit (direct user request): "default width of zones is too wide" -
   `flex-grow: 1` (was `1 1 auto`) stretched a zone to fill whatever's
   left of its row. Every BUILT-IN panel has an explicit preset/saved
   width by now (the Infinity Table camera's absolute positioning,
   D130+) and never reaches this rule at all - the only panel that
   still does is a brand-new Add Zone/Add Pile result, which has no
   stored size yet and was filling an entire empty row (confirmed live:
   a single empty Pile inside a 700px-wide Zone). `0 1 auto` matches
   the sibling rule this project already settled on for the same reason
   (`.pile-section` below, "a Pile never stretches... only the ZONE
   itself is Resizable") - fit content, don't grow to fill space no one
   asked it to fill. Still `min-width: 11rem` below, still shrinkable,
   still resizable by drag same as always. */
#zones > .zone:not(.seat-zone) {
  flex: 0 1 auto;
  min-width: 11rem;
  margin-bottom: 0;
}

/* *nit (2026-08-27), direct user request ("save space"): the
   consolidated Score panel (`ScoreZoneElement`, every seated player's
   row) is tall enough (one row per player) that letting it flow beside
   the Table Zone - `#zones`'s default row behavior, above - extended
   that row far enough right to reach into the opponent seat-zone's own
   ring position at packed desktop widths (measured live via `npm run
   lint:design`: a new "Bob overlaps Scores" violation that a plain
   flow position didn't avoid). Forcing its own line, before any
   `panel-moved` drag ever happens, keeps it clear of the ring without
   reviving per-seat position math - real user drag (`wirePanelLayout`)
   still overrides this the moment someone moves it, same as any other
   panel. */
#zones > score-zone.zone:not(.panel-moved) {
  flex-basis: 100%;
}

/* UX follow-up (direct user request): "zone is one thing, pile is
   another - don't overload zone-panel to do everything." A Zone
   (`.zone`, `<zone-panel>`) draws its OWN box and holds one or more
   Piles (`.pile-section`, `<pile-panel>`) inside a `.zone-body` -
   replicates `#zones`'s own flex-row layout and its member-sizing rule
   one level in, so a Pile living inside a Zone's body looks/behaves
   the same as a standalone Zone did living directly in `#zones`. */
.zone-body {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
}

/* *nit (2026-08-26), direct user request: "Piles are not Resizable so
   they always should be the min size for the content." `flex-grow: 0`
   (was `1`) - a Pile never stretches to fill extra space its Zone
   happens to have (from a manual resize, or simply sitting beside a
   taller sibling); only the ZONE itself is Resizable
   (`wirePanelLayout`'s corner handle, wired once per Zone box, never
   per Pile). `min-width` stays - a readability floor, not a growth
   allowance. */
.zone-body > /* *nit (direct user request): "a 42 card deck overlaps both the buttons
   and the bottom of the panel". A panel's width/height come from this
   browser's SAVED layout (`panelLayout.js`), which a preset change can
   never revisit - so an arranged table kept a box sized before the deck
   had any depth, and the stack spilled out of it. `min-height` beats an
   inline `height`, so this makes any panel refuse to be squeezed below
   what it actually contains, whatever the saved layout says. */
.pile-section {
  min-height: max-content;
  flex: 0 1 auto;
  min-width: 11rem;
}

/* Bug fix (direct user request): reserved empty drop target so a card
   can always be dropped beside a Zone's existing piles to spawn a new
   one (a meld, etc.) - `ui.js`'s `renderZonePanel` appends exactly one
   of these as `.zone-body`'s last child, always. Without it, a Zone
   whose box shrinks to fit its content exactly (`.seat-zone`) has zero
   pixels of empty `.zone-body` space once its one pile fills the row -
   confirmed live, its bounding box was pixel-identical to its lone
   pile's. Sized to one card slot (not a bigger, more visually
   demanding target) - unobtrusive at rest, and the existing
   `.zone.drag-over` highlight (triggered on the SAME `body`
   listener this space extends) already gives drag feedback without
   this needing its own. */
.zone-drop-gutter {
  flex: 0 0 auto;
  min-width: var(--card-w);
  min-height: var(--card-h);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
}

/* UX follow-up (direct user request): "make zones and piles visually
   distinct" (then, immediately after, "put the border around the
   piles back") - a Pile is its own real, bordered region INSIDE the
   Zone's own box, not identical to the Zone (dashed and a lighter/
   subtler color keeps it visually distinct from the Zone's solid
   `var(--border)` outline) and not un-styled either. Addressable/
   droppable exactly like a Zone is - `pileElement`/`touchTargetAt` key
   off `.pile-section[data-pile-id]`, and the drag-over highlight below
   applies to `.pile-section` too - but it never draws a SECOND
   zone-shaped box or wires its own move/resize; a Pile always lives
   inside exactly one Zone, which owns both of those once. */
.pile-section {
  position: relative;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  padding: 0.35rem 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
}

/* Your hand no longer needs `position: sticky` here - that was the
   previous fix for the same complaint this whole change addresses, and
   it only mattered because the PAGE used to scroll. Now #screen-game is
   a flex column that fills the viewport (`min-height: 100svh`) with the
   table panel set to `flex: 1 1 auto; min-height: 0` and this panel left
   at its natural size, so the hand sits at the bottom of the column by
   construction - visible without a positioning trick, and without a
   scrollbar to be stuck against in the first place. */
#screen-game > .panel:last-of-type {
  flex: 0 0 auto;
  background: var(--surface);
  margin-bottom: 0;
}

/* .deck-column (UX follow-up: retired) - the deck lives inside
   #zones as one of its own zone-like panels now, not in a separate
   column beside it. */

/* Every pile that can receive the chosen action lights up, so the valid
   destinations are visible rather than guessed (Nielsen #1/#6). */
/* D51 finding: a click-to-choose target (`beginTargeting`) needs to be
   clickable WITHOUT hovering it first - unlike `.pile-hover-host`'s
   z-index escalation (only active on hover), `.pile-target` is applied
   BEFORE any hover happens. Confirmed live: `#hand-zone` sits at the
   same seat position `#game-roster`'s bottom seat `<li>` occupies
   (z-index:2) - without its own z-index, a targeted-but-unhovered hand
   zone lost the click to the roster row sitting on top of it. */
.pile-target {
  outline: 2px dashed var(--accent);
  outline-offset: 3px;
  background: rgba(79, 157, 255, 0.1);
  cursor: pointer;
  position: relative;
  z-index: 4;
}

/* The table code stays visible for the whole game - late arrivals and
   rejoins always need it, and it used to live only on a screen you had
   to leave the table to reach. */
.game-code-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* US-69/70/D61: same compact info-bar shape as .game-code-bar right
   above it, not a new visual pattern. The caption is a small persistent
   note (Smith Gate 2), not styled as an error/warning - it's normal,
   expected-every-time information. */
.layout-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  margin-bottom: 0.3rem;
}

.layout-controls-caption {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--muted);
}

/* US-148/D170: the "Save Layout As" button's own replacement while
   naming - same look-and-feel as `.zone-name-edit`'s inline rename,
   sized for this button row rather than a zone title. */
.layout-save-as-edit {
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0.2rem 0.4rem;
  min-width: 8rem;
  max-width: 14rem;
}

/* US-149/D171: "Add Zone"/"Add Pile"'s own inline form, same
   button-swap idiom as `.layout-save-as-edit` above. */
.builder-inline-form {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.builder-kind-select,
.builder-zone-select {
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0.2rem 0.3rem;
}

.game-code-bar code {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.25rem 0.6rem;
}

/* Icon-only buttons carry no text, so they need an explicit box - and it
   has to clear the 44px floor from the UI Conventions in ARCHITECTURE.md,
   which is exactly the rule an icon button is most likely to break. */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  line-height: 0;
}

.icon-btn svg {
  width: 1.15rem;
  height: 1.15rem;
}

.copy-link-btn { margin: 0 auto; }

/* --- Touch drag (US-40, D28) ------------------------------------------
   The dragged card stays where it is, dimmed, while a clone follows the
   finger. Moving the real element would mean overwriting - and later
   restoring - the inline `transform` the US-30 hand fan puts on every
   card, and a drop into dead space re-renders nothing, so a card could
   be stranded mid-air. A clone has no state to restore. */
.card-dragging { opacity: 0.35; }

/* Smith Gate 2 #3: the lift is the ONLY feedback in the whole gesture -
   nothing marks the 250ms hold, so a user whose hold didn't take gets
   silence and no way to tell a failed gesture from a broken app. It has
   to be impossible to miss, not tasteful.

   The pop animates `scale`, NOT `transform`: `transform` is written
   inline on every move to follow the finger, and an animation on the
   same property outranks the inline style, which would snap the ghost
   back to the origin for the length of the animation. `scale` is its own
   property and composes with the translate instead of fighting it. */
@keyframes card-lift-pop {
  from { scale: 1; }
  to { scale: 1.12; }
}

.touch-drag-ghost {
  position: fixed;
  z-index: 30; /* above the modal layer (20) - nothing may cover the card you are holding */
  pointer-events: none; /* so elementFromPoint never hit-tests the ghost as the card */
  scale: 1.12;
  opacity: 0.92;
  outline: 2px solid var(--accent);
  box-shadow: 0 8px 20px rgb(0 0 0 / 45%);
  animation: card-lift-pop 120ms ease-out;
  /* Parked off-screen until the first move positions it. `left`/`top`,
     never a transform translate: `scale` above composes OUTSIDE
     `transform`, so a translate here would be multiplied by 1.12 and the
     ghost would drift further from the finger the further it travelled
     (Smith's Gate 2 #2 finding at sprint close). */
  left: -9999px;
  top: -9999px;
}

/* --- Pile-level and card-level actions (US-41, D29; generalized D34/D37;
   unified D51; radial D52; RETIRED in favor of plain buttons, direct
   user request 2026-08-24: "the radials are not working... use a
   header on Piles and Zones to display the actions ... as a set of
   buttons next to the title.") ---------------------------------------
   Every pile/zone's own heading (`.zone-name`) doubles as its action
   header now (`<header-actions>`) - the actions it offers
   are always-visible buttons next to the title, not something you have
   to hover to discover. No more `position: fixed`-at-pointer menu, no
   more per-render open/close/reposition state to get wrong. */
/* UX follow-up (direct user request): "remove all that crazy padding
   around the buttons ... a nice crisp header bar with the action
   buttons compact and aligned with the title." The old `margin-right:
   auto` on the title pushed buttons to the far edge of whatever width
   the header happened to have, which read as a big gap before them
   (and unpredictable wrapping) rather than "next to the title." Plain
   flow with a small fixed gap puts them immediately after the title
   instead - the header's own width (`.deck-area`, below) sizing to
   content rather than a fixed column is what actually lets them sit on
   one row when they fit, not the margin trick. */
.pile-action-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.1rem;
}

/* *nit (direct user request, 2026-08-25): "put PileAction buttons in a
   row below the Pile Title" - the title (`.zone-name-text`) forced to
   its own full-width line makes every button wrap onto the next line
   as a row underneath it, via the same `flex-wrap` the header already
   had (no new wrapper element, no JS change).
   Scoped to `.pile-title` specifically (`ui.js`'s `headingClass:
   'pile-title'`, the ONLY header actually built from `pileActions.js`)
   rather than the shared `.pile-action-header` every header reuses for
   its base button/label styling.
   *nit (2026-08-27): `<score-zone>` (`ScoreZone.js`) no longer renders
   through this path at all - its 2-button title-bar adjuster (and the
   `.score-header` variant of this same rule that briefly existed for
   it) is gone with the one-panel-per-player design; its heading is now
   plain text, no actions, and every player's own +/-1/+/-10 controls
   live in that player's row instead (`.score-adjust-btn`, below). */
.pile-title .zone-name-text {
  /* Superseded by the block-layout fix below (`.pile-title { display:
     block }`) - a block-level child always starts its own line with no
     percentage math needed, so `flex: 1 0 100%` no longer does
     anything here, but the rule stays merged into the one below rather
     than left as a second, now-inert declaration for the same
     selector (stylelint's `no-duplicate-selectors`). */
  display: block;
}

/* nit fix, resumed 2026-09-07 (was reverted 2026-09-04, then re-
   attempted twice more before landing here - see the two failed
   attempts below, kept for the next person who's tempted to retry
   them): `.pile-title` itself had no explicit width, so it sized
   shrink-to-fit against its content by default - but
   `.zone-name-text`'s percentage `flex-basis` (above) resolves
   CIRCULARLY against that same shrink-to-fit ancestor (a flex item's
   percentage basis needs a definite container size to resolve against;
   a shrink-to-fit container's size is defined IN TERMS OF its items'
   sizes - the two can't both be resolved first), inflating the header
   well past what its content needs. Confirmed by measuring an
   individual title span cloned outside the flex context: its real text
   width was 106px, but resolved to 259px in place - not a fixed
   overshoot, so no fudge-factor width would fix every case.
     - `width: min-content` breaks the circularity but goes too far the
       other way: min-content for a wrapping flex row is the width of
       its single widest UNBREAKABLE item (one button, ~44px), so every
       button wraps onto its own line - taller headers, which is what
       regressed `lint:design`'s scroll checks when this was tried.
     - `width: max-content` also breaks the circularity, and looked
       right on the header tested first (RtG's Decks panel, plain
       buttons only) - but re-measuring RtG's Discard header (which
       adds a `.pile-action-enum` `<details>` control to the mix)
       showed the SAME 259px inflation still happening. `max-content`
       resolves the container's OWN preferred size correctly, but the
       percentage basis inside it is still asking "100% of what?" during
       that same resolution pass - the circularity isn't about which
       content-sizing keyword the container gets, it's that a
       PERCENTAGE basis can't participate in that resolution at all.
   The actual fix: stop using flex + a percentage basis to force the
   title onto its own line. `.pile-title` is normal block layout instead
   - a block-level `.zone-name-text` always starts a new line by
   definition (no percentage math involved), and the buttons after it
   are ordinary inline-level boxes that wrap like words, so the
   container's shrink-to-fit width is just "the widest line", computed
   the same well-defined way a paragraph's shrink-to-fit width is.
   Confirmed empirically: RtG Discard now measures 176px (matches the
   "hide either the title or the buttons alone" floor Neo's original
   investigation established as correct), Deck panel unaffected,
   `lint:design`'s violation set is still the pre-existing baseline, and
   RtG's Decks-zone box (`presets.js`, 1400x570) still fits with no
   re-tuning needed. */
.pile-title {
  display: block;
  width: max-content;
  /* *fix (queued 2026-09-10, direct user reports: "deck/pile split...
     super wide because of all the actions" / "fold pile actions into
     rows"): `width: max-content` (above) means "as wide as an
     UNWRAPPED line of content" by definition, so a pile with many
     actions (Deck: 6 icons + the changePileType control) always forced
     the whole panel open wide enough for one unbroken row, rather than
     ever actually using the "buttons wrap like words" behavior this
     rule's own history already established. Capping it lets max-
     content still govern the common 1-3-action case exactly as before
     (well under this cap, nothing changes) while forcing a many-action
     header to wrap onto multiple rows instead of stretching the whole
     panel - a fixed value, not a percentage, so it carries no risk of
     reopening D118's own shrink-to-fit circularity.
     11rem, matching `.pile-section`'s own `min-width` two rules below:
     tried 9rem first (measured narrower - Deck panel 176px vs this
     rule's 194px), but it also wrapped panels that fit comfortably on
     one row today, adding a row's worth of height to enough of them at
     once to measurably worsen `lint:design`'s existing scroll-overflow
     baseline (56px -> 78px on the smallest tested viewport). 11rem
     reproduces the pre-existing baseline byte-for-byte while still
     narrowing Deck (was 210px) and every other many-action header. */
  max-width: 11rem;
}
.pile-title .pile-action-btn,
.pile-title .pile-action-enum {
  margin: 0.1rem 0.1rem 0 0;
}

/* UX follow-up (direct user request): "small square icons ... tool tip
   style hover text ... keep each button the same size." One fixed
   square, same for every pile/zone header action, the glyph is the
   only thing that changes (`ACTION_SPECS[id].icon`, the full name
   moved to `title`/`aria-label` - see `ui.js`'s `applyIconButton`).
   2.75rem keeps the existing 44px touch-target floor exactly, just
   square instead of pill-shaped now. *nit (2026-08-26): `.card-
   action-btn` (the card hover-popup's own buttons) is gone with the
   popup itself - "cards are Movable not Actionable". */
.pile-action-btn {
  /* UX follow-up (direct user request, 2026-08-24): "the button is still
     HUGE... needs to be the same size or smaller than the title text."
     A deliberate override of the base `button{}` rule's 44px touch-
     target floor (`min-width`/`min-height` reset to 0 below, same
     override pattern `button.card` already used for playing cards) -
     sized to `.zone-name`'s own `font-size: 0.8rem`, not the floor.
     `tests/designLint.check.mjs`'s 44px check is exempted for both
     classes to match, same reasoning as its existing `.card` exemption. */
  width: 1.3rem;
  height: 1.3rem;
  min-width: 0;
  min-height: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  line-height: 1;
  background: var(--surface-2);
  border-color: var(--accent);
  /* UX follow-up: "not round though - square." The base `button{}`
     rule's `border-radius: var(--radius-md)` (0.75rem) is more than
     half this button's own size, rounding it into a circle/pill - even
     `--radius-sm` (0.45rem) is still a third of this button's own
     size, visibly rounded. A small explicit corner reads as a crisp
     square instead, not scaled off either shared token. */
  border-radius: 0.15rem;
}

/* *nit (direct user request): "a menu for the change pile action and
   give me an indication of the currently selected pile type" -
   `ui.js`'s `buildEnumActionMenu` (an EnumAction, e.g. `changePileType`).
   `<details>`/`<summary>` gives open/close and click-outside-to-close
   for free - `position: relative` here is only so `.pile-action-menu`
   below anchors to THIS control, not the whole `.pile-section`. */
.pile-action-enum {
  position: relative;
  display: inline-flex;
}

/* The indicator itself: unlike `.pile-action-btn` (icon-only, fixed
   1.3rem square), this shows the CURRENT choice's own label as text, so
   it needs to size to that text, not a fixed glyph box - same compact
   header-row sizing spirit (small font, tight padding), just width-
   flexible. A `<summary>`, not a `<button>` - browsers already render it
   focusable/clickable with its own default disclosure marker, which the
   two rules below replace with nothing (no marker) since the label text
   already communicates "menu" the same way every other header control
   here communicates its own affordance (an icon), with no arrow needed
   to say so twice. Naturally outside `tests/designLint.check.mjs`'s 44px
   check (its selector only matches `button`) - the same "small habitual
   header control, not a primary touch target" territory
   `.pile-action-btn` already occupies, not a new exemption to add. */
.pile-action-enum-btn {
  display: inline-flex;
  align-items: center;
  height: 1.3rem;
  padding: 0 0.35rem;
  font-size: 0.7rem;
  line-height: 1;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--accent);
  border-radius: 0.15rem;
  cursor: pointer;
  white-space: nowrap;
}
.pile-action-enum-btn::marker,
.pile-action-enum-btn::-webkit-details-marker {
  display: none;
  content: '';
}

/* Tighten/Loosen slider (direct user request, 2026-09-13): the
   RangeAction sibling of `.pile-action-enum` above (`ui.js`'s
   `buildRangeAction`, `<spread-slider>`). A native range input, not a
   pair of `.pile-action-btn` icons any more - sized to the same
   compact 1.3rem header-row height, a fixed width since (unlike the
   enum control) there's no label text to size to and no numeric
   readout (direct user answer at Smith's gate: handle position only). */
.pile-action-range {
  display: inline-flex;
  align-items: center;
  height: 1.3rem;
}
.spread-slider-input {
  width: 4rem;
  height: 1.3rem;
  margin: 0;
  cursor: pointer;
}

/* The open menu - a real touch target per item (unlike the compact
   toggle above), since these ARE what a viewer taps to commit to a
   choice, not a habitual small header control. */
.pile-action-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 10;
  margin-top: 0.2rem;
  display: flex;
  flex-direction: column;
  min-width: 8rem;
  background: var(--surface-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}
/* US-147: found live wiring Flip's 4th choice - opening the dropdown
   never changes its OWN parent's layout box (it's `position: absolute`),
   so the enclosing popup's one-time open-time clamp can't see it grow
   and a 4-item menu near the bottom of the screen ran off past the
   viewport. `buildEnumActionMenu` adds this class once the dropdown's
   own real rect (checked on the native `toggle` event, once it's
   actually open) would extend past the viewport bottom - the same
   "flip near an edge" a native `<select>` gives for free. */
.pile-action-menu-flip-up {
  top: auto;
  bottom: 100%;
  margin-top: 0;
  margin-bottom: 0.2rem;
}
.pile-action-menu-item {
  min-height: 44px;
  padding: 0 0.75rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  text-align: left;
  font-size: 0.8rem;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--text);
  cursor: pointer;
}
.pile-action-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}
/* The currently-selected kind, marked inside its own row rather than a
   separate always-visible label - the toggle button already shows the
   current value at rest (`.pile-action-enum-btn`'s own text content);
   this is the "you are here" marker for once the menu is open. */
.pile-action-menu-item-current {
  font-weight: 700;
  color: var(--accent);
}
.pile-action-menu-item-current::after {
  content: ' ✓';
}

/* US-145/D167 (renamed direction -> style, US-147): Flip's choices
   (`buildEnumActionMenu`'s optional `choice.preview`) get a small
   literal illustration of the resulting arrangement beside their label
   - never instead of it (Smith Gate 1, WCAG 1.4.1: the word is the real
   signal, the picture is decoration, `aria-hidden` on the preview
   itself says so structurally too). A fixed box just large enough for
   3 tiny "cards"; CSS positions them per style, the same "JS builds,
   CSS positions" split the real stack layout math (`Stackable.
   offsetIn`) already uses. */
.stack-style-preview {
  position: relative;
  flex: none;
  width: 1.5rem;
  height: 1.3rem;
}
.stack-style-preview-card {
  position: absolute;
  width: 0.6rem;
  height: 0.85rem;
  background: var(--text);
  border-radius: 1px;
  opacity: 0.85;
}
.stack-style-preview-vertical .stack-style-preview-card:nth-child(1) { top: 0; left: 0.45rem; }
.stack-style-preview-vertical .stack-style-preview-card:nth-child(2) { top: 0.225rem; left: 0.45rem; }
.stack-style-preview-vertical .stack-style-preview-card:nth-child(3) { top: 0.45rem; left: 0.45rem; }

.stack-style-preview-horizontal .stack-style-preview-card:nth-child(1) { top: 0.225rem; left: 0; }
.stack-style-preview-horizontal .stack-style-preview-card:nth-child(2) { top: 0.225rem; left: 0.45rem; }
.stack-style-preview-horizontal .stack-style-preview-card:nth-child(3) { top: 0.225rem; left: 0.9rem; }

.stack-style-preview-fan .stack-style-preview-card:nth-child(1) { top: 0.4rem; left: 0.1rem; transform: rotate(-18deg); }
.stack-style-preview-fan .stack-style-preview-card:nth-child(2) { top: 0.25rem; left: 0.45rem; }
.stack-style-preview-fan .stack-style-preview-card:nth-child(3) { top: 0.4rem; left: 0.8rem; transform: rotate(18deg); }

/* US-147: Jumble's preview scatters its 3 "cards" off-centre and tilts
   them, echoing the real layout's own "no axis, small deterministic
   scatter" shape (`Stackable.jumbleHash`) - a fixed illustration here,
   not computed, since a preview icon has no `index` to hash. */
.stack-style-preview-jumble .stack-style-preview-card:nth-child(1) { top: 0.1rem; left: 0.2rem; transform: rotate(-12deg); }
.stack-style-preview-jumble .stack-style-preview-card:nth-child(2) { top: 0.35rem; left: 0.55rem; transform: rotate(15deg); }
.stack-style-preview-jumble .stack-style-preview-card:nth-child(3) { top: 0.15rem; left: 0.75rem; transform: rotate(-6deg); }

/* US-100/D101: the card right-click menu (`ui.js`'s `openCardContextMenu`)
   reuses `.pile-action-menu`/`.pile-action-menu-item` above verbatim for
   its look - this class only overrides the ANCHORING, from "absolute
   under a `<details>` toggle" to "fixed at the cursor" (`menu.style.left`/
   `.top` are set inline, in viewport px, per click - see
   `clampMenuPosition`). */
.card-context-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  margin-top: 0;
}

/* US-145/D167: found live wiring Flip into the stack gear menu - the
   outer `<action-menu>` popup reuses `.pile-action-menu`'s own
   classname for ITS shell (`ActionMenuElement.open()`), including that
   class's `overflow: hidden` (meant to clip a plain row's rounded
   corners). An EnumAction item (`buildEnumActionMenu`) nests its OWN
   `.pile-action-menu` dropdown that must render BELOW the toggle,
   outside the outer shell's box - `overflow: hidden` silently clipped
   it to nothing, invisible but still fully present in the DOM (every
   existing test kept passing regardless - Playwright's own click/
   visibility checks don't account for an ANCESTOR's overflow clip,
   only the element's own display/visibility/opacity - see
   `tests/uiActions.browser.mjs`'s `elementFromPoint` check, added
   specifically because this class of bug is otherwise invisible to
   automated tests). Scoped to `.stack-action-menu` only (this feature's
   own popup) so the plain card-context-menu keeps its tight-clipped
   corners. */
.stack-action-menu {
  overflow: visible;
}

/* UX follow-up (direct user request, "move pile action buttons to a
   corner gear icon menu"): the pile header's own gear menu can ALSO
   nest an EnumAction disclosure (changePileType) now - the exact same
   popup-in-popup hazard `.stack-action-menu` above exists to fix, found
   live there first. Applied here BEFORE shipping, not after a repeat
   report - same root cause, same fix. */
.pile-header-menu {
  overflow: visible;
}

/* *nit (2026-08-26), direct user request ("cards are Movable not
   Actionable"): the card hover-popup (`.card-action-row`, `ui.js`'s
   `attachActionRow`) and its follow-mode label (`.radial-follow-ghost`,
   `beginTargetingWithGhost`) are both deleted - every card action now
   has a real trigger of its own (drag for move/pickup/play, a direct
   tap for reveal/rotate), no popup needed at all. */

/* Phase 56 (T56.1)/D52: the count inputs (Deal's cards-per-player,
   Split's pile count) are persistent now, next to the deck itself, not
   nested in a menu - see `ui.js`'s `pileCountInput`. *nit (direct user
   request, "give the number more room and I like the badge idea"):
   widened past the legacy popover-era sizing, and restyled to match
   `.deck-count-badge`'s own pill treatment right next to it (same
   `background`/`border`/`border-radius`/`font-weight`) instead of a
   plain bordered box - the two numbers sitting side by side now read
   as one visual family instead of two different input styles. */
.pile-anchor-count {
  width: 4.5rem;
  min-height: 44px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.4rem;
}

/* An empty deck still occupies its slot, so the controls beside it don't
   jump around the moment the last card is drawn. */
.deck-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: var(--card-w);
  min-height: var(--card-h);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: 0.7rem;
  text-align: center;
}

/* --- Restore: waiting for players (US-45) ------------------------------ */
.restore-waiting { margin-top: 0.75rem; }

.restore-waiting .waiting-summary {
  font-weight: 600;
  margin: 0 0 0.4rem;
}

.restore-waiting .waiting-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
}

/* Named, and marked - "2 of 3" never tells a host whether to keep
   waiting; "Bob is still disconnected" does. */
.restore-waiting .returner-back { color: var(--muted); }
.restore-waiting .returner-missing { font-weight: 600; }

.restore-waiting .returner-back::before { content: "✓ "; }
.restore-waiting .returner-missing::before { content: "… "; }

#resume-anyway-btn { min-height: 44px; }

/* UX follow-up (direct user request): move is a base zone feature -
   every Zone panel (shared, personal, deck) switches to this, plain
   `position: absolute` with NO transform, the first time it's actually
   dragged (`ui.js`'s `attachPanelDrag`) or preset-seeded
   (`applyPresetLayout`). Before that, each panel keeps its own default
   mechanism unchanged - a personal zone's `.seat-zone`/`.own-zone`
   centering `--raise-base` transform, or a shared/deck panel's normal
   flex-wrap flow (`#zones`). `--raise-base: none` matters even though
   `transform` alone would look right at rest: `.pile-hover-host:hover`
   COMPOSES `var(--raise-base, none)` with its own raise - leaving the
   old centering transform in that custom property would silently
   re-apply it (a visible jump) the moment a moved panel is hovered.
   `.zone.panel-moved` (not just `.panel-moved`) outranks `.seat-zone`'s
   own same-specificity rule regardless of source order.
   *nit (2026-08-26) history: this whole mechanism was briefly deleted
   ("remove pointer-based panel behavior"), then directly restored by
   the user - "zones can be moved anywhere on the table, it was working
   great until you broke it." Piles use a separate native-drag
   mechanism for their own different capability (reparent/reorder). */
.zone.panel-moved {
  position: absolute;
  transform: none;
  --raise-base: none;
}

/* UX follow-up (direct user request): "grab bars and click title...
   grabbing the title to move the panel to a different place on the
   table." A panel's own title (`.zone-name`) is the drag handle
   (`ui.js`'s `attachPanelDrag`) - a real cursor affordance beats a
   silent draggable area. */
.panel-drag-handle {
  cursor: grab;
}

.panel-dragging {
  cursor: grabbing;
  z-index: 15;
  opacity: 0.92;
}

/* Set on <body> for the duration of a drag so the cursor reads
   "grabbing" everywhere, not just while directly over the panel (no
   pointer capture is taken - this is the cheap equivalent). */
body.panel-drag-active {
  cursor: grabbing;
}

/* UX follow-up (direct user request): a resize handle alongside the
   existing move handle - "grab areas for resize... a slight border
   around resizable zones or piles would help provide visual
   indication." Two parts: `.panel-resizable` marks the panel itself so
   it reads as resizable at rest, before the pointer ever finds the
   small corner grip; `.panel-resize-handle` is that grip. */
.panel-resizable {
  /* Deliberately subtler than the accent-colored `.drag-over`
     drop-target highlight (which means something is actively
     happening) - this means "you CAN do something here", a standing
     affordance, not a live state change. */
  border-color: rgba(79, 157, 255, 0.4);
}

/* *nit (2026-08-26), real bug found live: a Zone's own `flex-grow: 1`
   (`#zones > .zone:not(.seat-zone)`, ID+2-class specificity) outranks
   an explicit `style.width` set by a resize - the drag correctly set
   the width, but the browser grew the panel right back past it to
   fill the row anyway, reading as "I can't make it narrower." Once a
   panel has a REAL width (a live resize, or a stored/preset one -
   `ui.js`'s `wirePanelLayout`/`attachPanelResize` both add this class
   the moment that's true), it stops growing - the explicit width is
   what a resize is FOR. Matched (ID + 2 classes + the same `:not()`
   argument) rather than a bare `.panel-sized`, so this genuinely
   outranks the rule it's overriding instead of hoping source order
   favors it - same reasoning `.zone.panel-moved`'s own comment gives
   for its fight against `.seat-zone`. */
#zones > .zone.panel-sized:not(.seat-zone) {
  flex-grow: 0;
}

.panel-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 1rem;
  height: 1rem;
  /* A plain <div>, not a <button> - designLint's 44px floor only checks
     `button` elements (tests/designLint.check.mjs), the same reason
     `.panel-drag-handle` (the title bar) never needed an exemption
     either. Deliberately smaller than a tap target: mouse-only, like
     every other panel-drag affordance in this pass. */
  min-width: 0;
  min-height: 0;
  cursor: nwse-resize;
  /* Three short diagonal grip lines in the corner, same visual language
     as a native OS resize handle - a repeating gradient rather than a
     background image so it stays crisp at any zoom/DPI with no asset. */
  background-image: repeating-linear-gradient(
    135deg,
    rgba(230, 236, 245, 0.55) 0 1.5px,
    transparent 1.5px 4px
  );
  background-position: bottom right;
  background-repeat: no-repeat;
  background-size: 0.7rem 0.7rem;
  border-radius: 0 0 var(--radius-md) 0;
  opacity: 0.6;
}

.panel-resizable:hover .panel-resize-handle,
.panel-resize-handle:hover {
  opacity: 1;
}

.panel-resizing {
  z-index: 15;
  opacity: 0.92;
}

/* Set on <body> for the duration of a resize so the cursor reads
   "resize" everywhere, not just while directly over the small handle -
   same reasoning/technique as `body.panel-drag-active` above. */
body.panel-resize-active {
  cursor: nwse-resize;
}

/* ---- Recard the Gathering card face (D76, US-80) --------------------
   Scoped entirely to `.card-rtg`. The global `--card-w`/`--card-h` are
   deliberately NOT touched: an MTG card needs more room than a pip
   card, but changing the shared tokens would resize every other
   preset's table, which the RtG brief explicitly ruled out. */
/* `.card.card-rtg`, not `.card-rtg` and not `button.card-rtg`:
   - a plain `.card-rtg` (0,1,0) loses to `button.card` (0,1,1), which
     sets min-width/min-height/display. That exact trap already caused a
     real "tiny cards" bug once (see the comment above `button.card`).
   - `button.card-rtg` fixes that but only matches BUTTONS, and a
     face-down card is a `div` (`cardBackElement`), so RtG card backs
     rendered at standard size next to full-size faces.
   Two classes (0,2,0) outrank one element + one class (0,1,1) and match
   either tag. Both problems were caught by measuring in a browser. */
.card.card-rtg {
  --card-rtg-w: 4.4rem;
  --card-rtg-h: 6.1rem;

  /* A fixed box, not just a floor: `min-width` alone let a long card
     name ("Ser Calla, Dawnbreak Captain") stretch the flex item well
     past the intended width. Caught by measuring in a browser, not by
     reading the rule. */
  min-width: var(--card-rtg-w);
  width: var(--card-rtg-w);
  min-height: var(--card-rtg-h);
  height: var(--card-rtg-h);
  flex: 0 0 auto;
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  flex-direction: column;
  background: #201d18;
  border-color: #0d0b09;
}

/* *nit (real bug, found live): a card back now carries `.card-rtg` too
   (added for SIZING only - `cardBackElement`, `ui.js`, dispatches
   through the same `faceFor` a face-up card uses) - but `.card.card-rtg`
   above sets `background` as a SHORTHAND, which resets `background-image`
   to `none` when the shorthand doesn't repeat it. Applied to a back, that
   silently wiped out the branded `.card-back` art, leaving a flat dark
   rectangle. Three classes (0,3,0) beats `.card.card-rtg`'s two (0,2,0)
   regardless of source order, so this always wins back the real art. */
.card.card-back.card-rtg {
  background-color: #16341f;
  background-image:
    image-set(url("assets/brand/card-back.webp") type("image/webp")),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0 2px, transparent 2px 6px);
  background-size: cover;
  background-position: center;
  border-color: #0c1d12;
}

.rtg-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* *nit (direct user request: "put cost upper left so I can see it in
   the fan") - a fanned hand only shows the LEFT edge of each covered
   card (later cards overlap from the right), the same reasoning
   `.card-corner`'s own placement already documents elsewhere. Cost
   pips sat top-RIGHT, which a fan hides on every card but the last. */
.rtg-top {
  position: relative;
  display: flex;
  justify-content: flex-start;
  padding: 0.12rem 0.15rem;
}

.rtg-cost {
  display: inline-flex;
  gap: 0.08rem;
}

/* *nit (direct user request): "show the mana requirements as glyphs
   not {u} etc" - a pip now also appears inline inside running prose
   (`.rtg-inspect-rules`, via `renderRulesText`), not just inside
   `.rtg-cost`'s own flex row. `display`/`vertical-align` move here
   (were implicit, relying on `.rtg-cost`'s flex context to give a bare
   `<span>` a box at all) so a pip is a self-contained glyph wherever
   it's placed. */
.rtg-pip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: -0.1em;
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 50%;
  font-size: 0.5rem;
  font-weight: 700;
  line-height: 0.72rem;
  text-align: center;
  color: #1a1a1a;
  border: 1px solid rgba(0, 0, 0, 0.5);
}

.pip-generic { background: #cdc5b4; }
.pip-w { background: #fbf7e6; }
.pip-u { background: #9ed0e6; }
.pip-b { background: #a6a29c; }
.pip-r { background: #f0a081; }
.pip-g { background: #a7d7a9; }
/* *nit (direct user request): "replace {T} with a bent arrow tap
   symbol" - tap isn't one of the five colours, so it gets its own
   neutral (not colour-coded) pip rather than borrowing `pip-generic`,
   which already means "colourless/generic mana" (a real, different
   concept - a {1} in a cost is not the same symbol as a tap). */
.pip-tap { background: #d8d2c4; font-size: 0.55rem; }

/* Name strip sits at the bottom over the art, where it stays legible
   against the ridge silhouettes (which are always the darkest band of
   the generated art). */
.rtg-name {
  position: relative;
  margin-top: auto;
  font-size: 0.42rem;
  line-height: 1.15;
  font-weight: 600;
  color: #f5f0e4;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85) 45%);
  /* Right padding reserves the corner the P/T box occupies - without it
     a long name runs under the stats and both become unreadable
     (caught on screenshot, not in review). */
  padding: 0.3rem 1.15rem 0.12rem 0.18rem;
  text-align: left;

  /* Clamp to two lines - a long name must not push the art out of the
     fixed-height card. The inspect overlay carries the full name. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rtg-stats {
  position: absolute;
  right: 0.1rem;
  bottom: 0.08rem;
  font-size: 0.5rem;
  font-weight: 700;
  color: #f5f0e4;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 0.2rem;
  padding: 0 0.16rem;
}

/* ---- Inspect overlay (Smith Gate-1 condition C1) --------------------
   Rules text is unreadable at card size, so hovering or focusing an RtG
   card opens a readable copy. Appended to <body>, not to the card, so it
   escapes the pile's overflow and the zone's stacking context. */
.rtg-inspect {
  position: fixed;
  z-index: 9000;
  width: 15rem;
  padding: 0.45rem;
  border-radius: 0.4rem;
  background: #24211b;
  color: #f2ece0;
  border: 1px solid #0d0b09;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  font-size: 0.72rem;
}

.rtg-inspect-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.rtg-inspect-name {
  font-weight: 700;
  font-size: 0.78rem;
}

.rtg-inspect .rtg-pip {
  width: 0.85rem;
  height: 0.85rem;
  font-size: 0.58rem;
  line-height: 0.85rem;
}

/* *nit (direct user report): "the card expand/hover is not the same
   ratio as the card so it looks funny and the top of the card image is
   cut off" - a fixed `height: 7rem` against a `width: 100%` (15rem,
   this overlay's own width) forced every card's portrait art (~0.7:1,
   `--card-aspect`) into a ~2.1:1 landscape crop, showing only a thin
   centre band of the illustration - EVERYTHING above and below that
   band is lost, not just "the top" specifically, but that's the part a
   viewer notices first since it's usually where the subject's head is.
   `aspect-ratio: var(--card-aspect)` makes this box the same shape as
   the resting card's own art, so `object-fit: cover` crops it the same
   way the player already sees at rest, just bigger. */
.rtg-inspect-art {
  display: block;
  width: 100%;
  aspect-ratio: var(--card-aspect);
  object-fit: cover;
  border-radius: 0.25rem;
  margin: 0.35rem 0;
}

.rtg-inspect-types {
  font-size: 0.68rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  padding-bottom: 0.2rem;
  margin-bottom: 0.25rem;
}

.rtg-inspect-rules { margin: 0 0 0.3rem; }

.rtg-inspect-flavor {
  margin: 0;
  font-style: italic;
  opacity: 0.72;
  font-size: 0.66rem;
}

.rtg-inspect-stats {
  text-align: right;
  font-weight: 700;
  margin-top: 0.3rem;
}

/* ---- Battlefield overflow (Smith Gate-1 condition C2) ---------------
   A battlefield routinely holds far more permanents than any other pile
   (10+ by the midgame). `.card-row` already wraps, but without a height
   ceiling the pile panel grows without bound and pushes the rest of the
   table off screen. Cap it and scroll INSIDE the pile, so the table
   layout stays stable no matter how wide the board gets.

   Scoped by `[data-kind='battlefield']`, which `PileElement` already
   sets - no JS change needed. */
[data-kind='battlefield'] .card-row {
  max-height: 15rem;
  overflow-y: auto;
  align-content: flex-start;
  /* *fix (queued 2026-09-10, "No Gears on RTG stacks?" then "move the
     gear to the top right of the stack"; nitted again 2026-09-29 to
     top-left): `.stack-gear` sits OUTSIDE its own stack's box (below,
     originally; the top edge, either corner, since), which is
     never part of this row's own auto-sized flow-content height - an
     auto-height `overflow:auto` box only ever sizes to its IN-FLOW
     children, so anything positioned outside a row-edge stack's own
     box is clipped by definition, regardless of the gear's own size
     (confirmed empirically both times: fixing the gear's oversized
     44px footprint alone did NOT stop the clipping either direction).
     Reserving the gear's real footprint (1.3rem + its 0.15rem gap,
     rounded up) as TOP padding now that it hangs off the top edge -
     only the first row's stacks are ever at risk (interior wrapped
     rows already have real gap space above them from the row before). */
  padding-top: 1rem;
}

/* ---- RtG art fallback (US-79) ---------------------------------------
   Art generation is quota-limited and runs as a separate build step, so
   a card may have no image yet. Rather than a broken-image icon, the
   card paints a colour-keyed panel: still readable, still playable, and
   obviously "art pending" rather than "broken". Multiple colour classes
   stack for gold cards, which is why each sets only one gradient stop. */
button.card-rtg.rtg-art-missing {
  background:
    linear-gradient(160deg, var(--rtg-fallback-a, #4a4a4a), var(--rtg-fallback-b, #1d1d1d));
}

.rtg-c-w { --rtg-fallback-a: #d9c98f; }
.rtg-c-u { --rtg-fallback-a: #5b93b0; }
.rtg-c-b { --rtg-fallback-a: #4d5648; }
.rtg-c-r { --rtg-fallback-a: #b1552f; }
.rtg-c-g { --rtg-fallback-a: #4f8f43; }
.rtg-c-c { --rtg-fallback-a: #6f7a80; }

/* The second colour of a gold card supplies the gradient's far stop. */
.rtg-c-u.rtg-c-w { --rtg-fallback-b: #24455a; }
.rtg-c-b.rtg-c-w,
.rtg-c-b.rtg-c-u { --rtg-fallback-b: #232a20; }
.rtg-c-r.rtg-c-w,
.rtg-c-r.rtg-c-u,
.rtg-c-r.rtg-c-b { --rtg-fallback-b: #5a2711; }
.rtg-c-g.rtg-c-w,
.rtg-c-g.rtg-c-u,
.rtg-c-g.rtg-c-b,
.rtg-c-g.rtg-c-r { --rtg-fallback-b: #20401d; }

/* US-120/D138: table talk - fixed to the bottom-left corner so it never
   pushes the table; desktop-only pass, like the rest of this UI. */
table-talk {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 50;
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}
/* US-123/D144: what was just touched glows in the colour of whoever
   touched it, and fades out on its own in about a second and a half
   (the user's "a second or two"). Colour is the primary "who" cue, not
   the only one - names stay on every seat (Gate 1 condition 4). The
   animation is cosmetic: it never blocks a pointer. */
@keyframes just-touched-fade {
  from { box-shadow: 0 0 0 3px var(--touch-color, #f2b134), 0 0 12px 4px var(--touch-color, #f2b134); }
  to { box-shadow: 0 0 0 0 transparent, 0 0 0 0 transparent; }
}
.just-touched {
  animation: just-touched-fade 1.5s ease-out forwards;
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .just-touched { animation-duration: 0.01ms; }
}

/* US-124: the host's own "watch only" option on the create screen. */
.checkbox-row { display: flex; align-items: center; gap: 6px; }

/* US-121/D142: a bot's thought bubble, on its seat. Collapsed it is one
   line; expanded it is a fixed panel holding the whole history, placed
   with the focus-zoom clamp so a seat at the table's edge still shows
   it fully. It closes on a click OUTSIDE, never on pointerleave - it
   scrolls, and a pointer-close would snatch it away mid-read. */
thought-bubble { display: block; margin-top: 2px; }
.thought-summary {
  max-width: 18rem;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}
.thought-open .thought-summary { border-color: var(--text); }
.thought-panel {
  position: fixed;
  z-index: 60;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  text-align: left;
  cursor: auto;
}
/* `hidden` must beat the panel's own `display: flex` - without this the
   whole history renders inline, unplaced, before anyone clicks it
   (found by LOOKING at the table, not by a test: the tests asserted the
   `hidden` PROPERTY, which was correct all along). */
.thought-panel[hidden] { display: none; }
.thought-entry { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--border); padding-top: 6px; }
.thought-entry:first-child { border-top: 0; padding-top: 0; }
.thought-move { font-weight: 600; }
.thought-considered, .thought-facts, .thought-jev-help { color: var(--muted); }
.thought-hand { overflow-wrap: anywhere; }

/* US-122: sits directly above table talk, in the same corner and the
   same panel language - it is part of the same conversation with the
   Jev player, and it is hidden entirely unless one is there (D143). */
add-bot {
  position: fixed;
  left: 12px;
  bottom: 232px;
  z-index: 50;
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}
add-bot[hidden] { display: none; }
.add-bot-heading { margin: 0; font-size: 12px; color: var(--muted); }
.add-bot-row { display: flex; gap: 6px; }
.add-bot-strategy { flex: 1; min-width: 0; }
.add-bot-status { margin: 0; color: var(--muted); overflow-wrap: anywhere; }

.talk-heading { margin: 0; font-size: 12px; color: var(--muted); }
.talk-log { margin: 0; padding: 0; list-style: none; max-height: 140px; overflow-y: auto; }
.talk-line { overflow-wrap: anywhere; }
.talk-form { display: flex; gap: 6px; }
.talk-input { flex: 1; min-width: 0; }
