*, *::before, *::after {
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

::selection {
  background: transparent;
}

::-moz-selection {
  background: transparent;
}

@font-face {
  font-family: 'MightySouly';
  src: url('assets/MightySouly-lxggD.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

/* MightySouly — numbers only */
#balance-num,
#winnings-num,
#bet-val,
.kv-purchase-price,
.auto-rounds-btn {
  font-family: 'MightySouly', 'Segoe UI', system-ui, sans-serif;
}

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

body {
  background: #0d0d0f;
  color: #e8e8e8;
  font-family: 'Segoe UI', system-ui, sans-serif;
  overflow: hidden;
  height: 100vh;
  height: 100dvh; /* dynamic viewport height — correct on mobile when toolbar shows/hides */
}

canvas { display: block; }

#grain-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: overlay;
  image-rendering: pixelated;
  z-index: 9999;
}

/* ── UI Panel ── */
#ui {
  position: fixed;
  top: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10;
}

.panel {
  background: rgba(15, 15, 20, 0.82);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 14px 16px;
  min-width: 220px;
}

.panel-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.panel-title::after {
  content: '▾';
  font-size: 11px;
  color: #555;
  transition: transform 0.18s ease;
  flex-shrink: 0;
}

.panel.collapsed .panel-title {
  margin-bottom: 0;
}

.panel.collapsed .panel-title::after {
  transform: rotate(-90deg);
}

.panel-body {
  overflow: hidden;
}

.panel.collapsed .panel-body {
  display: none;
}

/* Dropdown */
.select-wrap {
  position: relative;
}

select {
  appearance: none;
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: #e8e8e8;
  font-size: 13px;
  padding: 8px 32px 8px 12px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

select:hover { border-color: rgba(255,255,255,0.25); }
select:focus { border-color: #6c8eff; }

.select-wrap::after {
  content: '▾';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #888;
  font-size: 12px;
}

option { background: #1a1a22; color: #e8e8e8; }

/* Buttons row */
.btn-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

button {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: #e8e8e8;
  font-size: 12px;
  padding: 7px 10px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

button:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.25); }

button.active {
  background: #6c8eff22;
  border-color: #6c8eff;
  color: #8eaaff;
}

/* Speed slider */
.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.slider-label { font-size: 12px; color: #888; flex-shrink: 0; }

input[type=range] {
  -webkit-appearance: none;
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  outline: none;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #6c8eff;
  cursor: pointer;
}

.slider-val { font-size: 12px; color: #aaa; width: 28px; text-align: right; }

/* Loader */
#loader {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0a0a0a;
  z-index: 100;
  gap: 16px;
  opacity: 1;
  transition: opacity 0.9s ease;
  pointer-events: all;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.08);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

#loader-text { font-size: 13px; color: #555; }

/* Scene buttons */
.scene-btn-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scene-btn {
  flex: unset;
  width: 100%;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-align: left;
  border-radius: 8px;
}

.scene-btn.active {
  background: #6c8eff22;
  border-color: #6c8eff;
  color: #8eaaff;
}

.scene-badge {
  display: inline-block;
  font-size: 10px;
  color: #666;
  margin-left: 6px;
  font-weight: 400;
}

/* Events panel */
.ev-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #666;
  margin-bottom: 6px;
}

.ev-json-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: #e8e8e8;
  font-size: 11px;
  font-family: 'SF Mono', 'Consolas', monospace;
  padding: 8px 10px;
  resize: vertical;
  outline: none;
  margin-bottom: 8px;
}

.ev-json-input:focus {
  border-color: rgba(108,142,255,0.5);
}

.ev-run-btn {
  width: 100%;
}

.ev-quick-row {
  gap: 8px;
}

.ev-quick-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ev-param-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: #e8e8e8;
  font-size: 12px;
  padding: 5px 8px;
  outline: none;
  text-align: center;
}

.ev-param-input:focus {
  border-color: rgba(108,142,255,0.5);
}

.ev-check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #aaa;
  cursor: pointer;
  user-select: none;
  padding: 2px 0;
}

