/* ── Google Sans Flex ── */
@font-face {
  font-family: 'Google Sans Flex';
  src: url('GoogleSansFlex.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
}

/* ── Originals Design System Tokens ── */
:root {
  /* Colors */
  --bg: #171717;
  --bg-secondary: #171717;
  --surface-default: #262626;
  --surface-raised: #404040;
  --surface-overlay: #171717;
  --border-default: #262626;
  --border-strong: #525252;

  /* Content */
  --content-primary: #ffffff;
  --content-secondary: #d4d4d4;
  --content-tertiary: #737373;
  --content-disabled: #525252;
  --content-inverse: #171717;

  /* Brand */
  --brand-primary: #ffd106;
  --brand-rgb: 255, 209, 6;   /* brand-primary as r,g,b for glows/tints — rgba(var(--brand-rgb), a) */
  --brand-secondary: #fbbf24;
  --brand-highlight: #fcd34d;
  --brand-border: #ccab18;

  /* Action / CTA accent — decoupled from --brand-primary so a brand can use a
     different colour for its primary buttons than for its arena/logo accent.
     Default: buttons follow the brand accent (yellow). Aviator overrides to green. */
  --action-primary: var(--brand-primary);
  --action-text: var(--content-inverse);

  /* Status */
  --status-success: #22c55e;
  --status-error: #f43f5e;

  /* Shadow */
  --shadow-neutral: #171717;

  /* Legacy aliases */
  --brand: #ffd106;
  --red: #f43f5e;
  --green: #22c55e;
  --amber: #ffd106;
  --tx: #ffffff;
  --tx2: #d4d4d4;
  --tx3: #737373;
  --card: #171717;
  --card2: #262626;
  --elev: #262626;
  --brd: #262626;
  --brd2: #404040;
  --bg-old: #0d0d0d;
  --blue: #ffd106;
  --purple: #ffd106;

  /* Typography */
  --font-primary: 'Google Sans Flex', system-ui, sans-serif;
  --font-mono: 'Google Sans Flex', monospace;
  --font: var(--font-primary);
  --mono: var(--font-mono);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 6px;
  --space-8: 8px;
  --space-12: 12px;

  /* Font sizes */
  --font-size-2xs: 10px;
  --font-size-xs: 12px;
  --font-size-sm: 14px;
  --font-size-md: 16px;
  --font-size-lg: 18px;

  /* Responsive tokens (mobile first) */
  --pad: 12px;
  --gap: 8px;
  --die-size: 56px;
  --btn-h: 40px;
  --radius: 16px;
}

/* ── Aviator brand ──
   Same dark theme as the default; only the brand (primary) colour swaps to
   Aviator crimson and on-brand text flips to white. Activated by app.jsx adding
   `brand-aviator` to <html> from the ?brand=aviator launch param. Every brand
   accent reads var(--brand-primary) / rgba(var(--brand-rgb), …), so this single
   block re-themes the whole game. Semantic colours (win/lose/push) are untouched. */
:root.brand-aviator {
  /* Arena / logo / accent crimson (Figma new-aviator: #AF292A + hotter glow reds) */
  --brand-primary: #AF292A;
  --brand-rgb: 175, 41, 42;
  --brand-secondary: #c1352f;
  --brand-highlight: #d94a42;
  --brand-border: #7c2824;
  --brand: #AF292A;
  --amber: #AF292A;
  --blue: #AF292A;
  --purple: #AF292A;
  /* Dual-accent: primary CTAs are GREEN in the new aviator design, not crimson. */
  --action-primary: #37A003;
  --action-text: #ffffff;
  /* dark crimson is a dark surface → on-brand text must be light, not #171717 */
  --content-inverse: #ffffff;
}
/* Aviator's deep-space background: a top-centred teal glow (Figma bg-on-top)
   layered over the top-down linear gradient (designer spec). The starfield
   canvas sits on this and the stars draw over it — the animation is untouched;
   this only enriches the STATIC backdrop the stars float on. */
:root.brand-aviator body {
  background:
    radial-gradient(150% 62% at 50% -16%, #13252F 0%, rgba(15, 29, 40, 0) 60%),
    linear-gradient(180deg, #0A131A 0%, #000000 45%, #000000 100%);
  background-attachment: fixed;
}
.starfield-bg {
  position: fixed;
  inset: 0;
  /* z-index:0 (not -1) so it renders ABOVE an opaque html background on iOS
     WebKit — a negative-z-index fixed layer is painted behind the root bg there,
     which both hid the animation and left the safe-area white. The game content
     is lifted to z-index:1 so it still sits on top of the starfield. */
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(180deg, #0A131A 0%, #000000 45%, #000000 100%);
}
/* Keep all game content above the z-index:0 starfield (aviator only). */
:root.brand-aviator .game-arena-center,
:root.brand-aviator .m-controls {
  position: relative;
  z-index: 1;
}

/* ── Reset ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── Body & Layout ── */
/* Dark root so the iOS safe-area insets (status bar / home indicator) under
   viewport-fit=cover render #171717, not white. Safe to be opaque because the
   aviator starfield canvas sits at z-index:0 (not -1) with the game content
   lifted above it — see .starfield-bg / .game-arena-center / .m-controls. */
html {
  background: #171717;
}
body {
  height: 100dvh;
  background: var(--bg);
  color: var(--content-primary);
  font-family: var(--font-primary);
  display: flex;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  /* Casino-style: nothing in the UI is text-selectable by default. Avoids
     the player accidentally highlighting chip totals / bet amounts while
     mashing the table. The Provably Fair surfaces below opt back in
     (.pf-result, .pf-input-text, .hist-seed-* etc.) so players can copy
     server seeds / hashes for independent verification. */
  user-select: none;
  -webkit-user-select: none;
}

/* Anything inside the Provably Fair drawer or the per-round history's
   seed reveal is meant to be copied. Re-enable text selection on those. */
.pf-result,
.pf-result *,
.pf-input,
.pf-input *,
.hist-seed-group,
.hist-seed-group *,
.hist-seeds,
.hist-seeds * {
  user-select: text;
  -webkit-user-select: text;
}

#root {
  width: 100%;
  max-width: 520px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
  flex-shrink: 0;
  gap: 8px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--surface-default);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.icon-btn:hover {
  background: var(--surface-raised);
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.history-btn {
  height: 32px;
  padding: 0 12px 0 8px;
  border-radius: var(--radius-md);
  background: var(--surface-default);
  border: none;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.history-btn:hover {
  background: var(--surface-raised);
}

.history-btn:active {
  transform: scale(0.95);
}

.history-btn svg {
  width: 16px;
  height: 16px;
}

.history-btn span {
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--content-primary);
  line-height: 1.5;
}

/* ── Brand Logo ── */
.brand-logo {
  display: flex;
  justify-content: center;
  padding: 4px 0 6px;
  flex-shrink: 0;
}

.brand-logo-img {
  width: 171px;
  height: 38px;
}

/* ── Game Arena ── */
.game-arena-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
}

.game-arena {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0d0d0d;
  border-radius: var(--radius-sm);
  padding: 0;
  position: relative;
  min-height: 0;
}


/* ── Arena Header (icons inside game area — desktop only) ── */
.arena-header {
  display: none;
}

/* ── Arena Layout ── */
.arena-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  gap: 0;
  margin-top: -40px;
  transform: translateY(-20px); /* mobile: nudge whole table 20px higher (exact) */
}

.arena-label-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 5;
}
.arena-label-row .chip {
  min-width: 50px;
  height: 22px;
  padding: 4px;
  font-size: 10px;
  line-height: 140%;
  box-shadow: 0px 1px 0px #171717;
  border-radius: 8px;
}
.arena-top-labels {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 5;
  margin-bottom: -11px;
  order: 1;
  position: relative;
}

.arena-score--top {
  order: 2;
}

.arena-dice--top {
  order: 3;
}

.arena-table {
  order: 4;
}

.arena-dice--bottom {
  order: 5;
}

.arena-score--bottom {
  order: 6;
}

.arena-bottom-labels {
  order: 7;
}

.arena-bottom-labels {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 3;
  margin-top: -11px;
  height: 60px;
  flex-shrink: 0;
  position: relative;
}

/* Player dice inside the table */

.arena-dice {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  transform-style: preserve-3d;
}

.arena-dice--top {
  margin-bottom: -70px;
  --die-size: 40px;
  z-index: 2;
}

.arena-dice--top .zdog-dice-canvas {
  transform: rotate(180deg) translateY(-20px) scale(0.72);
}

.arena-dice--bottom {
  margin-top: -110px;
  --die-size: 56px;
  z-index: 2;
}

/* Score chips — sit between dice and table */
.arena-score {
  z-index: 3;
}

.arena-score--top {
  z-index: 5;
  position: relative;
}

.arena-score--bottom {
  z-index: 3;
  position: relative;
}

/* ── Arena Table Shape ── */
.arena-table {
  position: relative;
  width: clamp(216px, 70vh - 100px, 332px);
  overflow: visible;
}

.arena-table-bg {
  display: block;
  width: 100%;
  height: auto;
}
/* Aviator table (Figma Vector 16): translucent #15191B@40% surface (in the SVG)
   + a subtle 3.5px backdrop blur. The blur is gentle so the transparency still
   reads. Clipped to the table's rounded shape. */
:root.brand-aviator .arena-table-bg {
  border-radius: 19%;
  -webkit-backdrop-filter: blur(2.5px);
  backdrop-filter: blur(2.5px);
}

.arena-edge-label {
  position: absolute;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 10;
}
.arena-edge-label--top {
  top: 0;
  transform: translate(-50%, -50%);
}
.arena-edge-label--bottom {
  bottom: 5%;
  transform: translate(-50%, 50%);
}
/* Aviator's red border makes alignment visible — sit the player chip on it */
:root.brand-aviator .arena-edge-label--bottom {
  bottom: 3.2%;
}

.arena-table-logo {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(160px, 80%, 240px);
  height: auto;
}
/* MyBC table logo rendered as a subtle transparent watermark */
.arena-table-logo--mybc {
  opacity: 0.5;
}
/* Aviator table watermark: half size, vertically centred on the table */
:root.brand-aviator .arena-table-logo {
  width: clamp(80px, 40%, 120px);
  top: 50%;
}
/* …20% larger on desktop */
@media (min-width: 768px) and (min-height: 600px) {
  :root.brand-aviator .arena-table-logo {
    width: clamp(96px, 48%, 144px);
  }
}


/* ── Chips (Design System) ── */
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  font-family: var(--font-primary);
  font-weight: 400;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: 0 1px 0 var(--shadow-neutral);
}

