
:root {
  --primary: #dcae4d;
  --secondary: #76501f;
  --accent: #ffe6a2;
  --surface: #17130c;
  --glow: #f2c963;
  --title: #ffe6a2;
  --win-text: #ffe6a2;
  --button: #dcae4d;
  --button-text: #17130c;
  --slot-dark: rgba(7,9,14,.84);
  --controls-dark: rgba(7,9,14,.68);
  --reels-frame-spread-x-desktop: 4.25%;
  --reels-frame-spread-y-desktop: 7.5714%;
  --reels-frame-spread-x-phone: 4%;
  --reels-frame-spread-y-phone: 8.4286%;
  --reels-frame-slice-top: 5%;
  --reels-frame-slice-right: 5%;
  --reels-frame-slice-bottom: 5%;
  --reels-frame-slice-left: 5%;
  --reels-frame-border-x: 34px;
  --reels-frame-border-y: 34px;
  --effective-reels-frame-border-x: var(--reels-frame-border-x);
  --effective-reels-frame-border-y: var(--reels-frame-border-y);
  --effective-frame-spread-x: var(--reels-frame-spread-x-desktop);
  --effective-frame-spread-y: var(--reels-frame-spread-y-desktop);
  --title-offset-y-desktop: 0px;
  --slot-offset-y-desktop: 0px;
  --controls-offset-y-desktop: 0px;
  --title-offset-y-phone: 0px;
  --slot-offset-y-phone: 0px;
  --controls-offset-y-phone: 0px;
  --title-image-width-desktop: 90%;
  --title-image-max-width-desktop: 1000px;
  --title-image-min-height-desktop: 90px;
  --title-image-fluid-height-desktop: 17dvh;
  --title-image-max-height-desktop: 190px;
  --title-image-width-phone: 70.2%;
  --title-image-max-width-phone: 780px;
  --title-image-min-height-phone: 45.24px;
  --title-image-fluid-height-phone: 9.36dvh;
  --title-image-max-height-phone: 74.88px;
  --effective-title-offset-y: var(--title-offset-y-desktop);
  --effective-slot-offset-y: var(--slot-offset-y-desktop);
  --effective-controls-offset-y: var(--controls-offset-y-desktop);
  --effective-title-image-width: var(--title-image-width-desktop);
  --effective-title-image-max-width: var(--title-image-max-width-desktop);
  --effective-title-image-min-height: var(--title-image-min-height-desktop);
  --effective-title-image-fluid-height: var(--title-image-fluid-height-desktop);
  --effective-title-image-max-height: var(--title-image-max-height-desktop);
  --slot-columns: 5;
  --slot-rows: 3;
  color-scheme: dark;
}
@media (max-width: 760px) {
  :root {
    --effective-frame-spread-x: var(--reels-frame-spread-x-phone);
    --effective-frame-spread-y: var(--reels-frame-spread-y-phone);
    --effective-title-offset-y: var(--title-offset-y-phone);
    --effective-slot-offset-y: var(--slot-offset-y-phone);
    --effective-controls-offset-y: var(--controls-offset-y-phone);
    --effective-title-image-width: var(--title-image-width-phone);
    --effective-title-image-max-width: var(--title-image-max-width-phone);
    --effective-title-image-min-height: var(--title-image-min-height-phone);
    --effective-title-image-fluid-height: var(--title-image-fluid-height-phone);
    --effective-title-image-max-height: var(--title-image-max-height-phone);
  }
}
:root[data-preview-viewport="desktop"] {
  --effective-frame-spread-x: var(--reels-frame-spread-x-desktop);
  --effective-frame-spread-y: var(--reels-frame-spread-y-desktop);
  --effective-title-offset-y: var(--title-offset-y-desktop);
  --effective-slot-offset-y: var(--slot-offset-y-desktop);
  --effective-controls-offset-y: var(--controls-offset-y-desktop);
  --effective-title-image-width: var(--title-image-width-desktop);
  --effective-title-image-max-width: var(--title-image-max-width-desktop);
  --effective-title-image-min-height: var(--title-image-min-height-desktop);
  --effective-title-image-fluid-height: var(--title-image-fluid-height-desktop);
  --effective-title-image-max-height: var(--title-image-max-height-desktop);
}
:root[data-preview-viewport="phone"] {
  --effective-frame-spread-x: var(--reels-frame-spread-x-phone);
  --effective-frame-spread-y: var(--reels-frame-spread-y-phone);
  --effective-title-offset-y: var(--title-offset-y-phone);
  --effective-slot-offset-y: var(--slot-offset-y-phone);
  --effective-controls-offset-y: var(--controls-offset-y-phone);
  --effective-title-image-width: var(--title-image-width-phone);
  --effective-title-image-max-width: var(--title-image-max-width-phone);
  --effective-title-image-min-height: var(--title-image-min-height-phone);
  --effective-title-image-fluid-height: var(--title-image-fluid-height-phone);
  --effective-title-image-max-height: var(--title-image-max-height-phone);
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: #07080b; color: #fff; font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: url("../assets/background.webp");
  background-size: cover;
  background-position: center;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: none;
}
button, select { font: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.game-shell {
  width: 100%;
  height: 100dvh;
  min-height: 0;
  margin: auto;
  padding: clamp(34px, 6dvh, 72px) clamp(42px, 7vw, 96px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.game-content {
  width: min(1180px, 100%);
  flex: 0 0 auto;
  min-width: 0;
  max-width: 1180px;
  display: grid;
  grid-template-rows: auto minmax(0, auto) auto;
  align-content: center;
  gap: clamp(8px, 1.7dvh, 16px);
  transform: scale(var(--game-scale, 1));
  transform-origin: center;
  will-change: transform;
}
.game-header { position: relative; top: calc(0px - var(--effective-title-offset-y)); text-align: center; min-width: 0; }
.game-content.has-custom-frame .game-header { top: calc(-48px - var(--effective-title-offset-y)); }
.game-content.has-custom-frame .slot-machine { top: calc(-24px - var(--effective-slot-offset-y)); }
.game-title-image { display: block; width: min(var(--effective-title-image-width), var(--effective-title-image-max-width)); height: clamp(var(--effective-title-image-min-height), var(--effective-title-image-fluid-height), var(--effective-title-image-max-height)); margin: 0 auto; object-fit: contain; filter: drop-shadow(0 5px 18px rgba(0,0,0,.48)); }
.game-header h1 {
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--title);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 4.2vw, 48px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: .035em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 4px 22px rgba(0,0,0,.75), 0 0 24px color-mix(in srgb, var(--glow), transparent 72%);
}
.slot-machine {
  position: relative;
  top: calc(0px - var(--effective-slot-offset-y));
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 5px;
  overflow: hidden;
  border: 3px solid color-mix(in srgb, var(--primary), white 14%);
  border-radius: 15px;
  background: var(--slot-dark);
  box-shadow: 0 20px 58px rgba(0,0,0,.58), 0 0 32px color-mix(in srgb, var(--glow), transparent 84%), inset 0 0 0 1px rgba(255,255,255,.04);
  isolation: isolate;
}
.slot-machine::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle, color-mix(in srgb, var(--glow), white 24%), transparent 68%);
}
.slot-machine.is-big-win::after { animation: screenFlash .7s ease-out 2; }
.slot-machine.is-mega-win::after { animation: screenFlash .75s ease-out 3; }
.slot-machine.is-mega-win { animation: celebrationShake .42s ease-in-out 2; }
.slot-machine.has-custom-frame { padding: clamp(8px, 1vw, 12px); overflow: visible; border-color: transparent; }
.slot-machine.has-cell-background { background: var(--slot-dark); }
.slot-background-clip {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: none;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}
.slot-machine.has-cell-background > .slot-background-clip { display: block; }
.slot-background-grid { position: absolute; display: grid; }
.slot-background-grid > i {
  min-width: 0;
  min-height: 0;
  background-image: var(--cell-background-tile);
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}
.reels-shell { position: relative; width: 100%; min-width: 0; overflow: visible; }
.reels-window {
  position: relative;
  width: 100%;
  min-width: 0;
  height: auto;
  aspect-ratio: var(--slot-columns) / var(--slot-rows);
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}
.reels-window::before, .reels-window::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 10%;
  z-index: 4;
  pointer-events: none;
  display: none;
}
.reels-window::before { top: 0; background: linear-gradient(rgba(0,0,0,.44), transparent); }
.reels-window::after { bottom: 0; background: linear-gradient(transparent, rgba(0,0,0,.44)); }
.reels-frame-asset {
  position: absolute;
  inset: calc(0px - var(--effective-frame-spread-y)) calc(0px - var(--effective-frame-spread-x));
  z-index: 80;
  display: none;
  pointer-events: none;
  background-image: var(--reels-frame-image);
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  transform: translateZ(0);
}
.slot-machine.has-custom-frame .reels-frame-asset { display: block; }
.slot-machine.has-nine-slice-frame .reels-frame-asset {
  border-style: solid;
  border-color: transparent;
  border-width: var(--effective-reels-frame-border-y) var(--effective-reels-frame-border-x);
  border-image-source: var(--reels-frame-image);
  border-image-slice: var(--reels-frame-slice-top) var(--reels-frame-slice-right) var(--reels-frame-slice-bottom) var(--reels-frame-slice-left) fill;
  border-image-width: 1;
  border-image-repeat: stretch;
  background-image: none;
}
.cell-background-grid {
  position: absolute;
  inset: 2px;
  z-index: 0;
  display: none;
  grid-template-columns: repeat(var(--slot-columns), minmax(0, 1fr));
  grid-template-rows: repeat(var(--slot-rows), minmax(0, 1fr));
  overflow: hidden;
  pointer-events: none;
}
.slot-machine.has-cell-background .cell-background-grid { display: grid; }
.cell-background-grid > i {
  min-width: 0;
  min-height: 0;
  background-image: var(--cell-background-tile);
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}
.reels { position: relative; display: grid; grid-template-columns: repeat(var(--slot-columns), minmax(0, 1fr)); width: 100%; min-width: 0; height: 100%; padding: 2px; }
.reel {
  position: relative;
  display: grid;
  grid-template-rows: repeat(var(--slot-rows), minmax(0, 1fr));
  min-width: 0;
  background: linear-gradient(90deg, rgba(255,255,255,.008), rgba(255,255,255,.045), rgba(0,0,0,.045));
  border-right: 1px solid color-mix(in srgb, var(--primary), transparent 76%);
}
.reel:last-child { border-right: 0; }
.symbol {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  padding: 1px;
  border-bottom: 1px solid color-mix(in srgb, var(--primary), transparent 84%);
  transition: opacity .3s, filter .3s;
  overflow: visible;
}
.symbol img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  filter: drop-shadow(0 7px 5px rgba(0,0,0,.5));
}
.reel.spinning .symbol img { animation: reelBlur .12s linear infinite; }
.symbol.is-dimmed { z-index: 1; opacity: .34; filter: saturate(.58) brightness(.66); }
.symbol.is-winning {
  z-index: 90;
  opacity: 1;
}
.symbol.is-winning img { position: relative; overflow: visible; filter: drop-shadow(0 0 14px var(--accent)) drop-shadow(0 7px 5px #000); animation: winLift .62s ease-in-out infinite alternate; }
.slot-machine.is-celebrating, .slot-machine.is-celebrating .reels-shell, .slot-machine.is-celebrating .reels-window, .slot-machine.is-celebrating .reels { overflow: visible; }
.reels-dim { position: absolute; inset: 0; z-index: 70; pointer-events: none; opacity: 0; border-radius: inherit; background: rgba(0,0,0,.48); transition: opacity .3s ease; }
.reels-dim.is-visible { opacity: 1; }
.win-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -44%) scale(.82);
  border: 0;
  background: none;
  box-shadow: none;
}
.win-overlay.is-visible { opacity: 1; transform: translate(-50%, -50%) scale(1); animation: overlayEnter .42s cubic-bezier(.18,.82,.24,1.2) both; }
.win-title { position: relative; z-index: 2; color: var(--win-text); font-family: Georgia, serif; font-size: clamp(32px, 7vw, 78px); font-weight: 900; line-height: 1; letter-spacing: .055em; text-align: center; text-shadow: 0 2px 0 rgba(0,0,0,.52), 0 0 18px color-mix(in srgb, var(--win-text), transparent 24%), 0 5px 16px #000; white-space: nowrap; }
.win-amount { position: relative; z-index: 1; display: flex; align-items: center; gap: 9px; color: var(--win-text); font-size: clamp(19px, 3.5vw, 36px); font-weight: 800; font-variant-numeric: tabular-nums; text-shadow: 0 2px 12px #000, 0 0 12px rgba(0,0,0,.8); }
.win-overlay.mega-win .win-title { animation: megaText 1s ease-in-out infinite alternate; }
.particles { position: absolute; inset: 0; z-index: 95; overflow: hidden; pointer-events: none; }
.particles i { position: absolute; left: var(--x); top: -12px; width: 7px; height: 11px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 8px var(--glow); animation: particleFall 1.8s var(--delay) ease-in infinite; }
.controls {
  position: relative;
  top: calc(0px - var(--effective-controls-offset-y));
  width: min(96%, 1040px);
  min-height: 68px;
  margin: 0 auto;
  padding: 8px 12px;
  display: grid;
  grid-template-columns: 1fr 118px 112px 124px 1fr;
  align-items: center;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--primary), transparent 66%);
  border-radius: 14px;
  background: var(--controls-dark);
  box-shadow: 0 13px 34px rgba(0,0,0,.42), inset 0 1px rgba(255,255,255,.045);
}
.meter, .bet-control { position: relative; height: 52px; display: flex; flex-direction: column; justify-content: center; padding: 0 10px; }
.meter > span, .bet-control > span { position: absolute; top: 0; left: 10px; right: 10px; pointer-events: none; }
.meter > span, .bet-control > span { color: rgba(255,255,255,.5); font-size: 8px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.meter > span { color: rgba(255,255,255,.9); text-shadow: 0 1px 8px rgba(0,0,0,.72); }
.meter strong { display: flex; align-items: center; gap: 7px; margin-top: 0; color: color-mix(in srgb, var(--accent), white 58%); font-size: 17px; font-variant-numeric: tabular-nums; text-shadow: 0 1px 9px rgba(0,0,0,.72); }
.meter strong b { font-weight: 800; }
#balance, #last-win { color: #fff; }
.win-meter { align-items: flex-end; text-align: right; }
.win-meter > span { text-align: right; }
.crystal-icon { position: relative; display: inline-block; width: 12px; height: 12px; flex: 0 0 auto; transform: rotate(45deg); border: 1px solid var(--accent); border-radius: 2px; background: linear-gradient(135deg, var(--accent), var(--primary) 55%, var(--secondary)); box-shadow: 0 0 9px color-mix(in srgb, var(--glow), transparent 35%); }
.bet-control select { margin-top: 0; padding: 6px 8px; border: 1px solid color-mix(in srgb, var(--primary), transparent 62%); border-radius: 7px; outline: none; background: rgba(3,5,9,.78); color: #fff; }
.spin-button {
  position: relative;
  width: 76px;
  height: 58px;
  padding: 0 8px;
  display: grid;
  place-items: center;
  justify-self: center;
  overflow: hidden;
  border: 2px solid color-mix(in srgb, var(--button), black 24%);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 28%, color-mix(in srgb, var(--button), white 52%), var(--button) 54%, color-mix(in srgb, var(--button), black 46%));
  color: var(--button-text);
  box-shadow: 0 0 22px color-mix(in srgb, var(--button), transparent 48%), inset 0 1px 2px rgba(255,255,255,.55);
  cursor: pointer;
  transition: transform .16s, filter .16s, opacity .16s;
}
.spin-button span { position: absolute; left: 50%; top: 50%; display: inline-block; max-width: none; font-family: Georgia, serif; font-size: 16px; font-weight: 900; line-height: 1; white-space: nowrap; transform: translate(-50%,-50%); transform-origin: center; }
.spin-button:hover:not(:disabled) { transform: scale(1.06); filter: brightness(1.12); }
.spin-button:active:not(:disabled) { transform: scale(.97); }
.spin-button:disabled { cursor: wait; opacity: .62; filter: saturate(.55); }
.auto-button { height: 40px; border: 1px solid color-mix(in srgb, var(--primary), transparent 65%); border-radius: 9px; background: rgba(3,5,9,.78); color: rgba(255,255,255,.68); font-size: 9px; font-weight: 800; letter-spacing: .07em; cursor: pointer; transition: .2s; }
.auto-button:hover, .auto-button.active { border-color: var(--primary); color: var(--accent); box-shadow: 0 0 16px color-mix(in srgb, var(--glow), transparent 78%); }
.auto-icon { margin-right: 5px; font-size: 15px; }
@keyframes reelBlur { 0% { transform: translateY(-4px); filter: blur(0); } 50% { transform: translateY(5px); filter: blur(3px); } 100% { transform: translateY(-4px); filter: blur(0); } }
@keyframes winLift { from { transform: translateY(-4px) scale(1.035); filter: brightness(1.08); } to { transform: translateY(-9px) scale(1.085); filter: brightness(1.24); } }
@keyframes overlayEnter { from { opacity: 0; transform: translate(-50%, -42%) scale(.75); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes screenFlash { 0%,100% { opacity: 0; } 35% { opacity: .34; } }
@keyframes celebrationShake { 0%,100% { transform: translateX(0); } 30% { transform: translateX(-3px); } 70% { transform: translateX(3px); } }
@keyframes megaText { to { transform: scale(1.055); filter: brightness(1.25); } }
@keyframes particleFall { 0% { opacity: 0; transform: translate3d(0,-10px,0) rotate(0); } 12% { opacity: 1; } 100% { opacity: 0; transform: translate3d(var(--drift),560px,0) rotate(420deg); } }
@media (min-width: 900px) {
  .slot-machine { width: 94%; margin-inline: auto; }
  .controls { width: min(99%, 1120px); min-height: 96px; padding: 16px 22px; grid-template-columns: 1fr 138px 132px 140px 1fr; gap: 16px; }
  .meter, .bet-control { padding-inline: 13px; }
  .meter, .bet-control { height: 72px; }
  .meter > span, .bet-control > span { left: 13px; right: 13px; }
  .meter > span, .bet-control > span { font-size: 10px; }
  .meter strong { gap: 9px; margin-top: 0; font-size: 22px; }
  .crystal-icon { width: 14px; height: 14px; }
  .bet-control select { min-height: 44px; padding: 9px 12px; font-size: 16px; }
  .spin-button { width: 88px; height: 70px; }
  .spin-button span { font-size: 18px; }
  .auto-button { height: 48px; font-size: 11px; }
  .auto-icon { font-size: 18px; }
}
@media (max-width: 760px) {
  .game-shell { padding: 8px 6px; }
  .game-content { gap: 8px; }
  .game-content.has-custom-frame .game-header { top: calc(-30px - var(--effective-title-offset-y)); }
  .game-content.has-custom-frame .slot-machine { top: calc(-14px - var(--effective-slot-offset-y)); }
  .game-header h1 { font-size: clamp(20px, 7vw, 29px); }
  .game-title-image { width: min(var(--effective-title-image-width), var(--effective-title-image-max-width)); height: clamp(var(--effective-title-image-min-height), var(--effective-title-image-fluid-height), var(--effective-title-image-max-height)); }
  .slot-machine { padding: 3px; border-radius: 11px; }
  .reels-window { height: auto; border-radius: 8px; }
  .reels { padding: 1px; }
  .symbol { padding: 0; }
  .controls { width: 100%; min-height: 82px; padding: 8px 5px; grid-template-columns: minmax(48px,1fr) 68px 70px 46px minmax(48px,1fr); gap: 4px 5px; border-radius: 12px; }
  .meter, .bet-control { padding: 0 4px; }
  .meter, .bet-control { height: 66px; }
  .meter > span, .bet-control > span { left: 4px; right: 4px; }
  .meter > span, .bet-control > span { font-size: 7px; letter-spacing: .1em; }
  .meter strong { gap: 5px; margin-top: 0; font-size: 13px; }
  .crystal-icon { width: 11px; height: 11px; }
  .bet-control select { width: 100%; height: 38px; min-height: 38px; margin-top: 0; padding: 5px 4px; font-size: 14px; }
  .spin-button { width: 64px; height: 54px; border-width: 1px; }
  .spin-button span { font-size: 14px; }
  .auto-button { height: 38px; font-size: 0; }
  .auto-icon { margin: 0; font-size: 18px; }
  .win-overlay { padding: 0; }
  .win-title { font-size: clamp(27px, 10vw, 42px); }
  .win-amount { font-size: 18px; }
}
@media (max-width: 380px) {
  .game-shell { padding-inline: 5px; }
  .controls { grid-template-columns: minmax(44px,1fr) 64px 62px 44px minmax(44px,1fr); }
  .spin-button { width: 60px; height: 50px; }
  .meter strong { font-size: 12px; }
}
@media (max-height: 620px) and (max-width: 760px) {
  .game-shell { padding-block: 5px; }
  .game-content { gap: 6px; }
  .game-header h1 { font-size: clamp(18px, 5dvh, 30px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
