:root {
  --ink: #0a0508; --cream: #fff4d6;
  --gold-hi: #fff6c2; --gold: #ffd557; --gold-mid: #f0a51a; --gold-lo: #8a5606; --gold-deep: #3a1c02;
  /* theme colours, overridden per machine */
  --bg1: #4a0f1c; --bg2: #14060a; --accent: #ffd557;
  --orb1: #fff3a0; --orb2: #f5a400; --orb3: #a85a00;
  --display: 'Bowlby One', 'Arial Black', Impact, sans-serif;
  --ui: 'Outfit', -apple-system, system-ui, 'Segoe UI', Roboto, sans-serif;
  --gold-grad: linear-gradient(180deg, var(--gold-hi) 0%, var(--gold) 34%, var(--gold-mid) 58%, #c26a00 74%, var(--gold-hi) 100%);
  /* the app is always landscape: on a phone held upright it is turned a quarter turn (see #app) */
  --aw: 100dvw; --ah: 100dvh;
  --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px); --sb: min(env(safe-area-inset-bottom, 0px), 12px);
  --cell: min(calc((var(--ah) - 162px - var(--sb)) / 3), calc((var(--aw) - var(--sl) - var(--sr) - 40px) / 6.5));
  --reel: #16309a;
  --gold-rim: linear-gradient(135deg, var(--gold-hi) 0%, var(--gold-mid) 18%, var(--gold-lo) 38%, var(--gold) 52%, var(--gold-lo) 70%, var(--gold-mid) 86%, var(--gold-hi) 100%);
}
@media (orientation: portrait) {
  :root { --aw: 100dvh; --ah: 100dvw; --sl: env(safe-area-inset-top, 0px); --sr: env(safe-area-inset-bottom, 0px); --sb: 0px; }
  #app { transform-origin: 0 0; transform: rotate(90deg) translateY(-100%); }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
[hidden] { display: none !important; }
html, body {
  margin: 0; height: 100%; background: #000; color: var(--cream); overscroll-behavior: none; touch-action: manipulation;
  font-family: var(--ui); font-weight: 500;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
button:disabled { opacity: .45; }
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

#app {
  position: fixed; top: 0; left: 0; width: var(--aw); height: var(--ah); overflow: hidden;
  display: flex; flex-direction: column;
  padding: 6px calc(var(--sr) + 10px) 0 calc(var(--sl) + 10px);
  background:
    radial-gradient(100% 46% at 50% 0%, var(--bg1), transparent 100%),
    radial-gradient(90% 36% at 50% 104%, color-mix(in srgb, var(--bg1) 70%, #000), transparent 100%),
    linear-gradient(var(--bg2), var(--ink));
}
#app[class^="m-"] { background: linear-gradient(rgba(0, 0, 0, .15), rgba(0, 0, 0, .15)), var(--scene) center / cover no-repeat, var(--ink); }
#fxBack, #fxFront { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#fxBack { z-index: 0; }
#fxFront { z-index: 45; }
#hud, #lobby, #game { position: relative; z-index: 1; }
#flash { position: absolute; inset: 0; z-index: 44; pointer-events: none; opacity: 0; background: #fff; }

.logo span, #win, #gameName, .card h3, #banner > div, #bwTitle i, #sheet h2, .timer {
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---- top bar ---- */
#hud { flex: none; display: flex; align-items: center; gap: 8px; height: 32px; }
.pill {
  display: flex; align-items: center; gap: 7px; height: 28px; padding: 0 12px 0 4px; border-radius: 14px;
  background: linear-gradient(#0d070b, #24131b); font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 2px 5px #000, 0 0 0 1.5px var(--gold-lo), 0 1px 0 2px rgba(255, 255, 255, .06);
}
.purse { min-width: 132px; }
.coin {
  width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #fff 0 8%, transparent 24%), radial-gradient(circle at 40% 35%, var(--gold-hi), var(--gold-mid) 55%, var(--gold-lo));
  box-shadow: inset 0 0 0 2px rgba(138, 86, 6, .7), 0 0 8px rgba(255, 190, 60, .6);
}
.level b {
  display: grid; place-items: center; width: 21px; height: 21px; border-radius: 50%; font-family: var(--display); font-weight: 400;
  font-size: 11px; color: var(--gold-deep); background: radial-gradient(circle at 35% 28%, var(--gold-hi), var(--gold) 45%, var(--gold-mid)); box-shadow: 0 0 8px rgba(255, 190, 60, .5);
}
.bar { width: 78px; height: 8px; border-radius: 4px; background: #000; box-shadow: inset 0 1px 2px #000, 0 0 0 1px rgba(255, 255, 255, .08); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(#c9ffb0, #3ed46a 55%, #128a3a); transition: width .5s cubic-bezier(.2, 1.3, .4, 1); }
.icon-btn { width: 32px; height: 30px; font-size: 16px; }
#updateBtn { height: 28px; padding: 0 14px; border-radius: 14px; font-size: 12.5px; color: var(--gold); }
#gameName { flex: 1; text-align: center; font-family: var(--display); font-size: 15px; letter-spacing: 1px; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .6)); }

/* ---- lobby ---- */
#lobby { flex: 1; min-height: 0; display: flex; gap: 14px; padding: 6px 0 calc(var(--sb) + 10px); }
.lobby-side { flex: none; width: 150px; display: flex; flex-direction: column; justify-content: center; gap: 12px; text-align: center; }
.logo { margin: 0 0 6px; font-family: var(--display); font-weight: 400; line-height: .88; filter: drop-shadow(0 3px 0 #5c3202) drop-shadow(0 0 22px rgba(255, 170, 40, .55)); }
.logo span { display: block; }
.logo span:first-child { font-size: 21px; letter-spacing: 4px; }
.logo span:last-child { font-size: 48px; letter-spacing: 2px; }
#installTip { margin: 0; font-size: 11.5px; line-height: 1.35; opacity: .8; }
#machines { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; padding: 5px; }
.card {
  position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; padding: 0 8px 12px; border-radius: 16px;
  background: linear-gradient(transparent 30%, rgba(0, 0, 0, .86) 76%), var(--scene) center / cover no-repeat, var(--bg2);
  box-shadow: 0 0 0 2px var(--gold-deep), 0 0 0 4px var(--gold-mid), 0 0 0 5px var(--gold-deep), 0 12px 24px rgba(0, 0, 0, .65), inset 0 0 30px rgba(0, 0, 0, .5);
  transition: transform .12s;
}
.card:active { transform: scale(.96); }
.card .art { position: relative; flex: 1; min-height: 70px; width: 100%; display: grid; place-items: center; }
.card .art > * { grid-area: 1 / 1; }
.card .art .disc { height: 58px; }
.card .art .corona { height: 104px; }
.card .g { position: absolute; bottom: -2px; width: 68px; height: 52px; }
.card .g1 { left: -6px; transform: rotate(-7deg); }
.card .g2 { right: -6px; transform: rotate(7deg); }
.card h3 { margin: 4px 0 4px; font-family: var(--display); font-weight: 400; font-size: 15.5px; line-height: 1.1; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .6)); }
.card p { margin: 0; font-size: 11.5px; line-height: 1.3; opacity: .85; }
.card .grand {
  display: inline-block; margin-top: 6px; padding: 3px 12px; border-radius: 10px; font-style: normal; font-family: var(--display); font-size: 12px;
  color: #fff3b0; background: linear-gradient(#000, #3a0408); box-shadow: 0 0 0 1.5px var(--gold-lo), 0 0 10px rgba(255, 74, 42, .6); text-shadow: 0 0 8px #ff9a1f;
}
.card.locked .art { filter: grayscale(1) brightness(.45); }
.card.locked h3 { filter: grayscale(1) brightness(.7); }
.card .lock { display: inline-block; padding: 4px 12px; border-radius: 12px; background: #000; box-shadow: 0 0 0 1px var(--gold-lo); font-size: 12px; font-weight: 700; color: var(--gold); }


.btn {
  padding: 13px 14px; border-radius: 14px; font-weight: 700; background: linear-gradient(#3a2530, #1b0f15);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 0 0 1.5px var(--gold-lo), 0 4px 0 #000, 0 8px 14px rgba(0, 0, 0, .5);
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 0 0 1.5px var(--gold-lo), 0 1px 0 #000; }
.btn.gold {
  display: block; width: 100%; margin-top: 14px; font-family: var(--display); font-weight: 400; font-size: 17px; color: var(--gold-deep);
  background: linear-gradient(var(--gold-hi), var(--gold) 40%, var(--gold-mid)); box-shadow: inset 0 1px 0 #fff, 0 4px 0 var(--gold-lo), 0 8px 14px rgba(0, 0, 0, .5);
}
.btn.small { padding: 0; width: 58px; height: 38px; border-radius: 11px; font-size: 13px; }
.btn.on { background: linear-gradient(#ff6b5c, #a8101c); }
.btn.glow { animation: glow 1.5s ease-in-out infinite; }
.link-btn { padding: 8px 6px; font-size: 14px; opacity: .75; }
@keyframes glow { 50% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 0 0 1.5px var(--gold), 0 4px 0 #000, 0 0 22px rgba(255, 200, 80, .85); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { transform: scale(.2); opacity: 0; } }
@keyframes enter { from { transform: scale(.94); opacity: 0; } }
#lobby, #game { animation: enter .35s cubic-bezier(.2, 1, .3, 1); }

/* ---- game ---- */
#game { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; }
#cabinet { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; }

/* jackpot strip: four lit meters in one row, exactly as wide as the reels */
#jackpots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 0 2px; }
.jp {
  --c: #ff3b3b; --lo: #5a000c; display: flex; flex-direction: column; align-items: center; padding: 3px 2px 1px; border-radius: 6px; overflow: hidden;
  background: linear-gradient(#000, color-mix(in srgb, var(--lo) 60%, #000));
  box-shadow: inset 0 0 0 1.5px var(--c), inset 0 4px 8px #000, 0 0 0 1.5px var(--gold-deep), 0 0 12px color-mix(in srgb, var(--c) 40%, transparent);
}
.jp label { font-family: var(--display); font-size: 9px; line-height: 1; letter-spacing: 2px; text-transform: uppercase; color: var(--c); }
.jp span {
  font-family: var(--display); font-size: calc(var(--cell) * .2); line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap;
  color: color-mix(in srgb, var(--c) 30%, #fff); text-shadow: 0 0 9px var(--c), 0 1px 0 #000;
}
.jp.grand { --c: #ff4a2a; --lo: #6a000c; }
.jp.major { --c: #c56bff; --lo: #3a0d7a; }
.jp.minor { --c: #4aa8ff; --lo: #0d3a7a; }
.jp.mini { --c: #4fe07a; --lo: #0a5a2a; }
.jp.grand span { color: #fff3b0; text-shadow: 0 0 10px #ff9a1f, 0 0 3px #ff4a2a, 0 1px 0 #8a2a00; }

#frame {
  position: relative; padding: 6px; border-radius: 12px; background: var(--rim, var(--gold-rim));
  box-shadow: 0 0 0 2px var(--gold-deep), inset 0 1px 0 rgba(255, 255, 255, .8), inset 0 -2px 0 rgba(0, 0, 0, .35),
    0 16px 30px rgba(0, 0, 0, .7), 0 0 46px color-mix(in srgb, var(--accent) 38%, transparent);
}
#frame.fs { box-shadow: 0 0 0 2px var(--gold-deep), inset 0 1px 0 rgba(255, 255, 255, .8), 0 16px 30px rgba(0, 0, 0, .7), 0 0 60px 6px var(--accent); }
#reels {
  position: relative; display: grid; grid-template-columns: repeat(5, calc(var(--cell) * 1.3)); gap: 3px; padding: 3px; border-radius: 7px; background: linear-gradient(#3a1c02, #b8780e 50%, #3a1c02);
  box-shadow: inset 0 0 0 2px var(--gold-deep), 0 0 0 1px rgba(0, 0, 0, .6); overflow: hidden;
}
#reels::after {
  content: ''; position: absolute; inset: 0; z-index: 4; pointer-events: none; border-radius: 7px;
  background: linear-gradient(rgba(0, 0, 0, .45), transparent 9%, transparent 91%, rgba(0, 0, 0, .45));
  box-shadow: inset 0 0 10px 1px rgba(0, 0, 0, .8);
}
.reel {
  grid-row: 1; height: calc(var(--cell) * 3); position: relative; container-type: inline-size; clip-path: inset(0 -14px);
  background: linear-gradient(90deg, rgba(0, 0, 0, .38), transparent 14%, transparent 86%, rgba(0, 0, 0, .38)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .045) 0 1.5px, transparent 1.5px 13px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, .045) 0 1.5px, transparent 1.5px 13px),
    linear-gradient(color-mix(in srgb, var(--reel) 62%, #000), var(--reel) 50%, color-mix(in srgb, var(--reel) 62%, #000));
}
.reel.antic { z-index: 3; animation: antic .28s ease-in-out infinite alternate; }
@keyframes antic {
  from { box-shadow: 0 0 0 2px var(--gold), 0 0 14px 2px var(--orb2), inset 0 0 20px var(--orb2); }
  to { box-shadow: 0 0 0 2px var(--gold-hi), 0 0 30px 8px var(--orb2), inset 0 0 34px var(--orb2); }
}
.strip { position: absolute; top: 0; left: 0; width: 100%; will-change: transform; }
.blur .disc, .blur .corona { transform: scaleY(1.35); opacity: .7; }
.cell { height: var(--cell); display: grid; place-items: center; position: relative; }
.cell > * { grid-area: 1 / 1; }
.cell.dim { opacity: .25; }
.cell.win { z-index: 3; }
.cell.win > * { animation: winpulse .7s ease-in-out infinite; }
.cell.win::after, .mega.win::after {
  content: ''; position: absolute; inset: 2px; border-radius: 7px; border: 2.5px solid var(--gold-hi);
  box-shadow: 0 0 14px 2px var(--gold-mid), inset 0 0 14px rgba(255, 200, 80, .55);
}
.cell.pop > * { animation: land .45s cubic-bezier(.25, 1.7, .4, 1); }
@keyframes winpulse { 50% { transform: scale(1.16) rotate(-2deg); } }
@keyframes land { 0% { transform: scale(1.9); opacity: 0; } 40% { opacity: 1; } }

.s { grid-area: 1 / 1; display: block; width: 100%; height: 100%; background: center / contain no-repeat; }

/* the orb: a small sun */
.corona {
  grid-area: 1 / 1; height: 134%; aspect-ratio: 1; border-radius: 50%; opacity: .8;
  background: repeating-conic-gradient(var(--orb2) 0 var(--ray, 7deg), transparent var(--ray, 7deg) var(--gap, 22.5deg));
  -webkit-mask: radial-gradient(circle, #000 36%, transparent 68%); mask: radial-gradient(circle, #000 36%, transparent 68%);
}
.reel:not(.blur) .corona, .card .corona { animation: spin var(--turn, 10s) linear infinite; }
.disc {
  grid-area: 1 / 1; position: relative; display: grid; place-items: center; height: 88%; aspect-ratio: 1; border-radius: 50%;
  background:
    radial-gradient(circle at 33% 24%, rgba(255, 255, 255, .95) 0 5%, transparent 21%),
    radial-gradient(circle at 55% 112%, var(--orb1) 0, transparent 46%),
    radial-gradient(circle at 40% 34%, var(--orb1), var(--orb2) 46%, var(--orb3) 94%);
  box-shadow: 0 0 0 1.5px var(--orb3), 0 0 16px 2px var(--orb2), inset 0 -7px 11px rgba(0, 0, 0, .42), inset 0 2px 3px rgba(255, 255, 255, .75);
}
.disc span {
  font-family: var(--display); font-size: 19cqw; line-height: 1; color: #fff; letter-spacing: -.5px;
  -webkit-text-stroke: 4cqw rgba(40, 14, 0, .85); paint-order: stroke fill;
}
.jp-mini { --orb1: #e6ffec; --orb2: #2fd06a; --orb3: #0a5a2a; }
.jp-minor { --orb1: #e0f1ff; --orb2: #2f8fff; --orb3: #0a2f7a; }
.jp-major { --orb1: #f3e0ff; --orb2: #b04dff; --orb3: #3d0a7a; }
.jp-mini .disc span, .jp-minor .disc span, .jp-major .disc span { font-size: 15cqw; color: var(--gold-hi); }
.cell.paid .disc { animation: paid .45s ease-out; filter: brightness(1.25); }
@keyframes paid { 30% { transform: scale(1.25); filter: brightness(2); } }

#frame.holding #reels { background: radial-gradient(circle, color-mix(in srgb, var(--bg1) 80%, #000), #000 90%); }
#frame.holding .reel { background: none; }
.cell.empty::before, .cell.slot::before {
  content: ''; position: absolute; inset: 4%; border-radius: 6cqw; background: rgba(0, 0, 0, .55);
  box-shadow: inset 0 2px 8px #000, inset 0 0 0 1px rgba(255, 255, 255, .07);
}
.cell.slot { overflow: hidden; border-radius: 6cqw; }
.cell.slot.tease { box-shadow: 0 0 0 2px var(--gold-hi), 0 0 22px 4px var(--orb2); }
.ministrip { position: absolute; inset: 0; will-change: transform; }
.it { height: 100%; display: grid; place-items: center; }
.it > * { grid-area: 1 / 1; }

.mega {
  grid-row: 1; grid-column: 2 / 5; z-index: 3; display: flex; position: relative; border-radius: 6px; container-type: inline-size;
  background: radial-gradient(circle, #33254a, #0a0710); box-shadow: inset 0 0 0 2px var(--gold-mid), inset 0 0 30px rgba(0, 0, 0, .7);
  animation: pop .4s cubic-bezier(.3, 1.4, .5, 1);
}
.mega .cell { flex: 1; height: auto; }

#lines { position: absolute; inset: 9px; width: calc(100% - 18px); height: calc(100% - 18px); z-index: 5; pointer-events: none; overflow: visible; filter: drop-shadow(0 0 5px rgba(255, 255, 255, .9)); }
#lines polyline { fill: none; stroke-width: 4; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; animation: linefade 1.4s ease-in-out infinite; }
@keyframes linefade { 0% { opacity: 0; } 20%, 60% { opacity: .95; } 100% { opacity: .25; } }

#badge {
  position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%); z-index: 7; display: flex; align-items: center; gap: 6px;
  padding: 3px 16px; border-radius: 14px; font-family: var(--display); font-size: 14px; color: var(--gold-deep); white-space: nowrap;
  background: linear-gradient(var(--gold-hi), var(--gold) 40%, var(--gold-mid)); box-shadow: 0 0 0 2px var(--gold-deep), 0 4px 10px #000;
}
#badge i { width: 13px; height: 13px; border-radius: 50%; background: #5c3202; box-shadow: inset 0 1px 2px #000; }
#badge i.on { background: radial-gradient(circle at 35% 30%, #fff, #ff4a3a 45%, #8a0010); box-shadow: 0 0 8px #ff4a3a; }

#banner {
  position: absolute; inset: 0; z-index: 6; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; border-radius: 12px; font-family: var(--display); font-size: 40px; line-height: 1.05;
  background: radial-gradient(circle, color-mix(in srgb, var(--bg1) 85%, #000), rgba(0, 0, 0, .93));
}
#banner > div {
  display: flex; flex-direction: column; align-items: center; padding: 0 10px;
  filter: drop-shadow(0 3px 0 #5c3202) drop-shadow(0 0 18px rgba(255, 170, 40, .9)); animation: bannerin .45s cubic-bezier(.2, 1.5, .4, 1);
}
#banner small { font-family: var(--ui); font-weight: 800; font-size: 15px; letter-spacing: 4px; text-transform: uppercase; color: var(--cream); margin-bottom: 6px; }
@keyframes bannerin { from { transform: scale(1.5); opacity: 0; } }

#controls {
  flex: none; align-self: stretch; display: flex; align-items: center; gap: 8px; height: calc(52px + var(--sb));
  margin: 10px calc(-10px - var(--sr)) 0 calc(-10px - var(--sl)); padding: 0 calc(var(--sr) + 12px) var(--sb) calc(var(--sl) + 12px);
  background: linear-gradient(#33202a, #150b10); box-shadow: inset 0 1.5px 0 rgba(255, 220, 150, .3), 0 -8px 20px rgba(0, 0, 0, .5);
}
.bet { display: flex; align-items: center; gap: 5px; margin-left: 4px; }
.bet-box { min-width: 80px; padding: 3px 4px 2px; border-radius: 9px; text-align: center; background: #070307; box-shadow: inset 0 2px 6px #000, 0 0 0 1.5px var(--gold-lo); }
.bet label { display: block; font-size: 9px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; opacity: .55; }
.bet span { font-family: var(--display); font-size: 16px; line-height: 1.2; color: var(--gold); font-variant-numeric: tabular-nums; }
.round {
  width: 36px; height: 36px; border-radius: 50%; font-size: 22px; font-weight: 800; line-height: 1; background: linear-gradient(#4a3340, #1b0f15);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 0 0 1.5px var(--gold-lo), 0 3px 0 #000;
}
.round.glow:not(:disabled) { color: var(--gold-deep); background: linear-gradient(var(--gold-hi), var(--gold) 40%, var(--gold-mid)); animation: betglow .8s ease-in-out infinite alternate; }
@keyframes betglow { from { box-shadow: 0 0 0 1.5px var(--gold-lo), 0 3px 0 #000, 0 0 6px var(--gold); } to { box-shadow: 0 0 0 1.5px var(--gold-hi), 0 3px 0 #000, 0 0 24px 6px var(--gold); transform: scale(1.12); } }
.bet-box.max { box-shadow: inset 0 2px 6px #000, 0 0 0 1.5px var(--gold), 0 0 14px rgba(255, 200, 80, .7); }
.bet-box.max label { opacity: 1; color: var(--gold); }
.round:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 0 0 1.5px var(--gold-lo), 0 1px 0 #000; }
#meter { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#meter > div { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
#meter label { font-size: 10px; font-weight: 800; letter-spacing: 3px; text-transform: uppercase; opacity: .5; }
#win { font-family: var(--display); font-size: 29px; line-height: 1.05; font-variant-numeric: tabular-nums; filter: drop-shadow(0 2px 0 #5c3202) drop-shadow(0 0 12px rgba(255, 170, 40, .6)); transition: opacity .3s; }
#win.idle { opacity: .22; filter: none; }
#win.bump { animation: bump .32s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes bump { 30% { transform: scale(1.22); } }
#msg { font-style: normal; font-size: 12px; font-weight: 700; opacity: .8; font-variant-numeric: tabular-nums; }
#spinBtn {
  position: relative; flex: none; width: 136px; height: 44px; padding: 4px; border-radius: 14px; background: var(--rim, var(--gold-rim));
  box-shadow: 0 0 0 2px var(--gold-deep), 0 4px 0 #4a2a02, 0 8px 16px rgba(0, 0, 0, .7); transition: transform .06s, box-shadow .06s, filter .2s;
}
#spinBtn span {
  display: grid; place-items: center; width: 100%; height: 100%; border-radius: 10px; font-family: var(--display); font-size: 23px; letter-spacing: 2px;
  color: var(--cream); text-shadow: 0 2px 0 rgba(0, 0, 0, .5);
  background: linear-gradient(#ff8e6e, #d81a26 52%, #6a000c);
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, .5), inset 0 -6px 10px rgba(0, 0, 0, .45);
}
#spinBtn::before { content: ''; position: absolute; inset: -3px; border-radius: 16px; animation: halo 1.8s ease-out infinite; }
@keyframes halo { from { box-shadow: 0 0 0 0 rgba(255, 200, 80, .7); } to { box-shadow: 0 0 0 14px rgba(255, 200, 80, 0); } }
#spinBtn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 2px var(--gold-deep), 0 1px 0 #4a2a02, 0 4px 8px rgba(0, 0, 0, .7); }
#spinBtn:disabled { opacity: 1; filter: saturate(.45) brightness(.7); }
#spinBtn:disabled::before { animation: none; }

/* ---- overlays ---- */
#toasts { position: absolute; top: 44px; left: 0; right: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast {
  max-width: 70%; padding: 8px 18px; border-radius: 14px; font-size: 14px; text-align: center; line-height: 1.35;
  background: linear-gradient(#3a2530, #150b10); box-shadow: 0 0 0 1.5px var(--gold-mid), 0 8px 20px #000; animation: toastin .4s cubic-bezier(.2, 1.4, .4, 1);
}
.toast b { color: var(--gold); }
@keyframes toastin { from { transform: translateY(-30px); opacity: 0; } }

#intro {
  position: absolute; inset: 0; z-index: 42; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 20px;
  background: radial-gradient(circle, transparent 20%, rgba(0, 0, 0, .7)), var(--scene) center / cover no-repeat, var(--ink); animation: worldin 1.5s cubic-bezier(.2, .8, .3, 1);
}
#intro h2 {
  margin: 0; font-family: var(--display); font-weight: 400; font-size: 42px; line-height: 1.02;
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 #5c3202) drop-shadow(0 0 26px var(--accent)); animation: bannerin .7s cubic-bezier(.2, 1.4, .4, 1);
}
#intro small { font-weight: 800; font-size: 15px; letter-spacing: 4px; text-transform: uppercase; text-shadow: 0 2px 6px #000; margin-bottom: 8px; }
#intro .count {
  font-family: var(--display); font-weight: 400; font-size: 104px; line-height: .95; color: #fff;
  text-shadow: 0 6px 0 var(--gold-lo), 0 0 40px var(--accent), 0 0 12px #fff; animation: count .9s cubic-bezier(.2, 1.7, .3, 1) .35s backwards;
}
#intro .how { font-weight: 500; font-size: 14px; opacity: .9; }
@keyframes count { from { transform: scale(4) rotate(-14deg); opacity: 0; } }
#intro p { margin: 6px 0 0; font-weight: 800; font-size: 16px; letter-spacing: .5px; text-shadow: 0 2px 6px #000; }
@keyframes worldin { from { transform: scale(1.5); opacity: 0; } 25% { opacity: 1; } }
#bigwin { position: absolute; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; background: radial-gradient(circle, rgba(90, 40, 0, .82), rgba(0, 0, 0, .95) 75%); animation: fade .3s; }
@keyframes fade { from { opacity: 0; } }
.rays {
  position: absolute; width: 190vmax; aspect-ratio: 1; border-radius: 50%; animation: spin 16s linear infinite;
  background: repeating-conic-gradient(rgba(255, 213, 87, .13) 0 8deg, transparent 8deg 20deg);
  -webkit-mask: radial-gradient(circle, #000, transparent 60%); mask: radial-gradient(circle, #000, transparent 60%);
}
#bwTitle { position: relative; margin: 0; font-family: var(--display); font-weight: 400; font-size: 54px; line-height: 1; text-align: center; filter: drop-shadow(0 4px 0 #5c3202) drop-shadow(0 0 26px rgba(255, 170, 40, .95)); }
#bwTitle i { display: inline-block; font-style: normal; white-space: pre; animation: letter .55s cubic-bezier(.2, 1.7, .4, 1) backwards; animation-delay: calc(var(--i) * 45ms); }
@keyframes letter { from { transform: translateY(-70px) scale(2) rotate(-12deg); opacity: 0; } }
#bwTitle span { display: inline-block; white-space: nowrap; }
#bwAmount { position: relative; margin-top: 10px; font-family: var(--display); font-size: 44px; color: var(--cream); text-shadow: 0 3px 0 rgba(0, 0, 0, .6), 0 0 20px rgba(255, 200, 80, .6); font-variant-numeric: tabular-nums; }

/* covers everything while the game starts, and again from the moment a refresh is tapped */
#loading {
  position: absolute; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(100% 80% at 50% 0%, #4a0f1c, #14060a 70%, #0a0508);
}
#loading p { margin: 0; font-weight: 800; font-size: 15px; letter-spacing: 3px; text-transform: uppercase; }
#loading i { width: 34px; height: 34px; border-radius: 50%; border: 4px solid rgba(255, 213, 87, .25); border-top-color: var(--gold); animation: spin .8s linear infinite; }
#modal { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .8); animation: fade .2s; }
#sheet {
  width: min(92%, 540px); max-height: 90%; overflow-y: auto; padding: 16px 18px; border-radius: 20px; text-align: center;
  background: radial-gradient(120% 60% at 50% 0%, #4a2536, #1a0d14 90%);
  box-shadow: 0 0 0 2px var(--gold-deep), 0 0 0 4px var(--gold-mid), 0 20px 40px #000; animation: enter .3s cubic-bezier(.2, 1.3, .4, 1);
}
#sheet h2 { margin: 0 0 8px; font-family: var(--display); font-weight: 400; font-size: 23px; }
#sheet p { margin: 8px 0; font-size: 14.5px; line-height: 1.5; opacity: .9; }
#sheet input { width: 100%; padding: 12px; border-radius: 12px; border: 2px solid var(--gold-lo); background: #fff; color: #000; font: 500 16px var(--ui); user-select: text; -webkit-user-select: text; }
.timer { margin: 8px 0; font-family: var(--display); font-size: 52px; font-variant-numeric: tabular-nums; }
.pledge { padding: 12px; border-radius: 12px; background: rgba(0, 0, 0, .45); font-weight: 700; font-size: 16px !important; }

.ach-list { text-align: left; }
.ach { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, .08); opacity: .7; }
.ach.got { opacity: 1; }
.ach > span { font-size: 24px; }
.ach > div { flex: 1; }
.ach b, .ach small { display: block; }
.ach small { opacity: .7; font-size: 12px; margin-bottom: 5px; }
.ach .bar { width: 100%; height: 6px; }
.ach em { font-style: normal; font-weight: 800; font-size: 12px; color: var(--gold); }

.pays { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.pays th { font-size: 12px; opacity: .6; }
.pays td { padding: 0 4px; font-weight: 700; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.pays td:first-child { width: 56px; }
.pays .cell { height: 43px; }

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

/* ---- free games: the whole world lights up ---- */
#app.free::before {
  content: ''; position: absolute; left: 50%; top: 42%; width: 240vmax; aspect-ratio: 1; margin: -120vmax 0 0 -120vmax; z-index: 0; pointer-events: none;
  background: repeating-conic-gradient(color-mix(in srgb, var(--accent) 30%, transparent) 0 7deg, transparent 7deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 0, transparent 46%); mask: radial-gradient(circle, #000 0, transparent 46%);
  animation: spin 22s linear infinite, fade .8s;
}
#app.free #frame { animation: freeglow 1s ease-in-out infinite alternate; }
@keyframes freeglow {
  from { box-shadow: 0 0 0 2px var(--gold-deep), inset 0 1px 0 rgba(255, 255, 255, .8), 0 16px 30px rgba(0, 0, 0, .7), 0 0 30px 2px var(--accent); }
  to { box-shadow: 0 0 0 2px var(--gold-deep), inset 0 1px 0 rgba(255, 255, 255, .8), 0 16px 30px rgba(0, 0, 0, .7), 0 0 80px 14px var(--accent); }
}
#app.free .reel {
  background: linear-gradient(90deg, rgba(0, 0, 0, .35), transparent 18%, transparent 82%, rgba(0, 0, 0, .35)),
    linear-gradient(color-mix(in srgb, var(--accent) 22%, #000), color-mix(in srgb, var(--accent) 48%, #1a1220) 50%, color-mix(in srgb, var(--accent) 22%, #000));
}
#app.free #msg { font-family: var(--display); font-size: 14px; opacity: 1; color: var(--accent); text-shadow: 0 2px 0 #000, 0 0 14px var(--accent); }
#app.free #badge { bottom: -13px; padding: 2px 22px; font-size: 19px; border-radius: 18px; }
#app.free #spinBtn:disabled { filter: none; }
#app.free #spinBtn span { font-size: 30px; background: linear-gradient(color-mix(in srgb, var(--accent) 60%, #fff), var(--accent) 52%, color-mix(in srgb, var(--accent) 35%, #000)); color: #fff; }
