:root {
  color-scheme: dark;
  --bg: #14070b;
  --ink: #fff8df;
  --muted: #c9a95f;
  --panel: #241015;
  --panel-2: #3a1018;
  --line: rgba(255, 215, 130, 0.34);
  --gold: #ffd76f;
  --gold-2: #b97921;
  --red: #d7193f;
  --red-2: #8e1028;
  --green: #0f6b4f;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% -8%, rgba(255, 218, 106, 0.24), transparent 34%),
    radial-gradient(circle at 8% 18%, rgba(215, 25, 63, 0.22), transparent 26%),
    radial-gradient(circle at 100% 30%, rgba(15, 107, 79, 0.2), transparent 22%),
    linear-gradient(180deg, #260a12 0%, #120609 48%, #080405 100%);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.85), transparent 82%);
}

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

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

.slot-app {
  position: relative;
  width: min(100vw, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto auto auto auto auto auto 1fr;
  gap: 13px;
}

.status-bar {
  min-height: 62px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 239, 171, 0.18), rgba(255, 215, 111, 0.04)),
    rgba(22, 8, 11, 0.86);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), var(--shadow);
}

.status-bar div {
  min-width: 0;
  padding: 0 4px;
}

.label,
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-bar strong {
  display: block;
  margin-top: 4px;
  color: #fff7d4;
  font-size: 20px;
  line-height: 1.1;
  text-shadow: 0 0 12px rgba(255, 215, 111, 0.42);
}

.title-panel {
  text-align: center;
  padding: 4px 0 0;
}

.title-tools {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

.title-panel h1 {
  margin: 4px 0 0;
  color: var(--gold);
  font-size: 36px;
  line-height: 1.05;
  letter-spacing: 0;
  text-shadow:
    0 2px 0 #6e260c,
    0 0 18px rgba(255, 215, 111, 0.42);
}

.eyebrow {
  letter-spacing: 0;
  margin: 0;
  text-align: right;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.language-switch select {
  max-width: 108px;
  min-height: 30px;
  border: 1px solid rgba(255, 215, 111, 0.38);
  border-radius: 8px;
  background: #201016;
  color: #ffe6a1;
  font: inherit;
  padding: 0 7px;
}

.machine {
  position: relative;
  padding: 14px 10px 13px;
  border: 1px solid rgba(255, 215, 111, 0.4);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 215, 111, 0.28), transparent 22%),
    linear-gradient(180deg, #6f1124 0%, #2a0b12 58%, #15070b 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 247, 200, 0.18),
    inset 0 -16px 28px rgba(0, 0, 0, 0.32),
    var(--shadow);
  display: grid;
  justify-items: center;
}

.machine::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(255, 215, 111, 0.2);
  border-radius: 8px;
  pointer-events: none;
}

.machine-lights {
  position: relative;
  z-index: 1;
  width: min(100%, 340px);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.machine-lights span {
  aspect-ratio: 1;
  max-width: 14px;
  justify-self: center;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 30%, #fff8bc 0 22%, #ffd76f 42%, #b94a20 78%);
  box-shadow: 0 0 12px rgba(255, 215, 111, 0.7);
}

.reels {
  position: relative;
  z-index: 1;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 90px);
  justify-content: center;
  gap: 12px;
  column-gap: 12px;
  padding: 15px;
  border: 1px solid rgba(255, 215, 111, 0.34);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 215, 111, 0.18), transparent 54%),
    linear-gradient(180deg, #21080d, #050203 52%, #23090e);
  box-shadow:
    inset 0 0 0 2px rgba(0, 0, 0, 0.46),
    inset 0 16px 26px rgba(255, 215, 111, 0.08),
    inset 0 -18px 30px rgba(0, 0, 0, 0.56);
}

.reels::before,
.reels::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  z-index: 3;
  height: 20px;
  pointer-events: none;
}

.reels::before {
  top: 10px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.42), transparent);
}

.reels::after {
  bottom: 10px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.5), transparent);
}