/* Camera HUD */
#cam-hud {
  position: fixed;
  bottom: 88px;
  right: 20px;
  background: rgba(15,15,20,0.78);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 11px;
  color: #666;
  pointer-events: none;
  line-height: 1.7;
  font-family: 'SF Mono', 'Consolas', monospace;
}

#cam-hud span { color: #8eaaff; }

/* Animation name badge */
#anim-badge {
  position: fixed;
  top: 60px;
  right: 20px;
  background: rgba(108,142,255,0.15);
  border: 1px solid rgba(108,142,255,0.3);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  color: #8eaaff;
  pointer-events: none;
  display: none;
}

/* Spawn button accent */
#btn-spawn-safe {
  background: rgba(108,255,150,0.07);
  border-color: rgba(108,255,150,0.22);
  color: #8effc0;
}
#btn-spawn-safe:hover {
  background: rgba(108,255,150,0.14);
  border-color: rgba(108,255,150,0.4);
}

/* Safe selector badge */
#safe-badge {
  position: fixed;
  top: 20px;
  right: 20px;
  display: none;
}

/* ── RGS mode indicator ── */
#rgs-indicator {
  position: fixed;
  top: 100px;
  right: 20px;
  z-index: 30;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid;
  pointer-events: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

#rgs-indicator.mode-dummy {
  background: rgba(255,180,0,0.12);
  border-color: rgba(255,180,0,0.4);
  color: #ffcc55;
}

#rgs-indicator.mode-stake {
  background: rgba(60,200,100,0.12);
  border-color: rgba(60,200,100,0.4);
  color: #66dd88;
}

/* ── Dev Toggle Button ── */
#btn-dev-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 30;
  flex: unset;
  width: auto;
  padding: 7px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 8px;
  color: #ccc;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

#btn-dev-toggle:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.35);
  color: #fff;
}

#btn-dev-toggle.active {
  background: rgba(108,142,255,0.2);
  border-color: rgba(108,142,255,0.55);
  color: #aec4ff;
}

/* ── Game UI Bar ── */
#game-ui {
  touch-action: none; /* none propagates to all children — no browser double-tap zoom */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  backdrop-filter: blur(2px);
  padding: 0 32px;
  height: 85px;
  overflow: visible;
  margin: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.game-segment {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 28px;
}

.game-segment.row {
  flex-direction: row;
  gap: 10px;
}

.game-segment + .game-segment {
  border-left: 1px solid rgba(255,255,255,0.06);
}

.game-label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #e1bd94;
}

/* Balance */
#balance-num .num-dec,
#winnings-num .num-dec,
#bet-val .num-dec,
#kv-cost-num .num-dec {
  font-size: 0.7em;
  vertical-align: baseline;
  opacity: 0.75;
}

#balance-val {
  font-size: 24px;
  font-weight: 700;
  color: #e1c995;
  font-variant-numeric: tabular-nums;
}

#balance-val .currency {
  font-size: 13px;
  font-weight: 500;
  color: #e1bd94;
  margin-right: 3px;
}

/* Bet amount */
.bet-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bet-adj {
  flex: unset;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #edcf9eaa;
  background: linear-gradient(to right, #2e2722, #544c4680, #2e2722);
  color: #ddba83ee;
  font-size: 22px;
  font-weight: 400;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  line-height: 1;
  padding-bottom: 2px;
  touch-action: manipulation;
}

.bet-adj:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.3);
  color: #fff;
}

.bet-adj:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.bet-cluster.no-funds #bet-display,
.bet-cluster.no-funds .game-label,
.bet-cluster.no-funds #btn-turbo,
.bet-cluster.no-funds #btn-auto,
.bet-cluster.no-funds #btn-skip {
  opacity: 0.3;
  transition: opacity 0.2s;
  pointer-events: none;
}

#bet-display {
  min-width: 80px;
  text-align: right;
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #e1c995;
  user-select: none;
}

