/* ==========================================================================
   table.css — the table itself. Laid out for landscape: opponents left and
   right, the played trick in the middle, your fan along the bottom.
   Reads only the variables in tokens.css.
   ========================================================================== */

.table {
  position: fixed; inset: 0; display: grid; overflow: hidden;
  grid-template-rows: auto 1fr auto;
  /* One card width for the whole table. It lives here, not on .card, because
     .hand reserves its row height from it and a value set on the card itself
     would never reach an ancestor: the fan would then overflow upward and cover
     the trick. Each landing area overrides it on its own cards. */
  --card-w: clamp(44px, 7.4vw, 82px);
  /* The cloth, veiled so cards read over the print; the vignette is an inset
     shadow so it costs no extra layer. */
  background: var(--table-surface);
  box-shadow: var(--table-vignette);
}

/* --- head-up display -------------------------------------------------------
   Every readable thing up here is a card-stock tag laid on the cloth, so the
   bar itself carries no fill: text straight on the print would lose contrast
   wherever a peony sits behind it. */

.hud {
  display: flex; align-items: center; gap: clamp(8px, 1.6vw, 18px);
  padding: 8px clamp(10px, 2vw, 22px);
  background: transparent;
  border-bottom: 1px solid transparent;
  font-size: clamp(12px, 1.6vw, 15px);
}
.hud__spacer { flex: 1; }
.hud__pill {
  display: flex; align-items: baseline; gap: 6px; white-space: nowrap;
  padding: 5px 11px; border-radius: var(--r-pill);
  border: 1px solid var(--hairline); background: var(--pill-bg);
  box-shadow: var(--shadow-1);
  color: var(--text); font-family: var(--font-display); font-weight: 700;
}
.hud__pill b {
  font-size: 1.25em; font-weight: 700;
  /* One colour for every purse: gold and silver do not hold 4.5:1 on card
     stock, and the label beside the number already says which coin it is. */
  color: var(--red-deep);
  font-variant-numeric: lining-nums tabular-nums;
}
.hud__pill--table b { color: var(--text); }
.hud__pill--mult b { font-size: 1.35em; }
.hud .back-link {
  font-size: 1.3em; padding: 2px 8px; line-height: 1;
  color: var(--text); background: var(--stock); border-radius: var(--r-pill);
  /* An inset ring, not a border: .back-link has none, and adding one would grow the box. */
  box-shadow: var(--shadow-1), inset 0 0 0 1px var(--hairline);
}
.hud .back-link:hover { color: var(--red-hover); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--red); }
.fullscreen-toggle {
  font: inherit; font-size: 1.1em; line-height: 1; color: var(--text-secondary);
  background: var(--pill-bg); border: 1px solid var(--hairline); border-radius: var(--r-pill);
  box-shadow: var(--shadow-1);
  padding: 5px 9px; cursor: pointer;
}
.fullscreen-toggle:hover { color: var(--red-hover); border-color: var(--red); }
.fullscreen-toggle.is-on { color: var(--red); }
.hud__pill small { font-size: 0.9em; font-style: normal; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text-tertiary); }
/* The multiplier went up (a bomb or a rocket): the tag turns stool red, the
   same fill the landlord badge uses, so it reads as an event rather than a number. */
.hud__pill.is-hot { background: var(--red); border-color: var(--red); color: var(--on-red); }
.hud__pill.is-hot b { color: var(--on-red); }
/* display:flex above beats the UA [hidden] rule, so a pill that has nothing to
   show (no stake given) needs its own. */