.chip--xs {
  padding: var(--space-1);
  font-size: var(--font-size-2xs);
}

.chip--sm {
  min-width: 16px;
  height: 22px;
  padding: 4px;
  font-size: 10px;
  line-height: 140%;
  box-shadow: 0px 1px 0px #171717;
  border-radius: 8px;
  line-height: 14px;
}

.chip--neutral {
  background: var(--surface-default);
  color: var(--content-primary);
}

.chip--primary {
  background: var(--brand-primary);
  color: var(--content-inverse);
}

.chip--positive {
  background: #15803D;
  color: var(--content-primary);
}

.chip--negative {
  background: var(--status-error);
  color: var(--content-primary);
}

/* ── Dice Display ── */
.dice-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  padding: 6px 0;
  transform-style: preserve-3d;
}

/* ── Mobile Header (new Figma design) ── */
.m-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  height: 56px;
  box-sizing: border-box;
  position: relative;
  z-index: 20;
}
.m-header-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px;
  background: #262626;
  border: none;
  cursor: pointer;
}
.m-header-btn--lg {
  width: 32px;
  height: 32px;
  border-radius: 12px;
}
.m-header-btn svg { width: 16px; height: 16px; }
.m-header-btn:active { transform: scale(0.92); }
.m-header-results {
  /* Hidden for now — keep markup/logic intact, may re-enable later.
     Restore by switching back to: display: flex; */
  display: none;
  align-items: center;
  gap: 8px;
}
.m-header-dot {
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 28px;
  height: 28px;
  background: #262626;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  padding: 0;
}
.m-header-dot--loss {
  border-color: #F43F5E;
}
.m-header-dot--push {
  border-color: #FFD106;
}
.m-header-dot:active { transform: scale(0.92); }
.m-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.m-header-actions .m-header-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
.desktop-only { display: none !important; }
.m-header-history-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px 8px 8px;
  gap: 4px;
  height: 37px;
  background: #262626;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 14px;
  color: #FFFFFF;
}
.m-header-history-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.m-header-history-btn:active { transform: scale(0.95); }

