/* Dice game — vanilla DOM, no framework, no iframe.
   Mounted into #dice-game in the outer SEO shell.
   Visual parity with lib/dice_game/* (Flutter). */

#dice-game {
  --panel-bg: #1C1C1D;
  --panel-radius: 10px;
  --text-muted: #8C8C91;
  --text-yellow: #FFCC00;
  --track-active: #35C759;
  --track-inactive: #FF3B31;
  --win: #35C759;
  --lose: #FF3B31;
  --grey: #8E8E92;

  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Inner column — matches Flutter ConstrainedBox(maxWidth: 560).
   On wider viewports (>500px) leave more breathing room at the top so
   the game content sits visually centered under the SEO shell header. */
#dice-game .dx-inner {
  width: 100%;
  max-width: 560px;
  padding: 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
@media (min-width: 501px) {
  #dice-game .dx-inner { padding-top: 48px; }
}

/* ============== Sound button (lives in the auto-bet row) ============== */
#dice-game .dx-sound-btn {
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.15s, transform 0.1s;
}
#dice-game .dx-sound-btn:hover { background: rgba(255,255,255,0.06); }
#dice-game .dx-sound-btn:active { transform: scale(0.94); }
#dice-game .dx-sound-btn svg { width: 24px; height: 24px; fill: currentColor; }

/* ============== Result panel (center number + win/lose text) ============== */
#dice-game .dx-result {
  width: 100%;
  border-radius: var(--panel-radius);
  background: var(--panel-bg);
  padding: 30px 8px;
  box-sizing: border-box;
  border: 4px solid transparent;
  transition: border-color 0.25s ease;
  text-align: center;
}
#dice-game .dx-result.win { border-color: var(--text-yellow); }
#dice-game .dx-result-number {
  font-size: 60px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-yellow);
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}
#dice-game .dx-result-text {
  font-size: 20px;
  font-weight: 700;
  min-height: 22px;
  letter-spacing: 0.3px;
}
#dice-game .dx-result-text.win    { color: var(--win); }
#dice-game .dx-result-text.lose   { color: var(--lose); }
#dice-game .dx-result-text.rolling{ color: var(--grey); }

/* Compact for short viewports */
@media (max-height: 750px) {
  #dice-game .dx-result { padding: 12px 8px; }
  #dice-game .dx-result-number { font-size: 48px; }
  #dice-game .dx-result-text { font-size: 16px; }
}

/* ============== History row ============== */
#dice-game .dx-history {
  width: 100%;
  padding: 0 8px;
  box-sizing: border-box;
  height: 30px;
  position: relative;
  overflow: hidden;
}
/* 10 equal columns — every cell is centered inside its slot, so the
   ten cells are always evenly distributed across the available width
   regardless of container size. */
#dice-game .dx-history-track {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  align-items: center;
  justify-items: center;
  height: 100%;
  position: relative;
  width: 100%;
}
#dice-game .dx-hist-cell {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  transition: transform 0.4s ease;
}
#dice-game .dx-hist-cell.win  { background: rgba(53, 199, 89, 0.15); color: var(--win); }
#dice-game .dx-hist-cell.lose { background: rgba(255, 59, 49, 0.15); color: var(--lose); }
#dice-game .dx-hist-cell.enter {
  animation: dx-hist-enter 0.4s cubic-bezier(0, 0, 0.2, 1);
}
@keyframes dx-hist-enter {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
#dice-game .dx-hist-cell.shifting {
  transform: translateX(calc(-1 * (24px + var(--spacer)) ));
}
#dice-game .dx-hist-ghost {
  position: absolute;
  pointer-events: none;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.7s cubic-bezier(.4,0,.2,1), opacity 0.7s ease-in-out;
}
#dice-game .dx-hist-ghost.win  { background: rgba(53, 199, 89, 0.15); color: var(--win); }
#dice-game .dx-hist-ghost.lose { background: rgba(255, 59, 49, 0.15); color: var(--lose); }

/* ============== Odds + Probability row ============== */
#dice-game .dx-odds {
  width: 100%;
  background: var(--panel-bg);
  border-radius: var(--panel-radius);
  padding: 15px 20px;
  box-sizing: border-box;
}
#dice-game .dx-odds-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#dice-game .dx-odds-label {
  font-size: 12px;
  color: var(--text-muted);
}
#dice-game .dx-odds-value {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