.hud__pill[hidden] { display: none; }
.hud__pill--pot.is-pulse { animation: cg-pot-pulse var(--dur-med) var(--ease); }
@keyframes cg-pot-pulse {
  0% { transform: scale(1); opacity: 0.7; }
  40% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@media (max-width: 700px) { .hud__pill--pot small { display: none; } }

/* --- the cloth ------------------------------------------------------------ */

.felt { position: relative; min-height: 0; }

.seat {
  position: absolute; top: clamp(6px, 2vh, 20px);
  display: flex; flex-direction: column; gap: 6px; align-items: center;
  width: clamp(120px, 20vw, 210px);
}
.seat--left { left: clamp(8px, 2vw, 26px); }
.seat--right { right: clamp(8px, 2vw, 26px); }

.seat__plate {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 7px;
  border-radius: var(--r-pill); border: 1px solid var(--hairline);
  background: var(--plate-bg); box-shadow: var(--shadow-1);
  color: var(--text); font-family: var(--font-display); font-weight: 700;
  font-size: clamp(12px, 1.5vw, 14.5px); max-width: 100%;
  position: relative; /* anchors the turn glow below */
}
/* The ring's second pixel is a shadow, so the plate keeps its 1px border and
   its box. */
.seat__plate.is-turn { border-color: var(--red); box-shadow: 0 0 0 1px var(--red), var(--shadow-1); }
/* The glow is its own layer so that only its opacity pulses; animating the
   plate's box-shadow would repaint it every frame. An outer box-shadow is
   clipped to outside the border box, so the plate's contents stay clean. */
.seat__plate.is-turn::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 14px 2px color-mix(in srgb, var(--red) 55%, transparent);
  animation: cg-turn-glow 1.2s ease-in-out infinite alternate;
}
@keyframes cg-turn-glow {
  from { opacity: 0.35; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .seat__plate.is-turn::after { animation: none; opacity: 0.7; }
}
.seat__avatar {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 14px; font-weight: 700; color: var(--text);
  background: var(--hairline);
}
.seat__avatar.is-landlord { background: var(--red); color: var(--on-red); }
.seat__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat__count { color: var(--red-deep); white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
/* Sits on the cloth, not on a plate, and has no padding to hold a fill, so the
   cloth-coloured halo keeps it readable over a peony. */
.seat__role {
  font-size: var(--t-label); font-family: var(--font-display); font-weight: 700;
  font-style: normal; letter-spacing: 0.08em; text-transform: uppercase; color: var(--red-deep);
  text-shadow: 0 0 3px var(--cloth), 0 0 6px var(--cloth);
}
/* Bidding is the only turn with nothing to show for itself, so it is the only
   thing that still speaks. Reserving its height permanently (the old
   min-height) pushed the seat tall enough to overlap the play zone once the
   hand grew to spec 2's size, so an idle bubble now takes 0 space instead —
   only opacity animates (house rule), the height/padding just snap. */
.seat__say {
  max-height: 0; overflow: hidden; font-size: clamp(13px, 1.7vw, 16px);
  font-family: var(--font-display); font-weight: 700;
  color: var(--text); text-align: center; padding: 0 10px; border-radius: var(--r-pill);
  background: var(--stock); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--hairline);
  opacity: 0; transition: opacity var(--dur-med) var(--ease-std);
}
.seat__say.is-on { opacity: 1; max-height: 2.4em; padding: 3px 10px; }

.seat__backs { display: flex; justify-content: center; max-width: 100%; }
.seat__backs .card {
  /* Tied to viewport height, like the hand and the played cards, so a phone's
     browser-bar height (844x330) shrinks every card on the table together. */
  --card-w: clamp(26px, 6.5vh, 40px);
  /* A percentage margin would resolve against the row, not the card, and the fan
     would collapse across the cloth. Keep it proportional to the card instead. */
  margin-left: calc(var(--card-w) * -0.58);
  box-shadow: var(--card-shadow);
}
.seat__backs .card:first-child { margin-left: 0; }
/* Hand end: a leftover can be 20 cards, so the face-up hand wraps at ten a row.
   Every card carries the same negative left margin (so each row starts flush),
   and the container's padding takes it back; likewise the top margin and
   padding for the second row's overlap. Widths are multiples of --rev-w, not
   percentages, so the fan stays proportional to the card. */
.seat__backs.is-revealed {
  --rev-w: clamp(24px, 5.6vh, 36px);
  flex-wrap: wrap; justify-content: center; row-gap: 0;
  box-sizing: content-box; max-width: none;
  /* The extra pixel keeps sub-pixel rounding from bumping the tenth card to
     the next row. */
  width: calc(var(--rev-w) * 4.2 + 1px);
  padding: calc(var(--rev-w) * 0.7) 0 0 calc(var(--rev-w) * 0.58);
}
.seat__backs.is-revealed .card,
.seat__backs.is-revealed .card:first-child {
  --card-w: var(--rev-w);
  margin: calc(var(--rev-w) * -0.7) 0 0 calc(var(--rev-w) * -0.58);
  box-shadow: var(--card-shadow);
}

/* Pinned to the very top, centred, directly under the HUD — small enough
   that it costs the cloth almost nothing, which is what leaves the middle
   band free for the play zones below. The caption is gone (an aria-label on
   the container says it instead): at this height a text line was a third of
   the block's own size. */
.bottom-cards {
  position: absolute; top: 2px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center;
}
.bottom-cards__row { display: flex; gap: 3px; }
/* Height = card-w * 1.4, so 8.6vh of width is ~12vh of height — the 11-13%
   of viewport height the cards should read at, with a floor (28.6px wide,
   40px tall) so it never drops below readable even at 844x330. */
.bottom-cards .card { --card-w: clamp(28.6px, 8.6vh, 62px); }

/* --- the trick, one landing area per seat ---------------------------------
   Cards sit in front of whoever played them, so position answers "who" and the
   cloth needs no captions. The play still standing is the bright one; a finished
   trick greys out instead of vanishing. */

.play {
  position: absolute; display: flex; justify-content: center; align-items: center;
  min-height: clamp(54px, 11vh, 116px);
  transition: opacity var(--dur-slow) var(--ease-std), filter var(--dur-slow) var(--ease-std);
}
.play--left { left: 24%; top: 44%; transform: translate(-50%, -50%); }
.play--right { left: 76%; top: 44%; transform: translate(-50%, -50%); }
/* Landlord's three moved to a thin strip under the HUD (see .bottom-cards)
   specifically to free this band: self's own play now sits in the middle of
   the cloth, clear of both it and the floating controls pill below, instead
   of fighting either for the same few rows. */
.play--self { left: 50%; top: 54%; transform: translate(-50%, -50%); }

.play__cards { display: flex; justify-content: center; }
.play__cards .card {
  /* ~55% of the hand card's own vh-based size (20.5vh below), the middle of
     the spec's 50-60% band, so a play zone scales with the hand it came from. */
  --card-w: clamp(40px, 11.5vh, 82px);
  /* Never a percentage here: it would resolve against the row rather than the
     card, so every extra card widens the row, widens the margin, and collapses
     the fan into a stack. Keep the overlap proportional to the card. */
  margin-left: calc(var(--card-w) * -0.5);
}
.play__cards .card:first-child { margin-left: 0; }

.play.is-empty { opacity: 0; }
/* The trick is over: readable, but plainly in the past. */
.play.is-stale { opacity: 0.4; filter: saturate(0.6); }
/* The play everyone is trying to beat. */
.play.is-standing .play__cards .card { box-shadow: 0 0 0 2px var(--red), var(--card-shadow); }

.play__name {
  position: absolute; left: 50%; transform: translateX(-50%);
  /* -1.5em used to be flush with the caption's own line-height (~1.55em),
     so the caption's near edge landed on top of the card row it labels
     instead of beside it — 0-4px negative clearance, every seat, every
     size, once measured with getBoundingClientRect rather than eyeballed.
     -2em leaves a real gap regardless of viewport: the caption's font-size
     is a fixed rem, never vw/vh scaled, so a fixed em offset here clears it
     by the same margin everywhere. */
  bottom: -2em;
  white-space: nowrap; font-size: var(--t-caption); letter-spacing: 0.04em;
  /* Tight, like .bj-banner's own caption chip: the default 1.55 body
     line-height turns one line of text into a box a third taller than the
     glyphs need, which is exactly the margin the short-landscape query
     below is short on. */
  line-height: 1.1;
  /* Bare text on the cloth, like .seat__role: halo instead of a fill. Full
     opacity once shown, since .9 on the print would dip under 4.5:1. */
  color: var(--red-deep); font-family: var(--font-display); font-weight: 700;
  text-shadow: 0 0 3px var(--cloth), 0 0 6px var(--cloth);
  opacity: 0; transition: opacity var(--dur-med) var(--ease-std);
}
.play.is-standing .play__name { opacity: 1; }
/* Your own play sits just above the fan, so its caption goes above the cards
   rather than under them, where the hand would swallow it. */
.play--self .play__name { bottom: auto; top: -2em; }

.play__pass {
  font-size: clamp(13px, 1.7vw, 17px); color: var(--text-secondary);
  font-family: var(--font-display); font-weight: 700;
  padding: 5px 16px; border-radius: var(--r-pill);
  background: var(--stock); border: 1px solid var(--hairline); box-shadow: var(--shadow-1);
}

/* Cards travel in from the seat that played them — the other half of saying
   who moved without saying it. */
.play.is-entering .play__cards > * {
  animation: play-in var(--dur-slow) var(--ease) backwards;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.play--left.is-entering .play__cards > * { animation-name: play-in-left; }
.play--right.is-entering .play__cards > * { animation-name: play-in-right; }
.play--self.is-entering .play__cards > * { animation-name: play-in-self; }

@keyframes play-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes play-in-left {
  from { opacity: 0; transform: translate(-40%, -60%) scale(0.86) rotate(-6deg); }
  to { opacity: 1; transform: none; }
}
@keyframes play-in-right {
  from { opacity: 0; transform: translate(40%, -60%) scale(0.86) rotate(6deg); }
  to { opacity: 1; transform: none; }
}
/* 15%, not the 70% this started at: self's play zone now shares the cloth's
   middle band with the floating controls pill below it, and a card sliding
   in from most of its own height further down swept straight through that
   pill's space on the way — the entrance still reads as "from the hand",
   just without the overshoot. */
@keyframes play-in-self {
  from { opacity: 0; transform: translateY(15%) scale(0.88); }
  to { opacity: 1; transform: none; }
}

/* --- shuffle and deal ------------------------------------------------------
   Transform and opacity only, so the whole flourish stays on the compositor.
   Every phase of the deal — the shuffle flourish, each of the round-robin
   flights, the hand's gather and sorted re-spread, and the landlord's three —
   reuses the one cg-fly keyframe below; tableview.js writes the ten --f*/--t*
   custom properties per call and restarts the animation. Nothing here reads
   a guessed vw/vh: every from/to pair is pixels off the dealer stack's own
   measured centre, from tableview.js's single measurement pass. */

.dealer { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.dealer__card {
  position: absolute; left: 50%; top: 16%;
  width: clamp(40px, 9vh, 78px);
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
}

@keyframes cg-fly {
  from {
    transform: translate(calc(-50% + var(--fx, 0px)), calc(-50% + var(--fy, 0px)))
               rotate(var(--fr, 0deg)) scale(var(--fs, 1));
    opacity: var(--fo, 1);
  }
  to {
    transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, 0px)))
               rotate(var(--tr, 0deg)) scale(var(--ts, 1));
    opacity: var(--to, 1);
  }
}

