/* ---------- fonts ----------
   Chinese always uses 杨任东竹石体 (YRDZST Semibold), a soft handwritten face. It has its own
   family name, listed first, because Apple's ui-rounded carries its own Chinese (PingFang):
   if ui-rounded came first, iPhones would never reach YRDZST. Latin text then falls through
   to the system's rounded face (SF Pro Rounded via ui-rounded) on Apple devices and to Nunito
   everywhere else. Both files are bundled (licenses in fonts/) so they work offline. The
   Chinese file only holds the characters the app's own text uses; anything else falls back
   to the system font. Each family is one file covering every weight, so nothing gets a
   synthesized bold. */
@font-face {
  font-family: "Guandan Chinese"; font-weight: 100 1000; font-display: swap;
  src: url("fonts/zhushi-zh.woff2") format("woff2");
  unicode-range: U+3000-303F, U+4E00-9FFF, U+FF00-FFEF;
}
@font-face {
  font-family: "Guandan Rounded"; font-weight: 100 1000; font-display: swap;
  src: url("fonts/nunito.woff2") format("woff2");
  unicode-range: U+0020-007E, U+00A0-00FF, U+2013-2014, U+2018-201D, U+2022, U+2026, U+2039-203A, U+2192, U+20AC;
}

/* ---------- tokens ----------
   iOS-style neutrals for everything, follows the system light/dark setting. The green felt
   is spent in one place only: the card table that holds the two level cards (plus the
   opening animation). Contrast is noted against the surface each text color sits on. */
:root {
  color-scheme: light dark;
  --bg: #f2f2f7;                       /* grouped background */
  --surface: #ffffff;                  /* cards and list rows */
  --cell: #ffffff;                     /* rows inside a sheet */
  --sheet-bg: #f2f2f7;
  --label: #000000;
  --label-2: #6c6c70;                  /* 5.2:1 on white, 4.7:1 on #f2f2f7 */
  --sep: rgba(60, 60, 67, .2);
  --fill: rgba(118, 118, 128, .12);
  --fill-2: rgba(118, 118, 128, .2);
  --seg-on: #ffffff;
  --accent: #0a7a4f;                   /* felt green; 5.4:1 on white */
  --on-accent: #ffffff;                /* 5.4:1 on the accent */
  --accent-tint: rgba(10, 122, 79, .12);
  --red: #c9302a;                      /* team fills; white text 5.3:1 */
  --blue: #1f4fb6;                     /* white text 7.4:1 */
  --red-text: #c9302a;                 /* 5.3:1 on white */
  --blue-text: #1f4fb6;                /* 7.4:1 on white */
  --red-tint: rgba(201, 48, 42, .12);
  --blue-tint: rgba(31, 79, 182, .12);
  --gold-text: #8f5f00;
  --warn: #b54708;
  --glass: rgba(255, 255, 255, .72);
  --glass-line: rgba(0, 0, 0, .08);
  --toast: rgba(28, 28, 30, .92);
  --on-toast: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 6px 20px rgba(0, 0, 0, .06);

  /* the card table and the cards themselves look the same in both appearances */
  --felt-hi: #1a6b4b;
  --felt: #0f4c35;
  --felt-lo: #0a3627;
  --on-felt: #f4f0e4;                  /* 8.8:1 on felt */
  --on-felt-muted: rgba(244, 240, 228, .75);
  --gold: #f2c45c;                     /* 6.1:1 on felt */
  --paper: #fbf9f3;
  --paper-2: #eee9dd;
  --ink: #1c1d1f;
  --card-red: #c9302a;
  --card-blue: #1f4fb6;
  --team-0: #c9302a;
  --team-1: #1f4fb6;
  --seat-1: #2a78d6;
  --seat-2: #eb6834;
  --seat-3: #1baf7a;
  --seat-4: #eda100;

  --radius: 18px;
  --tabbar: 62px;
  --tab-gap: 10px;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-drawer: cubic-bezier(.32, .72, 0, 1);
  /* screen height: dvh where the browser has it. iPadOS before 15.4 doesn't, and a dvh
     inside the card size (--w) would leave the level cards with body-size numbers. */
  --vh: 100vh;
}
@supports (height: 100dvh) {
  :root { --vh: 100dvh; }
}

@media (prefers-color-scheme: dark) {
  :root {
    /* the same navy as the opening animation, so one flows into the other */
    --bg: #1f2f4a;
    --surface: #2a3c5b;
    --cell: #35496b;
    --sheet-bg: #2a3c5b;
    --label: #ffffff;
    --label-2: #b7c2d6;                /* 7.5:1 on the background, 5.1:1 on sheet rows */
    --sep: rgba(150, 170, 210, .25);
    --fill: rgba(150, 170, 210, .16);
    --fill-2: rgba(150, 170, 210, .28);
    --seg-on: #4a5f86;
    --accent: #4be39a;                 /* 5.5:1 on sheet rows */
    --on-accent: #00281a;
    --accent-tint: rgba(75, 227, 154, .16);
    --red-text: #ffa197;               /* 4.7:1 on sheet rows */
    --blue-text: #9dbbff;              /* 4.7:1 on sheet rows */
    --team-0: #ff8a7e;
    --team-1: #9dbfff;
    --seat-1: #3987e5;
    --seat-2: #d95926;
    --seat-3: #199e70;
    --seat-4: #c98500;
    --red-tint: rgba(255, 161, 151, .16);
    --blue-tint: rgba(157, 187, 255, .16);
    --gold-text: #f2c45c;
    --warn: #ffb08a;
    --glass: rgba(38, 54, 84, .72);
    --glass-line: rgba(255, 255, 255, .12);
    --toast: rgba(242, 242, 247, .94);
    --on-toast: #000000;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--bg); }

body {
  margin: 0;
  min-height: var(--vh);
  color: var(--label);
  background: var(--bg);
  font-family: "Guandan Chinese", ui-rounded, "SF Pro Rounded", "Guandan Rounded", -apple-system, system-ui, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) calc(var(--tabbar) + var(--tab-gap) + env(safe-area-inset-bottom) + 24px) max(16px, env(safe-area-inset-left));
}

body.sheet-open { overflow: hidden; }

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; border: 0; background: none; padding: 0; user-select: none; -webkit-user-select: none; }
button:disabled { opacity: .35; cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 20px; font-weight: 700; margin-bottom: 10px; }

#view { max-width: 1180px; margin: 0 auto; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--label-2); font-weight: 400; }
.small { font-size: 13px; }
.center { text-align: center; }
.gold-text { color: var(--gold-text); }
.warn { color: var(--warn); }
.hint { color: var(--label-2); font-size: 15px; margin: 0 0 10px; }
.empty { color: var(--label-2); text-align: center; padding: 28px 16px; margin: 0; }
.big-empty { padding: 56px 24px; font-size: 17px; max-width: 420px; margin: 0 auto; }
.empty-suits { display: block; font-size: 34px; letter-spacing: 8px; margin-bottom: 12px; color: var(--label-2); opacity: .6; }
.narrow { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }

/* ---------- navigation bar: toolbar row + large title ---------- */
.bar { margin-bottom: 14px; }
.bar-row { display: flex; align-items: center; justify-content: space-between; min-height: 52px; gap: 8px; }
.bar-left, .bar-right { display: flex; align-items: center; gap: 8px; }
.bar h1 {
  display: flex; align-items: center; gap: 10px;
  font-size: 34px; font-weight: 700; letter-spacing: -.01em; line-height: 41px;
  min-width: 0;
}
.bar h1 span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-logo { flex-shrink: 0; width: 36px; height: 36px; border-radius: 9px; box-shadow: 0 0 0 .5px var(--glass-line), 0 2px 6px rgba(0, 0, 0, .12); }
.back { color: var(--accent); font-size: 17px; font-weight: 600; min-height: 44px; padding: 0 4px 0 0; }

/* toolbar buttons: round, monochrome, on a soft fill */
.sound-btn, .bar .icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 36px; min-width: 36px; padding: 0 12px; border-radius: 18px;
  background: var(--fill); color: var(--label);
  font-size: 15px; font-weight: 600; white-space: nowrap; flex-shrink: 0;
  transition: transform 140ms var(--ease-out), background-color 140ms ease;
}
.bar .icon-btn { width: 36px; padding: 0; letter-spacing: 1px; font-size: 13px; }
.sound-btn span { font-size: 15px; color: var(--accent); }
.help-btn { padding: 0; width: 36px; font-size: 17px; font-weight: 700; color: var(--accent); }

