/* TEN @ ONCE — one stylesheet, three surfaces: phone, board, host. */

:root {
  --bg: #0a0e13;
  --panel: #141b24;
  --panel-2: #1b2431;
  --line: #293546;
  --text: #e9f0f8;
  --dim: #8ea0b4;
  --gold: #f6b812;
  --amber: #ff9f1c;
  --red: #e5383b;
  --green: #2a9d8f;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* ---------------------------------------------------------------- THE CARD
     ONE geometry, everywhere. Rob, 2026-11-14: "make the cards remain in the
     same square size all the time ... switching from the rectangular card
     display to the more square cards and back is distracting."

     --card-w is the only number. Height, corner and the glyph sizes are derived
     from it, so a card cannot be one shape in the hand, another on the pile and
     a third on the table: every card surface in this file reads these
     properties and nothing else. Change the width here and every card in the
     game changes together — hand, pile, table, fan, chooser, discard rail and
     the big board.

     1.36 : 1 — taller than wide, a playing card, never a square tile and never
     a pillar. Card size is never traded for layout: the layout makes room. */
  --card-w: 52px;
  --card-h: calc(var(--card-w) * 1.36);
  --card-r: calc(var(--card-w) * 0.16);
  --card-rank: calc(var(--card-w) * 0.5);   /* the rank numeral */
  --card-mark: calc(var(--card-w) * 0.21);  /* the colour letter under it */
  --card-skip: calc(var(--card-w) * 0.3);   /* SKIP is a word, not a numeral */
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100%;
}

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled {
  cursor: default;
}
input {
  font-family: inherit;
}

[hidden] {
  display: none !important;
}

/* ------------------------------------------------------------------ join */

.phone {
  /* 100vh is the fallback for browsers without dynamic viewport units: without
     it the shell collapses to content height and the hand stops filling. */
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}


.join {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(246, 184, 18, 0.09), transparent 60%),
    var(--bg);
}
.join-inner {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.wordmark {
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1;
}
.wordmark span {
  color: var(--gold);
}
.join-sub {
  margin: -4px 0 18px;
  color: var(--dim);
  font-size: 0.95rem;
  line-height: 1.4;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field span {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--dim);
  font-weight: 700;
}
.field input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  outline: none;
}
.field input:focus {
  border-color: var(--gold);
}
.btn {
  padding: 15px 18px;
  border-radius: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 0.95rem;
}
.btn.primary {
  background: var(--gold);
  color: #151005;
  margin-top: 6px;
}
.btn.primary:active {
  transform: translateY(1px);
}
.btn.ghost {
  border: 1px solid var(--line);
  color: var(--dim);
  margin-top: 10px;
}
.join-err {
  color: var(--red);
  font-size: 0.9rem;
  margin: 0;
}
.join-foot {
  color: #5c6a7b;
  font-size: 0.78rem;
  line-height: 1.5;
  margin-top: 8px;
}

/* ------------------------------------------------------------------ build chip */

/* V0.01.02 (Rob, 2026-11-13) — the build this phone is running. Fixed chrome at the top centre: on
   screen on the join screen AND at the table, above the round overlay, and it costs no layout
   height on a phone (the header row is label left, clock right, so the centre is empty). */
