:root {
  --panel:        #23204E;
  --board:        #120D24;
  --card-bg:      #23204E;
  --card-shadow:  #0a0818;
  --elevated:     #272859;
  --hairline:     rgba(255, 255, 255, 0.06);
  --toggle-bg:    rgba(30, 24, 69, 0.8);
  --toggle-border:rgba(255, 255, 255, 0.12);
  --input-border: rgba(255, 255, 255, 0.10);
  --input-bg:     #23204E;
  --chip-bg:      #23204E;

  --text:         #FFFFFF;
  --text-75:      rgba(255, 255, 255, 0.75);
  --text-mid:     #8B8BA3;
  --text-dim:     rgba(139, 139, 163, 0.50);
  --text-dimmer:  #5C5C7A;

  --accent:       #F7931A;
  --accent-border:rgba(247, 147, 26, 0.45);
  --accent-glow:  rgba(247, 147, 26, 0.20);

  --green:        #0ECC68;
  --green-bright: #10e676;
  --green-bg:     rgba(14, 204, 104, 0.12);
  --red:          #F85F5D;
  --red-bg:       rgba(248, 95, 93, 0.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100dvh;
  background: #120D24;
  color: var(--text);
  font-family: 'Montserrat', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
body {
  display: flex;
}
#root { width: 100%; height: 100dvh; display: flex; }

/* ===== APP FRAME ===== */
.app {
  width: 100%; max-width: 100%;
  height: var(--app-height, 100%); max-height: var(--app-height, 100%);
  border-radius: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  box-shadow: none;
}

.app > .header,
.app > .row,
.app > .bottom { width: 100%; }

/* ===== HEADER ===== */
.header {
  display: flex;
  height: 50px;
  background: var(--panel);
  border-bottom: 1px solid var(--hairline);
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-left .game-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.header-left .game-name .ico { font-size: 18px; color: var(--accent); }
.header-balance {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(247,147,26,0.10) 0%, rgba(247,147,26,0.02) 100%);
  border: 1px solid rgba(247,147,26,0.18);
  border-radius: 999px;
  padding: 6px 16px 6px 10px;
  transition: border-color 0.2s;
}
.header-balance:hover { border-color: rgba(247,147,26,0.35); }
.header-bal-icon {
  font-size: 13px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.header-bal-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}
.header-right { display: flex; align-items: center; gap: 8px; }
.fairplay {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--toggle-border);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-mid);
  cursor: pointer;
  transition: all 0.2s;
}
.fairplay::before {
  content: '';
  width: 14px; height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23919FC0' stroke-width='2'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.fairplay:hover { border-color: var(--accent-border); color: var(--text); }
.info {
  width: 30px; height: 30px;
  border: 1px solid var(--toggle-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-mid);
  cursor: pointer;
  transition: all 0.2s;
}
.info:hover { border-color: var(--accent-border); color: var(--text); }

/* ===== BOTTOM BAR ===== */
.bottom {
  height: 44px; background: var(--panel);
  border-top: 1px solid var(--hairline);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; flex-shrink: 0;
}
.bottom-icons { display: flex; gap: 14px; align-items: center; }
.ic { color: rgba(255,255,255,0.7); cursor: pointer; display: flex; align-items: center; transition: color 0.2s, transform 0.15s; }
.ic:hover { color: #fff; transform: scale(1.1); }
.ic.muted { color: var(--red); }
.ic.faved { color: var(--accent); }
.ic.faved svg { fill: var(--accent); }
.bottom-logo { font-size: 13px; font-weight: 700; color: rgba(255,255,255,0.4); letter-spacing: 0.12em; }

/* ===== ROW ===== */
.row {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* ===== SIDE PANEL ===== */
.side {
  width: 340px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--hairline);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

/* Mode Toggle */
.mode-toggle {
  display: flex;
  background: var(--toggle-bg);
  border: 1px solid var(--toggle-border);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}
.mode-toggle button {
  flex: 1;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-mid);
  font-family: inherit;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.25s;
}
.mode-toggle button.active {
  background: linear-gradient(257.95deg, #E67A00 2.9%, #F7931A 54.68%, #F7951C 95.53%);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(247,147,26,0.30);
}
.mode-toggle button:disabled { opacity: 0.4; cursor: not-allowed; }

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.auto-bet-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Auto progress */
.auto-progress-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auto-progress-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.auto-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #e6b800);
  border-radius: 2px;
  transition: width 0.4s ease-out;
}

/* Fields */
.field { display: flex; flex-direction: column; gap: 6px; }
.label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.label.small { font-size: 10px; }

.input-row {
  height: 46px;
  display: flex;
  align-items: center;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(180deg, #23204E 0%, #23204E 100%);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(247, 147, 26, 0.08);
}
.input-row .currency {
  width: 38px;
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
  text-align: center;
  flex-shrink: 0;
}
.input-row input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  padding: 0 8px;
  -moz-appearance: textfield;
}
.input-row input::-webkit-outer-spin-button,
.input-row input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.input-row input::placeholder { color: var(--text-dimmer); }

.chips {
  display: flex;
  gap: 4px;
  padding: 0 8px;
  flex-shrink: 0;
}
.chip {
  width: 40px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--toggle-border);
  color: var(--text-75);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.chip:hover:not(:disabled) {
  border-color: var(--accent-border);
  background: rgba(247, 147, 26, 0.08);
  color: var(--accent);
  transform: translateY(-1px);
}
.chip:disabled { opacity: 0.3; cursor: not-allowed; }

.target-input { flex-direction: row-reverse; }
.target-input .currency { color: var(--text-mid); font-size: 13px; }

/* Side stats — compact inline row */
.side-stats {
  display: flex;
  gap: 8px;
}
.stat-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--hairline);
  border-radius: 10px;
}
.stat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat-val {
  font-size: 15px;
  font-weight: 800;
}
.stat-val.accent { color: var(--accent); }
.stat-val.green { color: var(--green); }

