:root {
  --cyan: #5fe6ff; --mag: #ff3fae; --gold: #ffc54a; --ink: #03040c;
  --display: 'Unbounded', 'Segoe UI', sans-serif; --ui: 'Chakra Petch', 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--ink); color: #e8f6ff; font-family: var(--ui); user-select: none; -webkit-user-select: none; }
canvas#c { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.hidden { display: none !important; }
body.playing, body.playing * { cursor: none; }
kbd { font-family: var(--ui); font-weight: 600; font-size: 11px; letter-spacing: .08em; padding: 3px 7px; border: 1px solid rgba(140, 220, 255, .35); border-radius: 5px; background: rgba(90, 200, 255, .08); color: #bfefff; }

/* ---------- crosshair ---------- */
#cross { position: fixed; left: 0; top: 0; width: 0; height: 0; pointer-events: none; z-index: 30; display: none; }
body.playing #cross { display: block; }
#cross::before { content: ''; position: absolute; left: -15px; top: -15px; width: 30px; height: 30px; border: 1.5px solid rgba(160, 240, 255, .9); border-radius: 50%; box-shadow: 0 0 12px rgba(95, 230, 255, .8), inset 0 0 8px rgba(95, 230, 255, .4); clip-path: polygon(0 0, 38% 0, 38% 100%, 62% 100%, 62% 0, 100% 0, 100% 38%, 0 38%, 0 62%, 100% 62%, 100% 100%, 0 100%); transform: rotate(45deg); }
#cross::after { content: ''; position: absolute; left: -2px; top: -2px; width: 4px; height: 4px; background: #fff; border-radius: 50%; box-shadow: 0 0 8px #fff; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud .tl { position: absolute; left: 28px; top: 22px; }
#wave { font-family: var(--display); font-weight: 500; font-size: 13px; letter-spacing: .32em; color: #9fdcff; text-shadow: 0 0 14px rgba(95, 230, 255, .7); }
#hp { display: flex; gap: 7px; margin-top: 12px; }
#hp i { width: 15px; height: 15px; transform: rotate(45deg); border: 1.5px solid rgba(255, 90, 170, .55); background: transparent; transition: all .25s; }
#hp i.on { background: linear-gradient(135deg, #ff7ac8, #ff2f8f); border-color: #ffb0dd; box-shadow: 0 0 12px rgba(255, 63, 174, .9); }
#hud .tc { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); text-align: center; }
#score { font-family: var(--display); font-weight: 800; font-size: 34px; letter-spacing: .06em; font-variant-numeric: tabular-nums; text-shadow: 0 0 22px rgba(120, 220, 255, .65); }
#mult { --h: 190; font-family: var(--display); font-weight: 500; font-size: 17px; margin-top: 2px; color: hsl(var(--h) 100% 72%); text-shadow: 0 0 16px hsl(var(--h) 100% 60% / .9); }
.combo { width: 120px; height: 2px; margin: 7px auto 0; background: rgba(255, 255, 255, .1); overflow: hidden; border-radius: 2px; }
.combo i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--mag)); transform-origin: left; transform: scaleX(0); }
#hud .bc { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); display: flex; gap: 12px; align-items: flex-end; }
.meter { position: relative; width: 96px; height: 20px; border: 1px solid rgba(140, 220, 255, .3); border-radius: 4px; background: rgba(4, 10, 26, .55); overflow: hidden; transform: skewX(-14deg); }
.meter.wide { width: 250px; }
.meter i { position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, rgba(60, 150, 255, .75), rgba(95, 230, 255, .95)); }
#nova i { background: linear-gradient(90deg, rgba(255, 63, 174, .8), rgba(255, 197, 74, .95)); }
.meter span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; letter-spacing: .3em; color: rgba(255, 255, 255, .85); transform: skewX(14deg); text-shadow: 0 0 6px rgba(0, 0, 0, .9); }
.meter.ready { border-color: rgba(255, 255, 255, .8); }
#nova.ready { animation: novaPulse .9s ease-in-out infinite; }
@keyframes novaPulse { 50% { box-shadow: 0 0 26px rgba(255, 150, 120, .95), 0 0 60px rgba(255, 63, 174, .5); } }
#bossbar { position: absolute; left: 50%; top: 112px; transform: translateX(-50%); width: min(560px, 60vw); text-align: center; }
#bossbar span { font-family: var(--display); font-size: 11px; letter-spacing: .5em; color: var(--gold); text-shadow: 0 0 14px rgba(255, 197, 74, .8); }
#bossbar div { height: 7px; margin-top: 7px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 197, 74, .4); border-radius: 4px; overflow: hidden; }
#bossbar i { display: block; height: 100%; transform-origin: left; background: linear-gradient(90deg, #ff5a3c, var(--gold)); box-shadow: 0 0 14px var(--gold); transition: transform .15s; }

