/* =========================================================
   WipaGames Arcade — retro arcade theme
   ========================================================= */
:root {
  --bg: #0b0b1e;
  --bg-2: #11112b;
  --panel: #16163a;
  --panel-2: #1f1f4d;
  --line: #34347a;
  --line-2: #4a4aa8;
  --text: #f4f4ff;
  --muted: #b6b6e2;
  --pink: #ff2e88;
  --cyan: #29f0ff;
  --yellow: #ffe14d;
  --green: #3cff7a;
  --purple: #8a5cff;
  --red: #ff5a7a;
  --ink: #0b0b1e;

  --font-pixel: "Press Start 2P", ui-monospace, monospace;
  --font-body: "VT323", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --gutter: clamp(1rem, 4vw, 2rem);
  --notch: 6px;
  --ease: cubic-bezier(.2, .9, .3, 1.2);
  --z-crt: 90; --z-top: 50; --z-tab: 50; --z-toast: 80;
  --tabbar-h: 0px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--bg);
  background-image: radial-gradient(circle at 50% -20%, #2a1260 0, transparent 55%);
  color: var(--text);
  font: 400 1.375rem/1.35 var(--font-body);
  -webkit-font-smoothing: antialiased;
  padding-bottom: var(--tabbar-h);
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul[role="list"], ol { list-style: none; padding: 0; }
a { color: var(--cyan); text-underline-offset: 3px; }
a:hover { color: var(--text); }
button { font: inherit; color: inherit; cursor: pointer; }
svg { display: block; }
b { font-weight: 400; color: var(--yellow); }
::selection { background: var(--pink); color: var(--text); }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
[hidden] { display: none !important; }

.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 1rem; top: 1rem; z-index: 200; padding: .75rem 1rem; background: var(--yellow); color: var(--ink); font-family: var(--font-pixel); font-size: .75rem; transform: translateY(-200%); }
.skip-link:focus { transform: none; }
.wrap { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: var(--gutter); }
.muted { color: var(--muted); }
.small { font-size: 1.125rem; }
.noscript { padding: 2rem; text-align: center; }

/* CRT scanlines + vignette (static: no cost per frame) */
.crt {
  position: fixed; inset: 0; z-index: var(--z-crt); pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,.16) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,.45) 100%);
}

/* Notched pixel corners */
.px-corners, .btn, .panel, .cabinet, .item, .player-card, .toast, .chip, .token-pill, .overlay .reward, .wardrobe__item, .form-error {
  clip-path: polygon(var(--notch) 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% calc(100% - var(--notch)), calc(100% - var(--notch)) 100%, var(--notch) 100%, 0 calc(100% - var(--notch)), 0 var(--notch));
}