/* ── Insufficient Balance Toast ── */
.insufficient-toast {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  padding: 8px;
  gap: 8px;
  width: auto;
  height: 40px;
  background: #262626;
  border: 1px solid #262626;
  border-radius: 16px;
  position: absolute;
  left: 50%;
  top: calc(60% - 16px);
  transform: translate(-50%, -50%);
  z-index: 15;
  z-index: 10;
  animation: toast-pop .2s ease;
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 12px;
  color: #FFFFFF;
}
@keyframes toast-pop {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.insufficient-toast span {
  white-space: nowrap;
}

/* ── Round Result Toast ── */
/* Aviator hides the win/push/lost round toast (kept in the DOM, just not shown). */
:root.brand-aviator .round-toast { display: none !important; }
.round-toast {
  display: flex;
  align-items: center;
  gap: 4px;
  position: absolute;
  top: calc(60% - 16px);
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 15;
  z-index: 10;
  animation: toast-pop .2s ease;
  white-space: nowrap;
}
.round-toast-chip {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 4px;
  height: 22px;
  border-radius: 8px;
  box-shadow: 0px 1px 0px #171717;
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 10px;
  line-height: 1.4;
  color: #FFFFFF;
  white-space: nowrap;
  box-sizing: border-box;
}
.round-toast-chip--win { background: #22C55E; }
.round-toast-chip--lose { background: #F43F5E; }
.round-toast-chip--push { background: #FFD106; color: #171717; }
.round-toast-chip--tie { background: #FFD106; color: #171717; }
.round-toast-detail {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 4px;
  height: 22px;
  background: #262626;
  box-shadow: 0px 1px 0px #171717;
  border-radius: 8px;
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 10px;
  line-height: 1.4;
  color: #FFFFFF;
  white-space: nowrap;
  box-sizing: border-box;
}

/* ── Free Round Counter ── */
.fr-counter-wrap {
  /* Mobile: full-width, matches .m-controls horizontal padding. */
  padding: 8px 14px 0;
}
.free-round-counter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}
.free-round-counter-text {
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 13px;
  color: var(--content-primary);
}
.free-round-winnings {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: #22C55E;
}

/* ── Desktop Free Round Counter ── */
.desktop-free-round {
  position: absolute;
  bottom: 90px;
  right: 24px;
  max-width: 372px;
}

/* ── Cashout Success Alert ── */
.cashout-alert-backdrop {
  /* Matches main: centered over the arena table on both mobile and desktop. */
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: cashout-fade .15s ease;
}
@keyframes cashout-fade { from { opacity: 0; } to { opacity: 1; } }
.cashout-alert {
  box-sizing: border-box;
  position: relative;
  overflow: hidden;            /* clip the confetti burst to the card */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
  gap: 8px;
  width: 112px;
  background: var(--surface-default);
  border: 2px solid #4ADE80;
  border-radius: 16px;
  box-shadow: 0 0 40px rgba(74,222,128,0.15), 0 16px 48px rgba(0,0,0,0.5);
  /* win-card pop + one-shot border glow */
  animation: cardPop .25s cubic-bezier(0.25, 0.1, 0.25, 1) both,
             borderGlow 1.6s ease-out .15s both;
}
.cashout-alert--big {
  width: 157px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.91) 0%, var(--brand-primary) 100%);
  border-color: var(--brand-border);
  box-shadow: 0 0 40px rgba(var(--brand-rgb),0.15), 0 16px 48px rgba(0,0,0,0.5);
  animation: cardPop .25s cubic-bezier(0.25, 0.1, 0.25, 1) both,
             borderGlowBig 1.6s ease-out .15s both;
}
.cashout-alert--big .cashout-alert-label { color: var(--brand-primary); }
@keyframes cardPop {
  0%   { transform: scale(0.5); opacity: 0; }
  60%  { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes borderGlow {
  0%   { box-shadow: 0 0 0 0 rgba(74,222,128,0),    0 16px 48px rgba(0,0,0,0.5); }
  35%  { box-shadow: 0 0 56px 4px rgba(74,222,128,0.6), 0 16px 48px rgba(0,0,0,0.5); }
  100% { box-shadow: 0 0 40px 0 rgba(74,222,128,0.15), 0 16px 48px rgba(0,0,0,0.5); }
}
@keyframes borderGlowBig {
  0%   { box-shadow: 0 0 0 0 rgba(var(--brand-rgb),0),    0 16px 48px rgba(0,0,0,0.5); }
  35%  { box-shadow: 0 0 56px 4px rgba(var(--brand-rgb),0.6), 0 16px 48px rgba(0,0,0,0.5); }
  100% { box-shadow: 0 0 40px 0 rgba(var(--brand-rgb),0.15), 0 16px 48px rgba(0,0,0,0.5); }
}
/* confetti burst canvas — fills the card (clipped by overflow:hidden),
   sits behind the text, never blocks clicks */
.cashout-confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
/* text/chip layer sits above the confetti canvas */
.cashout-alert-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.cashout-alert-label {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 12px;
  line-height: 150%;
  text-align: center;
  color: #4ADE80;
}
.cashout-alert-mult {
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.5;
  text-align: center;
  color: #4ade80;
  white-space: nowrap;
}
.cashout-alert--big .cashout-alert-mult {
  color: #FFFFFF;
}
.cashout-alert-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  height: 22px;
  animation: chipRise .45s cubic-bezier(0.25, 0.1, 0.25, 1) both;
  background: var(--surface-default);
  border-radius: 8px;
  box-shadow: 0px 1px 0px #171717;
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 10px;
  line-height: 1.4;
  color: var(--content-primary);
  white-space: nowrap;
  box-sizing: border-box;
}
@keyframes chipRise {
  0%   { transform: translateY(10px); opacity: 0; }
  100% { transform: translateY(0);    opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .cashout-alert,
  .cashout-alert--big,
  .cashout-alert-chip { animation: none !important; }
}

/* ── History ── */
.hist-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px 16px;
  overflow-y: auto;
}
.hist-item {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-default);
  border-radius: 16px;
  padding: 8px 0;
  overflow: hidden;
  cursor: pointer;
}
.hist-item--expanded {
  flex-direction: column;
  gap: 8px;
}
.hist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 4px;
  padding-right: 8px;
  width: 100%;
  box-sizing: border-box;
}
.hist-left {
  display: flex;
  align-items: center;
  min-width: 0;
  flex-shrink: 1;
}
.hist-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 12px;
}
.hist-icon svg { width: 20px; height: 20px; }
.hist-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hist-info-title {
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.5;
  color: var(--content-secondary);
  white-space: nowrap;
}
.hist-info-sub {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 10px;
  line-height: 1.4;
  color: var(--content-secondary);
  white-space: nowrap;
}
.hist-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}
.hist-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 160px;
  justify-content: flex-end;
}
.hist-mult-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  min-width: 56px;
  padding: 4px 8px;
  background: var(--surface-raised);
  border-radius: 8px;
  box-shadow: 0px 1px 0px #171717;
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.6;
  color: var(--content-primary);
  white-space: nowrap;
  box-sizing: border-box;
}
.hist-payout-chip {
  min-width: 72px;
}
.hist-payout-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 4px 8px;
  border-radius: 8px;
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.6;
  white-space: nowrap;
}
.hist-payout-chip--win {
  background: rgba(34,197,94,0.14);
  color: #22c55e;
}
.hist-payout-chip--lose {
  background: rgba(244,63,94,0.14);
  color: #f43f5e;
}
.hist-payout-chip--push {
  background: rgba(255,209,6,0.14);
  color: #FFD106;
}
.hist-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 12px;
  background: none;
  border: none;
  cursor: pointer;
}
.hist-chevron svg { width: 16px; height: 16px; }
.hist-details {
  padding: 0 8px;
  width: 100%;
  box-sizing: border-box;
}
.hist-details-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(0,0,0,0.14);
  border-radius: 12px;
  padding: 10px;
  width: 100%;
  box-sizing: border-box;
}
.hist-details-inner .pf-result {
  margin: 0;
}
.hist-details-inner .pf-result-body {
  font-size: 14px;
}
.hist-seeds {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 4px;
}
.hist-seed-group {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hist-seed-label {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.5;
  color: var(--content-secondary);
}
.hist-seed-value {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.4;
  color: var(--content-primary);
  word-break: break-all;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.hist-verify-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 40px;
  background: var(--surface-default);
  border: none;
  border-radius: 12px;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 12px;
  line-height: 1.6;
  color: var(--content-primary);
  cursor: pointer;
  gap: 4px;
}
.hist-verify-btn:active { transform: scale(0.98); }
.hist-verify-btn svg { width: 20px; height: 20px; }
.hist-empty {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 14px;
  color: var(--content-tertiary);
  text-align: center;
  padding: 40px 16px;
}

/* ── Provably Fair ── */
.pf-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 16px 16px;
}
.pf-title {
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.5;
  color: var(--content-primary);
}
.pf-desc {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.6;
  color: var(--content-secondary);
}
.pf-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 4px;
}
/* Overview steps */
.pf-steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  background: rgba(0,0,0,0.22);
  border-radius: 16px;
  padding: 16px;
  overflow: hidden;
}
.pf-step {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  overflow: hidden;
}
.pf-step-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  background: var(--brand-primary);
  border-radius: 999px;
  padding: 6px;
  overflow: hidden;
}
.pf-step-icon svg {
  width: 20px;
  height: 20px;
}
.pf-step-text {
  flex: 1;
  min-width: 0;
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.6;
  color: var(--content-secondary);
}
.pf-step-arrow {
  display: flex;
  align-items: center;
  padding: 0 16px;
  width: 100%;
}
.pf-step-arrow-line {
  width: 0;
  height: 20px;
  border-left: 1px dashed var(--content-tertiary);
}
/* Inputs (Seeds + Verify) */
.pf-input {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  max-height: 56px;
  background: var(--surface-overlay);
  border: 1px solid var(--brd);
  border-radius: 16px;
  padding: 8px 12px 8px 16px;
  box-sizing: border-box;
  width: 100%;
}
.pf-input-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  gap: 0;
}
.pf-input-label {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.5;
  color: var(--content-secondary);
}
.pf-input-value {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  color: var(--content-primary);
  background: none;
  border: none;
  outline: none;
  padding: 0;
  width: 100%;
}
.pf-input-value--green {
  color: #4ade80;
}
.pf-input-value--mono {
  font-family: var(--font-mono);
  word-break: break-all;
}
.pf-input-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  background: var(--surface-default);
  border: none;
  border-radius: 12px;
  cursor: pointer;
}
.pf-input-btn:active { transform: scale(0.92); }
.pf-input-btn svg { width: 16px; height: 16px; }
/* Input states */
.pf-input:focus-within {
  border-color: #d4d4d4;
}
.pf-input--danger {
  border-color: #e11d48;
}
.pf-input--success {
  border-color: #4ade80;
}
.pf-input .pf-input-value::placeholder {
  color: var(--content-tertiary);
}
/* Buttons */
.pf-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  min-height: 48px;
  background: var(--surface-default);
  border: none;
  border-radius: 12px;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.5;
  color: var(--content-primary);
  cursor: pointer;
}
.pf-btn:active { transform: scale(0.98); }
.pf-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.pf-btn--ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--content-secondary);
}

/* Provably-fair: hash-match proof + outcome mapping */
.pf-proof {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-default);
  border: 1px solid var(--border-strong);
}
.pf-proof--ok { border-color: rgba(34,197,94,0.5); background: rgba(34,197,94,0.07); }
.pf-proof--bad { border-color: rgba(244,63,94,0.5); background: rgba(244,63,94,0.07); }
.pf-proof-verdict {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  color: var(--green);
}
.pf-proof-verdict svg { width: 16px; height: 16px; flex-shrink: 0; }
.pf-proof--bad .pf-proof-verdict { color: var(--red); }
.pf-proof-label { font-size: 11px; color: var(--content-tertiary); text-transform: uppercase; letter-spacing: 0.04em; }
.pf-proof-row { display: flex; flex-direction: column; gap: 2px; }
.pf-proof-hash {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.pf-proof-hash-value {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  line-height: 1.4;
  color: var(--content-secondary);
  word-break: break-all;
  flex: 1;
}
.pf-proof-note { font-size: 12px; color: var(--content-tertiary); }
.pf-result-value--mono { font-family: var(--font-mono, monospace); }
.pf-mapping {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-default);
  border: 1px solid var(--border-default);
}
.pf-mapping-label { font-size: 11px; color: var(--content-tertiary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.pf-mapping-formula {
  display: block;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  line-height: 1.5;
  color: var(--brand-highlight);
  word-break: break-word;
}

/* Standalone round-verification page (/dice/?round=<id>) */
.rv-wrap {
  min-height: 100vh;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 16px 48px;
  background: var(--bg);
  overflow-y: auto;
}
.rv-card {
  width: 100%;
  max-width: 560px;
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  padding: 24px;
}
.rv-card--wide { max-width: 760px; }
.rv-title {
  font-family: var(--font-primary);
  font-weight: 800;
  font-size: 22px;
  color: var(--brand-primary);
  margin-bottom: 4px;
}
.rv-muted { color: var(--content-tertiary); font-size: 14px; }
.rv-mono { font-family: var(--font-mono, monospace); color: var(--content-primary); font-size: 13px; }
.rv-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.rv-meta-cell { display: flex; flex-direction: column; gap: 4px; }
.rv-seeds {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-default);
  border: 1px solid var(--border-default);
}

/* Shareable verification permalink in a bet-history row */
.hist-permalink {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-default);
  border: 1px solid var(--border-default);
}
.hist-permalink-row { display: flex; align-items: center; gap: 8px; }
.hist-permalink-a {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--brand-primary);
  text-decoration: none;
  word-break: break-all;
}
.hist-permalink-a:hover { text-decoration: underline; }
.hist-permalink-copy {
  flex-shrink: 0;
  height: 28px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--content-secondary);
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.hist-permalink-copy:active { transform: scale(0.97); }