/* ============== Slider ============== */
#dice-game .dx-slider-wrap {
  width: 100%;
  background: var(--panel-bg);
  border-radius: var(--panel-radius);
  padding: 30px 8px 15px;
  box-sizing: border-box;
}
/* Track layout — Flutter parity (slider_track_shape.dart):
     The painted bar spans the full track width.
     The thumb's CENTER moves between [thumb-r, trackW - thumb-r], i.e.
     it stays inset from both edges by one thumb radius — so the thumb
     circle never overflows the bar.
     Green/red boundary lines up with the thumb because both --pct and the
     native thumb use the same fraction (value - min)/(max - min). */
#dice-game .dx-slider-track {
  position: relative;
  height: 60px;
  /* Flutter parity: thumb radius = 20 (slider_track_shape.dart:25 thumbRadius)
     but Flutter draws semi-transparent thumb on a 25px track, so visually
     the thumb hugs the bar. We use a 32px thumb (radius 16) so the white
     circle sits centered on the 25px bar without dwarfing it. */
  --thumb-r: 16px;
  --thumb-d: 32px;
  padding: 0 var(--thumb-r);
  box-sizing: border-box;
}
/* Painted bar fills the whole track width (full extent, like Flutter's
   trackLeft..trackRight in the CustomPainter). */
#dice-game .dx-slider-bar {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 25px;
  transform: translateY(-50%);
  border-radius: 12.5px;
  background: linear-gradient(to right,
    var(--track-active) 0%,
    var(--track-active) calc(var(--pct, 50) * 1%),
    var(--track-inactive) calc(var(--pct, 50) * 1%),
    var(--track-inactive) 100%);
  z-index: 0;
  pointer-events: none;
}
/* Native input occupies the full track and lets thumb sweep edge-to-edge.
   Browsers render the thumb so its CENTER aligns to the value fraction,
   which lands exactly on the same percentage of the bar. */
#dice-game .dx-slider-input {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  height: var(--thumb-d);
  background: transparent;
  outline: none;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  cursor: pointer;
  z-index: 2;
  touch-action: none;
}
#dice-game .dx-slider-input:disabled { cursor: not-allowed; }

/* Random pointer — Flutter parity (slider_track_shape.dart:252-253):
   `randomValue / 100 * totalTrackWidth`. Uses the bar's coordinate system
   (left:0..right:0 inside the padded track), so 0%..100% lines up with
   the bar 0%..100%. */
#dice-game .dx-slider-pointer {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 25px;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 1;
  opacity: var(--rand-opacity, 1);
  transition: opacity 0.2s ease;
}
#dice-game .dx-slider-pointer-inner {
  position: absolute;
  top: 0;
  left: calc(var(--rand-pct, 0) * 1%);
  width: 0;
  height: 100%;
  transition: left 0.08s linear;
}
#dice-game .dx-pointer-line {
  position: absolute;
  width: 2px;
  height: 35px;
  background: #fff;
  left: 0;
  top: -5px;
  box-shadow: 0 0 4px rgba(0,0,0,0.4);
}
#dice-game .dx-pointer-icon {
  position: absolute;
  width: 24px;
  height: 24px;
  left: -12px;
  top: -32px;
  background: url('./assets/dice.png') center/contain no-repeat;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
}

/* Custom thumb (white circle) — center-aligns to the painted bar */
#dice-game .dx-slider-input::-webkit-slider-runnable-track {
  height: 25px;
  background: transparent;
  border-radius: 12.5px;
}
#dice-game .dx-slider-input::-moz-range-track {
  height: 25px;
  background: transparent;
  border-radius: 12.5px;
}
/* Thumb — Flutter parity (slider_track_shape.dart:161-162):
   Color.fromRGBO(255, 255, 255, 0.8) — semi-transparent white so the
   green/red bar shows through where the thumb overlaps it. */
#dice-game .dx-slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  border: 0;
  margin-top: -3.5px; /* center the 32px thumb on the 25px painted bar */
  cursor: grab;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: transform 0.1s;
}
#dice-game .dx-slider-input::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.05); }
#dice-game .dx-slider-input::-moz-range-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  border: 0;
  cursor: grab;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Tick labels under track — same horizontal extent as the painted bar.
   Track has padding-x = thumb-r (16px) so ticks must also be inset by
   that amount to line up with bar's 0%..100%. */
