@font-face {
  font-family: "Helvetica Neue Bold";
  src:
    url("../roulette/fonts/HelveticaNeue-Bold.otf") format("opentype"),
    local("Helvetica Neue Bold"),
    local("HelveticaNeue-Bold");
  font-style: normal;
  font-weight: 700;
  font-display: block;
}

:root {
  --page-bg: #0a0a0a;
  --hint: #9a9a9a;
  --gold: #d4af37;
  --cream: #f4f1e6;
  --reel-window-bg: #f3efe3;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Helvetica Neue Bold", "Helvetica Neue", Helvetica, sans-serif;
  font-weight: 700;
  color: var(--cream);
  background: var(--page-bg);
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 8px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
}

.btn-customize {
  margin-left: auto;
  padding: 0.45rem 0.85rem;
  border: 1px solid rgba(212, 175, 55, 0.55);
  border-radius: 6px;
  background: transparent;
  color: var(--gold);
  font: inherit;
  font-size: 0.8rem;
  text-transform: lowercase;
  cursor: pointer;
}

.btn-customize:hover,
.btn-customize:focus-visible {
  background: rgba(212, 175, 55, 0.12);
  outline: none;
}

.home-link {
  font-size: 0.85rem;
  color: var(--gold);
  text-decoration: none;
}

.home-link:hover,
.home-link:focus-visible {
  text-decoration: underline;
  outline: none;
}

.brand h1 {
  margin: 0;
  font-size: 1.5rem;
  text-transform: lowercase;
  color: var(--gold);
}

.tagline {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  opacity: 0.85;
  text-transform: lowercase;
}

.slots-main {
  padding: 1rem 1.25rem 2rem;
  max-width: 760px;
  margin: 0 auto;
}

.slots-hint {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--hint);
  text-transform: lowercase;
}

.slots-status {
  margin: 1rem 0 0;
  min-height: 1.25rem;
  font-size: 0.85rem;
  color: var(--gold);
  text-transform: lowercase;
}

.machine-wrap {
  display: flex;
  justify-content: center;
}

.machine {
  width: min(100%, 620px);
}

/* —— Cabinet, drawn entirely in CSS (no PNG) —— */

.machine-cabinet {
  position: relative;
  width: 100%;
  /* Landscape body; leaves room for the lever sticking out on the right */
  aspect-ratio: 3 / 2;
  /* Inside padding: top (marquee), right (lever), bottom (bet panel), left */
  padding: 5% 22% 18% 5%;
  display: flex;
  flex-direction: column;
  gap: 3%;
  border-radius: 22px 22px 14px 14px;
  /* Customizable color, set by slots.js. Yellow is just the first-time default. */
  --machine-tint: #ffde00;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.08) 30%, rgba(0, 0, 0, 0.25)),
    var(--machine-tint);
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.35),
    inset 0 -8px 0 rgba(0, 0, 0, 0.25),
    0 14px 30px rgba(0, 0, 0, 0.5);
}