/* Mobile header balance — minimal */
.header-bal-mobile {
  display: none !important; align-items: center; gap: 4px;
  background: none !important; border: none !important;
  border-radius: 0 !important; padding: 0 !important;
}
.header-bal-mobile .bet-balance-icon {
  font-size: 14px !important; font-weight: 700; color: var(--accent);
  width: auto !important; height: auto !important;
  background: none !important; border-radius: 0 !important;
}
.header-bal-mobile .bet-balance-amount { font-size: 14px !important; font-weight: 700; color: #fff !important; }
@media (max-width: 860px) {
  .header-bal-mobile { display: flex !important; }
  .header-balance { display: none; }
}
@media (min-width: 861px) { .header-bal-mobile { display: none; } }
.floating-balance { display: none; }
@media (max-width: 680px) { .bet-balance-row { display: none !important; } }

/* Balance display in bet area */
.bet-balance-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(247,147,26,0.10) 0%, rgba(247,147,26,0.03) 100%);
  border: 1px solid rgba(247,147,26,0.20);
  border-radius: 10px;
}
.bet-balance-icon {
  display: flex; justify-content: center; align-items: center;
  width: 28px; height: 28px;
  background: #F7931A; border-radius: 9999px;
  font-weight: 700; font-size: 11px; color: #FFFFFF; flex-shrink: 0;
}
.bet-balance-text { display: flex; flex-direction: column; gap: 1px; }
.bet-balance-label {
  font-size: 10px; color: #F7931A; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.bet-balance-amount {
  font-weight: 800; font-size: 15px; color: #F7931A;
  font-variant-numeric: tabular-nums;
}

/* Buttons */
.place-btn {
  height: 50px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #F7931A 0%, #E67A00 100%);
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(247,147,26,0.30), inset 0 1px 0 rgba(255,255,255,0.2);
}
.place-btn:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 6px 24px rgba(247,147,26,0.40), inset 0 1px 0 rgba(255,255,255,0.2);
  transform: translateY(-1px);
}
.place-btn:active:not(:disabled) { transform: translateY(0); }
.place-btn:disabled { opacity: 0.4; cursor: not-allowed; filter: none; transform: none; }

/* Auto section */
.auto-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255,255,255,0.02);
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--hairline);
}
.auto-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.auto-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.auto-input {
  flex: 1;
  height: 36px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  background: linear-gradient(180deg, #23204E 0%, #23204E 100%);
  color: var(--text);
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  padding: 0 10px;
  outline: none;
  -moz-appearance: textfield;
  transition: border-color 0.2s;
}
.auto-input::-webkit-outer-spin-button,
.auto-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.auto-input:focus { border-color: var(--accent); }
.auto-start-btn {
  height: 42px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #F7931A 0%, #E67A00 100%);
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  width: 100%;
  box-shadow: 0 4px 16px rgba(247,147,26,0.30), inset 0 1px 0 rgba(255,255,255,0.2);
  transition: all 0.2s;
}
.auto-start-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(247,147,26,0.35); }
.auto-start-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.stop-btn {
  height: 42px;
  border: 1.5px solid var(--red);
  border-radius: 10px;
  background: var(--red-bg);
  color: var(--red);
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s;
}
.stop-btn:hover { background: rgba(248, 95, 93, 0.25); }
.auto-progress-text {
  font-size: 11px;
  color: var(--text-mid);
  text-align: center;
  font-weight: 600;
}

/* ===== MAIN AREA ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--board);
  min-width: 0;
}
.game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px;
  position: relative;
  overflow: visible;
  min-height: 0;
}

/* ===== AMBIENT BACKGROUND ===== */
.bg-ambient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