/* Real destinations stay hidden until dealIn() hands over to them. Seat backs
   and the landlord's three hide per card (so each can be revealed the instant
   its own flyer lands, growing the visible count one at a time, per spec);
   the hand hides as a whole, because its own flyers stand in for it right up
   until the gather-and-sort finishes and every card is revealed together. No
   transition on any of these: a transition here would run from whatever
   opacity a just-unhidden element had a moment before, flashing it. */
.table.is-dealing-left .seat--left .seat__backs .card,
.table.is-dealing-right .seat--right .seat__backs .card,
.table.is-dealing-bottom .bottom-cards .card,
.table.is-dealing-self .hand,
.table.is-dealing-bid .bid-panel {
  opacity: 0;
  /* Invisible but still clickable would let a fast tap bid before the cards
     have landed. */
  pointer-events: none;
}

.bid-panel {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  text-align: center; padding: 18px 26px; border-radius: var(--r-ui);
  border: 1px solid var(--hairline); background: var(--panel-solid);
  box-shadow: var(--shadow-paper); max-width: min(92vw, 460px);
}
.bid-panel h2 { margin: 0 0 4px; font-size: clamp(19px, 2.8vw, 26px); font-weight: 800; color: var(--red-deep); }
.bid-panel p { margin: 0 0 14px; font-size: 15px; color: var(--text-tertiary); }
.bid-panel .btn-row { justify-content: center; }