.machine-marquee {
  flex: 0 0 auto;
  text-align: center;
  padding: 0.5rem 0.6rem;
  background: linear-gradient(180deg, #1a1a1a, #2a2a2a);
  color: var(--gold);
  border-radius: 8px;
  letter-spacing: 0.18em;
  font-size: clamp(0.7rem, 2vw, 1rem);
  text-transform: uppercase;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
}

/* Dark recessed frame = the "hole" cut into the cabinet */
.reels-frame {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.5%;
  background: linear-gradient(180deg, #0d0d0d, #1c1c1c);
  border-radius: 12px;
  box-shadow:
    inset 0 6px 14px rgba(0, 0, 0, 0.8),
    inset 0 -2px 0 rgba(255, 255, 255, 0.05);
}

/* Reel viewport — exactly 3 columns wide × 2 rows tall (each cell square) */
.reels-window {
  width: 100%;
  aspect-ratio: 3 / 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  overflow: hidden;
  background: #000;
  border-radius: 4px;
}

.reel {
  position: relative;
  overflow: hidden;
  background: var(--reel-window-bg);
}

/* Strip stacks square cells; viewport is 2 cells tall, so strip = N/2 * viewport */
.reel-strip {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: calc(100% * var(--cell-count, 19) / 2);
  will-change: transform;
}

.reels-window--spinning .reel-strip {
  filter: blur(1px);
}

.reel-cell {
  flex: 0 0 calc(100% / var(--cell-count, 19));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.reel-symbol {
  display: block;
  width: 86%;
  height: 86%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.reel-mult {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 60%;
  min-height: 60%;
  padding: 0.2em 0.5em;
  border-radius: 8px;
  color: #fff;
  font-size: clamp(0.8rem, 2.6vw, 1.2rem);
  border: 2px solid rgba(0, 0, 0, 0.4);
  font-weight: 700;
}

/* —— Bet panel inside the cabinet —— */

.bet-panel {
  position: absolute;
  left: 5%;
  right: 22%;
  bottom: 5%;
  height: 11%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: stretch;
  column-gap: 0.15rem;
  background: #000;
  border-radius: 6px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.machine-cabinet--spinning .lever-hit,
.machine-cabinet--spinning .bet-btn {
  pointer-events: none;
}

/* —— Lever (pure CSS) sticking out on the right —— */

.lever-wrap {
  position: absolute;
  right: 4%;
  top: 18%;
  width: 16%;
  height: 60%;
  transform-origin: 50% 100%;
  transition: transform 320ms cubic-bezier(0.34, 1.2, 0.48, 1);
  z-index: 8;
}

.lever-wrap--pulling {
  transform: rotate(34deg);
}

.lever-wrap--released {
  transition: transform 520ms cubic-bezier(0.34, 1.1, 0.64, 1);
  transform: rotate(0deg);
}

.lever-hit {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.lever-stick {
  position: absolute;
  left: 40%;
  top: 22%;
  width: 20%;
  height: 78%;
  background: linear-gradient(90deg, #6e6e6e, #d8d8d8 50%, #6e6e6e);
  border-radius: 4px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.45);
}

.lever-ball {
  position: absolute;
  left: 22%;
  top: 0;
  width: 56%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #ffb3a8, #c62828 60%, #6a1010);
  box-shadow:
    0 5px 10px rgba(0, 0, 0, 0.5),
    inset 0 -4px 6px rgba(0, 0, 0, 0.35);
}

.lever-hit:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
  border-radius: 6px;
}

.lever-hit:disabled {
  cursor: not-allowed;
}

.bet-btn {
  border: none;
  margin: 0;
  align-self: stretch;
  width: auto;
  aspect-ratio: 1;
  font-size: clamp(1rem, 2.8vw, 1.35rem);
  line-height: 1;
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  flex-shrink: 0;
}

.bet-btn--down {
  background: #e53935;
}

.bet-btn--up {
  background: #43a047;
}

.bet-btn:hover,
.bet-btn:focus-visible {
  filter: brightness(1.08);
  outline: none;
}

.bet-readout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-width: 3rem;
  padding: 0 0.4rem;
  color: #ffffff;
  background: #000000;
  z-index: 1;
}

.bet-label {
  font-size: clamp(0.5rem, 1.45vw, 0.64rem);
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: lowercase;
}

.bet-value {
  font-size: clamp(1rem, 3.2vw, 1.4rem);
  line-height: 1;
  margin: 0;
}

/* ——— Customize panel ——— */

dialog.customize-sheet {
  border: none;
  border-radius: 14px;
  padding: 0;
  width: min(520px, 94vw);
  max-height: 90vh;
  overflow: hidden;
  background: #2a2a2a;
  color: #f4f1e6;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.55);
}

dialog.customize-sheet::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.customize-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.customize-head h2 {
  margin: 0;
  font-size: 1.1rem;
  text-transform: lowercase;
  color: var(--gold);
}

.customize-close {
  border: none;
  background: transparent;
  color: #ccc;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
}

.customize-section {
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  overflow: auto;
  max-height: 28vh;
}

.customize-section h3 {
  margin: 0 0 6px;
  font-size: 0.9rem;
  text-transform: lowercase;
}

.customize-note {
  margin: 0 0 10px;
  font-size: 0.72rem;
  color: var(--hint);
  line-height: 1.4;
  text-transform: lowercase;
}

.customize-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 18px 16px;
}

.btn-small {
  border: none;
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-size: 0.75rem;
  text-transform: lowercase;
  cursor: pointer;
}

.btn-primary {
  background: #43a047;
  color: #fff;
}

.btn-muted {
  background: #444;
  color: #eee;
}

.payout-list,
.symbol-list,
.color-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.payout-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 0.5rem 0.55rem;
  border: none;
  border-radius: 6px;
  background: #1a1a1a;
  color: #fff;
  font: inherit;
  font-size: 0.78rem;
  text-align: left;
  text-transform: lowercase;
  cursor: pointer;
}

.payout-list li + li {
  margin-top: 6px;
}

.payout-row:hover:not(:disabled),
.payout-row:focus-visible {
  background: #333;
  outline: none;
}

.payout-row--locked {
  opacity: 0.65;
  cursor: not-allowed;
}

.payout-row-value {
  color: var(--gold);
  flex-shrink: 0;
}

.color-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.color-tools input[type="color"] {
  width: 48px;
  height: 36px;
  padding: 0;
  border: 2px solid #555;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.color-chip-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.color-code {
  flex: 1;
  font-size: 0.75rem;
  text-transform: lowercase;
}

.color-preview {
  height: 28px;
  border-radius: 6px;
  margin-top: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.symbol-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  text-transform: lowercase;
  cursor: pointer;
}

.symbol-list li + li {
  margin-top: 6px;
}

/* ——— Payout editor (slot machine window.png) ——— */

dialog.payout-editor {
  border: none;
  border-radius: 16px;
  padding: 18px 20px 16px;
  width: min(420px, 92vw);
  background: #3a3a3a;
  color: #fff;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.55);
}

dialog.payout-editor::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

dialog.payout-editor h2 {
  margin: 0 0 4px;
  font-size: 1rem;
  text-transform: lowercase;
}

.payout-editor-label {
  margin: 0 0 12px;
  font-size: 0.8rem;
  color: #ccc;
  text-transform: lowercase;
}

.payout-amount-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #000;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.payout-amount-prefix {
  font-size: 1.5rem;
  color: #fff;
  flex-shrink: 0;
}

.payout-amount-input {
  flex: 1;
  border: none;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 1.5rem;
  min-width: 0;
}

.payout-amount-input:focus {
  outline: none;
}

.payout-type-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.payout-type-label {
  font-size: 0.85rem;
  text-transform: lowercase;
}

.payout-type-buttons {
  display: flex;
  flex: 1;
  gap: 6px;
}

.type-btn {
  flex: 1;
  border: none;
  border-radius: 6px;
  padding: 0.45rem 0.35rem;
  background: #1e5bb8;
  color: #fff;
  font: inherit;
  font-size: 0.72rem;
  text-transform: lowercase;
  cursor: pointer;
}

.type-btn.is-active {
  background: #4a9eff;
}

.type-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.payout-editor-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.editor-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 0.5rem;
  font: inherit;
  font-size: 0.85rem;
  text-transform: lowercase;
  color: #fff;
  cursor: pointer;
}

.editor-btn--cancel {
  background: #c62828;
}

.editor-btn--save {
  background: #2ecc40;
}

