/* ============================================================
   ROYAL SCATTER — card scatter slot demo (portfolio only)
   Dark premium theme · gold accents · deep red secondary
   Mobile-first · virtual credits only
   ============================================================ */

:root {
  --bg: #0C0A08;
  --bg-2: #16110B;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.07);
  --border: rgba(245, 194, 74, 0.20);
  --border-soft: rgba(255, 255, 255, 0.10);
  --text: #F3EBDC;
  --muted: #9C917E;
  --gold: #F5C24A;
  --gold-2: #FFE3A1;
  --gold-dim: rgba(245, 194, 74, 0.14);
  --red: #B32740;
  --red-2: #E04848;
  --card-red: #D64545;
  --card-black: #262A34;
  --grad-gold: linear-gradient(100deg, #8A5A14, #F5C24A 45%, #FFE3A1);
  --grad-red: linear-gradient(120deg, #5E0F1E, #B32740);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Space Grotesk", "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  --card-w: clamp(50px, 16vw, 92px);
  --gap: clamp(5px, 1.2vw, 10px);
  --rows: 4;
  --cell-h: 160px; /* set by JS after measure */
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font);
  background:
    radial-gradient(70% 50% at 50% -10%, rgba(245, 194, 74, 0.10), transparent 60%),
    radial-gradient(55% 45% at 105% 15%, rgba(179, 39, 64, 0.14), transparent 60%),
    radial-gradient(50% 40% at -5% 80%, rgba(245, 194, 74, 0.05), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
.mono { font-family: var(--mono); }
.gold { color: var(--gold); }
.muted { color: var(--muted); }
.small { font-size: 0.78rem; }

.app {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100dvh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(0.6rem, 2.5vw, 1.5rem) calc(0.8rem + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ================= FLOATING SUITS BACKGROUND ================= */
.bg-suits {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.bg-suits span {
  position: absolute;
  bottom: -70px;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
  color: rgba(245, 194, 74, 0.11);
  text-shadow: 0 0 18px rgba(245, 194, 74, 0.14);
  animation: bgSuitFloat linear infinite;
  will-change: transform, opacity;
}
.bg-suits span.d {
  color: rgba(224, 72, 72, 0.11);
  text-shadow: 0 0 18px rgba(224, 72, 72, 0.14);
}
@keyframes bgSuitFloat {
  0%   { transform: translateY(0) rotate(-8deg); opacity: 0; }
  12%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { transform: translateY(-115vh) rotate(12deg); opacity: 0; }
}

/* ================= LOADING SCREEN ================= */
.loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  background: radial-gradient(80% 60% at 50% 30%, rgba(245, 194, 74, 0.09), transparent 60%), var(--bg);
  transition: opacity 0.5s var(--ease);
}
.loader.hide { opacity: 0; pointer-events: none; }
.loader-mark { position: relative; width: 96px; height: 96px; display: grid; place-items: center; animation: lmFloat 2.4s ease-in-out infinite; }
.lm-suit { position: absolute; font-size: 3.2rem; color: var(--gold); text-shadow: 0 0 24px rgba(245, 194, 74, 0.6); }
.lm-suit.lm-d { transform: translate(26px, 22px) rotate(18deg); font-size: 2.2rem; color: var(--red-2); }
.lm-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(245, 194, 74, 0.4); border-top-color: var(--gold); animation: lmSpin 1.6s linear infinite; }
@keyframes lmFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes lmSpin { to { transform: rotate(360deg); } }
.loader-title { font-size: clamp(1.6rem, 7vw, 2.4rem); letter-spacing: 0.18em; font-weight: 700; }
.loader-title em { font-style: normal; background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.loader-sub { font-size: 0.72rem; letter-spacing: 0.3em; color: var(--muted); }
.loader-bar { width: min(240px, 70vw); height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.loader-bar span { display: block; height: 100%; width: 0%; border-radius: inherit; background: var(--grad-gold); transition: width 0.2s linear; box-shadow: 0 0 14px rgba(245, 194, 74, 0.7); }
.loader-pct { font-size: 0.72rem; color: var(--gold); letter-spacing: 0.2em; }

/* ================= TOP BAR ================= */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: max(0.65rem, env(safe-area-inset-top)) 0 0.6rem;
}
.back {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  white-space: nowrap;
  transition: color 0.25s, border-color 0.25s;
}
.back:hover { color: var(--gold); border-color: var(--gold); }
.logo { font-weight: 700; letter-spacing: 0.14em; font-size: clamp(0.95rem, 3.4vw, 1.35rem); white-space: nowrap; }
.logo-crown { color: var(--gold); margin-right: 0.2rem; }
.logo em { font-style: normal; background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.top-actions { display: flex; gap: 0.4rem; }
.icon-btn {
  width: 42px; height: 42px;
  min-height: 42px;
  display: grid; place-items: center;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  font-size: 1.02rem;
  color: var(--muted);
  transition: color 0.25s, border-color 0.25s, transform 0.2s;
}
.icon-btn:hover { color: var(--gold); border-color: var(--gold); }
.icon-btn:active { transform: scale(0.92); }

/* ================= HUD ================= */
.hud {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0.5rem 0 0.6rem;
}
.hud-cell {
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--surface);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.hud-label { font-size: 0.6rem; letter-spacing: 0.22em; color: var(--muted); }
.hud-value { font-size: clamp(1.05rem, 4.5vw, 1.45rem); font-weight: 700; font-variant-numeric: tabular-nums; }
.hud-demo {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  line-height: 1.6;
  color: var(--gold);
  border-color: rgba(245, 194, 74, 0.28);
  background: var(--gold-dim);
}

/* ================= REEL STAGE ================= */
.stage { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.reels-wrap { position: relative; isolation: isolate; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: clamp(0.6rem, 2vw, 1.1rem); }
.reels-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 22px;
  padding: 1px;
  background: linear-gradient(120deg, rgba(245, 194, 74, 0.55), transparent 30%, transparent 70%, rgba(179, 39, 64, 0.5));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.reels-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 22px;
  background:
    radial-gradient(80% 70% at 50% 0%, rgba(245, 194, 74, 0.07), transparent 60%),
    linear-gradient(180deg, var(--bg-2), #0D0A07);
  z-index: -1;
}
.reels {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--gap);
  perspective: 900px;
}
.reel {
  position: relative;
  width: var(--card-w);
  height: calc(var(--cell-h) * var(--rows));
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 0 0 1px rgba(245, 194, 74, 0.14), inset 0 0 18px rgba(0, 0, 0, 0.6), 0 10px 26px -12px rgba(0, 0, 0, 0.85);
}
.strip { will-change: transform; }
.cell {
  width: var(--card-w);
  height: var(--cell-h);
  display: grid;
  place-items: center;
  padding: clamp(3px, 0.6vw, 6px);
}
.cell-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}
/* winning / scatter highlights */
.cell.win-cell .cell-img {
  box-shadow: 0 0 0 2.5px var(--gold), 0 0 22px rgba(245, 194, 74, 0.75);
  animation: winPulse 1s ease-in-out infinite;
}
@keyframes winPulse {
  0%, 100% { box-shadow: 0 0 0 2.5px var(--gold), 0 0 14px rgba(245, 194, 74, 0.5); }
  50% { box-shadow: 0 0 0 2.5px var(--gold), 0 0 30px rgba(245, 194, 74, 0.95); }
}
.cell.scatter-cell .cell-img { box-shadow: 0 0 0 2.5px var(--red-2), 0 0 24px rgba(224, 72, 72, 0.8); }

/* golden card (wild) — gold border + shimmer overlay */
.cell.gold { position: relative; }
.cell.gold .cell-img {
  box-shadow: 0 0 0 2.5px #F5C24A, 0 0 20px rgba(245, 194, 74, 0.55), inset 0 0 14px rgba(245, 194, 74, 0.45);
  animation: goldShimmer 2.2s ease-in-out infinite;
}
@keyframes goldShimmer {
  0%, 100% { filter: brightness(1) saturate(1.05); }
  50% { filter: brightness(1.18) saturate(1.25); }
}
.gold-badge {
  position: absolute;
  top: 4%;
  right: 5%;
  width: 22%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  color: #5C3A00;
  background: radial-gradient(circle at 35% 28%, #FFE9A8, #F5C24A 55%, #8A5A14 100%);
  border: 1px solid #FFE3A1;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(245, 194, 74, 0.8);
  z-index: 2;
  pointer-events: none;
}

/* suit symbols (low pays) — spade/heart & diamond/club, like the real game */
.suit-tile {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(165deg, #FDFBF5, #E9E0CE);
  border: 1px solid #C9BFA8;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.8);
}
.suit-tile.red { background: linear-gradient(165deg, #FFF6F2, #F6DDD2); border-color: #D9B3A5; }
.suit-glyph {
  font-size: clamp(1.3rem, 5vw, 2.2rem);
  line-height: 1;
  color: var(--card-black);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.6);
}
.suit-tile.red .suit-glyph { color: var(--card-red); }
.cell.gold .suit-tile {
  border-color: #F5C24A;
  box-shadow: 0 0 0 2.5px #F5C24A, 0 0 20px rgba(245, 194, 74, 0.55);
  animation: goldShimmer 2.2s ease-in-out infinite;
}
.suit-pt { font-size: 1.05rem; letter-spacing: 0.04em; }
.suit-pt .glyph { }

/* fallback card (missing asset) */
.fb-card {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  background: linear-gradient(160deg, #FDFBF5, #EDE6D8);
  border: 1px solid #C9BFA8;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.8);
}
.fb-rank { font-weight: 700; font-size: clamp(0.9rem, 3vw, 1.4rem); color: var(--card-black); }
.fb-rank.red, .fb-suit.red { color: var(--card-red); }
.fb-suit { font-size: clamp(0.8rem, 2.6vw, 1.2rem); color: var(--card-black); }

/* scatter symbol — original golden ACE emblem (CSS-only, not copied artwork) */
.scatter {
  position: relative;
  width: 86%;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 28%, #FFE9A8, #F5C24A 45%, #8A5A14 100%);
  border: 2px solid #FFE3A1;
  box-shadow: 0 0 18px rgba(245, 194, 74, 0.75), inset 0 -6px 14px rgba(90, 55, 0, 0.45), inset 0 4px 10px rgba(255, 255, 255, 0.5);
  animation: scatterPulse 1.6s ease-in-out infinite;
}
.scatter::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px dashed rgba(245, 194, 74, 0.75);
  animation: scatterSpin 7s linear infinite;
}
.scatter::after {
  content: "";
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #FFE9A8;
  box-shadow: 0 0 8px rgba(255, 233, 168, 0.9);
  top: 8%; right: 16%;
  animation: scatterSpin 3s linear infinite;
}
.scatter-core {
  font-family: var(--font);
  font-weight: 700;
  font-size: clamp(1.4rem, 5.2vw, 2.3rem);
  line-height: 1;
  color: #5C3A00;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.55);
  animation: scatterSpin 11s linear infinite;
}
.scatter-crown {
  position: absolute;
  top: 7%;
  font-size: clamp(0.5rem, 1.8vw, 0.8rem);
  color: #FFE9A8;
  text-shadow: 0 0 6px rgba(90, 55, 0, 0.8);
}
.scatter-text {
  position: absolute;
  bottom: 12%;
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(0.34rem, 1.3vw, 0.55rem);
  letter-spacing: 0.06em;
  color: #4A2F00;
  background: rgba(255, 233, 168, 0.9);
  padding: 0.08rem 0.3rem;
  border-radius: 4px;
  white-space: nowrap;
}
@keyframes scatterPulse { 0%, 100% { transform: scale(1) rotate(0deg); filter: brightness(1); } 50% { transform: scale(1.07) rotate(2deg); filter: brightness(1.15); } }
@keyframes scatterSpin { to { transform: rotate(360deg); } }
.cell.scatter-cell .scatter { animation: scatterHit 0.9s ease-in-out infinite; box-shadow: 0 0 34px rgba(224, 72, 72, 0.9); }
@keyframes scatterHit {
  0%, 100% { transform: scale(1.05); }
  50% { transform: scale(1.18) rotate(4deg); }
}

/* cascade: winning symbols pop out, new ones fall in */
.cell.popping { animation: cellPop 0.3s var(--ease) forwards; }
@keyframes cellPop {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.35) translateY(-8px); opacity: 0; }
}
.cell.fall { animation: cellFall 0.42s var(--ease) both; }
@keyframes cellFall {
  from { transform: translateY(-110%) scale(0.92); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.win-banner {
  position: relative;
  min-height: 58px;
  margin: clamp(0.5rem, 1.6vw, 0.9rem) 0;
  padding: 0.6rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  text-align: center;
  transition: border-color 0.3s, background 0.3s;
}
.mult-chip {
  position: absolute;
  top: -0.55rem;
  right: -0.4rem;
  min-width: 34px;
  padding: 0.15rem 0.45rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #241500;
  background: var(--grad-gold);
  border-radius: 999px;
  box-shadow: 0 4px 14px -4px rgba(245, 194, 74, 0.7);
  animation: multPop 0.35s var(--ease) both;
  z-index: 2;
}
@keyframes multPop { from { transform: scale(0); } }
.win-banner.win { border-color: rgba(245, 194, 74, 0.55); background: var(--gold-dim); }
.win-banner.lose { border-color: rgba(255, 255, 255, 0.14); }
.wb-title { font-size: clamp(1rem, 4.2vw, 1.4rem); font-weight: 700; letter-spacing: 0.04em; color: var(--gold); }
.wb-title.lose { color: var(--muted); }
.wb-sub { font-size: 0.66rem; letter-spacing: 0.18em; color: var(--muted); }

/* free spins ribbon */
.fs-ribbon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin: clamp(0.5rem, 1.6vw, 0.9rem) 0;
  padding: 0.65rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(224, 72, 72, 0.5);
  background: linear-gradient(120deg, rgba(179, 39, 64, 0.22), rgba(245, 194, 74, 0.10));
  animation: fsGlow 1.8s ease-in-out infinite;
}
@keyframes fsGlow { 0%, 100% { box-shadow: 0 0 0 rgba(224, 72, 72, 0); } 50% { box-shadow: 0 0 22px rgba(224, 72, 72, 0.35); } }
.fs-label { font-size: 0.62rem; letter-spacing: 0.24em; color: var(--red-2); }
.fs-count { font-size: clamp(1.1rem, 4.5vw, 1.5rem); font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.fs-mult { font-size: 0.62rem; letter-spacing: 0.12em; color: var(--muted); text-align: center; }
.fs-mult b { display: block; font-size: 0.95rem; color: var(--gold); font-weight: 700; }
.fs-total { font-size: 0.62rem; letter-spacing: 0.12em; color: var(--muted); text-align: right; }
.fs-total b { display: block; font-size: 0.95rem; color: var(--gold); font-weight: 700; }

/* ================= CONTROLS ================= */
.controls {
  position: sticky;
  bottom: 0;
  z-index: 30;
  margin: 0 -0.6rem;
  padding: 0.6rem 0.6rem calc(0.7rem + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(12, 10, 8, 0), rgba(12, 10, 8, 0.94) 40%);
}
.bet-row { display: flex; gap: 0.5rem; align-items: stretch; }
.bet-btn, .max-btn {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 700;
  transition: border-color 0.2s, color 0.2s, transform 0.15s;
  display: grid;
  place-items: center;
}
.bet-btn { width: 56px; flex: 0 0 56px; }
.bet-btn:active { transform: scale(0.94); }
.bet-btn:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.bet-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.bet-display {
  flex: 1;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(245, 194, 74, 0.4);
  background: var(--gold-dim);
  color: var(--gold);
  font-size: clamp(1.15rem, 5vw, 1.5rem);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-variant-numeric: tabular-nums;
}
.bet-cap { font-size: 0.6rem; letter-spacing: 0.2em; color: var(--muted); font-weight: 600; margin-right: 0.2rem; }
.max-btn { flex: 0 0 auto; padding: 0 0.9rem; font-size: 0.72rem; letter-spacing: 0.14em; font-weight: 700; }
.max-btn:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.max-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.spin-row { display: flex; gap: 0.6rem; margin-top: 0.55rem; }
.auto-btn {
  flex: 0 0 auto;
  width: 108px;
  min-height: 58px;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.auto-btn:hover:not(:disabled) { color: var(--gold); border-color: var(--gold); }
.auto-btn.stop { color: #fff; border-color: var(--red-2); background: rgba(179, 39, 64, 0.25); }
.auto-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.buy-btn {
  flex: 0 0 auto;
  width: 104px;
  min-height: 58px;
  border-radius: 16px;
  border: 1px solid rgba(245, 194, 74, 0.6);
  background: linear-gradient(180deg, rgba(245, 194, 74, 0.16), rgba(179, 39, 64, 0.12));
  color: var(--gold);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.1rem;
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.15s;
}
.buy-cost { font-size: 0.62rem; letter-spacing: 0.06em; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.buy-btn:hover:not(:disabled) { background: linear-gradient(180deg, rgba(245, 194, 74, 0.28), rgba(179, 39, 64, 0.2)); box-shadow: 0 0 18px rgba(245, 194, 74, 0.25); }
.buy-btn:active { transform: scale(0.96); }
.buy-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.spin-btn {
  flex: 1;
  min-height: 58px;
  border-radius: 16px;
  background: var(--grad-gold);
  color: #241500;
  font-weight: 700;
  font-size: clamp(1.15rem, 5vw, 1.6rem);
  letter-spacing: 0.18em;
  box-shadow: 0 10px 30px -8px rgba(245, 194, 74, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.15s, box-shadow 0.25s, filter 0.25s;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}
.spin-btn:active { transform: scale(0.97); }
.spin-btn:not(:disabled):hover { box-shadow: 0 14px 38px -8px rgba(245, 194, 74, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.spin-btn:disabled { filter: grayscale(0.6) brightness(0.55); cursor: not-allowed; }

.util-row { display: flex; gap: 0.5rem; margin-top: 0.55rem; }
.util {
  flex: 1;
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  transition: color 0.2s, border-color 0.2s;
}
.util:hover { color: var(--gold); border-color: var(--gold); }
.util:disabled { opacity: 0.4; cursor: not-allowed; }

/* ================= FOOTER ================= */
.foot {
  margin-top: 1.1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border-soft);
  text-align: center;
  display: grid;
  gap: 0.3rem;
}
.foot-main { font-size: 0.62rem; letter-spacing: 0.2em; color: var(--gold); }
.foot-sub { font-size: 0.6rem; letter-spacing: 0.14em; color: var(--muted); }

/* ================= MODALS ================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(4, 3, 2, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 1rem;
  animation: fadeIn 0.25s var(--ease) both;
  overflow-y: auto;
}
.modal[hidden], .overlay[hidden], .toast:empty, [hidden] { display: none !important; }
@keyframes fadeIn { from { opacity: 0; } }
.modal-card {
  width: min(520px, 100%);
  max-height: min(84dvh, 640px);
  overflow-y: auto;
  padding: 1.2rem 1.3rem;
  background: linear-gradient(170deg, #171310, #0E0B08);
  border: 1px solid rgba(245, 194, 74, 0.3);
  border-radius: 22px;
  box-shadow: 0 40px 120px -40px rgba(0, 0, 0, 0.95);
  animation: popIn 0.32s var(--ease) both;
}
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.9rem; }
.modal-head h2 { font-size: 1.25rem; letter-spacing: 0.12em; color: var(--gold); }
.modal-x {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 0.95rem;
  transition: color 0.2s, border-color 0.2s;
}
.modal-x:hover { color: var(--gold); border-color: var(--gold); }
.modal-body { display: grid; gap: 0.4rem; }
.section-cap { font-size: 0.66rem; letter-spacing: 0.22em; color: var(--muted); }

/* paytable */
.pt-table { display: grid; gap: 0.35rem; }
.pt-row {
  display: grid;
  grid-template-columns: 2.6fr 1fr 1fr 1fr;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
}
.pt-row.head { font-size: 0.62rem; letter-spacing: 0.16em; color: var(--muted); background: transparent; border-color: transparent; }
.pt-sym { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 0.9rem; }
.pt-sym img { width: 26px; height: 37px; object-fit: cover; border-radius: 4px; box-shadow: 0 3px 8px -3px rgba(0, 0, 0, 0.8); }
.pt-cell { text-align: center; font-family: var(--mono); font-size: 0.78rem; color: var(--gold); }
.pt-row.head .pt-cell { color: var(--muted); font-size: 0.62rem; }
.pt-scatter { display: grid; gap: 0.35rem; }
.pt-srow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  background: rgba(179, 39, 64, 0.14);
  border: 1px solid rgba(224, 72, 72, 0.3);
  font-size: 0.85rem;
}
.pt-srow b { color: var(--gold); }
.pt-lines { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.35rem; }
.pt-line {
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  color: var(--muted);
}

/* settings */
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.7rem 0.2rem;
  border-bottom: 1px solid var(--border-soft);
}
.set-name { font-size: 0.92rem; font-weight: 600; }
.toggle {
  min-width: 64px;
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
  transition: all 0.2s;
}
.toggle.on { color: #241500; background: var(--grad-gold); border-color: var(--gold); }
.set-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; margin-top: 1rem; }
.ghost-btn {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  transition: border-color 0.2s, color 0.2s;
}
.ghost-btn:hover { border-color: var(--gold); color: var(--gold); }
.ghost-btn.danger:hover { border-color: var(--red-2); color: var(--red-2); }

/* about */
.about-body { line-height: 1.65; color: var(--text); gap: 0.7rem; }
.about-logo { font-size: 1.3rem; font-weight: 700; letter-spacing: 0.12em; }
.about-logo em { font-style: normal; background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.about-warn { color: var(--gold); font-size: 0.72rem; letter-spacing: 0.14em; line-height: 1.7; border: 1px dashed rgba(245, 194, 74, 0.4); border-radius: 12px; padding: 0.6rem 0.8rem; }

/* stats */
.stats-grid { display: grid; gap: 0.3rem; margin-top: 0.3rem; }
.stats-grid div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  font-size: 0.86rem;
}
.stats-grid dt { color: var(--muted); }
.stats-grid dd { font-family: var(--mono); font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }

/* auto spin options */
.auto-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.55rem; margin-top: 0.9rem; }
.auto-opt {
  min-height: 64px;
  border-radius: 16px;
  border: 1px solid rgba(245, 194, 74, 0.35);
  background: var(--gold-dim);
  color: var(--gold);
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.2s;
}
.auto-opt span { font-size: 0.6rem; letter-spacing: 0.18em; color: var(--muted); }
.auto-opt:active { transform: scale(0.95); }
.auto-opt:hover { box-shadow: 0 8px 24px -10px rgba(245, 194, 74, 0.5); }

/* ================= OVERLAYS ================= */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  background: rgba(4, 3, 2, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 1.4rem;
  animation: fadeIn 0.3s var(--ease) both;
}
.overlay-card {
  width: min(400px, 100%);
  display: grid;
  justify-items: center;
  gap: 0.7rem;
  padding: 2rem 1.6rem;
  text-align: center;
  background: linear-gradient(170deg, #171310, #0E0B08);
  border: 1px solid rgba(245, 194, 74, 0.35);
  border-radius: 22px;
  box-shadow: 0 40px 120px -40px rgba(0, 0, 0, 0.95);
  animation: popIn 0.35s var(--ease) both;
}
.ov-sub { font-size: 0.68rem; letter-spacing: 0.28em; color: var(--muted); }
.ov-title { font-size: clamp(1.7rem, 8vw, 2.4rem); font-weight: 700; letter-spacing: 0.06em; background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.ov-info { font-size: 0.85rem; color: var(--muted); line-height: 1.5; }
.ov-amount { font-size: clamp(1.6rem, 7vw, 2.1rem); font-weight: 700; font-variant-numeric: tabular-nums; }
.cta {
  margin-top: 0.4rem;
  min-height: 52px;
  width: 100%;
  border-radius: 14px;
  background: var(--grad-gold);
  color: #241500;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  transition: transform 0.15s, box-shadow 0.25s;
}
.cta:hover { box-shadow: 0 12px 34px -10px rgba(245, 194, 74, 0.6); }
.cta:active { transform: scale(0.97); }
.cta.ghost { background: none; border: 1px solid var(--border-soft); color: var(--text); }
.cta.ghost:hover { border-color: var(--text); color: var(--text); box-shadow: none; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; width: 100%; margin-top: 0.4rem; }

/* free spins intro */
.fs-intro { border-color: rgba(224, 72, 72, 0.5); }
.fs-burst { font-size: 3rem; color: var(--gold); text-shadow: 0 0 26px rgba(245, 194, 74, 0.9); animation: burstSpin 4s linear infinite; }
@keyframes burstSpin { to { transform: rotate(360deg); } }

/* big win overlay */
.bigwin-overlay { background: rgba(2, 1, 0, 0.92); }
.bigwin-inner { position: relative; z-index: 2; display: grid; justify-items: center; gap: 0.5rem; text-align: center; }
.bw-title {
  font-size: clamp(2.4rem, 12vw, 4.6rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  background: linear-gradient(100deg, #FFE3A1, #F5C24A 40%, #FFD166 60%, #FFE3A1);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: bwShimmer 1.4s linear infinite;
  filter: drop-shadow(0 0 22px rgba(245, 194, 74, 0.65));
}
@keyframes bwShimmer { to { background-position: -200% 0; } }
.bw-amount { font-size: clamp(1.8rem, 9vw, 3rem); font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; text-shadow: 0 0 20px rgba(245, 194, 74, 0.7); }
.bw-sub { font-size: 0.72rem; letter-spacing: 0.24em; color: var(--gold); }
.bw-cta { max-width: 280px; }

/* confetti */
.confetti-zone { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti {
  position: absolute;
  top: -18px;
  border-radius: 2px;
  animation: confFall linear forwards;
}
@keyframes confFall {
  to { transform: translateY(110vh) rotate(760deg); opacity: 0; }
}
.card-bit {
  position: absolute;
  top: -30px;
  width: 26px; height: 37px;
  border-radius: 4px;
  background: linear-gradient(160deg, #FDFBF5, #E8E0CE);
  border: 1px solid #B9AF96;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  animation: confFall linear forwards;
}

/* ================= TOAST ================= */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 160;
  max-width: min(92vw, 420px);
  padding: 0.7rem 1.1rem;
  border-radius: 12px;
  border: 1px solid rgba(245, 194, 74, 0.45);
  background: #171310;
  color: var(--text);
  font-size: 0.85rem;
  text-align: center;
  box-shadow: 0 16px 44px -16px rgba(0, 0, 0, 0.9);
  animation: toastIn 0.3s var(--ease) both;
}
.toast.warn { border-color: rgba(224, 72, 72, 0.55); color: #FFC9C9; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ================= RESPONSIVE: desktop — side-panel layout =================
   On wide screens the banner + controls move to a right column so the
   reels get the full screen height (bigger cards, no scrolling). */
@media (min-width: 1024px) {
  :root { --card-w: clamp(84px, 7.6vw, 118px); }
  .app {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(300px, 28vw, 400px);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      "topbar topbar"
      "hud    hud"
      "stage  side"
      "foot   foot";
    column-gap: clamp(1rem, 2.5vw, 2rem);
    row-gap: 0.4rem;
  }
  .topbar { grid-area: topbar; }
  .hud { grid-area: hud; grid-template-columns: 1fr 1fr auto; align-items: stretch; }
  .hud-demo { grid-column: auto; display: grid; place-items: center; padding-inline: 1.6rem; }
  .stage { grid-area: stage; min-height: 0; }
  .reels-wrap { padding: clamp(1rem, 2vw, 1.6rem); }
  .side {
    grid-area: side;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: clamp(0.6rem, 1.2vw, 1rem);
  }
  .side .win-banner, .side .fs-ribbon { margin: 0; }
  .controls {
    position: static;
    margin: 0;
    padding: 0;
    background: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
  }
  .controls .bet-row, .controls .spin-row, .controls .util-row { max-width: none; margin: 0; }
  .controls .bet-btn, .controls .bet-display, .controls .max-btn { min-height: 48px; }
  .controls .bet-btn { width: 52px; flex-basis: 52px; }
  .controls .spin-btn, .controls .auto-btn, .controls .buy-btn { min-height: 60px; }
  .controls .auto-btn { width: 120px; }
  .controls .buy-btn { width: 120px; }
  .foot { grid-area: foot; margin-top: 0.3rem; padding-top: 0.5rem; }
}

/* compact chrome on phones + short screens — keep everything in view without scrolling */
@media (max-width: 900px), (max-height: 780px) {
  .topbar { padding-top: 0.4rem; padding-bottom: 0.4rem; }
  .back { padding: 0.4rem 0.55rem; font-size: 0.66rem; }
  .icon-btn { width: 38px; height: 38px; min-height: 38px; font-size: 0.92rem; }
  .hud { margin: 0.3rem 0 0.35rem; grid-template-columns: 1fr 1fr auto; gap: 0.35rem; }
  .hud-cell { padding: 0.32rem 0.6rem; gap: 0; }
  .hud-demo { grid-column: auto; font-size: 0.5rem; letter-spacing: 0.12em; padding: 0.32rem 0.55rem; }
  .hud-label { font-size: 0.54rem; }
  .hud-value { font-size: clamp(0.95rem, 4vw, 1.25rem); }
  .reels-wrap { padding: clamp(0.4rem, 1.4vw, 0.8rem); }
  .win-banner { min-height: 46px; margin: 0.35rem 0; padding: 0.4rem 0.8rem; }
  .wb-title { font-size: clamp(0.9rem, 3.8vw, 1.2rem); }
  .fs-ribbon { margin: 0.35rem 0; padding: 0.45rem 0.8rem; }
  .controls { padding: 0.4rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom)); }
  .bet-btn { width: 48px; flex: 0 0 48px; min-height: 44px; }
  .bet-display, .max-btn { min-height: 44px; }
  .spin-row { margin-top: 0.4rem; }
  .spin-btn, .auto-btn, .buy-btn { min-height: 50px; }
  .auto-btn { width: 96px; }
  .buy-btn { width: 92px; }
  .buy-cost { font-size: 0.56rem; }
  .util-row { margin-top: 0.4rem; }
  .util { min-height: 38px; }
  .foot { margin-top: 0.5rem; padding-top: 0.4rem; gap: 0.15rem; }
}

/* landscape phones / short wide screens */
@media (max-height: 620px) and (orientation: landscape) {
  .topbar { padding-top: 0.4rem; }
  .hud { margin: 0.3rem 0; }
  .reels-wrap { padding: 0.5rem; }
  .controls { position: static; padding: 0.5rem 0; }
  .hud-cell { padding: 0.4rem 0.7rem; }
  .win-banner { min-height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* animations off (settings) */
html.no-anim *, html.no-anim *::before, html.no-anim *::after { animation: none !important; transition: none !important; }
