/* Fonts: system stack by default. To self-host, add @font-face rules for
   "Unbounded" / "Inter Tight" pointing at files in fonts/ (see README). */

/* ───────── tokens ───────── */
:root {
  --bg: #07060b;
  --bg-2: #0e0c16;
  --panel: rgba(22, 19, 34, 0.62);
  --panel-solid: #15121f;
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.16);
  --text: #f3f1fa;
  --muted: #9a94b0;
  --purple: #9945ff;
  --green: #14f195;
  --cyan: #3ce0ff;
  --pink: #ff4fd8;
  --warn: #ffb547;
  --up: #22e39a;
  --down: #ff5c7a;
  --radius: 22px;
  --cell: clamp(92px, 20vw, 168px);
  --display: "Unbounded", "SF Pro Display", ui-rounded, "Segoe UI Black", system-ui, sans-serif;
  --body: "Inter Tight", "SF Pro Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100dvh; overflow-x: hidden;
  background: var(--bg); color: var(--text);
  font: 500 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
code, .mono { font-family: var(--mono); }
kbd { font: 600 11px var(--mono); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-2); background: rgba(255,255,255,.04); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: 8px; }
[hidden] { display: none !important; }

/* ───────── ambient background ───────── */
.aurora { position: fixed; inset: -20%; z-index: -4; filter: blur(80px) saturate(140%); opacity: .75; pointer-events: none; }
.aurora i { position: absolute; width: 55vmax; height: 55vmax; border-radius: 50%; mix-blend-mode: screen; animation: drift 22s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { background: radial-gradient(circle, rgba(153,69,255,.55), transparent 60%); left: 5%; top: 0%; }
.aurora i:nth-child(2) { background: radial-gradient(circle, rgba(20,241,149,.35), transparent 60%); right: 0%; top: 20%; animation-duration: 28s; animation-delay: -6s; }
.aurora i:nth-child(3) { background: radial-gradient(circle, rgba(255,79,216,.28), transparent 60%); left: 30%; bottom: -10%; animation-duration: 34s; animation-delay: -12s; }
@keyframes drift {
  0% { transform: translate3d(0,0,0) scale(1); }
  50% { transform: translate3d(8vw,-6vh,0) scale(1.15); }
  100% { transform: translate3d(-6vw,8vh,0) scale(.95); }
}

.grid-floor {
  position: fixed; left: -50%; right: -50%; bottom: -10vh; height: 60vh; z-index: -3; pointer-events: none;
  background-image:
    linear-gradient(rgba(153,69,255,.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(153,69,255,.22) 1px, transparent 1px);
  background-size: 60px 60px;
  transform: perspective(500px) rotateX(62deg);
  transform-origin: 50% 100%;
  mask-image: linear-gradient(to top, #000 10%, transparent 80%);
  -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 80%);
  animation: floor 3s linear infinite;
}
@keyframes floor { to { background-position: 0 60px, 0 0; } }

.grain {
  position: fixed; inset: -50%; z-index: 50; pointer-events: none; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
  0%,100% { transform: translate(0,0); } 20% { transform: translate(-4%,3%); } 40% { transform: translate(3%,-5%); }
  60% { transform: translate(-6%,-2%); } 80% { transform: translate(5%,4%); }
}

.cursor-glow {
  position: fixed; left: 0; top: 0; width: 520px; height: 520px; margin: -260px 0 0 -260px; z-index: -2; pointer-events: none;
  background: radial-gradient(circle, rgba(20,241,149,.12), transparent 60%);
  transform: translate3d(var(--x, 50vw), var(--y, 40vh), 0);
  transition: transform .25s var(--ease-out);
}
@media (hover: none) { .cursor-glow { display: none; } }

.floaters { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.floater {
  position: absolute; bottom: -120px; width: var(--s); height: var(--s); border-radius: 50%;
  display: grid; place-items: center; font: 800 calc(var(--s) * .32) var(--display); color: rgba(0,0,0,.55);
  background: radial-gradient(circle at 30% 28%, rgba(255,255,255,.9), var(--c) 38%, color-mix(in oklab, var(--c), #000 45%) 100%);
  box-shadow: inset -6px -8px 16px rgba(0,0,0,.35), 0 10px 40px color-mix(in oklab, var(--c), transparent 60%);
  opacity: .0; filter: blur(var(--b));
  animation: floatUp var(--d) linear infinite; animation-delay: var(--dl);
}
.floater svg { width: 56%; height: 56%; opacity: .8; }
.floater img { width: 58%; height: 58%; border-radius: 28%; opacity: .85; }
@keyframes floatUp {
  0% { transform: translate3d(0,0,0) rotate(0); opacity: 0; }
  10% { opacity: var(--o); }
  90% { opacity: var(--o); }
  100% { transform: translate3d(var(--dx), -125vh, 0) rotate(var(--r)); opacity: 0; }
}

#fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 56; pointer-events: none; }

/* ───────── header ───────── */
.top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) clamp(16px, 4vw, 40px) 12px;
  backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
  background: linear-gradient(to bottom, rgba(7,6,11,.75), rgba(7,6,11,.35));
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark { display: grid; gap: 3px; width: 26px; }
.brand-mark span { height: 5px; border-radius: 2px; background: linear-gradient(90deg, var(--purple), var(--green)); transform: skewX(-30deg); animation: bars 2.4s var(--ease-out) infinite; }
.brand-mark span:nth-child(2) { transform: skewX(30deg); animation-delay: .15s; }
.brand-mark span:nth-child(3) { animation-delay: .3s; }
@keyframes bars { 0%, 70%, 100% { filter: none; } 80% { filter: brightness(2) drop-shadow(0 0 6px var(--green)); } }
.brand-word { font: 700 20px/1 var(--display); letter-spacing: -.02em; }
.brand-word b { font-weight: 900; background: linear-gradient(90deg, var(--green), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.top-actions { display: flex; gap: 8px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px;
  background: rgba(255,255,255,.04); border: 1px solid var(--line-2); font-size: 13px; font-weight: 600;
  transition: background .2s, border-color .2s, transform .2s var(--ease-spring);
}
.chip:hover { background: rgba(255,255,255,.08); transform: translateY(-1px); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 0 var(--warn); animation: ping 2s infinite; }
.chip[aria-pressed="true"] { border-color: color-mix(in oklab, var(--green), transparent 50%); }
.chip[aria-pressed="true"] .dot { background: var(--green); --pc: var(--green); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in oklab, currentColor, transparent 40%); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-2); background: rgba(255,255,255,.04); transition: background .2s, transform .2s var(--ease-spring); }
.icon-btn:hover { background: rgba(255,255,255,.08); transform: scale(1.06); }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.icon-btn .ic-off { display: none; }
.icon-btn[aria-pressed="true"] .ic-on { display: none; }
.icon-btn[aria-pressed="true"] .ic-off { display: block; }

/* ───────── layout ───────── */
main { width: min(1120px, 100%); margin: 0 auto; padding: 0 16px; }
@keyframes rise { to { opacity: 1; transform: none; filter: none; } }

/* ───────── machine: 3D drum with copper rings, neon caps and a pull lever ───────── */
.machine-wrap { display: grid; gap: 20px; justify-items: center; align-content: center; min-height: calc(100dvh - 64px); padding: clamp(16px, 4vw, 40px) 0; }
.machine {
  --cap: clamp(26px, 5.4vw, 54px);   /* end-cap width */
  --ringw: clamp(10px, 1.9vw, 18px); /* copper ring width */
  --lever: clamp(34px, 7vw, 64px);   /* room for the lever on the right */
  --reel-h: calc(var(--cell) * 2.05);
  position: relative; width: min(820px, 100%);
  padding: clamp(10px, 2vw, 18px) calc(var(--cap) * .6 + var(--lever) * .95 + 4px) 0 calc(var(--cap) * .6 + 2px);
  opacity: 0; transform: translateY(24px) scale(.98); animation: rise 1s .45s var(--ease-out) forwards;
  isolation: isolate;
}
.machine-glow {
  position: absolute; left: 6%; right: 12%; top: 30%; bottom: -8%; z-index: -1; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 55%, rgba(255,63,180,.35), rgba(120,60,255,.22) 45%, transparent 70%);
  filter: blur(40px); opacity: .7; transition: opacity .4s;
}
.machine.spinning .machine-glow { opacity: 1; animation: glowPulse .5s ease-in-out infinite alternate; }
@keyframes glowPulse { to { filter: blur(40px) brightness(1.35); } }

/* One housing: [neon end | barrel (ring reel ring reel ring reel ring) | neon end],
   clipped to a single cylinder silhouette and shaded by one shared overlay, so every
   part curves and lights together. Hubs + lever hang off the same wrapper. */
.drum { position: relative; }
.labels, .barrel {
  display: grid; grid-template-columns: var(--ringw) 1fr var(--ringw) 1fr var(--ringw) 1fr var(--ringw);
}
.labels { padding: 0 var(--cap) 14px; }
.reel-label { text-align: center; font: 700 clamp(9px, 1.3vw, 12px) var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reel-label span { color: var(--pink); margin-right: 6px; }
.c2 { grid-column: 2; } .c4 { grid-column: 4; } .c6 { grid-column: 6; }

.housing-wrap { position: relative; --hubw: calc(var(--cap) * .6); --arm: calc(var(--lever) * .42); }
.housing {
  position: relative; display: grid; grid-template-columns: var(--cap) 1fr var(--cap);
  height: var(--reel-h); border-radius: var(--cap) / 50%; overflow: hidden; isolation: isolate;
  box-shadow:
    0 0 0 1.5px rgba(255,170,240,.55),
    0 0 26px rgba(255,79,216,.5), 0 0 90px rgba(150,60,255,.35),
    0 50px 70px -35px rgba(0,0,0,.95);
  transition: box-shadow .3s;
}
.machine.spinning .housing { box-shadow: 0 0 0 1.5px rgba(255,200,245,.8), 0 0 36px rgba(255,79,216,.8), 0 0 120px rgba(150,60,255,.55), 0 50px 70px -35px rgba(0,0,0,.95); }
.machine.won .housing { box-shadow: 0 0 0 2px #fff8, 0 0 40px var(--hl), 0 0 140px var(--hl), 0 50px 70px -35px rgba(0,0,0,.95); }

/* neon end bands: part of the housing, so the clip gives them the rounded drum ends */
.endcap { position: relative; background: linear-gradient(90deg, #4a15b0, #b53cff 28%, #ff8fe4 52%, #d53cff 74%, #5a1cc4); animation: capBreath 3.2s ease-in-out infinite; }
.endcap::after { content: ""; position: absolute; inset: 0; background: radial-gradient(40% 60% at 50% 50%, rgba(255,210,250,.55), transparent 70%); mix-blend-mode: screen; }
@keyframes capBreath { 50% { filter: brightness(1.18) saturate(1.15); } }
.machine.spinning .endcap { animation-duration: .6s; }

.barrel { position: relative; height: 100%; background: #07103f; }
/* copper bands between reels */
.ring { position: relative; z-index: 2;
  background: linear-gradient(90deg, #2a0e05 0%, #8a3a15 18%, #e0874a 38%, #ffd2a8 50%, #d77a3c 62%, #7a3010 82%, #2a0e05 100%);
  box-shadow: -3px 0 6px rgba(0,0,0,.45), 3px 0 6px rgba(0,0,0,.45); }

/* shared cylinder shading + one continuous specular band across the whole drum */
.housing-shade { position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(1,2,16,.85) 0%, rgba(1,2,16,.35) 13%, transparent 30%, transparent 70%, rgba(1,2,16,.4) 87%, rgba(1,2,16,.9) 100%),
    linear-gradient(180deg, transparent 12%, rgba(255,255,255,.26) 15.5%, rgba(255,255,255,.07) 23%, transparent 31%),
    linear-gradient(180deg, transparent 82%, rgba(255,110,220,.16) 91%, transparent 98%); }

/* axle hubs + lever, all hung off the housing wrapper */
.hub { position: absolute; top: 50%; z-index: 3; width: var(--hubw); height: calc(var(--reel-h) * .2); transform: translateY(-50%); border-radius: 6px / 40%;
  background: linear-gradient(180deg, #ffd2a8, #d77a3c 30%, #8a3a15 70%, #2a0e05);
  box-shadow: 0 6px 12px rgba(0,0,0,.55), inset 0 0 0 1px rgba(0,0,0,.35); }
.hub-left { right: calc(100% - 4px); }
.hub-right { left: calc(100% - 4px); }
.lever-arm { position: absolute; top: 50%; z-index: 2; left: calc(100% + var(--hubw) - 10px); width: calc(var(--arm) + 10px); height: calc(var(--reel-h) * .07);
  transform: translateY(-50%); border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, #ffd2a8, #d77a3c 35%, #8a3a15 75%, #2a0e05); box-shadow: 0 5px 10px rgba(0,0,0,.5); }
/* reels: a real 3D cylinder per reel (cells placed by angle in JS) */
.reel {
  position: relative; height: 100%; overflow: hidden; z-index: 1;
  perspective: 900px; container-type: inline-size;
  background:
    linear-gradient(90deg, rgba(2,4,30,.6), transparent 16%, transparent 84%, rgba(2,4,30,.6)),
    radial-gradient(90% 70% at 50% 46%, #3b6dff 0%, #1f44cc 32%, #102687 62%, #050c3a 100%);
}
.reel::before { /* light behind the payline symbol */
  content: ""; position: absolute; left: 50%; top: 50%; width: 120%; aspect-ratio: 1.6; transform: translate(-50%, -50%); z-index: 0;
  background: radial-gradient(closest-side, color-mix(in oklab, var(--hl, #7fa2ff), transparent 55%), transparent);
  opacity: .55; transition: opacity .4s;
}
.reel.landed::before { opacity: 1; animation: landGlow .9s var(--ease-out); }
@keyframes landGlow { 0% { opacity: 1; transform: translate(-50%, -50%) scale(1.5); filter: brightness(1.8); } }
.strip { position: absolute; left: 0; right: 0; top: 50%; height: 0; transform-style: preserve-3d; z-index: 1; }
.strip .cell { position: absolute; left: 0; right: 0; top: calc(var(--cell) / -2); backface-visibility: hidden; }
/* names only on the payline symbol, and only when the reel is still */
.strip .cell .name { opacity: 0; transition: opacity .25s; }
.strip .cell.front .name { opacity: 1; }
.reel.moving .strip .cell .name { opacity: 0; transition: none; }
.cell { height: var(--cell); display: grid; place-items: center; align-content: center; gap: 5px; padding: 8px; text-align: center; }
.cell .logo { width: calc(var(--cell) * .54); aspect-ratio: 1; border-radius: 28%; display: grid; place-items: center; overflow: hidden; position: relative; }
.cell .logo svg, .cell .logo img { width: 100%; height: 100%; display: block; object-fit: cover; }
.cell .logo.pad { background: var(--c); box-shadow: 0 0 22px -2px var(--c), inset 0 -6px 12px rgba(0,0,0,.25), inset 0 3px 0 rgba(255,255,255,.45); }
.cell .logo.pad svg { width: 70%; height: 70%; }
.cell .logo.token { border-radius: 50%; background: #1b1829; box-shadow: 0 0 0 3px rgba(255,178,122,.55), 0 0 22px rgba(255,79,216,.45); }
/* market-cap tier drawn like the classic glossy "7" */
.cell .logo.cap { width: 100%; aspect-ratio: auto; overflow: visible; gap: 0; border-radius: 0; }
.cell .logo.cap .cap-k { font: 800 calc(var(--cell) * .075) var(--mono); letter-spacing: .2em; color: #ffd98a; text-shadow: 0 0 8px rgba(255,160,60,.8); }
.cell .logo.cap .cap-val {
  font: 900 min(calc(var(--cell) * .3), 23cqi)/1 var(--display); letter-spacing: -.05em;
  color: #ff4a2a; -webkit-text-stroke: 1.5px #ffd46a;
  text-shadow: 0 -2px 0 #ffb13a, 0 2px 0 #c0102f, 0 4px 0 #6a0a1e, 0 0 16px color-mix(in oklab, var(--c), transparent 10%), 0 0 30px rgba(255,90,40,.55);
}
.cell .name { font: 700 clamp(9px, 1.5vw, 13px)/1.1 var(--display); letter-spacing: -.01em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #eef0ff; text-shadow: 0 1px 0 rgba(0,0,0,.6); }
.cell .name small { display: block; font: 500 clamp(8px, 1.1vw, 10px) var(--mono); color: #aab4ff; letter-spacing: .04em; margin-top: 2px; }

/* payline: faint light band with gold pointers at the inner edge of the neon ends */
.payline { position: absolute; left: var(--cap); right: var(--cap); top: 50%; z-index: 5; transform: translateY(-50%); height: calc(var(--cell) * .92); pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,.035) 20%, rgba(255,255,255,.05) 50%, rgba(255,255,255,.035) 80%, transparent); }
.payline::before, .payline::after { content: ""; position: absolute; top: 50%; width: 0; height: 0; transform: translateY(-50%);
  border-top: 9px solid transparent; border-bottom: 9px solid transparent; filter: drop-shadow(0 0 6px #ffb347); }
.payline::before { left: 0; border-left: 12px solid #ffd98a; }
.payline::after { right: 0; border-right: 12px solid #ffd98a; }
.machine.won .payline::before, .machine.won .payline::after { animation: pointer .5s ease-in-out 3; }
@keyframes pointer { 50% { filter: drop-shadow(0 0 14px #fff) brightness(1.6); } }

.sweep { position: absolute; inset: 0; pointer-events: none; z-index: 3; background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.55) 50%, transparent 65%); transform: translateX(-120%); mix-blend-mode: overlay; }
.reel.win .sweep { animation: sweep 1.1s .1s var(--ease-out); }
@keyframes sweep { to { transform: translateX(120%); } }
.reel.win .strip .cell.hit .logo { animation: pop .7s var(--ease-spring); }
@keyframes pop { 0% { transform: scale(1); } 35% { transform: scale(1.2); } 100% { transform: scale(1); } }

/* lever: pivots on the end of the copper arm; --pull (0 → 1) drives it */
.lever {
  position: absolute; z-index: 3; bottom: 50%;
  left: calc(100% + var(--hubw) + var(--arm) - var(--lever) * .5 - 4px);
  width: var(--lever); height: calc(var(--reel-h) * .52);
  -webkit-tap-highlight-color: transparent; touch-action: none; cursor: grab; --pull: 0;
}
.lever:active { cursor: grabbing; }
.lever:disabled { cursor: progress; }
.lever-base { position: absolute; left: 50%; bottom: 0; z-index: 1; width: calc(var(--lever) * .42); aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, 50%);
  background: radial-gradient(circle at 35% 30%, #ffd2a8, #d77a3c 40%, #7a3010 80%, #2a0e05); box-shadow: 0 4px 10px rgba(0,0,0,.6); }
.lever-rod { position: absolute; left: calc(50% - 5px); bottom: 0; width: 10px; height: 100%;
  transform-origin: 50% 100%; transform: scaleY(calc(1 - 2 * var(--pull)));
  border-radius: 6px; background: linear-gradient(90deg, #6b6f7a, #f4f6fb 45%, #9aa0ad 60%, #4a4e57); box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.lever-ball { position: absolute; left: 50%; bottom: 100%; width: calc(var(--lever) * .62); aspect-ratio: 1; border-radius: 50%;
  transform: translate(-50%, 50%) translateY(calc(var(--pull) * 2 * var(--reel-h) * .52)) scale(calc(1 + .35 * var(--pull) * (1 - var(--pull)) * 4));
  background: radial-gradient(circle at 34% 28%, #fff 0 8%, #ff8aa0 16%, #ff1d4a 42%, #9a0020 78%, #5a0012);
  box-shadow: 0 0 18px rgba(255,40,90,.75), 0 8px 16px rgba(0,0,0,.45); transition: box-shadow .2s; }
.lever:hover .lever-ball, .lever:focus-visible .lever-ball { box-shadow: 0 0 28px rgba(255,40,90,1), 0 8px 16px rgba(0,0,0,.45); }
.lever:focus-visible { outline: none; }
.lever:focus-visible .lever-ball { outline: 2px solid var(--green); outline-offset: 3px; }
.lever-hint { position: absolute; left: 50%; top: calc(var(--lever) * -.62 - 22px); transform: translateX(-50%); font: 700 10px var(--mono); letter-spacing: .14em; color: #ffd98a; white-space: nowrap; text-transform: uppercase; animation: nudge 1.6s ease-in-out infinite; pointer-events: none; }
@keyframes nudge { 50% { transform: translate(-50%, 6px); opacity: .6; } }
.lever:disabled .lever-hint, .machine.pulled .lever-hint { opacity: 0; animation: none; }

/* controls */
.controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin: clamp(22px, 4vw, 34px) 0 0 var(--cap); }
.readout { display: grid; gap: 2px; min-width: 0; }
.readout.right { text-align: right; }
.readout-k { font: 600 10px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.readout-v { font: 700 clamp(12px, 1.8vw, 15px) var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.loading .dot { background: var(--cyan); animation-duration: .8s; }
.hint { margin: 0; text-align: center; font-size: 12px; color: var(--muted); }
@media (hover: none) { .hint .kb { display: none; } }

/* after the entrance animation, pin the final state so other animations can take over */
.machine.ready { opacity: 1; transform: none; animation: none; }

/* shake + chroma on win */
.machine.shake { animation: shake .5s var(--ease-out); }
@keyframes shake { 0%,100% { transform: none; } 20% { transform: translate(-4px, 2px) rotate(-.4deg); } 40% { transform: translate(4px,-2px) rotate(.4deg); } 60% { transform: translate(-2px,1px); } 80% { transform: translate(2px,-1px); } }
.machine.chroma .drum { animation: chroma .6s steps(6); }
@keyframes chroma { 0%,100% { filter: none; } 30% { filter: drop-shadow(3px 0 0 rgba(255,0,90,.8)) drop-shadow(-3px 0 0 rgba(0,240,255,.8)); } 60% { filter: drop-shadow(-2px 0 0 rgba(255,0,90,.6)) drop-shadow(2px 0 0 rgba(0,240,255,.6)); } }

/* full-screen flash */
.flash { position: fixed; inset: 0; z-index: 45; pointer-events: none; opacity: 0; }
.flash.go { animation: flash .9s var(--ease-out); }
.flash::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at var(--fx, 50%) var(--fy, 50%), rgba(255,255,255,.95), rgba(255,255,255,.35) 25%, transparent 60%); }
.flash::after { content: ""; position: absolute; left: var(--fx, 50%); top: var(--fy, 50%); width: 20px; height: 20px; margin: -10px; border-radius: 50%; border: 2px solid var(--hl, var(--green)); box-shadow: 0 0 30px var(--hl, var(--green)), inset 0 0 30px var(--hl, var(--green)); transform: scale(0); }
.flash.go::after { animation: ring 1s var(--ease-out); }
@keyframes flash { 0% { opacity: 0; } 8% { opacity: 1; } 100% { opacity: 0; } }
@keyframes ring { 0% { transform: scale(0); opacity: 1; } 100% { transform: scale(90); opacity: 0; } }

.win-word { position: fixed; left: 50%; top: 42%; z-index: 46; pointer-events: none; transform: translate(-50%, -50%); font: 900 clamp(48px, 13vw, 170px)/1 var(--display); letter-spacing: -.05em; color: transparent; -webkit-text-stroke: 2px #fff; white-space: nowrap; }
.win-word span { display: inline-block; animation: letter 1.3s var(--ease-out) forwards; animation-delay: calc(var(--i) * 35ms); opacity: 0; }
.win-word.filled { color: #fff; -webkit-text-stroke: 0; mix-blend-mode: difference; }
@keyframes letter { 0% { opacity: 0; transform: translateY(40%) scaleY(1.8); filter: blur(8px); } 25% { opacity: 1; transform: none; filter: none; } 75% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-20%) scale(1.05); filter: blur(6px); } }

/* ───────── win pop-up: jackpot ticket ───────── */
.result {
  position: fixed; inset: 0; z-index: 55; display: grid; place-items: center; overflow-y: auto;
  padding: max(56px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background:
    repeating-conic-gradient(from 0deg at 50% 38%, color-mix(in oklab, var(--hl, var(--green)), transparent 94%) 0 3deg, transparent 3deg 15deg),
    radial-gradient(circle at 50% 38%, color-mix(in oklab, var(--hl, var(--green)), transparent 75%), rgba(4,3,8,.9) 62%);
  backdrop-filter: blur(8px) saturate(130%); -webkit-backdrop-filter: blur(8px) saturate(130%);
  animation: fade .3s ease-out;
}
.result.closing { animation: fadeOut .25s ease-in forwards; }
.result.closing .ticket-glow { animation: popOut .25s ease-in forwards; }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes popOut { to { opacity: 0; transform: translateY(16px) rotate(-2deg) scale(.94); } }
@keyframes cardIn { from { opacity: 0; transform: rotateX(-25deg) translateY(-14px) scale(.96); } }

/* the glow lives on a wrapper so the ticket's notch mask can't clip it */
.ticket-glow {
  position: relative; width: min(400px, 100%);
  filter: drop-shadow(0 0 1px rgba(255,210,168,.6)) drop-shadow(0 0 28px color-mix(in oklab, var(--hl, var(--green)), transparent 45%)) drop-shadow(0 30px 40px rgba(0,0,0,.7));
  animation: ticketIn .75s var(--ease-spring) both;
}
@keyframes ticketIn { 0% { opacity: 0; transform: translateY(-60px) rotate(4deg) scale(.85); } 55% { opacity: 1; } }

.ticket {
  --notch: 60%;
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr);
  border: 2px solid transparent; border-radius: 22px;
  background:
    radial-gradient(rgba(255,255,255,.06) 1px, transparent 1.5px) 0 0 / 14px 14px padding-box,
    linear-gradient(180deg, color-mix(in oklab, var(--hl, var(--green)), #120d22 82%), #120d22 45%, #0d0a18) padding-box,
    linear-gradient(160deg, #ffd2a8, #b3521f 30%, #ff5fd8 65%, #7b2cff) border-box;
  /* ticket notches on both sides, level with the perforation */
  -webkit-mask: radial-gradient(circle 13px at 0 var(--notch), #0000 97%, #000) , radial-gradient(circle 13px at 100% var(--notch), #0000 97%, #000);
  -webkit-mask-composite: source-in;
  mask: radial-gradient(circle 13px at 0 var(--notch), #0000 97%, #000) , radial-gradient(circle 13px at 100% var(--notch), #0000 97%, #000);
  mask-composite: intersect;
}
.result-close { position: absolute; top: 12px; right: 12px; z-index: 2; width: 32px; height: 32px; border-radius: 10px; font-size: 20px; line-height: 1; color: rgba(255,255,255,.55); background: rgba(0,0,0,.25); transition: color .2s, transform .2s var(--ease-spring); }
.result-close:hover { color: #fff; transform: rotate(90deg); }

/* header: logo bursts up out of the top edge */
.ticket-head { display: grid; justify-items: center; text-align: center; padding: 78px 20px 18px; min-width: 0; }
.ticket-media { position: absolute; z-index: 3; left: 50%; top: -58px; width: 132px; aspect-ratio: 1; transform: translateX(-50%); isolation: isolate; }
.ticket-media img { position: relative; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; background: #1b1829;
  border: 4px solid #120d22; box-shadow: 0 0 0 2px #ffd2a8, 0 0 0 5px color-mix(in oklab, var(--hl, var(--green)), transparent 30%), 0 14px 30px rgba(0,0,0,.6);
  animation: logoPop .8s .15s var(--ease-spring) both; }
@keyframes logoPop { 0% { transform: scale(.2) rotate(-25deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.burst { position: absolute; inset: -60%; z-index: -1; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, color-mix(in oklab, var(--hl, var(--green)), transparent 25%) 0 7deg, transparent 7deg 20deg);
  -webkit-mask: radial-gradient(closest-side, #000 20%, transparent 75%); mask: radial-gradient(closest-side, #000 20%, transparent 75%);
  animation: haloSpin 14s linear infinite; }
@keyframes haloSpin { to { transform: rotate(360deg); } }

/* in the head's flow, the logo overhang doesn't count, so the ticket gets top room via .result padding */
.ticket-meta { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 14px; }
.meta-pad { display: inline-flex; align-items: center; gap: 7px; font: 700 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.8); }
.meta-pad img { width: 20px; height: 20px; border-radius: 6px; display: block; }
.meta-tier { display: inline-flex; align-items: baseline; gap: 5px; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.15); }
.meta-tier small { font: 700 9px var(--mono); letter-spacing: .18em; color: #ffd98a; }
.meta-tier b { font: 900 18px/1 var(--display); letter-spacing: -.04em; color: #ff4a2a; -webkit-text-stroke: .8px #ffd46a; text-shadow: 0 2px 0 #6a0a1e, 0 0 12px rgba(255,90,40,.6); }

.ticket-sym { margin: 10px 0 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 900 clamp(40px, 12vw, 60px)/.95 var(--display); letter-spacing: -.05em; color: #fff;
  text-shadow: 3px 3px 0 var(--hl, var(--green)), 6px 6px 0 rgba(0,0,0,.45);
  transform: skewX(-6deg); animation: symIn .6s .25s var(--ease-spring) both; }
@keyframes symIn { from { opacity: 0; transform: skewX(-6deg) translateY(14px) scale(.9); } }
.ticket-name { margin: 6px 0 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--muted); }
.ticket-demo { margin-top: 8px; font: 700 10px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--warn); }

/* perforation between head and receipt */
.perf { height: 0; margin: 0 22px; border-top: 2px dashed rgba(255,255,255,.14); }

/* receipt: lines "print" in one by one */
.receipt { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 16px 20px 18px; min-width: 0; }
.receipt dl { margin: 0; display: grid; gap: 7px; }
.receipt dl div { display: flex; align-items: baseline; gap: 8px; font: 500 13px var(--mono); animation: printIn .35s var(--ease-out) both; }
.receipt dl div:nth-child(1) { animation-delay: .35s; } .receipt dl div:nth-child(2) { animation-delay: .42s; }
.receipt dl div:nth-child(3) { animation-delay: .49s; } .receipt dl div:nth-child(4) { animation-delay: .56s; }
@keyframes printIn { from { opacity: 0; transform: translateY(-6px); clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }
.receipt dt { color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-size: 11px; }
.receipt dl div::after { content: ""; order: 1; flex: 1; border-bottom: 1px dotted rgba(255,255,255,.18); transform: translateY(-3px); }
.receipt dd { order: 2; margin: 0; font-weight: 700; color: #fff; white-space: nowrap; }
.receipt dd.up { color: var(--up); } .receipt dd.down { color: var(--down); }

.addr { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 10px; text-align: left;
  background: rgba(0,0,0,.3); border: 1px dashed rgba(255,255,255,.14); font: 500 12px var(--mono); color: var(--muted); transition: border-color .2s, color .2s; }
.addr i { font-style: normal; font-weight: 700; font-size: 10px; letter-spacing: .12em; color: #ffd98a; }
.addr span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addr svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; flex: none; }
.addr:hover { color: var(--text); border-color: rgba(255,255,255,.3); }

/* chunky arcade button that physically presses in */
.buy {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; height: 56px; border-radius: 14px;
  font: 900 17px var(--display); letter-spacing: -.01em; text-decoration: none; color: #04130b; overflow: hidden;
  background: linear-gradient(180deg, #5dffb8, var(--green) 55%, #0fc47a);
  box-shadow: 0 6px 0 #0a7a4a, 0 14px 24px -8px rgba(20,241,149,.55), inset 0 2px 0 rgba(255,255,255,.6);
  transition: transform .12s, box-shadow .12s;
}
.buy::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,.65) 50%, transparent 70%); transform: translateX(-120%); animation: shine 2.6s 1s ease-in-out infinite; }
@keyframes shine { 0% { transform: translateX(-120%); } 40%,100% { transform: translateX(120%); } }
.buy:hover { transform: translateY(-1px); box-shadow: 0 7px 0 #0a7a4a, 0 18px 30px -8px rgba(20,241,149,.7), inset 0 2px 0 rgba(255,255,255,.6); }
.buy:active { transform: translateY(5px); box-shadow: 0 1px 0 #0a7a4a, 0 6px 14px -6px rgba(20,241,149,.5), inset 0 2px 0 rgba(255,255,255,.4); }
.buy .tm-logo { height: 19px; width: auto; display: block; }
.buy.demo .tm-logo { display: none; }
.buy[aria-disabled="true"] { filter: grayscale(1) brightness(.6); pointer-events: none; box-shadow: 0 6px 0 #333; }

.again { justify-self: center; display: inline-flex; align-items: center; gap: 8px; padding: 4px 8px; font: 600 13px var(--body); color: var(--muted); transition: color .2s; }
.again span { font-size: 16px; transition: transform .4s var(--ease-spring); }
.again:hover { color: #fff; }
.again:hover span { transform: rotate(-180deg); }
@media (hover: none) { .again kbd { display: none; } }
.fine { margin: -4px 0 0; text-align: center; font-size: 11px; color: rgba(255,255,255,.35); }

/* ───────── launchpad grid ───────── */
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; margin: 40px 0 20px; }
.section-head h2 { margin: 0; font: 900 clamp(28px, 5vw, 48px)/1 var(--display); letter-spacing: -.04em; }
.section-head p { margin: 0; max-width: 460px; color: var(--muted); font-size: 14px; }
.pill-warn { font: 700 10px var(--mono); padding: 2px 7px; border-radius: 999px; color: var(--warn); border: 1px solid color-mix(in oklab, var(--warn), transparent 50%); text-transform: uppercase; letter-spacing: .08em; }
.lp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.lp {
  position: relative; padding: 18px; border-radius: var(--radius); overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transform: perspective(800px) rotateX(var(--rx, 0)) rotateY(var(--ry, 0)) translateY(var(--ty, 16px));
  opacity: 0; transition: transform .35s var(--ease-out), border-color .3s, opacity .6s var(--ease-out);
}
.lp.in { opacity: 1; --ty: 0px; }
.lp::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 0%), color-mix(in oklab, var(--c), transparent 82%), transparent 50%); opacity: 0; transition: opacity .3s; }
.lp:hover { border-color: color-mix(in oklab, var(--c), transparent 55%); }
.lp:hover::before { opacity: 1; }
.lp.lit { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), 0 20px 50px -20px var(--c); }
.lp-head { display: flex; gap: 12px; align-items: center; }
.lp-logo { width: 46px; height: 46px; border-radius: 14px; background: var(--c); display: grid; place-items: center; flex: none; box-shadow: 0 8px 20px -8px var(--c), inset 0 2px 0 rgba(255,255,255,.35); transition: transform .4s var(--ease-spring); }
.lp:hover .lp-logo { transform: rotate(-8deg) scale(1.08); }
.lp-logo svg { width: 70%; height: 70%; }
.lp-logo img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.lp-logo { overflow: hidden; }
.lp h3 { margin: 0; font: 800 17px/1.1 var(--display); letter-spacing: -.02em; }
.lp .dom { font: 500 12px var(--mono); color: var(--muted); display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.lp .tag { margin: 12px 0 10px; font-size: 14px; }
.lp ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 5px; }
.lp li { font-size: 13px; color: var(--muted); display: flex; gap: 8px; }
.lp li::before { content: ""; flex: none; width: 6px; height: 6px; margin-top: 7px; border-radius: 2px; background: var(--c); transform: rotate(45deg); }
.lp .count { position: absolute; top: 14px; right: 14px; font: 700 11px var(--mono); color: var(--muted); }

/* ───────── safety + footer ───────── */
.safety { margin: 48px 0 24px; padding: clamp(18px, 3vw, 28px); border-radius: var(--radius); background: linear-gradient(135deg, rgba(255,181,71,.08), rgba(20,17,31,.6)); border: 1px solid rgba(255,181,71,.22); }
.safety h3 { margin: 0 0 10px; font: 800 20px var(--display); }
.safety ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
.safety code { color: var(--text); font-size: 12px; }
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; width: min(1120px, 100%); margin: 0 auto; padding: 24px 16px max(24px, env(safe-area-inset-bottom)); font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }

/* ───────── modal + toast ───────── */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(4,3,8,.7); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: fade .25s; }
@keyframes fade { from { opacity: 0; } }
.modal-card { width: min(460px, 100%); padding: 24px; border-radius: var(--radius); background: var(--panel-solid); border: 1px solid var(--line-2); box-shadow: 0 40px 100px -20px rgba(0,0,0,.9); animation: cardIn .5s var(--ease-spring); }
.modal-card h3 { margin: 0 0 10px; font: 800 22px var(--display); }
.modal-card p { margin: 0 0 10px; font-size: 14px; }
.modal-card .muted { color: var(--muted); }
.hosts { margin: 0 0 12px; padding-left: 18px; font-size: 13px; color: var(--muted); display: grid; gap: 6px; }
.hosts code { color: var(--green); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 70; transform: translate(-50%, 140%); padding: 10px 16px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--line-2); font-size: 14px; transition: transform .4s var(--ease-spring); max-width: calc(100% - 32px); }
.toast.show { transform: translate(-50%, 0); }

/* ───────── responsive ───────── */
@media (max-width: 640px) {
  :root { --cell: clamp(72px, 22vw, 110px); --radius: 16px; }
  .machine { --reel-h: calc(var(--cell) * 1.8); --cap: 20px; --ringw: 8px; --lever: 32px; }
  .cell .logo.cap + .name { display: none; }  /* tier range text is too long for a phone reel */
  .cell { padding: 5px; gap: 3px; }
  .cell .name { font-size: 9px; }
  .reel-label { font-size: 8px; letter-spacing: .08em; }
  .reel-label span { display: none; }
  .cell .name small { display: none; }
  .controls { grid-template-columns: 1fr auto 1fr; }
  .chip-label { display: none; }
  .chip { width: 38px; padding: 0; justify-content: center; }
  .grid-floor { background-size: 40px 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .machine { opacity: 1; transform: none; filter: none; }
  .floaters, .grain { display: none; }
}
