
.controls {
  flex: none;
  margin: 4px -16px 0;
  padding: 4px 16px max(5px, calc(var(--safe-bottom) + 5px));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 22%),
    linear-gradient(180deg, #2b3fb0, #182572 35%, #0d1650 70%, #070c34);
  border-top: 1px solid var(--machine-accent);
  box-shadow:
    0 -2px 8px color-mix(in srgb, var(--machine-accent) 40%, transparent),
    inset 0 2px 6px color-mix(in srgb, var(--machine-accent-2) 60%, transparent),
    0 -6px 16px #0008;
}

.bet-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 2fr) 44px;
  align-items: stretch;
  gap: 6px;
  margin-bottom: 4px;
}

.bet {
  position: relative;
  display: flex;
  min-width: 0;
}

.rush-button,
.league-button,
.sheet-close {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.05) 48%, transparent 52%),
    linear-gradient(180deg, #3a7aff, #1a3ab0 60%, #0d1e6a);
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 1px var(--gold-deep), 0 3px 0 #070826, 0 4px 8px rgba(0, 0, 0, 0.5), inset 0 0 6px rgba(120, 180, 255, 0.5);
  color: #fff;
}

.bet-step,
.bet-max,
.controls .deck-button {
  min-width: 44px;
  min-height: 48px;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--machine-accent-2) 50%, #2a66f0);
  border-top: 2px solid var(--machine-accent);
  border-bottom: 2px solid var(--machine-accent-2);
  border-radius: 6px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--machine-accent) 40%, transparent), transparent 42%, #3c06a433 48%),
    linear-gradient(180deg, #5c9eff, #2a66f0 55%, #1a3fc4);
  box-shadow:
    inset 0 1px 3px color-mix(in srgb, var(--machine-accent) 60%, transparent),
    inset 0 -3px 6px #36005a88, 0 3px 0 #160537,
    0 0 7px color-mix(in srgb, var(--machine-accent-2) 55%, transparent);
  color: #fff;
  text-shadow: 0 2px 1px #403276, 0 0 3px #fff8;
}

.bet-step {
  font-size: 1.7rem;
  font-weight: 900;
  line-height: 1;
}

.bet-step:active:not(:disabled),
.bet-max:active:not(:disabled),
.controls .deck-button:active:not(:disabled),
.rush-button:active,
.league-button:active,
.sheet-close:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 1px var(--gold-deep), 0 1px 0 #070826;
}

.bet-max {
  font-family: var(--display);
  font-size: var(--type-key);
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1;
}

.controls .deck-home {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0;
  background:
    linear-gradient(180deg, #ffffff55, transparent 48%),
    linear-gradient(180deg, #da48f5, #9623da 48%, #601190);
}

.controls .deck-home::before { content: none; }

.deck-home svg {
  display: block;
  width: 28px;
  height: 28px;
  margin: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 1px #4a106b);
}

.controls .deck-info {
  font-size: 1.7rem;
  font-style: italic;
  font-weight: 900;
  line-height: 1;
}

.bet-max:disabled,
.bet-step:disabled,
.controls .deck-button:disabled {
  filter: saturate(0.45);
  color: #c1b4e7;
  border-color: #6555b0;
  box-shadow: inset 0 1px 3px #b3baff44, 0 2px 0 #160537;
  text-shadow: none;
  cursor: default;
}

.controls button:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 3px;
}

.bet-value,
.win-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 44px;
  padding: 1px 7px;
  border-radius: 6px;
  background:
    linear-gradient(180deg, #050a30, #0b1352);
  border: 1px solid color-mix(in srgb, var(--machine-accent-2) 50%, #0b1352);
  box-shadow: inset 0 2px 6px #070115cc, 0 1px 0 color-mix(in srgb, var(--machine-accent-2) 35%, transparent);
  line-height: 1.05;
}

.bet-value {
  width: 100%;
}

.bet-label,
.win-label {
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.045em;
  line-height: 12px;
  white-space: nowrap;
  text-shadow: 0 1px 2px #000;
}

.bet-value strong {
  display: block;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-align: center;
  font-family: var(--display);
  font-size: var(--type-meter);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: #ffdf32;
  text-shadow: 0 1px 2px #512500, 0 0 7px #ffca2522;
}

.bet-value.raised strong {
  text-shadow: 0 1px 2px #512500, 0 0 8px #ffca2555;
}

.denom-plate {
  position: absolute;
  z-index: 1;
  top: -6px;
  right: 6px;
  min-width: 22px;
  padding: 0 3px;
  border-radius: 4px;
  background: var(--plate-fill);
  box-shadow: inset 0 0 0 1px var(--gold-deep);
  color: var(--gold-light);
  font-family: var(--display);
  font-size: 11px;
  line-height: 11px;
  text-align: center;
  text-shadow: 0 1px 0 #000;
  pointer-events: none;
}

.denom-plate[hidden] {
  display: none;
}

.denom-plate.step {
  animation: denom-step 520ms ease-out;
}

@keyframes denom-step {
  40% {
    transform: scale(1.3);
    box-shadow: inset 0 0 0 1px var(--gold), 0 0 8px rgba(255, 211, 77, 0.9);
  }
}

@media (prefers-reduced-motion: reduce) {
  .denom-plate.step {
    animation: none;
  }
}

.bet-value.short {
  border-color: var(--ruby);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.9), 0 0 8px rgba(255, 59, 78, 0.7);
}

.bet-value.short strong {
  color: var(--ruby);
  text-shadow: 0 0 6px rgba(255, 59, 78, 0.8);
}

.per-spin.low {
  padding: 0 5px;
  border-radius: 4px;
  background: var(--plate-fill);
  box-shadow: inset 0 0 0 1px var(--gold-deep);
  color: var(--amber);
  text-shadow: 0 1px 0 #000;
}

.bet-value.nudge,
.shop-button.nudge {
  animation: bet-nudge 360ms ease;
}

.bet-step.buy {
  position: relative;
}

.bet-step.buy::after {
  content: "";
  position: absolute;
  top: -5px;
  right: -5px;
  width: 19px;
  height: 19px;
  background: url("../art/ui/coin-gold.webp") center / contain no-repeat;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 3px rgba(255, 211, 77, 0.55));
  pointer-events: none;
}

