:root {
  --cobalt: #2b31f0; --navy: #0a0b3d; --peach: #ffb48f; --mint: #9bf0cc; --gold: #ffd166; --pink: #ff5c8a;
  --ink: #f4f4ff; --mute: #a4a6d6; --glass: rgba(12, 14, 60, .72); --edge: rgba(255, 255, 255, .16);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: #05061f; color: var(--ink); font-family: 'Onest', system-ui, sans-serif; overflow: hidden; }
body { display: grid; place-items: center; }
#app { width: 100vw; height: 100vh; height: 100dvh; display: grid; place-items: center; background:
  radial-gradient(80% 60% at 20% 0%, #1a1f8f55, transparent), radial-gradient(70% 60% at 100% 100%, #5b1a8f44, transparent), #05061f; }
#stage { position: relative; width: min(100vw, calc(100vh * 1.6), calc(100dvh * 1.6)); aspect-ratio: 16 / 10; border-radius: 22px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 0 1px var(--edge); user-select: none; -webkit-user-select: none; touch-action: none; }
@media (max-width: 700px), (max-aspect-ratio: 4/3) { #stage { border-radius: 0; } }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: none; }
#stage { font-size: calc(min(100vw, 100vh * 1.6, 100dvh * 1.6) / 960 * 16); }

.screen { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 1em;
  background: radial-gradient(70% 70% at 50% 40%, rgba(5, 6, 31, .35), rgba(5, 6, 31, .82)); backdrop-filter: blur(3px); text-align: center; padding: 1.2em; z-index: 5; }
.screen.on { display: flex; animation: pop .45s cubic-bezier(.22, 1, .36, 1); }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }

.logo { display: flex; align-items: center; gap: .7em; }
.logo .mk { width: 3.2em; height: 3.2em; border-radius: 1em; display: grid; place-items: center; font-size: 1.1em; color: #fff;
  background: linear-gradient(135deg, #4b51ff, #b06bff); box-shadow: 0 0 2.4em rgba(120, 100, 255, .8); animation: glow 3s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 3.6em rgba(176, 107, 255, 1); } }
.logo b { font-family: 'Unbounded', sans-serif; font-size: 3.2em; letter-spacing: -.03em; line-height: .95; display: block;
  background: linear-gradient(180deg, #fff, #b9bcff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo small { display: block; font-family: 'Unbounded'; font-size: 1.5em; letter-spacing: .5em; color: var(--peach); text-align: left; margin-top: .1em; }
.tag { color: var(--mute); max-width: 26em; font-size: 1.05em; }
.menu-btns { display: flex; flex-direction: column; gap: .7em; width: min(20em, 80%); }
.row { display: flex; gap: .6em; justify-content: center; flex-wrap: wrap; }
.row.small { gap: .5em; }
button { font: inherit; color: inherit; border: none; cursor: pointer; transition: transform .15s, filter .15s; }
button:active { transform: scale(.96); }
button.big { padding: .85em 1.8em; border-radius: 1.2em; font-weight: 700; font-size: 1.25em; color: #fff;
  background: linear-gradient(135deg, #4b51ff, #8a5bff); box-shadow: 0 .5em 1.6em rgba(75, 81, 255, .55), inset 0 1px 0 rgba(255, 255, 255, .3); }
button.big:hover { filter: brightness(1.12); transform: translateY(-2px); }
button.sec { padding: .65em 1.2em; border-radius: 1em; font-weight: 600; background: rgba(255, 255, 255, .1); border: 1px solid var(--edge); flex: 1; }
button.sec:hover { background: rgba(255, 255, 255, .18); }
button.ghost { padding: .5em .9em; border-radius: .9em; background: rgba(255, 255, 255, .06); border: 1px solid var(--edge); color: var(--mute); font-size: .85em; }
.stats-line { color: var(--mute); font-size: .85em; min-height: 1.4em; }
.back { position: absolute; bottom: .8em; color: var(--mute); font-size: .8em; text-decoration: none; letter-spacing: .1em; }

.panel { background: var(--glass); border: 1px solid var(--edge); border-radius: 1.6em; padding: 1.4em 1.6em; width: min(26em, 94%); max-height: 94%; overflow: auto;
  box-shadow: 0 2em 4em rgba(0, 0, 0, .5); display: flex; flex-direction: column; gap: .9em; }
.panel.wide { width: min(40em, 96%); }
.panel h2 { font-family: 'Unbounded', sans-serif; font-size: 1.5em; font-weight: 600; }
.panel .head { display: flex; align-items: center; gap: .8em; }
.panel .head h2 { flex: 1; text-align: left; }
.panel .x { width: 2.2em; height: 2.2em; border-radius: 50%; background: rgba(255, 255, 255, .1); }
.wallet { padding: .35em .8em; border-radius: 2em; background: rgba(255, 209, 102, .16); color: var(--gold); font-weight: 700; }
.dim { color: var(--mute); font-size: .9em; }
.score { font-family: 'Unbounded', sans-serif; font-size: 3.4em; font-weight: 700; line-height: 1; background: linear-gradient(180deg, #fff, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.score small { display: block; font-size: .28em; color: var(--mute); -webkit-text-fill-color: var(--mute); letter-spacing: .15em; text-transform: uppercase; margin-top: .4em; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6em; }
.grid3 div { background: rgba(255, 255, 255, .07); border-radius: 1em; padding: .6em .3em; }
.grid3 b { font-family: 'Unbounded'; font-size: 1.4em; display: block; }
.grid3 small { color: var(--mute); font-size: .72em; }
.badge-new { align-self: center; padding: .3em 1em; border-radius: 2em; font-weight: 800; letter-spacing: .12em; font-size: .8em; color: #3a2300;
  background: linear-gradient(135deg, #ffd166, #ff9f43); animation: bounce 1s infinite; }
@keyframes bounce { 50% { transform: translateY(-4px) scale(1.05); } }
.ranks { color: var(--mute); font-size: .9em; min-height: 1.3em; }
.ranks b { color: var(--mint); }

.tabs { display: flex; gap: .4em; justify-content: center; }
.tab { padding: .45em 1.1em; border-radius: 2em; background: transparent; border: 1px solid var(--edge); color: var(--mute); font-weight: 600; }
.tab.on { background: linear-gradient(135deg, #4b51ff, #8a5bff); color: #fff; border-color: transparent; }
.list { display: flex; flex-direction: column; gap: .5em; overflow: auto; max-height: 20em; padding-right: .2em; text-align: left; }
.item { display: flex; align-items: center; gap: .8em; padding: .7em .9em; border-radius: 1.1em; background: rgba(255, 255, 255, .06); border: 1px solid transparent; }
.item .ic { font-size: 1.7em; width: 1.6em; text-align: center; }
.item .tx { flex: 1; min-width: 0; }
.item .tx b { display: block; }
.item .tx small { color: var(--mute); }
.pips { display: flex; gap: .2em; margin-top: .3em; }
.pips i { width: .9em; height: .35em; border-radius: .3em; background: rgba(255, 255, 255, .15); }
.pips i.on { background: var(--mint); box-shadow: 0 0 .6em rgba(155, 240, 204, .7); }
.buy { padding: .5em 1em; border-radius: .9em; font-weight: 700; background: linear-gradient(135deg, #ffd166, #ff9f43); color: #3a2300; white-space: nowrap; }
.buy[disabled] { background: rgba(255, 255, 255, .1); color: var(--mute); cursor: not-allowed; }
.buy.use { background: rgba(155, 240, 204, .2); color: var(--mint); }
.item.me { border-color: var(--peach); background: rgba(255, 180, 143, .12); }
.item .rk { width: 2em; text-align: center; font-family: 'Unbounded'; font-weight: 700; }
.item .sc { font-family: 'Unbounded'; font-weight: 600; color: var(--gold); }
.foot { color: var(--mute); font-size: .9em; text-align: center; }
input { font: inherit; padding: .8em 1em; border-radius: 1em; border: 1.5px solid var(--edge); background: rgba(255, 255, 255, .08); color: var(--ink); text-align: center; font-size: 1.2em; outline: none; }
input:focus { border-color: var(--peach); }
.err { color: var(--pink); min-height: 1.2em; font-size: .9em; }
#b-pause { position: absolute; top: .8em; right: .8em; width: 2.6em; height: 2.6em; border-radius: 50%; background: rgba(0, 0, 0, .35); border: 1px solid var(--edge); z-index: 4; }
#toast { position: absolute; left: 50%; bottom: 8%; transform: translate(-50%, 2em); padding: .7em 1.2em; border-radius: 1em; background: rgba(5, 6, 31, .92);
  border: 1px solid var(--edge); opacity: 0; transition: all .35s; pointer-events: none; z-index: 9; max-width: 80%; text-align: center; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