.reel {
  position: relative;
  z-index: 1;
  aspect-ratio: 1;
  width: 100%;
  min-height: 76px;
  max-height: 90px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 229, 141, 0.7);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 255, 255, 0.98), rgba(255, 250, 224, 0.94) 46%, rgba(218, 181, 91, 0.92) 100%),
    #fff5d6;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.88),
    inset 0 -13px 18px rgba(88, 51, 0, 0.2),
    inset 0 0 0 3px rgba(255, 255, 255, 0.08),
    0 7px 13px rgba(0, 0, 0, 0.38);
}

.reel::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 6px;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.68), transparent 30%),
    radial-gradient(circle at 50% 120%, rgba(125, 73, 0, 0.2), transparent 48%);
  mix-blend-mode: soft-light;
}

.reel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 8px;
  box-shadow: inset 0 0 18px rgba(52, 23, 0, 0.18);
}

.reel span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #12100d;
  font-size: clamp(30px, 10vw, 48px);
  font-weight: 950;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.52);
  transition: transform 160ms ease-out, filter 160ms ease-out;
  white-space: nowrap;
}

.reel[data-symbol="bar"] span,
.reel[data-symbol="seven"] span {
  color: #28070b;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 8vw, 38px);
  letter-spacing: 0;
  transform: scaleX(0.86);
  transform-origin: center;
}

.reel[data-symbol="bar"] span {
  font-size: clamp(24px, 7vw, 32px);
  transform: scaleX(0.72);
}

.reel[data-symbol="blank"] span {
  color: #2a1207;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 7vw, 32px);
  font-weight: 900;
  transform: scaleX(0.72);
  opacity: 0.72;
}

.reel[data-symbol="seven"] span {
  color: #cf163b;
  font-size: clamp(34px, 11vw, 50px);
  transform: none;
  text-shadow:
    0 2px 0 #fff0bf,
    0 0 13px rgba(215, 25, 63, 0.42);
}

.reel[data-symbol="tiger"] span {
  font-size: clamp(30px, 10vw, 46px);
  filter: drop-shadow(0 2px 0 rgba(70, 28, 0, 0.2));
}

.reel[data-symbol="blank"] {
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 253, 238, 0.72), rgba(230, 205, 135, 0.78) 54%, rgba(116, 72, 18, 0.5) 100%),
    #eedaa0;
}

.reel.spinning span {
  animation: symbol-roll 0.22s cubic-bezier(0.45, 0, 0.25, 1) infinite;
  filter: blur(0.7px);
}

.reel.spinning::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent 24%, transparent 76%, rgba(94, 47, 0, 0.24));
}

.reel.stopping span {
  animation: reel-stop 0.34s cubic-bezier(0.2, 0.9, 0.26, 1.08);
}

.reel.win {
  animation: win-pulse 0.72s ease-out 2;
  border-color: #fff1a6;
}

.result-card {
  min-height: 48px;
  display: grid;
  place-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(255, 215, 111, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 215, 111, 0.14), rgba(255, 215, 111, 0.04)),
    rgba(21, 7, 11, 0.9);
  color: #fff4c5;
  font-weight: 900;
  font-size: 19px;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.result-card.win {
  color: #fff6b0;
  border-color: rgba(255, 236, 155, 0.78);
  background:
    linear-gradient(180deg, rgba(183, 121, 33, 0.36), rgba(129, 33, 22, 0.38)),
    rgba(48, 9, 14, 0.92);
  text-shadow: 0 0 14px rgba(255, 215, 111, 0.72);
}

.bet-panel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.bet-button {
  min-height: 46px;
  border: 1px solid rgba(255, 215, 111, 0.38);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 246, 206, 0.16), rgba(255, 215, 111, 0.04)),
    #241015;
  color: #ffe8a0;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 8px 18px rgba(0, 0, 0, 0.24);
}

.bet-button.active {
  background:
    linear-gradient(180deg, #ffe58d, #c27a19);
  color: #230a08;
  border-color: #fff0a8;
  box-shadow: 0 0 0 2px rgba(255, 215, 111, 0.22), 0 10px 18px rgba(183, 121, 33, 0.32);
}

.spin-button {
  min-height: 58px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ff3657, #be1235 62%, #851124);
  color: #fff8df;
  font-size: 21px;
  font-weight: 950;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.24);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 14px 24px rgba(215, 25, 63, 0.34),
    0 0 0 1px rgba(255, 215, 111, 0.22);
}