/* how to play: grouped sections, like iOS Settings */
.rules-body { display: flex; flex-direction: column; gap: 10px; }
/* a sheet title that stays put while the sheet scrolls, with ✕ to close */
.sheet-head {
  position: sticky; top: -8px; z-index: 2; margin: -8px 0 0; padding: 12px 0 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--sheet-bg);
}
.sheet-head h2 { margin: 0; }
.sheet-x {
  width: 32px; height: 32px; border-radius: 16px; flex-shrink: 0; display: grid; place-items: center;
  background: var(--fill); color: var(--label-2); transition: transform 140ms var(--ease-out);
}
.sheet-x svg { width: 13px; height: 13px; }
.sheet-x:active { transform: scale(.9); }
.rules-sec { background: var(--cell); border-radius: 16px; padding: 12px 16px; }
.rules-sec h3 { font-size: 13px; font-weight: 600; color: var(--label-2); margin: 0 0 6px; }
.rules-sec ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.rules-sec li { font-size: 15px; line-height: 1.45; }
.rules-sec li::marker { color: var(--label-2); }
.rules-sec b { font-weight: 700; }

/* rules visuals: tiny playing cards and finish-order dots */
.rv { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.rv-row { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; }
.rv-label { min-width: 104px; font-size: 13px; font-weight: 600; color: var(--label-2); }
.rv-label:empty { display: none; }
.rv-cap { font-size: 13px; color: var(--label-2); }
.rv-res { margin-left: auto; min-width: 36px; text-align: right; font-size: 17px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.rv-eq, .rv-dots { font-weight: 700; color: var(--label-2); align-self: center; }
.rv-note { font-size: 13px; color: var(--label-2); }
.mini-hand { display: inline-flex; flex-wrap: wrap; gap: 2px; }
/* a bomb shown as a little fanned stack */
.mini-hand.stack { flex-wrap: nowrap; gap: 0; }
.mini-hand.stack .mini-card + .mini-card { margin-left: -11px; }
.mini-hand.stack .mini-card { align-items: flex-start; padding-left: 3px; }
.mini-hand.stack .mini-card.joker { padding-left: 1px; font-size: 12px; }
.mini-card {
  width: 22px; height: 32px; border-radius: 4px; flex-shrink: 0;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #fff, var(--paper)); color: var(--ink);
  font-family: "Guandan Rounded", ui-rounded, system-ui, sans-serif;
  font-size: 12px; font-weight: 800; line-height: 1;
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .18), 0 1px 3px rgba(0, 0, 0, .25);
}
.mini-card i { font-style: normal; font-size: 10px; margin-top: 1px; }
.mini-card.red { color: var(--card-red); }
.mini-card.joker { font-size: 15px; }
.mini-card.any { color: var(--label-2); font-size: 15px; background: var(--paper-2); }
.mini-card.wild { box-shadow: 0 0 0 2px var(--gold), 0 1px 3px rgba(0, 0, 0, .25); transform: rotate(-6deg); }
.mini-card.level { box-shadow: 0 0 0 2px var(--accent), 0 1px 3px rgba(0, 0, 0, .25); }
.finish { display: inline-flex; gap: 6px; }
.seat {
  width: 26px; height: 26px; border-radius: 13px; display: inline-grid; place-items: center;
  font-size: 13px; font-weight: 800; color: #fff;
}
.seat.r { background: var(--red); }
.seat.b { background: var(--blue); opacity: .55; }

.table-menu { display: none; }
.sound-btn.off span { color: var(--label-2); text-decoration: line-through; }
.sound-btn:active, .bar .icon-btn:active { transform: scale(.94); background: var(--fill-2); }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; font-size: 14px; color: var(--label-2); transition: transform 140ms var(--ease-out); }
.icon-btn:active { transform: scale(.92); background: var(--fill); }

/* ---------- surfaces ---------- */
.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
}

/* buttons: capsules. Prominent = accent fill, standard = gray fill with accent label */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 50px; padding: 0 22px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--accent);
  font-size: 17px; font-weight: 600;
  white-space: nowrap;
  transition: transform 140ms var(--ease-out), filter 140ms ease, background-color 140ms ease;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.gold { background: var(--accent); color: var(--on-accent); }
.btn.danger { color: var(--red-text); }
.btn.subtle { background: transparent; color: var(--accent); }
.btn.big { min-height: 56px; font-size: 17px; }
.btn.full { width: 100%; }
.link { color: var(--accent); font-weight: 600; padding: 10px 0; text-align: left; min-height: 44px; }

.actions-row { display: flex; flex-wrap: wrap; gap: 10px; }
.actions-row .btn { flex: 1 1 160px; }

