:root {
  color-scheme: dark;
  --page: #101116;
  --panel: #1b1e27;
  --panel-2: #252936;
  --panel-3: #11131a;
  --line: #3e4557;
  --text: #f8f4e8;
  --muted: #bbc0cc;
  --gold: #f2be45;
  --red: #df5267;
  --green: #31c58b;
  --cyan: #4cb8dc;
  --blue: #6978ff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(90deg, rgba(5, 6, 9, 0.78), rgba(5, 6, 9, 0.1) 34%, rgba(5, 6, 9, 0.08) 66%, rgba(5, 6, 9, 0.78)),
    linear-gradient(180deg, rgba(7, 8, 12, 0.2), rgba(7, 8, 12, 0.62)),
    url("./assets/ui/luxury-cabinet-bg.webp") center / cover fixed,
    #0c0d11;
  color: var(--text);
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.reel:disabled {
  opacity: 1;
}

.app-shell {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(12px, 3vw, 26px);
}

.machine {
  width: min(100%, 590px);
  padding: clamp(20px, 4vw, 32px) clamp(18px, 3.8vw, 32px);
  border: 1px solid rgba(255, 224, 144, 0.36);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.18)),
    url("./assets/ui/machine-face-3x3-skin.webp") center / 100% 100% no-repeat,
    rgba(20, 23, 31, 0.92);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 0 34px rgba(242, 190, 69, 0.16);
  backdrop-filter: blur(6px) saturate(1.05);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 2px 4px 0;
}

.title-block {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 6.4vw, 42px);
  line-height: 0.96;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
}

.balance,
.meter {
  min-width: 88px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 205, 96, 0.4);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.13), transparent 42%),
    rgba(8, 10, 15, 0.78);
  text-align: right;
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.22) inset,
    0 0 16px rgba(242, 190, 69, 0.08);
  backdrop-filter: blur(3px);
}

.balance span,
.meter span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.balance strong,
.meter strong {
  display: block;
  margin-top: 2px;
  font-size: clamp(20px, 5.2vw, 26px);
  line-height: 1.05;
}

.status-strip {
  display: grid;
  grid-template-columns: minmax(72px, 94px) minmax(0, 1fr) minmax(72px, 94px);
  gap: 10px;
  align-items: stretch;
  margin: 20px 0 16px;
}

.message {
  min-height: 62px;
  display: grid;
  place-items: center;
  padding: 10px;
  border: 1px solid rgba(242, 190, 69, 0.52);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent 46%),
    rgba(6, 7, 11, 0.82);
  color: var(--gold);
  font-size: clamp(13px, 3.4vw, 16px);
  font-weight: 900;
  text-align: center;
  overflow-wrap: anywhere;
  box-shadow: 0 0 18px rgba(242, 190, 69, 0.08) inset;
  backdrop-filter: blur(3px);
}

.message.is-win {
  color: #101116;
  background: linear-gradient(180deg, #ffe38a, var(--gold));
  border-color: var(--gold);
}

.message.is-alert {
  color: #ffffff;
  background: #4f2330;
  border-color: rgba(223, 82, 103, 0.75);
}

.reels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(6px, 1.8vw, 10px);
  margin: 0 0 16px;
  padding: clamp(10px, 2.4vw, 14px);
  border: 1px solid rgba(255, 205, 96, 0.46);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 216, 126, 0.18), transparent 22%),
    rgba(4, 5, 8, 0.78);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 18px 40px rgba(0, 0, 0, 0.28) inset,
    0 0 24px rgba(242, 190, 69, 0.12);
  backdrop-filter: blur(4px);
}

.reel {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(255, 224, 144, 0.32);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 255, 255, 0.13), transparent 4.4rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.17), transparent 38%),
    linear-gradient(160deg, rgba(38, 42, 55, 0.84), rgba(12, 14, 20, 0.9));
  box-shadow:
    0 16px 24px rgba(0, 0, 0, 0.2) inset,
    0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

.grid-3x3 {
  width: min(100%, 500px);
  margin-left: auto;
  margin-right: auto;
}

.reel::before,
.reel::after {
  content: "";
  position: absolute;
  left: 0;
  z-index: 1;
  width: 100%;
  height: 22%;
  pointer-events: none;
}

.reel::before {
  top: 0;
  background: linear-gradient(180deg, rgba(8, 9, 13, 0.42), transparent);
}

.reel::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(8, 9, 13, 0.42), transparent);
}

.symbol {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: clamp(5px, 1.8vw, 10px);
  transition:
    transform 180ms ease,
    opacity 180ms ease;
}