#dice-game .dx-slider-ticks {
  position: relative;
  height: 16px;
  margin: 4px 16px 0;
}
#dice-game .dx-tick {
  position: absolute;
  top: 0;
  font-size: 14px;
  color: var(--text-muted);
  transform: translateX(-50%);
  font-variant-numeric: tabular-nums;
}
#dice-game .dx-tick[data-v="0"]   { transform: translateX(0); }
#dice-game .dx-tick[data-v="100"] { transform: translateX(-100%); }

/* ============== Action row (Bet | Credits | Play) — tower-style ==============
   Mirrors web/games/tower/play/tower.css .tw-actions / .tw-bet / .tw-balance / .tw-launch. */
#dice-game .dx-actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin: 0;
  align-items: stretch;
}
#dice-game .dx-actions > * { min-width: 0; }

/* Bet stepper — segmented "− BET 10 +" with linear gradient + inset highlights */
#dice-game .dx-bet {
  height: 45px;
  background: linear-gradient(180deg, #1d1d2e 0%, #15151f 100%);
  border-radius: 12px;
  padding: 0 6px;
  display: grid;
  grid-template-columns: 22px 1fr 22px;
  align-items: center;
  gap: 4px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.04),
    inset 0 -1px 0 rgba(0,0,0,.4),
    0 1px 0 rgba(255,255,255,.03);
}
#dice-game .dx-bet-btn {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  padding: 0;
  line-height: 0;
  border: 0;
  cursor: pointer;
  transition: transform 100ms ease, filter 120ms ease;
  -webkit-tap-highlight-color: transparent;
}
#dice-game .dx-bet-btn svg {
  width: 16px; height: 16px;
  fill: #1a1a1a;
  display: block;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,.18));
}
#dice-game .dx-bet-btn--down {
  background: radial-gradient(circle at 30% 30%, #ff6b6b, #c93a3a);
  box-shadow: 0 2px 6px rgba(201,58,58,.45), inset 0 1px 0 rgba(255,255,255,.35);
}
#dice-game .dx-bet-btn--up {
  background: radial-gradient(circle at 30% 30%, #56dd76, #2fa84a);
  box-shadow: 0 2px 6px rgba(47,168,74,.45), inset 0 1px 0 rgba(255,255,255,.35);
}
#dice-game .dx-bet-btn:not(:disabled):hover  { filter: brightness(1.1); transform: translateY(-1px); }
#dice-game .dx-bet-btn:not(:disabled):active { transform: translateY(1px); filter: brightness(.92); }
/* Disabled: keep full color (per design); just block pointer interaction.
   Re-state the enabled background with !important so the UA's default
   disabled-button styling can't gray the circle out. */
#dice-game .dx-bet-btn--down:disabled {
  background: radial-gradient(circle at 30% 30%, #ff6b6b, #c93a3a) !important;
  box-shadow: 0 2px 6px rgba(201,58,58,.45), inset 0 1px 0 rgba(255,255,255,.35) !important;
  opacity: 1 !important;
  filter: none !important;
  cursor: not-allowed;
}
#dice-game .dx-bet-btn--up:disabled {
  background: radial-gradient(circle at 30% 30%, #56dd76, #2fa84a) !important;
  box-shadow: 0 2px 6px rgba(47,168,74,.45), inset 0 1px 0 rgba(255,255,255,.35) !important;
  opacity: 1 !important;
  filter: none !important;
  cursor: not-allowed;
}
#dice-game .dx-bet-btn:disabled svg { fill: #1a1a1a !important; opacity: 1 !important; }

#dice-game .dx-bet-readout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  gap: 2px;
  min-width: 0;
  padding: 0 4px;
}
#dice-game .dx-bet-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 8px;
  color: #6e6e88;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 600;
}
#dice-game .dx-bet-value {
  font-family: 'Roboto Mono', ui-monospace, monospace;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .3px;
  font-variant-numeric: tabular-nums;
}

/* Credits readout — gold value with subtle glow (tower parity) */
#dice-game .dx-balance {
  height: 45px;
  background: linear-gradient(180deg, #15151f 0%, #1d1d2e 100%);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0 6px;
  gap: 2px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), inset 0 -1px 0 rgba(0,0,0,.4);
}
#dice-game .dx-balance-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 8px;
  color: #6e6e88;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 600;
}
#dice-game .dx-balance-value {
  font-family: 'Roboto Mono', ui-monospace, monospace;
  font-size: 15px;
  font-weight: 700;
  color: #ffd54a;
  text-shadow: 0 0 12px rgba(255,213,74,.25);
  letter-spacing: .3px;
}