/* Full game rules */
.htp-fullrules-btn {
  width: 100%;
  height: 44px;
  margin-top: 8px;
  border-radius: 12px;
  border: 1px solid var(--brand-border);
  background: transparent;
  color: var(--brand-primary);
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.htp-fullrules-btn:active { transform: scale(0.99); }
.rules-content { display: flex; flex-direction: column; gap: 22px; padding-bottom: 8px; }
.rules-sec { display: flex; flex-direction: column; gap: 10px; }
.rules-h {
  font-family: var(--font-primary);
  font-weight: 800;
  font-size: 16px;
  color: var(--brand-primary);
  margin: 0;
}
.rules-p { font-size: 14px; line-height: 1.55; color: var(--content-secondary); margin: 0; }
.rules-ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.rules-ul li { font-size: 14px; line-height: 1.5; color: var(--content-secondary); }
.rules-table {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-default);
  border-radius: 10px;
  overflow-x: auto;            /* horizontal scroll on narrow screens instead of clipping */
  -webkit-overflow-scrolling: touch;
  background: var(--surface-default);
}
/* Keep wide tables legible on mobile: rows hold a min width and the table scrolls.
   The bare 6-col modes table is the widest; narrower variants need less. */
.rules-table:not(.rules-table--4):not(.rules-table--3):not(.rules-table--2) .rules-tr { min-width: 500px; }
.rules-table--4 .rules-tr { min-width: 380px; }
.rules-table--3 .rules-tr { min-width: 320px; }
.rules-tr {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: center;
  gap: 6px;
  padding: 9px 10px;
  font-size: 12px;
  color: var(--content-secondary);
  border-top: 1px solid var(--border-default);
}
.rules-table--2 .rules-tr { grid-template-columns: 1fr auto; }
.rules-table--3 .rules-tr { grid-template-columns: 1fr 1fr 1.4fr; }
.rules-table--4 .rules-tr { grid-template-columns: 0.6fr 1fr 1fr 1fr; }
.rules-tr:first-child { border-top: none; }
.rules-tr--head { background: var(--brand-primary); color: var(--content-inverse); font-weight: 800; border-top: none; }
.rules-accent { color: var(--brand-primary); font-weight: 700; }
.rules-win { color: var(--green); font-weight: 700; }
.rules-loss { color: var(--red); font-weight: 700; }
.rules-mode { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.rules-mode-t { font-weight: 700; font-size: 13px; color: var(--content-primary); }
.rules-ex {
  font-size: 13px;
  color: var(--content-primary);
  background: var(--surface-default);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 8px 10px;
}
.rules-warn {
  font-size: 13px;
  line-height: 1.5;
  color: var(--brand-highlight);
  background: rgba(var(--brand-rgb),0.07);
  border: 1px solid rgba(var(--brand-rgb),0.3);
  border-radius: 8px;
  padding: 10px 12px;
}
.rules-note { font-size: 12px; color: var(--content-tertiary); line-height: 1.5; }
.rules-disclaimer { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border, rgba(255,255,255,0.08)); font-size: 11px; letter-spacing: 0.03em; text-transform: uppercase; text-align: center; color: var(--content-tertiary); }

/* In-game full-rules overlay (no navigation → no game reload) */
.rules-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.rules-overlay-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-default);
  background: var(--surface-overlay);
  flex-shrink: 0;
}
.rules-overlay-back {
  background: transparent;
  border: none;
  color: var(--brand-primary);
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0;
}
.rules-overlay-title { color: var(--content-secondary); font-weight: 600; font-size: 14px; margin-left: auto; }
.rules-overlay-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}
/* Dice count chips */
.pf-dice-chips {
  display: flex;
  gap: 8px;
  width: 100%;
}
.pf-dice-chip {
  display: flex;
  flex: 1;
  min-width: 0;
  height: 40px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--surface-default);
  border: 1px solid transparent;
  border-radius: 12px;
  box-shadow: 0px 1px 0px #171717;
  cursor: pointer;
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.5;
  color: var(--content-primary);
  padding: 8px 6px;
  white-space: nowrap;
}
.pf-dice-chip--active {
  border-color: var(--brand-primary);
}
.pf-dice-chip svg { width: 16px; height: 16px; flex-shrink: 0; }
/* Verified result card */
.pf-result {
  display: flex;
  flex-direction: column;
  background: rgba(0,0,0,0.05);
  border: 1px solid var(--brd);
  border-radius: 16px;
  overflow: hidden;
  width: 100%;
}
.pf-result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 12px;
  gap: 10px;
}
.pf-result-status {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.pf-result-title {
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.5;
  color: #4ade80;
}
.pf-result-sub {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.6;
  color: var(--content-primary);
}
.pf-result-shield { width: 20px; height: 20px; flex-shrink: 0; }
.pf-result-hash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-top: 1px solid var(--brd);
  border-bottom: 1px solid var(--brd);
  gap: 8px;
}
.pf-result-hash-text {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 8px;
  align-items: center;
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
}
.pf-result-hash-label {
  color: var(--content-tertiary);
  white-space: nowrap;
}
.pf-result-hash-value {
  color: var(--content-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pf-result-copy { width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; }
.pf-result-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
}
.pf-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
}
.pf-result-row-left {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 8px;
  align-items: center;
}
.pf-result-label { color: var(--content-tertiary); }
.pf-result-value { color: var(--content-primary); }
/* Error result */
.pf-result--error {
  background: rgba(244,63,94,0.08);
  border-color: rgba(244,63,94,0.2);
}
.pf-result--error .pf-result-title { color: var(--red); }