.symbol img {
  width: min(100%, 94px);
  height: min(100%, 94px);
  object-fit: contain;
  filter:
    drop-shadow(0 15px 20px rgba(0, 0, 0, 0.34))
    drop-shadow(0 0 10px rgba(242, 190, 69, 0.12));
}

.symbol-fallback {
  width: min(100%, 82px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 38%),
    var(--symbol-color);
  color: #101116;
  font-size: clamp(20px, 5.6vw, 34px);
  font-weight: 1000;
  line-height: 1;
  text-align: center;
  box-shadow: inset 0 -10px 24px rgba(0, 0, 0, 0.16);
}

.symbol-fallback.is-long {
  font-size: clamp(15px, 4.5vw, 24px);
}

.reel.spinning .symbol {
  animation: tumble 130ms linear infinite;
}

.reel.stopped {
  border-color: rgba(76, 184, 220, 0.72);
}

.reel.win {
  border-color: var(--gold);
  box-shadow:
    0 0 0 2px rgba(242, 190, 69, 0.24),
    0 0 28px rgba(242, 190, 69, 0.34);
}

.stop-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: -4px 0 12px;
  padding: 0 2px;
}

.stop-button {
  min-height: 42px;
  border: 1px solid rgba(255, 224, 144, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 42%),
    #912c42;
  color: #fff6e1;
  font-size: 13px;
  font-weight: 900;
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

.stop-button:not(:disabled) {
  animation: stopReady 900ms ease-in-out infinite alternate;
}

.stop-button:disabled {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 42%),
    #2c3140;
  opacity: 0.76;
}

.controls {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) 62px;
  gap: 12px;
  padding: 0 2px;
}

.primary-button,
.icon-button,
.secondary-controls button {
  min-height: 54px;
  border-radius: 8px;
  font-weight: 900;
}

.primary-button {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 38%),
    linear-gradient(180deg, #ffe08a, var(--gold) 58%, #d49424);
  color: #1b1300;
  font-size: 24px;
  box-shadow:
    0 12px 28px rgba(242, 190, 69, 0.24),
    0 0 0 1px rgba(255, 255, 255, 0.24) inset;
}

.primary-button:not(:disabled):active,
.icon-button:not(:disabled):active,
.secondary-controls button:not(:disabled):active {
  transform: translateY(1px);
}

.icon-button {
  background: var(--red);
  color: #ffffff;
  font-size: 28px;
}

.bet-up {
  background: var(--green);
  color: #071912;
}

.secondary-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
  padding: 0 2px;
}

.secondary-controls button {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 46%),
    #2c3140;
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

.secondary-controls button[aria-pressed="true"] {
  background: var(--cyan);
  color: #061219;
}

.paytable {
  margin-top: 18px;
  padding: 14px 12px 10px;
  border: 1px solid rgba(255, 224, 144, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 36%),
    rgba(5, 6, 9, 0.42);
  backdrop-filter: blur(2px);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 8px;
}

.section-heading h2 {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.section-heading span {
  color: #8f96a8;
  font-size: 12px;
  font-weight: 700;
}

.pay-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  color: var(--muted);
  font-size: 14px;
}

.pay-row strong {
  color: var(--text);
  white-space: nowrap;
}

@keyframes tumble {
  0% {
    transform: translateY(-18%) scale(0.96);
    opacity: 0.48;
  }
  100% {
    transform: translateY(18%) scale(1.02);
    opacity: 1;
  }
}

@keyframes stopReady {
  0% {
    box-shadow:
      0 10px 22px rgba(0, 0, 0, 0.22),
      0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  }
  100% {
    box-shadow:
      0 10px 22px rgba(0, 0, 0, 0.22),
      0 0 18px rgba(223, 82, 103, 0.44),
      0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  }
}

@media (max-width: 440px) {
  .app-shell {
    align-items: start;
    padding: 10px;
  }

  .topbar {
    gap: 10px;
  }

  .eyebrow {
    font-size: 11px;
  }

  .balance,
  .meter {
    min-width: 0;
    padding: 9px 8px;
  }

  .status-strip {
    grid-template-columns: 72px minmax(0, 1fr) 72px;
    gap: 7px;
    margin-top: 16px;
  }

  .controls {
    grid-template-columns: 54px minmax(0, 1fr) 54px;
    gap: 8px;
  }

  .stop-controls {
    gap: 8px;
  }

  .stop-button {
    min-height: 38px;
    font-size: 12px;
  }

  .primary-button,
  .icon-button,
  .secondary-controls button {
    min-height: 50px;
  }

  .secondary-controls {
    gap: 8px;
  }

  .secondary-controls button {
    font-size: 12px;
  }
}