/* Star field */
.stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 30% 65%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(1px 1px at 55% 15%, rgba(255,255,255,0.25) 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 75%, rgba(255,255,255,0.15) 0%, transparent 100%),
    radial-gradient(1px 1px at 85% 40%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 45% 85%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 20% 50%, rgba(255,255,255,0.15) 0%, transparent 100%),
    radial-gradient(1px 1px at 65% 35%, rgba(255,255,255,0.25) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 10%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 5% 90%, rgba(255,255,255,0.15) 0%, transparent 100%),
    radial-gradient(1px 1px at 40% 45%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(1px 1px at 75% 55%, rgba(255,255,255,0.15) 0%, transparent 100%);
  animation: starsTwinkle 6s ease-in-out infinite alternate;
}
@keyframes starsTwinkle {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* Nebula clouds */
.nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
}
.n1 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(50, 80, 180, 0.12) 0%, rgba(30, 50, 140, 0.06) 50%, transparent 70%);
  top: -10%;
  right: -5%;
  animation: nebulaFlow1 25s ease-in-out infinite;
}
.n2 {
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(100, 50, 180, 0.10) 0%, rgba(60, 30, 140, 0.05) 50%, transparent 70%);
  bottom: -5%;
  left: -5%;
  animation: nebulaFlow2 30s ease-in-out infinite;
}
@keyframes nebulaFlow1 {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.7; }
  25% { transform: translate(-20px, 15px) scale(1.05); opacity: 0.9; }
  50% { transform: translate(10px, -10px) scale(0.95); opacity: 0.6; }
  75% { transform: translate(15px, 20px) scale(1.08); opacity: 0.8; }
}
@keyframes nebulaFlow2 {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.6; }
  33% { transform: translate(20px, -15px) scale(1.1); opacity: 0.8; }
  66% { transform: translate(-15px, 10px) scale(0.9); opacity: 0.5; }
}

/* Rotating infinity rings */
.infinity-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid transparent;
}
.ring-1 {
  width: 350px;
  height: 350px;
  top: 50%;
  left: 50%;
  margin: -175px 0 0 -175px;
  border-color: rgba(80, 120, 200, 0.06);
  animation: ringRotate 40s linear infinite;
}
.ring-2 {
  width: 280px;
  height: 280px;
  top: 50%;
  left: 50%;
  margin: -140px 0 0 -140px;
  border-color: rgba(80, 120, 200, 0.04);
  border-style: dashed;
  animation: ringRotate 30s linear infinite reverse;
}
.ring-3 {
  width: 420px;
  height: 420px;
  top: 50%;
  left: 50%;
  margin: -210px 0 0 -210px;
  border-color: rgba(80, 120, 200, 0.03);
  animation: ringRotate 50s linear infinite;
}
@keyframes ringRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Energy waves on counting */
.energy-wave {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200px;
  height: 200px;
  margin: -100px 0 0 -100px;
  border-radius: 50%;
  border: 1px solid rgba(80, 140, 255, 0);
  opacity: 0;
}
.energy-wave.active {
  animation: waveExpand 0.6s ease-out forwards;
}
.wave-2.active {
  animation-delay: 0.15s;
}
@keyframes waveExpand {
  0% { transform: scale(0.5); opacity: 0; border-color: rgba(80, 140, 255, 0.4); }
  50% { opacity: 1; }
  100% { transform: scale(2.5); opacity: 0; border-color: rgba(80, 140, 255, 0); }
}

/* Phase-reactive */
.game-area.phase-counting .nebula { filter: blur(60px); }
.game-area.phase-counting .ring-1 { border-color: rgba(80, 140, 255, 0.10); }
.game-area.phase-counting .ring-2 { border-color: rgba(80, 140, 255, 0.07); }
.game-area.phase-counting .stars { animation-duration: 1s; }
.game-area.phase-result.result-win .n1 { background: radial-gradient(circle, rgba(14, 204, 104, 0.12) 0%, transparent 70%); }
.game-area.phase-result.result-win .n2 { background: radial-gradient(circle, rgba(14, 204, 104, 0.08) 0%, transparent 70%); }
.game-area.phase-result.result-win .ring-1 { border-color: rgba(14, 204, 104, 0.08); }
.game-area.phase-result.result-win .stars { opacity: 1; }

/* ===== CUBE ===== */
.cube-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  position: relative;
  z-index: 1;
}
.cube-track {
  position: relative;
  width: 420px;
  height: 240px;
  background: #23204E;
  border-radius: 16px;
  border: 2px solid rgba(47, 69, 83, 0.60);
  overflow: hidden;
  transition: border-color 0.4s, box-shadow 0.4s;
}
.cube-track.result-win,
.cube-track.result-lose {
  border-color: rgba(90, 140, 220, 0.40);
  box-shadow:
    0 0 40px rgba(90, 140, 220, 0.12),
    0 0 80px rgba(90, 140, 220, 0.05),
    inset 0 0 30px rgba(90, 140, 220, 0.03);
}

