.dice-main {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(20px, 5vh, 56px) 20px 80px;
}

.dice-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
}

/* ── Header ── */
.dice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.dice-balance {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dice-balance-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.dice-balance-value {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: -0.5px;
  transition: color 0.25s;
}
.dice-balance-value.flash-win  { color: var(--green); }
.dice-balance-value.flash-lose { color: var(--red); }
.dice-header-actions { display: flex; gap: 8px; }

/* Daily claim button */
.dice-claim {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s, transform 0.12s;
}
.dice-claim:not(:disabled) {
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(124, 109, 250, 0.3);
}
.dice-claim:not(:disabled):hover  { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(124, 109, 250, 0.45); }
.dice-claim:not(:disabled):active { transform: translateY(1px); }
.dice-claim:disabled { cursor: not-allowed; opacity: 0.75; }
.dice-claim-icon { font-size: 1rem; line-height: 1; }
.dice-claim-text { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.2px; }

/* ── Main grid ── */
.dice-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 0;
}
.dice-board {
  padding: 28px 28px 36px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.dice-controls {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--surface);
}

/* ── History ── */
.dice-history {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 28px;
}
.dice-chip {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  transition: transform 0.18s, opacity 0.18s;
  animation: chipIn 0.25s ease-out;
}
.dice-chip.win  { color: var(--green); border-color: rgba(52, 211, 153, 0.4); }
.dice-chip.lose { color: var(--red);   border-color: rgba(248, 113, 113, 0.4); }
@keyframes chipIn {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ── Roll display ── */
.dice-roll-display {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0;
}
.dice-roll-num {
  font-family: var(--mono);
  font-size: clamp(3rem, 8vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -2px;
  color: var(--text);
  line-height: 1;
  transition: color 0.3s, transform 0.3s;
}
.dice-roll-num.win  { color: var(--green); transform: scale(1.04); }
.dice-roll-num.lose { color: var(--red); }
.dice-roll-sub {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-height: 1.1em;
}

/* ── Slider ── */
.dice-slider-wrap {
  padding: 18px 8px 8px;
}
.dice-slider {
  position: relative;
  height: 60px;
  user-select: none;
  touch-action: none;
}
.dice-track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 14px;
  transform: translateY(-50%);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
}
.dice-fill-lose,
.dice-fill-win {
  height: 100%;
  transition: width 0.18s ease, background 0.18s;
}
.dice-fill-lose { background: linear-gradient(90deg, #ef4444, #f87171); }
.dice-fill-win  { background: linear-gradient(90deg, #34d399, #10b981); }

.dice-ticks {
  position: absolute;
  top: calc(50% + 14px);
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  padding-top: 8px;
}

.dice-handle {
  position: absolute;
  top: 50%;
  width: 8px;
  height: 36px;
  background: var(--text);
  border-radius: 4px;
  transform: translate(-50%, -50%);
  cursor: grab;
  box-shadow: 0 0 12px rgba(124, 109, 250, 0.4), 0 2px 6px rgba(0, 0, 0, 0.4);
  z-index: 3;
  transition: box-shadow 0.18s;
}
.dice-handle:hover { box-shadow: 0 0 18px rgba(124, 109, 250, 0.7), 0 2px 6px rgba(0, 0, 0, 0.4); }
.dice-handle:active { cursor: grabbing; }
.dice-handle-grip {
  position: absolute;
  inset: 8px 2px;
  background: repeating-linear-gradient(180deg, var(--bg) 0 2px, transparent 2px 4px);
  border-radius: 2px;
  opacity: 0.5;
}
.dice-handle-value {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
}

.dice-marker {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent2);
  border: 2px solid var(--surface);
  transform: translate(-50%, -50%) scale(0);
  box-shadow: 0 0 14px rgba(167, 139, 250, 0.6);
  z-index: 2;
  transition: left 0.4s cubic-bezier(0.34, 1.4, 0.64, 1), transform 0.25s ease, background 0.25s;
  opacity: 0;
}
.dice-marker.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.dice-marker.win  { background: var(--green); box-shadow: 0 0 18px rgba(52, 211, 153, 0.7); }
.dice-marker.lose { background: var(--red);   box-shadow: 0 0 18px rgba(248, 113, 113, 0.7); }

/* ── Controls ── */
.dice-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dice-field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 500;
}
.dice-field-quick {
  display: flex;
  gap: 4px;
}
.dice-field-quick button {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
  text-transform: lowercase;
}
.dice-field-quick button:hover { color: var(--text); border-color: var(--accent); }

.dice-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.18s;
}
.dice-input-wrap:focus-within { border-color: var(--accent); }
.dice-input-wrap input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 14px;
  width: 100%;
  -moz-appearance: textfield;
}
.dice-input-wrap input::-webkit-outer-spin-button,
.dice-input-wrap input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.dice-input-prefix,
.dice-input-suffix {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.95rem;
  padding: 0 12px;
}
.dice-input-prefix { border-right: 1px solid var(--border); padding-right: 10px; }
.dice-input-suffix { border-left:  1px solid var(--border); padding-left:  10px; }

.dice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.dice-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  padding: 3px;
  gap: 3px;
}
.dice-mode-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 9px 0;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.dice-mode-btn:hover { color: var(--text); }
.dice-mode-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset;
}