/* --- your hand ------------------------------------------------------------
   Sized off the viewport's height, not its width: a phone's browser bar eats
   height, not width, so tying the card to vh is what keeps it big at 844x390
   and still legible at 844x330. Height = width / (100/140), i.e. width*1.4. */

.dock {
  display: flex; flex-direction: column;
  padding: 4px clamp(10px, 2vw, 22px) 0;
  background: var(--scrim-light);
}

.hand {
  /* A custom property named --hand-card-h, because the house rule reserves
     the literal name "--card-w" for .table and a .card selector, and .hand
     is neither. .hand .card below derives its own --card-w from this one
     number instead of repeating the clamp, so .hand's own height (which the
     card's --card-w can't reach — custom properties cascade down only, and
     .hand is the card's ancestor, not its descendant) still matches the
     card it is sized around. */
  --hand-card-h: clamp(100.8px, 28.7vh, 207.2px);
  position: relative; height: var(--hand-card-h);
  margin: 0 auto; width: 100%;
  transition: transform var(--dur-slow) var(--ease-std), opacity var(--dur-slow) var(--ease-std);
}
/* Whose move it is, said by the fan itself: it rises 5% of a card when it is
   yours and sits back a little when it is not. The lift is on this wrapper
   because .hand__inner below already owns a transform. */
