@font-face {
  font-family: "Lato";
  src: url("fonts/Lato-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Lato";
  src: url("fonts/Lato-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Lato";
  src: url("fonts/Lato-Black.ttf") format("truetype");
  font-weight: 900;
  font-display: swap;
}
@font-face {
  font-family: "Liberation Serif";
  src: url("fonts/LiberationSerif-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "DejaVu Sans";
  src: url("fonts/DejaVuSans.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "DejaVu Sans";
  src: url("fonts/DejaVuSans-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --gold: #f3d48a;
  --gold-deep: #8d6420;
  --ink: #fff8e8;
  --muted: #d9c79a;
  --navy: #050814;
  --chrome: 268px;
  --side: 108px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  min-height: 100svh;
  overflow: hidden;
  font-family: Lato, "DejaVu Sans", sans-serif;
  color: var(--ink);
  background: var(--navy);
}
button { font: inherit; touch-action: manipulation; }
:focus-visible { outline: 2px solid #ffe7a8; outline-offset: 3px; }
[hidden] { display: none !important; }

.atmosphere { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(30px);
  opacity: 0.85;
}
.glow-gold {
  width: 70vw;
  height: 46vh;
  left: 15vw;
  bottom: -8vh;
  background: radial-gradient(circle, rgba(196, 140, 42, 0.34), transparent 68%);
  animation: drift 16s ease-in-out infinite alternate;
}
.glow-blue {
  width: 54vw;
  height: 40vh;
  left: 23vw;
  top: -12vh;
  background: radial-gradient(circle, rgba(48, 104, 196, 0.38), transparent 70%);
  animation: drift 22s ease-in-out infinite alternate-reverse;
}
.columns {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 7%, rgba(255, 220, 150, 0.035) 7.2% 7.5%, transparent 7.8% 18%, rgba(255, 220, 150, 0.03) 18.2%, transparent 18.6%),
    linear-gradient(90deg, transparent 78%, rgba(120, 170, 255, 0.05) 78.3%, transparent 79% 100%);
  mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent);
}
.vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 46%, transparent 42%, rgba(0, 0, 0, 0.45) 100%),
    radial-gradient(rgba(255, 226, 160, 0.14) 0.6px, transparent 0.7px);
  background-size: auto, 18px 18px;
  opacity: 0.55;
}
@keyframes drift {
  from { transform: translate3d(-2%, 0, 0) scale(1); }
  to { transform: translate3d(2%, 1.5%, 0) scale(1.06); }
}

#loader {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  background: radial-gradient(circle at 50% 40%, #16305a, #05070f 72%);
  transition: opacity 0.45s ease;
}
#loader.hide { opacity: 0; pointer-events: none; }
#loader img { width: min(280px, 68vw); filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.45)); }
.loader-title { margin: 0; letter-spacing: 0.28em; font-size: 13px; color: var(--gold); }
.loader-track { width: min(240px, 60vw); height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
#load-bar { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #8a6424, #ffe7a8); }

#app.booting { visibility: hidden; }
.stage {
  position: relative;
  z-index: 1;
  height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding:
    max(8px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
}

.brand {
  width: min(96vw, calc((100svh - var(--chrome)) * 5 / 3 + var(--side)));
  display: flex;
  align-items: center;
  gap: 12px;
}
.app-mark {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(243, 212, 138, 0.45);
}
.brand-copy { flex: 1; min-width: 0; }
.eyebrow {
  margin: 0;
  letter-spacing: 0.34em;
  font-size: 11px;
  color: var(--gold);
}
.brand h1 {
  margin: 0;
  font-family: "Liberation Serif", "DejaVu Sans", serif;
  font-size: clamp(22px, 2.4vw, 36px);
  letter-spacing: 0.12em;
  background: linear-gradient(180deg, #fff6d4, #e2b85a 55%, #a9782a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
html[dir="rtl"] .brand h1 { letter-spacing: 0; font-family: "DejaVu Sans", Lato, sans-serif; }
.lang {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: #3c2a0c;
  font-weight: 700;
  background: linear-gradient(180deg, #fff1c4, #e0b45a);
  box-shadow: 0 4px 0 #6a4c16, inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.cabinet {
  position: relative;
  width: min(96vw, calc((100svh - var(--chrome)) * 5 / 3 + var(--side)));
  padding: 14px 14px 12px;
  border-radius: 34px;
  background:
    linear-gradient(180deg, rgba(255, 228, 170, 0.2), transparent 14%),
    linear-gradient(180deg, #3a2d16 0%, #16110c 8%, #0c121c 22%, #070b14 100%);
  box-shadow:
    0 0 0 1px #f0d48a,
    0 0 0 8px #1a140c,
    0 0 0 10px #b89045,
    0 0 0 12px #5c4316,
    0 30px 70px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 244, 214, 0.45);
}
.cabinet::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 236, 190, 0.85) 48%, transparent 62%);
  background-size: 220% 100%;
  animation: sweep 6.5s linear infinite;
  pointer-events: none;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}
@keyframes sweep { to { background-position: -220% 0; } }

.marquee {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
  min-height: 28px;
}
.marquee strong {
  font-family: "Liberation Serif", Georgia, serif;
  letter-spacing: 0.22em;
  font-size: clamp(16px, 1.6vw, 22px);
  color: #ffe7ad;
  text-shadow: 0 0 12px rgba(255, 196, 80, 0.45);
}
.marquee em {
  font-style: normal;
  letter-spacing: 0.28em;
  font-size: 11px;
  color: var(--muted);
}
html[dir="rtl"] .marquee em { letter-spacing: 0.04em; font-family: "DejaVu Sans", Lato, sans-serif; }
.lamp {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #ffd36a 40%, #a86b16);
  box-shadow: 0 0 8px #ffcf70;
  animation: blink 1.8s ease-in-out infinite;
}
.lamp:nth-child(2) { animation-delay: 0.25s; }
.lamp:nth-child(3) { animation-delay: 0.5s; }
.lamp:nth-child(6) { animation-delay: 0.15s; }
.lamp:nth-child(7) { animation-delay: 0.4s; }
@keyframes blink { 50% { opacity: 0.45; } }

.reel-frame {
  position: relative;
  padding: 12px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 0%, rgba(120, 170, 255, 0.18), transparent 46%),
    linear-gradient(180deg, #10182a, #070b14);
  box-shadow:
    inset 0 0 0 1px rgba(240, 212, 138, 0.35),
    inset 0 18px 28px rgba(0, 0, 0, 0.45),
    0 0 24px rgba(80, 130, 220, 0.12);
}
.bracket {
  position: absolute;
  width: 22px;
  height: 22px;
  z-index: 3;
  pointer-events: none;
  border: 2px solid #f3d48a;
  filter: drop-shadow(0 0 4px rgba(255, 210, 120, 0.7));
}
.tl { top: 6px; left: 6px; border-right: 0; border-bottom: 0; }
.tr { top: 6px; right: 6px; border-left: 0; border-bottom: 0; }
.bl { bottom: 6px; left: 6px; border-right: 0; border-top: 0; }
.br { bottom: 6px; right: 6px; border-left: 0; border-top: 0; }

.reels {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.reel-window {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 3;
  min-height: 0;
  overflow: hidden;
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.45), transparent 12%, transparent 88%, rgba(0, 0, 0, 0.45)),
    #03060e;
  box-shadow:
    inset 0 0 0 1px rgba(243, 212, 138, 0.32),
    inset 0 16px 22px rgba(0, 0, 0, 0.55),
    inset 0 -16px 18px rgba(0, 0, 0, 0.4);
}
.reel-window::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 22%, transparent 62%, rgba(0, 0, 0, 0.32));
}
.reel-window.spinning .strip { filter: blur(1.15px); }
.reel-window.landed { box-shadow: inset 0 0 0 1px rgba(255, 220, 140, 0.85), inset 0 0 22px rgba(255, 196, 80, 0.28); }
.strip { position: absolute; left: 0; right: 0; top: 0; width: 100%; will-change: transform; }
.symbol { display: grid; place-items: center; padding: 1.2%; }
.symbol img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  user-select: none;
  -webkit-user-drag: none;
}
.symbol.is-win img { animation: winGlow 0.8s ease-in-out infinite; }
@keyframes winGlow { 50% { filter: drop-shadow(0 0 12px #ffe08a) brightness(1.16); } }

.paylines, #fx, .win-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.paylines { overflow: visible; z-index: 2; }
.paylines polyline {
  fill: none;
  stroke: #ffe7a3;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px #ffd56a);
}
.win-overlay {
  z-index: 4;
  display: grid;
  place-items: center;
  pointer-events: auto;
  background: linear-gradient(180deg, rgba(4, 8, 18, 0.02), rgba(4, 8, 18, 0.18));
}
.win-card { text-align: center; }
.win-card p { margin: 0; }
#win-kicker {
  font-family: "Liberation Serif", "DejaVu Sans", serif;
  letter-spacing: 0.14em;
  font-size: clamp(32px, 5vw, 72px);
  color: #fff4cc;
  text-shadow: 0 8px 18px rgba(0, 0, 0, 0.55), 0 0 18px rgba(255, 208, 96, 0.75);
}
html[dir="rtl"] #win-kicker { letter-spacing: 0; font-family: "DejaVu Sans", Lato, sans-serif; }
.win-card.big #win-kicker { font-size: clamp(40px, 6vw, 84px); }
.win-card.mega #win-kicker {
  color: #f6e6ff;
  text-shadow: 0 0 18px #c084fc, 0 0 28px #ffd978, 0 8px 18px rgba(0, 0, 0, 0.55);
}
#win-amount {
  font-weight: 900;
  font-size: clamp(28px, 4vw, 52px);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 16px rgba(255, 214, 120, 0.45);
}
.skip-hint { margin-top: 6px !important; letter-spacing: 0.14em; font-size: 12px; color: var(--muted); }
.reel-frame.win-big { box-shadow: inset 0 0 46px rgba(255, 196, 70, 0.2), inset 0 0 0 1px rgba(255, 220, 140, 0.5); }
.reel-frame.win-mega { box-shadow: inset 0 0 52px rgba(176, 92, 255, 0.28), inset 0 0 0 1px rgba(240, 190, 255, 0.45); }