.suit { margin-right: 6px; }
.suit.t0 { color: var(--red-text); }
.suit.t1 { color: var(--blue-text); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-row:empty { display: none; }
.chip {
  min-height: 40px; padding: 0 16px; border-radius: 20px;
  background: var(--fill); color: var(--label); font-size: 15px; font-weight: 600;
  transition: transform 140ms var(--ease-out), background-color 160ms ease;
}
.chip:active { transform: scale(.95); }
.chip.on { background: var(--accent); color: var(--on-accent); }

/* iOS segmented control */
.seg { display: flex; background: var(--fill); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button {
  flex: 1; min-height: 38px; border-radius: 999px; padding: 0 10px;
  font-size: 15px; font-weight: 600; color: var(--label);
  transition: background-color 180ms ease, box-shadow 180ms ease, transform 140ms var(--ease-out);
}
.seg button:active { transform: scale(.97); }
.seg button.on { background: var(--seg-on); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }
.seg.range { align-self: center; width: 100%; max-width: 420px; }

.avatar {
  width: 34px; height: 34px; border-radius: 17px; flex-shrink: 0;
  display: inline-grid; place-items: center;
  background: var(--accent-tint); color: var(--accent); font-weight: 700; font-size: 15px;
}
.avatar.ghost { background: transparent; color: var(--label-2); border: 1.5px dashed var(--label-2); }

/* ---------- playing card ---------- */
.pcard-wrap {
  --w: clamp(118px, 34vw, 210px);
  position: relative;
  width: var(--w);
  aspect-ratio: 5 / 7;
  margin: 10px auto 8px;
  perspective: 900px;
}
.pcard-wrap.md { --w: clamp(96px, 26vw, 150px); }
.pcard-wrap.sm { --w: 74px; margin: 0; }
.pcard {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
}
.face {
  position: absolute; inset: 0;
  border-radius: calc(var(--w) * .075);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.front {
  background: linear-gradient(160deg, #fff, var(--paper) 60%, var(--paper-2));
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 10px 24px rgba(0, 0, 0, .3), 0 2px 4px rgba(0, 0, 0, .2);
  display: grid; place-items: center;
  overflow: hidden;
}
.pcard.t0 .front { color: var(--card-red); }
.pcard.t1 .front { color: var(--card-blue); }
.front .center {
  font-size: calc(var(--w) * .5);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1;
  margin-top: calc(var(--w) * -.1);
}
.front .center.wide { font-size: calc(var(--w) * .4); }
.front .pip {
  position: absolute; bottom: 15%; left: 50%; transform: translateX(-50%);
  font-size: calc(var(--w) * .2); line-height: 1;
}
.idx {
  position: absolute;
  display: flex; flex-direction: column; align-items: center;
  font-size: calc(var(--w) * .13); font-weight: 800; line-height: 1;
}
.idx i { font-style: normal; font-size: .8em; margin-top: 2px; }
.idx.tl { top: 7%; left: 8%; }
.idx.br { bottom: 7%; right: 8%; transform: rotate(180deg); }
.cback {
  transform: rotateY(180deg);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .14) 0 4px, transparent 4px 10px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, .14) 0 4px, transparent 4px 10px),
    #a3262a;
  border: calc(var(--w) * .045) solid #fbf9f3;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .35);
}
.pcard.t1 .cback { background-color: #1f3f8f; }

.float-gain {
  position: absolute; left: 50%; top: 18%;
  font-size: 30px; font-weight: 800;
  color: var(--gold);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .35);
  pointer-events: none;
  opacity: 0;
}

/* ---------- play ---------- */
.play-grid { display: grid; gap: 18px; }
.board { display: flex; flex-direction: column; gap: 16px; }

.status {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 14px;
  text-align: center; font-size: 17px;
}
.status .deal-no { color: var(--label-2); font-weight: 600; }
.status .playing { font-weight: 600; }
.status .playing b { font-size: 20px; color: var(--accent); }
.status .wild { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.wild-card {
  display: inline-flex; align-items: center; gap: 1px;
  background: var(--paper); color: var(--card-red);
  border-radius: 5px; padding: 2px 6px; font-weight: 800; font-size: 15px;
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .12), 0 2px 4px rgba(0, 0, 0, .15);
  transform: rotate(-6deg);
}
.wild-card i { font-style: normal; }
.status.champ { flex-direction: column; gap: 2px; font-size: 28px; font-weight: 700; }
.status.champ.t0 strong { color: var(--red-text); }
.status.champ.t1 strong { color: var(--blue-text); }
.status.champ small { font-size: 15px; color: var(--label-2); font-weight: 400; }
.crown { color: var(--gold); font-size: 30px; line-height: 1; }
.crown.sm { font-size: 15px; margin-right: 6px; }

/* the card table: the one place the green felt lives */
.teams {
  --label-2: var(--on-felt-muted);
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 12px;
  border-radius: 24px;
  color: var(--on-felt);
  background:
    radial-gradient(ellipse 120% 90% at 50% 0%, var(--felt-hi) 0%, var(--felt) 55%, var(--felt-lo) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), inset 0 2px 18px rgba(0, 0, 0, .35), var(--shadow);
}
.team {
  position: relative;
  border: 1.5px solid transparent;
  border-radius: 16px;
  padding: 12px 8px 10px;
  text-align: center;
  min-width: 0;
  transition: border-color 240ms ease, background-color 240ms ease;
}
.team-head { font-weight: 700; font-size: 17px; }
.team.t0 .team-head { color: #ff8a7e; }
.team.t1 .team-head { color: #9dbfff; }
.team-players { color: var(--on-felt-muted); font-size: 15px; min-height: 20px; overflow-wrap: anywhere; }
.team-meta { min-height: 26px; display: flex; justify-content: center; align-items: center; }
.team.declaring { border-color: rgba(242, 196, 92, .55); background: rgba(242, 196, 92, .08); }
/* 掼蛋: the cards are the "who won" buttons. A press sinks the whole side a touch. */
.team.tap { width: 100%; transition: transform 160ms var(--ease-out), border-color 240ms ease, background-color 240ms ease; }
.team.tap .pcard-wrap { transition: transform 220ms var(--ease-out); }
.team.tap:active { transform: scale(.97); }
.team.tap:active .pcard-wrap { transform: translateY(3px); }
.tap-hint { margin: 0; }
.tap-inline { display: none; }
.team.champ { border-color: var(--gold); background: rgba(242, 196, 92, .14); }

/* ---------- 转蛋: money on the felt ---------- */
.money { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.money.pos { color: var(--accent); }
.money.neg { color: var(--red-text); }

.money-board {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 12px;
  border-radius: 24px;
  color: var(--on-felt);
  background: radial-gradient(ellipse 120% 90% at 50% 0%, var(--felt-hi) 0%, var(--felt) 55%, var(--felt-lo) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), inset 0 2px 18px rgba(0, 0, 0, .35), var(--shadow);
}
.money-team { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 10px 8px; border-radius: 16px; background: rgba(0, 0, 0, .14); }
.money-team .team-head { text-align: center; }
.money-team.t0 .team-head { color: #ff8a7e; }
.money-team.t1 .team-head { color: #9dbfff; }
.money-team .suit { margin-right: 4px; }
.money-row {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 6px; border-radius: 14px;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}
.money-row .avatar { width: 30px; height: 30px; font-size: 14px; background: var(--paper-2); color: var(--ink); box-shadow: none; }
.mr-name { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: 15px; max-width: 100%; overflow: hidden; white-space: nowrap; }
.mr-edit { width: 13px; height: 13px; flex-shrink: 0; color: #8a857a; }
button.money-row { width: 100%; font: inherit; text-align: center; transition: transform 140ms var(--ease-out); }
button.money-row:active { transform: scale(.97); }
.money-row .money { font-size: 24px; line-height: 1.1; color: var(--ink); }
.money-row .money.pos { color: #0a7a4f; }
.money-row .money.neg { color: var(--card-red); }
.float-money {
  position: absolute; right: 8px; top: 6px;
  font-size: 15px; font-weight: 800; pointer-events: none; opacity: 0;
}
.float-money.pos { color: #0a7a4f; }
.float-money.neg { color: var(--card-red); }
.stake-pill { padding: 3px 10px; border-radius: 10px; background: var(--accent-tint); color: var(--accent); font-weight: 600; font-size: 15px; }
.zhuan-tools .btn { flex: 1 1 140px; }

/* bombs counted during the hand: one big tap per bomb, − to take one back */
.bomb-live { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); }
.bl-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; font-weight: 600; color: var(--label-2); }
.bomb-x { font-variant-numeric: tabular-nums; }
.bomb-x.on { color: var(--gold-text); }
.bl-row { display: flex; align-items: center; gap: 10px; }
.bomb-btn {
  flex: 1; min-height: 52px; padding: 0 8px 0 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; background: var(--fill); color: var(--label);
  font-size: 18px; font-weight: 700;
  transition: transform 140ms var(--ease-out), background-color 180ms ease;
}
.bomb-btn:active:not(:disabled) { transform: scale(.96); }
.bomb-n {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 15px; margin-left: auto;
  display: inline-grid; place-items: center;
  background: var(--label-2); color: var(--surface); font-size: 16px; font-variant-numeric: tabular-nums;
}
.bomb-btn.on .bomb-n { background: var(--gold); color: #3a2800; }
.bomb-live .chip.jokers { margin-left: 0; min-height: 52px; border-radius: 26px; }

/* hand sheet: bombs and jokers, then ×1 ×2 ×3 with the amount each */
.bomb-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bomb-label { font-weight: 700; font-size: 17px; }
.mini-step {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--cell); font-size: 22px; font-weight: 700; color: var(--label);
  transition: transform 140ms var(--ease-out);
}
.mini-step:active:not(:disabled) { transform: scale(.9); }
.bomb-count { min-width: 22px; text-align: center; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.chip.jokers { margin-left: auto; }
.money-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; line-height: 1.1; }
.money-btn small { font-size: 15px; font-weight: 700; opacity: .92; font-variant-numeric: tabular-nums; }

.menu button.pairing { flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; }
.menu button.pairing .vs { color: var(--label-2); font-weight: 500; font-size: 13px; }
.menu button.pairing.on { background: var(--accent-tint); }

.totals-list, .settle-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.totals-list li, .settle-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 12px; background: var(--fill);
}
.totals-list li .money, .settle-list li .money { margin-left: auto; font-size: 17px; }
.settle-list .arrow { color: var(--label-2); }
.sheet .totals-list li, .sheet .settle-list li { background: var(--cell); }

.gr-money { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; min-width: 0; font-size: 15px; }
.gr-money > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill.zhuan { background: var(--accent-tint); color: var(--accent); }

.stake-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stake-field {
  display: flex; align-items: center; gap: 4px;
  min-height: 44px; padding: 0 12px; border-radius: 12px; background: var(--fill);
  font-weight: 700; font-size: 17px;
}
.stake-field input { width: 84px; border: 0; background: transparent; font-size: 17px; font-weight: 700; color: var(--label); }
.stake-field input:focus { outline: none; }

/* ---------- choose a mode (after the opening animation) ---------- */
#mode-pick {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  background: radial-gradient(ellipse 120% 70% at 50% 30%, #2b3f5f 0%, #1f2f4a 50%, #151f33 100%), #1f2f4a;
  color: var(--on-felt);
  overflow-y: auto;
}
/* quick game or tracked, as an iOS segmented control on the navy */
.mp-kind { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 4px; }
.mp-seg { width: 100%; max-width: 340px; background: rgba(255, 255, 255, .1); }
.mp-seg button { color: var(--on-felt); }
.mp-seg button.on { background: rgba(255, 255, 255, .24); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.mp-note { margin: 0; font-size: 15px; color: var(--on-felt-muted); text-align: center; }
.mp-inner { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 14px; }
.mp-title { font-size: 28px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.mode-card {
  display: flex; align-items: center; gap: 16px;
  padding: 18px; border-radius: 22px; text-align: left;
  background: rgba(255, 255, 255, .07); color: var(--on-felt);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
  transition: transform 160ms var(--ease-out), background-color 160ms ease;
}
.mode-card:active { transform: scale(.97); }
.mode-card.last { box-shadow: inset 0 0 0 2px var(--gold); }
.mc-cards { position: relative; display: flex; flex-shrink: 0; width: 104px; height: 92px; }
.mc-cards .pcard-wrap { --w: 58px; position: absolute; top: 4px; }
.mc-cards .pcard-wrap:nth-child(1) { left: 4px; transform: rotate(-10deg); }
.mc-cards .pcard-wrap:nth-child(2) { left: 40px; transform: rotate(9deg); }
.coin {
  position: absolute; display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe28a, var(--gold) 60%, #b8860b);
  color: #4a3300; font-weight: 800; font-size: 19px;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .35), 0 3px 8px rgba(0, 0, 0, .35);
  left: 56px; top: 8px;
}
.coin.two { left: 66px; top: 46px; }
.mc-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mc-text b { font-size: 24px; font-weight: 700; }
.mc-text span { color: var(--on-felt-muted); font-size: 16px; }
.mode-btn span { color: var(--accent); }
.mp-back {
  position: absolute; top: max(12px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left));
  min-height: 44px; padding: 0 6px; color: var(--on-felt); font-size: 17px; font-weight: 600;
}
.mp-back:active { opacity: .6; }
.mc-live {
  align-self: flex-start; margin-top: 4px; padding: 3px 10px; border-radius: 10px;
  background: var(--gold); color: #2a1d02; font-style: normal; font-size: 13px; font-weight: 700;
}

@media (hover: hover) and (pointer: fine) {
  .mode-card:hover { background: rgba(255, 255, 255, .12); }
  .team.tap:hover .pcard-wrap { transform: translateY(-4px); }
}

.badge {
  display: inline-block; padding: 4px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 700;
  background: rgba(242, 196, 92, .18); color: var(--gold);
}
.badge.hot { background: rgba(255, 138, 126, .2); color: #ff9d93; }
.badge.gold { background: var(--gold); color: #2a1d02; }

.record .hint { text-align: center; margin-bottom: 10px; }
.record-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
/* the two "who won" buttons: team-colored fills with a faint poker-chip rim */
.chip-btn {
  position: relative;
  min-height: 72px; border-radius: 22px;
  color: #fff; font-size: 20px; font-weight: 700;
  transition: transform 140ms var(--ease-out), filter 140ms ease;
}
.chip-btn::before {
  content: ""; position: absolute; inset: 6px;
  border: 2px dashed rgba(255, 255, 255, .35);
  border-radius: 17px;
  pointer-events: none;
}
.chip-btn span { position: relative; }
.chip-btn.t0 { background: var(--red); }
.chip-btn.t1 { background: var(--blue); }
.chip-btn:active { transform: scale(.97); filter: brightness(.92); }
.undo-deal { align-self: center; }
.quit-game { align-self: center; color: var(--red-text); margin-top: -6px; }

.log h2 { margin-bottom: 4px; }
.deals { list-style: none; margin: 0; padding: 0; }
.deal {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center; gap: 8px;
  padding: 11px 4px;
  min-height: 44px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  transition: background-color 160ms ease;
}
.deal + .deal { border-top: .5px solid var(--sep); border-radius: 0; }
.deal:active { background: var(--fill); }
.deal .num { color: var(--label-2); font-variant-numeric: tabular-nums; font-size: 13px; text-align: center; }
.deal .what { min-width: 0; font-weight: 600; }
.deal .first { display: block; font-weight: 400; font-size: 13px; color: var(--label-2); }
.deal .res { display: flex; align-items: center; gap: 4px; justify-content: flex-end; font-size: 15px; white-space: nowrap; flex-wrap: wrap; }
.deal .arrow { color: var(--label-2); }
.deal.ignored { opacity: .45; }
.deal.adjust .what { font-weight: 400; color: var(--label-2); }

.mini {
  display: inline-grid; place-items: center;
  min-width: 24px; height: 32px; padding: 0 4px;
  border-radius: 5px;
  background: var(--paper); font-weight: 800; font-size: 14px;
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .14), 0 1px 3px rgba(0, 0, 0, .14);
}
.mini.t0 { color: var(--card-red); }
.mini.t1 { color: var(--card-blue); }

/* ---------- new game ---------- */
/* "Let's play" sits under the teams and sticks just above the tab bar,
   so it never needs a scroll to reach */
.start-bar {
  position: sticky; z-index: 5;
  bottom: calc(var(--tabbar) + var(--tab-gap) + env(safe-area-inset-bottom) + 10px);
}
.start-bar .btn { box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
/* a see-through disabled button would let the rules show through while it floats */
.start-bar .btn:disabled { opacity: 1; background: var(--surface); color: var(--label-2); }

.hero { text-align: center; padding: 4px 0 0; }
.hero p { margin: 6px auto 0; max-width: 40ch; color: var(--label-2); }
.hero-title { font-size: 28px; font-weight: 700; margin: 18px 0 0; }
.fan { display: flex; justify-content: center; height: 112px; padding-top: 6px; }
.fan .pcard-wrap { margin: 0 -14px; transform-origin: 50% 120%; }
.fan .pcard-wrap:nth-child(1) { transform: rotate(-14deg); }
.fan .pcard-wrap:nth-child(2) { transform: translateY(-6px); z-index: 1; }
.fan .pcard-wrap:nth-child(3) { transform: rotate(14deg); }
.fan.deal-in .pcard-wrap { animation: deal-in 520ms var(--ease-out) backwards; }
.fan.deal-in .pcard-wrap:nth-child(2) { animation-delay: 70ms; }
.fan.deal-in .pcard-wrap:nth-child(3) { animation-delay: 140ms; }
@keyframes deal-in { from { opacity: 0; transform: translateY(60px) rotate(0deg) scale(.9); } }

.new-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.new-team { min-width: 0; display: flex; flex-direction: column; gap: 8px; padding: 14px; }
.new-team .team-head { font-size: 17px; }
.new-team.t0 .team-head { color: var(--red-text); }
.new-team.t1 .team-head { color: var(--blue-text); }
.slot { display: flex; align-items: stretch; background: var(--fill); border-radius: 12px; min-height: 50px; }
.slot-name { flex: 1; display: flex; align-items: center; gap: 10px; text-align: left; padding: 0 10px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: transform 140ms var(--ease-out); }
.slot-name:active { transform: scale(.97); }
.slot-name.empty { color: var(--label-2); font-weight: 500; font-size: 15px; gap: 8px; padding: 0 8px; }
.slot-x { width: 44px; color: var(--label-2); font-size: 22px; }
.guest-name { flex: 1; min-width: 0; width: 100%; background: transparent; border: 0; font-weight: 600; font-size: 17px; padding: 0; }
.guest-name::placeholder { color: var(--label-2); }
.guest-name:focus { outline: none; }
.slot:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }
.guest-note { margin: -6px 0 0; color: var(--on-felt-muted); }
.board > .guest-note { color: var(--label-2); }

.rules { display: flex; flex-direction: column; gap: 16px; }
.rules h2 { margin: 0; }
.rule { display: flex; flex-direction: column; gap: 8px; }
.rule b { font-weight: 600; }
.rule p { margin: 2px 0 0; font-size: 15px; }
.start-levels { display: flex; gap: 12px; }
.start-levels label { flex: 1; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.start-levels label.t0 { color: var(--red-text); }
.start-levels label.t1 { color: var(--blue-text); }
select {
  flex: 1; min-height: 44px; border-radius: 10px; border: 0;
  background: var(--fill); padding: 0 10px; font-size: 17px; color: var(--label);
}

/* ---------- lists: inset grouped ---------- */
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.list.dim { opacity: .6; }
.list > li + li:not(.day) { box-shadow: inset 16px .5px 0 var(--surface), inset 0 .5px 0 var(--sep); }
.list .day { color: var(--label-2); font-size: 13px; font-weight: 600; padding: 14px 16px 6px; background: var(--bg); }
.list .day:first-child { padding-top: 0; }
.game-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; min-height: 60px; cursor: pointer; background: var(--surface); transition: background-color 160ms ease; }
.list .day + .game-row { border-radius: var(--radius) var(--radius) 0 0; }
.game-row:active, .player-row:active { background: var(--fill); }
.gr-teams { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gr-teams > div { display: flex; align-items: center; gap: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--label-2); }
.gr-teams .won { font-weight: 600; color: var(--label); }
.gr-teams .mini { height: 26px; min-width: 22px; font-size: 13px; }
.gr-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 13px; flex-shrink: 0; }
.gr-del { flex-shrink: 0; margin: -8px -10px -8px -6px; font-size: 16px; }
.gr-del:active, .gr-del:hover { color: var(--red-text); }
.pill { padding: 3px 10px; border-radius: 10px; font-weight: 600; font-size: 12px; background: var(--fill); color: var(--label-2); }
.pill.t0 { background: var(--red-tint); color: var(--red-text); }
.pill.t1 { background: var(--blue-tint); color: var(--blue-text); }
.pill.live { background: var(--accent-tint); color: var(--accent); }

/* History groups by day: give each day its own inset group */
.list:has(.day) { background: transparent; border-radius: 0; overflow: visible; }
.list:has(.day) > .game-row { border-radius: 0; }
.list:has(.day) > .day + .game-row { border-radius: var(--radius) var(--radius) 0 0; }
.list:has(.day) > .game-row:has(+ .day), .list:has(.day) > .game-row:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.list:has(.day) > .day + .game-row:has(+ .day), .list:has(.day) > .day + .game-row:last-child { border-radius: var(--radius); }
.list:has(.day) > li + li:not(.day) { box-shadow: inset 16px .5px 0 var(--surface), inset 0 .5px 0 var(--sep); }
.list:has(.day) > .day + .game-row { box-shadow: none; }

.player-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 56px; cursor: pointer; transition: background-color 160ms ease; }
.pr-name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.player-row .muted { font-size: 15px; }
.player-row .row-btn { width: 40px; height: 40px; flex-shrink: 0; margin: -6px -6px -6px -4px; font-size: 16px; color: var(--label-2); }
.player-row .row-btn.del:active, .player-row .row-btn.del:hover { color: var(--red-text); }
.sub { font-size: 13px; font-weight: 600; color: var(--label-2); margin: 4px 16px -10px; }

.add-form { display: flex; gap: 10px; }
.add-form input {
  flex: 1; min-width: 0; min-height: 50px; padding: 0 16px;
  border-radius: 12px; border: 0; background: var(--surface);
  font-size: 17px; color: var(--label);
}
.add-form input::placeholder { color: var(--label-2); }
.add-form input:focus { outline: none; box-shadow: 0 0 0 2px var(--accent); }

/* ---------- stats ---------- */
.podium { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.podium-card {
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
  background: var(--surface);
  border-radius: var(--radius); padding: 18px 16px;
}
.podium-card .crown { color: var(--gold-text); font-size: 26px; }
.podium-card .muted { color: var(--label-2); font-size: 13px; font-weight: 600; }
.podium-card b { font-size: 22px; font-weight: 700; }
.podium-card > span:last-child { color: var(--label-2); font-size: 15px; }

.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; white-space: nowrap; }
th { text-align: left; font-size: 13px; color: var(--label-2); font-weight: 600; padding: 0 14px 8px 0; }
td { padding: 11px 14px 11px 0; border-top: .5px solid var(--sep); font-variant-numeric: tabular-nums; }
td.name { font-weight: 600; }
tr[data-action] { cursor: pointer; }
tr[data-action]:active td { background: var(--fill); }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile { background: var(--surface); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.tile span { font-size: 13px; color: var(--label-2); font-weight: 600; }
.tile b { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile.wide { grid-column: 1 / -1; }

.backup p { margin: 0 0 12px; font-size: 15px; }

/* ---------- sheet ---------- */
#sheet-root[data-leaving] { pointer-events: none; }
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 20; }
.sheet {
  position: fixed; z-index: 21;
  left: 0; right: 0; bottom: 0; margin: 0 auto;
  width: 100%; max-width: 560px; max-height: calc(var(--vh) * .92); overflow-y: auto;
  background: var(--sheet-bg); color: var(--label);
  border-radius: 28px 28px 0 0;
  padding: 8px 18px calc(16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
  overscroll-behavior: contain;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, .25);
}
.sheet h2 { font-size: 22px; font-weight: 700; margin: 4px 0 0; }
.sheet p { margin: 0; }
.grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--fill-2); align-self: center; }
.backdrop.enter { animation: fade 220ms ease-out; }
.sheet.enter { animation: rise 340ms var(--ease-drawer); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(100%); } }

@media (min-width: 700px) {
  .sheet { top: 0; bottom: 0; margin: auto; height: fit-content; border-radius: 28px; padding-bottom: 20px; }
  .sheet.enter { animation: pop 240ms var(--ease-out); }
  .grabber { display: none; }
  @keyframes pop { from { opacity: 0; transform: scale(.96); } }
}

.sheet .btn { background: var(--cell); }
.sheet .btn.gold { background: var(--accent); color: var(--on-accent); }
.sheet .btn.subtle { background: transparent; }
.btn.danger-solid { background: var(--red); color: #fff; }
.sheet .btn.ink { background: var(--accent); color: var(--on-accent); }
.sheet .chip { background: var(--cell); }
.sheet .chip.on { background: var(--accent); color: var(--on-accent); }
.sheet .seg { background: var(--fill); }
.won-title.t0 { color: var(--red-text); }
.won-title.t1 { color: var(--blue-text); }
.sheet .add-form input { background: var(--cell); }

.label { font-weight: 600; font-size: 15px; color: var(--label); margin-top: 4px !important; }
.big-seg button { min-height: 46px; font-size: 17px; }
.sheet .big-seg button.on.t0 { background: var(--red); color: #fff; }
.sheet .big-seg button.on.t1 { background: var(--blue); color: #fff; }

/* +1 / +2 / +3: one tap saves the hand */
.gain-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 4px; }
.gain-btn {
  min-height: 84px; border-radius: 20px;
  font-size: 34px; font-weight: 800; color: #fff;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 3px transparent;
  transition: transform 140ms var(--ease-out), filter 140ms ease;
}
.gain-btn.t0 { background: var(--red); }
.gain-btn.t1 { background: var(--blue); }
.gain-btn:active { transform: scale(.95); filter: brightness(.92); }
.gain-btn.on { box-shadow: inset 0 0 0 3px #fff, 0 0 0 3px var(--accent); }

/* The hand sheet: big targets, no Cancel (tap outside or Esc closes it) */
.sheet-deal { gap: 16px; padding-top: 12px; }
.sheet-deal .won-title { font-size: 28px; }
.sheet-deal .gain-btns { gap: 12px; }
.sheet-deal .gain-btn { min-height: 120px; border-radius: 24px; font-size: 46px; }
.sheet-deal .money-btn small { font-size: 18px; }
.sheet-deal .order-chip { min-height: 56px; font-size: 18px; }
@media (min-width: 700px) {
  .sheet-deal { max-width: 680px; padding: 28px 28px 32px; gap: 20px; }
  .sheet-deal .won-title { font-size: 32px; }
  .sheet-deal .gain-btn { min-height: 150px; font-size: 56px; }
}

.menu { display: flex; flex-direction: column; background: var(--cell); border-radius: 16px; overflow: hidden; }
.menu button { text-align: left; padding: 13px 16px; min-height: 50px; font-size: 17px; display: flex; flex-direction: column; justify-content: center; transition: background-color 140ms ease; }
.menu button + button { box-shadow: inset 16px .5px 0 var(--cell), inset 0 .5px 0 var(--sep); }
.menu button small { font-weight: 400; color: var(--label-2); font-size: 13px; }
.menu button.danger { color: var(--red-text); }
.menu button:active { background: var(--fill); }

.rank-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.rank-grid button { min-height: 44px; border-radius: 10px; background: var(--cell); font-weight: 700; transition: transform 140ms var(--ease-out); }
.rank-grid button:active { transform: scale(.94); }
.rank-grid button.t0 { color: var(--red-text); }
.rank-grid button.t1 { color: var(--blue-text); }
.rank-grid button.on.t0 { background: var(--red); color: #fff; }
.rank-grid button.on.t1 { background: var(--blue); color: #fff; }

.pick-list { display: flex; flex-direction: column; max-height: calc(var(--vh) * .45); overflow-y: auto; border-radius: 16px; background: var(--cell); }
.pick-list button { display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 54px; text-align: left; font-weight: 600; font-size: 17px; transition: background-color 140ms ease; }
.pick-list button + button { box-shadow: inset 60px .5px 0 var(--cell), inset 0 .5px 0 var(--sep); }
.pick-list button:active { background: var(--fill); }

/* ---------- toast ---------- */
#toast {
  position: fixed; z-index: 30;
  left: 50%; bottom: calc(var(--tabbar) + var(--tab-gap) + env(safe-area-inset-bottom) + 12px);
  transform: translate(-50%, 16px) scale(.96);
  display: flex; align-items: center; gap: 14px;
  max-width: calc(100% - 32px);
  background: var(--toast); color: var(--on-toast);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  padding: 8px 8px 8px 18px; border-radius: 999px;
  font-weight: 600; font-size: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  opacity: 0; pointer-events: none;
  transition: opacity 200ms ease, transform 260ms var(--ease-out);
}
#toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); pointer-events: auto; }
#toast span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#toast button { color: var(--on-accent); background: var(--accent); font-weight: 600; padding: 8px 16px; border-radius: 999px; flex-shrink: 0; transition: transform 140ms var(--ease-out); }
#toast button:active { transform: scale(.95); }
#toast .toast-extra { background: var(--gold); color: #2a1d02; }

/* first out: the quick picker, and the "not recorded" marks in lists and stats */
.first-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* finishing order: four players, tapped in the order they went out */
.order-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.order-chip {
  position: relative; display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 12px;
  border-radius: 14px; background: var(--cell); color: var(--label); font-size: 16px; font-weight: 600; text-align: left;
  box-shadow: inset 0 0 0 1.5px transparent;
  transition: transform 140ms var(--ease-out), background-color 160ms ease, box-shadow 160ms ease;
}
.order-chip:active:not(:disabled) { transform: scale(.96); }
.order-chip .oc-pos {
  min-width: 34px; height: 24px; padding: 0 6px; border-radius: 12px; display: inline-grid; place-items: center;
  font-size: 12px; font-weight: 800; background: var(--fill); color: var(--label-2);
}
.order-chip:not(.on) .oc-pos { min-width: 0; padding: 0; background: none; }
.order-chip .oc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-chip.on.t0 { box-shadow: inset 0 0 0 1.5px var(--red-text); }
.order-chip.on.t1 { box-shadow: inset 0 0 0 1.5px var(--blue-text); }
.order-chip.on.t0 .oc-pos { background: var(--red); color: #fff; }
.order-chip.on.t1 .oc-pos { background: var(--blue); color: #fff; }

/* tribute (单贡 / 双贡 / 内贡), on its own line under the status */
.status .tribute { flex-basis: 100%; font-weight: 700; color: var(--gold-text); }

/* backups */
.backup-when { margin: 0 0 12px; font-size: 14px; color: var(--label-2); }
.backup h3.sub { margin: 20px 0 4px; padding: 0; }
.backup-when.due { color: var(--warn); font-weight: 600; }
.copies { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; }
.copies li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: .5px solid var(--sep); }
.copies li:first-child { border-top: 0; }
.copies li span { display: flex; flex-direction: column; gap: 2px; }
.copies li small { color: var(--label-2); font-size: 13px; }
.copies .btn { min-height: 36px; padding: 0 16px; font-size: 15px; }
.backup-nudge {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 10px 10px 16px; margin-bottom: 12px; border-radius: var(--radius);
  background: var(--surface); font-size: 15px; font-weight: 600;
}
.backup-nudge .btn { min-height: 38px; padding: 0 16px; flex-shrink: 0; }

/* charts: thin lines, hairline grid, text in text colors */
.chart .ch-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 2px 0 6px; font-size: 13px; color: var(--label-2); }
.chart .ch-legend span, .ch-tip span { display: inline-flex; align-items: center; gap: 6px; }
.chart i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; }
.ch-plot { position: relative; }
.ch-plot svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.ch-grid { stroke: var(--sep); stroke-width: 1; }
.ch-grid.zero { stroke: var(--label-2); stroke-opacity: .5; }
.ch-yl, .ch-xl, .ch-end { fill: var(--label-2); font-size: 10px; font-weight: 600; font-family: inherit; }
.ch-yl { text-anchor: end; dominant-baseline: middle; }
.ch-end { dominant-baseline: middle; fill: var(--label); font-weight: 700; }
.ch-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-dot { stroke: var(--surface); stroke-width: 2; }
.ch-cross { stroke: var(--label-2); stroke-width: 1; opacity: 0; }
.ch-cross.on { opacity: .6; }
.ch-tip {
  position: absolute; top: 0; transform: translateX(-50%); z-index: 1; pointer-events: none;
  display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 12px;
  background: var(--toast); color: var(--on-toast); font-size: 12px; white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}
.ch-tip em { font-style: normal; font-weight: 700; margin-left: 6px; font-variant-numeric: tabular-nums; }
.first.nr { color: var(--label-2); font-style: italic; }
.nr { color: var(--label-2); font-size: .85em; font-weight: 600; white-space: nowrap; }
.tile small.nr { display: block; margin-top: 2px; font-size: 12px; }
.nr-legend { margin: 8px 0 0; }

/* ---------- confetti ---------- */
.confetti { position: fixed; inset: 0; z-index: 40; pointer-events: none; overflow: hidden; }
.confetti span { position: absolute; top: 0; color: var(--ink); background: var(--paper); border-radius: 4px; padding: 0 4px; line-height: 1.3; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.confetti span.red { color: var(--card-red); }

/* GG mode: the clip, big and centered over a dimmed table */
.gg { position: fixed; inset: 0; z-index: 41; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .6); }
.gg img {
  width: min(92vw, 760px, calc(var(--vh) * .82 * 16 / 9)); aspect-ratio: 16 / 9; object-fit: cover;
  border-radius: 22px; box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
}
.mp-title { -webkit-tap-highlight-color: transparent; }
.gg-tag {
  display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 8px; vertical-align: middle;
  background: var(--red); color: #fff; font-size: 13px; font-weight: 800; letter-spacing: .04em;
}

/* "Spring": won the game while the other side never took a hand */
.spring {
  --R: min(40vw, 32vh, 210px);   /* wreath radius; the word is sized to fit inside it */
  position: fixed; inset: 0; z-index: 41; pointer-events: none; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.spring-glow {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 214, 120, .35) 0, rgba(255, 150, 196, .22) calc(var(--R) * 1.2), transparent calc(var(--R) * 2.2)),
    rgba(4, 22, 14, .72);
}
.spring-center { position: relative; z-index: 1; width: calc(var(--R) * 2 + 56px); aspect-ratio: 1; display: grid; place-items: center; }
.spring-center::before {
  content: ''; position: absolute; inset: 28px; border-radius: 50%;
  background: radial-gradient(circle, #fff7fb 0%, #ffe1ee 55%, #ffc9df 100%);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, .35), 0 12px 40px rgba(0, 0, 0, .45), 0 0 80px rgba(255, 170, 210, .55);
}
.spring-ring { position: absolute; inset: 0; }
.spring-ring span {
  position: absolute; left: 50%; top: 50%; line-height: 1;
  font-size: calc(var(--R) * .26);
  transform: translate(-50%, -50%) rotate(var(--a)) translateY(calc(var(--R) * -1)) rotate(calc(var(--a) * -1));
}
.spring-ring i { display: block; font-style: normal; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .3)); }
.spring-word {
  position: relative; white-space: nowrap; text-align: center;
  font-size: calc(var(--R) * .34); font-weight: 900; letter-spacing: .03em; line-height: 1;
  color: #e0307a;
  text-shadow: 0 2px 0 #fff, 0 -2px 0 #fff, 2px 0 0 #fff, -2px 0 0 #fff,
    0 5px 0 #f2c45c, 0 8px 18px rgba(170, 30, 90, .35);
}
.spring .petal, .spring-fly { position: absolute; top: 0; left: 0; line-height: 1; }
.spring-fly { z-index: 2; font-size: 34px; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .3)); }

/* ---------- tab bar: a floating glass capsule ---------- */
#tabs {
  position: fixed; z-index: 10;
  left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right));
  bottom: calc(env(safe-area-inset-bottom) + var(--tab-gap));
  max-width: 440px; margin: 0 auto;
  display: flex; justify-content: center; gap: 2px;
  height: var(--tabbar); padding: 5px;
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(28px) saturate(1.5); backdrop-filter: blur(28px) saturate(1.5);
  box-shadow: inset 0 0 0 .5px var(--glass-line), 0 8px 28px rgba(0, 0, 0, .16);
}
#tabs button {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600; color: var(--label);
  transition: color 160ms ease, background-color 200ms ease;
}
#tabs .ti { font-size: 22px; line-height: 1; transition: transform 200ms var(--ease-out); }
#tabs button:active .ti { transform: scale(.85); }
#tabs button.on { color: var(--accent); background: var(--fill); }