#bet-display .bet-currency {
  font-size: 13px;
  font-weight: 500;
  color: #e1bd94;
  margin-right: 2px;
}
.golden-button {
  touch-action: manipulation;
  display: inline-block;
  outline: none;
  font-family: inherit;
  font-size: 1em;
  box-sizing: border-box;
  border: none;
  border-radius: 0.3em;
  height: 2.75em;
  line-height: 2.5em;
  text-transform: uppercase;
  padding: 0 1em;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(110, 80, 20, 0.4),
    inset 0 -2px 5px 1px rgba(139, 66, 8, 1),
    inset 0 -1px 1px 3px rgba(250, 227, 133, 1);
  background-image: linear-gradient(
    160deg,
    #a54e07,
    #b47e11,
    #fef1a2,
    #bc881b,
    #a54e07
  );
  border: 1px solid #a55d07;
  color: rgb(120, 50, 5);
  text-shadow: 0 2px 2px rgba(250, 227, 133, 1);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  background-size: 100% 100%;
  background-position: center;
}

.golden-button:focus,
.golden-button:hover {
  background-size: 150% 150%;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23),
    inset 0 -2px 5px 1px #b17d10, inset 0 -1px 1px 3px rgba(250, 227, 133, 1);
  border: 1px solid rgba(165, 93, 7, 0.6);
  color: rgba(120, 50, 5, 0.8);
}

/* Bonus toggle */
#btn-bonus {
  flex: unset;
  width: 90px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}

#btn-bonus-img {
  width: 90px !important;
  display: block;
  animation: bonus-glow 2.4s ease-in-out infinite;
  transition: filter 0.2s;
}

#btn-bonus:hover #btn-bonus-img {
  animation: none;
  filter: drop-shadow(0 0 14px rgba(255, 205, 60, 0.9)) brightness(1.18);
}

#btn-bonus:active { transform: scale(0.95); }

#btn-bonus:disabled {
  cursor: not-allowed;
  opacity: 0.4;
  filter: grayscale(0.6);
  transform: none;
}
#btn-bonus:disabled #btn-bonus-img {
  animation: none;
  filter: none;
}

#btn-bonus.active #btn-bonus-img {
  animation: bonus-glow-active 1.3s ease-in-out infinite;
}

@keyframes bonus-glow {
  0%, 100% {
    filter: drop-shadow(0 0 4px rgba(255, 175, 35, 0.45));
  }
  50% {
    filter: drop-shadow(0 0 13px rgba(255, 205, 55, 0.82));
  }
}

@keyframes bonus-glow-active {
  0%, 100% {
    filter: drop-shadow(0 0 8px rgba(255, 185, 40, 0.65));
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 22px rgba(255, 215, 65, 1));
    transform: scale(1.06);
  }
}

/* Skip */
#btn-skip {
  flex: unset;
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 18px;
  border-radius: 50%;
  background: url('assets/btn_skip.png');
  background-size: 110%;
  background-position: center;
  opacity: 0.9;
  border: 1px solid rgba(255,255,255,0.14);
  cursor: pointer;
  transition: filter 0.2s, border-color 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

#btn-skip:hover {
  filter: brightness(1.2);
  border-color: rgba(255,170,60,0.35);
}

#btn-skip:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  pointer-events: none;
}

/* Turbo */
#btn-turbo {
  flex: unset;
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 18px;
  border-radius: 50%;
  background: url('assets/btn_turbo.png');
  background-size: 110%;
  background-position: center;
  opacity: 0.9;
  border: none;
  cursor: pointer;
  transition: filter 0.2s, border-color 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

#btn-turbo:hover {
  filter: brightness(1.2);
}

#btn-turbo.active {
  filter: brightness(1.3) saturate(1.3);
  box-shadow: 0 0 0 1px rgba(216, 146, 73, 0.3), 0 0 16px rgba(216, 146, 73, 0.3);
}

/* Info / Mute */
#btn-info, #btn-mute {
  flex: unset;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.14);
  background-color: transparent;
  background-size: 110%;
  background-position: center;
  opacity: 0.9;
  cursor: pointer;
  transition: filter 0.2s, border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
}