/* Game phase animations */
.cube-track.phase-counting {
  animation: cubeZoomIn 0.3s ease-out forwards;
}
.cube-track.phase-result {
  animation: cubeBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.cube-track.phase-result.result-win {
  animation: cubeWinPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.cube-value.phase-result {
  animation: textReveal 0.4s ease-out forwards;
}
.cube-value.phase-result.result-win {
  animation: textWinPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes cubeZoomIn {
  0% { transform: scale(0.97); }
  100% { transform: scale(1); }
}

@keyframes cubeBounce {
  0% { transform: scale(1); }
  40% { transform: scale(1.03); }
  70% { transform: scale(0.99); }
  100% { transform: scale(1); }
}

@keyframes cubeWinPop {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(14, 204, 104, 0); }
  30% { transform: scale(1.05); box-shadow: 0 0 40px rgba(14, 204, 104, 0.2); }
  60% { transform: scale(0.98); }
  100% { transform: scale(1); box-shadow: 0 0 0 rgba(14, 204, 104, 0); }
}

@keyframes textReveal {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes textWinPop {
  0% { transform: scale(1); }
  30% { transform: scale(1.15); }
  60% { transform: scale(0.95); }
  100% { transform: scale(1.05); }
}

/* Shimmer on win — light sweep across cube */
.cube-track.phase-result.result-win::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(14, 204, 104, 0.12) 45%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(14, 204, 104, 0.12) 55%,
    transparent 70%
  );
  animation: shimmer 0.6s ease-out forwards;
  z-index: 5;
  border-radius: 14px;
  pointer-events: none;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Indicator line pulse on result */
.cube-indicator.result-win {
  height: 3px;
  box-shadow: 0 0 16px rgba(14, 204, 104, 0.8), 0 0 30px rgba(14, 204, 104, 0.4);
  background: rgba(14, 204, 104, 0.9);
}

/* ===== PARTICLES ===== */
.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-bright);
  z-index: 10;
  pointer-events: none;
  animation: particleBurst 0.7s ease-out forwards;
  box-shadow: 0 0 6px var(--green);
}
@keyframes particleBurst {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) scale(0);
    opacity: 0;
  }
}

/* ===== RIPPLE RINGS ===== */
.ripple {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 2px solid rgba(90, 140, 220, 0.3);
  animation: rippleExpand 0.7s ease-out forwards;
  pointer-events: none;
  z-index: 0;
}
.ripple.result-win {
  border-color: rgba(14, 204, 104, 0.35);
}
.ripple-2 {
  animation-delay: 0.12s;
}
@keyframes rippleExpand {
  0% {
    transform: scale(0.3);
    opacity: 1;
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

/* ===== BACKGROUND FLASH ===== */
.bg-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
  animation: bgFlash 0.5s ease-out forwards;
}
.bg-flash.win {
  background: radial-gradient(circle at center, rgba(14, 204, 104, 0.12) 0%, transparent 70%);
}
@keyframes bgFlash {
  0% { opacity: 1; transform: scale(0.8); }
  100% { opacity: 0; transform: scale(1.5); }
}

/* ===== FLOATING PAYOUT ===== */
.payout-float {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 20px;
  font-weight: 800;
  color: var(--green-bright);
  text-shadow: 0 0 16px rgba(14, 204, 104, 0.5);
  pointer-events: none;
  z-index: 10;
  animation: floatUp 1.2s ease-out forwards;
  white-space: nowrap;
}
@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(0.8);
  }
  30% {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-50px) scale(0.9);
  }
}

/* ===== GAME AREA PHASE BG ===== */
.game-area.phase-counting {
  background: radial-gradient(circle at center, rgba(90, 140, 220, 0.03) 0%, transparent 60%);
}
.game-area.phase-result.result-win {
  background: radial-gradient(circle at center, rgba(14, 204, 104, 0.04) 0%, transparent 60%);
}

.cube-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0%;
  border-radius: 0 0 14px 14px;
  transition: height 0.03s linear;
  background: rgba(90, 140, 220, 0.20);
}

/* Indicator line — rides on top of fill */
.cube-indicator {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(130, 175, 255, 0.8);
  z-index: 2;
  transition: bottom 0.05s linear;
  box-shadow: 0 0 10px rgba(90, 140, 220, 0.6), 0 0 20px rgba(90, 140, 220, 0.3);
}
.cube-indicator.animating {
  background: rgba(130, 175, 255, 0.9);
  box-shadow: 0 0 12px rgba(90, 140, 220, 0.7), 0 0 24px rgba(90, 140, 220, 0.35);
}

/* Multiplier value inside cube */
.cube-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 800;
  color: #FFFFFF;
  z-index: 3;
  transition: color 0.4s, text-shadow 0.4s, transform 0.3s;
  letter-spacing: -0.02em;
  pointer-events: none;
}
.cube-value.animating {
  color: #FFFFFF;
}
.cube-value.result-win {
  color: var(--green-bright);
  text-shadow: 0 0 30px rgba(14, 204, 104, 0.5), 0 0 60px rgba(14, 204, 104, 0.2);
  transform: scale(1.05);
}
.cube-value.result-lose {
  color: #FFFFFF;
}

