@font-face {
  font-family: 'Bungee';
  src: url('bungee.woff2') format('woff2');
  font-display: swap;
}
:root {
  --cy: #2de2ff;
  --mg: #ff3df0;
  --yl: #ffe14d;
  --bg: #07021a;
  --panel: rgba(9, 3, 26, .9);
  --ink: #f4f0ff;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  user-select: none; -webkit-user-select: none; touch-action: none; overscroll-behavior: none;
}
#cv { position: fixed; inset: 0; display: block; touch-action: none; }
body::after { /* CRT scanlines + vignette */
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 5;
  background:
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.45) 100%),
    repeating-linear-gradient(0deg, rgba(0,0,0,.12) 0 1px, transparent 1px 3px);
}
.hidden { display: none !important; }

#pauseBtn {
  position: fixed; z-index: 8; width: 40px; height: 40px; padding: 8px;
  border-radius: 10px; border: 2px solid rgba(255,255,255,.55); background: rgba(10,4,30,.6);
  color: #fff; cursor: pointer; box-shadow: 0 0 12px rgba(45,226,255,.45);
}
#pauseBtn svg { width: 100%; height: 100%; fill: currentColor; display: block; }
#pauseBtn:hover { border-color: var(--cy); }

#ui { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.scr {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  pointer-events: auto;
}
.scr.on { display: flex; animation: scrIn .28s ease-out; }
@keyframes scrIn { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
#scrTitle { background: radial-gradient(ellipse at 50% 45%, rgba(7,2,26,.25), rgba(7,2,26,.78) 75%); }
#scrSelect, #scrPause, #scrClear, #scrOver { background: rgba(4,1,14,.55); }

.titleWrap { display: flex; flex-direction: column; align-items: center; gap: clamp(8px, 1.8vh, 16px); text-align: center; }
.logo { margin: 0; line-height: .86; font-family: 'Bungee', Impact, sans-serif; font-weight: 400; display: flex; flex-direction: column; align-items: center; }
.logo .b1 {
  font-size: clamp(46px, 12vmin, 118px); color: #fff; letter-spacing: .02em;
  text-shadow: 0 0 6px #fff, 0 0 18px var(--cy), 0 0 40px var(--cy), 3px 3px 0 #1a0a5a;
}
.logo .b2 {
  font-size: clamp(56px, 15vmin, 148px); letter-spacing: .02em; transform: skewX(-8deg);
  background: linear-gradient(180deg, #fff6b0 0%, #ffd23d 30%, #ff5ab4 58%, #b43dff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 14px rgba(255,61,240,.75)) drop-shadow(4px 4px 0 #2a0a4a);
  animation: shimmer 4s ease-in-out infinite;
}
@keyframes shimmer { 0%, 100% { filter: drop-shadow(0 0 14px rgba(255,61,240,.75)) drop-shadow(4px 4px 0 #2a0a4a); } 50% { filter: drop-shadow(0 0 26px rgba(255,61,240,1)) drop-shadow(4px 4px 0 #2a0a4a); } }
.tag { margin: 0; font-family: 'Bungee', Impact, sans-serif; font-size: clamp(11px, 1.9vmin, 15px); color: var(--cy); letter-spacing: .08em; text-shadow: 0 0 10px rgba(45,226,255,.7); }
.stats { margin: 0; font-size: 13px; color: rgba(255,255,255,.75); font-weight: 600; letter-spacing: .04em; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.btn {
  font-family: 'Bungee', Impact, sans-serif; font-size: 17px; letter-spacing: .04em; color: #fff;
  border: 2px solid rgba(255,255,255,.8); border-radius: 14px; padding: 12px 22px; cursor: pointer;
  background: linear-gradient(180deg, #ff6af5 0%, #d12dff 55%, #8a1fd6 100%);
  box-shadow: 0 0 18px rgba(255,61,240,.55), inset 0 2px 0 rgba(255,255,255,.45), 0 4px 0 #4a0a7a;
  transition: transform .08s, box-shadow .15s, filter .15s; min-height: 48px;
}
.btn:hover { filter: brightness(1.12); box-shadow: 0 0 28px rgba(255,61,240,.85), inset 0 2px 0 rgba(255,255,255,.45), 0 4px 0 #4a0a7a; }
.btn:active { transform: translateY(3px); box-shadow: 0 0 12px rgba(255,61,240,.5), inset 0 2px 0 rgba(255,255,255,.4), 0 1px 0 #4a0a7a; }
.btn:focus-visible, .tog:focus-visible, .tile:focus-visible, .wtab:focus-visible, .skin:focus-visible { outline: 3px solid var(--yl); outline-offset: 3px; }
.btn.big { font-size: clamp(24px, 4.2vmin, 34px); padding: 12px 52px; display: flex; flex-direction: column; align-items: center; line-height: 1.05; }
.btn.big small { font-size: 12px; opacity: .85; letter-spacing: .1em; margin-top: 3px; }
.btn.alt {
  background: rgba(10,4,30,.75); border-color: var(--cy);
  box-shadow: 0 0 14px rgba(45,226,255,.45), inset 0 0 12px rgba(45,226,255,.15), 0 4px 0 #0a3a52;
}
.btn.alt:hover { box-shadow: 0 0 24px rgba(45,226,255,.8), inset 0 0 12px rgba(45,226,255,.25), 0 4px 0 #0a3a52; }
.btn.mini { padding: 0 14px; min-height: 40px; font-size: 24px; line-height: 1; background: rgba(10,4,30,.75); border-color: var(--cy); box-shadow: 0 0 10px rgba(45,226,255,.4); }

.tog {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; min-height: 40px; border-radius: 999px; cursor: pointer;
  font-family: 'Bungee', Impact, sans-serif; font-size: 12px; letter-spacing: .05em;
  color: #fff; background: rgba(10,4,30,.7); border: 2px solid var(--cy); box-shadow: 0 0 10px rgba(45,226,255,.35);
}
.tog svg { width: 18px; height: 18px; fill: currentColor; }
.tog.off { color: rgba(255,255,255,.4); border-color: rgba(255,255,255,.25); box-shadow: none; text-decoration: line-through; }

.panel {
  position: relative; background: var(--panel); border: 2px solid var(--cy); border-radius: 20px;
  box-shadow: 0 0 34px rgba(45,226,255,.35), inset 0 0 40px rgba(255,61,240,.08);
  padding: 22px 24px; width: min(440px, 94vw); max-height: 94vh; overflow: auto;
  display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
}
.panel.wide { width: min(720px, 96vw); }
.panel h2 { margin: 0; font-family: 'Bungee', Impact, sans-serif; font-weight: 400; font-size: clamp(26px, 5vmin, 38px); color: #fff; text-shadow: 0 0 14px var(--mg), 0 0 30px var(--mg); }
.panel h2.red { text-shadow: 0 0 14px #ff2d55, 0 0 30px #ff2d55; }
.kicker { margin: 0 0 -8px; font-family: 'Bungee', Impact, sans-serif; color: var(--cy); font-size: 13px; letter-spacing: .1em; }
.help { margin: 0; font-size: 12px; color: rgba(255,255,255,.65); line-height: 1.5; }
.gc { color: rgba(255,255,255,.55); font-size: 12px; text-decoration: none; font-weight: 600; }
.gc:hover { color: #fff; }

.phead { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 10px; }
.phead h2 { font-size: clamp(20px, 4vmin, 30px); }
.starsTot { font-family: 'Bungee', Impact, sans-serif; color: var(--yl); font-size: 16px; white-space: nowrap; text-shadow: 0 0 10px rgba(255,225,77,.6); }
.worlds { display: flex; gap: 8px; width: 100%; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: thin; }
.wtab {
  flex: 1 0 auto; min-width: 104px; padding: 8px 10px; border-radius: 12px; cursor: pointer; text-align: left;
  background: rgba(255,255,255,.04); border: 2px solid rgba(255,255,255,.18); color: #fff;
  font-family: 'Bungee', Impact, sans-serif; font-size: 12px; line-height: 1.3;
}
.wtab small { display: block; font-family: system-ui, sans-serif; font-weight: 700; font-size: 11px; color: var(--yl); }
.wtab.sel { border-color: var(--wc, var(--mg)); box-shadow: 0 0 14px var(--wc, var(--mg)); background: rgba(255,255,255,.08); }
.wtab.locked { opacity: .45; }
.lgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; width: 100%; }
.tile {
  position: relative; aspect-ratio: 1.15; border-radius: 14px; cursor: pointer; padding: 6px 4px;
  border: 2px solid var(--wc, var(--cy)); background: linear-gradient(180deg, rgba(255,255,255,.1), rgba(255,255,255,.02));
  color: #fff; font-family: 'Bungee', Impact, sans-serif; font-size: clamp(16px, 3.4vmin, 24px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  box-shadow: 0 0 10px color-mix(in srgb, var(--wc, #2de2ff) 50%, transparent);
  transition: transform .1s;
}
.tile:hover { transform: translateY(-2px); }
.tile .st { display: flex; gap: 1px; }
.tile .st svg { width: 14px; height: 14px; fill: rgba(255,255,255,.18); }
.tile .st svg.on { fill: var(--yl); filter: drop-shadow(0 0 4px rgba(255,225,77,.8)); }
.tile .nm { font-family: system-ui, sans-serif; font-weight: 700; font-size: 9px; letter-spacing: .04em; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tile.boss { background: linear-gradient(180deg, rgba(255,45,85,.35), rgba(255,45,85,.06)); border-color: #ff2d55; box-shadow: 0 0 14px rgba(255,45,85,.6); }
.tile.boss::before { content: 'BOSS'; position: absolute; top: -9px; font-size: 10px; background: #ff2d55; padding: 1px 6px; border-radius: 6px; }
.tile.locked { cursor: default; opacity: .4; box-shadow: none; }
.tile.locked svg.lk { width: 22px; height: 22px; fill: rgba(255,255,255,.7); }
.tile.locked:hover { transform: none; }
.skins { width: 100%; }
.skins h3 { margin: 0 0 8px; font-family: 'Bungee', Impact, sans-serif; font-weight: 400; font-size: 13px; color: var(--cy); text-align: left; }
.skins h3 small { font-family: system-ui, sans-serif; font-weight: 600; color: rgba(255,255,255,.5); font-size: 11px; margin-left: 6px; }
.skinRow { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.skin {
  border-radius: 12px; padding: 8px 4px 6px; cursor: pointer; background: rgba(255,255,255,.04);
  border: 2px solid rgba(255,255,255,.2); color: #fff; display: flex; flex-direction: column; align-items: center; gap: 5px;
  font-family: 'Bungee', Impact, sans-serif; font-size: 10px;
}
.skin i { display: block; width: 80%; height: 9px; border-radius: 6px; }
.skin.sel { border-color: var(--yl); box-shadow: 0 0 12px rgba(255,225,77,.6); }
.skin.locked { opacity: .45; cursor: default; }

.bigstars { display: flex; gap: 10px; }
.bigstars svg { width: clamp(44px, 9vmin, 64px); height: clamp(44px, 9vmin, 64px); fill: rgba(255,255,255,.12); stroke: rgba(255,255,255,.3); stroke-width: .6; transform: scale(.5); opacity: 0; }
.bigstars svg.show { animation: starIn .45s cubic-bezier(.2, 1.6, .4, 1) forwards; }
.bigstars svg.on { fill: var(--yl); stroke: #fff; filter: drop-shadow(0 0 10px rgba(255,225,77,.9)); }
@keyframes starIn { to { transform: scale(1); opacity: 1; } }
.tally { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; font-size: 14px; font-weight: 700; text-align: left; }
.tally span:nth-child(even) { text-align: right; font-family: 'Bungee', Impact, sans-serif; font-weight: 400; color: #fff; }
.tally span:nth-child(odd) { color: rgba(255,255,255,.7); }
.tally .tot { color: var(--yl) !important; font-size: 18px; }
.unlock { margin: 0; color: var(--yl); font-family: 'Bungee', Impact, sans-serif; font-size: 13px; }
.unlock:empty { display: none; }
.bigscore { font-family: 'Bungee', Impact, sans-serif; font-size: clamp(34px, 7vmin, 52px); color: #fff; text-shadow: 0 0 16px var(--cy); }
.newbest { margin: -6px 0 0; font-family: 'Bungee', Impact, sans-serif; color: var(--yl); font-size: 14px; }
.newbest:empty { display: none; }
.top5 { margin: 0; padding: 0; list-style: none; width: 100%; counter-reset: r; }
.top5:empty { display: none; }
.top5 li { counter-increment: r; display: flex; justify-content: space-between; padding: 5px 10px; border-radius: 8px; font-weight: 700; font-size: 14px; }
.top5 li::before { content: counter(r) '.'; width: 26px; color: var(--cy); font-family: 'Bungee', Impact, sans-serif; }
.top5 li span:first-of-type { flex: 1; text-align: left; color: rgba(255,255,255,.65); }
.top5 li b { font-family: 'Bungee', Impact, sans-serif; font-weight: 400; }
.top5 li.me { background: rgba(255,225,77,.15); outline: 1px solid rgba(255,225,77,.6); }

body.clean #ui, body.clean #pauseBtn { display: none !important; }

@media (max-height: 520px) {
  .titleWrap { gap: 6px; }
  .logo { flex-direction: row; gap: 14px; align-items: baseline; }
  .logo .b1 { font-size: clamp(36px, 11vh, 64px); }
  .logo .b2 { font-size: clamp(40px, 13vh, 76px); }
  .btn { min-height: 42px; padding: 8px 18px; font-size: 15px; }
  .btn.big { padding: 8px 40px; font-size: 24px; }
  .panel { padding: 12px 16px; gap: 9px; max-height: 96vh; }
  .panel.wide { width: min(780px, 96vw); }
  .lgrid { grid-template-columns: repeat(10, 1fr); gap: 6px; }
  .tile { aspect-ratio: .85; font-size: 15px; padding: 4px 2px; }
  .tile .nm { display: none; }
  .tile .st svg { width: 10px; height: 10px; }
  .help { display: none; }
  .bigstars svg { width: 40px; height: 40px; }
  .tally { font-size: 12px; }
}
@media (max-width: 420px) {
  .lgrid { gap: 7px; }
  .tile .nm { display: none; }
  .skinRow { grid-template-columns: repeat(3, 1fr); }
  .btn.big { padding: 12px 40px; }
  .wtab { min-width: 92px; }
}
@media (prefers-reduced-motion: reduce) {
  .scr.on { animation: none; }
  .logo .b2 { animation: none; }
  .bigstars svg.show { animation: none; transform: none; opacity: 1; }
}
