:root {
  --bg: #120c18; --fg: #fff4e0; --gold: #ffcf4a; --gold2: #ff9a1a; --red: #e63a2e; --ink: #1a0d06; --glass: rgba(18, 12, 30, .78);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 30%, #2a1a2e, #0a0610 75%); }
body { display: flex; align-items: center; justify-content: center; font-family: "Lilita One", Impact, "Arial Black", sans-serif; color: var(--fg); padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#wrap { position: relative; width: min(100vw, calc(100vh * 2)); aspect-ratio: 2/1; container-type: inline-size; touch-action: none; user-select: none; -webkit-user-select: none; overflow: hidden; box-shadow: 0 0 60px rgba(0, 0, 0, .6); }
#c { width: 100%; height: 100%; display: block; }
.hide { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; -webkit-tap-highlight-color: transparent; }

/* ---------- buttons ---------- */
.btn {
  position: relative; font-size: 2.3cqw; padding: .9cqw 3.2cqw; border-radius: 1.6cqw; letter-spacing: .1cqw;
  background: linear-gradient(#ffe27a, var(--gold) 45%, var(--gold2)); color: #3a1a04;
  box-shadow: 0 .55cqw 0 #a35a00, 0 .9cqw 1.6cqw rgba(0, 0, 0, .45), inset 0 .25cqw 0 rgba(255, 255, 255, .6);
  text-shadow: 0 .12cqw 0 rgba(255, 255, 255, .5); transition: transform .08s, filter .15s;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-.15cqw); }
.btn:active { transform: translateY(.45cqw); box-shadow: 0 .1cqw 0 #a35a00, 0 .3cqw .8cqw rgba(0, 0, 0, .4), inset 0 .25cqw 0 rgba(255, 255, 255, .6); }
.btn.alt { background: linear-gradient(#fffaf0, #e8dccb); color: #3a2a1a; box-shadow: 0 .55cqw 0 #8a7a66, 0 .9cqw 1.6cqw rgba(0, 0, 0, .45), inset 0 .25cqw 0 #fff; }
.btn.green { background: linear-gradient(#b6ff8a, #5fe05a 50%, #22a83a); color: #0a3a10; box-shadow: 0 .55cqw 0 #12702a, 0 .9cqw 1.6cqw rgba(0, 0, 0, .45), inset 0 .25cqw 0 rgba(255, 255, 255, .6); }
.btn.big { font-size: 3.6cqw; padding: 1.1cqw 5cqw; border-radius: 2.2cqw; }
.btn.small { font-size: 1.6cqw; padding: .6cqw 2cqw; }
.btn:disabled { filter: grayscale(.85) brightness(.75); cursor: default; transform: none; }
.btn.play { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 .55cqw 0 #a35a00, 0 0 0 0 rgba(255, 207, 74, .55), inset 0 .25cqw 0 rgba(255, 255, 255, .6); } 50% { box-shadow: 0 .55cqw 0 #a35a00, 0 0 0 1.4cqw rgba(255, 207, 74, 0), inset 0 .25cqw 0 rgba(255, 255, 255, .6); } }
.icon-btn { width: 4.2cqw; height: 4.2cqw; border-radius: 1.2cqw; background: var(--glass); border: .15cqw solid rgba(255, 255, 255, .18); display: grid; place-items: center; font-size: 2cqw; color: #fff; }
.icon-btn svg { width: 60%; height: 60%; fill: currentColor; }
.icon-btn.off { opacity: .45; position: relative; }
.icon-btn.off::after { content: ""; position: absolute; width: 70%; height: .3cqw; background: #ff5a4a; transform: rotate(-45deg); border-radius: 1cqw; }
#pauseBtn { position: absolute; top: 1.2cqw; right: 1.2cqw; z-index: 5; }
.row { display: flex; gap: 1.6cqw; justify-content: center; }
.dot { position: absolute; top: -1cqw; right: -1cqw; width: 2.4cqw; height: 2.4cqw; border-radius: 50%; background: var(--red); color: #fff; font-style: normal; font-size: 1.6cqw; display: grid; place-items: center; box-shadow: 0 0 0 .25cqw #fff; animation: bob 1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-.4cqw); } }

/* ---------- chips ---------- */
.chip { display: flex; align-items: center; gap: .7cqw; background: var(--glass); border: .15cqw solid rgba(255, 255, 255, .16); border-radius: 3cqw; padding: .45cqw 1.4cqw .45cqw .6cqw; font-size: 2cqw; }
i.coin { display: inline-block; width: 2.4cqw; height: 2.4cqw; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6b8, #ffcf3a 45%, #d68a00); box-shadow: inset 0 0 0 .22cqw #9a5a00; vertical-align: middle; flex: none; }
.chip.rank { flex-direction: column; align-items: flex-start; gap: 0; padding: .4cqw 1.4cqw; line-height: 1.05; }
.chip.rank b { font-weight: 400; font-size: 1.5cqw; color: #9adfff; }
.chip.rank span { font-size: 1.7cqw; }
.stars { display: flex; gap: .3cqw; margin-top: .2cqw; }
.stars i { width: 1.3cqw; height: 1.3cqw; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); background: rgba(255, 255, 255, .25); }
.stars i.on { background: var(--gold); }

/* ---------- screens ---------- */
.scr { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 1.6cqw; text-align: center; z-index: 4; }
.scr.on { display: flex; animation: fadein .25s ease-out; }
@keyframes fadein { from { opacity: 0; } }
#menu { background: radial-gradient(ellipse at 50% 45%, rgba(10, 5, 20, .15), rgba(10, 5, 20, .6)); justify-content: flex-start; padding-top: 1.4cqw; gap: 0; }
.topbar { display: flex; align-items: center; gap: 1cqw; width: 100%; padding: 0 1.4cqw; }
.sp { flex: 1; }
.logo { margin-top: 1cqw; line-height: .82; filter: drop-shadow(0 .6cqw 0 #3a1406) drop-shadow(0 1cqw 1.5cqw rgba(0, 0, 0, .6)); transform: rotate(-3deg); }
.logo .l1, .logo .l3 { font-size: 10cqw; display: flex; justify-content: center; }
.logo span { display: inline-block; background: linear-gradient(#fff3c0 10%, #ffcf4a 40%, #ff6a1a 80%); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-stroke: .35cqw #3a1406; padding: 0 .1cqw; animation: hop 2.4s ease-in-out infinite; }
.logo .l3 span { background: linear-gradient(#fff 10%, #9adfff 45%, #3a8ae0 85%); -webkit-background-clip: text; background-clip: text; }
.logo span:nth-child(2) { animation-delay: .1s; } .logo span:nth-child(3) { animation-delay: .2s; } .logo span:nth-child(4) { animation-delay: .3s; } .logo span:nth-child(5) { animation-delay: .4s; }
@keyframes hop { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-1cqw) rotate(-2deg); } }
.logo .l2 { font-size: 3.6cqw; color: #fff; -webkit-text-stroke: .2cqw #3a1406; margin: .4cqw 0; letter-spacing: .3cqw; }
.logo .tag { display: inline-block; margin-top: .8cqw; font-size: 2.2cqw; letter-spacing: .8cqw; padding: .3cqw 1.4cqw .3cqw 2.2cqw; background: linear-gradient(90deg, #e63a2e, #ff6a1a); color: #fff; border-radius: .6cqw; transform: rotate(2deg); -webkit-text-stroke: 0; box-shadow: 0 .3cqw 0 #6a1006; }
.menu-btns { display: flex; flex-direction: column; gap: 1.6cqw; align-items: center; margin-top: 2cqw; }
.menu-btns .row .btn { min-width: 17cqw; }
.best { position: absolute; bottom: 1.4cqw; left: 1.6cqw; text-align: left; font-family: Nunito, system-ui, sans-serif; font-weight: 900; font-size: 1.5cqw; opacity: .9; text-shadow: 0 .15cqw .3cqw #000; line-height: 1.5; }
.best b { color: var(--gold); font-family: "Lilita One", Impact, sans-serif; font-weight: 400; font-size: 1.8cqw; }
.ctrl { position: absolute; bottom: 1.4cqw; right: 1.6cqw; text-align: right; font-family: Nunito, system-ui, sans-serif; font-weight: 800; font-size: 1.35cqw; opacity: .85; line-height: 1.55; text-shadow: 0 .15cqw .3cqw #000; }
.ctrl kbd { font-family: inherit; background: rgba(255, 255, 255, .15); border: .1cqw solid rgba(255, 255, 255, .3); border-bottom-width: .3cqw; border-radius: .5cqw; padding: 0 .6cqw; }
.title { font-size: 6cqw; margin: 0; line-height: .9; font-weight: 400; color: var(--gold); -webkit-text-stroke: .3cqw var(--ink); filter: drop-shadow(0 .5cqw 0 #3a1406); }
.title.red { color: #ff5a4a; }
.sub { margin: 0; font-family: Nunito, system-ui, sans-serif; font-weight: 900; font-size: 2cqw; }

/* ---------- panels ---------- */
.panel-scr { background: rgba(8, 4, 14, .55); backdrop-filter: blur(.4cqw); }
.panel { width: 92%; height: 88%; background: linear-gradient(160deg, rgba(40, 26, 60, .95), rgba(18, 12, 30, .96)); border: .2cqw solid rgba(255, 255, 255, .14); border-radius: 2.2cqw; box-shadow: 0 2cqw 4cqw rgba(0, 0, 0, .6), inset 0 .2cqw 0 rgba(255, 255, 255, .1); display: flex; flex-direction: column; overflow: hidden; }
.panel.narrow { width: 64%; height: auto; max-height: 90%; padding-bottom: 1.4cqw; }
.ph { display: flex; align-items: center; gap: 1.4cqw; padding: 1.2cqw 1.6cqw; border-bottom: .15cqw solid rgba(255, 255, 255, .1); background: rgba(0, 0, 0, .2); }
.ph h2 { margin: 0; font-weight: 400; font-size: 3.2cqw; color: var(--gold); -webkit-text-stroke: .15cqw var(--ink); }
.tabs { display: flex; gap: .6cqw; background: rgba(0, 0, 0, .35); border-radius: 1.4cqw; padding: .4cqw; }
.tab { font-size: 1.8cqw; padding: .5cqw 1.8cqw; border-radius: 1cqw; background: none; color: #cbb8e0; }
.tab.on { background: linear-gradient(#ffe27a, #ff9a1a); color: #3a1a04; }
.pb { flex: 1; display: flex; gap: 1.4cqw; padding: 1.4cqw; min-height: 0; }
.preview { width: 24%; flex: none; background: radial-gradient(ellipse at 50% 60%, rgba(255, 207, 74, .25), rgba(0, 0, 0, .25) 70%); border-radius: 1.6cqw; border: .15cqw solid rgba(255, 255, 255, .1); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8cqw; padding: 1cqw; }
.preview canvas { width: 90%; aspect-ratio: 220/260; }
.pv-name { font-size: 2.6cqw; color: #fff; }
.pv-sub { font-family: Nunito, system-ui, sans-serif; font-weight: 900; font-size: 1.4cqw; color: #cbb8e0; min-height: 1.6cqw; }
.grid { flex: 1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 1cqw; overflow-y: auto; align-content: start; padding-right: .4cqw; }
.grid::-webkit-scrollbar, .ups::-webkit-scrollbar { width: .6cqw; } .grid::-webkit-scrollbar-thumb, .ups::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .25); border-radius: 1cqw; }
.card { position: relative; background: linear-gradient(rgba(255, 255, 255, .1), rgba(255, 255, 255, .03)); border: .22cqw solid rgba(255, 255, 255, .08); border-radius: 1.3cqw; padding: .7cqw .4cqw .6cqw; cursor: pointer; transition: transform .1s, border-color .1s; display: flex; flex-direction: column; align-items: center; }
.card:hover { transform: translateY(-.3cqw); border-color: rgba(255, 255, 255, .3); }
.card.sel { border-color: var(--gold); box-shadow: 0 0 1.4cqw rgba(255, 207, 74, .4); }
.card canvas { width: 70%; aspect-ratio: 1; }
.card .nm { font-size: 1.45cqw; margin-top: .2cqw; white-space: nowrap; }
.card .st { font-family: Nunito, system-ui, sans-serif; font-weight: 900; font-size: 1.15cqw; color: #cbb8e0; display: flex; align-items: center; gap: .3cqw; }
.card .st i.coin { width: 1.4cqw; height: 1.4cqw; }
.card.lock canvas { filter: brightness(0) opacity(.5); }
.card .eq { position: absolute; top: .5cqw; right: .5cqw; font-size: 1cqw; background: #5fe05a; color: #0a3a10; padding: .1cqw .6cqw; border-radius: .6cqw; }
.card.rare { background: linear-gradient(rgba(255, 207, 74, .18), rgba(255, 120, 40, .05)); }
.ups { flex: 1; display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.2cqw; overflow-y: auto; align-content: start; }
.up { display: flex; gap: 1.2cqw; align-items: center; background: linear-gradient(rgba(255, 255, 255, .09), rgba(255, 255, 255, .03)); border: .15cqw solid rgba(255, 255, 255, .1); border-radius: 1.4cqw; padding: 1.1cqw; text-align: left; }
.up canvas { width: 6cqw; height: 6cqw; flex: none; }
.up .info { flex: 1; }
.up .info b { font-weight: 400; font-size: 2cqw; display: block; }
.up .info p { margin: .2cqw 0 .5cqw; font-family: Nunito, system-ui, sans-serif; font-weight: 800; font-size: 1.25cqw; color: #cbb8e0; }
.pips { display: flex; gap: .4cqw; }
.pips i { width: 2.2cqw; height: .9cqw; border-radius: .4cqw; background: rgba(255, 255, 255, .15); }
.pips i.on { background: linear-gradient(#aaff7a, #3ac04a); }
.up .btn { font-size: 1.6cqw; padding: .6cqw 1.4cqw; display: flex; gap: .4cqw; align-items: center; white-space: nowrap; }
.up .btn i.coin { width: 1.7cqw; height: 1.7cqw; }

/* ---------- missions ---------- */
.rankbox { display: flex; align-items: center; gap: 1.6cqw; padding: 1.4cqw 2cqw .4cqw; }
.badge { width: 7cqw; height: 7cqw; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #9adfff, #3a6ae0 60%, #1a2a7a); box-shadow: 0 0 0 .35cqw #fff, 0 .5cqw 1.4cqw rgba(0, 0, 0, .5); display: grid; place-items: center; font-size: 3.4cqw; color: #fff; -webkit-text-stroke: .15cqw #0a1a4a; flex: none; }
.rankinfo { text-align: left; flex: 1; }
.rankinfo .rn { font-size: 2.6cqw; color: #fff; }
.rankinfo .rm { font-family: Nunito, system-ui, sans-serif; font-weight: 900; font-size: 1.4cqw; color: #9adfff; }
.rankinfo .stars i { width: 2cqw; height: 2cqw; }
.mlist { display: flex; flex-direction: column; gap: .9cqw; padding: .6cqw 2cqw; width: 100%; }
.mis { display: flex; align-items: center; gap: 1.2cqw; background: linear-gradient(90deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .03)); border: .15cqw solid rgba(255, 255, 255, .1); border-radius: 1.3cqw; padding: .9cqw 1.3cqw; text-align: left; position: relative; }
.mis.done { border-color: #5fe05a; background: linear-gradient(90deg, rgba(95, 224, 90, .25), rgba(95, 224, 90, .05)); }
.mis .mt { flex: 1; font-family: Nunito, system-ui, sans-serif; font-weight: 900; font-size: 1.55cqw; }
.mis .bar { height: .9cqw; background: rgba(0, 0, 0, .4); border-radius: 1cqw; margin-top: .5cqw; overflow: hidden; }
.mis .bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffcf4a, #ff7a2a); border-radius: 1cqw; }
.mis.done .bar i { background: linear-gradient(90deg, #aaff7a, #3ac04a); }
.mis .rw { display: flex; align-items: center; gap: .4cqw; font-size: 1.8cqw; color: var(--gold); }
.mis .new { position: absolute; top: -.8cqw; left: 1cqw; background: var(--red); color: #fff; font-size: 1cqw; padding: .1cqw .7cqw; border-radius: .5cqw; }
.mlist.compact { width: 60%; padding: 0; gap: .6cqw; }
.mlist.compact .mis { padding: .4cqw 1cqw; }
.mlist.compact .bar { margin-top: .3cqw; height: .7cqw; }
.mlist.compact .rw { font-size: 1.5cqw; }
.mlist.compact .mt { font-size: 1.3cqw; }
.note { font-family: Nunito, system-ui, sans-serif; font-weight: 800; font-size: 1.3cqw; color: #cbb8e0; margin: .6cqw 2cqw 0; }
.note b { color: var(--gold); }

/* ---------- pause / revive / over ---------- */
#pause, #revive { background: rgba(8, 4, 14, .66); backdrop-filter: blur(.5cqw); }
.toggles .btn.off { opacity: .5; text-decoration: line-through; }
.timer { width: 30cqw; height: 1.2cqw; border-radius: 1cqw; background: rgba(255, 255, 255, .15); overflow: hidden; }
#revBar { height: 100%; width: 100%; background: linear-gradient(90deg, #ff5a4a, #ffcf4a); }
.have { font-family: Nunito, system-ui, sans-serif; font-weight: 900; font-size: 1.5cqw; opacity: .8; }
#over { background: radial-gradient(ellipse at 50% 50%, rgba(8, 4, 14, .55), rgba(8, 4, 14, .85)); }
.over-card { display: flex; flex-direction: column; align-items: center; gap: .9cqw; width: 72%; }
.over-card .title { font-size: 4cqw; }
.orow { align-items: center; margin-top: .4cqw; }
.newbest { font-size: 2.1cqw; color: #fff; background: linear-gradient(90deg, #ff3a8a, #ff9a1a); padding: .3cqw 2cqw; border-radius: 1cqw; animation: pop .6s ease-out, bob 1.2s ease-in-out .6s infinite; box-shadow: 0 .4cqw 0 #8a1040; }
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.25); } }
.oscore { font-size: 6cqw; line-height: 1; color: #fff; -webkit-text-stroke: .3cqw var(--ink); filter: drop-shadow(0 .5cqw 0 #3a1406); }
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: .8cqw; width: 100%; }
.stat { background: rgba(255, 255, 255, .08); border: .15cqw solid rgba(255, 255, 255, .1); border-radius: 1.2cqw; padding: .45cqw .4cqw; animation: pop .4s ease-out backwards; }
.stat b { display: block; font-weight: 400; font-size: 2.1cqw; color: var(--gold); }
.stat span { font-family: Nunito, system-ui, sans-serif; font-weight: 900; font-size: 1.1cqw; opacity: .85; text-transform: uppercase; }

/* ---------- toasts ---------- */
#toasts { position: absolute; top: 9cqw; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: .8cqw; z-index: 9; pointer-events: none; align-items: center; }
.toast { display: flex; align-items: center; gap: 1cqw; background: linear-gradient(90deg, #2a7a3a, #3ac04a); border: .2cqw solid #aaff7a; border-radius: 1.4cqw; padding: .7cqw 1.6cqw; box-shadow: 0 .8cqw 2cqw rgba(0, 0, 0, .5); animation: tin .35s cubic-bezier(.2, 1.6, .4, 1), tout .4s ease-in 3s forwards; }
.toast b { font-weight: 400; font-size: 1.9cqw; display: block; }
.toast span { font-family: Nunito, system-ui, sans-serif; font-weight: 900; font-size: 1.3cqw; }
.toast .rw { font-size: 2cqw; color: #fff6b0; display: flex; align-items: center; gap: .4cqw; }
@keyframes tin { from { transform: translateY(-3cqw) scale(.6); opacity: 0; } }
@keyframes tout { to { transform: translateY(-2cqw); opacity: 0; } }

#rotate { display: none; position: fixed; inset: 0; z-index: 99; background: #120c18; color: #fff; flex-direction: column; align-items: center; justify-content: center; font-size: 6vw; gap: 4vw; }
#rotate .ri { font-size: 20vw; animation: spin 2s ease-in-out infinite; }
@keyframes spin { 50% { transform: rotate(90deg); } }
@media (orientation: portrait) and (max-width: 820px) { #rotate { display: flex; } }

.chip.daily { cursor: pointer; color: #fff; background: linear-gradient(#ff7ad9, #c2185b); border-color: #ffd0f0; animation: bob 1s ease-in-out infinite; box-shadow: 0 0 1.6cqw rgba(255, 122, 217, .6); font-size: 1.7cqw; padding: .5cqw 1.4cqw .5cqw .7cqw; }
.gift { width: 2.4cqw; height: 2.2cqw; position: relative; background: linear-gradient(90deg, #ffcf4a 40%, #e63a2e 40% 60%, #ffcf4a 60%); border-radius: .3cqw; box-shadow: inset 0 .5cqw 0 rgba(0, 0, 0, .15); }
.gift::before { content: ""; position: absolute; left: -.2cqw; right: -.2cqw; top: -.5cqw; height: .7cqw; background: linear-gradient(90deg, #ffe27a 40%, #e63a2e 40% 60%, #ffe27a 60%); border-radius: .2cqw; }