/* ── How to Play ── */
.htp-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px 16px;
}
.htp-intro {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  color: var(--content-secondary);
}
.htp-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(0,0,0,0.22);
  border-radius: 20px;
  padding: 16px 12px;
  overflow: hidden;
}
.htp-card-title {
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.5;
  color: var(--content-primary);
  text-align: center;
  width: 100%;
}
.htp-previews {
  display: flex;
  gap: 12px;
  justify-content: center;
  width: 100%;
}
.htp-preview {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;
}
.htp-preview-img {
  width: 100%;
  height: 120px;
  background: #171717;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.htp-preview-table {
  position: absolute;
  width: 113px;
  height: 102px;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
}
.htp-preview-table-bg {
  width: 100%;
  height: 100%;
  display: block;
}
.htp-preview-table-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  width: 55%;
  opacity: 0.6;
}
/* SETANTAbet preview logo — brighter for legibility on the dark table (MyBC unaffected) */
.htp-preview-table-logo--setanta {
  opacity: 0.95;
}
.htp-preview-btn {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 6px 10px;
  border-radius: 8px;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 9px;
  white-space: nowrap;
  border: none;
  cursor: default;
}
.htp-preview-btn--green {
  background: #22c55e;
  color: #171717;
}
.htp-preview-btn--yellow {
  background: #FFD106;
  color: #171717;
}
.htp-preview-btn svg { width: 12px; height: 12px; }
.htp-preview-btn svg path { fill: #171717; }
.htp-preview-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  flex: 1;
}
.htp-preview-texts {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.htp-preview-label {
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 12px;
  line-height: 1.6;
}
.htp-preview-label--green { color: #22c55e; }
.htp-preview-label--yellow { color: #FFD106; }
.htp-preview-desc {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.6;
  color: var(--content-secondary);
  text-align: center;
}
.htp-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 8px;
  box-shadow: 0px 1px 0px #171717;
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.5;
  color: var(--content-primary);
  white-space: nowrap;
}
.htp-chip--green { background: rgba(34,197,94,0.12); }
.htp-chip--yellow { background: rgba(255,209,6,0.32); }
/* Aviator: the how-to-play "Double / Roll Again" previews use the brand colour,
   so they go brand-red (green "win" previews stay green). */
/* Cashout preview matches the real in-game Cashout button: gray surface with
   green text + green dice icon (not a solid green pill). */
:root.brand-aviator .htp-preview-btn--green { background: var(--surface-default); color: #4ade80; }
:root.brand-aviator .htp-preview-btn--green svg path { fill: #4ade80; }
/* Double / "Roll Again" preview uses the action green (matches the real Roll
   button), not the crimson brand accent. */
:root.brand-aviator .htp-preview-btn--yellow { background: var(--action-primary); color: var(--action-text); }
:root.brand-aviator .htp-preview-btn--yellow svg path { fill: var(--action-text); }
:root.brand-aviator .htp-preview-label--yellow { color: var(--action-primary); }
:root.brand-aviator .htp-chip--yellow { background: rgba(55, 160, 3, 0.32); }
.htp-stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 14px;
  width: 100%;
  box-sizing: border-box;
}
.htp-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 25px;
}
.htp-stat-label {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  color: var(--content-secondary);
}
.htp-stat-value {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  color: var(--content-primary);
  white-space: nowrap;
}
.htp-stat-value--green { color: #4ade80; }
.htp-warning {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  color: var(--content-secondary);
  text-align: center;
  padding: 0 4px;
}
.htp-warning-red { color: #e11d48; }
/* Risk Levels */
.htp-risk-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  width: 100%;
}
.htp-risk-card {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 16px 8px 8px;
}
.htp-risk-dice {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}
.htp-risk-dice svg { width: 24px; height: 24px; }
.htp-risk-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 88px;
  padding: 4px 8px;
  background: var(--surface-default);
  border-radius: 12px;
  box-shadow: 0px 1px 0px #171717;
}
.htp-risk-chip-icon { width: 16px; height: 16px; flex-shrink: 0; }
.htp-risk-chip-text {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  white-space: nowrap;
}
/* Aviator: no bar icon, multiplier + label on one line (e.g. "1.15x Easy"). */
:root.brand-aviator .htp-risk-chip {
  justify-content: center;
  width: 100%;
}
:root.brand-aviator .htp-risk-chip-text {
  flex-direction: row;
  align-items: baseline;
  gap: 6px;
}
.htp-risk-chip-mult {
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 12px;
  line-height: 1.6;
  color: var(--content-primary);
}
.htp-risk-chip-label {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 10px;
  line-height: 1.2;
  color: var(--content-secondary);
}
/* Footer */
.htp-footer {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 0 4px;
  width: 100%;
}
.htp-footer-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}
.htp-footer-text {
  flex: 1;
  min-width: 0;
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.6;
  color: var(--content-tertiary);
}
.htp-footer-text strong {
  color: var(--content-secondary);
  font-weight: 500;
}

/* ── Bottom Drawer ── */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: drawer-fade-in .2s ease;
}
@keyframes drawer-fade-in { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  width: 100%;
  max-width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: drawer-slide-up .25s ease;
}
@keyframes drawer-slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  height: 64px;
  box-sizing: border-box;
  background: var(--bg-secondary);
  border-radius: 16px 16px 0 0;
}
.drawer-title {
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 14px;
  color: var(--content-primary);
}
.drawer-close {
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: none;
  border: none;
  border-radius: 12px;
  cursor: pointer;
}
.drawer-close:active { background: var(--surface-default); }
.drawer-tabs {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  padding: 8px;
  margin: 0 16px 16px;
  background: var(--surface-overlay);
  border: 1px solid var(--brd);
  border-radius: 16px;
}
.drawer-tab {
  flex: 1;
  height: 34px;
  display: flex;
  justify-content: center;
  align-items: center;
  border: none;
  border-radius: 12px;
  background: transparent;
  filter: drop-shadow(0px 1px 0px var(--bg-secondary));
  cursor: pointer;
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 12px;
  color: var(--content-primary);
}
.drawer-tab--active {
  background: var(--surface-default);
  box-shadow: 0px 1px 0px var(--bg-secondary);
}
.drawer-content {
  background: var(--bg-secondary);
  overflow-y: auto;
  flex: 1;
  border-radius: 0;
  padding-top: 12px;
  padding-bottom: 12px;
}

/* ── Mobile 3-dot Menu ── */
.m-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99;
}
.m-menu {
  position: absolute;
  top: 40px;
  right: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  min-width: 160px;
  background: #262626;
  border: 1px solid #404040;
  border-radius: 12px;
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.m-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 500;
  color: #D4D4D4;
  white-space: nowrap;
}
.m-menu-item:active { background: #404040; }
.m-menu-item svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Mobile Controls Card (unified action footer) ── */
.m-controls {
  display: flex;
  flex-direction: column;
  padding: 0 14px 14px;
  gap: 0;
  margin-top: 4px;
}
.m-controls .m-action-row {
  padding: 0 0 16px;
}
.m-tab-group {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  padding: 8px;
  gap: 11px;
  background: #171717;
  border: 1px solid #262626;
  border-radius: 16px 16px 0 0;
  width: 100%;
  min-height: 64px;
  height: 64px;
}
.m-risk-chip {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  padding: 8px 12px;
  gap: 4px;
  flex: 1;
  height: 47px;
  border: none;
  border-radius: 12px;
  background: transparent;
  filter: drop-shadow(0px 1px 0px #171717);
  cursor: pointer;
  font-family: var(--font-primary);
  transition: background .15s;
}
.m-risk-chip--active {
  background: #262626;
  box-shadow: 0px 1px 0px #171717;
}
.m-risk-chip:disabled { opacity: 0.45; cursor: not-allowed; }
.m-risk-bars {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 2px;
  width: 11px;
  height: 11px;
}
.m-risk-bar {
  width: 2px;
  border-radius: 25px;
  flex-shrink: 0;
}
.m-risk-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  text-align: left;
}
.m-risk-mult {
  font-weight: 600;
  font-size: 12px;
  line-height: 160%;
  color: #FFFFFF;
}
.m-risk-label {
  font-weight: 400;
  font-size: 10px;
  line-height: 120%;
  color: #D4D4D4;
  white-space: nowrap;
}

/* Bet bar (bottom half of card) */
.m-bet-bar {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 8px;
  border: 1px solid #262626;
  border-top: none;
  border-radius: 0 0 16px 16px;
  height: 40px;
  min-height: 40px;
  max-height: 40px;
}
.m-bet-left {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.m-bet-currency {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 24px;
  height: 24px;
  background: #404040;
  box-shadow: 0px 1px 0px #171717;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 10px;
  color: #FFFFFF;
}
.m-bet-balance {
  font-weight: 400;
  font-size: 12px;
  line-height: 150%;
  color: #737373;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  width: auto;
  white-space: nowrap;
}
.m-bet-divider {
  width: 0;
  height: 16px;
  border-left: 1px solid #262626;
  margin: 0 4px;
}
.m-bet-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
}
.m-bet-adj {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 22px;
  height: 22px;
  background: var(--surface-default);
  box-shadow: 0px 1px 0px var(--bg-secondary);
  border-radius: 8px;
  font-size: 10px;
  border: none;
  font-size: 10px;
  color: #FFFFFF;
  cursor: pointer;
  font-family: var(--font-primary);
}
.m-bet-adj:active:not(:disabled) { transform: scale(0.95); }
.m-bet-adj:disabled { opacity: 0.4; cursor: not-allowed; }
.m-bet-value--disabled { opacity: 0.4; cursor: not-allowed; }
.m-bet-label {
  font-weight: 400;
  font-size: 12px;
  color: #737373;
  font-family: var(--font-primary);
}
.m-bet-value {
  font-weight: 400;
  font-size: 12px;
  color: #D4D4D4;
  cursor: pointer;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  min-width: 46px;
  text-align: center;
}
.m-bet-input {
  width: 50px;
  height: 22px;
  background: #262626;
  border: 1px solid #404040;
  border-radius: 6px;
  color: #D4D4D4;
  font-size: 12px;
  text-align: center;
  outline: none;
  font-family: var(--font-primary);
}
.m-bet-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.m-bet-chip {
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 4px;
  min-width: 26px;
  width: auto;
  height: 22px;
  background: #404040;
  border: 1px solid #525252;
  box-shadow: 0px 1px 0px #171717;
  border-radius: 8px;
  border: none;
  font-weight: 400;
  font-size: 10px;
  color: #FFFFFF;
  cursor: pointer;
  font-family: var(--font-primary);
}
.m-bet-chip:active { transform: scale(0.95); }
.m-bet-chip:disabled { opacity: 0.45; cursor: not-allowed; }

/* Action buttons row */
.m-action-row {
  display: flex;
  gap: 16px;
  padding: 0;
  position: relative;
  z-index: 10;
  width: 100%;
}
.m-btn-back {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 16px 10px 8px;
  gap: 4px;
  height: clamp(40px, 6.4vh + 11.2px, 56px);
  width: 172px;
  background: #262626;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 14px;
  color: #FFFFFF;
}
.m-btn-back:active:not(:disabled) { transform: scale(0.97); }
.m-btn-back:disabled { opacity: 0.4; cursor: not-allowed; }
.m-btn-back svg { flex-shrink: 0; }
.m-btn-roll {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 16px 10px 8px;
  gap: 4px;
  height: clamp(40px, 6.4vh + 11.2px, 56px);
  flex: 1;
  background: var(--action-primary);
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 14px;
  color: var(--action-text);
}
.m-btn-roll:active:not(:disabled) { transform: scale(0.97); }
.m-btn-roll:disabled { opacity: 0.5; cursor: not-allowed; }
.m-btn-roll svg { width: 20px; height: 20px; }

/* Cashout active button (green, in double mode) — legacy, kept for compat */
.m-btn-cashout-active {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 16px;
  gap: 4px;
  height: clamp(40px, 6.4vh + 11.2px, 56px);
  width: 172px;
  background: #22C55E;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 14px;
  color: #FFFFFF;
  animation: cashout-pulse 1.5s ease-in-out infinite;
}
.m-btn-cashout-active:active { transform: scale(0.97); }
@keyframes cashout-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  50% { box-shadow: 0 0 12px 4px rgba(34,197,94,0.25); }
}