@keyframes bet-nudge {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

.win-box {
  border-color: color-mix(in srgb, var(--machine-accent-2) 30%, transparent);
}

.win-display {
  width: 100%;
  overflow: hidden;
  color: #ffdf32;
  font-family: var(--display);
  font-size: var(--type-meter);
  flex-shrink: 0;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.01em;
  text-align: center;
  white-space: pre;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px #512500, 0 0 7px #ffca2522;
}

.win-display.idle {
  opacity: 0.8;
}

.win-display.hit {
  color: #ffdf32;
  text-shadow: 0 0 7px rgba(255, 178, 30, 0.8), 0 0 1px #ffe9a0;
}

.buttons {
  display: grid;
  grid-template-columns: 44px 44px minmax(0, 1fr) 44px clamp(44px, 15vw, 60px);
  align-items: stretch;
  gap: 5px;
}

.rush-button {
  position: relative;
  flex: none;
  width: 58px;
  border-radius: 12px;
  font-size: 1.5rem;
}

.badge {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--ruby);
  border: 2px solid #fff;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 900;
  line-height: 18px;
  animation: badge 1s ease-in-out infinite alternate;
}

.badge[hidden] {
  display: none;
}

.spin-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 48px;
  padding: 2px;
  border-radius: 6px;
  background:
    linear-gradient(180deg, #b5ff6266, transparent 45%, #02712722 55%),
    linear-gradient(180deg, #6cf51b, #28c322 46%, #0a9839 78%, #0a7934);
  border: 2px solid #7def60;
  border-bottom-color: #47d473;
  box-shadow: inset 0 1px 3px #e5ffad99, inset 0 -3px 6px #05512188, 0 3px 0 #083d23, 0 0 10px #50e12d55;
  color: #fff;
  touch-action: none;
}

.spin-button > * {
  pointer-events: none;
}

#spin-label {
  font-family: var(--display);
  font-size: var(--type-meter);
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 1;
  color: #fff;
  -webkit-text-stroke: 2px #0a5a24;
  paint-order: stroke fill;
  text-shadow: 0 2px 0 #064018, 0 3px 6px rgba(0, 0, 0, 0.5);
}

.per-spin {
  max-width: 100%;
  margin-top: 2px;
  font-size: clamp(0.44rem, 1.8vw, 0.6rem);
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: normal;
  text-align: center;
  color: #e0ffe8;
  text-shadow: 0 1px 0 #064018;
}

.spin-button.pulse {
  animation: press 140ms ease-out;
}

.spin-button.pulse:where(.replay-b) {
  animation-name: press-b;
}

.spin-button {
  transition: filter 150ms ease-out, opacity 150ms ease-out;
}

.spin-button:disabled,
.spin-button.broke,
.spin-button.busy {
  filter: grayscale(1);
  opacity: 0.65;
  box-shadow: inset 0 1px 3px #fff3, inset 0 -3px 6px #0006, 0 3px 0 #0006;
  cursor: default;
  animation: none;
}

.spin-button:disabled .per-spin,
.spin-button.short .per-spin {
  visibility: hidden;
}

.spin-button:disabled .turbo-badge,
.spin-button.broke .turbo-badge,
.spin-button.busy .turbo-badge {
  animation: none;
}

.spin-button.stop {
  background:
    linear-gradient(180deg, #fff6, transparent 45%),
    linear-gradient(180deg, #ff727e, #e0182e 48%, #8a0014);
  border-color: #ff8595;
  box-shadow: inset 0 -3px 6px #60000888, 0 3px 0 #3a0008, 0 0 10px #ff3b4e66;
}

.spin-button.stop #spin-label {
  -webkit-text-stroke-color: #7a0012;
  text-shadow: 0 2px 0 #4a0008, 0 3px 6px rgba(0, 0, 0, 0.5);
}

.spin-button.stop .per-spin {
  visibility: hidden;
}


.spin-button.auto {
  background:
    linear-gradient(180deg, #fff6, transparent 45%),
    linear-gradient(180deg, #ff818e, #e0213a 48%, #8a0a1c);
  border-color: #ff8595;
  box-shadow: inset 0 -3px 6px #60000888, 0 3px 0 #3a0008, 0 0 10px #ff3b4e66;
  animation: auto-glow 1.2s ease-in-out infinite alternate;
}

.spin-button.auto #spin-label {
  -webkit-text-stroke-color: #6a0016;
  text-shadow: 0 2px 0 #4a0010, 0 3px 6px rgba(0, 0, 0, 0.5);
}

.spin-button.auto .per-spin {
  color: #ffe0e4;
  text-shadow: 0 1px 0 #4a0010;
}

