/* ==========================================================================
   big2.css — the Big Two table. Four seats (you at the bottom, opponents
   left/top/right), a played-card zone per seat, and a hand sized and placed
   exactly like Dou Di Zhu's (see .b2-hand below). A separate
   implementation from table.css's three-seat Dou Di Zhu table: nothing here
   is shared with .table/.felt/.seat/.play, only the tokens both read and the
   bare .card box table.css defines (width/aspect-ratio/colour), which every
   table in the app reuses. Sizes below are tuned and measured at 844x390,
   844x330 and 1280x720 — anything expressed in vh rather than px is there so
   a phone's browser-bar height (844x330) shrinks the whole table together
   instead of clipping it.
   ========================================================================== */

.b2-table {
  position: fixed; inset: 0; display: grid; overflow: hidden;
  grid-template-rows: auto 1fr auto;
  --card-w: clamp(36px, 6vw, 70px);
  /* Declared here, not on .b2-hand, because .b2-controls (a sibling of the dock)
     needs it too: it clears the raised card by a share of this height. Same
     clamp as table.css's --hand-card-h, so the two tables' hands match. */
  --b2-hand-h: clamp(100.8px, 28.7vh, 207.2px);
  /* The cloth, veiled so cards read over the print (same recipe as table.css). */
  background: var(--table-surface);
  box-shadow: var(--table-vignette);
}

/* --- head-up display -------------------------------------------------------
   Card-stock tags laid straight on the cloth; the bar has no fill of its own,
   since bare text on the print would lose contrast behind a peony. */

.b2-hud {
  display: flex; align-items: center; gap: clamp(8px, 1.6vw, 18px);
  padding: 6px clamp(10px, 2vw, 22px);
  background: transparent;
  border-bottom: 1px solid transparent;
  font-size: clamp(11px, 1.5vw, 14px);
}
.b2-hud__spacer { flex: 1; }
.b2-hud__pill {
  display: flex; align-items: baseline; gap: 6px; white-space: nowrap;
  padding: 4px 10px; 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;
}
.b2-hud__pill b { font-size: 1.2em; font-weight: 700; color: var(--red-deep); font-variant-numeric: lining-nums tabular-nums; }
.b2-hud__pill--table b { color: var(--text); }
.b2-hud__pill--table small { margin-left: 4px; }
.b2-hud__pill small { font-size: 0.9em; font-style: normal; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text-tertiary); }
.b2-hud__pill[hidden] { display: none; }
@media (max-width: 700px) { .b2-hud__pill--pot small { display: none; } }
.b2-hud .back-link {
  font-size: 1.25em; 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);
}
.b2-hud .back-link:hover { color: var(--red-hover); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--red); }

/* --- the cloth ---------------------------------------------------------------
   seatTop, playTop, a flexible spacer, playSelf and controls are real flow
   children of this column now, not four independent top:NN% guesses: a
   fixed percentage for playTop and playSelf, tuned only against their own
   card row, is exactly what let each zone's caption (positioned outside
   that row, see .b2-play__name below) reach into the other's space without
   either box's height accounting for it. Flow makes the caption part of its
   own zone's height, so the spacer — not arithmetic — is what keeps them
   apart, at every viewport this table supports. Left/right seats and plays
   float beside this column and stay position:absolute, unchanged. */