/* NEW: Cashout button — gray bg, green text (Figma redesign) */
.m-btn-cashout-new {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 16px;
  gap: 4px;
  height: clamp(40px, 6.4vh + 11.2px, 56px);
  background: #262626;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 12px;
  color: #4ade80;
  white-space: nowrap;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.m-btn-cashout-new:active { transform: scale(0.97); }
.m-btn-cashout-new svg { width: 20px; height: 20px; flex-shrink: 0; }

/* NEW: Bet & Roll button — full-width yellow (idle state) */
.m-btn-betroll {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 16px 10px 8px;
  gap: 4px;
  height: clamp(40px, 6.4vh + 11.2px, 56px);
  width: 100%;
  flex: 1;
  background: var(--action-primary);
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 12px;
  color: var(--action-text);
  -webkit-tap-highlight-color: transparent;
}
.m-btn-betroll:active:not(:disabled) { transform: scale(0.97); }
.m-btn-betroll:disabled { opacity: 0.5; cursor: not-allowed; }
.m-btn-betroll svg { width: 20px; height: 20px; }

/* NEW: Step tracker (horizontal scroll in-game) */
.m-step-track {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  flex: 1;
  padding: 0 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  cursor: grab;
}
.m-step-track::-webkit-scrollbar { display: none; }

.m-step-chip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px;
  height: 36px;
  background: #262626;
  border-radius: 12px;
  border: none;
  cursor: default;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 12px;
  line-height: 1.6;
  color: #FFFFFF;
  white-space: nowrap;
  box-sizing: border-box;
}
.m-step-chip--active {
  border: 2px solid #404040;
}
.m-step-chip--done {
  padding: 0;
  width: 36px;
  min-width: 36px;
  height: 36px;
  background: #262626;
}
.m-step-chip svg { width: 16px; height: 16px; flex-shrink: 0; }

/* MultiplierTimeline (double-mode ladder) — chip promotion motion. The JS
   component references these by name; keeping them here avoids a per-render
   <style> injection. */
@keyframes dd-settle {
  0%   { transform: scale(0.96); }
  55%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}
@keyframes dd-shimmer {
  0%   { transform: translateX(-120%); }
  100% { transform: translateX(120%); }
}

/* MultiplierTimeline scroll container — hide the scrollbar (drag/touch scroll). */
.mt-timeline { scrollbar-width: none; -ms-overflow-style: none; }
.mt-timeline::-webkit-scrollbar { display: none; }
/* Inline (aviator) ladder: soften the right edge where rungs scroll off, so the
   clipped chip fades out instead of a hard cut (also signals "more to scroll"). */
.mt-timeline--inline {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent 100%);
  mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent 100%);
}

/* Risk icon wrapper (replaces signal bars) */
.m-risk-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: #D4D4D4;
}
.m-risk-chip--active .m-risk-icon {
  color: #FFFFFF;
}

/* Pot banner */
.pot-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: 12px;
  margin-bottom: 8px;
}
.pot-label {
  font-size: 12px;
  font-weight: 600;
  color: #A3A3A3;
}
.pot-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 800;
  color: #22C55E;
}
.pot-streak {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-primary);
  background: rgba(var(--brand-rgb),0.12);
  padding: 2px 6px;
  border-radius: 6px;
}

/* Desktop cashout button */
.desktop-cashout-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 16px;
  height: 44px;
  flex: 1;
  background: #22C55E;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 14px;
  color: #FFFFFF;
}
.desktop-cashout-btn:active { transform: scale(0.97); }

/* ── Controls Row (between arena and bet bar) ── */
.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 12px;
  flex-shrink: 0;
  gap: 16px;
}

.control-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.control-item--bonus {
  width: 59px;
}

.control-item-label {
  font-family: var(--font-primary);
  font-size: 10px;
  font-weight: 400;
  color: #d4d4d4;
  line-height: 120%;
  text-align: center;
  white-space: nowrap;
  width: 66px;
}

/* Compound button (dice selector): icon + chevron side by side */
.control-compound-btn {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.control-compound-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.control-compound-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.control-compound-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: #262626;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  color: var(--content-primary);
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.control-compound-icon:hover { background: #404040; }
.control-compound-icon:active { transform: scale(0.95); }
.control-compound-icon:disabled { opacity: 0.45; cursor: not-allowed; }

.control-compound-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: #262626;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  color: var(--content-primary);
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.control-compound-arrow:hover { background: #404040; }
.control-compound-arrow:active { transform: scale(0.95); }
.control-compound-arrow:disabled { opacity: 0.45; cursor: not-allowed; }

/* Bonus button */
.control-square-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #262626;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--content-primary);
  padding: 8px 12px;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.control-square-btn:hover:not(:disabled) {
  background: var(--surface-raised);
}

.control-square-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.control-square-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.control-square-btn--active {
  background: var(--brand-primary);
  color: var(--content-inverse);
}

.control-square-btn--active:hover:not(:disabled) {
  background: var(--brand-secondary);
}

/* ── Risk Picker Popup ── */
.risk-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 49;
}

.risk-picker {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 16px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  z-index: 50;
  animation: slide-up 0.15s ease-out;
  width: 160px;
}

.risk-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.risk-picker-item:hover {
  background: #333;
}

.risk-picker-item--active {
  background: #262626;
}

.risk-picker-info {
  display: flex;
  flex-direction: column;
}

.risk-picker-mult {
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  color: #ffffff;
}

.risk-picker-label {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 10px;
  line-height: 1.2;
  color: #737373;
}

/* ── Roll Button ── */
.roll-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 141px;
  height: 56px;
  padding: 16px 20px 16px 12px;
  border-radius: var(--radius-lg);
  background: var(--brand-primary);
  border: none;
  cursor: pointer;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: var(--font-size-md);
  color: var(--content-inverse);
  line-height: 1.5;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 16px rgba(var(--brand-rgb), 0.25);
  flex-shrink: 0;
}

.roll-btn:hover:not(:disabled) {
  background: var(--brand-secondary);
  box-shadow: 0 6px 24px rgba(var(--brand-rgb), 0.35);
  transform: translateY(-1px);
}

.roll-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.roll-btn:disabled {
  width: 123px;
  background: #404040;
  color: #525252;
  cursor: not-allowed;
  box-shadow: none;
}

.roll-btn svg {
  width: 24px;
  height: 24px;
}

/* ── Bottom Bet Bar ── */
/* ── Bottom Bet Bar ── */
.bet-bar-wrap {
  flex-shrink: 0;
  padding: 0 14px 12px;
}

.bet-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  width: 100%;
  height: 48px;
  background: #1e1e1e;
  border-radius: 9999px;
  gap: 8px;
}