/* ===== HISTORY BAR ===== */
.history-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  background: rgba(26, 44, 56, 0.6);
  border-bottom: 1px solid var(--hairline);
  overflow-x: auto;
  flex-shrink: 0;
  backdrop-filter: blur(6px);
}
.history-bar::-webkit-scrollbar { height: 2px; }
.history-bar::-webkit-scrollbar-track { background: transparent; }
.history-bar::-webkit-scrollbar-thumb { background: rgba(145,159,192,0.15); border-radius: 1px; }
.history-empty {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  font-weight: 500;
}
.history-chip {
  flex-shrink: 0;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  transition: transform 0.15s;
}
.history-chip:hover { transform: scale(1.05); }
.history-chip.hc-win {
  background: rgba(14, 204, 104, 0.10);
  color: var(--green);
  border: 1px solid rgba(14, 204, 104, 0.25);
}
.history-chip.hc-lose {
  background: rgba(145, 159, 192, 0.12);
  color: var(--text-mid);
  border: 1px solid rgba(145, 159, 192, 0.22);
}

/* Scrollbars */
.side::-webkit-scrollbar { width: 3px; }
.side::-webkit-scrollbar-track { background: transparent; }
.side::-webkit-scrollbar-thumb { background: rgba(145,159,192,0.12); border-radius: 2px; }

/* ===== ALERT TOAST ===== */
.alert-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: rgba(248, 95, 93, 0.15);
  border: 1px solid rgba(248, 95, 93, 0.4);
  border-radius: 10px;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
  z-index: 200;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  animation: alertSlide 0.3s ease-out forwards;
  white-space: nowrap;
}
.alert-icon {
  font-size: 16px;
}
@keyframes alertSlide {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  width: min(420px, calc(100vw - 32px));
  max-height: min(520px, 70dvh);
  overflow-y: auto;
  padding: 24px;
  position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.06);
}
.modal::-webkit-scrollbar { width: 3px; }
.modal::-webkit-scrollbar-track { background: transparent; }
.modal::-webkit-scrollbar-thumb { background: rgba(145,159,192,0.15); border-radius: 2px; }
.modal h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
}
.modal h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin: 12px 0 6px;
}
.modal p, .modal li {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-75);
}
.modal ul, .modal ol { padding-left: 18px; margin-bottom: 8px; }
.modal li { margin-bottom: 3px; }
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px; height: 28px;
  background: var(--card-bg);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  color: var(--text-mid);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.modal-close:hover { border-color: var(--accent-border); color: var(--text); }
.modal-payout-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  margin-bottom: 8px;
}
.modal-payout-box .label { font-size: 12px; color: var(--text-mid); }
.modal-payout-box .value { font-size: 13px; font-weight: 700; color: var(--accent); }
.info-box {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: var(--card-bg);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  margin-bottom: 8px;
}
.info-box .info-icon { font-size: 20px; flex-shrink: 0; }
.info-box p { margin: 0; }
.mult-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 8px;
}
.mult-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.mult-table th, .mult-table td {
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid var(--hairline);
}
.mult-table th { color: var(--text-mid); font-weight: 600; }
.mult-table td { color: var(--text-75); }

/* Provably Fair modal */
.pf-desc { margin-bottom: 16px; }
.pf-section {
  background: var(--card-bg);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}
