/* ── 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-secondary: #fbbf24;
  --brand-highlight: #fcd34d;
  --brand-border: #ccab18;

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

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

/* ── Body & Layout ── */
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;
}

.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;
}

.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%);
}

.arena-table-logo {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(160px, 80%, 240px);
  height: auto;
}


/* ── 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: var(--status-success);
  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 {
  display: flex;
  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 ── */
.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 ── */
.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 {
  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;
  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;
  animation: cashout-pop .2s ease;
  box-shadow: 0 0 40px rgba(74,222,128,0.15), 0 16px 48px rgba(0,0,0,0.5);
}
.cashout-alert--big {
  width: 157px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.91) 0%, #FFD106 100%);
  border-color: #CCAB18;
  box-shadow: 0 0 40px rgba(255,209,6,0.15), 0 16px 48px rgba(0,0,0,0.5);
}
.cashout-alert--big .cashout-alert-label { color: #FFD106; }
@keyframes cashout-pop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}
.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;
  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;
}

/* ── 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: #FFD106;
  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; }
/* 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 16px;
}
.pf-dice-chip--active {
  border-color: #FFD106;
}
.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;
}
.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); }
.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;
}
.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: center;
  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;
}
.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: #FFD106;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 14px;
  color: #171717;
}
.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: #FFD106;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 12px;
  color: #171717;
  -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; }

/* 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: #FFD106;
  background: rgba(255,209,6,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(255, 209, 6, 0.25);
  flex-shrink: 0;
}

.roll-btn:hover:not(:disabled) {
  background: var(--brand-secondary);
  box-shadow: 0 6px 24px rgba(255, 209, 6, 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: #ffd106;
  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;
}

/* ── 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(255, 209, 6, 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(255, 209, 6, 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) ── */
@media (min-width: 768px) {
  .mobile-only {
    display: none !important;
  }
  .desktop-only {
    display: flex !important;
  }

  /* 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: 1280px;
    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;
  }
  .m-controls .m-action-row {
    padding: 0;
    margin-top: 16px;
  }


  /* 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: 3;
  }
  .m-tab-group {
    order: 1;
  }
  .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: 2;
  }
  .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) {
  .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;
  }
}