.hand.is-mine { transform: translateY(calc(var(--hand-card-h) * -0.05)); }
.hand.is-waiting { opacity: 0.82; }
/* dealIn hides the hand when the deal starts and un-hides it in the step that
   removes the flyers; a fade at either end would show the real hand half-
   visible for 220ms (tableview.js snapHand). */
.hand.is-snap { transition: none; }
.hand .card { --card-w: calc(var(--hand-card-h) / 1.4); }
/* The hand hugs the bottom edge and is let run off it: up to 18% of every
   card's height, but never the top-left index, which sits in the top 30%. A
   percentage transform resolves against the element's own box, not the row,
   so this stays exactly "18% of a card" regardless of how many cards there
   are — .table's own overflow:hidden (it fills the viewport exactly) is what
   actually crops it, at the real screen edge rather than a guessed pixel. */
.hand__inner {
  position: absolute; left: 50%; height: 100%;
  transform: translate(-50%, calc(var(--hand-card-h) * 0.18));
}

.card {
  /* The fallback only matters for a card rendered outside .table. */
  width: var(--card-w, clamp(44px, 7.4vw, 82px)); aspect-ratio: 100 / 140; padding: 0; border: 0;
  background: none; display: block; line-height: 0;
  /* A box-shadow on the element beats a drop-shadow on the artwork: the filter
     is evaluated per pixel of a forty-card table, the shadow is not. */
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  /* Everything below is inherited into the <use> shadow tree, which outer
     selectors cannot reach. It is how the artwork gets its suit colour and its
     typeface. */
  font-family: var(--font-display);
  font-weight: 700;
  font-variant-numeric: lining-nums;
  font-feature-settings: 'lnum' 1;
}
.card-svg, .cg-card-svg { width: 100%; height: 100%; display: block; }

