/*
 * Drift — main.css
 * Shell shares Frame's visual system (frame-mobile-v10 lineage): brand tokens,
 * masthead, stage chrome, chips, bankroll, action buttons, info sheet, toast.
 * Drift-specific stage: one large anchor card + the die, the wake tracker
 * (six face cells), and the payout ladder strip. Phone-first, NO SCROLLING.
 */

:root {
  --bg: #0A0A0B;
  --surface: #131316;
  --elevated: #1C1C20;
  --text-primary: #EDEDF0;
  --text-secondary: #A1A1AA;
  --text-tertiary: #71717A;
  --accent: #10B981;
  --accent-bright: #34D399;
  --accent-dim: #047857;
  --border-subtle: #27272A;
  --border-strong: #3F3F46;
  --warning: #F59E0B;
  --danger: #EF4444;

  /* canonical card (v3) */
  --card-bg: #FFFFFF;
  --card-red: #C4444D;
  --card-black: #0E0E12;

  /* die stock — warm white, like felt-worn ivory */
  --die-bg-hi: #F8F5EE;
  --die-bg-lo: #E8E3D6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: #1A1A1F;
  min-height: 100dvh;
  font-family: 'Geist', sans-serif;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  justify-content: center;
  align-items: stretch;
}

/* ─────── App frame ─────── */
.app {
  width: min(414px, 100vw);
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain;
  touch-action: manipulation;
}

/* Desktop: render as a centered phone frame */
@media (min-width: 460px) {
  body { padding: 24px 0; align-items: center; }
  .app {
    height: min(860px, calc(100dvh - 48px));
    border-radius: 24px;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 30px 80px -10px rgba(0,0,0,0.7);
  }
}

.app::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 100% 30% at 50% -5%, rgba(16,185,129,0.10), transparent),
    radial-gradient(ellipse 80% 25% at 50% 105%, rgba(245,158,11,0.04), transparent);
  pointer-events: none;
  z-index: 0;
}
.app::after {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.9' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: overlay;
}
.app > * { position: relative; z-index: 2; }

/* ─────── Masthead ─────── */
.masthead {
  flex-shrink: 0;
  padding: calc(16px + env(safe-area-inset-top)) 18px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}
.wordmark {
  font-family: 'Geist', sans-serif;
  font-weight: 500;
  font-size: 19px;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  text-decoration: none;
  line-height: 1;
}
.wordmark .chevron { color: var(--accent); font-weight: 600; }
.game-title {
  font-family: 'Fraunces', serif;
  font-weight: 500; font-style: italic;
  font-size: 20px;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.01em;
}
.mast-right { display: flex; align-items: center; gap: 12px; }
.info-btn {
  background: transparent; border: none; padding: 4px; cursor: pointer;
  color: var(--text-tertiary);
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  transition: color 0.15s, background 0.15s, transform 0.1s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.info-btn:hover { color: var(--accent); background: rgba(16,185,129,0.08); }
.info-btn:active { transform: scale(0.94); }

/* ─────── Stage ─────── */
.stage-wrap {
  flex: 1;
  padding: 14px;
  display: flex;
  align-items: stretch;
  min-height: 0; min-width: 0;
}
.stage {
  flex: 1; min-width: 0;
  position: relative;
  padding: 14px 14px 0; /* no bottom padding: readout centers in the leftover space */
  background: linear-gradient(180deg, var(--surface) 0%, #0F0F11 100%);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow:
    0 0 0 1px rgba(16,185,129,0.04),
    0 14px 28px -10px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.02);
}

/* shared eyebrow for table zones */
.table-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.2em;
  color: var(--text-tertiary); line-height: 1; font-weight: 500;
}

/* ─────── Anchor + die row ─────── */
/* Height-aware sizing (Frame's dvh lesson): the stage must absorb short
   Safari viewports by shrinking the card/die, never by scrolling. */
.table-row {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: clamp(22px, 9vw, 44px);
  padding-top: 2px;
}
.table-col {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  justify-content: flex-start;
}
.table-col #anchorMount, .table-col #dieMount {
  display: flex; align-items: center; flex: 1;
}