#btn-info {
  background-image: url('assets/btn_info.png');
}

#btn-mute {
  background-image: url('assets/btn_speaker.png');
}

#btn-mute.muted {
  background-image: url('assets/btn_muted.png');
  border-color: rgba(255,80,80,0.4);
  filter: brightness(1.05);
}

#btn-info:hover, #btn-mute:hover {
  filter: brightness(1.2);
  border-color: rgba(255,170,60,0.35);
}

#btn-info.active {
  filter: brightness(1.3) saturate(1.3);
  border-color: rgba(108,142,255,0.55);
  box-shadow: 0 0 12px rgba(108,142,255,0.3);
}

/* Auto Play */
#btn-auto {
  flex: unset;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  font-size: 15px;
  font-weight: 700;
  border-radius: 50%;
  background: url('assets/btn_auto.png');
  background-size: 110%;
  background-position: center;
  opacity: 0.9;
  backdrop-filter: blur(14px);
  color: #e1c99580;
  cursor: pointer;
  transition: filter 0.2s, color 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#btn-auto:hover {
  filter: brightness(1.2);
}

#btn-auto .auto-stop { display: none; }
#btn-auto .auto-label { display: flex; }

#btn-auto.active {
  filter: brightness(1.3) saturate(1.3);
  box-shadow: 0 0 0 1px rgba(216, 146, 73, 0.3), 0 0 16px rgba(216, 146, 73, 0.3);
  animation: auto-pulse 1.6s ease-in-out infinite;
}
  
@keyframes auto-pulse {
  0%, 100% { filter: brightness(1.3) saturate(1.3); box-shadow: 0 0 0 1px rgba(216, 146, 73, 0.3), 0 0 16px rgba(216, 146, 73, 0.3); }
  50%       { filter: brightness(1.5) saturate(1.4); box-shadow: 0 0 0 2px rgba(216, 146, 73, 0.5), 0 0 24px rgba(216, 146, 73, 0.5); }
}

#btn-auto.active .auto-label { display: none; }
#btn-auto.active .auto-stop  { display: none; }


/* Action cluster */
.bet-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* Wrapper that elevates the skip + bet button together */
.btn-bet-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transform: translateY(-24px);
}

/* BET button */
#btn-bet {
  flex: unset;
  width: 96px;
  height: 96px;
  padding: 0;
  border-radius: 50%;
  backdrop-filter: blur(14px);
  border: 2px solid #deaa6580;
  background: url(assets/btn_V2.png);
  background-size: 103%;
  color: #00000000;
  background-position: center;
  opacity: 0.9;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 0 24px rgba(226,183,130,0.45), 0 4px 16px rgba(0,0,0,0.5);
  transform: none;
}

#btn-bet svg { transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1); }

#btn-bet:hover {
  filter: brightness(1.14);
  box-shadow: 0 0 36px rgba(226,183,130,0.65), 0 6px 20px rgba(0,0,0,0.5);
  transform: none;
}

#btn-bet:hover svg { transform: rotate(45deg); }
#btn-bet:active { transform: scale(0.93); filter: brightness(0.92); }

#btn-bet:disabled {
  border-color: rgba(255,255,255,0.1);
  box-shadow: none;
  cursor: not-allowed;
  filter: grayscale(0.7) brightness(0.5);
  opacity: 0.55;
  transform: none;
}

#btn-bet:disabled svg { transform: none; }

/* Active round — overrides the grey :disabled appearance */
#btn-bet.spinning,
#btn-bet.spinning:disabled {
  border-color: #deaa6590;
  box-shadow: 0 0 28px rgba(226,183,130,0.55), 0 4px 16px rgba(0,0,0,0.5);
  cursor: wait;
  filter: brightness(1.1);
  opacity: 1;
  transform: none;
  animation: btn-bet-glow 1.4s ease-in-out infinite;
}

#btn-bet.spinning svg,
#btn-bet.spinning:disabled svg {
  animation: btn-bet-spin 0.9s linear infinite;
  transform: none !important;
  transition: none;
}

