:root {
  --bg: #151515;
  --panel: #202020;
  --panel-2: #292929;
  --text: #f6f0e8;
  --muted: #b9ada0;
  --line: #3c3732;
  --gold: #f3b941;
  --red: #c83b37;
  --green: #45a163;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(200, 59, 55, 0.18), transparent 42%),
    var(--bg);
}

button {
  font: inherit;
}

.game {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
  display: grid;
  align-content: center;
  gap: 14px;
}

.machine,
.paytable {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
}

.machine {
  position: relative;
  padding: 18px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
}

.topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.stats {
  display: flex;
  align-items: center;
  gap: 8px;
}

.balance,
.message {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.balance {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #181818;
}

.balance.is-bumping {
  animation: bump 260ms ease-out;
}

.sound-toggle {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: #181818;
  color: var(--gold);
}

.sound-icon {
  width: 22px;
  height: 22px;
  display: block;
}

.sound-icon .speaker {
  fill: currentColor;
}

.sound-icon .wave,
.sound-icon .mute-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.sound-icon .mute-line {
  display: none;
  stroke-width: 2.4;
}

.sound-toggle.is-muted .wave {
  display: none;
}

.sound-toggle.is-muted .mute-line {
  display: block;
}

h1 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.5rem, 18vw, 4.5rem);
  line-height: 0.9;
}

.reels {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 24px 0 14px;
}

.reel {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
}

.slot {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #4b443c;
  border-radius: 7px;
  background: #f8eee0;
  box-shadow:
    inset 0 0 0 5px rgba(255, 255, 255, 0.46),
    inset 0 -10px 24px rgba(42, 24, 10, 0.12);
}

.slot svg {
  width: 76%;
  height: 76%;
  display: block;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.16));
}

.slot[data-symbol="crown"] svg,
.slot[data-symbol="bell"] svg,
.slot[data-symbol="gem"] svg {
  width: 84%;
  height: 84%;
}

.slot[data-symbol="cherry"] {
  background: #fff2df;
}

.slot[data-symbol="crown"] {
  background: #ffe2a5;
}

.slot[data-symbol="bell"] {
  background: #eee5ff;
}

.slot[data-symbol="gem"] {
  background: #dff8f3;
}

.slot[data-symbol="star"] {
  background: #ffe3ee;
}

.slot.is-payline {
  border-color: var(--gold);
}

.slot.is-win {
  animation: win-slot 780ms ease-out;
}

.payline {
  position: absolute;
  left: -5px;
  right: -5px;
  top: 50%;
  height: calc((100% - 12px) / 3 + 10px);
  border: 2px solid rgba(243, 185, 65, 0.72);
  border-radius: 9px;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 2;
}

.reel.is-spinning .slot svg {
  animation: reel-drop 72ms linear;
}

.message {
  min-height: 1.4em;
  margin-bottom: 14px;
}

.result-pop {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 50%;
  display: grid;
  place-items: center;
  pointer-events: none;
  color: var(--gold);
  font-size: clamp(2rem, 16vw, 4.6rem);
  font-weight: 900;
  line-height: 1;
  opacity: 0;
  text-shadow: 0 4px 0 #17120b;
  transform: translateY(-50%) scale(0.72);
}

.result-pop.is-visible {
  animation: result-pop 900ms ease-out;
}

.machine.is-win {
  animation: machine-win 620ms ease-out;
}

.spin {
  width: 100%;
  min-height: 58px;
  border: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  color: #17120b;
  background: var(--gold);
  font-weight: 900;
  font-size: 1.08rem;
}

.spin:active {
  transform: translateY(1px);
}

.spin:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.cost {
  min-width: 28px;
  min-height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #17120b;
  color: var(--gold);
  font-size: 0.9rem;
}

.paytable {
  padding: 14px;
}

.paytable summary {
  cursor: pointer;
  color: var(--gold);
  font-weight: 800;
  list-style-position: inside;
}

.paytable[open] summary {
  margin-bottom: 10px;
}

dl {
  margin: 0;
  display: grid;
  gap: 8px;
}

dl div {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 10px;
  border-radius: 6px;
  background: var(--panel-2);
}

dt,
dd {
  margin: 0;
}

dt {
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

dd {
  color: var(--green);
  font-weight: 800;
}

.pay-symbol,
.pay-any {
  width: 28px;
  height: 28px;
  border: 1px solid #4b443c;
  border-radius: 5px;
  display: grid;
  place-items: center;
  background: #f8eee0;
}

.pay-symbol svg {
  width: 82%;
  height: 82%;
  display: block;
}

.pay-symbol[data-pay-symbol="cherry"] {
  background: #fff2df;
}

.pay-symbol[data-pay-symbol="crown"] {
  background: #ffe2a5;
}

.pay-symbol[data-pay-symbol="bell"] {
  background: #eee5ff;
}

.pay-symbol[data-pay-symbol="gem"] {
  background: #dff8f3;
}

.pay-symbol[data-pay-symbol="star"] {
  background: #ffe3ee;
}

.pay-any::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow:
    -7px 0 0 var(--muted),
    7px 0 0 var(--muted);
  color: var(--muted);
}

@keyframes reel-drop {
  from {
    transform: translateY(-8px);
  }

  to {
    transform: translateY(0);
  }
}

@keyframes win-slot {
  0%,
  100% {
    transform: scale(1);
  }

  35% {
    transform: scale(1.08);
    box-shadow:
      inset 0 0 0 5px rgba(255, 255, 255, 0.58),
      0 0 0 3px rgba(243, 185, 65, 0.55),
      0 12px 28px rgba(243, 185, 65, 0.2);
  }
}

@keyframes machine-win {
  0%,
  100% {
    border-color: var(--line);
  }

  40% {
    border-color: var(--gold);
    box-shadow:
      0 18px 60px rgba(0, 0, 0, 0.32),
      0 0 0 3px rgba(243, 185, 65, 0.16);
  }
}

@keyframes result-pop {
  0% {
    opacity: 0;
    transform: translateY(-36%) scale(0.72);
  }

  18%,
  62% {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-72%) scale(0.92);
  }
}

@keyframes bump {
  0%,
  100% {
    transform: scale(1);
  }

  45% {
    transform: scale(1.08);
  }
}