/* ─────── Anchor card (Frame card architecture, one big card) ─────── */
.card {
  --card-w: clamp(74px, min(24vw, 11.5dvh), 96px);
  width: var(--card-w);
  aspect-ratio: 5 / 7;
  border-radius: 8px;
  position: relative;
  perspective: 700px;
  box-shadow: 0 3px 8px -1px rgba(0,0,0,0.5);
}
.card-flip {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.card.revealed .card-flip { transform: rotateY(180deg); }
.card-back, .card-face {
  position: absolute; inset: 0;
  border-radius: inherit;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.card-back { background: #0A0A0B; }
.card-back-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.card-back-mark {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Geist', sans-serif; font-weight: 600;
  font-size: calc(var(--card-w) * 0.125);
  color: var(--accent); letter-spacing: -0.02em; line-height: 1;
  user-select: none; pointer-events: none;
}
.card-back-mark .chevron { font-weight: 700; }
.card-face {
  background: var(--card-bg);
  transform: rotateY(180deg);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.card-corner {
  position: absolute; top: 5%; left: 7%;
  display: flex; flex-direction: column; align-items: flex-start;
  line-height: 0.82;
}
.card-rank {
  font-family: 'Geist', sans-serif;
  font-weight: 900;
  font-size: calc(var(--card-w) * 0.375);
  line-height: 0.85;
  letter-spacing: -0.06em;
}
.card-corner-suit { width: calc(var(--card-w) * 0.27); height: calc(var(--card-w) * 0.27); margin-top: 2%; display: block; }
.card-suit-large { position: absolute; bottom: 5%; right: 6%; width: calc(var(--card-w) * 0.55); height: calc(var(--card-w) * 0.55); }
.red { color: var(--card-red); }
.black { color: var(--card-black); }

/* ─────── The die ─────── */
.die {
  --die-s: clamp(74px, min(24vw, 11.5dvh), 96px);
  width: var(--die-s);
  height: var(--die-s);
  border-radius: calc(var(--die-s) * 0.18);
  background: linear-gradient(145deg, var(--die-bg-hi) 0%, var(--die-bg-lo) 100%);
  position: relative;
  box-shadow:
    0 6px 18px -4px rgba(0,0,0,0.6),
    0 0 0 1px rgba(0,0,0,0.08),
    inset 0 2px 4px rgba(255,255,255,0.5),
    inset 0 -2px 4px rgba(0,0,0,0.1);
  transition: box-shadow 0.2s ease;
}
.die.idle { opacity: 0.8; }
.die-face {
  position: absolute; inset: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: calc(var(--die-s) * 0.16);
}
.die-pip {
  width: calc(var(--die-s) * 0.14);
  height: calc(var(--die-s) * 0.14);
  background: var(--card-black);
  border-radius: 50%;
  align-self: center; justify-self: center;
  box-shadow: inset 0 2px 3px rgba(0,0,0,0.4);
}
/* pip grid slots */
.die-pip.tl { grid-column: 1; grid-row: 1; }
.die-pip.tr { grid-column: 3; grid-row: 1; }
.die-pip.ml { grid-column: 1; grid-row: 2; }
.die-pip.mr { grid-column: 3; grid-row: 2; }
.die-pip.bl { grid-column: 1; grid-row: 3; }
.die-pip.br { grid-column: 3; grid-row: 3; }
.die-pip.c  { grid-column: 2; grid-row: 2; }

.die.rolling { animation: die-tumble 0.65s cubic-bezier(0.3, 0.6, 0.4, 1); }
@keyframes die-tumble {
  0%   { transform: rotate(0deg)    scale(1); }
  20%  { transform: rotate(-14deg)  scale(1.06) translateY(-6px); }
  45%  { transform: rotate(11deg)   scale(1.09) translateY(-9px); }
  70%  { transform: rotate(-7deg)   scale(1.04) translateY(-3px); }
  100% { transform: rotate(0deg)    scale(1); }
}
.die.land {
  box-shadow:
    0 0 0 2px var(--accent),
    0 0 18px 0 rgba(16,185,129,0.5),
    0 6px 18px -4px rgba(0,0,0,0.6),
    inset 0 2px 4px rgba(255,255,255,0.5);
}
.die.bust { animation: die-bust 0.55s ease; }
@keyframes die-bust {
  0%, 100% { transform: translateX(0); box-shadow: 0 0 0 2px var(--danger), 0 0 20px 2px rgba(239,68,68,0.55), 0 6px 18px -4px rgba(0,0,0,0.6); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
.die.bust .die-pip { background: var(--danger); }

/* ─────── Wake tracker (dead faces) ─────── */
.wake-zone {
  flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.wake-track { display: flex; gap: 7px; }
.wake-cell {
  --cell-s: clamp(26px, min(7.2vw, 4dvh), 32px);
  width: var(--cell-s); height: var(--cell-s);
  border-radius: calc(var(--cell-s) * 0.22);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-strong);
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: calc(var(--cell-s) * 0.16);
  transition: border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}
.wake-cell .die-pip {
  width: calc(var(--cell-s) * 0.15);
  height: calc(var(--cell-s) * 0.15);
  background: var(--text-tertiary);
  box-shadow: none;
}
.wake-cell.dead {
  background: rgba(239,68,68,0.10);
  border-color: rgba(239,68,68,0.55);
}
.wake-cell.dead .die-pip { background: var(--danger); }
.wake-cell.just-hit { animation: cell-hit 0.5s ease; }
@keyframes cell-hit {
  0% { box-shadow: 0 0 0 0 rgba(239,68,68,0.7); }
  50% { box-shadow: 0 0 14px 3px rgba(239,68,68,0.65); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}
.wake-cell.just-dead { animation: cell-dim 0.5s ease; }
@keyframes cell-dim {
  0% { box-shadow: 0 0 0 0 rgba(16,185,129,0.6); }
  50% { box-shadow: 0 0 12px 2px rgba(16,185,129,0.5); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

/* ─────── The drift track (vertical voyage: ladder + roll history + position) ─────── */
.track {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 6px;
  position: relative;
  --trail-stop: 0%;
}
/* the trail — your wake down the stamp column */
.track::before {
  content: '';
  position: absolute; left: 80px; top: 16px; bottom: 16px; width: 1.5px;
  background: linear-gradient(180deg,
    var(--accent-dim) 0%,
    var(--accent) max(calc(var(--trail-stop) - 6%), 0%),
    var(--border-strong) var(--trail-stop),
    var(--border-strong) 100%);
  opacity: 0.5;
  transition: opacity 0.2s ease;
}
.track.washed::before { opacity: 0.18; }
.trow {
  display: grid;
  grid-template-columns: 30px 44px 1fr auto;
  align-items: center; gap: 12px;
  padding: 5px 10px;
  min-height: clamp(36px, 5.6dvh, 44px);
  border-radius: 8px;
  position: relative;
  transition: background 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.trow-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; letter-spacing: 0.16em; line-height: 1;
  color: var(--text-tertiary);
}
.trow-status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-tertiary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.trow-mult {
  font-family: 'Fraunces', serif; font-weight: 600; font-style: italic;
  font-size: clamp(15px, 4.2vw, 17px);
  line-height: 1; letter-spacing: -0.02em;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap; justify-self: end;
}
.trow-stamp {
  width: clamp(30px, 4.6dvh, 34px);
  height: clamp(30px, 4.6dvh, 34px);
  border-radius: 7px;
  justify-self: center;
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 16%;
}
.trow-stamp .die-pip {
  width: 5px; height: 5px;
  background: var(--card-black);
  box-shadow: none;
}
/* survived rows: the rolled face stamped in die stock */
.trow.done .trow-stamp,
.trow.current .trow-stamp {
  background: linear-gradient(145deg, var(--die-bg-hi) 0%, var(--die-bg-lo) 100%);
  box-shadow: 0 2px 6px -1px rgba(0,0,0,0.5), 0 0 0 1.5px var(--accent-dim);
}
.trow.done .trow-num, .trow.done .trow-status { color: var(--accent-dim); }
.trow.done .trow-mult { color: var(--accent-dim); }
/* where you float now */
.trow.current {
  background: rgba(16,185,129,0.10);
  box-shadow: inset 0 0 0 1px rgba(16,185,129,0.45), 0 0 16px -2px rgba(16,185,129,0.35);
}
.trow.current .trow-stamp { box-shadow: 0 2px 6px -1px rgba(0,0,0,0.5), 0 0 0 2px var(--accent); }
.trow.current .trow-num, .trow.current .trow-status { color: var(--accent); }
.trow.current .trow-mult { color: var(--accent-bright); }
/* the roll in flight */
.trow.rolling .trow-stamp {
  border: 1.5px dashed var(--accent);
  background: rgba(16,185,129,0.08);
}
.trow.rolling .trow-stamp::after {
  content: '';
  position: absolute; inset: 30%;
  border-radius: 50%;
  background: var(--accent-bright);
  animation: stamp-pulse 0.9s ease-in-out infinite;
}
@keyframes stamp-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.05); box-shadow: 0 0 10px 2px rgba(16,185,129,0.6); }
}
.trow.rolling .trow-num, .trow.rolling .trow-status { color: var(--accent); }
/* the face that caught you */
.trow.bust .trow-stamp {
  background: rgba(239,68,68,0.12);
  box-shadow: 0 0 0 1.5px var(--danger);
}
.trow.bust .trow-stamp .die-pip { background: var(--danger); }
.trow.bust .trow-num, .trow.bust .trow-status { color: var(--danger); }
.trow.bust .trow-mult { color: var(--text-tertiary); }
.trow.future .trow-stamp {
  border: 1px solid var(--border-strong);
  background: rgba(255,255,255,0.02);
}
.trow.washed { opacity: 0.45; }
.trow.washed.bust { opacity: 1; }
.trow.hit { animation: trow-hit 0.7s ease; }
@keyframes trow-hit {
  0% { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 0 rgba(16,185,129,0.6); }
  50% { box-shadow: inset 0 0 0 1px var(--accent-bright), 0 0 22px 6px rgba(16,185,129,0.65); }
  100% { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 0 rgba(16,185,129,0); }
}

/* ─────── Hand readout (Frame) ─────── */
.hand-readout {
  flex-shrink: 0;
  margin: 2px 0 12px; /* the track above owns the flex space now */
  width: 100%;
  padding: 12px 18px;
  background: linear-gradient(180deg, rgba(16,185,129,0.12) 0%, transparent 100%);
  border: 1px solid var(--accent);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: relative;
  transition: opacity 0.2s ease;
}
.hand-readout.idle { border-color: var(--border-subtle); background: rgba(255,255,255,0.02); }
.hand-readout::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.7;
}
.hand-readout.idle::before { opacity: 0.15; }
.hand-readout-name {
  font-family: 'Fraunces', serif;
  font-weight: 500; font-style: italic;
  font-size: 19px;
  color: var(--text-primary);
  line-height: 1.1; letter-spacing: -0.01em;
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hand-readout.idle .hand-readout-name { color: var(--text-tertiary); }
.hand-readout-payout {
  font-family: 'Fraunces', serif;
  font-weight: 500; font-style: italic;
  font-size: 22px;
  color: var(--accent);
  line-height: 1.1; letter-spacing: -0.02em;
  flex-shrink: 0; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.hand-readout-payout.loss { color: var(--text-tertiary); }

/* ─────── Bet zone (chips ↔ locked-ante display, swapped by phase) ─────── */
.bet-zone { flex-shrink: 0; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.bet-col { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; min-height: 55px; justify-content: center; }
.bet-col.hidden { display: none; }
.zone-label {
  font-family: 'JetBrains Mono', monospace; font-size: 9px; text-transform: uppercase;
  letter-spacing: 0.18em; color: var(--accent); line-height: 1; font-weight: 500;
}
.stake-value {
  font-family: 'Fraunces', serif; font-weight: 500; font-style: italic;
  font-size: 26px; color: var(--text-primary); line-height: 1;
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.chips-row { display: flex; gap: 6px; flex-shrink: 0; }
.chip {
  background: transparent; border: none; padding: 0; cursor: pointer;
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  position: relative; transition: transform 0.15s ease;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.chip:active { transform: scale(0.95); }
.chip:disabled { opacity: 0.35; cursor: not-allowed; }
.chip-face {
  width: 100%; height: 100%; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; position: relative;
  box-shadow: 0 3px 7px -2px rgba(0,0,0,0.5), inset 0 -2px 4px rgba(0,0,0,0.25), inset 0 2px 4px rgba(255,255,255,0.18);
}
.chip-face.red { background: linear-gradient(180deg, #E0353E 0%, #B82C34 100%); }
.chip-face.green { background: linear-gradient(180deg, #10B981 0%, #047857 100%); }
.chip-face.black { background: linear-gradient(180deg, #2A2A30 0%, #0E0E12 100%); }
.chip-face.purple { background: linear-gradient(180deg, #9B6CF6 0%, #6D28D9 100%); }
.chip-face::before {
  content: ''; position: absolute; inset: 3px; border-radius: 50%;
  border: 1.5px dashed rgba(255,255,255,0.4); pointer-events: none;
}
.chip-value {
  font-family: 'Fraunces', serif; font-weight: 600; font-style: italic;
  font-size: 15px; color: #fff; line-height: 1; z-index: 1; letter-spacing: -0.02em;
}
.chip.active .chip-face {
  box-shadow:
    0 0 18px 0 rgba(16,185,129,0.7),
    0 3px 7px -2px rgba(0,0,0,0.5),
    inset 0 0 0 2px rgba(255,255,255,0.5),
    inset 0 -2px 4px rgba(0,0,0,0.25),
    inset 0 2px 4px rgba(255,255,255,0.18);
}
.bankroll-col { margin-left: auto; margin-right: 4px; width: 100px; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.bankroll-label {
  font-family: 'JetBrains Mono', monospace; font-size: 9px; text-transform: uppercase;
  letter-spacing: 0.18em; color: var(--accent); line-height: 1; font-weight: 500;
}
.bankroll-value {
  font-family: 'Fraunces', serif; font-weight: 500; font-style: italic;
  font-size: 26px; color: var(--text-primary); line-height: 1;
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
  padding-right: 4px; /* pull the italic number's right edge in to line up with the label */
}

/* ─────── Action zone ─────── */
.action-zone {
  flex-shrink: 0;
  padding: 18px 14px calc(28px + env(safe-area-inset-bottom));
  display: flex; gap: 10px;
}
.action-zone .hidden { display: none; }
.primary-action {
  flex: 1.15;
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent);
  padding: 16px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  position: relative; overflow: hidden; line-height: 1;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.primary-action::before {
  content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: btn-shimmer 3s infinite;
}
@keyframes btn-shimmer { 0% { left: -100%; } 100% { left: 100%; } }
.primary-action:not(.disabled):hover { background: var(--accent-bright); }
.primary-action:not(.disabled):active { transform: scale(0.98); }
.primary-action.disabled { opacity: 0.5; cursor: not-allowed; }
.primary-action.disabled::before { display: none; }
.action-verb {
  font-family: 'Geist', sans-serif; font-weight: 600; font-size: 15px;
  letter-spacing: 0.04em; color: var(--bg); z-index: 1; white-space: nowrap;
}
.action-amount {
  font-family: 'Fraunces', serif; font-style: italic; font-weight: 600;
  font-size: 17px; color: var(--bg); z-index: 1; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
/* HOLD — the player's discipline button: green outline, exact amount */
.hold-action {
  flex: 1;
  background: rgba(16,185,129,0.07);
  border: 1px solid var(--accent);
  padding: 16px 10px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  line-height: 1;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.hold-action:hover { background: rgba(16,185,129,0.14); }
.hold-action:active { transform: scale(0.98); }
.hold-action.disabled { opacity: 0.5; cursor: not-allowed; }
.hold-action .action-verb { color: var(--accent-bright); }
.hold-action .action-amount { color: var(--accent-bright); }
.secondary-action {
  flex-shrink: 0; width: 100px;
  background: transparent; border: 1px solid var(--border-strong);
  color: var(--text-secondary); padding: 16px 0; border-radius: 6px; cursor: pointer;
  font-family: 'Geist', sans-serif; font-weight: 500; font-size: 14px;
  letter-spacing: 0.06em; transition: all 0.15s; line-height: 1;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.secondary-action:hover { border-color: var(--text-secondary); color: var(--text-primary); }
.secondary-action:active { transform: scale(0.98); }

/* ─────── Toast ─────── */
.toast {
  position: absolute; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(8px);
  background: var(--elevated); color: var(--text-primary);
  border: 1px solid var(--accent);
  padding: 10px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 24px -6px rgba(0,0,0,0.6);
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 20; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─────── Ladder / rules sheet ─────── */
.sheet {
  position: absolute; inset: 0; z-index: 30;
  background: var(--bg);
  display: flex; flex-direction: column; gap: 25px; /* roomy section breaks like Frame (JH) — verified no-scroll at 740px */
  padding: calc(14px + env(safe-area-inset-top)) 20px calc(10px + env(safe-area-inset-bottom));
  opacity: 0; visibility: hidden; transform: translateY(14px);
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.2,0.7,0.2,1), visibility 0.22s;
  overflow-y: auto;
}
.sheet.open { opacity: 1; visibility: visible; transform: translateY(0); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-title {
  font-family: 'Fraunces', serif; font-style: italic; font-weight: 600;
  font-size: 26px; color: var(--text-primary); letter-spacing: -0.01em;
}
.sheet-close {
  background: transparent; border: 1px solid var(--border-strong); color: var(--text-secondary);
  width: 36px; height: 36px; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.sheet-close:hover { color: var(--text-primary); border-color: var(--text-secondary); }
.sheet-section { display: flex; flex-direction: column; gap: 7px; }
.sheet-eyebrow {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.18em; color: var(--accent);
}
.paytable { width: 100%; border-collapse: collapse; }
.paytable td { padding: 4px 0; border-bottom: 1px solid var(--border-subtle); }
.paytable tr:last-child td { border-bottom: none; }
.pt-name { font-family: 'Geist', sans-serif; font-size: 15px; color: var(--text-primary); }
.pt-mult {
  font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums;
  font-size: 15px; text-align: right; font-weight: 500;
}
.pt-mult.win { color: var(--accent); }
.sheet-note { font-size: 12px; color: var(--text-tertiary); line-height: 1.45; }
.wake-track.demo { padding: 2px 0; }
.wake-track.demo .wake-cell { --cell-s: 28px; }

.sheet-steps {
  margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 5px;
}
.sheet-steps li {
  font-size: 14px; line-height: 1.4; color: var(--text-secondary); padding-left: 4px;
}
.sheet-steps li::marker {
  font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--accent);
}
.sheet-steps strong, .sheet-facts strong { color: var(--text-primary); font-weight: 600; }

.sheet-facts {
  margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px;
}
.sheet-facts li {
  font-size: 13px; line-height: 1.4; color: var(--text-secondary);
  padding-left: 16px; position: relative;
}
.sheet-facts li::before {
  content: ''; position: absolute; left: 2px; top: 0.5em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .card-flip, .primary-action, .hold-action, .chip, .toast, .sheet,
  .die, .wake-cell, .ladder-rung { transition: none; }
  .primary-action::before, .die.rolling, .die.bust, .wake-cell.just-hit,
  .wake-cell.just-dead, .ladder-rung.hit { animation: none; }
}