.spin-button:active:not(:disabled) {
  transform: translateY(1px);
}

.action-row {
  align-self: start;
  display: grid;
  grid-template-columns: minmax(82px, auto) minmax(0, 1fr) minmax(82px, auto);
  align-items: center;
  gap: 10px;
}

.action-row button,
.icon-button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(255, 215, 111, 0.26);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 215, 111, 0.16), rgba(255, 215, 111, 0.04)),
    #201016;
  color: #ffe6a1;
  font-weight: 800;
}

.action-row p {
  min-width: 0;
  margin: 0;
  color: #d8bf7e;
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
}

.sheet,
.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
}

.sheet[hidden],
.modal[hidden] {
  display: none;
}

.sheet-backdrop,
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 2, 3, 0.66);
}

.sheet-panel,
.modal-panel {
  position: absolute;
  left: 50%;
  width: min(100vw, 430px);
  border: 1px solid rgba(255, 215, 111, 0.38);
  background:
    linear-gradient(180deg, rgba(255, 215, 111, 0.08), transparent 42%),
    #1b0a0f;
  box-shadow: 0 -16px 36px rgba(0, 0, 0, 0.44);
}

.sheet-panel {
  bottom: 0;
  max-height: 70vh;
  padding: 16px;
  border-radius: 8px 8px 0 0;
  transform: translateX(-50%);
}

.modal-panel {
  top: 50%;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 120px);
  padding: 18px;
  border-radius: 8px;
  transform: translate(-50%, -50%);
  overflow: auto;
}

.sheet-panel header,
.modal-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.sheet-panel h2,
.modal-panel h2 {
  margin: 0;
  color: var(--gold);
  font-size: 20px;
}

.icon-button {
  width: 40px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.records-list {
  display: grid;
  gap: 9px;
  max-height: 50vh;
  overflow: auto;
}

.record-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(255, 215, 111, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  font-size: 14px;
}

.record-item strong {
  color: #ffe58d;
}

.record-item small,
.empty {
  color: #d8bf7e;
}

.modal-panel ul {
  margin: 0;
  padding-left: 20px;
  color: #fff2c9;
  line-height: 1.65;
}

@keyframes symbol-roll {
  0% {
    transform: translateY(-36%) scaleY(0.96);
  }
  48% {
    transform: translateY(0) scaleY(1.03);
  }
  100% {
    transform: translateY(36%) scaleY(0.96);
  }
}

@keyframes reel-stop {
  0% {
    transform: translateY(-18%) scaleY(0.98);
    filter: blur(0.5px);
  }
  62% {
    transform: translateY(5%) scaleY(1.02);
    filter: blur(0);
  }
  100% {
    transform: translateY(0) scaleY(1);
    filter: blur(0);
  }
}

@keyframes win-pulse {
  0%,
  100% {
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, 0.88),
      inset 0 -13px 18px rgba(88, 51, 0, 0.2),
      0 8px 18px rgba(0, 0, 0, 0.36);
  }
  50% {
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, 0.92),
      inset 0 -13px 18px rgba(88, 51, 0, 0.18),
      0 0 0 4px rgba(255, 215, 111, 0.34),
      0 0 24px rgba(255, 215, 111, 0.58);
  }
}

@media (max-width: 340px) {
  .slot-app {
    padding-left: 10px;
    padding-right: 10px;
    gap: 10px;
  }

  .title-panel h1 {
    font-size: 31px;
  }

  .machine {
    padding-left: 8px;
    padding-right: 8px;
  }

  .reels {
    grid-template-columns: repeat(3, 76px);
    gap: 8px;
    column-gap: 8px;
    padding: 9px;
  }

  .reel {
    min-height: 62px;
    max-height: 76px;
  }

  .status-bar strong {
    font-size: 17px;
  }
}