.bet-bar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Vertical divider line */
.bet-bar-divider {
  width: 1px;
  height: 22px;
  background: #262626;
  flex-shrink: 0;
}

/* Currency chip: 24x24, bg #404040, rounded full */
.bet-bar-balance {
  display: flex;
  align-items: center;
  gap: 4px;
}

.bet-bar-currency {
  width: 24px;
  height: 24px;
  background: #404040;
  border-radius: 9999px;
  box-shadow: 0px 1px 0px #171717;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 10px;
  line-height: 120%;
  color: #ffffff;
  flex-shrink: 0;
}

/* Balance text: 12px, #737373 */
.bet-bar-balance-text {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 12px;
  line-height: 150%;
  color: #737373;
  white-space: nowrap;
}

/* Vertical divider line */
.bet-bar-divider {
  width: 1px;
  height: 22px;
  background: #262626;
  flex-shrink: 0;
}

/* Bet controls: [-] $10.00 [+] */
.bet-bar-bet {
  display: flex;
  align-items: center;
  gap: 4px;
}

.bet-adjust-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #262626;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #d4d4d4;
  padding: 6px;
  flex-shrink: 0;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.bet-adjust-btn:hover {
  background: #404040;
}

.bet-adjust-btn:active {
  transform: scale(0.9);
}

.bet-bar-bet-value {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 12px;
  line-height: 150%;
  text-align: center;
  color: #d4d4d4;
  width: 70px;
  cursor: pointer;
}

.bet-bar-bet-value:hover {
  color: #ffffff;
}

.bet-bar-bet-input {
  width: 70px;
  height: 24px;
  background: #171717;
  border: 1px solid #404040;
  border-radius: 8px;
  color: #ffffff;
  font-family: var(--font-primary);
  font-size: 12px;
  text-align: center;
  outline: none;
  padding: 0 4px;
}

/* Right side: 1/2 and Max chips */
.bet-bar-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.bet-bar-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  height: 32px;
  border-radius: 9999px;
  background: #262626;
  box-shadow: 0px 1px 0px #171717;
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 10px;
  line-height: 140%;
  color: #ffffff;
  cursor: pointer;
  border: none;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s ease;
}

.bet-bar-chip:hover {
  background: var(--surface-raised);
}

.bet-bar-chip:active {
  transform: scale(0.9);
}

/* ── Zdog Dice Canvas ── */
.zdog-dice-canvas {
  flex-shrink: 0;
  margin-top: -70px;
  margin-bottom: -70px;
}

/* ── General Animations ── */
@keyframes pop-in {
  0%   { transform: scale(0.3); opacity: 0; }
  60%  { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes win-pulse {
  0%, 100% { text-shadow: 0 0 6px rgba(34, 197, 94, 0.15); }
  50%      { text-shadow: 0 0 30px rgba(34, 197, 94, 0.45); }
}

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes slide-up {
  0%   { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes fade-in {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}


/* ── Overlay / Modal ── */
/* ── Loading Screen ── */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: #0d0d0d;
  position: relative;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.loading-logo {
  width: 138px;
  height: 121px;
}

.loading-bar-wrap {
  width: 135px;
  height: 4px;
  background: #262626;
  border-radius: 32px;
  overflow: hidden;
}

.loading-bar {
  width: 0%;
  height: 100%;
  background: var(--brand-primary);
  border-radius: 32px;
  animation: loading-fill 2.5s ease-out forwards;
}

@keyframes loading-fill {
  0%   { width: 0%; }
  20%  { width: 25%; }
  50%  { width: 55%; }
  80%  { width: 85%; }
  100% { width: 100%; }
}

.loading-text {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 10px;
  line-height: 1.4;
  color: #ffffff;
  text-align: center;
}

.loading-watermark {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
}

.loading-watermark img {
  width: 171px;
  height: 38px;
}

/* ── SETANTAbet brand logos (Dice Duel + Aviator) — MyBC unaffected ── */
.loading-logo--setanta {
  width: 160px;
  height: auto;
}
.loading-watermark--setanta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  bottom: 56px;
}
.loading-watermark--setanta img {
  width: 58px;
  height: auto;
}
.loading-watermark-label {
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8a8a8a;
}

/* ── Overlay / Modal ── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: fade-in 0.2s;
  padding: var(--pad);
}

.modal {
  background: linear-gradient(145deg, var(--card), var(--bg-secondary));
  border: 1px solid var(--brd2);
  border-radius: var(--radius-lg);
  padding: var(--pad);
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  animation: pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 88vh;
  overflow-y: auto;
}

/* ── Utility ── */
.label {
  font-size: var(--font-size-2xs);
  font-weight: 700;
  color: var(--content-tertiary);
  letter-spacing: 1.5px;
  text-align: center;
  text-transform: uppercase;
}

.mono {
  font-family: var(--font-mono);
}

.btn {
  border: none;
  cursor: pointer;
  font-family: var(--font-primary);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s ease;
}

.btn:disabled {
  cursor: not-allowed;
  pointer-events: none;
}

.control-btn {
  min-width: var(--btn-h);
  height: var(--btn-h);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  background: var(--elev);
  color: var(--tx);
  border: 1px solid var(--brd);
  padding: 0 4px;
  transition: all 0.15s ease;
}

.control-btn:hover {
  background: var(--card2);
  border-color: var(--brd2);
}

.card {
  background: var(--card);
  border: 1px solid var(--brd);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

/* ── Score display ── */
.score-value {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 18px;
  color: var(--content-secondary);
  animation: slide-up .2s;
}

/* ── Result display ── */
.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  animation: pop-in .35s;
}

.result-text {
  font-size: 12px;
  font-weight: 900;
}

.result-text--win {
  color: var(--status-success);
  animation: win-pulse 1.5s ease infinite;
}

.result-text--lose {
  color: var(--status-error);
}

.result-text--tie {
  color: var(--brand-primary);
}

.result-amount {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.result-amount--win {
  color: var(--status-success);
}

.result-amount--lose {
  color: var(--status-error);
}

.result-returned {
  font-size: 10px;
  font-weight: 700;
  color: var(--brand-primary);
  background: rgba(var(--brand-rgb), 0.12);
  border-radius: 5px;
  padding: 2px 6px;
}

/* ── Number Input ── */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

input[type="number"]:focus {
  border-color: var(--brd2);
  box-shadow: 0 0 0 2px rgba(var(--brand-rgb), 0.2);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.15); }

/* ── Bet Controls Modal ── */
.bet-controls-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  animation: fade-in 0.15s;
}

.bet-controls-panel {
  width: 100%;
  max-width: 376px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-default);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 16px;
  animation: slide-up-panel 0.25s ease-out;
}

@keyframes slide-up-panel {
  0%   { transform: translateY(100%); }
  100% { transform: translateY(0); }
}

/* ── Game Arena Center (all sizes) ── */
.game-arena-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

/* ── Desktop / Tablet (>=768px) ──
   min-height gate locks PHONES to the vertical layout: a phone in landscape is
   wide (>768px) but short (<600px tall), so requiring a tall viewport keeps it
   vertical in any orientation. Tablets (iPad etc.) and desktops are tall
   (>=600px) and keep the horizontal layout — iPad landscape is intentionally
   allowed to go horizontal. */
@media (min-width: 768px) and (min-height: 600px) {
  .mobile-only {
    display: none !important;
  }
  .desktop-only {
    display: flex !important;
  }

  /* Desktop: nudge whole table 40px higher (exact, overrides the mobile -20px) */
  .arena-layout {
    transform: translateY(-40px);
  }

  /* Drawer → centered modal on desktop */
  .drawer-backdrop {
    align-items: center;
  }
  .drawer {
    max-width: 480px;
    max-height: 70vh;
    border-radius: 16px;
    animation: drawer-modal-pop .2s ease;
  }
  @keyframes drawer-modal-pop {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
  }
  .drawer-header {
    border-radius: 16px 16px 0 0;
  }
  .drawer-content {
    border-radius: 0 0 16px 16px;
  }

  #root {
    max-width: none;
    padding: 0;
    margin: 0 auto;
  }

  /* Header scales up */
  .m-header {
    padding: 16px 24px;
    height: 64px;
  }
  .m-header-btn--lg {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }
  .m-header-dot {
    width: 32px;
    height: 32px;
  }

  /* Arena — scaled down to fit controls below */
  .game-arena-center {
    padding: 0 24px;
    margin-top: 0;
  }
  .arena-layout {
    margin-top: 0;
  }
  .arena-top-labels {
    margin-top: -20px;
    margin-bottom: 4px;
    position: relative;
    top: 0;
  }
  .arena-dice--top {
    --die-size: 40px;
    margin-bottom: -80px;
    margin-top: -16px;
    position: relative;
    top: 0;
    z-index: 2;
  }
  .arena-dice--top .zdog-dice-canvas {
    transform: rotate(180deg) translateY(-20px) scale(0.76);
  }
  .arena-dice--bottom {
    --die-size: 56px;
    margin-top: -152px;
    z-index: 2;
  }
  .arena-dice--bottom .zdog-dice-canvas {
    transform: scale(1);
  }
  .arena-table {
    width: clamp(220px, 100vh - 280px, 520px);
    max-width: 100%;
    margin-top: -24px;
  }
  .arena-edge-label .chip {
    min-width: 46px;
    height: 26px;
    padding: 4px 8px;
    font-size: 12px;
    line-height: 150%;
    box-shadow: 0px 1px 0px #171717;
    border-radius: 8px;
  }

  /* Controls — centered vertical stack at bottom */
  .m-controls {
    flex-direction: column;
    align-items: center;
    padding: 0 24px 24px;
    gap: 0;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
  }
  /* Free-round counter: match the centered action-area width so its two
     labels align with the Bet & Roll card edges instead of the screen edges. */
  .fr-counter-wrap {
    box-sizing: border-box;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 8px 24px 8px; /* 8px gap between the counter row and the Bet & Roll button */
  }
  .m-controls .m-action-row {
    padding: 0;
    margin-bottom: 16px; /* desktop: gap below the now-top Bet button, before the tabs */
  }


  /* Toast position on desktop */
  .insufficient-toast,
  .round-toast {
    top: calc(60% - 32px);
  }
  /* Round toast bigger on desktop */
  .round-toast-chip,
  .round-toast-detail {
    height: 28px;
    font-size: 12px;
    padding: 4px 6px;
  }

  /* Action buttons — static row below the card */
  .m-action-row {
    position: static;
    transform: none;
    flex-direction: row;
    align-items: center;
    width: 100%;
    max-width: 100%;
    padding: 0;
    gap: 16px;
    order: 1; /* desktop: Bet button moved to the top, above the risk tabs + footer */
  }
  .m-tab-group,
  .mt-timeline,
  .av-diffrow {
    /* both occupy the same slot (idle = risk tabs / aviator difficulty row,
       active round = multiplier timeline); keep them at the same order so the
       Bet/Roll button above doesn't jump when toggling between betting and the
       double-or-nothing round. .av-diffrow MUST be here too — without it the
       aviator row defaults to order 0 and floats above the button, splitting
       the footer card. */
    order: 2;
  }
  .m-btn-roll,
  .m-btn-cashout-new,
  .m-btn-betroll {
    width: auto !important;
    max-width: none !important;
    height: 56px;
    font-size: 16px;
    border-radius: 16px;
    padding: 16px 20px;
    gap: 6px;
  }
  .m-btn-roll { flex: 1 !important; }
  .m-btn-cashout-new { flex: none !important; }
  .m-btn-betroll { flex: 1 !important; width: 100% !important; }
  .m-btn-roll svg,
  .m-btn-cashout-new svg,
  .m-btn-betroll svg { width: 24px; height: 24px; }

  /* Risk tabs + step tracker — just ensure full width */
  .m-tab-group {
    width: 100%;
    max-width: 100%;
  }

  /* Bet bar — same as mobile, just full width */
  .m-bet-bar {
    width: 100%;
    max-width: 100%;
    order: 3; /* desktop: footer stays directly under the tabs (connected card) */
  }
  .m-bet-left {
    gap: 4px;
  }
  .m-bet-currency {
    width: 24px;
    height: 24px;
    font-size: 10px;
  }
  .m-bet-balance {
    font-size: 12px;
    color: #737373;
  }
  .m-bet-divider {
    height: 16px;
    margin: 0 8px;
  }
  .m-bet-adj {
    width: 22px;
    height: 22px;
    font-size: 10px;
    background: var(--surface-default);
    border-radius: 8px;
    box-shadow: 0px 1px 0px var(--bg-secondary);
  }
  .m-bet-label {
    font-size: 12px;
    color: #737373;
  }
  .m-bet-value {
    font-size: 12px;
    color: #D4D4D4;
  }
  .m-bet-chip {
    box-sizing: border-box;
    width: auto;
    min-width: 26px;
    height: 22px;
    padding: 4px;
    background: #404040;
    border: 1px solid #525252;
    box-shadow: 0px 1px 0px var(--bg-secondary);
    border-radius: 8px;
    font-size: 10px;
  }
}

