/* 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;
}

* {
  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;
}

/* ------------------------------------------------------------------ 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;
}

/* 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;
  height: 104px;
  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;
  min-width: 48px;
  height: 56px;
  padding: 0 6px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: var(--panel-2);
  line-height: 1;
}
.pile-face b {
  font-size: 1.6rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.pile-face i {
  font-size: 0.55rem;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.08em;
  opacity: 0.9;
}
.pile-face.c-S b {
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}
.pile-face.empty {
  border-style: dashed;
  border-color: #3c4a5b;
  color: #6f8095;
}
.pile-face.empty b {
  font-size: 0.58rem;
  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. */
.offer-face {
  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 */
.table-block {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 44px;
}
.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);
}
/* A claimed add: the group and the card both wear this until the beat turns. */
.group.locked {
  border-color: var(--gold);
  box-shadow:
    0 0 0 2px rgba(246, 184, 18, 0.6),
    inset 0 0 0 1px rgba(246, 184, 18, 0.45);
}
.group.rejected,
.tok.rejected {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(229, 56, 59, 0.55);
  animation: rejectPulse 0.45s ease-in-out 2;
}
@keyframes rejectPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}
.group.retired {
  opacity: 0.45;
}
.group-cards {
  display: flex;
  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: 36px;
  height: 46px;
  border-radius: 7px;
  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: 1.4rem;
  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: 42px;
  height: 42px;
  border-radius: 9px;
  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: 1.25rem;
  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;
}
.chip.run-end {
  position: relative;
  min-width: 28px;
  height: 38px;
}
.chip.run-end b {
  font-size: 1rem;
}
.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;
  min-width: 26px;
  height: 32px;
  padding: 0 3px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  line-height: 1;
}
.chip b {
  font-size: 0.86rem;
  font-weight: 900;
}
.chip i {
  font-size: 0.5rem;
  font-style: normal;
  opacity: 0.85;
  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 */
.hand-block {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}
.hand {
  /* Fills every pixel between the table and the room strip: the tokens are the
     only elastic region on the phone (§8.1 item 4). --hand-cols is set by
     renderHand() so a ragged last row never leaves one card alone. */
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(var(--hand-cols, 5), minmax(0, 1fr));
  grid-auto-rows: minmax(52px, 1fr);
  gap: 7px;
  align-content: stretch;
  justify-content: stretch;
}
.hand-empty {
  color: var(--dim);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  grid-column: 1 / -1;
  align-self: center;
  text-align: center;
}
/* A short hand (five or fewer, after laying down) would otherwise stretch one
   row to the full height of the block and turn a card into a pillar. Give the
   tokens the height they would have with two rows and centre them, so a card
   is the same size whether the hand holds five or ten. */
.hand.short {
  align-items: center;
}
.hand.short .tok {
  height: calc((100% - 7px) / 2);
  max-height: 240px;
}
.tok {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 11px;
  border: 1.5px solid var(--line);
  background: var(--panel-2);
  min-height: 52px;
  transition: transform 0.1s, box-shadow 0.12s;
}
.tok:active {
  transform: scale(0.96);
}
.tok-num {
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.tok-col {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: inherit;
  opacity: 0.92;
}
.tok.skip .tok-num {
  font-size: 0.95rem;
  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);
}
/* The card half of a claimed add — same gold language as .group.locked. */
.tok.locked {
  border-color: var(--gold);
  box-shadow:
    0 0 0 3px var(--gold),
    0 0 0 7px rgba(246, 184, 18, 0.16);
  transform: translateY(-1px);
}

/* 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%;
  padding: 16px 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: 34px;
  height: 42px;
  border-radius: 7px;
  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: 1rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.bar-swatch i {
  font-size: 0.46rem;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.07em;
  opacity: 0.9;
}
.bar-swatch.c-S b {
  font-size: 0.5rem;
  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);
}
.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;
}
.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;
}
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 */

@media (max-height: 720px) {
  .offer {
    height: 86px;
  }
  .tok-num {
    font-size: 1.3rem;
  }
  .bar {
    padding: 13px 10px;
  }
}