.b2-felt { position: relative; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.b2-spacer { flex: 1 1 0; }

.b2-seat {
  display: flex; flex-direction: column; gap: 4px; align-items: center;
  width: clamp(100px, 17vw, 176px);
}
/* flex-shrink:0 — a flex column's default shrink would rather compress this
   box below its content size than let the spacer do it, and a compressed
   box's overflowing content is what re-creates the exact sibling-overlap
   this whole restructure exists to remove. Only .b2-spacer may give. */
.b2-seat--top { margin-top: clamp(2px, 1vh, 8px); flex-shrink: 0; }
.b2-seat--left, .b2-seat--right { position: absolute; top: 50%; transform: translateY(-50%); }
.b2-seat--left { left: clamp(4px, 1.4vw, 16px); align-items: flex-start; }
.b2-seat--right { right: clamp(4px, 1.4vw, 16px); align-items: flex-end; }

.b2-seat__plate {
  display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 6px;
  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(11px, 1.4vw, 13.5px); max-width: 100%;
}
/* The ring beyond the 1px border is a shadow, so the plate keeps its box. The
   glow is a pseudo-element so only its opacity pulses: animating box-shadow
   itself would repaint the plate every frame. */
.b2-seat__plate { position: relative; }
.b2-seat__plate::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: 0 0 14px 2px color-mix(in srgb, var(--red) 55%, transparent);
  opacity: 0; pointer-events: none;
}
.b2-seat__plate.is-turn { border-color: var(--red); box-shadow: 0 0 0 2px var(--red), var(--shadow-1); }
.b2-seat__plate.is-turn::after { animation: b2-turn-glow 1.2s ease-in-out infinite alternate; }
@keyframes b2-turn-glow {
  from { opacity: 0.35; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .b2-seat__plate.is-turn::after { animation: none; opacity: 0.7; }
}
.b2-seat__avatar {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 12px; font-weight: 700; color: var(--text);
  background: var(--hairline);
}
.b2-seat__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 12ch; }
.b2-seat__count { color: var(--red-deep); white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
/* Stool red against the deep red of every other count: the one hand a follower
   most needs to notice (F4). */
.b2-seat__count.is-last-card { color: var(--red); font-weight: 800; }

.b2-seat__backs { display: flex; justify-content: center; max-width: 100%; }
.b2-seat__backs .card {
  --card-w: clamp(20px, 4.6vh, 32px);
  margin-left: calc(var(--card-w) * -0.62);
  box-shadow: var(--card-shadow);
}
.b2-seat__backs .card:first-child { margin-left: 0; }
/* Hand end: the stack becomes the real, face-up hand, revealed in place — a
   touch bigger than the backs it replaces, since it is now meant to be read. */
.b2-seat__backs.is-revealed .card { --card-w: clamp(24px, 5.4vh, 40px); margin-left: calc(var(--card-w) * -0.42); box-shadow: var(--card-shadow); }

/* --- the trick, one landing zone per seat ---------------------------------- */

.b2-play {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: clamp(38px, 9vh, 84px);
  flex-shrink: 0; /* see .b2-seat--top's comment above */
  transition: opacity 300ms var(--ease-std);
}
.b2-play--left, .b2-play--right { position: absolute; top: 50%; transform: translate(-50%, -50%); }
.b2-play--left { left: 27%; }
.b2-play--right { left: 73%; }

.b2-play__cards { display: flex; justify-content: center; }
.b2-play__cards .card {
  /* 24px floor, down from the 28px every other clamp on this table uses,
     because this is the one box that has to share its corridor with a
     second copy of itself (playTop's cards+caption stacked against
     playSelf's) inside the same north/south flow — see .b2-felt above. */
  --card-w: clamp(24px, 8vh, 58px);
  margin-left: calc(var(--card-w) * -0.5);
}
.b2-play__cards .card:first-child { margin-left: 0; }

/* A table-wide notice (someone left / is back). Out of flow, opacity-only fade,
   and never intercepts a tap meant for the cards or controls underneath. */
.b2-caption {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%);
  z-index: 3; max-width: 44%; text-align: center; pointer-events: none;
  padding: 4px 12px; border-radius: var(--r-pill);
  background: var(--stock); color: var(--text);
  box-shadow: var(--shadow-1), inset 0 0 0 1px var(--hairline);
  font-family: var(--font-display); font-weight: 700;
  font-size: var(--t-caption); line-height: 1.3;
  opacity: 0; transition: opacity 240ms var(--ease-std);
}
.b2-caption.is-shown { opacity: 1; }

.b2-play.is-empty { opacity: 0; }
.b2-play.is-fading { opacity: 0; }