/* ── Large Desktop (>=1024px) ── */
@media (min-width: 1024px) and (min-height: 600px) {
  .arena-dice--top {
    --die-size: 48px;
  }
  .arena-dice--bottom {
    --die-size: 72px;
  }
  .arena-table {
    width: clamp(260px, 100vh - 280px, 520px);
  }
  .m-action-row {
    max-width: 560px;
  }
}

/* ============================================================================
   Aviator difficulty row (dropdown + inline multiplier ladder)
   Rendered only for ?brand=aviator, in place of .m-tab-group.
   ========================================================================== */
.av-diffrow {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
/* Filled footer card (Figma Frame 1618874111: 1px #262626 border, r16;
   game-States #171717 on top (h52), bet-input #0D0D0D below (h42)). The
   difficulty row is the top section, the bet bar the bottom — together they
   read as one rounded two-tone card. */
:root.brand-aviator .av-diffrow {
  box-sizing: border-box;
  background: var(--surface-overlay); /* #171717 */
  padding: 0 8px;
  gap: 8px;
  height: 52px;
  border: 1px solid #262626;
  border-bottom: none;
  border-radius: 16px 16px 0 0;
}
/* vertical divider between the difficulty pill and the ladder (Figma Line 3 —
   full-height, stretches to the game-States row height). */
:root.brand-aviator .av-diff-sep {
  flex: none;
  width: 1px;
  align-self: stretch;
  background: #262626;
}
:root.brand-aviator .m-bet-bar {
  box-sizing: border-box;
  background: #0D0D0D;
  padding: 0 10px;
  height: 42px;
  min-height: 42px;
  max-height: 42px;
  border: 1px solid #262626;
  border-top: none;
  border-radius: 0 0 16px 16px;
}
/* Figma hides the balance/controls divider (Line 1: display none) */
:root.brand-aviator .m-bet-divider { display: none; }
:root.brand-aviator .m-bet-currency,
:root.brand-aviator .m-bet-balance { color: #D4D4D4; }
/* transparent difficulty pill (Figma _base/button for the pill has no fill) */
:root.brand-aviator .av-diff-pill { background: transparent; padding: 8px 6px 8px 8px; }
.av-diff { position: relative; flex: none; }
.av-diff-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  background: var(--surface-default);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.av-diff-pill:disabled { opacity: 0.55; cursor: not-allowed; }
.av-diff-pill:active:not(:disabled) { transform: scale(0.97); }
.av-diff-label { line-height: 1; }
.av-dice { display: inline-flex; gap: 2px; color: #fff; }
.av-die { display: block; }
.av-chev { color: #d4d4d4; }

/* dropdown */
.av-diff-scrim { position: fixed; inset: 0; z-index: 40; }
.av-diff-menu {
  position: absolute;
  /* 8px gap above the .av-diffrow card. The pill is centred in the 52px row
     (~8px of card sits above it), so offset by that + the 8px gap. */
  bottom: calc(100% + 16px);
  /* Flush-left with the footer card, not indented to the pill (offsets the
     game-states row's 8px padding + 1px border), matching the design. */
  left: -9px;
  z-index: 50;
  min-width: 150px;
  background: var(--surface-overlay);
  border-radius: 12px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  animation: cashout-fade 0.12s ease;
}
.av-diff-item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 8px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--content-secondary);
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.av-diff-item:hover { background: rgba(64, 64, 64, 0.5); }
.av-diff-item--sel { background: var(--surface-raised); color: #fff; }
.av-diff-item-label { flex: 1; text-align: left; line-height: 1; }
.av-diff-item .av-dice { color: currentColor; }

/* The aviator ladder is rendered by <MultiplierTimeline inline/> (same motion as
   the default brand). It sits inside the #171717 game-states row, so pull its
   chips down to 36px height to match the pill and centre them. */
:root.brand-aviator .av-diffrow .mt-timeline--inline { align-self: center; }