.buildchrome {
  position: fixed;
  top: calc(6px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}
.buildchip {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.09em;
  color: var(--dim);
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 999px;
  padding: 2px 7px;
  white-space: nowrap;
}
/* The door is serving a different build than this shell IS, so the phone is holding a cached shell.
   Gold and full width, because it is the one thing on screen a player should tap and a mismatch must
   not be missable: one tap reloads onto the build the door is actually handing out. It covers the
   header while it is up — deliberately. Nothing else is worth reading on a stale build. */
.stalechip {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 55;
  padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-align: center;
  color: #231a06;
  border: 0;
  border-bottom: 1px solid #ffd37a;
  background: var(--gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

/* ------------------------------------------------------------------ game shell */

.game {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 12px calc(10px + env(safe-area-inset-bottom));
  gap: 8px;
}

/* header */
.hdr {
  padding-top: 6px;
  flex: none;
}
.hdr-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.phase-label {
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}
.clock {
  font-size: 1.7rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.req-label {
  font-size: 0.78rem;
  letter-spacing: 0.13em;
  color: var(--dim);
  font-weight: 700;
  margin-top: 1px;
}
.beat-bar {
  height: 7px;
  border-radius: 4px;
  background: #1c2531;
  overflow: hidden;
  margin-top: 9px;
}
.beat-fill {
  height: 100%;
  width: 100%;
  background: var(--gold);
  border-radius: 4px;
  transition: width 0.12s linear, background-color 0.2s;
}
.beat-fill.warm {
  background: var(--amber);
}
.beat-fill.urgent {
  background: var(--red);
  animation: pulse 0.65s infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.event-line {
  flex: none;
  min-height: 16px;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--dim);
  opacity: 0;
  transition: opacity 0.25s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-line.show {
  opacity: 1;
}
/* An announcement that lands while the lobby / gap / winner overlay is up: the
   feed line leaves the header and sits above the overlay (z-index 40). It is the
   only way "Pam is back" is seen by anyone when the table is covered. */
.event-line.over-overlay {
  position: fixed;
  top: calc(30px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  max-width: 92vw;
  z-index: 55;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(6, 9, 13, 0.94);
  color: var(--text);
  font-weight: 700;
}

/* middle */
.mid {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* the two offered card objects */
.offers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex: none;
}
.offer {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: calc(var(--card-h) + 40px);
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  transition: border-color 0.15s, transform 0.08s;
}
.offer:active:not(:disabled) {
  transform: scale(0.985);
}
.offer:disabled {
  opacity: 0.55;
}
.offer.pile {
  border-color: #3a4a5f;
}
.offer.deck {
  background: repeating-linear-gradient(135deg, #18202b, #18202b 7px, #1c2531 7px, #1c2531 14px);
}
.offer-tag {
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  color: var(--dim);
  font-weight: 800;
}
/* The top of your pile is a real card face: colour field, rank, letter. It is
   read at arm's length, without tapping — on phase 8 this is the decision. */
.pile-face {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-r);
  border: 1.5px solid var(--line);
  background: var(--panel-2);
  line-height: 1;
}
.pile-face b {
  font-size: var(--card-rank);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.pile-face i {
  font-size: var(--card-mark);
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.08em;
  opacity: 0.9;
}
.pile-face.c-S b {
  font-size: var(--card-skip);
  letter-spacing: 0.05em;
}
.pile-face.empty {
  border-style: dashed;
  border-color: #3c4a5b;
  color: #6f8095;
}
.pile-face.empty b {
  font-size: var(--card-mark);
  font-weight: 800;
  letter-spacing: 0.12em;
}
.offer-hint {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--dim);
  font-weight: 700;
}
/* The deck back: a stacked-card glyph, not a card face — but it stands where a
   card stands, so its box is the card's box. The two offers are the same object
   in two states and neither grows or shrinks on a beat. */
.offer-face {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-r);
  border: 1.5px solid var(--line);
  background: var(--panel-2);
  box-shadow: 3px 3px 0 -1px #0a0f16, 3px 3px 0 0 var(--line);
  font-size: 2.1rem;
  font-weight: 900;
  line-height: 1;
}
.offer.spent {
  opacity: 0.4;
}

/* flags */
.flag-strip {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: none;
}
.flag {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 7px 10px;
  border-radius: 8px;
}
.flag.freeze {
  background: rgba(74, 125, 255, 0.16);
  color: #9db8ff;
  border: 1px solid rgba(74, 125, 255, 0.4);
}
.flag.forfeit {
  background: rgba(229, 56, 59, 0.14);
  color: #ff9b9d;
  border: 1px solid rgba(229, 56, 59, 0.4);
}
.flag.out {
  background: rgba(42, 157, 143, 0.14);
  color: #7fd6c9;
  border: 1px solid rgba(42, 157, 143, 0.4);
}

/* table */
/* The table is the one elastic region on the phone now that a card keeps its
   size. The hand no longer stretches to fill the screen, so a crowded table
   takes the room it never had; in the extreme case (four seats, every group
   out) it scrolls. The card never gives up its geometry for a layout. */
.table-block {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-bottom: 2px;
}
.block-label {
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: var(--dim);
  font-weight: 800;
}
/* The whole table, wrapped rather than scrolled: a group hidden behind a
   horizontal scroll is a group you cannot bet the draw against. Collapsed
   faces are what buys the rows — never un-collapse to make room. */
.table-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
  padding-bottom: 2px;
}
.group {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 7px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  flex: none;
}
.group.target {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(246, 184, 18, 0.18);
}
/* The group the card on your pile would join. Dashed, because it is an offer
   you have not taken yet: the solid gold ring is a card in your hand. This is
   the mark the draw choice is made against — take the pile or draw blind. */
.group.pile-target {
  border-style: dashed;
  border-color: rgba(246, 184, 18, 0.7);
}
.group.retired {
  opacity: 0.45;
}
/* A fanned group holds real cards, so it takes the full row and wraps inside
   itself rather than running off the edge of a phone. */
.group.fanned {
  flex: 1 1 100%;
}
.group-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

/* ---------------------------------------------------------------- group faces
   A laid group is a target, not an inventory. Sets collapse to the number they
   accept, phase-8 colour groups to the colour they accept, and runs to their
   two ends — the only ranks a card can be played against (engine/phases.mjs:
   200-209). The face says what the group TAKES; the badge counts; the meter
   shows progress to the twelve-card retirement (engine/phases.mjs:195, :234).
   Tap a group to fan it; tap again to close. */
.gf-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.gf {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* A set: a neutral card outline with a numeral. Colour is irrelevant to a set,
   so the face carries none — the numeral is the identity and the rule. */
.gf.set-face {
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-r);
  border: 2px solid #3a4a5e;
  background: #0e1520;
  color: var(--text);
  box-shadow: 3px 3px 0 -1px #0a0f16, 3px 3px 0 0 #2b3a4d;
}
.gf-num {
  font-size: var(--card-rank);
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
/* A colour group: a solid colour field. This is the one group whose colour is
   its rule, so the face must never be neutral — two phase-8 groups have to be
   tellable apart at a glance. Different shape from the numeral, on purpose. */
.gf.swatch {
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-r);
  border: 2px solid var(--card-edge);
  background: var(--card-fill);
  color: var(--card-ink);
  box-shadow: 3px 3px 0 -1px #0a0f16, 3px 3px 0 0 #2b3a4d;
}
.gf-letter {
  font-size: var(--card-rank);
  font-weight: 900;
  letter-spacing: 0.02em;
}
.gf-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  min-width: 21px;
  padding: 1px 4px;
  border-radius: 999px;
  background: #eef4fb;
  color: #0b1119;
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1.3;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 1.5px #0b1119;
}
.gf-meter {
  width: 100%;
  min-width: 36px;
  height: 4px;
  border-radius: 2px;
  background: #1c2531;
  overflow: hidden;
}
.gf-meter i {
  display: block;
  height: 100%;
  background: #7c93ad;
}
.gf-meter.near i {
  background: var(--gold);
}
/* A run: low card — dash — high card. The outer edge of each end is the edge a
   card extends from, so it is marked; the middle is not on screen at all. */
.gf-run {
  flex-direction: row;
  align-items: center;
  gap: 3px;
}
.run-dash {
  font-size: 1rem;
  font-weight: 900;
  color: var(--dim);
  line-height: 1;
  padding: 0 1px;
}
/* A run end is a card, so it is THE card: same width, height and corner as
   everything else. Only the edge a card extends from is marked. */
.chip.run-end {
  position: relative;
}
.chip.run-end.low {
  border-left: 3px solid #5b7290;
}
.chip.run-end.high {
  border-right: 3px solid #5b7290;
}
/* A Wild at an end still has a rank — that rank is what a card is played
   against, so it is shown beside the Wild token, never hidden. */
.chip.wild-end em {
  position: absolute;
  top: -7px;
  right: -7px;
  padding: 0 3px;
  border-radius: 5px;
  background: var(--gold);
  color: #151005;
  font-style: normal;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1.3;
  box-shadow: 0 0 0 1.5px #0b1119;
}
/* A divider between acceptance axes — numbers here, colours there. No prose. */
.kind-sep {
  flex: none;
  width: 1px;
  align-self: stretch;
  margin: 4px 3px;
  background: var(--line);
}
.table-note {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: #6f8095;
  font-weight: 700;
  padding: 6px 0;
}

/* a card chip, used on the table and in the chooser */
.chip {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-r);
  border: 1px solid var(--line);
  background: var(--panel-2);
  line-height: 1;
}
.chip b {
  font-size: var(--card-rank);
  font-weight: 900;
}
.chip i {
  font-size: var(--card-mark);
  font-style: normal;
  opacity: 0.85;
  letter-spacing: 0.05em;
}
/* SKIP is a word: it takes the word size, or it runs out of the card. */
.chip.c-S b {
  font-size: var(--card-skip);
  letter-spacing: 0.05em;
}
/* ---------------------------------------------------------------- card colour
   A card is a solid colour field, not a 20% tint: at 20% the dark table shows
   through and every card reads as grey with a hint of something. Six faces
   cover everything the engine can emit — four numbered colours (R G Y B),
   Wild (W) and Skip (S). Rank and letter are painted in --card-ink; the suite
   asserts every face class exists and its ink clears 4.5:1 on the fill. */
.c-R {
  --card-fill: #c62828;
  --card-edge: #8e1b1b;
  --card-ink: #ffffff;
}
.c-G {
  --card-fill: #2e7d32;
  --card-edge: #1b5720;
  --card-ink: #ffffff;
}
.c-Y {
  --card-fill: #f2b300;
  --card-edge: #a67a00;
  --card-ink: #1a1205;
}
.c-B {
  --card-fill: #1565c0;
  --card-edge: #0d3f7a;
  --card-ink: #ffffff;
}
.c-W {
  --card-fill: #7b1fa2;
  --card-edge: #51156b;
  --card-ink: #ffffff;
}
.c-S {
  --card-fill: #37474f;
  --card-edge: #1f2a30;
  --card-ink: #ffffff;
}

/* hand */
/* The hand is where a card used to be stretched into a pillar: the grid cell
   WAS the card, so a hand of six and a hand of eleven drew different shapes and
   the card changed size every time one left. Now the cell is the card's size,
   the grid is centred in whatever space is left, and the hand keeps its cards
   at the bottom of the screen under the thumb. A hand never changes the card to
   fit; --hand-cols only changes how many cards sit on a row. */
.hand-block {
  flex: 0 0 auto;
  margin-top: auto;
  display: flex;
}
.hand {
  flex: none;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(var(--hand-cols, 5), var(--card-w));
  grid-auto-rows: var(--card-h);
  gap: 7px;
  align-content: center;
  justify-content: center;
}
.hand-empty {
  color: var(--dim);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  grid-column: 1 / -1;
  align-self: center;
  text-align: center;
}
.tok {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-r);
  border: 1.5px solid var(--line);
  background: var(--panel-2);
  transition: transform 0.1s, box-shadow 0.12s;
}
.tok:active {
  transform: scale(0.96);
}
.tok-num {
  font-size: var(--card-rank);
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.tok-col {
  font-size: var(--card-mark);
  font-weight: 800;
  letter-spacing: 0.1em;
  color: inherit;
  opacity: 0.92;
}
.tok.skip .tok-num {
  font-size: var(--card-skip);
  letter-spacing: 0.06em;
}
.tok.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(246, 184, 18, 0.55), 0 0 0 6px rgba(246, 184, 18, 0.18);
  transform: translateY(-2px);
}

/* Paint every card surface from the colour tokens above. This rule comes after
   the surfaces so it wins the cascade: chip (table), tok (hand), pile-face
   (your pile) and bar-swatch (discard rail). */
.c-R,
.c-G,
.c-Y,
.c-B,
.c-W,
.c-S {
  background: var(--card-fill);
  border-color: var(--card-edge);
  color: var(--card-ink);
}

/* room strip */
.room-block {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 2px;
}
.room-strip {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.rchip {
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  color: var(--dim);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 6px;
  font-weight: 700;
}
.rchip b {
  color: var(--text);
}
.rchip.out {
  border-color: rgba(42, 157, 143, 0.5);
  color: #7fd6c9;
}
.room-meta {
  font-size: 0.6rem;
  letter-spacing: 0.09em;
  color: #55657a;
  font-weight: 700;
}

/* the two bars */
.bars {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-top: 2px;
}
.bar {
  width: 100%;
  /* The discard rail carries a card face, so its height is the card's height in
     both of its states. An empty rail and a rail showing a card are the same
     height: nothing on the phone jumps when the swatch arrives. */
  min-height: calc(var(--card-h) + 20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 900;
  letter-spacing: 0.07em;
  font-size: 0.95rem;
  text-align: center;
}
.bar.red {
  background: #1a1214;
  border: 1px solid #43242a;
  color: #7c5a5f;
}
/* The server is holding the beat open for this player's discard. */
.bar.red.pending {
  border-color: rgba(246, 184, 18, 0.6);
  color: var(--gold);
}
.bar.red.armed {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.bar.red:not(:disabled):active {
  transform: translateY(1px);
}
/* The discard rail carries the card with the sentence: colour first, words
   second, both on screen without tapping. */
.bar.has-swatch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 12px;
}
.bar-label {
  line-height: 1.25;
}
.bar-swatch {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: none;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-r);
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3);
  line-height: 1;
}
.bar-swatch b {
  font-size: var(--card-rank);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.bar-swatch i {
  font-size: var(--card-mark);
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.07em;
  opacity: 0.9;
}
.bar-swatch.c-S b {
  font-size: var(--card-skip);
  letter-spacing: 0.04em;
}
.bar.gold {
  background: var(--gold);
  color: #151005;
  animation: goldPulse 1.4s ease-in-out infinite;
}
@keyframes goldPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(246, 184, 18, 0.4);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(246, 184, 18, 0);
  }
}

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

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 13, 0.86);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  z-index: 40;
}
.overlay-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  text-align: center;
}
.overlay-kicker {
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  color: var(--dim);
  font-weight: 800;
}
.overlay-title {
  font-size: 1.5rem;
  font-weight: 900;
  margin: 8px 0 10px;
  letter-spacing: 0.02em;
}
.overlay-title.big {
  font-size: 1.9rem;
  color: var(--gold);
}
.overlay-title.code {
  font-size: 3.2rem;
  letter-spacing: 0.16em;
  color: var(--gold);
  margin: 10px 0 6px;
}
.overlay-copy {
  color: var(--dim);
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0 0 12px;
}
.overlay-gain {
  color: var(--gold);
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  margin: 6px 0 12px;
}
.overlay-foot {
  color: #6f8095;
  font-size: 0.78rem;
  margin: 12px 0 0;
}
.share {
  font-size: 0.8rem;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 8px;
  word-break: break-all;
  margin-bottom: 14px;
}
.pchips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.pchip {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 20px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.pchip.dim {
  color: var(--dim);
}
.pchip.is-host {
  color: var(--gold);
  border-color: var(--gold);
}
/* A bot seat: visibly a seat, visibly not a phone (Rob, 2026-11-13). */
.pchip.is-bot {
  color: #9fd0ff;
  border-style: dashed;
  border-color: #3f6d94;
}
.bot-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.bot-btn {
  flex: 1;
  padding: 10px 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.bot-btn:disabled {
  opacity: 0.45;
}
.lobby-start {
  width: 100%;
  margin-top: 14px;
}
.lobby-start:disabled {
  opacity: 0.45;
  cursor: default;
}
.lobby-err {
  color: var(--red);
  font-size: 0.82rem;
  font-weight: 800;
  margin: 10px 0 0;
}

/* chooser */
.chooser-card {
  text-align: left;
  max-height: 82dvh;
  overflow-y: auto;
}
.chooser-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.chooser-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--panel-2);
}
.chooser-rows {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.chooser-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chooser-type {
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: var(--dim);
  font-weight: 800;
  width: 46px;
  flex: none;
}
.chooser-cards {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}
.chooser-meta {
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  color: var(--dim);
  margin: 9px 0 4px;
  font-weight: 700;
}
.chooser-item .btn.pick {
  width: 100%;
  background: var(--gold);
  color: #151005;
  margin-top: 6px;
  padding: 11px;
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: #2a1c1e;
  border: 1px solid #5a3035;
  color: #ffc9cb;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 700;
  z-index: 60;
  max-width: 90vw;
  text-align: center;
}

/* ------------------------------------------------------------------ board */

.board {
  min-height: 100dvh;
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 22px 40px;
}
.board-head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.board-title {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}
.board-code {
  color: var(--gold);
}
.board-meta {
  display: flex;
  gap: 18px;
  color: var(--dim);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-left: auto;
}
.board-meta b {
  color: var(--text);
}
.ladder {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 18px;
}
.rung {
  display: grid;
  grid-template-columns: 46px 260px 1fr;
  align-items: center;
  gap: 14px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  min-height: 52px;
}
.rung.live {
  border-color: rgba(246, 184, 18, 0.55);
  background: linear-gradient(90deg, rgba(246, 184, 18, 0.09), var(--panel) 40%);
}
.rung-num {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.rung.live .rung-num {
  color: var(--gold);
}
.rung-name {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--dim);
  font-weight: 700;
}
.rung-players {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 20px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 0.86rem;
  font-weight: 700;
}
.player-chip.down {
  border-color: var(--gold);
  color: #ffdf95;
}
.player-chip.out {
  border-color: var(--green);
  color: #8fe0d4;
  text-decoration: line-through;
}
.player-chip.dropped {
  opacity: 0.4;
}
/* A bot seat on the big screen, the same mark the phone lobby uses. */
.player-chip.bot {
  border-style: dashed;
  border-color: #3f6d94;
  color: #9fd0ff;
}
.player-chip.bot .dot {
  background: #9fd0ff;
}
.player-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dim);
}
.player-chip.down .dot {
  background: var(--gold);
}
.player-chip.out .dot {
  background: var(--green);
}