.b2-play__name {
  white-space: nowrap; font-size: var(--t-caption); letter-spacing: 0.04em; line-height: 1.1;
  /* Bare text on the cloth, so a cloth-coloured halo stands in for a fill, and
     full opacity once shown: .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 200ms var(--ease-std);
}
.b2-play:not(.is-empty):not(.is-fading) .b2-play__name { opacity: 1; }

.b2-play.is-entering .b2-play__cards > * {
  animation: b2-play-in 220ms var(--ease) backwards;
  animation-delay: calc(var(--i, 0) * 40ms);
}
@keyframes b2-play-in {
  from { opacity: 0; transform: translateY(-8%) scale(0.88); }
  to { opacity: 1; transform: none; }
}

/* --- controls: last item in the cloth's north/south flow, just above the
   hand -------------------------------------------------------------------
   F4's "Your lead — include 3♦" line (first play of the hand only) shares
   .b2-controls__label with the ordinary selection feedback rather than
   taking a spot of its own — see big2.js's renderControls(): the two never
   apply at once, and the cloth has no free band left for a fifth floating
   element at 844x330. */

.b2-controls {
  /* A selected card ends up 4% of its height above the hand box (it rises 22%,
     the run-off below pushed it 18% down), and the dock's 2px top padding
     already counts toward the gap, so this leaves the same >=2px of daylight
     above the red ring the old headroom did. Plus the 5% the hand lifts on your
     turn (.b2-hand.is-mine), which otherwise eats that daylight. */
  margin-bottom: calc(var(--b2-hand-h) * 0.09 + 2px); z-index: 4; flex-shrink: 0; /* see .b2-seat--top's comment */
  display: flex; align-items: center; justify-content: center; gap: clamp(5px, 1vw, 12px); flex-wrap: nowrap;
  max-width: 96%; padding: 5px clamp(8px, 1.4vw, 14px); border-radius: var(--r-ui);
  background: var(--controls-bg); border: 1px solid var(--hairline); box-shadow: var(--shadow-paper);
  transition: opacity var(--dur-med) var(--ease-std), transform var(--dur-med) var(--ease-std);
}
/* Off your turn the bar recedes; JS only sets this while a hand is in play, so
   the result reveal and the deal keep their own rules. */
.b2-controls.is-waiting { opacity: 0.55; transform: translateY(6px); }
/* Hand over: hidden during the reveal, but in flow so nothing shifts. */
.b2-controls.is-ended { visibility: hidden; }
.b2-controls .btn { padding: clamp(5px, 0.9vh, 8px) clamp(8px, 1.6vw, 16px); font-size: clamp(12px, 1.5vw, 15px); }
.b2-controls__label { font-size: clamp(11px, 1.4vw, 13.5px); color: var(--text-secondary); font-family: var(--font-display); font-weight: 700; white-space: nowrap; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; }

/* --- your hand --------------------------------------------------------------
   The same rule as Dou Di Zhu's fan (table.css .hand): the hand hugs the bottom
   edge and the lowest 18% of every card runs off the screen. The index sits in
   the top 53% of a card, so nothing a player reads is lost, and the cards stay
   as large as that table's. This replaces the earlier keep-the-whole-card-on-
   screen rule, which left the fan at about 60% of Dou Di Zhu's size. */

.b2-dock {
  display: flex; flex-direction: column; align-items: center;
  /* No bottom padding: the run-off has to reach the screen edge, which
     .b2-table's overflow:hidden then crops. */
  padding: 2px clamp(10px, 2vw, 22px) 0;
  background: var(--scrim-light);
}

.b2-hand {
  position: relative; height: var(--b2-hand-h);
  margin: 0 auto; width: 100%;
  transition: transform var(--dur-slow) var(--ease-std), opacity var(--dur-slow) var(--ease-std);
}
/* The lift goes on this wrapper because .b2-hand__inner already carries the
   18% run-off transform. 5% of a card's height, and a card is --b2-hand-h tall. */
.b2-hand.is-mine { transform: translateY(calc(var(--b2-hand-h) * -0.05)); }
.b2-hand.is-waiting { opacity: 0.82; }
/* Reduced motion keeps the dim and drops the lift and the settle. */
@media (prefers-reduced-motion: reduce) {
  .b2-hand.is-mine { transform: none; }
  .b2-controls.is-waiting { transform: none; }
}
.b2-hand .card { --card-w: calc(var(--b2-hand-h) / 1.4); }
/* 18% of one card's height, taken off --b2-hand-h as table.css does. */
.b2-hand__inner {
  position: absolute; left: 50%; bottom: 0; height: 100%;
  transform: translate(-50%, calc(var(--b2-hand-h) * 0.18));
}

.b2-hand .card {
  position: absolute; bottom: 0; left: calc(var(--i) * var(--step));
  /* Rearranging the hand (handdrag.js sets --dx): see table.css .hand .card. */
  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);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.b2-hand .card:hover { transform: translateY(calc(var(--card-w) * 1.4 * -0.08)); }
.b2-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); }
.b2-hand .card:focus-visible { outline: var(--focus-outline); outline-offset: 3px; }
/* Dragged and dropped states: the same as table.css .hand .card.is-dragging. */
.b2-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);
}
.b2-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);
}
.b2-hand .card.is-dropping { z-index: 10; }

