/* ===================== BOOMBOX ===================== */
:root{
  --bg:#0A0912;
  --ink:#08070E;
  --paper:#F6F2FF;
  --muted:#9E96C0;
  --accent:#FF2E88;      /* set at runtime per theme */
  --accent2:#22E0FF;
  --line:rgba(150,130,220,.20);
  --panel:rgba(16,13,32,.88);
}
*{ margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
[hidden]{ display:none !important; }
html,body{ height:100%; overflow:hidden; background:var(--bg); }
body{
  font-family:'Space Grotesk',system-ui,sans-serif; color:var(--paper);
  position:fixed; inset:0; touch-action:none; overscroll-behavior:none;
  -webkit-user-select:none; user-select:none; -webkit-font-smoothing:antialiased;
}
.mono{ font-family:'Chivo Mono',ui-monospace,monospace; }
.hide{ display:none !important; }
a{ color:var(--accent2); text-decoration:none; }
#gl{ position:fixed; inset:0; width:100%; height:100%; display:block; touch-action:none; }

/* no canvas */
#nogl{ position:fixed; inset:0; display:flex; align-items:center; justify-content:center; background:var(--bg); z-index:50; text-align:center; padding:24px; }
#nogl p{ color:var(--muted); line-height:1.6; margin-top:14px; }
.wordmark-mini{ font-family:'Bungee',cursive; font-size:24px; letter-spacing:2px; color:var(--paper); text-align:center; }
.wordmark-mini.sm{ font-size:19px; }

/* ==================== HUD ==================== */
#hud{ position:fixed; inset:0; z-index:20; pointer-events:none; }
#hud button{ pointer-events:auto; }
.chip{ position:absolute; display:flex; align-items:center; gap:5px; background:rgba(10,8,20,.5); border:1px solid var(--line);
  border-radius:11px; padding:6px 11px; backdrop-filter:blur(4px); font-family:'Bungee',cursive; }
#lvChip{ top:calc(env(safe-area-inset-top,0px) + 12px); left:12px; font-size:15px; }
#lvChip .k{ color:var(--accent2); font-size:11px; }
#scoreWrap{ position:absolute; top:calc(env(safe-area-inset-top,0px) + 10px); left:0; right:0; text-align:center;
  font-family:'Bungee',cursive; font-size:8vw; line-height:1; text-shadow:0 3px 0 rgba(0,0,0,.35), 0 0 22px var(--accent); }
#comboB{ position:absolute; top:calc(env(safe-area-inset-top,0px) + 11vw); left:50%; transform:translateX(-50%);
  font-family:'Bungee',cursive; font-size:5vw; color:var(--accent); text-shadow:0 2px 0 rgba(0,0,0,.4); }
#goalBar{ position:absolute; left:50%; transform:translateX(-50%); bottom:calc(env(safe-area-inset-bottom,0px) + 14px);
  width:min(70vw,380px); height:16px; background:rgba(0,0,0,.4); border:1px solid var(--line); border-radius:10px; overflow:hidden; }
#goalFill{ position:absolute; inset:0; width:0%; background:linear-gradient(90deg,var(--accent2),var(--accent)); transition:width .25s cubic-bezier(.2,.8,.3,1); }
#goalTxt{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:10px; color:#fff; text-shadow:0 1px 2px #000; letter-spacing:1px; }
#heatWrap{ position:absolute; left:12px; bottom:calc(env(safe-area-inset-bottom,0px) + 14px); width:60px; height:10px; background:rgba(0,0,0,.4); border:1px solid var(--line); border-radius:6px; overflow:hidden; }
#heatFill{ position:absolute; inset:0; width:0%; background:linear-gradient(90deg,#ffd23f,#ff3b3b); }

#banner{ position:absolute; top:34%; left:50%; transform:translate(-50%,-50%); font-family:'Bungee',cursive; font-size:11vw;
  color:var(--accent); text-shadow:0 4px 0 rgba(0,0,0,.45); white-space:nowrap; text-align:center; }