/* A bomb in a hand (cardart.js markBomb): the lower half gilded, a badge pinned
   under the index. Hand cards only — they are position:absolute, so both the
   wash and the badge anchor to the card. The wash is multiplied into the stock
   so the ink index and pip stay dark through it. isolation keeps that blend and
   the badge's z-index inside this one card, so the neighbour that overlaps it
   in the fan still covers both. */
.hand .card.is-bomb { isolation: isolate; }
.hand .card.is-bomb::after {
  /* Starts just under the suit pip (it ends at 53%) and is nearly solid at once:
     a hand shows only the top ~82% of a card, so a long fade left the visible
     part reading as cream. */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; top: 52%;
  border-radius: 0 0 var(--card-radius) var(--card-radius);
  background: linear-gradient(to bottom, var(--bomb-gold-top) 0%, var(--bomb-gold-mid) 6%, var(--bomb-gold-low) 100%);
  mix-blend-mode: multiply; pointer-events: none;
}
/* Centred under the index (x = 21 of 100, the rank's own centre) and inside the
   strip a 20-card fan leaves showing, which can shrink to 0.376 of the card at
   1280 wide. Its bottom (about 80% of the card) clears the 18% the hand runs off
   the screen. Percentages here resolve against the card box, which is what is
   wanted; the no-percentage rule is about fan margins. */
.card__bomb {
  position: absolute; z-index: 1; pointer-events: none;
  left: 5%; top: 57%; width: 32%; aspect-ratio: 1;
  border-radius: 50%; background: var(--bomb-badge);
  box-shadow: 0 0 0 1.5px var(--bomb-badge-ring), 0 1px 3px rgba(60, 20, 20, 0.4);
  display: grid; place-items: center;
}
.card__bomb svg { width: 78%; height: 78%; display: block; }