/* --- shuffle and deal -------------------------------------------------------
   Transform and opacity only. One flight leg (b2-fly) is reused for every
   phase of the deal, the same way table.css's cg-fly is: big2.js writes the
   ten --f*/--t* custom properties per call and restarts the animation. */

.b2-dealer { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.b2-dealer__card, .b2-dealer__flyer {
  position: absolute; left: 50%; top: 50%;
  width: clamp(34px, 7.5vh, 64px);
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
}

@keyframes b2-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);
  }
}

.b2-table.is-dealing .b2-seat__backs .card,
.b2-table.is-dealing .b2-hand,
.b2-table.is-dealing .b2-controls {
  opacity: 0;
  pointer-events: none;
}

/* --- overlays ---------------------------------------------------------------
   Independent of table.css's .overlay/.result: same look, own classes, so a
   change to one table's result sheet can never silently move the other's. */

.b2-overlay {
  position: fixed; inset: 0; z-index: var(--z-overlay); display: grid;
  /* Read by .b2-result's max-height below too, so the clearance the padding
     promises and the cap that keeps the sheet inside it can't drift apart. */
  --b2-result-pad-y: max(18px, 23vh);
  /* "safe center", not plain center: a plain center overflows equally in both
     directions once the item is taller than the padded area, which is
     exactly what let an unusually long result (multiple optional lines at
     once — capped loss and a bankrupt notice together) push back up above
     the top padding and into seatTop's plate/revealed cards at 1280x720.
     "safe" falls back to start alignment rather than let that happen, so the
     23vh top padding below is a genuine floor on the sheet's top edge, not
     just the common case. */
  align-items: safe center; justify-items: center;
  /* Top padding alone, not the centering math, is what has to clear seatTop's
     plate and revealed cards. 23vh clears that band with margin at 720.
     Reverted to a plain 8px for the short-landscape query below, where this
     table is a different shape (phones use the collapse toggle for this,
     not headroom — see .is-collapsed there). */
  padding: var(--b2-result-pad-y) 18px 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;
}
.b2-overlay.is-pending { opacity: 0; visibility: hidden; pointer-events: none; }
.b2-result {
  width: min(92vw, 540px);
  /* Capped to the space the overlay's own padding actually leaves, not a flat
     90vh: "safe center" only protects the sheet's top edge from riding up
     over seatTop, it does nothing about the bottom edge. Content long enough
     to exceed this (worst case: 4 rows plus every optional line at once —
     measured 610px against ~536px available at 1280x720) now scrolls inside
     the box via overflow-y instead of pushing past the viewport's own edge. */
  max-height: min(90vh, calc(100vh - var(--b2-result-pad-y) - 18px));
  overflow-y: auto; text-align: center;
  padding: 24px 26px 20px; border-radius: var(--r-ui);
  border: 1px solid var(--hairline); background: var(--panel-solid);
  box-shadow: var(--shadow-paper);
}
.b2-result__head { margin: 0 0 14px; }
.b2-result__title { font-size: clamp(24px, 5vw, 36px); font-weight: 800; margin: 0 0 4px; }
.b2-result__title.is-win { color: var(--red-deep); }
.b2-result__title.is-loss { color: var(--text-secondary); }
.b2-result__big-delta { font-size: clamp(20px, 4vw, 28px); font-family: var(--font-display); font-weight: 700; margin: 0; font-variant-numeric: lining-nums tabular-nums; }
.b2-result__big-delta.is-win { color: var(--ok); }
.b2-result__big-delta.is-loss { color: var(--danger); }

