@font-face { font-family: "Fraunces"; src: url(fonts/fraunces.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url(fonts/dm-sans.woff2) format("woff2"); font-weight: 100 1000; font-display: swap; }
:root {
  --accent: #9fb8ff; --ink: #f6efe2; --mute: #b8b1d6; --glass: rgba(20, 16, 44, .58); --line: rgba(255, 255, 255, .12);
  --serif: "Fraunces", Georgia, serif; --sans: "DM Sans", system-ui, sans-serif;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.22, 1, .36, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0d0b1f; color: var(--ink); font-family: var(--sans); overflow: hidden; -webkit-tap-highlight-color: transparent; }
#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; outline: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.hide { display: none !important; }

/* loader */
#loader { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 18px; background: #0d0b1f; z-index: 50; transition: opacity .8s var(--ease), visibility .8s; }
#loader p { margin: 0; color: var(--mute); font-size: 14px; letter-spacing: .04em; }
#loader .lid { width: 54px; height: 54px; border-radius: 10px; background: linear-gradient(135deg, #5b4ad6, #2a2070); box-shadow: inset 0 0 0 3px #e0b25e; animation: bob 1.2s var(--ease) infinite alternate; }
@keyframes bob { to { transform: translateY(-10px) rotate(8deg); } }
#loader.done { opacity: 0; visibility: hidden; }

/* screens */
.screen { position: fixed; inset: 0; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity .5s var(--ease), visibility .5s; }
.screen > * { pointer-events: auto; }
body[data-screen="title"] #title, body[data-screen="select"] #select, body[data-screen="reward"] #reward, body[data-screen="cabinet"] #cabinet { opacity: 1; visibility: visible; }
.kicker { margin: 0 0 8px; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.line { margin: 6px 0 0; color: var(--mute); font-size: 15px; line-height: 1.45; }
h1, h2 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -.01em; }

/* title */
.title-copy { position: absolute; left: 0; right: 0; top: calc(var(--st) + 9vh); text-align: center; padding: 0 20px; pointer-events: none; }
#title h1 { font-size: clamp(44px, 9vw, 92px); line-height: .95; font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144; }
#title h1 span { display: inline-block; background: linear-gradient(100deg, #fff4dc 20%, #e7c27a 40%, #fff4dc 50%, #c9b8ff 70%, #fff4dc 85%); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 6s linear infinite; }
#title h1 span + span { animation-delay: -.6s; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -150% 0; } }
.tag { margin: 14px 0 0; color: var(--mute); font-size: clamp(15px, 2vw, 18px); }
.title-actions { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--sb) + 7vh); display: grid; gap: 10px; width: min(320px, 86vw); }
.back-hub { position: absolute; top: calc(var(--st) + 16px); left: 16px; color: var(--mute); text-decoration: none; font-size: 14px; padding: 10px 12px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: color .2s, background .2s; }
.back-hub:hover { color: var(--ink); background: rgba(40, 32, 80, .7); }
#title .sound { position: absolute; top: calc(var(--st) + 16px); right: 16px; }