.board-table {
  margin-top: 22px;
}
.board-table h2 {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--dim);
  margin: 0 0 10px;
}
.board-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.board-group {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 9px 11px;
}
.board-group .owner {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--dim);
  font-weight: 800;
  margin-bottom: 6px;
}
.board-group.retired {
  opacity: 0.45;
}
.last-group {
  margin-top: 16px;
  color: var(--dim);
  font-size: 0.85rem;
}
.last-group b {
  color: var(--text);
}

/* ------------------------------------------------------------------ host */

.host {
  min-height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.host h1 {
  font-size: 1.5rem;
  margin: 0;
  letter-spacing: 0.04em;
}
.host .sub {
  color: var(--dim);
  font-size: 0.85rem;
  margin: 4px 0 0;
  line-height: 1.5;
}
.card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 14px;
  padding: 16px;
}
.card h2 {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--dim);
  margin: 0 0 12px;
}
.host-code {
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--gold);
  margin: 0;
}
.host-share {
  color: var(--dim);
  font-size: 0.86rem;
  word-break: break-all;
  margin-top: 6px;
}
.host-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.host-row + .host-row {
  margin-top: 12px;
}
.host-row label {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--dim);
  font-weight: 800;
}
.host-hint {
  flex: 1;
  min-width: 200px;
  color: var(--dim);
  font-size: 0.78rem;
  line-height: 1.35;
}
input[type='range'] {
  flex: 1;
  min-width: 160px;
  accent-color: var(--gold);
}
.beat-value {
  font-weight: 900;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
  min-width: 46px;
  text-align: right;
}
.hbtn {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 0.85rem;
}
.hbtn.primary {
  background: var(--gold);
  color: #151005;
  border-color: var(--gold);
}
.hbtn.danger {
  border-color: #5a3035;
  color: #ff9b9d;
}
.health {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--dim);
  flex-wrap: wrap;
}
.tick {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #33414f;
}
.tick.beat {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(42, 157, 143, 0.2);
}
.log {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.74rem;
  color: var(--dim);
  line-height: 1.7;
  max-height: 260px;
  overflow-y: auto;
}
.log b {
  color: var(--text);
}
.status-pill {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 5px 10px;
  border-radius: 20px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--dim);
}
.status-pill.playing {
  color: #8fe0d4;
  border-color: rgba(42, 157, 143, 0.5);
}
.status-pill.gap {
  color: #ffdf95;
  border-color: rgba(246, 184, 18, 0.5);
}

