:root {
  color-scheme: dark;
  --ink: #160715;
  --wine: #310b2b;
  --wine-deep: #22071f;
  --gold: #e8b64d;
  --gold-light: #ffe3a0;
  --text: #fff5e7;
  --muted: #b8a0b1;
  --silver: #d8d4db;
  --panel: rgba(25, 9, 27, .86);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--ink); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(ellipse at 8% 22%, rgba(143, 17, 91, .36), transparent 34%),
    radial-gradient(ellipse at 92% 26%, rgba(176, 20, 107, .29), transparent 31%),
    radial-gradient(ellipse at 50% 92%, rgba(90, 14, 67, .30), transparent 45%),
    linear-gradient(145deg, #160715 0%, #27091f 48%, #160716 100%);
  overscroll-behavior: none;
}
button { font: inherit; }
button:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 3px; }
[hidden] { display: none !important; }

.app-shell {
  width: min(100%, 980px);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: max(8px, env(safe-area-inset-top)) 16px max(10px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
  padding: 0 2px;
}
.back-button {
  flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; color: #ffe8b4;
  border: 1px solid rgba(233,199,136,.42);
  background: linear-gradient(145deg, rgba(77,35,66,.95), rgba(28,12,31,.96));
  box-shadow: inset 0 1px rgba(255,255,255,.12), 0 3px 10px rgba(0,0,0,.25);
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.back-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.back-button:hover { border-color: var(--gold-light); background: rgba(92,35,69,.96); }
.back-button:active { transform: translateX(-2px) scale(.96); }
.brand { flex: 1 1 auto; }
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; object-fit: contain; }
.brand-copy { display: flex; flex-direction: column; gap: 1px; line-height: 1; }
.brand-name { font-weight: 900; letter-spacing: .18em; font-size: 13px; }
.brand-game { color: var(--gold); font-size: 9px; letter-spacing: .31em; font-weight: 800; }
.top-actions { display: flex; gap: 8px; }
.icon-button {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid rgba(233, 199, 136, .38);
  color: #f6e9ed; background: rgba(37, 12, 36, .76);
  display: grid; place-items: center; cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.icon-button:active { transform: scale(.94); }
.icon-button:hover { border-color: var(--gold); background: rgba(77, 20, 61, .86); }
.icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.game-stage {
  width: 100%; flex: 1; min-height: 0; position: relative;
  display: flex; flex-direction: column; align-items: center;
  justify-content: flex-start; gap: clamp(6px, 1.15vh, 12px);
  padding: 3px 0 3px;
}
.game-heading { text-align: center; line-height: 1; margin: 0 0 1px; }
.heading-kicker { color: #c49aa9; font-size: 8px; font-weight: 800; letter-spacing: .35em; margin-bottom: 5px; }
.game-heading h1 {
  margin: 0; font-size: clamp(24px, 5.3vw, 34px); font-weight: 950; letter-spacing: .10em;
  color: #ffd77d;
  text-shadow: 0 2px 0 #773b25, 0 4px 0 #4c1c2f;
}
.game-heading h1 span { color: #fff1cf; }

.bonus-strip {
  width: min(92vw, 760px); min-height: 34px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 3px 12px; border-radius: 999px;
  border: 1px solid rgba(250, 202, 94, .72);
  background: linear-gradient(90deg, rgba(74, 14, 54, .96), rgba(40, 10, 43, .94));
  color: #ffe7aa; box-shadow: inset 0 1px rgba(255,255,255,.08), 0 4px 14px rgba(0,0,0,.18);
}
.bonus-label { font-weight: 900; font-size: 10px; letter-spacing: .18em; }
.bonus-count { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 13px; }
.bonus-strip img { width: 30px; height: 30px; object-fit: contain; }

.reel-frame {
  width: min(94vw, 790px);
  aspect-ratio: 1.73 / 1;
  position: relative;
  padding: 7px;
  border-radius: 19px;
  background: linear-gradient(135deg, #f8d77c 0%, #8b562e 13%, #f5d982 24%, #5f321e 48%, #d69a42 73%, #ffdf8b 100%);
  border: 1px solid #f9d98a;
  box-shadow:
    0 10px 30px rgba(0,0,0,.42),
    inset 0 0 0 2px rgba(72, 28, 26, .92),
    inset 0 0 0 4px rgba(255, 228, 151, .33);
  overflow: hidden;
}
.reel-top-edge { position: absolute; z-index: 3; left: 10px; right: 10px; top: 5px; height: 2px; background: linear-gradient(90deg, transparent, rgba(255,239,187,.9), transparent); pointer-events: none; }
.reels {
  width: 100%; height: 100%; display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px; overflow: hidden; border-radius: 12px;
  background: #21091e;
  box-shadow: inset 0 0 22px rgba(0,0,0,.7);
}
.reel {
  min-width: 0; min-height: 0; display: grid; grid-template-rows: repeat(3, minmax(0, 1fr));
  overflow: hidden; position: relative;
  background: linear-gradient(180deg, rgba(68, 14, 53, .95), rgba(35, 8, 33, .97));
  border-right: 1px solid rgba(235, 187, 101, .19);
}
.reel:last-child { border-right: 0; }
.symbol-cell {
  min-height: 0; min-width: 0; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  border-bottom: 1px solid rgba(237, 191, 115, .075);
  background: linear-gradient(180deg, rgba(255,255,255,.018), rgba(0,0,0,.065));
}
.symbol-cell:last-child { border-bottom: 0; }
.symbol-cell img {
  width: 88%; height: 88%; object-fit: contain; display: block;
  filter: drop-shadow(0 3px 3px rgba(0,0,0,.52));
  user-select: none; pointer-events: none;
  transition: transform .16s ease, filter .16s ease;
}
.symbol-cell.winning {
  z-index: 2;
  background: radial-gradient(ellipse, rgba(255, 220, 112, .22), rgba(255, 204, 77, .02) 72%);
  box-shadow: inset 0 0 0 2px rgba(255, 214, 109, .94), inset 0 0 15px rgba(255, 203, 74, .36);
  animation: win-cell-pulse .8s ease-in-out infinite alternate;
}
.symbol-cell.winning img { transform: scale(1.07); filter: drop-shadow(0 0 8px rgba(255,211,105,.75)); }
.symbol-cell.is-wild:not(.winning) { background: radial-gradient(circle, rgba(255,116,43,.15), transparent 72%); }
.symbol-cell.is-wild img { filter: drop-shadow(0 0 7px rgba(255,107,47,.42)); }
.symbol-cell.is-scatter:not(.winning) { background: radial-gradient(circle, rgba(255,213,103,.16), transparent 72%); }
.symbol-cell.is-scatter img { animation: scatter-flicker 1.8s ease-in-out infinite; }
.symbol-cell.is-chest:not(.winning) img { animation: chest-glint 2.4s ease-in-out infinite; }
.reel.spinning .symbol-cell img { filter: blur(1.2px) brightness(1.15) drop-shadow(0 3px 3px rgba(0,0,0,.4)); transform: translateY(3px) scale(.97); }
.reel.stopping .symbol-cell img { animation: reel-land .24s cubic-bezier(.16,.8,.3,1) both; }
.reel-glass { position: absolute; inset: 7px; pointer-events: none; border-radius: 12px; box-shadow: inset 0 0 16px rgba(0,0,0,.2); }

.result-line { width: min(94vw, 790px); min-height: 25px; display: flex; align-items: center; justify-content: space-between; padding: 0 5px; }
.result-message { color: #d4b8c8; font-size: 11px; letter-spacing: .04em; min-width: 0; }
.last-win { display: flex; align-items: baseline; gap: 5px; color: #ffe2a2; font-variant-numeric: tabular-nums; }
.last-win small { color: #ae8b9f; font-size: 8px; font-weight: 800; letter-spacing: .16em; }
.last-win strong { color: #fff2d1; font-size: 14px; font-weight: 900; }

.control-panel { width: min(94vw, 640px); }
.bet-header { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 5px; color: #c4a7b8; font-size: 9px; font-weight: 900; letter-spacing: .18em; }
.bet-header span:last-child { color: #ffe2a3; letter-spacing: .04em; font-size: 10px; font-variant-numeric: tabular-nums; }
.bet-editor { display: grid; grid-template-columns: 42px minmax(0,1fr) 42px; align-items: center; gap: 8px; margin-bottom: 5px; }
.bet-adjust { height: 38px; border-radius: 10px; color: #ffe6ac; font-size: 22px; font-weight: 700; border: 1px solid rgba(230,190,111,.42); background: linear-gradient(180deg, rgba(87,47,73,.92), rgba(36,17,39,.98)); cursor: pointer; box-shadow: inset 0 1px rgba(255,255,255,.1), 0 3px 8px rgba(0,0,0,.2); }
.bet-adjust:active { transform: scale(.96); }
.bet-adjust:disabled { opacity: .42; cursor: not-allowed; }
.bet-input-wrap { min-width: 0; height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 11px; border-radius: 10px; border: 1px solid rgba(239,197,111,.5); background: rgba(16,8,20,.8); box-shadow: inset 0 1px 5px rgba(0,0,0,.3); }
.bet-input-wrap:focus-within { border-color: var(--gold-light); box-shadow: 0 0 0 2px rgba(255,218,140,.13), inset 0 1px 5px rgba(0,0,0,.3); }
.bet-input-wrap input { width: 100%; min-width: 0; border: 0; outline: 0; color: #fff1ca; background: transparent; font: inherit; font-size: 15px; line-height: 1; font-weight: 900; font-variant-numeric: tabular-nums; text-align: center; }
.bet-input-wrap input::-webkit-inner-spin-button, .bet-input-wrap input::-webkit-outer-spin-button { opacity: .55; }
.bet-input-wrap span { flex: 0 0 auto; color: #c7a970; font-size: 8px; font-weight: 900; letter-spacing: .08em; white-space: nowrap; }
.bet-input-wrap input:disabled { opacity: .55; }
.bet-limits { margin: 0 0 6px; text-align: center; color: #8f788a; font-size: 7px; font-weight: 800; letter-spacing: .16em; }
.bet-options { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.bet-chip {
  min-height: 37px; padding: 0 6px; border-radius: 999px; cursor: pointer;
  color: #f9e8ef; font-weight: 800; font-size: 13px;
  border: 1px solid rgba(213, 190, 206, .5);
  background: linear-gradient(180deg, rgba(91, 64, 87, .9), rgba(39, 20, 41, .97));
  box-shadow: inset 0 1px rgba(255,255,255,.17), 0 3px 7px rgba(0,0,0,.24);
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.bet-chip:active { transform: scale(.97); }
.bet-chip.is-active { color: #fff1c8; border: 1.5px solid #f5c95f; background: linear-gradient(180deg, #6e4359, #32182e); box-shadow: inset 0 0 0 1px rgba(255,216,126,.17), 0 0 0 1px rgba(243,188,76,.12); }
.bet-chip:disabled { opacity: .45; cursor: not-allowed; }

.spin-controls { display: flex; align-items: center; justify-content: center; gap: clamp(16px, 5vw, 34px); width: 100%; padding: clamp(8px, 1.6vh, 16px) 0 2px; margin-top: auto; }
.side-control {
  flex: 0 0 auto; width: 54px; height: 54px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: #f5e8f1; border: 1px solid rgba(221, 202, 222, .56);
  background: linear-gradient(145deg, #60465e, #241626 75%);
  box-shadow: inset 0 1px 3px rgba(255,255,255,.23), 0 4px 10px rgba(0,0,0,.3);
  cursor: pointer; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.side-control svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.side-control span { font-size: 7px; font-weight: 900; letter-spacing: .12em; }
.side-control:active { transform: scale(.94); }
.side-control.active { color: #ffe7a9; border-color: #f2ca69; box-shadow: inset 0 0 0 1px rgba(255,223,149,.24), 0 0 13px rgba(229,174,70,.22); }
.side-control:disabled { opacity: .42; cursor: not-allowed; }

.spin-button {
  flex: 0 0 auto; width: clamp(112px, 31vw, 148px); aspect-ratio: 1;
  position: relative; border-radius: 50%; cursor: pointer; border: 0; padding: 0;
  display: grid; place-items: center; color: #fff;
  background: radial-gradient(circle at 35% 25%, #6b5b6b 0%, #35303b 37%, #19131e 69%, #0e0b13 100%);
  box-shadow:
    0 0 0 2px #7e7882,
    0 0 0 5px #28222d,
    0 0 0 7px rgba(220, 213, 218, .58),
    inset 0 5px 10px rgba(255,255,255,.18),
    inset 0 -12px 22px rgba(0,0,0,.62),
    0 10px 22px rgba(0,0,0,.48);
  transition: transform .14s ease, filter .14s ease;
}
.spin-button::before {
  content: ""; position: absolute; inset: 9px; border-radius: 50%;
  border: 2px solid rgba(243, 237, 243, .48);
  box-shadow: inset 0 2px 8px rgba(255,255,255,.13), 0 1px rgba(0,0,0,.65);
}
.spin-button:hover { filter: brightness(1.13); }
.spin-button:active { transform: scale(.96); }
.spin-button:disabled { cursor: wait; filter: grayscale(.3) brightness(.72); }
.spin-ring { width: 57%; height: 57%; display: grid; place-items: center; border-radius: 50%; transform: translateY(-9%); background: radial-gradient(circle, rgba(255,255,255,.08), transparent 68%); }
.spin-ring svg { width: 100%; height: 100%; fill: none; stroke: #f7f5f7; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 2px 2px rgba(0,0,0,.65)); }
.spin-word { position: absolute; bottom: 17%; color: rgba(255,255,255,.82); font-size: 8px; font-weight: 900; letter-spacing: .34em; text-indent: .34em; text-shadow: 0 1px 3px #09060b; }
.spin-button.is-spinning .spin-ring svg { animation: spin-rotate .6s linear infinite; }

.balance-bar {
  margin-top: clamp(7px, 1.2vh, 12px);
  width: min(94vw, 790px); min-height: 39px; display: flex; align-items: center; gap: 9px;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid rgba(190, 160, 178, .67);
  background: linear-gradient(180deg, rgba(44, 25, 46, .98), rgba(16, 12, 21, .98));
  box-shadow: inset 0 1px 3px rgba(255,255,255,.11), 0 4px 14px rgba(0,0,0,.28);
}
.balance-title { display: flex; align-items: center; gap: 6px; color: #c6b2c1; font-size: 8px; letter-spacing: .16em; font-weight: 900; white-space: nowrap; }
.balance-title i { width: 7px; height: 7px; display: block; border-radius: 50%; background: #e9bb56; box-shadow: 0 0 7px rgba(233,187,86,.4); }
.balance-bar strong { flex: 1; text-align: center; color: #fff1d1; font-size: clamp(13px, 3.5vw, 16px); font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.balance-bar strong em { color: #e5bd61; font-size: 9px; font-style: normal; letter-spacing: .12em; }
.balance-reset { border: 0; width: 25px; height: 25px; border-radius: 50%; color: #bea8bc; background: rgba(255,255,255,.06); font-size: 17px; cursor: pointer; }
.balance-reset:active { transform: rotate(45deg); }
.demo-note { margin-bottom: clamp(8px, 1.4vh, 15px); color: #9a8093; font-size: 7px; font-weight: 800; letter-spacing: .23em; }

.win-banner {
  position: absolute; z-index: 12; left: 50%; top: 37%; transform: translate(-50%, -50%);
  min-width: min(76vw, 300px); padding: 12px 22px 13px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 1px solid rgba(255,226,151,.9); border-radius: 16px;
  background: linear-gradient(155deg, rgba(78,25,55,.97), rgba(25,9,27,.97));
  box-shadow: 0 12px 42px rgba(0,0,0,.5), inset 0 1px rgba(255,255,255,.17), 0 0 28px rgba(255,189,76,.22);
  pointer-events: none; animation: win-banner-in .36s cubic-bezier(.16,.85,.3,1) both;
}
.win-banner span { color: #f8d98f; font-size: 10px; font-weight: 950; letter-spacing: .24em; }
.win-banner strong { color: #fff4d3; font-size: clamp(17px, 4.6vw, 25px); font-weight: 950; text-shadow: 0 2px 12px rgba(255,188,70,.3); font-variant-numeric: tabular-nums; }
.win-banner[data-tier="mega"], .win-banner[data-tier="epic"] { border-color: #fff0b5; box-shadow: 0 12px 48px rgba(0,0,0,.6), 0 0 42px rgba(255,194,71,.44); }
.win-banner[data-tier="epic"] { background: linear-gradient(155deg, rgba(116,53,23,.98), rgba(50,13,27,.98)); }
.fx-layer { position: absolute; z-index: 11; inset: 0; overflow: hidden; pointer-events: none; }
.fx-coin {
  position: absolute; left: 50%; top: 38%; display: grid; place-items: center;
  width: 20px; height: 20px; border-radius: 50%; color: #fff0ad; font-size: 12px; font-weight: 900;
  border: 1px solid rgba(255,239,172,.95); background: radial-gradient(circle at 35% 25%, #fff0ad, #d58d28 60%, #75401b);
  box-shadow: 0 2px 10px rgba(255,190,73,.42); opacity: 0;
  animation: coin-burst 1.05s cubic-bezier(.12,.65,.22,1) var(--delay, 0ms) both;
}

.fx-spark {
  position: absolute; left: 50%; top: 39%; width: 5px; height: 18px;
  border-radius: 999px; opacity: 0; pointer-events: none;
  background: linear-gradient(180deg, #fff8d9, #f6c45b 55%, rgba(255,151,54,0));
  box-shadow: 0 0 8px rgba(255,213,112,.76);
  transform-origin: center top;
  animation: spark-burst 1.3s cubic-bezier(.12,.7,.2,1) var(--delay,0ms) both;
}
.game-stage.win-impact .reel-frame { animation: win-impact .78s cubic-bezier(.18,.7,.25,1); }
.game-stage.win-impact .reel-frame::after {
  content: ""; position: absolute; z-index: 5; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 20%, rgba(255,243,191,.3) 48%, transparent 72%);
  animation: reel-shine .72s ease-out both;
}
.game-stage.bonus-pulse .bonus-strip:not([hidden]) { box-shadow: 0 0 22px rgba(255,207,99,.35), inset 0 1px rgba(255,255,255,.12); }

.game-stage.feature-pulse .reel-frame { animation: frame-pulse .72s ease-out; }
.game-stage.bonus-pulse .reel-frame { animation: bonus-frame-pulse .9s ease-out; }
.bonus-strip:not([hidden]) { animation: bonus-strip-in .38s cubic-bezier(.18,.8,.3,1) both; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center;
  padding: 18px; background: rgba(7, 3, 9, .79); backdrop-filter: blur(8px);
}
.modal {
  width: min(100%, 490px); max-height: min(84vh, 720px); overflow: auto; position: relative;
  border-radius: 20px; padding: 24px 20px 20px;
  border: 1px solid rgba(242, 200, 111, .72);
  background: linear-gradient(155deg, #42123a, #1b0a21 66%, #160916);
  box-shadow: 0 20px 70px rgba(0,0,0,.62), inset 0 1px rgba(255,255,255,.1);
}
.modal-close { position: absolute; right: 12px; top: 8px; width: 32px; height: 32px; border: 0; border-radius: 50%; color: #f5e6ee; background: rgba(255,255,255,.08); font-size: 25px; cursor: pointer; line-height: 1; }
.modal h2 { margin: 0 0 5px; color: #ffe2a0; text-align: center; font-size: 22px; letter-spacing: .13em; }
.modal-subtitle { margin: 0 0 18px; color: #c5a9bc; text-align: center; font-size: 10px; letter-spacing: .14em; }
.modal-section { margin-top: 15px; }
.modal-section h3 { margin: 0 0 8px; color: #f6d486; font-size: 11px; letter-spacing: .12em; }
.paytable-grid { display: grid; grid-template-columns: 1fr auto auto auto; gap: 5px 10px; align-items: center; font-size: 11px; }
.paytable-grid .head { color: #a98b9f; font-size: 8px; font-weight: 900; letter-spacing: .12em; }
.paytable-symbol { display: flex; align-items: center; gap: 7px; color: #f5e5ee; }
.paytable-symbol img { width: 30px; height: 30px; object-fit: contain; }
.paytable-value { color: #ffe5ab; text-align: right; font-variant-numeric: tabular-nums; }
.rule-card { display: flex; align-items: center; gap: 10px; padding: 9px 10px; margin-top: 7px; border-radius: 12px; background: rgba(255,255,255,.045); border: 1px solid rgba(245,203,125,.12); }
.rule-card img { width: 40px; height: 40px; object-fit: contain; flex: 0 0 auto; }
.rule-card strong { display: block; color: #ffe5ac; font-size: 11px; margin-bottom: 2px; }
.rule-card span { display: block; color: #c8b3c2; font-size: 10px; line-height: 1.45; }
.rtp-note { margin: 14px 0 0; color: #a98e9f; font-size: 9px; line-height: 1.5; text-align: center; }
.menu-actions { display: grid; gap: 8px; margin-top: 18px; }
.menu-action { width: 100%; min-height: 42px; border-radius: 11px; color: #ffebbf; font-weight: 800; letter-spacing: .08em; border: 1px solid rgba(241,197,110,.42); background: rgba(255,255,255,.055); cursor: pointer; }
.history-list { display: grid; gap: 7px; margin-top: 14px; }
.history-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 10px; background: rgba(255,255,255,.045); font-size: 10px; }
.history-row span:first-child { color: #d7c3d1; }
.history-row .negative { color: #c99bab; }
.history-row .positive { color: #ffe1a0; font-weight: 800; }
.empty-history { color: #b99caf; text-align: center; font-size: 12px; padding: 20px 0; }

.vault-title { margin: 0; color: #ffe1a0; text-align: center; font-weight: 950; font-size: 22px; letter-spacing: .16em; }
.vault-copy { margin: 7px 0 15px; color: #c9a9bc; text-align: center; font-size: 11px; }
.vault-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.vault-choice { min-width: 0; min-height: 120px; padding: 12px 4px 9px; border: 1px solid rgba(240,194,105,.42); border-radius: 14px; background: linear-gradient(180deg, rgba(255,226,154,.08), rgba(16,7,17,.5)); color: #ffdf97; cursor: pointer; font-weight: 900; font-size: 11px; }
.vault-choice img { display: block; width: 75px; height: 68px; object-fit: contain; margin: 0 auto 5px; animation: chest-idle 2s ease-in-out infinite; }
.vault-choice:hover:not(:disabled) { transform: translateY(-4px); border-color: #ffe7a6; box-shadow: 0 7px 18px rgba(245,190,81,.18); }
.vault-choice:disabled { cursor: default; opacity: .84; }
.vault-choice.revealed { border-color: #ffe7a6; background: rgba(195,126,38,.22); box-shadow: 0 0 16px rgba(245,190,81,.25); animation: vault-reveal .35s ease-out both; }
.vault-reward { margin-top: 15px; min-height: 28px; text-align: center; color: #fff1c5; font-size: 18px; font-weight: 950; }

.toast {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 40;
  transform: translate(-50%, 18px); opacity: 0; pointer-events: none;
  padding: 10px 15px; border: 1px solid rgba(250,211,125,.58); border-radius: 999px;
  color: #ffedc2; background: rgba(27, 9, 27, .96); box-shadow: 0 8px 24px rgba(0,0,0,.4);
  font-size: 11px; font-weight: 800; white-space: nowrap; transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes spin-rotate { to { transform: rotate(360deg); } }
@keyframes scatter-flicker { 0%,100% { filter: drop-shadow(0 0 3px rgba(255,209,98,.35)); } 50% { filter: drop-shadow(0 0 10px rgba(255,218,115,.8)); transform: scale(1.035); } }
@keyframes chest-glint { 0%,100% { filter: drop-shadow(0 2px 3px rgba(0,0,0,.48)); } 50% { filter: drop-shadow(0 0 9px rgba(255,208,102,.56)); } }
@keyframes chest-idle { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes vault-reveal { from { transform: scale(.94); filter: brightness(1); } to { transform: scale(1.03); filter: brightness(1.28); } }
@keyframes win-banner-in { from { opacity: 0; transform: translate(-50%, -42%) scale(.78); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes coin-burst { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.25) rotate(0); } 14% { opacity: 1; } 100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.72) rotate(var(--spin)); } }
@keyframes frame-pulse { 0% { filter: brightness(1); } 35% { filter: brightness(1.35) saturate(1.18); } 100% { filter: brightness(1); } }
@keyframes bonus-frame-pulse { 0% { filter: brightness(1); box-shadow: 0 10px 30px rgba(0,0,0,.42); } 28% { filter: brightness(1.55) saturate(1.3); box-shadow: 0 0 34px rgba(255,197,77,.48); } 100% { filter: brightness(1); } }
@keyframes bonus-strip-in { from { opacity: 0; transform: translateY(-9px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes reel-land { 0% { transform: translateY(-12px) scale(.94); opacity: .55; } 100% { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes win-cell-pulse { from { box-shadow: inset 0 0 0 1px rgba(255,214,109,.58), inset 0 0 8px rgba(255,203,74,.16); } to { box-shadow: inset 0 0 0 2px rgba(255,231,159,1), inset 0 0 18px rgba(255,203,74,.52); } }

@media (min-width: 700px) {
  .app-shell { padding-left: 24px; padding-right: 24px; }
  .back-button { flex-basis: 42px; width: 42px; height: 42px; }
  .game-stage { gap: 15px; }
  .reel-frame { padding: 10px; border-radius: 24px; }
  .reels { gap: 3px; border-radius: 15px; }
  .reel-glass { inset: 10px; border-radius: 15px; }
  .symbol-cell img { width: 82%; height: 82%; }
  .bet-chip { min-height: 43px; font-size: 15px; }
  .spin-controls { gap: 36px; padding-top: 16px; }
  .bet-editor { grid-template-columns: 46px minmax(0,1fr) 46px; }
  .bet-adjust, .bet-input-wrap { height: 42px; }
  .side-control { width: 62px; height: 62px; }
  .side-control svg { width: 23px; height: 23px; }
  .spin-word { font-size: 9px; }
  .balance-bar { min-height: 44px; padding: 6px 15px; }
}

@media (max-height: 720px) and (max-width: 699px) {
  .app-shell { padding-top: max(3px, env(safe-area-inset-top)); padding-bottom: max(4px, env(safe-area-inset-bottom)); }
  .topbar { min-height: 43px; }
  .brand-mark { width: 28px; height: 28px; }
  .game-stage { gap: 7px; }
  .game-heading h1 { font-size: 23px; }
  .reel-frame { width: min(92vw, 600px); }
  .bet-chip { min-height: 32px; }
  .bet-editor { grid-template-columns: 36px minmax(0,1fr) 36px; gap: 6px; margin-bottom: 3px; }
  .bet-adjust, .bet-input-wrap { height: 34px; }
  .bet-input-wrap input { font-size: 14px; }
  .bet-limits { margin-bottom: 4px; }
  .spin-button { width: 100px; }
  .side-control { width: 48px; height: 48px; }
  .balance-bar { min-height: 34px; margin-top: 11px; }
  .demo-note { margin-bottom: 2px; }
  .spin-ring { transform: translateY(-8%); }
  .spin-word { bottom: 15%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@keyframes spark-burst {
  0% { opacity: 0; transform: translate(-50%,0) rotate(0deg) scaleY(.45); }
  16% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), var(--dy)) rotate(45deg) scaleY(.08); }
}
@keyframes win-impact {
  0%,100% { filter: brightness(1); transform: translateZ(0); }
  22% { filter: brightness(1.42) saturate(1.22); transform: translateY(-2px) scale(1.008); }
  48% { filter: brightness(1.12); transform: translateY(1px) scale(.997); }
  70% { filter: brightness(1.2); transform: translateY(-1px); }
}
@keyframes reel-shine {
  from { opacity: 0; transform: translateX(-35%); }
  30% { opacity: .9; }
  to { opacity: 0; transform: translateX(35%); }
}

/* PHOENIX GEMFORGE V4 — larger desktop reels and compact mobile control stack. */
@media (min-width: 700px) {
  .app-shell { width: min(100%, 1120px); }
  .game-stage { gap: clamp(10px, 1.45vh, 16px); }
  .reel-frame {
    width: min(96vw, 930px);
    aspect-ratio: 1.62 / 1;
  }
  .result-line,
  .balance-bar { width: min(96vw, 930px); }
  .control-panel {
    width: min(92vw, 740px);
    padding: 12px 16px 14px;
    border: 1px solid rgba(230, 190, 111, .28);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(48, 19, 45, .86), rgba(22, 9, 27, .92));
    box-shadow: inset 0 1px rgba(255,255,255,.08), 0 8px 20px rgba(0,0,0,.22);
  }
  .bet-header { font-size: 10px; padding-bottom: 8px; }
  .bet-header span:last-child { font-size: 11px; }
  .bet-editor { grid-template-columns: 52px minmax(0,1fr) 52px; gap: 10px; margin-bottom: 7px; }
  .bet-adjust, .bet-input-wrap { height: 46px; }
  .bet-input-wrap input { font-size: 17px; }
  .bet-limits { font-size: 8px; margin-bottom: 8px; }
  .bet-chip { min-height: 46px; font-size: 15px; }
  .spin-controls { gap: 46px; padding-top: 10px; }
  .side-control { width: 70px; height: 70px; }
  .side-control svg { width: 25px; height: 25px; }
  .side-control span { font-size: 8px; }
  .spin-button { width: clamp(154px, 14vw, 174px); }
  .spin-word { font-size: 10px; }
  .balance-bar { min-height: 52px; padding: 8px 18px; }
  .balance-title { font-size: 9px; }
  .balance-bar strong { font-size: clamp(17px, 1.8vw, 21px); }
  .balance-bar strong em { font-size: 10px; }
  .balance-reset { width: 30px; height: 30px; font-size: 19px; }
  .demo-note { font-size: 8px; }
}

/* On shorter desktop/laptop displays keep the larger reel without crowding the controls. */
@media (min-width: 700px) and (max-height: 850px) {
  .game-stage { gap: 9px; }
  .reel-frame { width: min(94vw, 900px); aspect-ratio: 1.78 / 1; }
  .spin-controls { padding-top: 5px; gap: 34px; }
  .side-control { width: 64px; height: 64px; }
  .spin-button { width: clamp(146px, 13vw, 160px); }
  .control-panel { padding-top: 9px; padding-bottom: 10px; }
}

/* Phone layout: action buttons → bet card → balance. Desktop order stays unchanged. */
@media (max-width: 699px) {
  .game-stage { gap: clamp(4px, .75vh, 8px); }
  .game-heading { order: 1; margin-bottom: 0; }
  .bonus-strip { order: 2; }
  .reel-frame { order: 3; width: min(96vw, 640px); }
  .result-line { order: 4; }
  .spin-controls {
    order: 5;
    margin-top: 0;
    padding: 3px 0 1px;
    gap: clamp(22px, 7vw, 42px);
  }
  .side-control { width: 56px; height: 56px; }
  .side-control svg { width: 21px; height: 21px; }
  .side-control span { font-size: 7px; }
  .spin-button { width: clamp(116px, 31vw, 136px); }
  .control-panel {
    order: 6;
    width: min(94vw, 620px);
    padding: 8px 10px 9px;
    border: 1px solid rgba(230, 190, 111, .28);
    border-radius: 13px;
    background: linear-gradient(180deg, rgba(48, 19, 45, .88), rgba(22, 9, 27, .94));
    box-shadow: inset 0 1px rgba(255,255,255,.07), 0 6px 16px rgba(0,0,0,.2);
  }
  .bet-header { font-size: 8px; padding-bottom: 4px; }
  .bet-header span:last-child { font-size: 9px; }
  .bet-editor { grid-template-columns: 39px minmax(0,1fr) 39px; gap: 6px; margin-bottom: 4px; }
  .bet-adjust, .bet-input-wrap { height: 35px; }
  .bet-input-wrap { padding: 0 9px; }
  .bet-input-wrap input { font-size: 14px; }
  .bet-input-wrap span { font-size: 7px; }
  .bet-limits { font-size: 6px; letter-spacing: .12em; margin-bottom: 5px; }
  .bet-options { gap: 6px; }
  .bet-chip { min-height: 33px; font-size: 12px; }
  .balance-bar {
    order: 7;
    width: min(94vw, 620px);
    min-height: 47px;
    margin-top: auto;
    margin-bottom: 5px;
    padding: 8px 12px;
  }
  .balance-title { font-size: 8px; }
  .balance-bar strong { font-size: clamp(16px, 4.5vw, 19px); }
  .balance-bar strong em { font-size: 9px; }
  .balance-reset { width: 29px; height: 29px; }
  .demo-note { order: 8; margin: 0 0 3px; }
}

@media (max-height: 720px) and (max-width: 699px) {
  .game-stage { gap: 4px; }
  .reel-frame { width: min(95vw, 600px); }
  .spin-controls { padding-top: 1px; }
  .side-control { width: 50px; height: 50px; }
  .spin-button { width: 108px; }
  .control-panel { padding: 6px 9px 7px; }
  .bet-chip { min-height: 29px; }
  .balance-bar { min-height: 42px; margin-bottom: 3px; }
}


/* PHOENIX GEMFORGE V5 — lower mobile control stack, slightly larger phone reels,
   and enlarged desktop header actions. These overrides intentionally leave
   the desktop game-stage layout and all game logic unchanged. */
@media (max-width: 699px) {
  /* A modest increase in reel presence without stealing room from controls. */
  .reel-frame {
    width: min(97vw, 640px);
    aspect-ratio: 1.68 / 1;
  }

  /* Push the whole action/bet/balance group down together. Keeping the auto
     margin before the controls makes the bet panel sit directly above balance. */
  .spin-controls {
    margin-top: auto;
    padding-top: clamp(6px, 1vh, 10px);
    padding-bottom: 1px;
  }

  .control-panel {
    margin-top: 0;
  }

  .balance-bar {
    margin-top: clamp(5px, .8vh, 8px);
  }
}

/* Keep the compact short-phone treatment readable without creating overlap. */
@media (max-height: 720px) and (max-width: 699px) {
  .reel-frame {
    width: min(96vw, 620px);
    aspect-ratio: 1.73 / 1;
  }
  .spin-controls {
    margin-top: 2px;
    padding-top: 3px;
  }
  .control-panel {
    margin-top: 0;
  }
  .balance-bar {
    margin-top: 5px;
  }
}

/* Desktop only: approximately 50% larger back, sound and menu controls.
   Their fixed flex sizes and the taller topbar prevent collision or clipping. */
@media (min-width: 900px) {
  .topbar {
    min-height: 70px;
    gap: 12px;
  }
  .back-button {
    flex: 0 0 63px;
    width: 63px;
    height: 63px;
  }
  .back-button svg {
    width: 28.5px;
    height: 28.5px;
  }
  .top-actions {
    flex: 0 0 auto;
    gap: 10px;
  }
  .icon-button {
    flex: 0 0 57px;
    width: 57px;
    height: 57px;
  }
  .icon-button svg {
    width: 28.5px;
    height: 28.5px;
  }
}
/* PHOENIX GEMFORGE V6 — mobile bottom dock correction.
   Desktop styles and game/API logic are intentionally untouched. */
@media (max-width: 699px) {
  .game-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    /* The flexible spacer moves the complete control stack toward the
       bottom while keeping the bet panel and balance close together. */
    grid-template-rows: auto auto auto auto minmax(12px, 1fr) auto auto auto auto;
    align-content: stretch;
    justify-items: center;
    align-items: center;
    gap: clamp(5px, .8vh, 9px);
  }

  .game-heading { grid-row: 1; align-self: start; }
  .bonus-strip { grid-row: 2; }
  .reel-frame { grid-row: 3; align-self: center; }
  .result-line { grid-row: 4; }

  .spin-controls {
    grid-row: 6;
    margin-top: 0;
    padding: 3px 0 0;
    align-self: center;
  }

  .control-panel {
    grid-row: 7;
    margin: 0;
    align-self: center;
  }

  .balance-bar {
    grid-row: 8;
    margin: 0 0 clamp(4px, .6vh, 8px);
    align-self: center;
  }

  .demo-note { grid-row: 9; margin: 0; }
}

/* Short phones: preserve the same order and spacing, but allow the spacer
   to collapse before any controls overlap or force horizontal clipping. */
@media (max-height: 720px) and (max-width: 699px) {
  .game-stage {
    grid-template-rows: auto auto auto auto minmax(4px, 1fr) auto auto auto auto;
    gap: 4px;
  }

  .spin-controls { padding-top: 2px; }
  .control-panel { margin: 0; }
  .balance-bar { margin-bottom: 3px; }
}


/* GEMFORGE V7 - mobile spin controls slightly higher */
@media (max-width: 699px) {
  .spin-controls {
    transform: translateY(-8px);
  }
}


/* GEMFORGE V8 - slight mobile reel and control adjustment */
@media (max-width: 699px) {
  .spin-controls {
    transform: translateY(-12px);
  }

  .reel-frame {
    width: min(98vw, 640px);
    aspect-ratio: 1.65 / 1;
  }
}

@media (max-height: 720px) and (max-width: 699px) {
  .spin-controls {
    transform: translateY(-12px);
  }

  .reel-frame {
    width: min(97vw, 630px);
    aspect-ratio: 1.70 / 1;
  }
}


/* GEMFORGE V9 - taller mobile reels */
@media (max-width: 699px) {
  .reel-frame {
    width: min(98vw, 640px);
    aspect-ratio: 1.60 / 1;
  }
}
@media (max-height: 720px) and (max-width: 699px) {
  .reel-frame {
    width: min(97vw, 630px);
    aspect-ratio: 1.65 / 1;
  }
}


/* GEMFORGE V10 - taller phone reels */
@media (max-width: 699px) {
  .reel-frame {
    width: min(99vw, 660px);
    aspect-ratio: 1.52 / 1;
  }
}
@media (max-height: 720px) and (max-width: 699px) {
  .reel-frame {
    width: min(98vw, 650px);
    aspect-ratio: 1.57 / 1;
  }
}


/* GEMFORGE V11 - remove headings and taller mobile reels */
.brand-game,
.heading-kicker {
  display: none !important;
}

@media (max-width: 699px) {
  .reel-frame {
    width: min(99vw, 660px);
    aspect-ratio: 1.47 / 1;
  }
}

@media (max-height: 720px) and (max-width: 699px) {
  .reel-frame {
    width: min(98vw, 650px);
    aspect-ratio: 1.52 / 1;
  }
}