/* ---------- Buttons ---------- */
.btn {
  --b: var(--panel-2); --f: var(--text); --s: #000;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: 0 1.25rem;
  font: 400 .75rem/1.2 var(--font-pixel); text-transform: uppercase; letter-spacing: .02em; text-decoration: none;
  color: var(--f); background: var(--b);
  border: 0; box-shadow: inset 0 -4px 0 var(--s);
  transition: transform 80ms, filter 120ms;
  touch-action: manipulation; user-select: none;
}
.btn:hover { filter: brightness(1.12); color: var(--f); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 var(--s); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; filter: grayscale(.4); }
.btn--primary { --b: var(--yellow); --f: var(--ink); --s: #b39500; }
.btn--pink { --b: var(--pink); --f: #fff; --s: #a3104f; }
.btn--green { --b: var(--green); --f: var(--ink); --s: #1f9e4a; }
.btn--ghost { --b: transparent; --f: var(--text); --s: transparent; box-shadow: inset 0 0 0 3px var(--line-2); }
.btn--ghost:active { box-shadow: inset 0 0 0 3px var(--line-2); }
.btn--sm { min-height: 44px; padding: 0 .875rem; font-size: .625rem; }
.btn--big { min-height: 56px; padding: 0 1.75rem; font-size: .875rem; }
.btn--block { width: 100%; }
.btn[aria-busy="true"] { cursor: progress; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: var(--z-top); background: rgba(11, 11, 30, .92); border-bottom: 3px solid var(--line); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.topbar__row { display: flex; align-items: center; gap: 1rem; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: .625rem; text-decoration: none; color: var(--text); min-height: 44px; }
.brand__mark { width: 32px; height: 32px; }
.brand__word { font: .875rem/1 var(--font-pixel); text-transform: uppercase; }
.brand__word span { color: var(--pink); }
.topnav { display: flex; gap: .25rem; margin-left: 1rem; }
.topnav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 .875rem;
  font: .6875rem/1 var(--font-pixel); text-transform: uppercase; text-decoration: none; color: var(--muted);
}
.topnav a:hover { color: var(--text); }
.topnav a[aria-current="page"] { color: var(--yellow); }
.topnav a[aria-current="page"]::before { content: "\25B6"; margin-right: .5rem; font-size: .5rem; animation: blink 1s steps(2, jump-none) infinite; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: .625rem; }
.token-pill {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 40px; padding: 0 .875rem;
  background: var(--panel-2); color: var(--yellow); text-decoration: none; font: .75rem/1 var(--font-pixel);
  box-shadow: inset 0 -3px 0 #000;
}
.token-pill .coin { width: 18px; height: 18px; }
.token-pill.bump { animation: bump 500ms var(--ease); }
@keyframes bump { 30% { transform: scale(1.25); } }
.icon-btn {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; min-width: 44px; padding: 0 .75rem;
  background: none; border: 3px solid var(--line-2); color: var(--muted);
  font: .625rem/1 var(--font-pixel); text-transform: uppercase;
}
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.icon-btn:hover { color: var(--text); border-color: var(--text); }
.icon-btn[aria-pressed="true"] { color: var(--ink); background: var(--green); border-color: var(--green); }
.auth-links { display: flex; align-items: center; gap: .75rem; }
.auth-links__login { font: .625rem/1 var(--font-pixel); text-transform: uppercase; color: var(--text); padding: .75rem .25rem; }
.me { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 .5rem 0 .25rem; text-decoration: none; color: var(--text); font: .625rem/1 var(--font-pixel); border: 3px solid var(--line-2); }
.me:hover { border-color: var(--text); color: var(--text); }
.me .avatar--mini { width: 24px; height: 34px; flex: none; }

/* ---------- Tab bar (mobile) ---------- */
.tabbar { display: none; }
@media (max-width: 767px) {
  :root { --tabbar-h: calc(64px + env(safe-area-inset-bottom)); }
  .topnav, .auth-links__login, .icon-btn__label, .me__name { display: none; }
  .brand__word { font-size: .6875rem; }
  .topbar__row { gap: .5rem; min-height: 56px; }
  .topbar__right { gap: .375rem; }
  .token-pill { padding: 0 .625rem; font-size: .6875rem; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-tab);
    display: grid; grid-template-columns: repeat(3, 1fr);
    height: var(--tabbar-h); padding-bottom: env(safe-area-inset-bottom);
    background: #0e0e28; border-top: 3px solid var(--line);
  }
  .tabbar a { display: grid; place-items: center; align-content: center; gap: .25rem; text-decoration: none; color: var(--muted); font: .5625rem/1 var(--font-pixel); text-transform: uppercase; }
  .tabbar svg { width: 22px; height: 22px; fill: currentColor; }
  .tabbar a[aria-current="page"] { color: var(--yellow); }
}
@media (max-width: 380px) { .brand__word { display: none; } }

/* ---------- Main + page transition ---------- */
main { flex: 1; outline: none; }
main.is-entering { animation: page-in 380ms ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } }
.footer { padding: 2rem 0 2.5rem; color: var(--muted); font-size: 1.125rem; border-top: 3px solid var(--line); margin-top: 4rem; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; isolation: isolate; border-bottom: 3px solid var(--line); }
.hero__sky { position: absolute; inset: 0; z-index: -1; background: linear-gradient(#0b0b1e 0%, #1c0c40 40%, #4a0f5c 62%, #0b0b1e 62.3%); }
.hero__sky::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(11, 11, 30, .88) 0%, rgba(11, 11, 30, .55) 45%, transparent 70%); }
@media (max-width: 899px) { .hero__sky::after { background: rgba(11, 11, 30, .6); } }
.stars { position: absolute; inset: 0 0 40% 0; }
.stars::before, .stars::after {
  content: ""; position: absolute; width: 2px; height: 2px; background: #fff;
  box-shadow: 8vw 12vh #fff, 22vw 30vh #9ff, 35vw 8vh #fff, 48vw 22vh #fcf, 63vw 10vh #fff, 77vw 28vh #9ff, 88vw 14vh #fff, 94vw 34vh #fff, 15vw 40vh #fcf, 55vw 38vh #fff, 70vw 44vh #fff, 4vw 30vh #9ff;
  animation: twinkle 3s steps(2, jump-none) infinite;
}
.stars::after { transform: translate(3vw, 6vh); animation-delay: 1.5s; }
@keyframes twinkle { 50% { opacity: .35; } }
.sun {
  position: absolute; left: 70%; top: 62%; width: min(42vw, 360px); aspect-ratio: 1; transform: translate(-50%, -62%);
  border-radius: 50%;
  background: linear-gradient(#ffe14d 10%, #ff8c1a 45%, #ff2e88 80%);
  -webkit-mask: linear-gradient(#000 45%, transparent 45% 49%, #000 49% 58%, transparent 58% 63%, #000 63% 70%, transparent 70% 76%, #000 76% 82%, transparent 82% 89%, #000 89%);
          mask: linear-gradient(#000 45%, transparent 45% 49%, #000 49% 58%, transparent 58% 63%, #000 63% 70%, transparent 70% 76%, #000 76% 82%, transparent 82% 89%, #000 89%);
  filter: drop-shadow(0 0 40px rgba(255, 46, 136, .5));
}
.floor { position: absolute; left: 0; right: 0; top: 62%; bottom: 0; perspective: 260px; perspective-origin: 50% 0; overflow: hidden; background: linear-gradient(#170a33, #0b0b1e); }
.floor__plane { position: absolute; left: -60%; right: -60%; top: 0; height: 300%; transform-origin: 50% 0; transform: rotateX(72deg); overflow: hidden; }
.floor__lines {
  position: absolute; inset: -48px 0 0 0;
  background-image: linear-gradient(rgba(255, 46, 136, .8) 3px, transparent 3px), linear-gradient(90deg, rgba(255, 46, 136, .8) 3px, transparent 3px);
  background-size: 48px 48px;
  animation: floor 900ms linear infinite;
}
@keyframes floor { to { transform: translateY(48px); } }

.hero__inner { position: relative; display: grid; gap: 2rem; align-items: center; padding-block: clamp(2.5rem, 7vw, 5rem) clamp(3rem, 8vw, 6rem); }
@media (min-width: 900px) { .hero__inner { grid-template-columns: 1.4fr 1fr; } }
.insert-coin { position: relative; display: inline-block; font: .75rem/1 var(--font-pixel); color: var(--yellow); text-transform: uppercase; margin-bottom: 1.5rem; height: 1em; }
.insert-coin span { animation: swap 2.4s steps(1) infinite; }
.insert-coin span + span { position: absolute; left: 0; top: 0; opacity: 0; animation-delay: 1.2s; color: var(--cyan); }
@keyframes swap { 0% { opacity: 1; } 42% { opacity: 0; } 50% { opacity: 0; } 100% { opacity: 0; } }
.hero__title {
  font: 400 clamp(1.75rem, 6.2vw, 4rem)/1.15 var(--font-pixel); text-transform: uppercase; outline: none;
  color: #fff; text-shadow: 3px 3px 0 var(--pink), 6px 6px 0 #5a0f5c;
}
.hero__title span { display: block; color: var(--cyan); text-shadow: 3px 3px 0 #1a3aa8, 6px 6px 0 #0b0b1e; font-size: .8em; margin-top: .35em; }
.hero__lede { max-width: 32rem; margin-top: 1.5rem; font-size: 1.625rem; color: var(--text); text-shadow: 0 2px 0 #000; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }

.player-card { background: rgba(22, 22, 58, .92); padding: 1.5rem; box-shadow: inset 0 0 0 3px var(--line-2); display: grid; gap: .75rem; justify-items: center; text-align: center; max-width: 22rem; width: 100%; justify-self: center; }
.player-card__stage { width: 132px; padding: 12px 0 4px; background: radial-gradient(ellipse at 50% 95%, rgba(41, 240, 255, .25), transparent 60%); animation: idle 1.6s steps(2, jump-none) infinite; }
@keyframes idle { 50% { transform: translateY(-3px); } }
.player-card__name { font: .875rem/1.3 var(--font-pixel); color: var(--text); }
.player-card__tokens { display: inline-flex; align-items: center; gap: .5rem; font: .75rem/1 var(--font-pixel); color: var(--muted); }
.player-card__tokens b { font-size: 1.25rem; }
.player-card__text { color: var(--muted); }
.avatar { width: 100%; height: auto; image-rendering: pixelated; }

/* Coins */
.coin { width: 16px; height: 16px; flex: none; }
.coin--md { width: 22px; height: 22px; }
.coin--lg { width: 30px; height: 30px; }

/* Token meter: five blocks = one item */
.meter { display: grid; gap: .5rem; width: 100%; }
.meter__bar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 4px; background: #07071a; box-shadow: inset 0 0 0 2px var(--line); }
.meter__block { height: 14px; background: var(--panel-2); }
.meter__block.is-on { background: var(--green); box-shadow: inset 0 -3px 0 #1f9e4a; }
.meter__label { font-size: 1.1875rem; color: var(--muted); text-align: left; }

/* ---------- Steps strip ---------- */
.steps { margin-top: 2rem; }
.steps__list { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); padding: 0; }
.steps__list li { display: flex; gap: 1rem; align-items: center; padding: 1rem 1.25rem; background: var(--panel); box-shadow: inset 0 0 0 3px var(--line); }
.steps__num { flex: none; display: grid; place-items: center; width: 40px; height: 40px; background: var(--pink); font: .875rem/1 var(--font-pixel); color: #fff; box-shadow: inset 0 -4px 0 #a3104f; }
.steps__list b { display: block; font: .625rem/1.6 var(--font-pixel); color: var(--yellow); text-transform: uppercase; }

/* ---------- Game cabinets ---------- */
.games { margin-top: 3.5rem; }
.section-title { font: .9375rem/1.4 var(--font-pixel); text-transform: uppercase; margin-bottom: 1.5rem; color: var(--text); }
.section-title::before { content: "> "; color: var(--pink); }
.cabinets { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13.5rem), 1fr)); }
.cabinet {
  --c: var(--cyan);
  display: flex; flex-direction: column; height: 100%; text-decoration: none; color: var(--text);
  background: var(--panel); box-shadow: inset 0 0 0 3px var(--line);
  transition: transform 180ms var(--ease), box-shadow 180ms;
}
.cabinet:hover, .cabinet:focus-visible { transform: translateY(-4px); box-shadow: inset 0 0 0 3px var(--c), 0 0 24px -4px var(--c); color: var(--text); }
.cabinet:focus-visible { outline-offset: 4px; }
.cabinet__marquee { display: flex; align-items: center; justify-content: space-between; height: 22px; padding: 0 10px; background: var(--c); }
.cabinet__num { font: .5625rem/1 var(--font-pixel); color: var(--ink); }
.cabinet__screen { position: relative; display: block; margin: 10px 10px 0; aspect-ratio: 4 / 3; background: #000; overflow: hidden; box-shadow: inset 0 0 0 3px #000; }
.cabinet__screen canvas { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; transition: transform 400ms ease-out; }
.cabinet__screen::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(to bottom, rgba(0,0,0,.25) 0 1px, transparent 1px 3px); pointer-events: none; }
.cabinet:hover .cabinet__screen canvas { transform: scale(1.06); }
.cabinet__body { display: grid; gap: .375rem; padding: 12px 12px 14px; flex: 1; align-content: start; }
.cabinet__title { font: .75rem/1.4 var(--font-pixel); text-transform: uppercase; color: var(--c); }
.cabinet__tag { font-size: 1.1875rem; color: var(--muted); line-height: 1.2; }
.cabinet__foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: .5rem; font: .5625rem/1 var(--font-pixel); color: var(--yellow); text-transform: uppercase; }
.cabinet__play { display: inline-flex; align-items: center; gap: 4px; color: var(--text); }
.cabinet__play svg { width: 12px; height: 12px; fill: currentColor; }
.cabinet:hover .cabinet__play { animation: blink .6s steps(2, jump-none) infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* ---------- Panels & page heads ---------- */
.page { padding-block: 2rem 1rem; }
.page-head { margin-bottom: 2rem; display: grid; gap: .75rem; }
.page-title { font: 400 clamp(1.25rem, 4vw, 2rem)/1.3 var(--font-pixel); text-transform: uppercase; color: #fff; text-shadow: 3px 3px 0 var(--pink); outline: none; overflow-wrap: anywhere; }
.page-lede { color: var(--muted); font-size: 1.5rem; max-width: 40rem; }
.panel { background: var(--panel); padding: 1.5rem; box-shadow: inset 0 0 0 3px var(--line); display: grid; gap: 1rem; align-content: start; }
.panel + .panel { margin-top: 1.25rem; }
.panel__title { font: .75rem/1.4 var(--font-pixel); text-transform: uppercase; color: var(--cyan); }
.big-tokens { display: flex; align-items: center; gap: .75rem; font: 1.5rem/1 var(--font-pixel); }
.badge { display: inline-block; margin-left: .75rem; padding: .375rem .5rem; background: var(--pink); color: #fff; font: .5625rem/1 var(--font-pixel); text-transform: uppercase; vertical-align: middle; animation: blink 1s steps(2, jump-none) 3; }
.badge--green { margin: 0; background: var(--green); color: var(--ink); animation: none; }
.back-link { display: inline-flex; align-items: center; gap: .375rem; min-height: 44px; font: .625rem/1 var(--font-pixel); text-transform: uppercase; text-decoration: none; color: var(--muted); }
.back-link svg { width: 16px; height: 16px; fill: currentColor; }
.back-link:hover { color: var(--text); }

/* ---------- Play page ---------- */
.play { padding-block: 1rem 1rem; }
.play__layout { display: grid; gap: 1.5rem; margin-top: .5rem; }
@media (min-width: 960px) { .play__layout { grid-template-columns: minmax(0, 1fr) 20rem; align-items: start; } }
.play__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .75rem 1rem; margin-bottom: .75rem; }
.play__num { font: .625rem/1 var(--font-pixel); color: var(--c, var(--pink)); text-transform: uppercase; }
.play__title { font: 400 clamp(1rem, 3.4vw, 1.5rem)/1.3 var(--font-pixel); text-transform: uppercase; color: #fff; text-shadow: 3px 3px 0 var(--c, var(--pink)); outline: none; }
.hud { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; padding: .5rem .75rem; margin-bottom: .75rem; background: #07071a; box-shadow: inset 0 0 0 3px var(--line); font: .625rem/1.6 var(--font-pixel); text-transform: uppercase; color: var(--muted); }
.hud b { font-variant-numeric: tabular-nums; }
.hud__lives b { color: var(--pink); letter-spacing: .15em; }
.hud__status { margin-left: auto; color: var(--cyan); }
.screen {
  position: relative; margin-inline: auto;
  aspect-ratio: var(--ar);
  width: min(100%, calc(var(--ar) * (100dvh - 17rem - var(--tabbar-h))));
  min-width: min(100%, 260px);
  background: #000; box-shadow: 0 0 0 4px #000, 0 0 0 7px var(--c, var(--line-2)), 0 0 40px -6px var(--c, var(--cyan));
}
.screen__canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; outline: none; }
.screen__canvas.is-playing { touch-action: none; }
.screen::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(to bottom, rgba(0,0,0,.2) 0 1px, transparent 1px 3px); }
.shake { animation: shake 260ms steps(4); }
@keyframes shake { 25% { transform: translate(3px, -2px); } 50% { transform: translate(-3px, 2px); } 75% { transform: translate(2px, 1px); } }

.overlay {
  position: absolute; inset: 0; z-index: 2; overflow: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .875rem;
  padding: 1rem; text-align: center; background: rgba(7, 7, 26, .86);
}
.overlay__kicker { font: .5625rem/1 var(--font-pixel); color: var(--muted); text-transform: uppercase; }
.overlay__title { font: 400 clamp(.875rem, 4vw, 1.375rem)/1.3 var(--font-pixel); color: var(--c, var(--yellow)); text-transform: uppercase; text-shadow: 2px 2px 0 #000; }
.overlay__title.is-win { color: var(--green); }
.overlay__hint { font-size: 1.125rem; color: var(--muted); }
.overlay__score { font: .75rem/1.6 var(--font-pixel); text-transform: uppercase; }
.overlay__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .625rem; }
.overlay .btn--big { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { filter: brightness(1.25); } }
.reward { display: grid; gap: .5rem; justify-items: center; width: min(100%, 18rem); padding: .875rem 1rem; background: var(--panel); box-shadow: inset 0 0 0 3px var(--yellow); }
.reward__amount { display: flex; align-items: center; gap: .5rem; font: .875rem/1 var(--font-pixel); color: var(--yellow); animation: pop 500ms var(--ease); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.reward__balance { font-size: 1.25rem; }
.reward .meter__label { text-align: center; font-size: 1.0625rem; }
.reward--guest { box-shadow: inset 0 0 0 3px var(--pink); font-size: 1.1875rem; }

.play__tools { display: flex; flex-wrap: wrap; gap: .625rem; justify-content: center; margin-top: 1rem; }
[data-sfx][aria-pressed="false"] { opacity: .6; text-decoration: line-through; }
.play__side p { color: var(--text); }

/* Touch pad: shown on touch devices only */
.pad { display: none; }
@media (hover: none), (pointer: coarse) {
  .pad { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.25rem; padding-inline: .5rem; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
}
.pad__dirs { display: grid; grid-template-areas: ". up ." "left . right" ". down ."; grid-template-columns: repeat(3, 60px); grid-auto-rows: auto; gap: 4px; }
.pad__btn, .pad__a { touch-action: none; border: 0; }
.pad__btn { width: 60px; height: 60px; display: grid; place-items: center; background: var(--panel-2); color: var(--text); box-shadow: inset 0 -5px 0 #000, inset 0 0 0 3px var(--line-2); }
.pad__btn svg { width: 26px; height: 26px; fill: currentColor; }
.pad__btn--up { grid-area: up; } .pad__btn--down { grid-area: down; } .pad__btn--left { grid-area: left; } .pad__btn--right { grid-area: right; }
.pad__a { width: 92px; height: 92px; border-radius: 50%; background: var(--pink); color: #fff; font: .625rem/1 var(--font-pixel); text-transform: uppercase; box-shadow: inset 0 -6px 0 #a3104f, 0 0 0 4px #0b0b1e, 0 0 0 7px var(--pink); }
.pad__btn.is-down, .pad__a.is-down { transform: translateY(3px); box-shadow: inset 0 -2px 0 #000, inset 0 0 0 3px var(--cyan); }
.pad__a.is-down { box-shadow: inset 0 -2px 0 #a3104f, 0 0 0 4px #0b0b1e, 0 0 0 7px var(--yellow); }

/* ---------- Shop ---------- */
.shop { display: grid; gap: 1.5rem; }
@media (min-width: 900px) { .shop { grid-template-columns: 18rem minmax(0, 1fr); align-items: start; } .fitting { position: sticky; top: 5.5rem; } }
.fitting { justify-items: center; text-align: center; }
.fitting__stage { width: 150px; padding: 10px 0; background: radial-gradient(ellipse at 50% 95%, rgba(255, 46, 136, .25), transparent 60%); }
@media (max-width: 899px) { .fitting { grid-template-columns: 110px 1fr; justify-items: start; text-align: left; } .fitting__stage { width: 110px; grid-row: span 4; } .fitting .panel__title { grid-column: 2; } }
.fitting__caption { font-size: 1.25rem; color: var(--muted); }
.fitting__balance { width: 100%; display: grid; gap: .75rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.25rem; }
.chip { min-height: 44px; padding: 0 1rem; background: transparent; border: 0; box-shadow: inset 0 0 0 3px var(--line-2); color: var(--muted); font: .625rem/1 var(--font-pixel); text-transform: uppercase; }
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { background: var(--cyan); color: var(--ink); box-shadow: inset 0 -4px 0 #1596a3; }
.items { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 12.5rem), 1fr)); }
.item { display: grid; gap: .375rem; padding: 1rem; background: var(--panel); box-shadow: inset 0 0 0 3px var(--line); align-content: start; }
.item.is-owned { box-shadow: inset 0 0 0 3px #1f6b3a; }
.item.is-preview { box-shadow: inset 0 0 0 3px var(--pink); }
.item__stage { justify-self: center; width: 88px; margin-bottom: .25rem; }
.item__stage .avatar { opacity: 1; }
.item__name { font: .6875rem/1.4 var(--font-pixel); text-transform: uppercase; color: var(--text); }
.item__meta { font-size: 1.125rem; color: var(--muted); }
.item__price { display: flex; align-items: center; gap: .375rem; font: .75rem/1 var(--font-pixel); color: var(--yellow); min-height: 24px; }
.item__actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .5rem; }
.item__actions .btn { padding: 0 .5rem; }
.item__actions .btn--ghost[aria-pressed="true"] { box-shadow: inset 0 0 0 3px var(--pink); color: var(--pink); }

/* ---------- Account ---------- */
.account { display: grid; gap: 1.25rem; margin-bottom: 1.25rem; }
@media (min-width: 800px) { .account { grid-template-columns: 16rem 1fr; } }
.account__player { justify-items: center; }
.account__stage { width: 160px; padding: 8px 0; background: radial-gradient(ellipse at 50% 95%, rgba(41, 240, 255, .25), transparent 60%); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: .75rem; margin-top: .5rem; }
.stats div { padding: .75rem; background: #07071a; box-shadow: inset 0 0 0 2px var(--line); }
.stats dt { font-size: 1.125rem; color: var(--muted); }
.stats dd { font: .875rem/1.4 var(--font-pixel); color: var(--text); font-variant-numeric: tabular-nums; }
.wardrobe { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.5rem), 1fr)); }
.wardrobe__item { display: grid; gap: .375rem; justify-items: center; padding: .75rem; background: #07071a; box-shadow: inset 0 0 0 2px var(--line); text-align: center; }
.wardrobe__item.is-on { box-shadow: inset 0 0 0 3px var(--green); }
.wardrobe__stage { width: 64px; }
.wardrobe__name { font: .5625rem/1.5 var(--font-pixel); text-transform: uppercase; }
.wardrobe__item .btn { width: 100%; }
.empty { color: var(--muted); }
.scores { width: 100%; border-collapse: collapse; font-size: 1.25rem; }
.scores th, .scores td { padding: .5rem .25rem; border-bottom: 2px solid var(--line); text-align: left; }
.scores thead th { font: .5625rem/1 var(--font-pixel); text-transform: uppercase; color: var(--muted); }
.scores td { text-align: right; font-variant-numeric: tabular-nums; color: var(--yellow); }
.scores thead th:last-child { text-align: right; }
.scores a { color: var(--text); text-decoration: none; }
.scores a:hover { color: var(--cyan); }
.account__footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.25rem; }

/* ---------- Auth ---------- */
.auth { display: grid; gap: 2rem; align-items: center; }
@media (min-width: 860px) { .auth { grid-template-columns: minmax(0, 30rem) 1fr; } }
.auth__panel { gap: 1.25rem; }
.auth__switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: #07071a; box-shadow: inset 0 0 0 2px var(--line); }
.auth__switch a { display: grid; place-items: center; min-height: 44px; font: .625rem/1 var(--font-pixel); text-transform: uppercase; text-decoration: none; color: var(--muted); }
.auth__switch a[aria-current="page"] { background: var(--pink); color: #fff; box-shadow: inset 0 -4px 0 #a3104f; }
.auth__preview { display: grid; justify-items: center; gap: 1rem; }
.auth__stage { width: min(200px, 50vw); animation: idle 1.6s steps(2, jump-none) infinite; }
@media (max-width: 859px) { .auth__preview { display: none; } }
.form { display: grid; gap: 1.25rem; }
.field { display: grid; gap: .375rem; }
.field label { font: .625rem/1.4 var(--font-pixel); text-transform: uppercase; color: var(--text); }
.field__row { display: flex; gap: .5rem; }
.field__row input { flex: 1; min-width: 0; }
.field input {
  min-height: 52px; padding: 0 1rem; width: 100%;
  font: 1.5rem var(--font-body); color: var(--text);
  background: #07071a; border: 3px solid var(--line-2); border-radius: 0;
}
.field input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(41, 240, 255, .25); }
.field input[aria-invalid="true"] { border-color: var(--red); }
.field__toggle { flex: none; }
.field__help { font-size: 1.125rem; color: var(--muted); }
.field__error { font-size: 1.1875rem; color: #ff9db0; min-height: 0; }
.field__error:empty { display: none; }
.field__error::before { content: "! "; }
.form-error { padding: .875rem 1rem; background: #3a0f22; color: #ffd0da; box-shadow: inset 0 0 0 3px var(--red); outline: none; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 1rem; bottom: calc(1rem + var(--tabbar-h)); z-index: var(--z-toast); display: grid; gap: .5rem; justify-items: end; pointer-events: none; }
.toast { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .75rem; min-width: 15rem; max-width: calc(100vw - 2rem); padding: .75rem 1rem .75rem .75rem; background: #10102c; box-shadow: inset 0 0 0 3px var(--yellow); animation: toast-in 380ms var(--ease) both; }
.toast--pink { box-shadow: inset 0 0 0 3px var(--pink); }
.toast--cyan { box-shadow: inset 0 0 0 3px var(--cyan); }
.toast.is-leaving { animation: toast-out 260ms ease-in both; }
.toast__icon .coin { width: 28px; height: 28px; }
.toast__kicker { display: block; font: .5rem/1.4 var(--font-pixel); text-transform: uppercase; color: var(--muted); }
.toast__title { display: block; font: .6875rem/1.4 var(--font-pixel); color: var(--text); }
@keyframes toast-in { from { opacity: 0; transform: translateY(20px) scale(.9); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30%); } }
@media (max-width: 599px) { .toasts { left: 1rem; justify-items: stretch; } }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .insert-coin span + span { display: none; }
  .insert-coin span { opacity: 1 !important; }
}
.cabinet__screen canvas[data-thumb="blocks"] { object-position: 50% 100%; }
@media (hover: none), (pointer: coarse) { .overlay__hint { display: none; } }

/* =========================================================
   Rarity, legendary unlocks, categories
   ========================================================= */
:root { --r-common: #a3a3cc; --r-rare: #3d9bff; --r-unique: #c77dff; --r-legendary: #ffc53d; }
.btn--gold { --b: var(--r-legendary); --f: var(--ink); --s: #b3800f; }
.badge--gold { margin: 0; background: var(--r-legendary); color: var(--ink); animation: none; }
.lock { width: 14px; height: 14px; flex: none; color: currentColor; }
.toast--gold { box-shadow: inset 0 0 0 3px var(--r-legendary), 0 0 24px -4px var(--r-legendary); }
.toast--gold .toast__icon { color: var(--r-legendary); }
.toast--gold .lock { width: 26px; height: 26px; }

.rarity { display: inline-block; padding: .3rem .45rem; font: .5rem/1 var(--font-pixel); text-transform: uppercase; color: var(--ink); background: var(--r-common); }
.rarity--rare { background: var(--r-rare); }
.rarity--unique { background: var(--r-unique); }
.rarity--legendary { background: linear-gradient(90deg, #ffc53d, #fff3b0, #ffc53d); background-size: 200% 100%; animation: shimmer 2.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Shop filters */
.chips--cats { margin-bottom: .75rem; }
.chip__count { margin-left: .5rem; opacity: .75; }
.chips--rarity { margin-bottom: 1rem; }
.chip--sm { min-height: 40px; font-size: .5625rem; }
.chip--common[aria-pressed="true"] { background: var(--r-common); box-shadow: none; }
.chip--rare[aria-pressed="true"] { background: var(--r-rare); box-shadow: none; }
.chip--unique[aria-pressed="true"] { background: var(--r-unique); box-shadow: none; }
.chip--legendary[aria-pressed="true"] { background: var(--r-legendary); box-shadow: none; }
.shop__summary { color: var(--muted); font-size: 1.1875rem; margin-bottom: .75rem; }
.price-list { display: grid; gap: .375rem; width: 100%; margin: .25rem 0 0; padding-top: .75rem; border-top: 2px solid var(--line); }
.price-list div { display: flex; align-items: center; justify-content: space-between; }
.price-list dt, .price-list dd { margin: 0; }
.price-list dd { display: inline-flex; align-items: center; gap: .375rem; font: .625rem/1 var(--font-pixel); color: var(--yellow); }

/* Item cards by rarity */
.item { --rc: var(--line); box-shadow: inset 0 0 0 3px var(--rc); position: relative; }
.item--rare { --rc: #1f5fa8; }
.item--unique { --rc: #7a3fb0; }
.item--legendary { --rc: #b3800f; background: linear-gradient(180deg, #2a2240, var(--panel) 55%); }
.item--legendary:not(.is-locked) { box-shadow: inset 0 0 0 3px var(--r-legendary), 0 0 22px -8px var(--r-legendary); }
.item.is-owned { --rc: #1f6b3a; }
.item.is-preview { box-shadow: inset 0 0 0 3px var(--pink); }
.item__top { display: flex; align-items: center; justify-content: space-between; min-height: 22px; }
.item__lockicon { display: inline-flex; color: var(--r-legendary); }
.item__stage { width: 100%; height: 92px; margin: .25rem 0; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 80%, rgba(255, 255, 255, .06), transparent 70%); }
.item__stage .avatar { width: 100%; height: 100%; }
.item--legendary .item__stage { background: radial-gradient(ellipse at 50% 70%, rgba(255, 197, 61, .22), transparent 70%); }
.item.is-locked .item__stage .avatar { filter: brightness(.55) saturate(.6); }
.item__lock { font-size: 1.0625rem; line-height: 1.2; color: #ffe3a3; }
.item__lock b { color: var(--r-legendary); }

/* Legendary quests */
.quests { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.quests--compact { grid-template-columns: 1fr; }
.quest { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: .75rem; padding: .625rem .75rem; background: #07071a; box-shadow: inset 0 0 0 2px #5c4312; }
.quest.is-unlocked { box-shadow: inset 0 0 0 2px var(--r-legendary); }
.quest__stage { width: 64px; height: 56px; background: radial-gradient(ellipse at 50% 70%, rgba(255, 197, 61, .2), transparent 70%); }
.quest__stage .avatar { width: 100%; height: 100%; }
.quest:not(.is-unlocked) .quest__stage .avatar { filter: brightness(.55) saturate(.6); }
.quest__body { display: grid; gap: .2rem; min-width: 0; }
.quest__name { font: .5625rem/1.4 var(--font-pixel); text-transform: uppercase; color: var(--r-legendary); }
.quest__goal, .quest__best { font-size: 1.0625rem; line-height: 1.15; }
.quest__best { color: var(--muted); }
.quest__bar { height: 8px; background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line); }
.quest__bar span { display: block; height: 100%; background: var(--r-legendary); }
.quest__locked { display: inline-flex; align-items: center; gap: .3rem; font: .5rem/1 var(--font-pixel); text-transform: uppercase; color: var(--muted); }
.panel__title--gold { color: var(--r-legendary); }

/* Play page additions */
.hud__tokens { display: inline-flex; align-items: center; gap: .375rem; }
.hud__tokens .coin { width: 14px; height: 14px; }
.play__side-inner { display: grid; gap: 1rem; }
.rate { display: flex; align-items: center; gap: .5rem; padding: .625rem .75rem; background: #07071a; box-shadow: inset 0 0 0 2px var(--line); font-size: 1.1875rem; line-height: 1.2; }
.reward__calc { font-size: 1.0625rem; color: var(--muted); }
.unlock { display: flex; align-items: center; gap: .75rem; width: min(100%, 18rem); padding: .5rem .75rem; background: #2a2240; box-shadow: inset 0 0 0 3px var(--r-legendary), 0 0 24px -6px var(--r-legendary); text-align: left; animation: pop 600ms var(--ease); }
.unlock__stage { width: 56px; height: 48px; flex: none; }
.unlock__stage .avatar { width: 100%; height: 100%; }
.unlock p { font: .5625rem/1.5 var(--font-pixel); text-transform: uppercase; color: var(--text); }
.unlock__kicker { display: block; color: var(--r-legendary); }

/* Arcade cabinets */
.cabinet__legend { font: .625rem/1 var(--font-pixel); color: var(--ink); letter-spacing: .1em; }
.cabinet__foot .coin { width: 12px; height: 12px; display: inline-block; vertical-align: -2px; }
.section-note { margin: -.75rem 0 1.25rem; color: var(--muted); font-size: 1.1875rem; }
.section-note .star { color: var(--r-legendary); }

/* Wardrobe by category */
.wardrobe__cat { font: .625rem/1.4 var(--font-pixel); text-transform: uppercase; color: var(--text); margin: .75rem 0 .5rem; }
.wardrobe__cat span { color: var(--muted); }
.wardrobe__item--rare { box-shadow: inset 0 0 0 2px #1f5fa8; }
.wardrobe__item--unique { box-shadow: inset 0 0 0 2px #7a3fb0; }
.wardrobe__item--legendary { box-shadow: inset 0 0 0 2px var(--r-legendary); }
.wardrobe__item.is-on { box-shadow: inset 0 0 0 3px var(--green); }
.wardrobe__stage { width: 64px; height: 56px; }
.wardrobe__stage .avatar { width: 100%; height: 100%; }
.scores td.muted { color: var(--muted); }
.scores thead th:not(:first-child) { text-align: right; }
.page-root { display: contents; }
@media (max-width: 599px) {
  .items { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .625rem; }
  .item { padding: .75rem .625rem; }
  .item__actions { grid-template-columns: 1fr; }
  .item__stage { height: 76px; }
  .item__name { font-size: .5625rem; }
  .price-list { display: none; }
}

/* =========================================================
   Today: login bonus + daily challenges
   ========================================================= */
.today { margin-top: 3rem; }
.today__grid { display: grid; gap: 1.25rem; }
@media (min-width: 900px) { .today__grid { grid-template-columns: 1fr 1fr; } }
.today .panel + .panel { margin-top: 0; }
.panel__title .muted { margin-left: .5rem; font-size: .5625rem; }

.login-track { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 0; list-style: none; }
.login-day {
  position: relative; display: grid; justify-items: center; align-content: center; gap: .3rem;
  min-height: 92px; padding: .5rem .25rem; background: #07071a; box-shadow: inset 0 0 0 2px var(--line); text-align: center;
}
.login-day__label { font: .5rem/1 var(--font-pixel); text-transform: uppercase; color: var(--muted); }
.login-day__amount { font: .6875rem/1 var(--font-pixel); color: var(--yellow); }
.login-day.is-big { background: linear-gradient(180deg, #3a2a0a, #07071a); box-shadow: inset 0 0 0 2px #b3800f; }
.login-day.is-big .login-day__amount { font-size: .875rem; color: var(--r-legendary); }
.login-day.is-today { box-shadow: inset 0 0 0 3px var(--cyan), 0 0 16px -4px var(--cyan); animation: pulse 1.2s ease-in-out infinite; }
.login-day.is-claimed { opacity: .55; animation: none; }
.login-day__check { position: absolute; top: 4px; right: 5px; color: var(--green); font-size: 1rem; }

.challenges { display: grid; gap: .5rem; }
.challenge {
  --c: var(--cyan);
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "level goal action" "level reward action";
  align-items: center; gap: .125rem .75rem; padding: .625rem .75rem;
  background: #07071a; box-shadow: inset 4px 0 0 var(--c), inset 0 0 0 2px var(--line);
}
.challenge__level { grid-area: level; min-width: 4.25rem; padding: .35rem .4rem; text-align: center; font: .5rem/1 var(--font-pixel); text-transform: uppercase; color: var(--ink); background: var(--green); }
.challenge--medium .challenge__level { background: var(--yellow); }
.challenge--hard .challenge__level { background: var(--pink); color: #fff; }
.challenge__goal { grid-area: goal; font-size: 1.1875rem; line-height: 1.2; }
.challenge__reward { grid-area: reward; display: inline-flex; align-items: center; gap: .375rem; font: .625rem/1 var(--font-pixel); color: var(--yellow); }
.challenge > .btn, .challenge > .badge, .challenge__open { grid-area: action; }
.challenge__open { font: .5rem/1 var(--font-pixel); text-transform: uppercase; color: var(--muted); }
.challenge.is-done { opacity: .65; }
.challenge.is-done .challenge__goal { text-decoration: line-through; }

/* =========================================================
   Mystery boxes
   ========================================================= */
.boxes { margin-bottom: 2rem; }
.boxes__note { margin: -1rem 0 1rem; color: var(--muted); font-size: 1.1875rem; }
.boxes__list { display: grid; gap: .75rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mbox-card { display: grid; gap: .5rem; justify-items: center; padding: 1rem .75rem; text-align: center; background: linear-gradient(180deg, color-mix(in srgb, var(--bc) 18%, #0b0b1e), var(--panel)); box-shadow: inset 0 0 0 3px var(--bc); }
.mbox-card__art { width: 72px; height: 72px; animation: idle 1.6s steps(2, jump-none) infinite; }
.mbox-card:nth-child(2) .mbox-card__art { animation-delay: .4s; }
.mbox-card:nth-child(3) .mbox-card__art { animation-delay: .8s; }
.mbox, .mbox-card__art svg { width: 100%; height: 100%; }
.mbox-card__name { font: .625rem/1.4 var(--font-pixel); text-transform: uppercase; color: var(--bc); }
.mbox-card__odds { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .25rem; font-size: 1.0625rem; }
.shop__cats-title { margin-top: .5rem; }
.box-tag { display: inline-block; margin-left: .25rem; padding: .3rem .4rem; font: .5rem/1 var(--font-pixel); text-transform: uppercase; color: #fff; background: var(--pink); }
.wardrobe__tags { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem; }
@media (max-width: 599px) {
  .boxes__list { grid-template-columns: 1fr; }
  .mbox-card { grid-template-columns: 64px 1fr auto; grid-template-areas: "art name price" "art odds odds" "art btn btn"; justify-items: start; text-align: left; }
  .mbox-card__art { grid-area: art; width: 64px; height: 64px; }
  .mbox-card__name { grid-area: name; } .mbox-card__odds { grid-area: odds; justify-content: flex-start; }
  .mbox-card .item__price { grid-area: price; justify-self: end; }
  .mbox-card > .btn { grid-area: btn; }
  .login-day { min-height: 80px; }
}

/* =========================================================
   Modal + box reveal
   ========================================================= */
.modal { width: min(30rem, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); padding: 0; border: 0; background: var(--panel); color: var(--text); box-shadow: 0 0 0 3px var(--line-2), 0 20px 60px #000; overflow: auto; }
.modal[open] { animation: toast-in 320ms var(--ease); }
.modal::backdrop { background: rgba(5, 5, 20, .78); }
.modal__body { display: grid; gap: 1rem; padding: 1.5rem; text-align: center; }
.modal__body [data-login-modal] { display: grid; gap: 1rem; }
.modal__title { font: .9375rem/1.4 var(--font-pixel); text-transform: uppercase; color: #fff; text-shadow: 2px 2px 0 var(--pink); }
.modal__text { font-size: 1.25rem; }
.modal__text .rarity { vertical-align: middle; }
.modal__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .625rem; }
.modal__box { width: 120px; height: 120px; margin: 0 auto; }
.modal__box.is-opening { animation: box-shake 900ms steps(12) forwards; }
@keyframes box-shake {
  0%, 60% { transform: translateX(0) rotate(0); }
  10%, 30%, 50% { transform: translateX(-4px) rotate(-4deg); }
  20%, 40% { transform: translateX(4px) rotate(4deg); }
  80% { transform: scale(1.25); filter: brightness(2); }
  100% { transform: scale(1.6); opacity: 0; filter: brightness(3); }
}
.modal .login-track { margin-top: .25rem; }
.modal__close { margin-top: .25rem; }
.reveal { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.reveal__item { display: grid; gap: .4rem; justify-items: center; align-content: start; padding: .75rem .5rem; background: #07071a; box-shadow: inset 0 0 0 3px var(--r-common); animation: reveal-in 600ms var(--ease) both; animation-delay: var(--d, 0ms); }
.reveal__item--rare { box-shadow: inset 0 0 0 3px var(--r-rare), 0 0 20px -6px var(--r-rare); }
.reveal__item--unique { box-shadow: inset 0 0 0 3px var(--r-unique), 0 0 20px -6px var(--r-unique); }
.reveal__item--legendary { box-shadow: inset 0 0 0 3px var(--r-legendary), 0 0 28px -4px var(--r-legendary); background: linear-gradient(180deg, #3a2a0a, #07071a); }
@keyframes reveal-in { from { opacity: 0; transform: translateY(20px) scale(.6) rotate(-6deg); } }
.reveal__stage { width: 100%; height: 84px; }
.reveal__stage .avatar { width: 100%; height: 100%; }
.reveal__name { font: .5625rem/1.5 var(--font-pixel); text-transform: uppercase; }
.reveal__meta, .reveal__dupe { font-size: 1.0625rem; color: var(--muted); line-height: 1.2; }
.reveal__item .btn { width: 100%; }
.unlock--challenge { box-shadow: inset 0 0 0 3px var(--cyan), 0 0 24px -6px var(--cyan); }
.unlock--challenge .unlock__kicker { color: var(--cyan); }
.modal [data-login-modal] .panel__title { display: none; }
.toast__icon .star-icon { width: 28px; height: 28px; }
@media (max-width: 599px) {
  .challenge { grid-template-columns: 1fr auto; grid-template-areas: "level action" "goal action" "reward action"; row-gap: .375rem; }
  .challenge__level { justify-self: start; min-width: 0; }
}

/* Genre filter + tag on cabinets */
.chips--genre { margin-bottom: 1rem; }
.cabinets > li[hidden] { display: none; }
.cabinet__genre { justify-self: start; padding: .25rem .4rem; font: .5rem/1 var(--font-pixel); text-transform: uppercase; color: var(--c); box-shadow: inset 0 0 0 1px var(--c); }
.cabinet__screen canvas:is([data-thumb="stack"], [data-thumb="racer"], [data-thumb="beat"], [data-thumb="catcher"]) { object-position: 50% 100%; }

/* Legendary unlock routes (2–3 games per item) */
.quest { align-items: start; }
.quest__hint { font-size: 1rem; color: var(--muted); line-height: 1.1; }
.quest__routes { display: grid; gap: .375rem; margin-top: .125rem; }
.quest__route { display: grid; grid-template-columns: 1fr auto; gap: .125rem .5rem; align-items: baseline; font-size: 1.0625rem; line-height: 1.1; }
.quest__route .quest__bar { grid-column: 1 / -1; height: 6px; }
.quest__route.is-current .quest__game { color: var(--r-legendary); }
.quest__route.is-current .quest__game::before { content: "\25B6  "; font-size: .75em; }
.quest__route.is-met .quest__bar span { background: var(--green); }
.quest__game { min-width: 0; overflow-wrap: anywhere; }
.quest__game a { color: var(--text); }
.quest__nums { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.quest__state { align-self: center; }
.quest { grid-template-columns: 56px minmax(0, 1fr); }
.quest__stage { width: 56px; height: 52px; }
.quest__state { grid-column: 2; justify-self: start; align-self: start; }
.quest__game { overflow-wrap: normal; }

/* Four mystery boxes */
.boxes__list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); }
@media (max-width: 599px) { .boxes__list { grid-template-columns: 1fr; } }

/* Random game buttons */
.dice { width: 16px; height: 16px; flex: none; }
.btn--sm .dice { width: 14px; height: 14px; }
.games__random { margin: 0 0 1rem; }

/* =========================================================
   Inventory
   ========================================================= */
@media (max-width: 767px) { .tabbar { grid-template-columns: repeat(4, 1fr); } }
.inventory { display: grid; gap: 1.5rem; }
@media (min-width: 900px) { .inventory { grid-template-columns: 19rem minmax(0, 1fr); align-items: start; } .inv-preview { position: sticky; top: 5.5rem; } }
.inv-preview { justify-items: center; }
.inv-preview__stage { width: 150px; padding: 8px 0; background: radial-gradient(ellipse at 50% 95%, rgba(41, 240, 255, .25), transparent 60%); }
.inv-slots { display: grid; gap: 4px; width: 100%; }
.inv-slot { display: grid; grid-template-columns: 5.5rem 1fr auto; align-items: center; gap: .5rem; min-height: 36px; padding: 0 .25rem 0 .625rem; background: #07071a; box-shadow: inset 0 0 0 2px var(--line); font-size: 1.125rem; }
.inv-slot.is-on { box-shadow: inset 0 0 0 2px #1f6b3a; }
.inv-slot__label { font: .5rem/1.2 var(--font-pixel); text-transform: uppercase; color: var(--muted); }
.inv-slot__item { min-width: 0; line-height: 1.1; }
.inv-slot:not(.is-on) .inv-slot__item { color: var(--muted); }
.inv-slot__off { width: 32px; height: 32px; border: 0; background: transparent; color: var(--red); font: 1.375rem/1 var(--font-body); }
.inv-slot__off:hover { color: #fff; background: #3a0f22; }
.inv-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; width: 100%; }
.inv-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 8.5rem), 1fr)); }
.inv-item {
  --rc: var(--line);
  display: grid; gap: .3rem; justify-items: center; width: 100%; height: 100%; padding: .625rem .5rem; text-align: center;
  background: var(--panel); border: 0; color: var(--text); box-shadow: inset 0 0 0 3px var(--rc);
  clip-path: polygon(var(--notch) 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% calc(100% - var(--notch)), calc(100% - var(--notch)) 100%, var(--notch) 100%, 0 calc(100% - var(--notch)), 0 var(--notch));
  transition: transform 120ms var(--ease), box-shadow 120ms;
}
.inv-item:hover { transform: translateY(-2px); }
.inv-item--rare { --rc: #1f5fa8; } .inv-item--unique { --rc: #7a3fb0; } .inv-item--legendary { --rc: #b3800f; }
.inv-item.is-on { box-shadow: inset 0 0 0 3px var(--green), 0 0 18px -6px var(--green); background: #10301f; }
.inv-item__tags { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem; min-height: 20px; }
.inv-item__stage { width: 100%; height: 70px; }
.inv-item__stage .avatar { width: 100%; height: 100%; }
.inv-item__name { font: .5rem/1.5 var(--font-pixel); text-transform: uppercase; }
.inv-item__slot { font-size: 1rem; color: var(--muted); }
.inv-item.is-on .inv-item__slot { color: var(--green); }
.inv-empty { grid-column: 1 / -1; padding: 1.5rem; background: var(--panel); box-shadow: inset 0 0 0 3px var(--line); color: var(--muted); display: grid; gap: .5rem; }
@media (max-width: 599px) { .inv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .inv-preview { grid-template-columns: 1fr; } }
@media (max-width: 899px) {
  .inv-preview { display: contents; }
  .inv-preview__stage { order: 1; justify-self: center; width: 130px; }
  .inv-actions { order: 2; }
  .inv-main { order: 3; }
  .inv-slots { order: 4; }
}

/* =========================================================
   Friends, multiplayer hub and lobbies
   ========================================================= */
@media (max-width: 767px) { .tabbar { grid-template-columns: repeat(4, 1fr); } }
.friends-btn { position: relative; }
.count-badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px; display: grid; place-items: center; background: var(--pink); color: #fff; font: .5rem/1 var(--font-pixel); box-shadow: 0 0 0 2px var(--bg); }
.friends { display: grid; gap: 1.25rem; }
@media (min-width: 900px) { .friends { grid-template-columns: 1fr 1fr; align-items: start; } .friends__list { grid-row: span 3; } }
.friends .panel + .panel { margin-top: 0; }
.form--inline { gap: .5rem; }
.people { display: grid; gap: .5rem; }
.person { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: .75rem; padding: .5rem .625rem; background: #07071a; box-shadow: inset 0 0 0 2px var(--line); }
.person.is-online { box-shadow: inset 0 0 0 2px #1f6b3a; }
.friend__avatar { width: 40px; height: 40px; background: radial-gradient(circle at 50% 80%, rgba(41, 240, 255, .2), transparent 70%); }
.friend__avatar .avatar { width: 100%; height: 100%; }
.person__info { display: grid; min-width: 0; }
.person__name { font: .625rem/1.5 var(--font-pixel); overflow-wrap: anywhere; }
.person__status { display: flex; align-items: center; gap: .375rem; font-size: 1.0625rem; color: var(--muted); line-height: 1.2; }
.dot { width: 8px; height: 8px; flex: none; background: #4a4a6a; }
.is-online .dot { background: var(--green); box-shadow: 0 0 6px var(--green); }
.person__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .375rem; }
.person__actions .btn { min-height: 40px; }
.people .empty { padding: .5rem 0; }
@media (max-width: 599px) { .person { grid-template-columns: 36px 1fr; } .person__actions { grid-column: 1 / -1; justify-content: flex-start; } }

.mp-top { display: grid; gap: 1.25rem; margin-bottom: 2rem; }
@media (min-width: 800px) { .mp-top { grid-template-columns: 1fr 1fr; } }
.mp-top .panel + .panel { margin-top: 0; }
.mp-guest { margin-bottom: 2rem; display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.mp-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); margin-bottom: 2.5rem; }
.mp-card { --c: var(--cyan); display: grid; gap: .5rem; align-content: start; padding: 1rem; background: var(--panel); box-shadow: inset 0 0 0 3px var(--line), inset 0 4px 0 var(--c);
  clip-path: polygon(var(--notch) 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% calc(100% - var(--notch)), calc(100% - var(--notch)) 100%, var(--notch) 100%, 0 calc(100% - var(--notch)), 0 var(--notch)); }
.mp-card__top { display: flex; justify-content: space-between; gap: .5rem; font: .5rem/1.4 var(--font-pixel); text-transform: uppercase; }
.mp-card__kind { color: var(--c); }
.mp-card__players { color: var(--muted); }
.mp-card__title { font: .75rem/1.4 var(--font-pixel); text-transform: uppercase; color: #fff; }
.mp-card__tag { font-size: 1.125rem; color: var(--muted); line-height: 1.2; min-height: 2.4em; }

.lobby__grid { display: grid; gap: 1.25rem; }
@media (min-width: 900px) { .lobby__grid { grid-template-columns: 1fr 1fr; } .lobby__how { grid-column: 1 / -1; } }
.lobby__grid .panel + .panel { margin-top: 0; }
.lobby__players { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); gap: .625rem; }
.lobby__player { --pc: var(--cyan); display: grid; justify-items: center; gap: .375rem; padding: .75rem .5rem; background: #07071a; box-shadow: inset 0 0 0 2px var(--pc); text-align: center; }
.lobby__player.is-empty { box-shadow: inset 0 0 0 2px var(--line); opacity: .6; }
.lobby__player.is-away { opacity: .55; }
.lobby__avatar { width: 56px; height: 64px; }
.lobby__avatar .avatar { width: 100%; height: 100%; }
.lobby__name { font: .5625rem/1.5 var(--font-pixel); overflow-wrap: anywhere; }
.lobby__actions { display: grid; gap: .75rem; justify-items: start; margin-top: .5rem; }
.lobby__code { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; padding: .75rem; background: #07071a; box-shadow: inset 0 0 0 2px var(--line); }
.lobby__code b { font: 1.25rem/1 var(--font-pixel); letter-spacing: .15em; color: var(--yellow); }
.mp-scores { display: grid; gap: .375rem; }
.mp-score { --pc: var(--cyan); display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: .5rem; padding: .5rem .625rem; background: #07071a; box-shadow: inset 0 0 0 2px var(--line); font-size: 1.125rem; }
.mp-score.is-turn { box-shadow: inset 0 0 0 2px var(--pc), 0 0 14px -4px var(--pc); }
.mp-score.is-gone { opacity: .5; text-decoration: line-through; }
.mp-score__dot { width: 12px; height: 12px; background: var(--pc); }
.mp-score__name { min-width: 0; overflow-wrap: anywhere; }
.mp-score__val { color: var(--yellow); font-variant-numeric: tabular-nums; }
.mp-results { list-style: none; padding: 0; margin: 0; display: grid; gap: .375rem; width: min(100%, 17rem); }
.mp-results li { --pc: var(--cyan); display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: .5rem; padding: .375rem .5rem; background: var(--panel); box-shadow: inset 4px 0 0 var(--pc); font-size: 1.125rem; text-align: left; }
.mp-results__place { font: .75rem/1 var(--font-pixel); color: var(--yellow); }
.mp-results__pay { display: inline-flex; align-items: center; gap: .25rem; color: var(--yellow); }
.countdown { font-size: 2.5rem !important; }
.invite__who { width: 72px; height: 84px; margin: 0 auto; }
.invite__who .avatar { width: 100%; height: 100%; }
.booting { padding-top: 3rem; color: var(--muted); }

/* ---------- Jukebox ---------- */
.icon-btn.is-playing { color: var(--ink); background: var(--green); border-color: var(--green); }
.icon-btn[aria-expanded="true"] { color: var(--text); border-color: var(--text); }
.icon-btn.is-playing[aria-expanded="true"] { color: var(--ink); box-shadow: 0 0 0 3px var(--text); }
.jukebox {
  position: fixed; z-index: 70; top: 76px; right: max(1rem, calc((100vw - 1200px) / 2 + var(--gutter)));
  width: min(23rem, calc(100vw - 2rem)); max-height: calc(100dvh - 92px - var(--tabbar-h)); overflow: auto; overscroll-behavior: contain;
  display: grid; gap: .875rem; padding: 1rem 1rem 1.125rem;
  background: var(--panel); box-shadow: 0 0 0 3px var(--line-2), 0 24px 60px #000;
  animation: jb-in 220ms var(--ease) both;
}
.jukebox[hidden] { display: none; }
@keyframes jb-in { from { opacity: 0; transform: translateY(-8px); } }
.jukebox__head { display: flex; align-items: center; justify-content: space-between; }
.jukebox__close { display: grid; place-items: center; width: 40px; height: 40px; margin: -.5rem -.5rem -.5rem 0; padding: 0; background: none; border: 0; color: var(--muted); }
.jukebox__close:hover { color: var(--text); }
.jukebox__close svg { width: 14px; height: 14px; fill: currentColor; }
.jukebox__now { display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: .875rem; }
.jukebox__eq { display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 56px; padding: 8px; background: #07071a; box-shadow: inset 0 0 0 3px var(--line); }
.jukebox__eq i { width: 5px; height: 6px; background: var(--green); }
.jukebox.is-playing .jukebox__eq i { animation: jb-eq 900ms steps(5) infinite alternate; }
.jukebox__eq i:nth-child(2) { animation-delay: -300ms !important; animation-duration: 700ms !important; background: var(--cyan); }
.jukebox__eq i:nth-child(3) { animation-delay: -600ms !important; background: var(--yellow); }
.jukebox__eq i:nth-child(4) { animation-delay: -150ms !important; animation-duration: 1100ms !important; background: var(--pink); }
.jukebox__eq i:nth-child(5) { animation-delay: -450ms !important; animation-duration: 800ms !important; background: var(--purple); }
@keyframes jb-eq { to { height: 36px; } }
.jukebox__meta { min-width: 0; }
.jukebox__title { margin: 0; font: .75rem/1.5 var(--font-pixel); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jukebox__artist { margin: .125rem 0 0; color: var(--muted); font-size: 1.125rem; }
.jukebox__seek { display: grid; grid-template-columns: 3ch 1fr 3ch; align-items: center; gap: .5rem; font-size: 1rem; color: var(--muted); }
.jukebox__seek span:last-child { text-align: right; }
.jukebox input[type="range"] {
  --fill: 0%; -webkit-appearance: none; appearance: none; width: 100%; height: 24px; margin: 0; background: none; cursor: pointer;
}
.jukebox input[type="range"]::-webkit-slider-runnable-track { height: 8px; background: linear-gradient(90deg, var(--cyan) var(--fill), #07071a var(--fill)); box-shadow: inset 0 0 0 2px var(--line); }
.jukebox input[type="range"]::-moz-range-track { height: 8px; background: linear-gradient(90deg, var(--cyan) var(--fill), #07071a var(--fill)); box-shadow: inset 0 0 0 2px var(--line); }
.jukebox input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 18px; margin-top: -5px; background: var(--text); border: 0; border-radius: 0; box-shadow: inset 0 -3px 0 #8a8ab8; }
.jukebox input[type="range"]::-moz-range-thumb { width: 14px; height: 18px; background: var(--text); border: 0; border-radius: 0; box-shadow: inset 0 -3px 0 #8a8ab8; }
.jukebox input[type="range"]:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.jukebox__controls { display: flex; align-items: center; justify-content: center; gap: .5rem; }
.jb-btn { position: relative; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; background: none; border: 3px solid transparent; color: var(--muted); }
.jb-btn svg { width: 18px; height: 18px; fill: currentColor; }
.jb-btn:hover { color: var(--text); }
.jb-btn--toggle[aria-pressed="true"] { color: var(--green); }
.jb-btn--play { width: 56px; height: 56px; background: var(--yellow); color: var(--ink); box-shadow: inset 0 -4px 0 #b39500; }
.jb-btn--play:hover { color: var(--ink); filter: brightness(1.08); }
.jb-btn--play:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 #b39500; }
.jb-btn--play svg { width: 22px; height: 22px; }
.jb-btn__tag { position: absolute; right: 4px; bottom: 3px; font: .4375rem/1 var(--font-pixel); color: var(--green); }
.jukebox__vol { display: grid; grid-template-columns: 18px 1fr; align-items: center; gap: .625rem; color: var(--muted); }
.jukebox__vol svg { width: 18px; height: 18px; fill: currentColor; }
.jukebox__list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; border-top: 3px solid var(--line); padding-top: .625rem; }
.jb-track { display: grid; grid-template-columns: 2ch 1fr auto; align-items: center; gap: .625rem; width: 100%; min-height: 44px; padding: .375rem .5rem; background: none; border: 0; color: var(--text); font: inherit; font-size: 1.125rem; text-align: left; }
.jb-track:hover { background: var(--panel-2); }
.jb-track__num { color: var(--muted); font-size: 1rem; text-align: right; }
.jb-track__info { display: grid; min-width: 0; line-height: 1.15; }
.jb-track__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jb-track__artist { color: var(--muted); font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jb-track__len { color: var(--muted); font-size: 1rem; }
.jb-track.is-current { background: #07071a; box-shadow: inset 4px 0 0 var(--green); }
.jb-track.is-current .jb-track__title { color: var(--green); }
.jb-track.is-current .jb-track__num { color: var(--green); }
.jukebox__credit { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.25; }
@media (max-width: 767px) {
  .jukebox { top: auto; left: .5rem; right: .5rem; bottom: calc(var(--tabbar-h) + .5rem); width: auto; max-height: calc(100dvh - 56px - var(--tabbar-h) - 1rem); animation-name: jb-up; }
  @keyframes jb-up { from { opacity: 0; transform: translateY(12px); } }
}
@media (prefers-reduced-motion: reduce) {
  .jukebox, .jukebox.is-playing .jukebox__eq i { animation: none; }
  .jukebox.is-playing .jukebox__eq i { height: 22px; }
}

/* ---------- Multiplayer example pictures ---------- */
.mp-shot { position: relative; display: block; aspect-ratio: 4 / 3; margin: -.25rem -.25rem .25rem; background: #000; overflow: hidden; box-shadow: inset 0 0 0 3px #000; }
.mp-shot canvas { display: block; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; transition: transform 400ms ease-out; }
.mp-shot--fit canvas { object-fit: contain; }
.mp-shot::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(to bottom, rgba(0,0,0,.22) 0 1px, transparent 1px 3px); pointer-events: none; }
.mp-card:hover .mp-shot canvas { transform: scale(1.04); }
.lobby__how .mp-shot { margin: 0; max-width: 22rem; }
@media (prefers-reduced-motion: reduce) { .mp-card:hover .mp-shot canvas { transform: none; } }
/* multiplayer boards: drags (aiming, swiping) shouldn't scroll the page */
[data-mp-canvas] { touch-action: none; }
/* 40 games: two compact cards per row on phones */
@media (max-width: 599px) {
  .mp-grid { grid-template-columns: 1fr 1fr; gap: .625rem; }
  .mp-card { padding: .625rem; gap: .375rem; }
  .mp-card .mp-shot { margin: 0 0 .125rem; }
  .mp-card__top { flex-direction: column; gap: .125rem; }
  .mp-card__title { font-size: .625rem; }
  .mp-card__tag { font-size: 1rem; min-height: 0; }
  .mp-card .btn { padding-inline: .25rem; font-size: .5625rem; }
}
.mp-card { grid-template-rows: auto auto auto 1fr auto; align-content: stretch; }
.mp-card__tag { align-self: start; }

/* Privacy page */
.prose .panel { max-width: 46rem; }
.prose .panel p { margin: 0; line-height: 1.35; }
.prose .panel__title { margin-top: .5rem; }
.prose a { color: var(--cyan); }
.footer a { color: var(--cyan); }
.footer__link { padding: 0; border: 0; background: none; color: var(--cyan); font: inherit; text-decoration: underline; cursor: pointer; }

/* ---------- Feature cards on the home page ---------- */
.feature { margin-top: 1.5rem; }
.feature__card { display: grid; grid-template-columns: 4.5rem 1fr auto; align-items: center; gap: 1rem; padding: 1rem 1.25rem; background: linear-gradient(120deg, #140b3d, #3a1260 60%, #8a0f4a); color: var(--text); text-decoration: none; box-shadow: inset 0 0 0 3px var(--yellow), 0 0 30px -10px var(--yellow); }
.feature__card:hover, .feature__card:focus-visible { color: var(--text); transform: translateY(-2px); }
.feature__avatar .avatar { width: 100%; height: auto; display: block; }
.feature__copy { display: grid; gap: .25rem; }
.feature__kicker { font: .5rem/1.4 var(--font-pixel); text-transform: uppercase; color: var(--yellow); }
.feature__title { font: 1rem/1.3 var(--font-pixel); text-transform: uppercase; }
.feature__text { color: var(--muted); font-size: 1.125rem; line-height: 1.2; }
@media (max-width: 599px) { .feature__card { grid-template-columns: 3.5rem 1fr; } .feature__card .btn { grid-column: 1 / -1; } }


/* Top menu: seven links plus tokens, friends, jukebox and avatar have to share one row */
.topnav { margin-left: .5rem; gap: 0; }
.topnav a { padding: 0 .625rem; font-size: .625rem; white-space: nowrap; }
.topbar__row { gap: .75rem; }
/* the row is at most 1200px wide on any screen, so these always apply */
.topnav a[data-route="friends"] { display: none; }            /* the friends icon is right there */
[data-music] .icon-btn__label { display: none; }
.topnav a { padding: 0 .5rem; font-size: .5625rem; }
.topnav a[aria-current="page"]::before { margin-right: .25rem; }
@media (max-width: 1179px) {
  .topnav a[data-route="inventory"] { display: none; }        /* also on the Account page and the town Boutique */
  .me__name { display: none; }
}
@media (max-width: 999px) {
  .brand__word, .topnav a[data-route="account"] { display: none; } /* the avatar button opens Account */
  .topnav a { padding: 0 .375rem; }
}

/* ---------- Pixel Town ---------- */
.town-layout { display: grid; gap: 1.5rem; align-items: start; }
@media (min-width: 1000px) { .town-layout { grid-template-columns: minmax(0, 1fr) 19rem; } }
.town-main { display: grid; gap: .75rem; min-width: 0; }
.town-screen { position: relative; background: #0b0b1e; box-shadow: inset 0 0 0 3px var(--line), 0 0 40px -16px var(--cyan); padding: 3px; }
.town-canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: none; cursor: pointer; outline: none; }
.town-canvas:focus-visible { box-shadow: 0 0 0 3px var(--yellow); }
.town-status { position: absolute; left: 3px; right: 3px; bottom: 3px; margin: 0; padding: .5rem .75rem; background: rgba(11, 11, 30, .85); font: .625rem/1.4 var(--font-pixel); text-transform: uppercase; color: var(--yellow); text-align: center; }
.town-status[hidden] { display: none; }
.town-action { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.town-action[hidden] { display: none; }
.town-emotes { display: flex; flex-wrap: wrap; gap: .375rem; }
.town-emote { min-height: 40px; padding: 0 .625rem; font-size: .5625rem; }
.town-side { display: grid; gap: .75rem; align-content: start; }
.town-side p { margin: 0; color: var(--muted); font-size: 1.125rem; line-height: 1.25; }
.town-people { max-height: 21rem; overflow: auto; margin: 0; padding: 0; list-style: none; }
.town-people .muted { font-size: 1.125rem; }
button.town-person { width: 100%; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; grid-template-columns: 40px 1fr; }
button.town-person:hover, button.town-person:focus-visible { box-shadow: inset 0 0 0 2px var(--cyan); }
li.town-person { grid-template-columns: 40px 1fr; }
.town-person.is-me { box-shadow: inset 0 0 0 2px var(--yellow); }
.town-card { text-align: center; }
.town-card__avatar { width: 6rem; margin: 0 auto .75rem; }
.town-card__avatar .avatar { width: 100%; height: auto; display: block; }
.town-card .modal__actions { justify-content: center; }
.town-notice { margin: 0 0 1rem; padding-left: 1.25rem; color: var(--muted); font-size: 1.125rem; line-height: 1.3; }
.town-guest { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.town-guest p { flex-basis: 100%; margin: 0; }

/* feature cards on the home page (one per row on phones, side by side when there's room) */
.feature { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 30rem), 1fr)); }
.feature__card--town { background: linear-gradient(120deg, #0b2a2a, #11523f 60%, #1f6b3a); box-shadow: inset 0 0 0 3px var(--cyan), 0 0 30px -10px var(--cyan); }
.feature__card--town .feature__kicker { color: var(--cyan); }

/* ---------- Ad banner (Google AdSense) ---------- */
.ad-wrap { margin-block: 1.5rem; }
.ad-wrap__label { display: none; margin: 0 0 .375rem; font: .5rem/1 var(--font-pixel); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ad-wrap:has(ins[data-ad-status="filled"]) .ad-wrap__label { display: block; }
/* no ad to show (e.g. none available, or an ad blocker): take up no space */
.ad-wrap:has(ins[data-ad-status="unfilled"]) { display: none; }
ins.adsbygoogle[data-ad-status="unfilled"] { display: none !important; }
.feature__card--scores { background: linear-gradient(120deg, #2a1d05, #5a3a0a 55%, #8a5a0f); }
.feature__icon { display: grid; place-items: center; }
.feature__icon .trophy { width: 100%; height: auto; image-rendering: pixelated; filter: drop-shadow(0 0 12px rgba(255, 210, 63, .5)); }

/* ---------- Hi-Scores (leaderboards) ---------- */
.scores__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1.25rem; }
.scores__bar .chips { margin: 0; }
.scores__reset { margin: 0; font-size: 1.125rem; }
.scores__top { display: grid; gap: 1.25rem; margin-bottom: 2rem; align-items: start; }
@media (min-width: 900px) { .scores__top { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }
.scores__extra { display: grid; gap: 1.25rem; }
.scores__note, .scores__extra p { margin: .25rem 0 .75rem; color: var(--muted); font-size: 1.0625rem; line-height: 1.25; }
.scores__me { margin: .75rem 0 0; font-size: 1.125rem; }
.scores__me:empty { display: none; }
.board { display: grid; gap: .25rem; margin: 0; padding: 0; list-style: none; }
.board > .muted { padding: .5rem 0; font-size: 1.125rem; }
.board__row { display: grid; grid-template-columns: 2rem 2rem minmax(0, 1fr) auto; align-items: center; gap: .625rem; padding: .375rem .625rem; background: #07071a; box-shadow: inset 0 0 0 2px var(--line); }
.board__row.is-me { box-shadow: inset 0 0 0 2px var(--yellow); }
.board__rank { font: .625rem/1 var(--font-pixel); color: var(--muted); text-align: center; }
.board__row.is-gold .board__rank { color: #ffd23f; }
.board__row.is-silver .board__rank { color: #c0c8d8; }
.board__row.is-bronze .board__rank { color: #e0965a; }
.board__row.is-gold { background: linear-gradient(90deg, rgba(255, 210, 63, .14), #07071a 60%); }
.board__avatar { width: 2rem; height: 2rem; }
.board__avatar .avatar { width: 100%; height: 100%; display: block; }
.board__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.1875rem; }
.board__value { display: inline-flex; align-items: center; gap: .375rem; color: var(--yellow); font-size: 1.1875rem; white-space: nowrap; }
.board__value .coin { width: 14px; height: 14px; }
.board__stars { color: #ffd23f; font-size: 1rem; }
.board__when { color: var(--muted); font-size: 1rem; }
.board--big .board__row { padding: .5rem .75rem; }
.board--mini .board__row { grid-template-columns: 1.25rem 1.5rem minmax(0, 1fr) auto; gap: .5rem; padding: .25rem .5rem; }
.board--mini .board__avatar { width: 1.5rem; height: 1.5rem; }
.board--mini .board__name, .board--mini .board__value { font-size: 1.0625rem; }
.play__scores { display: grid; gap: .5rem; }
.play__scores:empty { display: none; }
.play__scores .scores__me { margin: 0; }
.overlay__rank { margin: 0; font: .625rem/1.4 var(--font-pixel); text-transform: uppercase; }
.overlay__rank a { color: var(--yellow); }
.score-games { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: .75rem; margin: 0; padding: 0; list-style: none; }
.score-game { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); align-items: center; gap: .75rem; height: 100%; padding: .625rem; background: #07071a; color: var(--text); text-decoration: none; box-shadow: inset 0 0 0 2px var(--line); }
.score-game:hover, .score-game:focus-visible { color: var(--text); box-shadow: inset 0 0 0 2px var(--c); transform: translateY(-2px); }
.score-game.is-mine { box-shadow: inset 0 0 0 2px var(--yellow); }
.score-game__thumb { display: block; aspect-ratio: 1; background: #000; box-shadow: 0 0 0 2px var(--c); overflow: hidden; }
.score-game__thumb canvas { display: block; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.score-game__thumb--big { width: 6rem; flex: none; }
.score-game__body { display: grid; gap: .125rem; min-width: 0; }
.score-game__title { font: .625rem/1.5 var(--font-pixel); text-transform: uppercase; color: var(--c); }
.score-game__top, .score-game__me { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.0625rem; line-height: 1.25; }
.score-game__top b { color: var(--yellow); font-weight: normal; }
.score-game__me { color: var(--cyan); }
.score-game__crown { font: .5rem/1 var(--font-pixel); color: #ffd23f; }
.scores__head { display: flex; align-items: center; gap: 1.25rem; }
/* Pixel Town: minimap and the "reel in!" button */
.town-map { display: block; width: 100%; height: auto; image-rendering: pixelated; cursor: pointer; box-shadow: 0 0 0 2px var(--line); }
.town-map__legend { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; margin: 0; font-size: 1rem; color: var(--muted); }
.town-map__legend i { display: inline-block; width: 8px; height: 8px; margin-right: .25rem; background: #fff; }
.town-map__legend i.is-me { background: var(--yellow); }
.town-map__legend i.is-friend { background: var(--cyan); }
.town-action .btn.is-urgent { animation: town-urgent .25s steps(2, jump-none) infinite; }
@keyframes town-urgent { 50% { background: var(--pink); color: #fff; } }
@media (prefers-reduced-motion: reduce) { .town-action .btn.is-urgent { animation: none; background: var(--pink); color: #fff; } }

/* ---------- Shop tabs, the House shop and your house ---------- */
.shop-tabs { display: flex; gap: .5rem; margin-bottom: 1.25rem; border-bottom: 3px solid var(--line); }
.shop-tabs a { --c: var(--pink); padding: .75rem 1.125rem; font: .6875rem/1 var(--font-pixel); text-transform: uppercase; color: var(--c); text-decoration: none; border: 3px solid color-mix(in srgb, var(--c) 45%, transparent); border-bottom: 0; margin-bottom: -3px; background: color-mix(in srgb, var(--c) 10%, transparent); }
.shop-tabs a:nth-child(2) { --c: var(--cyan); }
.shop-tabs a:nth-child(3) { --c: var(--green); }
.shop-tabs a:hover { color: var(--text); }
.shop-tabs a[aria-current="page"] { color: var(--ink); background: var(--c); border-color: var(--c); border-bottom: 3px solid var(--c); }
.house-preview__canvas, .house__canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; background: #0b0b1e; }
.house-preview { align-self: start; }
@media (min-width: 900px) { .shop:has(.house-preview) { grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); } }
.furni__stage { display: grid; place-items: center; }
.furni__stage canvas { width: 72px; height: 72px; image-rendering: pixelated; }
.house__screen { max-width: 52rem; margin: 0 auto; padding: 3px; background: #0b0b1e; box-shadow: inset 0 0 0 3px var(--line), 0 0 40px -16px var(--purple, #8a5cff); }
.house__canvas { touch-action: none; cursor: pointer; }
.house__tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; max-width: 52rem; margin: .75rem auto 0; }
.house__hint { flex: 1 1 16rem; color: var(--muted); font-size: 1.125rem; }
.house__buttons { display: flex; flex-wrap: wrap; gap: .375rem; }
body.has-house-inv { padding-bottom: 9.5rem; }
.house-inv { position: fixed; left: 0; right: 0; bottom: var(--tabbar-h, 0px); z-index: 60; padding: .5rem max(1rem, env(safe-area-inset-left)) .625rem; background: rgba(14, 14, 40, .97); border-top: 3px solid var(--yellow); box-shadow: 0 -10px 30px rgba(0, 0, 0, .5); }
.house-inv__head { display: flex; align-items: center; gap: .75rem; margin-bottom: .375rem; font: .625rem/1 var(--font-pixel); text-transform: uppercase; color: var(--yellow); }
.house-inv__head .muted { font: 1rem/1 var(--font-body, inherit); text-transform: none; }
.house-inv__toggle { margin-left: auto; min-height: 32px; padding: 0 .75rem; background: none; border: 2px solid var(--line-2); color: var(--muted); font: .5rem/1 var(--font-pixel); text-transform: uppercase; }
.house-inv.is-closed .house-inv__list, .house-inv.is-closed .house-inv__empty { display: none; }
.house-inv__list { display: flex; gap: .5rem; margin: 0; padding: 0 0 .25rem; list-style: none; overflow-x: auto; scrollbar-width: thin; }
.house-inv__item { display: grid; justify-items: center; gap: .125rem; width: 5.5rem; padding: .375rem .25rem; background: #07071a; border: 0; box-shadow: inset 0 0 0 2px var(--line); color: var(--text); cursor: pointer; }
.house-inv__item:hover:not(:disabled), .house-inv__item:focus-visible { box-shadow: inset 0 0 0 2px var(--cyan); }
.house-inv__item.is-active { box-shadow: inset 0 0 0 2px var(--yellow); background: #1a1a3a; }
.house-inv__item:disabled { opacity: .4; cursor: default; }
.house-inv__item canvas { width: 40px; height: 40px; image-rendering: pixelated; }
.house-inv__name { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9375rem; line-height: 1.1; }
.house-inv__n { font: .5rem/1 var(--font-pixel); color: var(--yellow); }
.house-inv__empty { margin: 0; font-size: 1.125rem; }
.house__screen { max-width: 60rem; }
.house__tools, .house__social { max-width: 60rem; margin-left: auto; margin-right: auto; }
.house__social { display: grid; gap: .625rem; margin-top: .75rem; }
.house__here, .house__visit { margin: 0; font-size: 1.125rem; }
.house__here:empty { display: none; }
.house__visit { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; }
.house__pets { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; max-width: 60rem; margin: .75rem auto 0; font-size: 1.125rem; }
@media (max-width: 899px) { .fitting.house-preview { display: grid; grid-template-columns: 1fr; justify-items: stretch; text-align: left; } .fitting.house-preview .panel__title { grid-column: auto; } }
/* naming pets and houses */
.name-error { min-height: 1.4em; margin: .25rem 0 0; color: var(--red, #ff3b5c); font-size: 1.0625rem; }
.pet-chips { display: flex; flex-wrap: wrap; gap: .5rem; width: 100%; margin: .25rem 0 0; padding: 0; list-style: none; }
.pet-chip { display: flex; align-items: center; gap: .375rem; padding: .25rem .375rem .25rem .25rem; background: #07071a; box-shadow: inset 0 0 0 2px var(--line); }
.pet-chip.is-walking { box-shadow: inset 0 0 0 2px var(--green, #3cff7a); }
.pet-chip canvas { width: 28px; height: 28px; image-rendering: pixelated; }
.pet-chip__name { font-size: 1.0625rem; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* trading */
.trade-list { display: grid; gap: .75rem; margin: 0 0 1.5rem; padding: 0; list-style: none; }
.trade-card { display: grid; gap: .625rem; }
.trade-card__who { margin: 0; font-size: 1.125rem; }
.trade-card__sides { display: grid; grid-template-columns: 1fr auto 1fr; gap: .75rem; align-items: start; }
@media (max-width: 599px) { .trade-card__sides { grid-template-columns: 1fr; } .trade-card__arrow { justify-self: center; } }
.trade-card__h { margin: 0 0 .375rem; font: .5625rem/1.4 var(--font-pixel); text-transform: uppercase; color: var(--cyan); }
.trade-card__arrow { align-self: center; font-size: 1.5rem; color: var(--yellow); }
.trade-card__actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.trade-side { display: grid; gap: .25rem; margin: 0; padding: 0; list-style: none; }
.trade-side li { display: flex; align-items: center; gap: .5rem; font-size: 1.0625rem; }
.trade-pic { display: grid; place-items: center; width: 40px; height: 40px; flex: none; background: #07071a; box-shadow: inset 0 0 0 2px var(--line); overflow: hidden; }
.trade-pic svg, .trade-pic canvas { width: 36px; height: 36px; image-rendering: pixelated; }
.trade-pic--coin .coin { width: 22px; height: 22px; }
.trade-status--done { color: var(--green, #3cff7a); }
.trade-status--failed, .trade-status--declined { color: var(--pink); }
.trade-friends { display: flex; flex-wrap: wrap; gap: .375rem; }
.trade-builder__cols { display: grid; gap: 1rem; }
@media (min-width: 900px) { .trade-builder__cols { grid-template-columns: 1fr 1fr; } }
.trade-tokens { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .5rem 0 .75rem; font-size: 1.125rem; }
.trade-tokens input { width: 7rem; padding: .375rem .5rem; background: #07071a; border: 2px solid var(--line-2); color: var(--text); font: inherit; }
.trade-pool { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .375rem; margin: 0; padding: 0; list-style: none; max-height: 26rem; overflow: auto; }
.trade-pool li { display: flex; }
.trade-pick { flex: 1; display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; align-items: center; column-gap: .375rem; padding: .25rem; background: #07071a; border: 0; box-shadow: inset 0 0 0 2px var(--line); color: var(--text); text-align: left; cursor: pointer; }
.trade-pick .trade-pic { grid-row: span 2; box-shadow: none; }
.trade-pick:hover:not(:disabled) { box-shadow: inset 0 0 0 2px var(--cyan); }
.trade-pick.is-on { box-shadow: inset 0 0 0 2px var(--yellow); background: #1a1a3a; }
.trade-pick:disabled { opacity: .45; cursor: default; }
.trade-pick__name { font-size: .9375rem; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trade-pick__n { font: .5rem/1 var(--font-pixel); color: var(--yellow); }
.trade-pick__less { width: 28px; background: var(--panel-2); border: 0; box-shadow: inset 0 0 0 2px var(--line); color: var(--text); font-size: 1.25rem; cursor: pointer; }
.trade-builder__send { margin-top: 1rem; }

/* ---------- Game pages for search engines (games/<name>/) ---------- */
.game-page .play__num a { color: inherit; }
.game-page__hero { display: grid; gap: 1.25rem; align-items: start; margin: 1rem 0 2rem; }
@media (min-width: 900px) { .game-page__hero { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
.game-page__shot { display: block; box-shadow: 0 0 0 3px var(--c, var(--line)), 0 0 40px -12px var(--c, var(--cyan)); }
.game-page__shot img, 
.game-page__info { display: grid; gap: .5rem; }
.game-page__info p { margin: 0; color: var(--muted); font-size: 1.125rem; }
.game-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); gap: .75rem; margin: 0 0 1.5rem; padding: 0; list-style: none; }
.game-links a { display: grid; gap: .375rem; padding: .375rem; background: #07071a; box-shadow: inset 0 0 0 2px var(--line); color: var(--text); text-decoration: none; }
.game-links a:hover, .game-links a:focus-visible { box-shadow: inset 0 0 0 2px var(--c, var(--cyan)); color: var(--text); }
.game-links span { font: .625rem/1.4 var(--font-pixel); text-transform: uppercase; color: var(--c, var(--text)); padding: 0 .25rem .25rem; }
.game-links a { grid-template-columns: 4.5rem 1fr; align-items: center; }
.game-links img { display: block; width: 4.5rem; height: 4.5rem; image-rendering: pixelated; box-shadow: 0 0 0 2px var(--c, var(--line)); }
.game-page__shot img { display: block; width: 100%; height: auto; image-rendering: pixelated; }

/* ---------- Sharing and invites ---------- */
.overlay__share { margin-top: .25rem; }
.invite__by { color: var(--yellow); }
.invite__row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .75rem 0; }
.invite__link { flex: 1 1 14rem; min-width: 0; font: inherit; font-size: 1.1rem; padding: .4rem .6rem; color: inherit; background: rgba(0, 0, 0, .35); border: 2px solid rgba(255, 255, 255, .2); border-radius: 0; }
.mp-invite { margin-bottom: 1.25rem; }

/* ---------- Written guides: game pages, multiplayer pages, guides, the front page text ---------- */
.guide { display: grid; gap: 1.25rem; margin: 1.5rem 0 2rem; }
@media (min-width: 900px) { .guide { grid-template-columns: repeat(2, 1fr); } .guide > .panel:first-child { grid-column: 1 / -1; } }
.guide .panel + .panel { margin-top: 0; }
.guide p { max-width: 70ch; }
.guide-tips { margin: 0; padding-left: 1.25rem; display: grid; gap: .5rem; }
.guide-tips li::marker { color: var(--yellow); }
.text-links { list-style: none; margin: .75rem 0 1.25rem; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.text-links a { --c: var(--cyan); display: inline-block; padding: .35rem .6rem; color: var(--text); text-decoration: none; border: 2px solid color-mix(in srgb, var(--c) 60%, transparent); background: color-mix(in srgb, var(--c) 10%, transparent); }
.text-links a:hover, .text-links a:focus-visible { border-color: var(--c); color: var(--c); }
.home-intro { margin-top: 3rem; padding-bottom: 2rem; }
.home-intro > p { max-width: 75ch; }
.home-intro__grid { display: grid; gap: 1.25rem; margin: 1.25rem 0; }
@media (min-width: 800px) { .home-intro__grid { grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); } }
.home-intro__grid .panel + .panel { margin-top: 0; }