/* buttons */
.btn { border: 0; border-radius: 999px; padding: 16px 26px; font-weight: 700; font-size: 17px; letter-spacing: .01em; transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s, opacity .25s; min-height: 54px; }
.btn.primary { background: linear-gradient(180deg, #ffe3a6, #e0b25e); color: #2a1a05; box-shadow: 0 10px 30px -8px rgba(224, 178, 94, .65), inset 0 1px 0 rgba(255, 255, 255, .7); }
.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -10px rgba(224, 178, 94, .8), inset 0 1px 0 rgba(255, 255, 255, .7); }
.btn.primary:active { transform: translateY(1px) scale(.98); }
.btn.primary:disabled { background: #3a3458; color: #8e88ad; box-shadow: none; cursor: not-allowed; transform: none; }
.btn.ghost { background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.btn.ghost:hover { background: rgba(40, 32, 80, .7); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: grid; place-items: center; padding: 0; transition: background .2s, transform .2s var(--ease); }
.icon-btn:hover { background: rgba(40, 32, 80, .75); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sound svg path:first-child { fill: currentColor; stroke: none; }
.sound .x { display: none; } .sound.off .x { display: block; } .sound.off .w { display: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* top bar */
.topbar { position: absolute; top: calc(var(--st) + 12px); left: 12px; right: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tb-right { display: flex; gap: 8px; }
.play-name { font-family: var(--serif); font-size: clamp(16px, 2.4vw, 20px); text-align: center; flex: 1; text-shadow: 0 2px 12px rgba(0, 0, 0, .6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dots { display: flex; gap: 8px; } .dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .25); transition: background .3s, transform .3s var(--ease); } .dots i.on { background: var(--accent); transform: scale(1.35); }

/* select */
.sel-card { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--sb) + 4vh); width: min(440px, 90vw); text-align: center; padding: 22px 22px 20px; border-radius: 26px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.sel-card h2 { font-size: clamp(24px, 3.4vw, 32px); }
.level { margin: 10px 0 16px; font-size: 13px; color: var(--accent); font-weight: 700; letter-spacing: .04em; }
.sel-card .btn { width: 100%; }
.arrow { position: absolute; top: 42%; width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass); display: grid; place-items: center; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: opacity .3s, transform .25s var(--ease); }
.arrow svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.arrow.left { left: max(12px, 6vw); } .arrow.right { right: max(12px, 6vw); }
.arrow:disabled { opacity: 0; pointer-events: none; }
.arrow:hover { transform: scale(1.06); }

/* play */
#hud { position: fixed; inset: 0; pointer-events: none; } #hud .topbar { pointer-events: auto; }
#hint.nudge { animation: nudge 1.4s var(--ease) infinite; border-color: var(--accent); color: var(--accent); }
@keyframes nudge { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 220, 150, .0); } 50% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(255, 220, 150, .12); } }
#tray { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--sb) + 14px); display: flex; gap: 10px; padding: 8px; min-height: 68px; border-radius: 22px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); align-items: center; max-width: 94vw; }
.tray-empty { color: var(--mute); font-size: 13px; padding: 0 14px; opacity: .8; }
.slot { display: flex; align-items: center; gap: 8px; border: 1px solid transparent; background: rgba(255, 255, 255, .06); border-radius: 16px; padding: 6px 14px 6px 6px; min-height: 52px; transition: background .2s, border-color .2s, transform .25s var(--ease); }
.slot img { width: 40px; height: 40px; }
.slot span { font-size: 14px; font-weight: 600; white-space: nowrap; }
.slot:hover { background: rgba(255, 255, 255, .12); }
.slot.on { border-color: var(--accent); background: rgba(255, 220, 150, .14); box-shadow: 0 0 24px -6px var(--accent); transform: translateY(-3px); }
.slot.pop { animation: pop .6s var(--ease); }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
#toast { position: fixed; left: 50%; bottom: calc(var(--sb) + 100px); transform: translate(-50%, 14px); max-width: min(520px, 92vw); padding: 12px 18px; border-radius: 16px; background: rgba(14, 10, 32, .82); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); font-size: 15px; line-height: 1.4; text-align: center; opacity: 0; pointer-events: none; transition: opacity .35s var(--ease), transform .45s var(--ease); z-index: 20; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
body[data-screen="title"] #toast, body[data-screen="select"] #toast { bottom: calc(var(--sb) + 30px); }
#drag-tip { position: absolute; left: 50%; top: 58%; transform: translate(-50%, 0); display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 999px; background: rgba(14, 10, 32, .7); border: 1px solid var(--line); font-size: 14px; opacity: 0; transition: opacity .5s; pointer-events: none; }
#drag-tip.show { opacity: 1; }
#drag-tip .hand { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px var(--accent); animation: swipe 1.6s var(--ease) infinite; }
@keyframes swipe { 0% { transform: translateX(-14px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateX(22px); opacity: 0; } }

/* reward */
.rw-card { position: absolute; left: 50%; bottom: calc(var(--sb) + 4vh); transform: translateX(-50%); width: min(460px, 92vw); text-align: center; padding: 24px; border-radius: 26px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
body[data-screen="reward"] .rw-card { animation: rise .9s var(--ease) both; }
@keyframes rise { from { transform: translate(-50%, 30px); opacity: 0; } }
.rw-card h2 { font-size: clamp(28px, 4vw, 38px); }
.rw-card .row { display: grid; gap: 10px; margin-top: 18px; }

/* cabinet */
.cab-foot { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--sb) + 5vh); text-align: center; width: min(460px, 92vw); }
.cab-foot h2 { font-size: clamp(24px, 3.4vw, 32px); }

@media (max-width: 560px) {
  .arrow { top: 38%; }
  .title-copy { top: calc(var(--st) + 11vh); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; } }
.nojs { position: fixed; inset: 0; display: grid; place-items: center; margin: 0; }