@keyframes btn-bet-spin {
  to { transform: rotate(360deg); }
}

@keyframes btn-bet-glow {
  0%, 100% { box-shadow: 0 0 22px rgba(226,183,130,0.50), 0 4px 16px rgba(0,0,0,0.5); }
  50%       { box-shadow: 0 0 42px rgba(226,183,130,0.80), 0 4px 24px rgba(0,0,0,0.5); }
}

/* ── Balance deduct animation ────────────────────────────────────────────── */
@keyframes balance-deduct {
  0%   { transform: scale(1); }
  15%  { transform: scale(0.82); }
  40%  { transform: scale(1.08); }
  62%  { transform: scale(0.95); }
  80%  { transform: scale(1.03); }
  100% { transform: scale(1); }
}

#balance-val.balance-deduct {
  animation: balance-deduct 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* ── Claim payout animation ──────────────────────────────────────────────── */
@keyframes claim-bounce {
  0%   { transform: scale(1); }
  28%  { transform: scale(1.28); }
  52%  { transform: scale(0.89); }
  72%  { transform: scale(1.10); }
  88%  { transform: scale(0.97); }
  100% { transform: scale(1); }
}

#balance-val.claim-active {
  color: #f5e6c8;
  text-shadow: 0 0 10px #e8c98855, 0 0 28px #c8904030;
  transition: color 0.55s ease, text-shadow 0.55s ease;
}

#balance-val.claim-active .currency {
  color: #d4b88a;
  transition: color 0.55s ease;
}

#balance-val.claim-bounce {
  animation: claim-bounce 0.34s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* Winnings — hidden until claim, fades out when done */
#winnings-segment {
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

#winnings-segment.visible {
  opacity: 1;
  pointer-events: auto;
}

#winnings-val {
  font-size: 24px;
  font-weight: 700;
  color: #e8e8e8;
  font-variant-numeric: tabular-nums;
  transition: color 0.4s ease, text-shadow 0.4s ease;
}

#winnings-val .currency {
  font-size: 13px;
  font-weight: 500;
  color: #999;
  margin-right: 3px;
  transition: color 0.4s ease;
}

#winnings-val.claim-active {
  color: #f5e6c8;
  text-shadow: 0 0 10px #e8c98855, 0 0 28px #c8904030;
}

#winnings-val.claim-active .currency {
  color: #d4b88a;
}

#winnings-val.claim-bounce {
  animation: claim-bounce 0.34s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* ── RGS mode toggle ─────────────────────────────────────────────────── */
.rgs-toggle-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.rgs-btn {
  padding: 3px 10px;
  font-size: 11px;
  border-radius: 4px;
  background: #1e1e2a;
  color: #999;
  border: 1px solid #333;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.rgs-btn.active {
  background: #2a3a55;
  color: #80aaff;
  border-color: #4466aa;
}

/* ── FPS display ─────────────────────────────────────────────────────────── */
.fps-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

#fps-display,
#dpr-display {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: #80aaff;
  min-width: 28px;
}

.fps-sep {
  color: #444;
  font-size: 12px;
}

/* ── Game Dialog ─────────────────────────────────────────────────────────── */
.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  animation: dialog-fade-in 0.18s ease;
}

.dialog-bg {
    background: url('assets/menu-bg.jpg');
    height: 100%;
    width: 100%;
    position: absolute;
    z-index: -1;
    background-position: center -9px;
    opacity: 0.4;
    left: 0;
    right: 0;
    background-repeat: no-repeat;
}

@keyframes dialog-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.dialog-panel {
  padding-top: 36px;
}

.dialog-box {
  position: relative;
  background: #00000054;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 0 16px 16px;
  min-width: 320px;
  max-width: 600px;
  width: 90vw;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05);
  animation: dialog-slide-up 0.2s cubic-bezier(0.22,1,0.36,1);
  transition: max-width 0.2s ease;
  overflow: hidden;
}

.dialog-box--bonus {
  max-width: 380px;
}

@keyframes dialog-slide-up {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #888;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.dialog-close:hover { background: rgba(255,255,255,0.14); color: #fff; }

.dialog-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #e8e8e8;
  margin-bottom: 18px;
}