.dice-profit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.dice-profit-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 500;
}
.dice-profit-value {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--green);
}

.dice-roll-btn {
  margin-top: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  border: 0;
  border-radius: 12px;
  padding: 16px;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--sans);
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: transform 0.12s, box-shadow 0.18s, opacity 0.18s;
  box-shadow: 0 6px 20px rgba(124, 109, 250, 0.35);
}
.dice-roll-btn:hover  { transform: translateY(-1px); box-shadow: 0 8px 26px rgba(124, 109, 250, 0.5); }
.dice-roll-btn:active { transform: translateY(1px); }
.dice-roll-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Light theme tweaks */
[data-theme="light"] .dice-handle {
  background: var(--text);
  box-shadow: 0 0 10px rgba(91, 78, 232, 0.3), 0 2px 6px rgba(0, 0, 0, 0.15);
}
[data-theme="light"] .dice-handle-grip { background: repeating-linear-gradient(180deg, #ffffff 0 2px, transparent 2px 4px); }
[data-theme="light"] .dice-roll-btn { box-shadow: 0 4px 14px rgba(91, 78, 232, 0.25); }

/* Mobile */
@media (max-width: 760px) {
  .dice-grid { grid-template-columns: 1fr; }
  .dice-board { border-right: 0; border-bottom: 1px solid var(--border); padding: 24px 18px 30px; }
  .dice-controls { padding: 20px 18px; }
  .dice-balance-value { font-size: 1.3rem; }
  .dice-roll-num { font-size: 3.2rem; }
}

/* ── Auto-bet button (next to Roll Dice) ── */
.dice-auto-btn {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.12s;
}
.dice-auto-btn:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--surface);
}
.dice-auto-btn:active { transform: translateY(1px); }
.dice-auto-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* When auto is running, the main Roll button becomes a Stop button. */
.dice-roll-btn.auto-running {
  background: linear-gradient(135deg, #dc2626, #f87171);
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.32);
}
.dice-roll-btn.auto-running:hover { box-shadow: 0 8px 22px rgba(220, 38, 38, 0.45); }

/* ── Auto-bet modal ── */
.dice-auto-modal { max-width: 540px; }
.dice-auto-body {
  padding: 18px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dice-auto-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.dice-auto-field { display: flex; flex-direction: column; gap: 4px; }
.dice-auto-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.55px;
  font-weight: 600;
}
.dice-auto-hint { font-size: 0.68rem; color: var(--muted); margin-top: 2px; }

.dice-auto-input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  transition: border-color 0.15s;
}
.dice-auto-input-wrap:focus-within { border-color: var(--accent); }
.dice-auto-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 8px 0;
  outline: none;
  width: 100%;
  -moz-appearance: textfield;
}
.dice-auto-input-wrap input::-webkit-outer-spin-button,
.dice-auto-input-wrap input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.dice-auto-prefix, .dice-auto-suffix {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.85rem;
}
.dice-auto-prefix { margin-right: 5px; }
.dice-auto-suffix { margin-left: 5px; }

.dice-auto-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}
.dice-auto-tab {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 7px 0;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.78rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.dice-auto-tab:hover { color: var(--text); }
.dice-auto-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
}

.dice-auto-strategy {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.dice-auto-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.dice-auto-card-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.dice-auto-card-title.win  { color: var(--green); }
.dice-auto-card-title.loss { color: var(--red);   }
.dice-auto-strategy-body label {
  font-size: 0.68rem;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.dice-auto-actions {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
  margin-top: 6px;
}
.dice-auto-cancel,
.dice-auto-start {
  padding: 12px;
  border-radius: 10px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s, box-shadow 0.18s, border-color 0.15s, color 0.15s;
}
.dice-auto-cancel {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}
.dice-auto-cancel:hover { color: var(--text); border-color: var(--accent); }
.dice-auto-start {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  box-shadow: 0 6px 18px rgba(124, 109, 250, 0.32);
}
.dice-auto-start:hover  { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(124, 109, 250, 0.45); }
.dice-auto-start:active { transform: translateY(1px); }

@media (max-width: 540px) {
  .dice-auto-row, .dice-auto-strategy { grid-template-columns: 1fr; }
}