.hand .card {
  position: absolute; bottom: 0; left: calc(var(--i) * var(--step));
  /* Sideways travel while the hand is being rearranged (handdrag.js sets --dx).
     It rides on `translate`, not `transform`, so it stacks with the hover and
     selected lift below instead of replacing it. */
  translate: var(--dx, 0px) 0;
  transition: transform var(--dur-fast) var(--ease-std), translate var(--dur-fast) var(--ease-std), filter var(--dur-fast) var(--ease-std);
  cursor: pointer; border-radius: var(--card-radius);
  /* A drag along the fan has to arrive as pointer events, not as a scroll or a
     pinch of the page; select: none keeps the press from highlighting text. */
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.hand .card:hover { transform: translateY(calc(var(--card-w) * 1.4 * -0.08)); }
/* ~22% of card height, per spec. */
.hand .card.is-selected { transform: translateY(calc(var(--card-w) * 1.4 * -0.22)); box-shadow: 0 0 0 2px var(--red), var(--shadow-paper); }
.hand .card.is-hinted .cg-card-svg { outline: 2px solid var(--red); outline-offset: -2px; border-radius: var(--card-radius); }
.hand .card:focus-visible { outline: var(--focus-outline); outline-offset: 3px; }
/* Being dragged: lifted about 12% of its height (a selected card, already up
   22%, goes further) and above the fan. Its own `translate` has no transition so
   it tracks the pointer exactly; the cards it passes slide aside on the ordinary
   one. On release the transition returns and it eases into its slot. */
.hand .card.is-dragging {
  z-index: 10; cursor: grabbing; box-shadow: var(--shadow-paper);
  transform: translateY(calc(var(--card-w) * 1.4 * -0.12));
  transition: transform var(--dur-fast) var(--ease-std);
}
.hand .card.is-dragging.is-selected {
  transform: translateY(calc(var(--card-w) * 1.4 * -0.28));
  box-shadow: 0 0 0 2px var(--red), var(--shadow-paper);
}
.hand .card.is-dropping { z-index: 10; }

/* No legal answer: the whole fan greys and stops responding, so Pass is plainly
   the only move left. Said without a sentence. */
.hand.is-stuck .card { filter: grayscale(1) brightness(0.62); cursor: default; }
.hand.is-stuck .card:hover { transform: none; }

/* Floats over the cloth, just above the hand, instead of costing the dock a
   row of its own — the reference does the same with its Fight/Skip buttons. */
.controls {
  position: absolute; left: 50%; bottom: 2px; z-index: 4;
  /* Settled down and dim until it is your move (.is-mine); the buttons are
     already disabled by then, this just stops the bar looking live. */
  transform: translate(-50%, 6px); opacity: 0.55;
  transition: transform var(--dur-med) var(--ease-std), opacity var(--dur-med) var(--ease-std);
  display: flex; align-items: center; justify-content: center; gap: clamp(6px, 1.2vw, 14px); flex-wrap: nowrap;
  max-width: 94%; padding: 6px clamp(10px, 1.6vw, 16px); border-radius: var(--r-ui);
  background: var(--controls-bg); border: 1px solid var(--hairline); box-shadow: var(--shadow-paper);
}
.controls.is-mine { transform: translate(-50%, 0); opacity: 1; }
/* Reduced motion keeps the dim and drops the lift and the settle. */
@media (prefers-reduced-motion: reduce) {
  .hand.is-mine { transform: none; }
  .controls, .controls.is-mine { transform: translate(-50%, 0); }
}
.controls__you {
  font-size: clamp(12px, 1.6vw, 14.5px); color: var(--text-secondary); white-space: nowrap;
  font-family: var(--font-display); font-weight: 700;
}
.controls .btn { padding: clamp(6px, 1vh, 9px) clamp(10px, 1.8vw, 18px); font-size: clamp(13px, 1.7vw, 16px); }
/* Bidding has its own panel (Pass/1/2/3); Hint/Pass/Play do nothing until
   play starts, and floating both over a short table is how they overlapped. */
.controls.is-hidden { display: none; }
/* Hand over: the result sheet now waits a second, so the bar must go at once.
   visibility, not display, keeps the layout (and the hand) where it is. */
.controls.is-ended { visibility: hidden; }

/* --- overlays ------------------------------------------------------------- */

.overlay {
  position: fixed; inset: 0; z-index: var(--z-overlay); display: grid; place-items: center; padding: 18px;
  /* A veil of card stock rather than a dark scrim: the sheet is stock too, so
     it is its border and paper shadow that lift it off the pale table. */
  background: var(--panel); backdrop-filter: blur(3px);
  /* visibility flips at once on show so the fade is visible, and while pending
     it keeps the buttons out of reach of taps and Tab. */
  transition: opacity var(--dur-slow) var(--ease-std), visibility 0s;
}
.overlay.is-pending { opacity: 0; visibility: hidden; pointer-events: none; }
.result {
  width: min(92vw, 520px); text-align: center; padding: 26px 26px 22px; border-radius: var(--r-ui);
  border: 1px solid var(--hairline); background: var(--panel-solid);
  box-shadow: var(--shadow-paper);
}
.result__title { font-size: clamp(26px, 5.2vw, 38px); font-weight: 800; margin: 0 0 4px; }
.result__title.is-win { color: var(--red-deep); }
.result__title.is-loss { color: var(--text-secondary); }
.result__delta { font-size: clamp(22px, 4.2vw, 30px); font-family: var(--font-display); font-weight: 700; margin: 6px 0 14px; font-variant-numeric: lining-nums tabular-nums; }
.result__delta.is-win { color: var(--ok); }
.result__delta.is-loss { color: var(--danger); }
.result__lines { list-style: none; margin: 0 0 18px; padding: 0; font-size: 15px; line-height: 1.5; color: var(--text-secondary); display: grid; gap: 6px; }
.result__lines span { color: var(--red-deep); font-weight: 700; }

.rotate-gate { display: none; }
@media (orientation: portrait) and (max-width: 960px) {
  .rotate-gate {
    position: fixed; inset: 0; z-index: var(--z-rotate-gate); display: grid; place-items: center; text-align: center;
    padding: 30px; background: var(--panel-solid); color: var(--text);
  }
  .rotate-gate__icon { font-size: 46px; margin-bottom: 14px; color: var(--red); }
  .rotate-gate h2 { margin: 0 0 8px; font-size: 25px; font-weight: 800; color: var(--red-deep); }
  .rotate-gate p { margin: 0; max-width: 34ch; color: var(--text-tertiary); line-height: 1.6; }
}

/* Very short landscape windows (phones) get smaller cards so the fan still fits,
   and the landing areas pull in and down to clear the seats' card backs. */
@media (orientation: landscape) and (max-height: 460px) {
  /* Card sizes are vh-driven already (see .hand/.play__cards/.seat__backs/
     .bottom-cards above) and shrink themselves at this height; only the
     positions that would otherwise collide need a phone-with-a-browser-bar
     override here. */
  .seat { top: 2px; }
  .hud { padding-top: 4px; padding-bottom: 4px; }
  .play { min-height: clamp(40px, 9vh, 80px); }
  .play--left { left: 27%; top: 54%; }
  .play--right { left: 73%; top: 54%; }
  /* Tighter than the default 54%: at these heights the gap between the
     (now tiny) landlord's three and the floating controls pill is narrow
     enough that self's own card needs to sit nearer the top of it to clear
     both, at 844x330 especially. */
  /* 45% left only ~9px above the cards (against the landlord's three) and
     ~17px below (against the controls pill): tight, but it was tuned for a
     caption sitting above, clear of both by construction. Flipping the
     caption below (next rule) needs a single corridor >= 4px + the caption's
     own height + 4px in one place, and 17px alone isn't quite it — so this
     also nudges the whole zone up a few px, trading some of the (unused,
     ungraded) margin above the cards for the margin the caption needs below. */
  .play--self { top: 40.5%; }
  /* Self's play sits close enough under the landlord's three here that a
     caption above the cards (the non-query rule) prints across them — the
     defect this query exists to fix. There's no headroom to spare above at
     this height, only below, so self borrows the opponents' below-the-cards
     placement for the duration of this query. -1.5em rather than the shared
     -2em above: this corridor is the tightest on the table, and 1.5em is as
     far as the (now tightened, see .play__name's line-height) caption needs
     to clear its own cards by >= 4px. */
  .play--self .play__name { top: auto; bottom: -1.5em; }
}

/* A phone's browser bar can shrink height past what the 460px query above
   was tuned for: at ~330-350px, self's own played cards — still at
   .play__cards's general 40px floor — land under 4px below the landlord's
   three. Only self's cards need to shrink: the landlord's three itself
   doesn't move, and the left/right opponents' played cards sit clear of it
   horizontally already (.play--left/.play--right are off-centre; the
   landlord's three is pinned to the middle). 37px is set by the layout, not by the index: the bold index's rank has
   a cap height of ~16.8 of the card's 140 units, so at 37px wide (51.8px
   tall) it is ~6px — smaller than the 12px the old digit corner kept. 41.6% (nudged down
   from the 460px query's 40.5%, to match the shorter card) splits the
   now-larger slack evenly: ~5px clear of the landlord's three above the
   cards, ~5px clear of the controls pill below the caption. */
@media (orientation: landscape) and (max-height: 350px) {
  .play--self .play__cards .card { --card-w: 37px; }
  .play--self { top: 41.6%; }
}