.dialog-sub {
  font-size: 12px;
  color: #666;
  margin-bottom: 18px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dialog-body p {
  font-size: 13px;
  color: #aaa;
  line-height: 1.7;
  margin-bottom: 10px;
}
.dialog-body p:last-child { margin-bottom: 0; }
.dialog-body strong { color: #ccc; }

/* Info panel tabs */
.info-tabs {
  display: flex;
  gap: 4px;
  margin-top: 20px;
  margin-bottom: 20px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 4px;
}

.info-tab {
  flex: 1;
  padding: 7px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: #777;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.info-tab:hover { color: #bbb; }
.info-tab.active {
  background: rgba(255,255,255,0.10);
  color: #e8e8e8;
}

.info-tab-content {
  padding: 0 8px;
  overflow-y: auto;
  max-height: 400px;
  display: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}
.info-tab-content::-webkit-scrollbar {
  width: 4px;
}
.info-tab-content::-webkit-scrollbar-track {
  background: transparent;
}
.info-tab-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
}
.info-tab-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.45);
}
.info-tab-content.active { display: block; }

/* Rules disclaimer */
.rules-disclaimer {
  margin-top: 18px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 10.5px;
  color: #666;
  line-height: 1.6;
}

/* Paytable */
.paytable-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 4px;
}
.paytable-table th,
.paytable-table td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: #aaa;
}
.paytable-table th {
  color: #777;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.paytable-table td:last-child {
  text-align: right;
  font-weight: 700;
  color: #c8a96e;
}
.paytable-table tr:last-child td { border-bottom: none; }

/* Info brand block */
.info-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.info-brand-icon {
  width: 48px;
  height: 48px;
  color: #c8a96e;
  flex-shrink: 0;
}
.info-brand-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #e8e8e8;
  line-height: 1.2;
}
.info-brand-maker {
  font-size: 12px;
  color: #888;
  margin-top: 3px;
}
.info-brand-maker strong { color: #c8a96e; }

.info-footer-note {
  margin-top: 14px;
  font-size: 11px !important;
  color: #555 !important;
  line-height: 1.5 !important;
}

/* Auto rounds grid */
.auto-rounds-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.auto-rounds-btn {
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  font-size: 24px;
  font-weight: 700;
  color: #e1c995;
  min-width: 28px;
  text-align: center;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 14px 16px;
}

.auto-rounds-btn:hover {
  background: rgba(220,165,60,0.15);
  border-color: rgba(220,165,60,0.4);
  color: #e8cc88;
  transform: scale(1.04);
}

.auto-rounds-btn:active { transform: scale(0.96); }

.auto-rounds-btn[data-rounds="0"] {
  grid-column: 1 / -1;
  font-size: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 0 14px;
}

.auto-infinite-hint {
  font-size: 12px;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-weight: 400;
  color: #888;
  transition: color 0.15s;
}

.auto-rounds-btn[data-rounds="0"]:hover .auto-infinite-hint,
.auto-rounds-btn[data-rounds="0"].selected .auto-infinite-hint {
  color: #e8cc88;
}

.auto-rounds-btn.selected {
  background: rgb(240 216 152 / 22%);
  border-color: rgb(225 201 149 / 65%);
  color: #f0d898;
  box-shadow: 0 0 0 2px rgba(220, 165, 60, 0.25);
}

.auto-confirm-btn {
  display: block;
  width: 100%;
  margin-top: 0;
  padding: 14px 0;
  color: #e1c995;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s, transform 0.1s;
  background: none;
  border: none;
}
.auto-confirm-btn:hover {
  background: none;
  border: none;
}

.auto-confirm-btn:not(:disabled):hover {
  color: #f0d898;
  transform: scale(1.02);
}

.auto-confirm-btn:not(:disabled):active { transform: scale(0.97); }

.auto-confirm-btn:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  color: #666;
}