.console {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: center;
}
.meter-row { display: flex; gap: 8px; }
.meter {
  min-width: 124px;
  flex: 1;
  padding: 8px 14px 7px;
  border-radius: 16px;
  background: linear-gradient(180deg, #182033, #070b12);
  box-shadow: inset 0 0 0 1px rgba(243, 212, 138, 0.38), inset 0 10px 16px rgba(0, 0, 0, 0.45);
}
.meter span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
html[dir="rtl"] .meter span { letter-spacing: 0.04em; text-transform: none; font-family: "DejaVu Sans", Lato, sans-serif; }
.meter strong {
  display: block;
  font-size: clamp(22px, 2vw, 32px);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  text-shadow: 0 0 10px rgba(255, 220, 140, 0.25);
}
.meter-win strong { color: #ffe7ad; }
.bet-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.step, .icon-btn, .reset {
  border: 0;
  color: #3c2a0c;
  background: linear-gradient(180deg, #fff1c4, #e0b45a);
  cursor: pointer;
}
.step {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  box-shadow: 0 3px 0 #6a4c16;
}
.step:disabled, .spin:disabled { cursor: default; filter: grayscale(0.35) brightness(0.72); }
.spin-wrap { position: relative; display: grid; justify-items: center; }
.spin {
  width: 128px;
  height: 128px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: #3a2808;
  font-weight: 900;
  letter-spacing: 0.12em;
  font-size: 20px;
  background:
    radial-gradient(circle at 32% 28%, #fff8dc, #f6de9a 28%, #d7a84a 58%, #8a5e16 100%);
  box-shadow:
    0 0 0 8px #3a2a10,
    0 0 0 11px #e7c56a,
    0 10px 0 #5a3d10,
    0 18px 28px rgba(0, 0, 0, 0.45),
    inset 0 2px 0 rgba(255, 255, 255, 0.8);
  transition: transform 0.12s ease, filter 0.12s ease;
}
html[dir="rtl"] .spin { letter-spacing: 0; font-family: "DejaVu Sans", Lato, sans-serif; font-size: 22px; }
.spin:not(:disabled):hover { transform: translateY(-2px); filter: brightness(1.06); }
.spin:not(:disabled):active { transform: translateY(6px); box-shadow: 0 0 0 8px #3a2a10, 0 0 0 11px #e7c56a, 0 3px 0 #5a3d10, inset 0 2px 0 rgba(255, 255, 255, 0.7); }
.spin-wrap::before {
  content: "";
  position: absolute;
  width: 154px;
  height: 154px;
  border-radius: 50%;
  top: -13px;
  background: conic-gradient(from 20deg, transparent, rgba(255, 236, 180, 0.95), transparent 32%, transparent 68%, rgba(255, 210, 110, 0.75), transparent);
  animation: sheen 4.8s linear infinite;
  z-index: -1;
}
@keyframes sheen { to { transform: rotate(1turn); } }
.broke {
  position: absolute;
  top: calc(100% + 6px);
  width: max-content;
  max-width: 240px;
  margin: 0;
  text-align: center;
  font-size: 12px;
  color: #ffd0d0;
}
.side-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
  box-shadow: 0 4px 0 #6a4c16;
}
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: #3c2a0c; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.icon-btn.is-muted .wave { display: none; }
.disclaimer {
  grid-column: 1 / -1;
  margin: -4px 0 0;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(217, 199, 154, 0.82);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 4, 10, 0.72);
  backdrop-filter: blur(8px);
}
.sheet {
  width: min(760px, 100%);
  max-height: min(86dvh, 860px);
  overflow: auto;
  position: relative;
  padding: 26px 22px 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(28, 36, 58, 0.96), rgba(10, 14, 24, 0.96));
  box-shadow: 0 0 0 1px rgba(243, 212, 138, 0.5), 0 24px 60px rgba(0, 0, 0, 0.5);
}
.sheet h2, .sheet h3 { font-family: "Liberation Serif", "DejaVu Sans", serif; margin: 0 0 8px; }
html[dir="rtl"] .sheet h2, html[dir="rtl"] .sheet h3 { font-family: "DejaVu Sans", Lato, sans-serif; }
.sheet p { color: #e7dcc2; line-height: 1.5; }
.close { position: absolute; top: 12px; inset-inline-end: 12px; }
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.roster-card { padding: 8px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); text-align: center; }
.roster-card img { width: 78px; height: 78px; border-radius: 50%; object-fit: cover; }
.roster-card strong, .roster-card span { display: block; }
.roster-card strong { font-size: 13px; margin-top: 6px; }
.roster-card span { color: var(--muted); font-size: 12px; }
.reset { margin-top: 14px; border-radius: 999px; padding: 12px 18px; font-weight: 700; }

@media (max-height: 980px) and (min-width: 761px) {
  .brand {
    position: absolute;
    top: max(8px, env(safe-area-inset-top));
    inset-inline-start: 14px;
    width: auto;
    z-index: 5;
  }
  .brand-copy { display: none; }
  .lang {
    position: absolute;
    top: max(8px, env(safe-area-inset-top));
    inset-inline-end: 14px;
  }
  .stage { padding-top: 8px; }
}

@media (min-width: 761px) and (min-height: 981px) {
  .brand {
    position: absolute;
    top: max(10px, env(safe-area-inset-top));
    inset-inline-start: 18px;
    width: auto;
    z-index: 5;
  }
  .brand-copy { display: none; }
  .lang {
    position: absolute;
    top: max(10px, env(safe-area-inset-top));
    inset-inline-end: 18px;
  }
}

@media (max-width: 760px) {
  :root { --chrome: 168px; }
  .brand { width: 100%; }
  .app-mark { width: 46px; height: 46px; }
  .brand h1 { font-size: 20px; letter-spacing: 0.06em; }
  .cabinet { width: 100%; border-radius: 24px; padding: 10px; }
  .marquee em { display: none; }
  .reels { gap: 4px; }
  .console {
    grid-template-columns: 1fr auto;
    grid-template-areas: "meters meters" "spin actions";
    gap: 10px;
  }
  .meter-row { grid-area: meters; }
  .spin-wrap { grid-area: spin; justify-self: center; }
  .side-actions { grid-area: actions; align-self: center; }
  .meter { min-width: 0; padding: 7px 8px; }
  .meter strong { font-size: 18px; }
  .spin { width: 104px; height: 104px; font-size: 18px; }
  .spin-wrap::before { width: 126px; height: 126px; top: -11px; }
  .broke { position: static; margin-top: 4px; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .stage { flex-direction: row; align-items: stretch; gap: 10px; height: 100svh; overflow: hidden; padding: 16px; }
  .brand { position: static; width: 72px; flex-direction: column; justify-content: center; }
  .lang { position: static; }
  .brand-copy, .eyebrow { display: none; }
  .cabinet {
    width: auto;
    flex: 1;
    min-width: 0;
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 168px;
    grid-template-rows: auto minmax(0, 1fr);
    column-gap: 10px;
  }
  .marquee { grid-column: 1 / -1; margin: 0; }
  .reel-frame { min-height: 0; }
  .reels, .reel-window { height: 100%; }
  .reel-window { aspect-ratio: auto; }
  .console {
    grid-column: 2;
    grid-row: 2;
    grid-template-columns: 1fr;
    align-content: center;
  }
  .meter-row, .side-actions { flex-direction: column; }
  .spin { width: 84px; height: 84px; box-shadow: 0 0 0 6px #3a2a10, 0 0 0 8px #e7c56a, 0 6px 0 #5a3d10; }
  .spin-wrap::before { width: 104px; height: 104px; top: -10px; }
  .icon-btn { width: 36px; height: 36px; box-shadow: 0 3px 0 #6a4c16; }
  .side-actions { flex-direction: row; justify-content: center; }
  .meter { padding: 4px 8px; }
  .meter strong { font-size: 16px; }
  .disclaimer { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .glow-gold, .glow-blue, .cabinet::after, .spin-wrap::before, .lamp, .symbol.is-win img { animation: none; }
  .reel-window.spinning .strip { filter: none; }
}