.b2-result__rows { display: grid; gap: 4px; margin: 0 0 16px; padding: 10px 12px; border-radius: var(--r-md); background: var(--cloth); box-shadow: inset 0 0 0 1px var(--hairline); }
.b2-result__row { display: flex; align-items: baseline; gap: 10px; font-size: 14.5px; padding: 3px 0; }
.b2-result__row.is-winner .b2-result__name { color: var(--red-deep); font-weight: 700; }
.b2-result__name { flex: 1; text-align: left; color: var(--text-secondary); }
.b2-result__cards { color: var(--text-tertiary); font-variant-numeric: lining-nums tabular-nums; }
.b2-result__delta { min-width: 6ch; text-align: right; font-variant-numeric: lining-nums tabular-nums; }
.b2-result__delta.is-win { color: var(--ok); }
.b2-result__delta.is-loss { color: var(--danger); }

.b2-result__lines { list-style: none; margin: 0 0 18px; padding: 0; font-size: 14.5px; line-height: 1.5; color: var(--text-secondary); display: grid; gap: 6px; }
.b2-result__lines span { color: var(--red-deep); font-weight: 700; }

/* Small, unobtrusive: this is a secondary escape hatch (Leave/Next hand are
   the primary actions), not another button competing with them. */
.b2-result__toggle {
  display: block; margin: 10px auto 0; padding: 4px 10px; background: none; border: 0;
  font-family: var(--font); font-size: 12.5px; color: var(--text-tertiary); text-decoration: underline;
  cursor: pointer;
}
.b2-result__toggle:hover { color: var(--red-hover); }

/* --- "Show table": collapses the sheet to a slim bar so F4's face-up reveal
   is actually visible, not just technically present under a dimmed modal.
   Docked over the HUD rather than the cloth itself: the HUD is the one band
   on this table with no seat plate or card in it at any viewport, so a bar
   confined to that band can never cover a revealed hand by construction,
   without having to chase seat positions across three screen sizes. */
.b2-overlay.is-collapsed {
  place-items: start center; padding: 6px 12px; background: transparent; backdrop-filter: none;
  pointer-events: none;
}
.b2-overlay.is-collapsed .b2-result {
  display: flex; align-items: baseline; gap: 12px; width: auto; max-width: 92vw; max-height: none; overflow: visible;
  padding: 6px 8px 6px 16px; cursor: pointer; pointer-events: auto;
}
.b2-overlay.is-collapsed .b2-result__head { display: flex; align-items: baseline; gap: 8px; margin: 0; }
.b2-overlay.is-collapsed .b2-result__title { font-size: 14px; }
.b2-overlay.is-collapsed .b2-result__big-delta { font-size: 14px; }
.b2-overlay.is-collapsed .b2-result__rows,
.b2-overlay.is-collapsed .b2-result__lines,
.b2-overlay.is-collapsed .b2-result__toggle,
.b2-overlay.is-collapsed .btn-row .btn:not(.btn--primary) {
  display: none;
}
.b2-overlay.is-collapsed .btn-row { margin: 0; }
.b2-overlay.is-collapsed .btn-row .btn--primary { padding: 4px 10px; font-size: 12.5px; }

/* --- short landscape (phone browser bar): the sheet above is sized for a
   full-height screen and would run past a 330-390px-tall viewport, buttons
   included — see F4 audit. Every number below was checked against an actual
   settle() (4 seat rows, a capped-loss line) at 844x330, the tightest case,
   with >=8px still clear above and below the sheet. */