/* ── Key Vault bonus dialog ───────────────────────────────────────────────── */
.kv-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.kv-hero-icon {
  width: 72px;
  height: 72px;
  /* border-radius: 20px;
  background: radial-gradient(ellipse at 40% 40%, rgba(212,168,64,0.22) 0%, rgba(212,168,64,0.06) 70%);
  border: 1px solid rgba(212,168,64,0.30);
  box-shadow: 0 0 28px rgba(212,168,64,0.15); */
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.kv-hero-key-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(212,168,64,0.5));
}

.kv-btn-key-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  filter: brightness(0.4);
}

.kv-hero-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #e8e0c8;
}

.kv-hero-sub {
  font-size: 12px;
  color: #888;
  letter-spacing: 0.04em;
  text-align: center;
}

.kv-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 14px 16px;
}

.kv-stat-lbl {
  font-size: 11px;
  color: #777;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.kv-stepper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.kv-stepper-count {
  font-size: 24px;
  font-weight: 700;
  color: #e1c995;
  min-width: 28px;
  text-align: center;
  letter-spacing: 0.02em;
}

.kv-key-icons {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
}

.kv-key-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  filter: drop-shadow(0 0 3px rgba(212,168,64,0.45));
}

.kv-stepper-btn {
  flex: unset;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: #bbb;
  font-size: 17px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.kv-stepper-btn:hover {
  background: rgba(220,165,60,0.18);
  border-color: rgba(220,165,60,0.5);
  color: #f0d898;
  transform: none;
}

.kv-stepper-btn:active { transform: scale(0.9); }

.kv-stepper-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  pointer-events: none;
}

.kv-desc {
  font-size: 13px;
  color: #999;
  line-height: 1.6;
  text-align: center;
  margin: 0 0 24px;
}

.kv-purchase {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.kv-purchase-label {
  font-size: 12px;
  color: #999;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.kv-purchase-price {
  font-size: 20px;
  font-weight: 700;
  color: #e1c995;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

#kv-cost-sym {
  font-size: 13px;
  font-weight: 500;
  color: #e1bd94;
  margin-right: 2px;
}

@keyframes kv-btn-pulse {
  0%, 100% { transform: scale(0.95); }
  50%       { transform: scale(1.1);  }
}

.kv-play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 20px;
  border-radius: 14px;
  border: none;
  background: none;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
  animation: kv-btn-pulse 1.6s ease-in-out infinite;
}

.kv-play-btn-label {
  background-image: linear-gradient(to bottom, #b78f4c, #dec079, #b78f4c, #aa7f42);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.85));
}

.kv-play-btn:hover {
  animation-play-state: paused;
  transform: scale(1.1);
  background: none;
  filter: brightness(1.2);
}

.kv-play-btn:active {
  animation-play-state: paused;
  transform: scale(0.88);
}

/* ── Key Vault Bonus HUD — count badge ───────────────────────────────────── */
/* The actual key visuals are 3D objects in the scene; this badge just shows  */
/* how many bought keys remain (×N).                                          */
#keys-hud {
  position: fixed;
  top: 18px;
  right: 18px;
  display: none; /* shown/hidden by JS */
  align-items: center;
  justify-content: center;
  z-index: 25;
  padding: 6px 14px;
  background: rgba(14, 14, 20, 0.72);
  border: 1px solid rgba(212, 168, 64, 0.40);
  border-radius: 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: 'MightySouly', 'Segoe UI', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #d4a840;
  letter-spacing: 0.04em;
  pointer-events: none;
}

/* Propagate to all interactive children */
* {
  touch-action: manipulation;
}

/* ── Responsive: bottom navbar ── */
#btn-turbo,
#btn-auto,
#btn-skip {
  position: absolute;
}
#btn-turbo { right: 162px; top: -65px; }
#btn-skip  { right: 36px; top: -66.5px; }
#btn-auto  { right: 99px; top: -91px; }

#btn-bet {
  width: 120px;
  height: 120px;
}