#topRight{ position:absolute; top:calc(env(safe-area-inset-top,0px) + 12px); right:12px; display:flex; gap:8px; }
#topRight button{ width:42px; height:42px; border-radius:12px; border:1px solid var(--line); background:rgba(10,8,20,.5); color:var(--paper);
  font-size:18px; cursor:pointer; display:flex; align-items:center; justify-content:center; backdrop-filter:blur(4px); }
#topRight button:active{ transform:scale(.92); }
#muteBtn.off{ color:var(--muted); opacity:.55; }

#popupLayer{ position:absolute; inset:0; overflow:hidden; }
.pop{ position:absolute; font-family:'Bungee',cursive; font-size:22px; color:#fff; text-shadow:0 2px 0 rgba(0,0,0,.45); white-space:nowrap;
  animation:popRise .95s cubic-bezier(.2,.8,.3,1) forwards; will-change:transform,opacity; }
.pop.sm{ font-size:15px; } .pop.big{ font-size:30px; color:var(--accent); }
@keyframes popRise{ 0%{ transform:translate(-50%,0) scale(.5); opacity:0; } 16%{ transform:translate(-50%,-14px) scale(1.18); opacity:1; } 100%{ transform:translate(-50%,-64px) scale(1); opacity:0; } }

/* ==================== intro ==================== */
#intro{ position:fixed; inset:0; z-index:40; display:flex; align-items:center; justify-content:center;
  background:radial-gradient(120% 90% at 50% 10%, #241141 0%, #120C26 50%, #08060F 100%); }
.wm{ text-align:center; width:min(92vw,460px); padding:20px; }
.wm-word{ font-family:'Bungee',cursive; font-size:min(17vw,92px); line-height:.92; display:flex; justify-content:center; gap:.01em; flex-wrap:wrap; }
.wm .wl{ display:inline-block; animation:wlPop .5s cubic-bezier(.2,1.4,.4,1) backwards; }
.wm .wl:nth-child(1){ color:#FF2E88; animation-delay:.02s; } .wm .wl:nth-child(2){ color:#FF9F1C; animation-delay:.07s; }
.wm .wl:nth-child(3){ color:#FFD23F; animation-delay:.12s; } .wm .wl:nth-child(4){ color:#3DDC97; animation-delay:.17s; }
.wm .wl:nth-child(5){ color:#22E0FF; animation-delay:.22s; } .wm .wl:nth-child(6){ color:#7A5CFF; animation-delay:.27s; }
.wm .wl:nth-child(7){ color:#FF2E88; animation-delay:.32s; }
@keyframes wlPop{ 0%{ transform:translateY(-30px) scale(.5) rotate(-8deg); opacity:0; } 100%{ transform:none; opacity:1; } }
.wm-tag{ font-family:'Chivo Mono',monospace; color:var(--accent2); letter-spacing:5px; font-size:13px; text-transform:uppercase; margin:8px 0 30px; }
.intro-btns{ display:flex; flex-direction:column; gap:12px; align-items:center; }
.intro-hint{ color:var(--muted); font-size:12px; margin-top:20px; opacity:.85; letter-spacing:1px; }

/* ==================== buttons ==================== */
.big-btn{ font-family:'Bungee',cursive; font-size:21px; letter-spacing:1px; color:var(--ink);
  background:linear-gradient(180deg,#ff5ba3,var(--accent)); border:none; border-radius:15px; padding:15px 40px; cursor:pointer;
  box-shadow:0 5px 0 rgba(0,0,0,.4), 0 8px 22px rgba(0,0,0,.4); width:min(74vw,300px); position:relative; transition:transform .05s, box-shadow .05s; }
.big-btn:active{ transform:translateY(4px); box-shadow:0 1px 0 rgba(0,0,0,.4), 0 3px 10px rgba(0,0,0,.4); }
.big-btn.ghost{ color:var(--paper); background:rgba(255,255,255,.06); box-shadow:0 4px 0 rgba(0,0,0,.35); border:1px solid var(--line); }
.text-btn{ background:none; border:none; color:var(--muted); font-size:13px; cursor:pointer; padding:8px; letter-spacing:2px; text-transform:uppercase; }
.text-btn:active{ color:var(--paper); }

/* ==================== panels ==================== */
.panel{ position:fixed; inset:0; z-index:45; display:flex; align-items:center; justify-content:center; background:rgba(6,4,14,.82); backdrop-filter:blur(8px); padding:16px; overflow-y:auto; }
.panel-inner{ width:min(94vw,440px); background:var(--panel); border:1px solid var(--line); border-radius:24px; padding:22px 20px calc(env(safe-area-inset-bottom,0px) + 18px);
  display:flex; flex-direction:column; align-items:center; gap:14px; box-shadow:0 20px 60px rgba(0,0,0,.55); max-height:96vh; }
.panel-inner.wide{ width:min(96vw,560px); }
.kicker{ color:var(--accent2); letter-spacing:4px; font-size:12px; text-transform:uppercase; }
.sheet-btns{ display:flex; flex-direction:column; gap:10px; width:100%; align-items:center; }
.foot{ font-size:11px; color:var(--muted); } .foot a{ color:var(--muted); }
.fine{ font-size:11px; color:var(--muted); text-align:center; }
.setRow{ display:grid; grid-template-columns:1fr 1fr; gap:8px; width:100%; }
.tog{ font-family:'Chivo Mono',monospace; font-size:12px; letter-spacing:1px; padding:11px 8px; border-radius:12px; border:1px solid var(--line); background:rgba(0,0,0,.2); color:var(--muted); cursor:pointer; text-align:center; }
.tog.on{ color:var(--ink); background:var(--accent2); border-color:var(--accent2); font-weight:700; }

/* level select */
.lv-head{ display:flex; align-items:center; justify-content:space-between; width:100%; }
.lv-stats{ font-size:13px; color:var(--muted); }
.lv-stats span{ color:var(--accent2); }
#lvGrid{ display:flex; flex-direction:column; gap:14px; width:100%; }
.lv-block{ }
.lv-block .bt{ font-family:'Chivo Mono',monospace; font-size:11px; letter-spacing:2px; text-transform:uppercase; color:var(--muted); margin-bottom:6px; display:flex; justify-content:space-between; }
.lv-row{ display:grid; grid-template-columns:repeat(5,1fr); gap:8px; }
.lv-cell{ aspect-ratio:1; border-radius:12px; border:1px solid var(--line); background:rgba(0,0,0,.25); position:relative; cursor:pointer;
  display:flex; align-items:center; justify-content:center; font-family:'Bungee',cursive; font-size:17px; color:var(--paper); overflow:hidden; }
.lv-cell:active{ transform:scale(.94); }
.lv-cell .tint{ position:absolute; inset:0; opacity:.22; }
.lv-cell .n{ position:relative; z-index:1; }
.lv-cell.locked{ color:var(--muted); opacity:.5; cursor:default; }
.lv-cell.locked::after{ content:'🔒'; position:absolute; font-size:13px; z-index:2; }
.lv-cell.locked .n{ visibility:hidden; }
.lv-cell .stx{ position:absolute; bottom:3px; left:0; right:0; text-align:center; font-size:8px; letter-spacing:1px; color:var(--accent); z-index:1; }
.lv-cell.cleared{ border-color:var(--accent); }

/* result */
#stars{ display:flex; gap:10px; font-size:44px; }
#stars .st{ color:rgba(255,255,255,.16); transition:color .3s, transform .3s; }
#stars .st.on{ color:var(--accent); text-shadow:0 0 18px var(--accent); transform:scale(1.12); }
#resScore{ font-size:15px; color:var(--muted); text-align:center; }
#resScore b{ color:var(--paper); font-size:26px; font-family:'Bungee',cursive; display:block; }
#card{ width:min(70vw,280px); height:auto; aspect-ratio:1; border-radius:16px; }

/* responsive */
@media (min-aspect-ratio:1.3/1){
  #scoreWrap{ font-size:min(6vh,54px); } #comboB{ top:calc(env(safe-area-inset-top,0px) + 7vh); font-size:min(3.4vh,30px); }
  #banner{ font-size:min(9vh,80px); }
}
@media (min-aspect-ratio:0.8/1) and (max-aspect-ratio:1.3/1){
  #scoreWrap{ font-size:6.5vw; } #comboB{ top:calc(env(safe-area-inset-top,0px) + 9vw); font-size:4vw; } #banner{ font-size:8vw; }
}