/* ------------------------------------------------------------------ narrow */

/* A short screen loses chrome, never card size: the offers and the bars tighten
   their padding, and the card keeps the one geometry it has everywhere. */
@media (max-height: 720px) {
  .offer {
    min-height: calc(var(--card-h) + 26px);
    gap: 2px;
  }
  .bar {
    padding: 6px 10px;
  }
}

/* A phone on its side. 390 px of height cannot hold the portrait stack, and the card is not allowed
   to give up its size to make it fit — so the SHAPE OF THE SCREEN changes instead of the card: two
   columns, the two bars side by side, the table given a real window, and the hand tucked under the
   offers. Nothing in here sets a card's width or height; it only decides where the card sits. */
@media (max-height: 560px) and (orientation: landscape) {
  .game {
    gap: 6px;
    padding-bottom: 6px;
  }
  .hdr {
    padding-top: 0;
  }
  .phase-label {
    font-size: 1.15rem;
  }
  .clock {
    font-size: 1.25rem;
  }
  .beat-bar {
    height: 5px;
    margin-top: 5px;
  }
  .mid {
    display: grid;
    grid-template-columns: minmax(0, 38%) minmax(0, 1fr);
    grid-template-rows: auto auto auto minmax(0, 1fr);
    gap: 6px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .offers {
    grid-area: 1 / 1;
  }
  .flag-strip {
    grid-area: 2 / 1;
  }
  .hand-block {
    grid-area: 3 / 1;
    margin-top: 0;
  }
  .room-block {
    grid-area: 4 / 1;
    align-self: start;
  }
  .table-block {
    grid-area: 1 / 2 / span 4 / span 1;
  }
  .bars {
    flex-direction: row;
  }
}