@media (max-width: 640px) {
  #game-ui {
    padding: 0 6px;
    height: 74px;
  }
  .game-segment {
    border: none;
    padding: 0 6px;
  }
  .game-segment + .game-segment {
    border-left: none;
  }
  .game-segment.row {
    gap: 5px;
  }
  .game-label {
    font-size: 10px;
    letter-spacing: 0.07em;
  }
  #balance-val,
  #winnings-val {
    font-size: 22px;
  }
  #balance-val .currency,
  #winnings-val .currency {
    font-size: 12px;
  }
  #bet-display {
    font-size: 22px;
    min-width: 64px;
  }
  #bet-display .bet-currency {
    font-size: 12px;
  }
  #btn-bet {
    width: 94px;
    height: 94px;
  }
  #btn-bet svg {
    width: 42px;
    height: 42px;
  }
  .btn-bet-wrap {
    transform: translateY(-25px);
    gap: 4px;
  }
  #btn-bonus {
    width: 68px;
    height: 38px;
    font-size: 10px;
    letter-spacing: 0.08em;
    border-radius: 10px;
  }
  /* pull turbo/auto out of flex flow and anchor them beside the spin button */
  .bet-cluster {
    position: relative;
    gap: 5px;
  }
  #btn-turbo { right: 92px; top: -31px; }
  #btn-skip  { right: 0; top: -63.5px; }
  #btn-auto  { right: 52px; top: -64px; }
  #btn-turbo,
  #btn-auto,
  #btn-skip {
    position: absolute;
    width: 38px;
    height: 38px;
  }
  .bet-adj {
    width: 24px;
    height: 24px;
    font-size: 18px;
  }
  #btn-info,
  #btn-mute {
    width: 28px;
    height: 28px;
  }

  /* pull info/mute + bonus out of flow → float above the bar, left-anchored */
  #game-ui > .game-segment:nth-child(2) {
    position: absolute;
    left: 0;
    bottom: calc(100% + 52px);
    padding: 0 4px;
    border-left: none;
    margin-left: 6px;
  }
  #game-ui > .game-segment:nth-child(3) {
    position: absolute;
    left: 18px;
    bottom: calc(100% + 6px);
    border-left: none;
  }
}

/* ── Mobile: strip backdrop-filter blur to eliminate per-frame compositing cost ── */
/* backdrop-filter forces the browser to re-blur the animated WebGL canvas every
   frame. On touch-primary devices we swap it for a slightly more opaque solid
   background so the visual result is similar without the GPU overhead. */
/* @media (hover: none) and (pointer: coarse) {
  .panel,
  #cam-hud,
  #game-ui,
  #btn-skip,
  #btn-bet,
  #btn-bonus,
  #btn-auto,
  #btn-info,
  #btn-mute,
  .dialog-overlay,
  .dialog-box {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .panel          { background: rgba(15, 15, 20, 0.92); }
  #cam-hud        { background: rgba(15, 15, 20, 0.90); }
  #btn-bonus      { background: transparent; border: none; }
  .dialog-box     { background: linear-gradient(160deg, rgba(20,18,14,0.96) 0%, rgba(28,24,18,0.96) 100%); }
  .dialog-overlay { background: rgba(0, 0, 0, 0.55); }
} */

/* ── Bet confirmation dialog ──────────────────────────────────────────────── */
.bet-confirm-box {
  max-width: 300px;
  text-align: center;
  padding: 32px 28px 28px;
}

.bet-confirm-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 12px;
}

.bet-confirm-amount {
  font-size: 34px;
  font-weight: 700;
  color: #f0d898;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}

.bet-confirm-skip-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 12px;
  color: #666;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

.bet-confirm-skip-label:hover { color: #999; }

.bet-confirm-skip-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #c9a84c;
  cursor: pointer;
  flex-shrink: 0;
}

.game-ui-bg {
  position: absolute;
  inset: 0;
  background: url('assets/menu-bg.jpg') center -5px no-repeat;
  background-size: 100%;
  opacity: 0.2;
  z-index: -1;
}

@media (max-width: 768px) {
  .game-ui-bg {
    background: url('assets/menu_bg2.png') center -5px / 100% 89px repeat-x;
  }
}