@media (prefers-reduced-transparency: reduce) {
  #tabs, #toast { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
  #toast { color: var(--label); }
}
@media (prefers-contrast: more) {
  :root { --sep: rgba(60, 60, 67, .5); --fill: rgba(118, 118, 128, .22); }
  #tabs { box-shadow: inset 0 0 0 1px var(--label-2); }
}

/* ---------- iPad / wide ---------- */
@media (min-width: 900px) {
  .play-grid { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); align-items: start; }
  .log { position: sticky; top: calc(env(safe-area-inset-top) + 12px); max-height: calc(var(--vh) - var(--tabbar) - 60px); overflow-y: auto; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .chip-btn { min-height: 96px; font-size: 24px; }
  .status { font-size: 19px; }
}

@media (max-width: 380px) {
  .new-teams { grid-template-columns: 1fr; }
  .bar h1 { font-size: 30px; }
}

/* ---------- phone turned sideways: short and wide ----------
   The tab bar becomes a rail down the left side and the header shrinks to one line. (The
   play screen's full-screen table is shared with tablets; see the next block.) */

@media (orientation: landscape) and (max-height: 520px) {
  :root { --rail: 64px; }
  body {
    padding: max(8px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 20px) calc(max(10px, env(safe-area-inset-left)) + var(--rail) + 14px);
  }
  #tabs {
    left: max(10px, env(safe-area-inset-left)); right: auto; top: 50%; bottom: auto;
    transform: translateY(-50%);
    width: var(--rail); height: auto; max-width: none; margin: 0;
    flex-direction: column;
  }
  #tabs button { flex: none; height: 58px; }
  .start-bar { bottom: calc(env(safe-area-inset-bottom) + 10px); }

  /* one-line header: tools on both ends, a smaller title in between */
  .bar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; min-height: 44px; }
  .bar-row { display: contents; }
  .bar-left { order: 0; }
  .bar h1 { order: 1; flex: 1; font-size: 22px; line-height: 28px; gap: 8px; }
  .bar-right { order: 2; }
  .bar-logo { width: 26px; height: 26px; border-radius: 7px; }
  .narrow { gap: 12px; }

  .pcard-wrap { --w: clamp(70px, 24vh, 116px); margin: 6px auto 4px; }


  /* new game: the card fan sits beside the title instead of above it */
  .hero { display: grid; grid-template-columns: auto minmax(0, 34ch); justify-content: center; align-items: center; column-gap: 28px; text-align: left; padding: 6px 0 0; }
  .hero .fan { grid-row: span 2; height: 84px; transform: scale(.78); margin: -12px 0; }
  .hero-title { margin: 0; font-size: 24px; }
  .hero p { margin: 4px 0 0; }

  /* mode picker: the two choices side by side */
  .mp-inner { max-width: 780px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .mp-title { grid-column: 1 / -1; font-size: 24px; margin: 0; }

  /* sheets: a little tighter so a whole hand fits on screen */
  .sheet { max-height: calc(var(--vh) - 16px); gap: 10px; }
  .gain-btn { min-height: 64px; }
  .sheet-deal { padding-top: 12px; gap: 10px; }
  .sheet-deal .gain-btn { min-height: 84px; font-size: 38px; }
  .big-seg button { min-height: 40px; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- sideways play: the table, full screen ----------
   Phones turned sideways and touch tablets (iPad) in landscape: the play screen becomes the
   two level cards (or everyone's money in 转蛋), centered and big enough to read from across
   the room, with the way to record a hand underneath. It sits above the tabs; sheets, the
   toast and confetti still sit above it. Turning upright brings back the hands and tools. */
@media (orientation: landscape) and (max-height: 520px), (orientation: landscape) and (pointer: coarse) {
  /* up top, so it never covers the "who won" buttons */
  #toast { top: max(8px, env(safe-area-inset-top)); bottom: auto; transform: translate(-50%, -16px) scale(.96); }
  .play-grid {
    position: fixed; inset: 0; z-index: 15;
    display: flex; flex-direction: column; justify-content: center; align-items: stretch; gap: 6px;
    padding: max(10px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    --label-2: var(--on-felt-muted);
    color: var(--on-felt);
    background: radial-gradient(ellipse 120% 90% at 50% 0%, var(--felt-hi) 0%, var(--felt) 55%, var(--felt-lo) 100%), var(--felt);
  }
  .board { display: contents; }
  .board > :is(.guest-note, .undo-deal, .quit-game, .zhuan-tools), .play-grid > .log { display: none; }
  .board > .record, .board > .actions-row { flex: none; }
  .board > .record .hint { display: none; }
  .board > .record .chip-btn { min-height: 54px; font-size: 18px; }
  .board > .record .record-btns { gap: 24px; }
  .board > .actions-row { flex-wrap: nowrap; gap: 10px; }
  .board > .actions-row .btn { flex: 1; min-height: 50px; padding: 0 12px; font-size: 16px; }
  .board > .actions-row .btn:not(.gold) { background: rgba(255, 255, 255, .14); color: var(--on-felt); }

  /* 转蛋: money fills the top; bombs and "who won" share the bottom row */
  .play-grid.zhuan {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto; align-content: stretch; column-gap: 24px; row-gap: 8px;
  }
  .play-grid.zhuan .board > :is(.status, .money-board) { grid-column: 1 / -1; }
  .play-grid.zhuan .board > .record { align-self: center; }
  .play-grid.zhuan .board > .record .record-btns { gap: 10px; }
  .board > .bomb-live { flex: none; flex-direction: row; align-items: center; gap: 12px; padding: 0; background: none; }
  .board > .bomb-live .bl-head { color: var(--on-felt-muted); flex-direction: column; gap: 0; font-size: 13px; white-space: nowrap; }
  .board > .bomb-live .bomb-x.on { color: var(--gold); }
  .board > .bomb-live .bl-row { flex: 1; }
  .board > .bomb-live .bl-row { gap: 8px; min-width: 0; }
  .board > .bomb-live .bomb-btn { min-width: 0; padding-left: 12px; }
  .board > .bomb-live .bomb-btn, .board > .bomb-live .chip.jokers { min-height: 54px; }
  .board > .bomb-live .chip.jokers { padding: 0 12px; white-space: nowrap; }
  .board > .bomb-live .bomb-btn, .board > .bomb-live .mini-step, .board > .bomb-live .chip.jokers:not(.on) { background: rgba(255, 255, 255, .12); color: var(--on-felt); }
  .board > .bomb-live .bomb-n { background: rgba(255, 255, 255, .25); color: var(--on-felt); }
  .board > .bomb-live .bomb-btn.on .bomb-n { background: var(--gold); color: #3a2800; }
  .board > .status { flex: none; font-size: 17px; }
  .board > .status .playing b { color: var(--gold); }
  .board > .status .stake-pill { background: rgba(255, 255, 255, .14); color: var(--on-felt); }
  .board > .status.champ { font-size: 24px; }
  .board > .status.champ small { display: none; }
  .board > .status.champ .crown { display: none; }
  .board > .teams, .board > .money-board {
    flex: 1; min-height: 0; align-items: center; gap: 24px;
    padding: 0; border-radius: 0; background: none; box-shadow: none;
  }
  .board > .teams .team { padding: 4px 10px; }
  .board > .teams .team-head, .board > .teams .team-players { display: inline-block; min-height: 0; }
  .board > .teams .team-head { font-size: 20px; }
  .board > .teams .team-players::before { content: "·"; margin: 0 6px; }
  /* badges sit on the card's bottom edge, clear of the names */
  .board > .teams .team-meta { position: absolute; left: 0; right: 0; bottom: 14px; min-height: 0; z-index: 1; }
  .board > .teams .badge:not(.gold):not(.hot) { background: var(--felt); color: var(--gold); }
  .board > .teams .badge.hot { background: var(--card-red); color: #fff; }
  /* the game menu (settle up, partners, levels…) from the corner of the table */
  .table-menu {
    display: grid; place-items: center; position: absolute; z-index: 2;
    top: max(8px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right));
    width: 40px; height: 32px; border-radius: 16px;
    background: rgba(255, 255, 255, .14); color: var(--on-felt); font-size: 14px; letter-spacing: 1px;
    transition: transform 140ms var(--ease-out);
  }
  .table-menu:active { transform: scale(.92); }
  .board > .teams .pcard-wrap { --w: min(calc((var(--vh) - 64px) * 5 / 7), 31vw); margin: 4px auto 0; }
  /* before the first hand, the "tap their card" hint rides in the status line */
  .board > .tap-hint { display: none; }
  .play-grid.done .board > .teams .pcard-wrap { --w: min(calc((var(--vh) - 124px) * 5 / 7), 31vw); }

  /* 掼蛋: the two cards run almost the full height, with the status in a slim column
     between them: Red | deal, level, wild | Blue */
  .play-grid:not(.zhuan) {
    display: grid; grid-template-columns: minmax(0, 1fr) clamp(110px, 16vw, 170px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; row-gap: 8px;
  }
  .play-grid:not(.zhuan) .board > .teams { display: contents; }
  .play-grid:not(.zhuan) .team.t0 { grid-column: 1; grid-row: 1; }
  .play-grid:not(.zhuan) .team.t1 { grid-column: 3; grid-row: 1; }
  .play-grid:not(.zhuan) .board > .status { grid-column: 2; grid-row: 1; flex-direction: column; gap: 10px; line-height: 1.3; }
  .play-grid:not(.zhuan) .board > .status.champ { font-size: 22px; }
  .play-grid:not(.zhuan) .board > .status .tribute { flex-basis: auto; }
  .board > .status .tribute { color: var(--gold); }
  .play-grid:not(.zhuan) .board > .actions-row { grid-column: 1 / -1; grid-row: 2; }
  .board > .status .tap-inline { display: inline; color: var(--on-felt-muted); font-weight: 600; }
  .board > .money-board { align-items: stretch; padding: 4px 0; }
  .board > .money-board .money-team { justify-content: center; gap: 10px; padding: 10px; }
  .board > .money-board .team-head { font-size: 20px; }
  .board > .money-board .money-row { flex: 1; justify-content: center; gap: 2px; padding: 8px 12px; }
  .board > .money-board .money-row .avatar { display: none; }
  .board > .money-board .mr-name { font-size: 18px; }
  .board > .money-board .money-row .money { font-size: clamp(28px, 10vh, 46px); }
  .board > .money-board .float-money { font-size: 20px; }
  /* a narrow phone has no room for the bomb label; the hand sheet still shows the payout */
  @media (max-width: 800px) {
    .board > .bomb-live .bl-head { display: none; }
  }
}

/* the same table on a big tablet: everything scaled up to fill the screen */
@media (orientation: landscape) and (pointer: coarse) and (min-height: 600px) {
  .play-grid { padding: max(24px, env(safe-area-inset-top)) max(40px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(40px, env(safe-area-inset-left)); gap: 16px; }
  .play-grid.zhuan { column-gap: 40px; row-gap: 16px; }
  .board > .status { font-size: 24px; gap: 8px 20px; }
  .board > .status .wild-card { font-size: 21px; padding: 3px 9px; }
  .board > .status .stake-pill { font-size: 20px; padding: 5px 14px; border-radius: 14px; }
  .board > .status.champ { font-size: 36px; }
  .board > .teams { gap: 40px; }
  .board > .teams .team { padding: 14px 16px; border-radius: 24px; }
  .board > .teams .team-head { font-size: 30px; }
  .board > .teams .team-players { font-size: 21px; }
  .board > .teams .team-meta { bottom: 28px; }
  .board > .teams .badge { font-size: 17px; padding: 6px 14px; border-radius: 16px; }
  .board > .teams .pcard-wrap { --w: min(calc((var(--vh) - 130px) * 5 / 7), 36vw); margin: 10px auto 0; }
  .play-grid.done .board > .teams .pcard-wrap { --w: min(calc((var(--vh) - 230px) * 5 / 7), 36vw); }
  .play-grid:not(.zhuan) { grid-template-columns: minmax(0, 1fr) clamp(160px, 15vw, 220px) minmax(0, 1fr); column-gap: 24px; }
  .play-grid:not(.zhuan) .board > .status { gap: 16px; }
  .play-grid:not(.zhuan) .board > .status.champ { font-size: 32px; }
  .board > .money-board { gap: 40px; }
  .board > .money-board .money-team { gap: 16px; padding: 18px; border-radius: 24px; }
  .board > .money-board .team-head { font-size: 30px; }
  .board > .money-board .money-row { border-radius: 22px; gap: 6px; }
  .board > .money-board .mr-name { font-size: 26px; }
  .board > .money-board .mr-edit { width: 18px; height: 18px; }
  .board > .money-board .money-row .money { font-size: clamp(44px, 9vh, 96px); }
  .board > .money-board .float-money { font-size: 28px; right: 16px; top: 12px; }
  .board > .record .chip-btn { min-height: 80px; font-size: 26px; border-radius: 28px; }
  .board > .record .chip-btn::before { border-radius: 22px; }
  .board > .bomb-live .bl-head { font-size: 17px; }
  .board > .bomb-live .bomb-btn, .board > .bomb-live .chip.jokers { min-height: 80px; font-size: 22px; border-radius: 40px; }
  .board > .bomb-live .mini-step { width: 60px; height: 60px; font-size: 30px; }
  .board > .bomb-live .bomb-n { min-width: 40px; height: 40px; border-radius: 20px; font-size: 20px; }
  .board > .actions-row .btn { min-height: 72px; font-size: 22px; }
}

@media (hover: hover) and (pointer: fine) {
  .chip-btn:hover { filter: brightness(1.06); }
  .btn:hover:not(:disabled) { filter: brightness(1.05); }
  .deal:hover, .game-row:hover, .player-row:hover, .menu button:hover, .pick-list button:hover { background: var(--fill); }
}

@media (prefers-reduced-motion: reduce) {
  .backdrop.enter, .sheet.enter, .fan.deal-in .pcard-wrap { animation: none; }
  #toast { transition: opacity 200ms ease; }
}

/* ---------- opening animation: a soft, muted navy ----------
   Title text is 11.8:1 and the tagline 7.4:1 against the middle blue they sit on. */
#splash {
  --splash-hi: #2b3f5f;
  --splash: #1f2f4a;
  --splash-lo: #151f33;
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 24px; text-align: center;
  background: radial-gradient(ellipse 120% 70% at 50% 30%, var(--splash-hi) 0%, var(--splash) 50%, var(--splash-lo) 100%), var(--splash);
}
.splash-stage { position: relative; width: 300px; height: 300px; margin-bottom: 4px; }
.splash-stage .pcard-wrap {
  --w: 104px; position: absolute; left: 50%; top: 46%; margin: 0;
  transform-origin: 50% 130%;
}
.splash-chick { position: absolute; left: 50%; top: 64%; width: 168px; margin: -106px 0 0 -84px; }
.splash-chick img {
  display: block; width: 100%; height: auto; transform-origin: 50% 92%;
  filter: drop-shadow(0 14px 14px rgba(0, 0, 0, .35));
}
.splash-puff {
  position: absolute; width: 22px; height: 22px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, .7) 0, rgba(255, 255, 255, .25) 55%, transparent 70%);
}
.splash-title { font-size: clamp(30px, 9vw, 44px); font-weight: 800; letter-spacing: .01em; color: var(--on-felt); }
.splash-alt { margin-top: -6px; font-size: clamp(18px, 5.5vw, 24px); font-weight: 700; letter-spacing: .04em; color: var(--gold); }
.splash-tag { font-size: 16px; font-weight: 600; color: var(--on-felt-muted); }
.splash-suits { display: flex; gap: 18px; margin-top: 6px; font-size: 18px; color: var(--gold); }
.splash-suits span { display: inline-block; }

/* the opening animation, sideways: chick and aces on the left, the name on the right */
@media (orientation: landscape) and (max-height: 520px) {
  #splash {
    display: grid; grid-template-columns: auto auto; justify-content: center; align-content: center;
    justify-items: start; column-gap: 36px; row-gap: 6px; text-align: left;
  }
  .splash-stage { grid-row: 1 / span 4; width: 240px; height: 240px; margin: 0; }
  .splash-stage .pcard-wrap { --w: 84px; }
  .splash-chick { width: 136px; margin: -86px 0 0 -68px; }
  .splash-title { font-size: 40px; line-height: 1.1; }
  .splash-alt { margin-top: 0; font-size: 22px; }
  .splash-suits { margin-top: 4px; }
}