/* Launch CTA — green gradient, big outer glow + inner top highlight */
#dice-game .dx-launch { display: flex; }
#dice-game .dx-play {
  position: relative;
  width: 100%;
  height: 45px;
  border: 0;
  border-radius: 12px;
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .8px;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 0 2px 4px rgba(0,0,0,.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 6px;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 200ms ease;
  background: linear-gradient(180deg, #2bd957 0%, #16a23a 100%);
  box-shadow:
    0 4px 14px rgba(43,217,87,.45),
    0 0 24px rgba(43,217,87,.18),
    inset 0 1px 0 rgba(255,255,255,.35),
    inset 0 -2px 0 rgba(0,0,0,.2);
  -webkit-tap-highlight-color: transparent;
}
#dice-game .dx-play::before {
  content: '';
  position: absolute;
  inset: 1px 1px auto 1px;
  height: 45%;
  border-radius: 11px 11px 50% 50% / 11px 11px 100% 100%;
  background: linear-gradient(180deg, rgba(255,255,255,.3), rgba(255,255,255,0));
  pointer-events: none;
}
#dice-game .dx-play:not(:disabled):hover  { filter: brightness(1.08); }
#dice-game .dx-play:not(:disabled):active { transform: translateY(1px); filter: brightness(.95); }
#dice-game .dx-play[disabled] {
  cursor: not-allowed;
  background: linear-gradient(180deg, #6e6e72 0%, #4a4a4e 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), inset 0 -1px 0 rgba(0,0,0,.3);
  color: rgba(255,255,255,.6);
}
#dice-game .dx-play[disabled]::before { display: none; }

/* Narrow viewport: shrink stepper buttons (tower parity) */
@media (max-width: 480px) {
  #dice-game .dx-actions { gap: 8px; }
  #dice-game .dx-bet { grid-template-columns: 16px 1fr 16px; }
  #dice-game .dx-bet-btn { width: 18px; height: 18px; }
  #dice-game .dx-bet-btn svg { width: 12px; height: 12px; }
  #dice-game .dx-bet-value,
  #dice-game .dx-balance-value { font-size: 13px; }
  #dice-game .dx-play { font-size: 12px; letter-spacing: .4px; }
}

/* ============== Auto bet row (Auto Bet + switch on left, sound on right) ============== */
/* Pulled up tight against the action row by overriding the .dx-inner gap */
#dice-game .dx-auto-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: -10px;
}
#dice-game .dx-auto-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
#dice-game .dx-auto-label {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.2px;
}
#dice-game .dx-auto-count { color: #FFEB3B; font-weight: 700; margin-left: 4px; }
#dice-game .dx-auto-switch {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 13px;
  background: #1B1B2C;
  cursor: pointer;
  transition: background 0.2s;
  border: 0;
  padding: 0;
}
#dice-game .dx-auto-switch[data-on="1"] { background: #2da046; }
#dice-game .dx-auto-switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.2s ease;
}
#dice-game .dx-auto-switch[data-on="1"]::after { left: 23px; }

