:root {
  --ink: #f4f1ff; --muted: #b8aedb; --bg: #1b1530; --panel: rgba(27, 21, 48, 0.86); --line: rgba(255, 255, 255, 0.14);
  --gold: #f2c14d; --pink: #f05d8a; --violet: #9a7cf0; --mint: #7cc48a;
  --common: #b8aedb; --rare: #6fb6ff; --epic: #c58bff; --legendary: #ffcf3f;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; height: 100dvh; touch-action: none; overscroll-behavior: none; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; background: var(--bg); color: var(--ink); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
button, .bigbtn { touch-action: manipulation; }
body[data-screen="locker"] #view { visibility: hidden; }

.screen { position: fixed; inset: 0; overflow: auto; padding: 16px; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); touch-action: pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
#menu { display: flex; flex-direction: column; background: linear-gradient(180deg, rgba(27,21,48,0.75), rgba(27,21,48,0.05) 45%, rgba(27,21,48,0.8)); }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { font-weight: 800; letter-spacing: 0.02em; font-size: 18px; }
#me { display: flex; align-items: center; gap: 8px; background: var(--panel); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); }
.lvl { color: var(--gold); }
.xpbar { width: 90px; height: 7px; background: rgba(255,255,255,0.12); border-radius: 9px; overflow: hidden; }
.xpbar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--gold), var(--pink)); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); transition: transform 1.2s cubic-bezier(.2,.8,.2,1); will-change: transform; }
.xpbar.big { width: 100%; height: 12px; margin: 6px 0 2px; }
.hero { margin: auto 0; max-width: 560px; padding: 8px 4px; }
.hero h1 { font-size: clamp(44px, 9vw, 88px); line-height: 0.95; margin: 0 0 6px; letter-spacing: -0.02em; text-shadow: 0 4px 0 #5b3f6e, 0 0 40px rgba(240, 93, 138, 0.45); }
.hero .tagline { font-size: 19px; margin: 0 0 18px; color: #ffe6f0; text-shadow: 0 2px 8px #000; }
.menu-buttons { display: grid; gap: 10px; max-width: 380px; }
.bigbtn { display: block; text-align: left; width: 100%; border: 0; border-radius: 16px; padding: 14px 18px; font-weight: 800; font-size: 20px; background: linear-gradient(180deg, #ff7aa6, var(--pink)); box-shadow: 0 5px 0 #a8355f, 0 10px 24px rgba(0,0,0,0.35); color: #fff; transition: transform 0.08s, scale 0.35s cubic-bezier(.3,1.7,.5,1), rotate 0.35s cubic-bezier(.3,1.7,.5,1); }
.bigbtn small { display: block; font-weight: 500; font-size: 13px; opacity: 0.9; }
.bigbtn.alt { background: linear-gradient(180deg, #b49bff, var(--violet)); box-shadow: 0 5px 0 #5b4a9a, 0 10px 24px rgba(0,0,0,0.35); }
.bigbtn.alt2 { background: linear-gradient(180deg, #ffd978, var(--gold)); color: #3a2a10; box-shadow: 0 5px 0 #a87a1c, 0 10px 24px rgba(0,0,0,0.35); }
.bigbtn:active { transform: translateY(3px); }
.ghostbtn { background: rgba(255,255,255,0.08); border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; }
.ghostbtn:hover { background: rgba(255,255,255,0.16); }
.ghostbtn.small { padding: 4px 10px; font-size: 14px; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 0 4px; }
.opt { display: flex; gap: 8px; align-items: center; margin-top: 12px; color: #eee; text-shadow: 0 1px 4px #000; }
.opt input[type="text"], .opt input:not([type]) , #name { background: rgba(0,0,0,0.35); border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; color: var(--ink); width: 180px; }
.note { color: #ffe0ea; text-shadow: 0 1px 4px #000; max-width: 520px; font-size: 14px; }
.note a { color: var(--gold); }
.foot { font-size: 13px; color: var(--muted); max-width: 760px; text-shadow: 0 1px 4px #000; }

.panel { max-width: 640px; margin: 4vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 20px; backdrop-filter: blur(6px); }
.panel.wide { max-width: 980px; }
.panel h2 { margin: 0 0 10px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; align-items: center; }
.row .bigbtn { width: auto; flex: 1 1 200px; }
.join input { background: rgba(0,0,0,0.35); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; color: var(--ink); width: 120px; letter-spacing: 0.2em; text-transform: uppercase; }
.code { font-family: ui-monospace, monospace; color: var(--gold); letter-spacing: 0.15em; }
.list { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.list li { background: rgba(255,255,255,0.06); border-radius: 10px; padding: 8px 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud button, #touch { pointer-events: auto; }
.hud-top { position: absolute; top: 12px; left: 16px; right: 16px; display: flex; justify-content: space-between; font-weight: 800; text-shadow: 0 2px 6px #000, 0 0 2px #000; font-size: 17px; }
#hud-big { position: absolute; top: 34%; left: 0; right: 0; text-align: center; font-size: clamp(40px, 10vw, 110px); font-weight: 900; color: #fff; text-shadow: 0 6px 0 var(--pink), 0 0 30px rgba(0,0,0,0.6); opacity: 0; transform: scale(0.8); transition: opacity 0.15s, transform 0.15s; }
#hud-big.on { opacity: 1; transform: scale(1); }
#hud-big.small { font-size: clamp(26px, 5vw, 54px); top: 12%; }
#hud-blurb { position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%); max-width: min(620px, 92vw); text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px 18px; opacity: 0; transition: opacity 0.3s; }
#hud-blurb.on { opacity: 1; }
#hud-blurb b { display: block; font-size: 26px; color: var(--gold); }
#hud-seats { position: absolute; top: 44px; left: 0; right: 0; display: flex; justify-content: space-around; }
.seat { background: var(--panel); border-radius: 999px; padding: 4px 14px; font-weight: 800; color: var(--gold); }
#hud-feed { position: absolute; right: 16px; top: 48px; text-align: right; font-weight: 700; text-shadow: 0 2px 4px #000; }
#hud-feed div { color: #ffd0e0; }
#hud-help { position: absolute; bottom: 10px; left: 16px; font-size: 13px; color: #ddd; text-shadow: 0 1px 3px #000; }
#hud-leave { position: absolute; bottom: 10px; right: 16px; }
#tags { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#tags div { position: absolute; left: 0; top: 0; white-space: nowrap; will-change: transform; }
.tag { margin-left: -40px; width: 80px; text-align: center; font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px #000; }
.tag.me { color: var(--gold); }
.word { margin-left: -60px; width: 120px; text-align: center; font-weight: 900; font-size: 22px; color: #fff; text-shadow: 0 3px 0 #5b3f6e, 0 0 8px #000; }
.word.wipe { color: #8affc1; font-size: 28px; }
.word.through { color: var(--gold); font-size: 26px; }
.word.poof { color: #ffd0e0; }
#touch { position: absolute; inset: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
#touch-stick { position: absolute; left: 0; top: 22%; bottom: 0; width: 50%; touch-action: none; }
#stick-base { position: absolute; left: -56px; top: -56px; width: 112px; height: 112px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.35); background: rgba(255,255,255,0.08); opacity: 0; pointer-events: none; }
#stick-base.on { opacity: 1; }
#stick-knob { position: absolute; left: 31px; top: 31px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,0.45); border: 2px solid rgba(255,255,255,0.7); }
#hud:has(#touch:not(.hidden)) .hud-top { right: calc(84px + env(safe-area-inset-right)); left: calc(16px + env(safe-area-inset-left)); }
#hud:has(#touch:not(.hidden)) #hud-leave { top: calc(10px + env(safe-area-inset-top)); bottom: auto; }
#touch button { position: absolute; border-radius: 50%; border: 2px solid rgba(255,255,255,0.4); background: rgba(240, 93, 138, 0.55); font-weight: 900; color: #fff; }
#touch button { touch-action: none; font-size: 15px; -webkit-user-select: none; user-select: none; }
#touch button.down { transform: scale(0.92); filter: brightness(1.3); }
#touch-jump { right: calc(20px + env(safe-area-inset-right)); bottom: calc(28px + env(safe-area-inset-bottom)); width: 96px; height: 96px; }
#touch-emote { right: calc(36px + env(safe-area-inset-right)); bottom: calc(136px + env(safe-area-inset-bottom)); width: 58px; height: 58px; font-size: 22px !important; background: rgba(242, 193, 77, 0.55) !important; }

/* results */
#results { background: rgba(14, 10, 28, 0.6); }
.res-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 20px; }
@media (max-width: 760px) { .res-grid { grid-template-columns: 1fr; } }
.places { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; max-height: 52vh; overflow: auto; }
.places li { display: flex; gap: 8px; align-items: baseline; padding: 5px 10px; border-radius: 9px; background: rgba(255,255,255,0.05); font-size: 15px; }
.places li.me { background: rgba(242, 193, 77, 0.22); border: 1px solid rgba(242,193,77,0.5); }
.places li.human b { color: #ffd0e0; }
.pl { width: 38px; font-weight: 900; color: var(--gold); }
.xpbig { font-size: 44px; font-weight: 900; color: var(--gold); text-shadow: 0 3px 0 #8a5a00; }
.breakdown { list-style: none; padding: 0; margin: 4px 0 10px; font-size: 14px; }
.breakdown li { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 2px 0; }
.up { color: #8affc1; font-size: 20px; }
.cards { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.cards h3 { width: 100%; margin: 4px 0 0; }
.card { position: relative; width: 150px; padding: 12px; border-radius: 14px; background: rgba(255,255,255,0.07); border: 2px solid var(--common); display: flex; flex-direction: column; gap: 2px; animation: cardflip 0.75s cubic-bezier(.2,1.4,.4,1) var(--d, 0s) backwards; }
.card.rare { border-color: var(--rare); } .card.epic { border-color: var(--epic); box-shadow: 0 0 18px rgba(197,139,255,0.4); } .card.legendary { border-color: var(--legendary); box-shadow: 0 0 26px rgba(255,207,63,0.55); }
.card .slot { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.1em; }
.card .why { font-size: 12px; color: #ffd0e0; }
.challenges li { font-size: 14px; }
.challenges li.done { opacity: 0.6; }
.challenges li.just { background: rgba(138, 255, 193, 0.18); border: 1px solid #8affc1; }
.prog { margin-left: auto; font-weight: 800; color: var(--gold); }
.reward { font-size: 12px; color: #ffd0e0; }

/* locker */
#locker { padding: 0; background: radial-gradient(ellipse at 30% 40%, #3b2a66, #140f26 70%); }
.locker { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 480px); height: 100%; }
@media (max-width: 820px) and (orientation: portrait) { .locker { grid-template-columns: 1fr; grid-template-rows: 44vh auto; height: auto; } }
.locker-stage { position: relative; min-height: 300px; }
#locker-view { width: 100%; height: 100%; display: block; cursor: grab; }
.locker-level { position: absolute; left: 16px; top: 16px; background: var(--panel); padding: 8px 14px; border-radius: 14px; border: 1px solid var(--line); }
.locker-level .xpbar { width: 160px; margin: 4px 0; }
#lk-emote { position: absolute; left: 16px; bottom: 16px; }
.locker-side { background: var(--panel); border-left: 1px solid var(--line); padding: 16px; overflow: auto; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.tabs button { border: 1px solid var(--line); background: rgba(255,255,255,0.06); border-radius: 999px; padding: 5px 12px; font-size: 14px; }
.tabs button.on { background: var(--violet); border-color: var(--violet); font-weight: 700; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.item { text-align: left; border: 2px solid var(--common); background: rgba(255,255,255,0.06); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 2px; min-height: 120px; }
.item.rare { border-color: var(--rare); } .item.epic { border-color: var(--epic); } .item.legendary { border-color: var(--legendary); }
.item.on { background: rgba(242, 193, 77, 0.22); box-shadow: 0 0 0 2px var(--gold) inset; }
.item.locked { opacity: 0.55; filter: grayscale(0.5); }
.item .r { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.item .how { font-size: 12px; color: #e6dcff; }
.sw { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 30px; border-radius: 8px; font-size: 20px; margin-bottom: 4px; border: 1px solid var(--line); overflow: hidden; }
.sw.none { background: repeating-linear-gradient(45deg, #333 0 4px, #555 4px 8px) !important; }
.sw img { width: 100%; height: 100%; object-fit: cover; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 40px); background: #2b2148; border: 1px solid var(--line); padding: 10px 18px; border-radius: 12px; opacity: 0; transition: 0.25s; pointer-events: none; max-width: calc(100vw - 32px); z-index: 10; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* focus ring: visible for keyboard focus and, once a controller was used, for pad focus */
:focus-visible, body.padnav :focus { outline: 3px solid var(--gold); outline-offset: 3px; }
body.padnav .bigbtn:focus, body.padnav .ghostbtn:focus, body.padnav .item:focus, body.padnav .tabs button:focus { box-shadow: 0 0 0 5px rgba(242, 193, 77, 0.35), 0 5px 0 rgba(0,0,0,0.25); }

#padhint { position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top)); transform: translate(-50%, -60px); background: #2b2148; border: 1px solid var(--gold); padding: 8px 16px; border-radius: 999px; opacity: 0; transition: 0.25s; pointer-events: none; z-index: 12; font-size: 14px; max-width: calc(100vw - 32px); text-align: center; }
#padhint.on { opacity: 1; transform: translate(-50%, 0); }
#pause { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(14, 10, 28, 0.6); pointer-events: auto; z-index: 8; }
#pause .panel { margin: 0; text-align: center; }
#pause .row { justify-content: center; }
#rotate { position: absolute; left: 50%; top: calc(104px + env(safe-area-inset-top)); transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; font-size: 14px; opacity: 0; transition: opacity 0.3s; pointer-events: none; white-space: nowrap; }
#rotate.on { opacity: 1; pointer-events: auto; }

/* phones: portrait (360x640) */
@media (max-width: 600px) {
  .screen { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .hero h1 { font-size: clamp(40px, 14vw, 64px); }
  .hero .tagline { font-size: 16px; margin-bottom: 12px; }
  .menu-buttons { max-width: none; }
  .bigbtn { font-size: 18px; padding: 12px 16px; min-height: 52px; }
  .opt #name, #name { width: 150px; }
  .foot { font-size: 12px; }
  .panel { margin: 2vh auto; padding: 16px; border-radius: 16px; }
  .row .bigbtn { flex-basis: 100%; }
  .xpbar { width: 70px; }
  #me { padding: 4px 10px; gap: 6px; font-size: 14px; }
  .hud-top { font-size: 14px; left: 12px; right: 12px; flex-direction: column; gap: 0; }
  #hud-seats { top: 52px; }
  #hud-feed { top: 70px; font-size: 13px; }
  .card { width: calc(50% - 5px); }
  .places { max-height: 38vh; }
  .xpbig { font-size: 36px; }
  .tabs button, .ghostbtn, .link { min-height: 40px; }
  .items { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
/* phones: landscape (844x390) - short screens */
@media (max-height: 520px) and (orientation: landscape) {
  .screen { padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .hero { margin: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; max-width: none; align-content: center; flex: 1; }
  .hero h1 { grid-column: 1; font-size: 44px; margin: 0; }
  .hero .tagline { grid-column: 1; font-size: 14px; margin: 0 0 6px; }
  .menu-buttons { grid-column: 2; grid-row: 1 / span 4; gap: 8px; }
  .hero .opt, .hero .note { grid-column: 1; margin-top: 4px; font-size: 13px; }
  .bigbtn { padding: 8px 14px; font-size: 17px; }
  .foot { display: none; }
  .panel { margin: 0 auto; padding: 12px 16px; }
  .res-grid { grid-template-columns: 1fr 1.2fr; gap: 12px; }
  .places { max-height: 40vh; }
  .locker { grid-template-columns: minmax(0, 1fr) minmax(300px, 52%); height: 100%; }
  .locker-stage { min-height: 0; }
  .locker-side { padding: 10px 12px; padding-right: max(12px, env(safe-area-inset-right)); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .locker-level { left: max(10px, env(safe-area-inset-left)); top: 8px; padding: 4px 10px; }
  #lk-emote { left: max(10px, env(safe-area-inset-left)); bottom: 8px; }
  .item { min-height: 92px; padding: 8px; }
  #hud-blurb { bottom: 6%; padding: 6px 12px; }
  #hud-blurb b { font-size: 20px; }
  #hud-big { top: 22%; }
  #touch-jump { width: 84px; height: 84px; bottom: calc(16px + env(safe-area-inset-bottom)); }
    #touch-emote { width: 52px; height: 52px; bottom: calc(112px + env(safe-area-inset-bottom)); }
  #pause .panel { padding: 10px 16px; }
}

/* ── settings: sliders ── */
.topright { display: flex; align-items: center; gap: 10px; }
.gear { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); font-size: 22px; line-height: 1; display: grid; place-items: center; padding: 0; transition: rotate 0.5s cubic-bezier(.3,1.5,.5,1), scale 0.3s cubic-bezier(.3,1.7,.5,1); }
.gear:hover, .gear:focus-visible, body.padnav .gear:focus { rotate: 90deg; scale: 1.1; }
.gear:active { scale: 0.9; }
.vol-controls { display: grid; gap: 14px; margin: 14px 0; text-align: left; }
.vol-row { display: grid; grid-template-columns: minmax(96px, 120px) 1fr 3ch; align-items: center; gap: 12px; font-weight: 700; }
.vol-row output { text-align: right; color: var(--gold); font-variant-numeric: tabular-nums; }
.vol-row input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 40px; margin: 0; background: transparent; touch-action: none; cursor: pointer; }
.vol-row input[type="range"]:disabled { opacity: 0.45; }
.vol-row input[type="range"]::-webkit-slider-runnable-track { height: 10px; border-radius: 9px; background: linear-gradient(90deg, var(--gold), var(--pink)) 0 0 / var(--fill, 50%) 100% no-repeat, rgba(255,255,255,0.16); }
.vol-row input[type="range"]::-moz-range-track { height: 10px; border-radius: 9px; background: rgba(255,255,255,0.16); }
.vol-row input[type="range"]::-moz-range-progress { height: 10px; border-radius: 9px; background: linear-gradient(90deg, var(--gold), var(--pink)); }
.vol-row input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -9px; border-radius: 50%; background: #fff; border: 3px solid var(--violet); box-shadow: 0 2px 8px rgba(0,0,0,0.5); transition: transform 0.2s cubic-bezier(.3,1.7,.5,1); }
.vol-row input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 3px solid var(--violet); }
.vol-row input[type="range"]:active::-webkit-slider-thumb, .vol-row input[type="range"]:focus-visible::-webkit-slider-thumb { transform: scale(1.18); }
.vol-mute { justify-self: start; }
#pause-vol { margin: 6px 0 0; }
#pause { overflow: auto; }
#pause .panel { max-width: min(520px, 94vw); }

/* ── motion: transforms and opacity only; everything is switched off for prefers-reduced-motion at the bottom ── */
@keyframes screenin { from { opacity: 0; translate: 26px 0; } }
@keyframes screenin-back { from { opacity: 0; translate: -26px 0; } }
.screen:not(.hidden) { animation: screenin 0.38s cubic-bezier(.2,.8,.2,1) backwards; }
#menu:not(.hidden) { animation-name: screenin-back; }
#pause:not(.hidden) { animation: fadein 0.25s ease-out backwards; }
#pause:not(.hidden) .panel { animation: panelpop 0.45s cubic-bezier(.2,1.5,.4,1) backwards; }
@keyframes fadein { from { opacity: 0; } }
@keyframes panelpop { from { opacity: 0; scale: 0.88; translate: 0 16px; } }

/* menu buttons float in one after the other; hover, focus and press squish and wobble (scale/rotate, so the entrance and the press keep their own transforms) */
@keyframes floatin { 0% { opacity: 0; translate: -30px 22px; scale: 0.9; } 65% { opacity: 1; translate: 5px -5px; scale: 1.03; } 100% { translate: 0 0; scale: 1; } }
#menu:not(.hidden) .menu-buttons .bigbtn { animation: floatin 0.7s cubic-bezier(.2,.9,.3,1) backwards; }
#menu:not(.hidden) .menu-buttons .bigbtn:nth-child(1) { animation-delay: 0.2s; }
#menu:not(.hidden) .menu-buttons .bigbtn:nth-child(2) { animation-delay: 0.34s; }
#menu:not(.hidden) .menu-buttons .bigbtn:nth-child(3) { animation-delay: 0.48s; }
.bigbtn:hover, .bigbtn:focus-visible, body.padnav .bigbtn:focus { scale: 1.035; rotate: -1.1deg; }
.bigbtn:nth-child(even):hover, .bigbtn:nth-child(even):focus-visible, body.padnav .bigbtn:nth-child(even):focus { rotate: 1.1deg; }
.bigbtn:active { scale: 1.04 0.93; rotate: 0deg; }
.ghostbtn, .tabs button, .item { transition: scale 0.3s cubic-bezier(.3,1.7,.5,1), translate 0.3s cubic-bezier(.3,1.7,.5,1), background 0.15s; }
.ghostbtn:hover, .ghostbtn:focus-visible, body.padnav .ghostbtn:focus, .tabs button:hover { scale: 1.05; }
.ghostbtn:active, .tabs button:active, .item:active { scale: 1.03 0.92; }
.item:hover, .item:focus-visible, body.padnav .item:focus { translate: 0 -3px; scale: 1.03; }
.hero .tagline { animation: fadein 0.8s ease-out 0.1s backwards; }

/* the title floats, its letters bob in a wave */
@keyframes titlefloat { 0%, 100% { translate: 0 0; rotate: -0.6deg; } 50% { translate: 0 -7px; rotate: 0.6deg; } }
@keyframes ltrbob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -0.12em; } }
@keyframes ltrdrop { from { opacity: 0; translate: 0 -0.6em; rotate: -12deg; } }
.hero h1 { animation: titlefloat 5.5s ease-in-out infinite; transform-origin: 0 60%; }
.ltr { display: inline-block; animation: ltrdrop 0.6s cubic-bezier(.2,1.5,.4,1) calc(var(--i, 0) * 60ms) backwards, ltrbob 2.6s ease-in-out calc(0.7s + var(--i, 0) * 120ms) infinite; }

/* locker: items pop in with a stagger; equipping puffs and sparkles */
@keyframes itempop { 0% { opacity: 0; scale: 0.6; translate: 0 14px; } 65% { opacity: 1; scale: 1.07; translate: 0 -2px; } 100% { scale: 1; translate: 0 0; } }
.item.pop { animation: itempop 0.5s cubic-bezier(.2,1.2,.4,1) calc(min(var(--i, 0), 14) * 40ms + 0.12s) backwards; }
@keyframes equipped { 0% { scale: 0.9 1.08; } 40% { scale: 1.12 0.92; } 70% { scale: 0.97 1.03; } 100% { scale: 1; } }
.item.equipped-pulse { animation: equipped 0.55s ease-out; }
.item { position: relative; }
.fxhost { position: absolute; left: 50%; top: 46%; width: 0; height: 0; pointer-events: none; }
.fx { position: absolute; left: 0; top: 0; display: block; pointer-events: none; z-index: 3; animation: fxfly 0.9s cubic-bezier(.1,.7,.3,1) var(--dl, 0s) both; }
.card .fx, .item .fx { left: 50%; top: 50%; }
.fx.sparkle { width: 14px; height: 14px; margin: -7px; background: #ffe58a; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.fx.puff { width: 26px; height: 26px; margin: -13px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,0.95), rgba(214,200,255,0.5) 60%, transparent 70%); animation-duration: 0.8s; }
.fx.firefly { width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: #fff6a8; box-shadow: 0 0 8px 3px rgba(255,236,120,0.85); animation: firefly 1.6s ease-out var(--dl, 0s) both; }
@keyframes fxfly { 0% { opacity: 1; translate: 0 0; scale: 0.2; rotate: 0deg; } 100% { opacity: 0; translate: var(--dx) var(--dy); scale: var(--sc, 1); rotate: 120deg; } }
@keyframes firefly { 0% { opacity: 0; translate: 0 0; scale: 0.3; } 15% { opacity: 1; } 55% { opacity: 1; translate: calc(var(--dx) * 0.8) calc(var(--dy) * 0.8); scale: var(--sc, 1); } 100% { opacity: 0; translate: calc(var(--dx) * 1.1) calc(var(--dy) * 1.1 - 24px); scale: 0.3; } }

/* results */
@keyframes cardflip { 0% { opacity: 0; transform: perspective(700px) rotateY(-95deg) scale(0.7); } 60% { opacity: 1; transform: perspective(700px) rotateY(12deg) scale(1.08); } 100% { opacity: 1; transform: none; } }
@keyframes levelup { 0%, 100% { scale: 1; } 40% { scale: 1.18; } 70% { scale: 0.96; } }
.up { display: inline-block; animation: levelup 0.7s ease-out 1.2s 2 backwards; }
.places li { animation: screenin 0.4s ease-out backwards; }
.places li:nth-child(1) { animation-delay: 0.1s; } .places li:nth-child(2) { animation-delay: 0.16s; } .places li:nth-child(3) { animation-delay: 0.22s; } .places li:nth-child(4) { animation-delay: 0.28s; }
.places li:nth-child(5) { animation-delay: 0.34s; } .places li:nth-child(6) { animation-delay: 0.4s; } .places li:nth-child(7) { animation-delay: 0.46s; } .places li:nth-child(8) { animation-delay: 0.52s; }
.cards h3 { animation: fadein 0.4s ease-out 0.6s backwards; }

/* a ghost peeks in from a screen edge now and then */
#peeker { position: fixed; z-index: 9; width: 56px; height: 56px; left: 0; top: 0; opacity: 0; pointer-events: none; border-radius: 14px; filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5)); }
#peeker.peek-left { left: 0; top: var(--y, 40%); animation: peekl 3.6s ease-in-out both; }
#peeker.peek-right { left: auto; right: 0; top: var(--y, 40%); animation: peekr 3.6s ease-in-out both; }
#peeker.peek-bottom { left: var(--x, 40%); top: auto; bottom: 0; animation: peekb 3.6s ease-in-out both; }
@keyframes peekl { 0%, 100% { opacity: 0; transform: translateX(-100%) rotate(90deg); } 18%, 78% { opacity: 0.9; transform: translateX(-30%) rotate(90deg); } 40% { transform: translateX(-30%) rotate(98deg); } 55% { transform: translateX(-30%) rotate(82deg); } }
@keyframes peekr { 0%, 100% { opacity: 0; transform: translateX(100%) rotate(-90deg); } 18%, 78% { opacity: 0.9; transform: translateX(30%) rotate(-90deg); } 40% { transform: translateX(30%) rotate(-98deg); } 55% { transform: translateX(30%) rotate(-82deg); } }
@keyframes peekb { 0%, 100% { opacity: 0; transform: translateY(100%); } 18%, 78% { opacity: 0.9; transform: translateY(38%) rotate(0deg); } 40% { transform: translateY(38%) rotate(-8deg); } 55% { transform: translateY(38%) rotate(8deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; scale: none !important; rotate: none !important; }
  #peeker { display: none; }
}

/* fullscreen option and the iPhone tip */
.fs-opt { margin: 4px 0 8px; } .fs-now { margin: 4px 0 8px; }
#ios-tip { position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); translate: -50% 0; z-index: 11; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 24px); background: #2b2148; border: 1px solid var(--gold); border-radius: 999px; padding: 8px 8px 8px 16px; font-size: 14px; animation: screenin 0.5s ease-out 1s backwards; }
#ios-tip button { width: 32px; height: 32px; flex: none; border-radius: 50%; border: 0; background: rgba(255,255,255,0.14); padding: 0; }