.pf-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pf-icon { font-size: 14px; }
.pf-sublabel { font-size: 11px; color: var(--text-dim); margin-bottom: 8px; }
.pf-toggle-row { display: flex; gap: 6px; margin-bottom: 10px; }
.pf-toggle-btn {
  flex: 1;
  height: 32px;
  border: 1px solid var(--toggle-border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-mid);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.pf-toggle-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(247, 147, 26, 0.08);
}
.pf-input-row { display: flex; gap: 6px; margin-bottom: 8px; }
.pf-input-row input {
  flex: 1;
  height: 34px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  background: linear-gradient(180deg, #23204E 0%, #23204E 100%);
  color: var(--text);
  font-family: monospace;
  font-size: 11px;
  padding: 0 10px;
  outline: none;
  transition: border-color 0.2s;
}
.pf-input-row input:focus { border-color: var(--accent); }
.pf-btn-sm {
  width: 34px;
  height: 34px;
  border: 1px solid var(--toggle-border);
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  color: var(--text-mid);
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.pf-btn-sm:hover { border-color: var(--accent-border); color: var(--text); }
.pf-hash-box {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 10px;
  font-family: monospace;
  font-size: 10px;
  color: var(--text-mid);
  word-break: break-all;
  margin-bottom: 8px;
  line-height: 1.5;
}
.pf-cp-row { display: flex; gap: 6px; margin-bottom: 8px; }
.pf-note { font-size: 11px; color: var(--text-dim); margin: 0; line-height: 1.5; }
.pf-how {
  background: var(--card-bg);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 16px;
}
.pf-how-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.pf-how ol { padding-left: 18px; }
.pf-how li { font-size: 11px; color: var(--text-75); margin-bottom: 5px; line-height: 1.5; }

/* ===== RESPONSIVE ===== */

/* Tablet */
@media (max-width: 1168px) and (min-width: 861px) {
  .app { width: 100%; height: var(--app-height, 100%); border-radius: 0; }
  .side { width: 280px; padding: 14px; gap: 8px; }
  .cube-track { max-width: 340px; height: 200px; }
  .cube-value { font-size: 38px; }
  .payout-float { font-size: 16px; }
}

/* Phone portrait */
@media (max-width: 860px) {
  .app {
    width: 100% !important;
    height: var(--app-height, 100%) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
  .row {
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .main {
    order: 1;
    flex: 1 !important;
    width: 100% !important;
    overflow: visible !important;
  }
  .game-area {
    flex: 1 !important;
    width: 100% !important;
    min-height: 0 !important;
    gap: 8px !important;
    padding: 12px !important;
  }
  .cube-wrap {
    gap: 0 !important;
    width: 100% !important;
  }
  .cube-track {
    width: 200px !important;
    height: 160px !important;
    border-radius: 12px !important;
  }
  .cube-value { font-size: 32px !important; }
  .side {
    order: 2;
    flex: none !important;
    width: 100% !important;
    border-right: none !important;
    border-top: 1px solid var(--hairline);
    padding: 10px 16px;
    gap: 8px;
  }
  .history-bar { padding: 6px 12px; }
  .payout-float { font-size: 15px; }
  .ripple { width: 120px; height: 120px; }
  .bottom { height: 40px; padding: 0 14px; }

    /* Compact auto panel on mobile */
    .auto-section {
      background: none !important;
      border: none !important;
      padding: 0 !important;
      border-radius: 0 !important;
      margin-bottom: 4px !important;
    }
    .auto-section-label {
      font-size: 9px !important;
      margin-bottom: 4px !important;
    }
    /* Auto bet + start joined row */
    .auto-bet-row {
      display: flex !important;
      flex-direction: row !important;
      gap: 0 !important;
      align-items: center !important;
      margin-bottom: 6px !important;
    }
    .auto-bet-row .input-row {
      flex: 1 !important;
      min-width: 0 !important;
      border-radius: 10px 0 0 10px !important;
    }
    .auto-bet-row .auto-start-btn,
    .auto-bet-row .stop-btn {
      width: auto !important;
      min-width: 80px !important;
      height: 40px !important;
      font-size: 11px !important;
      padding: 0 12px !important;
      border-radius: 0 10px 10px 0 !important;
      box-shadow: none !important;
    }
    /* Compact auto rows */
    .auto-row {
      gap: 6px !important;
    }
    .auto-row .auto-input {
      height: 44px !important;
      font-size: 14px !important;
      width: 100% !important;
      flex: none !important;
      border: 1px solid #272859 !important;
      border-radius: 10px !important;
      background: #23204E !important;
      padding: 0 12px !important;
    }
    /* ── Auto panel compact (match RPS) ── */
    .tab-panel {
      display: flex !important;
      flex-direction: column !important;
      gap: 6px !important;
    }
    /* Strip ALL containers */
    .tab-panel .field,
    .tab-panel .auto-section,
    .tab-panel .side-stats,
    .tab-panel .side-stats .stat-box {
      background: none !important;
      border: none !important;
      padding: 0 !important;
      margin: 0 !important;
      border-radius: 0 !important;
    }
    /* All labels: tiny, uppercase */
    .tab-panel .label,
    .tab-panel .stat-label {
      font-size: 9px !important;
      text-transform: uppercase !important;
      letter-spacing: 0.06em !important;
      margin-bottom: 2px !important;
    }
    /* Hide "Auto Settings" label */
    .tab-panel .auto-section-label {
      display: none !important;
    }
    /* Rounds row: stack vertically */
    .tab-panel .auto-row {
      flex-direction: column !important;
      align-items: stretch !important;
      gap: 2px !important;
    }
    /* Rounds input: match target multiplier style */
    .tab-panel .auto-input {
      height: 44px !important;
      font-size: 14px !important;
      border: 1px solid #272859 !important;
      border-radius: 10px !important;
      background: #23204E !important;
      color: #fff !important;
      padding: 0 12px !important;
    }
    /* Win chance to bottom */
    .tab-panel .side-stats {
      display: none !important;
    }
    /* Hide sidebar progress bar on mobile (using top bar instead) */
    .auto-progress-bar-wrap {
      display: none !important;
    }
    /* Target input compact */
    .tab-panel .input-row.target-input {
      height: 36px !important;
    }
    /* Fix button/input jumping */
    .auto-bet-row .auto-start-btn,
    .auto-bet-row .stop-btn,
    .bet-compact-row .place-btn {
      min-height: 40px !important;
      max-height: 40px !important;
      min-width: 80px !important;
    }
    .bet-compact-row .input-row,
    .auto-bet-row .input-row {
      min-height: 40px !important;
      max-height: 40px !important;
    }
}

/* Small phones */
@media (max-width: 480px) {
  .game-area { height: 220px !important; padding: 10px !important; }
  .cube-track { width: 200px !important; height: 130px !important; border-radius: 10px !important; }
  .cube-value { font-size: 26px; }
  .place-btn { height: 44px; font-size: 13px; }
  .header { padding: 0 10px; height: 44px; }
  .header-left .game-name span:last-child { display: none; }
  .header-balance { padding: 4px 10px 4px 8px; }
  .header-bal-value { font-size: 12px; }
  .fairplay { font-size: 0; padding: 6px 8px; gap: 0; }
  .fairplay::before { width: 12px; height: 14px; }
  .header-right .info { width: 26px; height: 26px; font-size: 10px; }
  .history-bar { padding: 5px 10px; gap: 4px; }
  .history-chip { padding: 3px 8px; font-size: 10px; }
  .side { padding: 8px 12px; gap: 6px; }
  .input-row { height: 40px; }
  .mode-toggle button { height: 32px; font-size: 11px; }
  .payout-float { font-size: 13px; }
  .ripple { width: 100px; height: 100px; }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) and (min-width: 500px) {
  .app { width: 100%; height: var(--app-height, 100%); border-radius: 0; }
  .header { height: 32px; padding: 0 10px; }
  .header-left .game-name { font-size: 11px; }
  .header-left .game-name span:last-child { display: none; }
  .header-balance { padding: 2px 8px 2px 6px; }
  .header-bal-value { font-size: 10px; }
  .fairplay { font-size: 0; padding: 3px 5px; gap: 0; }
  .fairplay::before { width: 9px; height: 11px; }
  .header-right .info { width: 22px; height: 22px; font-size: 9px; }
  .row {
    flex-direction: row;
    overflow: hidden;
  }
  .main { order: 1; }
  .side {
    order: 0;
    width: 260px;
    flex: 0 0 260px;
    border-right: 1px solid var(--hairline);
    border-top: none;
    padding: 8px 10px;
    gap: 6px;
    overflow-y: auto;
  }
  .game-area { padding: 8px; gap: 8px; }
  .cube-track { width: min(95%, 340px); height: 160px; border-radius: 10px; }
  .cube-value { font-size: 28px; }
  .history-bar { padding: 4px 10px; }
  .history-chip { padding: 2px 6px; font-size: 9px; }
  .input-row { height: 36px; }
  .input-row input { font-size: 13px; }
  .place-btn { height: 36px; font-size: 12px; }
  .mode-toggle button { height: 28px; font-size: 10px; }
  .auto-start-btn, .stop-btn { height: 34px; font-size: 11px; }
  .bottom { height: 28px; padding: 0 8px; }
  .payout-float { font-size: 13px; }
}

/* ===== FREE BET ===== */

/* Mobile: compact free bet */
@media (max-width: 860px) {
  .free-bet-banner { padding: 8px 10px; margin-bottom: 8px; border-radius: 8px; }
  .free-bet-title { font-size: 11px; }
  .free-bet-count { font-size: 10px; }
  .free-bet-progress { margin-top: 4px; }
}
@media (max-width: 480px) {
  .free-bet-banner { padding: 6px 8px; margin-bottom: 6px; gap: 6px; }
  .free-bet-icon { font-size: 16px; }
  .free-bet-title { font-size: 10px; }
  .free-bet-count { font-size: 9px; }
}

.free-bet-banner {
  background: linear-gradient(135deg, rgba(247,147,26,0.15) 0%, rgba(247,147,26,0.05) 100%);
  border: 1px solid rgba(247,147,26,0.35);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.free-bet-icon { font-size: 20px; }
.free-bet-info { flex: 1; }
.free-bet-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.free-bet-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-mid);
  margin-top: 2px;
}
.free-bet-progress {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
.free-bet-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.place-btn.free-mode {
  background: linear-gradient(135deg, #F7931A 0%, #E67A00 100%);
  animation: freeBetPulse 2s ease-in-out infinite;
}
@keyframes freeBetPulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(247,147,26,0.30), inset 0 1px 0 rgba(255,255,255,0.2); }
  50% { box-shadow: 0 8px 32px rgba(247,147,26,0.50), inset 0 1px 0 rgba(255,255,255,0.2); }
}
.input-row.locked {
  opacity: 0.6;
  pointer-events: none;
  border-color: rgba(247,147,26,0.3);
}

/* Free bet summary */
.free-bet-summary { text-align: center; max-width: 360px; }
.fbs-icon { font-size: 48px; margin-bottom: 8px; }
.free-bet-summary h2 { margin-bottom: 16px; }
.fbs-stats { display: flex; gap: 8px; margin-bottom: 16px; }
.fbs-stat { flex: 1; background: var(--card-bg); border: 1px solid var(--hairline); border-radius: 10px; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; }
.fbs-stat-label { font-size: 9px; font-weight: 600; color: var(--text-dimmer); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.fbs-stat-val { font-size: 15px; font-weight: 800; }
.fbs-stat-val.accent { color: var(--accent); }
.fbs-winnings { display: flex; flex-direction: column; align-items: center; padding: 16px; background: linear-gradient(135deg, rgba(247,147,26,0.12) 0%, rgba(247,147,26,0.04) 100%); border: 1px solid rgba(247,147,26,0.3); border-radius: 12px; }
.fbs-winnings-label { font-size: 11px; font-weight: 600; color: var(--text-mid); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.fbs-winnings-val { font-size: 28px; font-weight: 800; color: var(--accent); }
.fbs-btn {
  display: block;
  width: 100%;
  height: 50px;
  margin-top: 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #F7931A 0%, #E67A00 100%);
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  box-shadow: 0 4px 16px rgba(247,147,26,0.30), inset 0 1px 0 rgba(255,255,255,0.2);
  transition: all 0.2s;
}
.fbs-btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 24px rgba(247,147,26,0.40), inset 0 1px 0 rgba(255,255,255,0.2);
  transform: translateY(-1px);
}

/* Free bet welcome modal */
.free-bet-welcome { text-align: center; max-width: 360px; }
.fbw-icon { font-size: 56px; margin-bottom: 12px; animation: fbwBounce 0.6s ease-out; }
@keyframes fbwBounce { 0% { transform: scale(0); opacity: 0; } 50% { transform: scale(1.2); } 100% { transform: scale(1); opacity: 1; } }
.fbw-desc { font-size: 13px; color: var(--text-75); line-height: 1.6; margin-bottom: 16px; }
.fbw-count { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px; background: linear-gradient(135deg, rgba(247,147,26,0.12) 0%, rgba(247,147,26,0.04) 100%); border: 1px solid rgba(247,147,26,0.3); border-radius: 12px; }
.fbw-count-num { font-size: 40px; font-weight: 800; color: var(--accent); line-height: 1; }
.fbw-count-label { font-size: 13px; font-weight: 700; color: var(--text-mid); text-transform: uppercase; letter-spacing: 0.06em; }
.fbw-btn {
  display: block;
  width: 100%;
  height: 50px;
  margin-top: 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #F7931A 0%, #E67A00 100%);
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  box-shadow: 0 4px 16px rgba(247,147,26,0.30), inset 0 1px 0 rgba(255,255,255,0.2);
  transition: all 0.2s;
  animation: freeBetPulse 2s ease-in-out infinite;
}
.fbw-btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 24px rgba(247,147,26,0.40), inset 0 1px 0 rgba(255,255,255,0.2);
  transform: translateY(-1px);
}

/* ── Loading Screen ── */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg, #120D24);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.loading-logo { width: 80px; height: auto; }
.loading-bar-wrap {
  width: 160px; height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px; overflow: hidden; margin-top: 8px;
}
.loading-bar {
  width: 100%; height: 100%;
  background: #F7931A; border-radius: 3px;
  animation: loading-fill 2.5s ease forwards;
}
@keyframes loading-fill { 0% { width: 0%; } 100% { width: 100%; } }
.loading-text {
  font-size: 11px; color: rgba(255,255,255,0.35); margin-top: 4px;
}

/* ── Short viewport portrait (≤500px height) — fit everything on one screen ── */
@media (max-height: 500px) and (orientation: portrait) {
  .header { height: 36px; padding: 0 10px; }
  .header-left .game-name { font-size: 11px; }
  .header-left .game-name span:last-child { display: none; }
  .header-balance { padding: 2px 8px 2px 6px; }
  .header-bal-value { font-size: 10px; }
  .header-bal-icon { font-size: 10px; width: 16px; height: 16px; }
  .fairplay { font-size: 0; padding: 4px 6px; gap: 0; }
  .fairplay::before { width: 10px; height: 12px; }
  .info { width: 24px; height: 24px; font-size: 9px; }
  .history-bar { padding: 3px 8px; gap: 3px; }
  .history-chip { padding: 2px 6px; font-size: 9px; }
  .game-area { padding: 6px !important; gap: 4px !important; }
  .cube-track { width: 160px !important; height: 100px !important; border-radius: 8px !important; }
  .cube-value { font-size: 22px !important; }
  .side { padding: 6px 10px !important; gap: 4px !important; }
  .bottom { height: 28px; padding: 0 8px; }
  .bottom-logo { font-size: 10px; }
  .payout-float { font-size: 12px; }
  .ripple { width: 80px; height: 80px; }
  .bg-ambient { display: none; }
  .auto-section { padding: 6px !important; }
  .auto-input { height: 30px !important; font-size: 11px !important; }
  .auto-start-btn, .stop-btn { height: 32px !important; font-size: 10px !important; }
}

/* ── Desktop: hide mobile-only elements, reset compact row ── */
@media (min-width: 861px) {
  .mobile-auto-progress { display: none !important; }
  .bet-compact-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }
  .bet-compact-row .place-btn {
    width: 100% !important;
    border-radius: 10px !important;
    min-width: unset !important;
  }
  .bet-compact-row .input-row {
    border-radius: 10px !important;
  }
}