/* ============== Modal (auto times picker + insufficient balance) ============== */
.dx-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: dx-fade-in 0.2s ease;
}
@keyframes dx-fade-in { from { opacity: 0; } to { opacity: 1; } }
.dx-modal {
  background: #1F1F22;
  color: #fff;
  border-radius: 14px;
  padding: 20px 18px;
  min-width: 240px;
  max-width: 320px;
  width: 80%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: dx-modal-pop 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes dx-modal-pop {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.dx-modal-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 12px;
  text-align: center;
}
.dx-modal-msg {
  font-size: 13px;
  color: #ddd;
  text-align: center;
  margin: 0 0 16px;
}
.dx-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.dx-modal-btn {
  background: var(--win, #35C759);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.dx-modal-btn--ghost { background: #3A3A3F; }
.dx-modal-btn:hover { filter: brightness(1.1); }

/* ============== Sound settings dialog — ported from keno (.kn-ss-*) ============== */
.dx-ss-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  animation: dx-ss-mask-in 180ms ease;
  font-family: 'Inter', system-ui, sans-serif;
}
@keyframes dx-ss-mask-in { from { opacity: 0; } to { opacity: 1; } }
.dx-ss-dialog {
  width: 340px;
  max-width: 100%;
  background: #1A2332;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  overflow: hidden;
  color: #fff;
  animation: dx-ss-dialog-in 220ms cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
@keyframes dx-ss-dialog-in {
  from { opacity: 0; transform: scale(0.94) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.dx-ss-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.dx-ss-title { color: rgba(255,255,255,.75); font-size: 14px; font-weight: 700; letter-spacing: 1.5px; }
.dx-ss-close {
  background: transparent; border: 0;
  color: rgba(255,255,255,.4);
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  border-radius: 4px;
  transition: color .15s, background .15s;
}
.dx-ss-close:hover { color: #fff; background: rgba(255,255,255,.08); }
.dx-ss-row {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  gap: 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.dx-ss-row:last-child { border-bottom: none; }
.dx-ss-label { flex: 0 0 40%; color: rgba(255,255,255,.6); font-size: 15px; }
.dx-ss-switch {
  position: relative;
  display: inline-block;
  margin-left: auto;
  cursor: pointer;
}
.dx-ss-switch input {
  appearance: none;
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0; height: 0;
}
.dx-ss-switch-track {
  display: inline-block;
  width: 44px; height: 24px;
  border-radius: 12px;
  background: rgba(255,255,255,.12);
  transition: background .2s;
  position: relative;
}
.dx-ss-switch-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(255,255,255,.7);
  transition: transform .2s, background .2s;
}
.dx-ss-switch input:checked + .dx-ss-switch-track { background: rgba(74,158,255,.4); }
.dx-ss-switch input:checked + .dx-ss-switch-track .dx-ss-switch-thumb {
  transform: translateX(20px);
  background: #4A9EFF;
}
input.dx-ss-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right,
    #4A9EFF 0%, #4A9EFF var(--fill, 100%),
    rgba(255,255,255,.12) var(--fill, 100%), rgba(255,255,255,.12) 100%);
  outline: none;
  cursor: pointer;
}
input.dx-ss-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.5);
  cursor: pointer;
}
input.dx-ss-slider::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.5);
  cursor: pointer;
}

/* Ad slot (mirrors flutter version when isAds true — kept hidden by default) */
#dice-game .dx-ad-slot {
  display: none;
}

/* ============== Auto Times dialog — ported from keno (.kn-auto-modal-*) ============== */
.dx-modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  pointer-events: auto;
  font-family: 'Inter', system-ui, sans-serif;
}
.dx-auto-modal {
  width: min(360px, 92%);
  padding: 26px 16px 18px;
  background: #17173A;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 22px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(178, 111, 255, 0.12) inset;
  font-family: 'Inter', system-ui, sans-serif;
  animation: dx-auto-modal-in 240ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes dx-auto-modal-in {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.dx-auto-modal-title {
  margin: 0 0 22px;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  color: #FFE94A;
  letter-spacing: 0.3px;
  text-shadow: 0 2px 8px rgba(255, 233, 74, 0.25);
}
.dx-auto-modal-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}
.dx-auto-modal-opt {
  position: relative;
  width: 100%;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(90deg, #B26FFF 0%, #E58CB6 50%, #FFC466 100%);
  color: #fff;
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  box-shadow:
    0 4px 12px rgba(178, 111, 255, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -2px 6px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}
.dx-auto-modal-opt::before {
  content: '';
  position: absolute;
  inset: 1px 1px auto 1px;
  height: 45%;
  border-radius: 13px 13px 50% 50% / 13px 13px 100% 100%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.dx-auto-modal-opt:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow:
    0 8px 18px rgba(178, 111, 255, 0.38),
    0 0 0 1px rgba(255, 196, 102, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -2px 6px rgba(0, 0, 0, 0.18);
}
.dx-auto-modal-opt:active {
  transform: translateY(1px);
  filter: brightness(0.96);
  box-shadow:
    0 2px 6px rgba(178, 111, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 3px rgba(0, 0, 0, 0.18);
}
.dx-auto-modal-num {
  position: relative;
  font-variant-numeric: tabular-nums;
}
.dx-auto-modal-suffix {
  position: relative;
  margin-left: 6px;
  font-weight: 600;
  opacity: 0.92;
}
.dx-auto-modal-cancel {
  width: 100%;
  height: 42px;
  background: #283151;
  color: #fff;
  border: 0;
  font-size: 15px;
  font-weight: 600;
  border-radius: 14px;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: background 140ms ease, transform 100ms ease;
}
.dx-auto-modal-cancel:hover  { background: #34406d; }
.dx-auto-modal-cancel:active { transform: translateY(1px); }