/* ---------- banner / toast ---------- */
#banner { position: fixed; left: 0; right: 0; top: 30%; text-align: center; pointer-events: none; z-index: 12; opacity: 0; }
#banner.show { animation: banner 2.4s cubic-bezier(.2, .8, .2, 1) forwards; }
#banner h2 { font-family: var(--display); font-weight: 800; font-size: clamp(34px, 6vw, 76px); letter-spacing: .14em; background: linear-gradient(90deg, #8ff0ff, #fff 45%, #ff9ad8); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 26px rgba(95, 230, 255, .55)); }
#banner p { margin-top: 8px; font-size: 15px; letter-spacing: .5em; text-transform: uppercase; color: #bfe9ff; text-shadow: 0 0 12px rgba(95, 230, 255, .7); }
@keyframes banner { 0% { opacity: 0; transform: scale(1.25); letter-spacing: .3em; filter: blur(8px); } 14% { opacity: 1; transform: scale(1); filter: blur(0); } 72% { opacity: 1; } 100% { opacity: 0; transform: scale(.97) translateY(-14px); } }
#toast { position: fixed; left: 50%; bottom: 74px; transform: translateX(-50%); font-size: 12px; font-weight: 700; letter-spacing: .34em; color: #dff7ff; opacity: 0; pointer-events: none; z-index: 12; text-shadow: 0 0 10px rgba(95, 230, 255, .8); }
#toast.show { animation: toast 1.6s ease forwards; }
@keyframes toast { 0% { opacity: 0; } 12%, 70% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; background: radial-gradient(ellipse at center, rgba(3, 4, 14, .25) 0%, rgba(3, 4, 14, .78) 78%); animation: fadeIn .5s ease both; }
@keyframes fadeIn { from { opacity: 0; } }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .62em; color: #9fdcff; text-shadow: 0 0 12px rgba(95, 230, 255, .7); margin-bottom: 16px; padding-left: .62em; }
h1 { font-family: var(--display); font-weight: 800; font-size: clamp(46px, 10.5vw, 148px); line-height: .95; letter-spacing: .02em; color: #f2fbff; text-shadow: 0 0 40px rgba(95, 230, 255, .55), 0 0 110px rgba(60, 120, 255, .5); }
h1 span { background: linear-gradient(100deg, #ff3fae 5%, #ff9a5c 55%, #ffd76a); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; filter: drop-shadow(0 0 34px rgba(255, 63, 174, .6)); }
.tag { margin-top: 20px; font-size: clamp(14px, 1.5vw, 19px); letter-spacing: .3em; text-transform: uppercase; color: #cfeaff; opacity: .9; }
.btn { margin-top: 38px; padding: 17px 60px; font-family: var(--display); font-weight: 500; font-size: 16px; letter-spacing: .34em; color: #03121c; background: linear-gradient(100deg, #7df0ff, #b8f6ff); border: 0; border-radius: 3px; cursor: pointer; clip-path: polygon(14px 0, 100% 0, calc(100% - 14px) 100%, 0 100%); filter: drop-shadow(0 0 22px rgba(95, 230, 255, .7)); transition: transform .15s, filter .15s; animation: btnPulse 2.2s ease-in-out infinite; }
.btn:hover { transform: scale(1.06); filter: drop-shadow(0 0 38px rgba(140, 240, 255, 1)); }
@keyframes btnPulse { 50% { filter: drop-shadow(0 0 36px rgba(95, 230, 255, .95)); } }
.best { margin-top: 18px; font-size: 13px; font-weight: 600; letter-spacing: .4em; color: var(--gold); text-shadow: 0 0 12px rgba(255, 197, 74, .6); min-height: 16px; }
.best.new { animation: novaPulse .9s infinite; color: #fff; }
.controls { margin-top: 34px; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 30px; max-width: 880px; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: #a9cde4; }
.controls div { display: flex; align-items: center; gap: 6px; }
.controls span { margin: 0 6px 0 4px; }

#upgrade h2, #pause h2 { font-family: var(--display); font-weight: 800; font-size: clamp(30px, 5vw, 60px); letter-spacing: .3em; padding-left: .3em; background: linear-gradient(90deg, #8ff0ff, #fff, #ffb1e0); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 24px rgba(95, 230, 255, .5)); }
.sub { margin-top: 10px; font-size: 13px; letter-spacing: .34em; text-transform: uppercase; color: #a9d6ee; }
.hint { margin-top: 26px; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: #88a9c0; }
#cards { margin-top: 34px; display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; }
.card { --c: 95, 230, 255; position: relative; width: 236px; min-height: 300px; padding: 30px 22px 22px; color: #eaf8ff; font-family: var(--ui); text-align: center; cursor: pointer; border: 1px solid rgba(var(--c), .45); border-radius: 14px; background: linear-gradient(170deg, rgba(var(--c), .16), rgba(6, 10, 28, .82) 55%); backdrop-filter: blur(9px); box-shadow: 0 0 0 rgba(var(--c), 0), inset 0 0 40px rgba(var(--c), .07); transition: transform .18s cubic-bezier(.2, .9, .3, 1.3), box-shadow .18s, border-color .18s; animation: cardIn .5s cubic-bezier(.2, .9, .3, 1.15) both; }
.card.r1 { --c: 255, 63, 174; }
.card.r2 { --c: 255, 197, 74; }
.card:hover { transform: translateY(-10px) scale(1.04); border-color: rgba(var(--c), 1); box-shadow: 0 0 44px rgba(var(--c), .5), inset 0 0 50px rgba(var(--c), .16); }
@keyframes cardIn { from { opacity: 0; transform: translateY(46px) scale(.92); } }
.card .key { position: absolute; left: 14px; top: 12px; font-size: 11px; font-weight: 700; width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid rgba(var(--c), .6); border-radius: 5px; color: rgb(var(--c)); }
.card .rar { position: absolute; right: 14px; top: 15px; font-size: 9.5px; font-weight: 700; letter-spacing: .26em; color: rgb(var(--c)); }
.card .icon { font-size: 54px; line-height: 1; height: 78px; display: grid; place-items: center; margin-top: 18px; color: rgb(var(--c)); text-shadow: 0 0 26px rgba(var(--c), .95); }
.card h3 { margin-top: 14px; font-family: var(--display); font-weight: 500; font-size: 15.5px; letter-spacing: .08em; }
.card p { margin-top: 12px; font-size: 14.5px; line-height: 1.45; color: #c3dcec; min-height: 62px; }
.card small { display: block; margin-top: 12px; font-size: 10.5px; font-weight: 700; letter-spacing: .28em; color: rgba(var(--c), .95); }

.bigscore { font-family: var(--display); font-weight: 800; font-size: clamp(54px, 10vw, 128px); line-height: 1; font-variant-numeric: tabular-nums; background: linear-gradient(100deg, #8ff0ff, #fff 40%, #ff9ad8 80%, #ffd76a); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 36px rgba(95, 230, 255, .5)); }
.stats { margin-top: 26px; display: flex; gap: 60px; }
.stats b { display: block; font-family: var(--display); font-weight: 500; font-size: 30px; }
.stats span { font-size: 11px; letter-spacing: .34em; color: #9fc4da; }
.ups { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 760px; }
.ups span { font-size: 12px; letter-spacing: .08em; padding: 5px 11px; border: 1px solid rgba(140, 220, 255, .3); border-radius: 20px; background: rgba(90, 200, 255, .07); color: #cfeaff; }

#err { position: fixed; inset: 0; z-index: 99; display: grid; place-items: center; padding: 40px; background: var(--ink); font-size: 18px; text-align: center; }

@media (max-width: 720px) {
  #score { font-size: 24px; } .card { width: 100%; max-width: 330px; min-height: 0; padding: 22px 18px 16px; } .card .icon { height: 54px; font-size: 40px; margin-top: 8px; } .card p { min-height: 0; }
  .meter.wide { width: 160px; } #cards { gap: 12px; margin-top: 18px; }
}