@media (orientation: landscape) and (max-height: 460px) {
  /* This table is a different shape at phone heights: the 23vh top padding
     above (sized for 1280x720's much taller HUD/seat band) would eat most of
     a 330-390px viewport on its own. Phones lean on the collapse toggle
     instead of headroom to keep the sheet off the seats. */
  .b2-overlay { padding: 8px; }
  .b2-result {
    padding: 10px 16px 12px; max-height: calc(100vh - 16px);
  }
  .b2-result__head { display: flex; align-items: baseline; justify-content: center; gap: 10px; margin: 0 0 6px; }
  .b2-result__title { font-size: 18px; margin: 0; }
  .b2-result__big-delta { font-size: 16px; }
  .b2-result__rows { gap: 0; margin: 0 0 6px; padding: 4px 8px; }
  .b2-result__row { font-size: 12.5px; padding: 1px 0; }
  .b2-result__lines { font-size: 12px; line-height: 1.3; margin: 0 0 8px; gap: 2px; }
  .b2-result__toggle { margin-top: 4px; }

  /* The collapsed bar's own safe band (the HUD strip above seatTop) is only
     ~40px tall at these heights — measured, not assumed, since it is the
     seat plate's own top clamp doing the work, not a plain fraction of the
     viewport — against the roomier defaults above, which alone measured
     tall enough to reach past seatTop's plate at 844x390. Every value below
     was sized to that ~40px, not guessed. */
  .b2-overlay.is-collapsed { padding: 2px 8px; }
  .b2-overlay.is-collapsed .b2-result { padding: 2px 6px; gap: 6px; }
  .b2-overlay.is-collapsed .b2-result__head { gap: 5px; }
  .b2-overlay.is-collapsed .b2-result__title,
  .b2-overlay.is-collapsed .b2-result__big-delta { font-size: 11.5px; }
  .b2-overlay.is-collapsed .btn-row .btn--primary { padding: 2px 7px; font-size: 10.5px; }
}

/* --- portrait guard, same idea as table.css's .rotate-gate ------------------ */

.b2-rotate-gate { display: none; }
@media (orientation: portrait) and (max-width: 960px) {
  .b2-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);
  }
  .b2-rotate-gate__icon { font-size: 46px; margin-bottom: 14px; color: var(--red); }
  .b2-rotate-gate h2 { margin: 0 0 8px; font-size: 25px; font-weight: 800; color: var(--red-deep); }
  .b2-rotate-gate p { margin: 0; max-width: 34ch; color: var(--text-tertiary); line-height: 1.6; }
}

/* Short landscape (phone browser bar). The hand is now Dou Di Zhu's 28.7vh,
   a bigger share of a short screen than the 21vh it used to be, and it takes
   its height out of the felt above it. A trick showing both north and south
   fills that whole column: the spacer reaches zero and the controls are pushed
   down onto the raised card. So what sits above the hand gives the room back,
   in two steps, each checked with both plays showing and a card selected. The
   first is what 844x390 needs. */
@media (orientation: landscape) and (max-height: 460px) {
  .b2-hud { padding-top: 3px; padding-bottom: 3px; }
  .b2-controls { padding-top: 2px; padding-bottom: 2px; }
  .b2-controls .btn { padding-top: 3px; padding-bottom: 3px; }
  .b2-play__cards .card { --card-w: clamp(22px, 7.5vh, 58px); }
}

/* Below ~385px the squeeze is worse than step one covers: the hand sits at its
   100.8px floor while the screen keeps shrinking. */
@media (orientation: landscape) and (max-height: 385px) {
  .b2-felt { gap: 1px; }
  .b2-hud { padding-top: 1px; padding-bottom: 1px; }
  .b2-hud__pill { padding-top: 2px; padding-bottom: 2px; }
  .b2-seat__backs .card { --card-w: clamp(17px, 4.6vh, 32px); }
  .b2-play__cards .card { --card-w: clamp(18px, 6vh, 58px); }
}
