:root {
  --ink: #3b2352;
  --cream: #fff8ec;
  --cream2: #ffeccc;
  --pink: #ff6fa5;
  --pink2: #e84d8a;
  --orange: #ffad33;
  --orange2: #e5821a;
  --purple: #7a4fd0;
  --purple2: #5a34a8;
  --green: #5ccf6a;
  --green2: #3aa84a;
  --gold: #ffd23f;
  --shadow: 0 4px 0 rgba(59, 35, 82, .35);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2d1f4a; color: var(--ink);
  font-family: 'Fredoka', 'Trebuchet MS', system-ui, sans-serif; font-weight: 600;
  user-select: none; -webkit-user-select: none; touch-action: none; overscroll-behavior: none; }
#app { position: fixed; inset: 0; overflow: hidden; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#safe { position: absolute; visibility: hidden; padding: var(--sat) var(--sar) var(--sab) var(--sal); }
.hidden { display: none !important; }
button { font-family: inherit; font-weight: 700; color: inherit; cursor: pointer; border: 0; }
img { -webkit-user-drag: none; }
h2, h3, .lilita { font-family: 'Lilita One', 'Fredoka', sans-serif; font-weight: 400; letter-spacing: .5px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: 'Lilita One', sans-serif; font-weight: 400; font-size: 22px; letter-spacing: .5px;
  color: #fff; padding: 12px 26px; border-radius: 18px; min-width: 120px;
  background: linear-gradient(#ffbf4d, var(--orange2)); border: 3px solid var(--ink);
  box-shadow: 0 5px 0 var(--ink), inset 0 3px 0 rgba(255,255,255,.45);
  text-shadow: 0 2px 0 rgba(59,35,82,.55); transition: transform .08s; }
.btn:active, .btn.down { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink), inset 0 3px 0 rgba(255,255,255,.45); }
.btn.big { font-size: 40px; padding: 14px 54px; border-radius: 26px; background: linear-gradient(#7ee87f, var(--green2)); }
.btn.small { font-size: 16px; padding: 8px 14px; min-width: 0; border-radius: 14px; }
.btn.ghost { background: linear-gradient(#fff, #f1e3ff); color: var(--ink); text-shadow: none; }
.btn.gold { background: linear-gradient(#ffe27a, #f2b31c); color: var(--ink); text-shadow: none; }
.btn.pink { background: linear-gradient(#ff9cc4, var(--pink2)); }
.btn.purple { background: linear-gradient(#a27cf0, var(--purple2)); }
.btn[disabled], .btn.off { filter: grayscale(.8) brightness(.9); opacity: .7; }
.btn img { width: 22px; height: 22px; object-fit: contain; }
.link { background: none; text-decoration: underline; color: var(--purple2); font-size: 14px; padding: 0 4px; }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }

.rbtn { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(#fff, #ecdcff); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
  font-family: 'Lilita One'; font-size: 18px; color: var(--ink); }
.rbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.rbtn svg { width: 22px; height: 22px; fill: var(--ink); color: var(--ink); }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px 0 6px; border-radius: 20px;
  background: rgba(255, 248, 236, .96); border: 3px solid var(--ink); box-shadow: 0 3px 0 rgba(59,35,82,.6);
  font-family: 'Lilita One'; font-size: 20px; color: var(--ink); white-space: nowrap; }
.pill img { width: 28px; height: 28px; object-fit: contain; }
.pill .lbl { font-family: 'Fredoka'; font-size: 13px; font-weight: 700; opacity: .7; margin-left: 6px; }
.pill.bump { animation: bump .25s; }
.pill.gold { background: #fff3c4; }
@keyframes bump { 40% { transform: scale(1.18); } }
#pLives.hurt { animation: hurt .4s; }
@keyframes hurt { 25% { transform: translateX(-5px) rotate(-4deg); background: #ffb3b3; } 75% { transform: translateX(5px) rotate(4deg); background: #ffb3b3; } }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud > * { position: absolute; pointer-events: auto; }
#hudInfo { display: flex; gap: 8px; }
#hudCtl { display: flex; gap: 8px; }
#hudAbil { display: flex; gap: 10px; }
.lay-tb #hudInfo { top: calc(8px + var(--sat)); left: calc(8px + var(--sal)); }
.lay-tb #hudCtl { top: calc(8px + var(--sat)); right: calc(8px + var(--sar)); }
.lay-tb #hudAbil { bottom: calc(8px + var(--sab)); left: calc(8px + var(--sal)); }
.lay-tb #hudNext { bottom: calc(10px + var(--sab)); right: calc(8px + var(--sar)); }
.lay-side #hudInfo { top: calc(8px + var(--sat)); left: calc(8px + var(--sal)); flex-direction: column; align-items: flex-start; }
.lay-side #hudCtl { top: calc(8px + var(--sat)); right: calc(8px + var(--sar)); }
.lay-side #hudAbil { bottom: calc(8px + var(--sab)); left: calc(8px + var(--sal)); flex-direction: column; }
.lay-side #hudNext { bottom: calc(10px + var(--sab)); right: calc(8px + var(--sar)); }
.lay-side #hudNext #bNext { width: 92px; flex-direction: column; padding: 8px 6px; }
.lay-side .pill { height: 34px; font-size: 17px; }
.lay-side .pill img { width: 24px; height: 24px; }
.compact .pill { height: 32px; font-size: 16px; padding: 0 10px 0 4px; }
.compact .pill img { width: 22px; height: 22px; }
.compact .pill .lbl { display: none; }
.compact .rbtn { width: 40px; height: 40px; }
.compact .abil { width: 58px; height: 58px; }
.compact .abil .nm { display: none; }
.compact #hint { font-size: 13px; padding: 6px 10px; }
.compact #phazSay img { width: 56px; height: 56px; }
.compact #phazSay .bubble { font-size: 13px; }

.abil { position: relative; width: 70px; height: 70px; border-radius: 50%; padding: 0; overflow: visible;
  background: radial-gradient(circle at 50% 35%, #fff, #ffd9ea); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); }
#abLil { background: radial-gradient(circle at 50% 35%, #fff, #d4ecff); }
.abil img { position: absolute; left: 50%; top: 52%; width: 84%; height: 84%; object-fit: cover; object-position: 50% 8%; transform: translate(-50%, -50%); border-radius: 50%; }
.abil .cd { position: absolute; inset: -3px; width: calc(100% + 6px); height: calc(100% + 6px); transform: rotate(-90deg); pointer-events: none; }
.abil .cd circle { fill: rgba(40, 20, 60, .55); stroke: none; }
.abil .nm { position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 11px; font-weight: 700;
  background: var(--ink); color: #fff; padding: 1px 7px; border-radius: 8px; }
.abil .key { position: absolute; top: -4px; right: -4px; font-size: 10px; width: 18px; height: 18px; border-radius: 50%; background: var(--cream); border: 2px solid var(--ink); display: grid; place-items: center; }
@media (hover: none) { .abil .key, .key { display: none !important; } }
.abil.ready { animation: ready 1.2s ease-in-out infinite; }
.abil.armed { outline: 4px solid var(--gold); outline-offset: 2px; }
@keyframes ready { 50% { box-shadow: 0 4px 0 var(--ink), 0 0 0 6px rgba(255, 210, 63, .7); } }

#bNext { position: relative; display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 8px 18px; border-radius: 22px;
  background: linear-gradient(#7ee87f, var(--green2)); border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink), inset 0 3px 0 rgba(255,255,255,.45);
  color: #fff; text-shadow: 0 2px 0 rgba(59,35,82,.5); }
#bNext:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
#bNext .lbl { font-family: 'Lilita One'; font-size: 21px; }
#bNext .sub { font-size: 12px; opacity: .95; }
#bNext .prev { display: flex; gap: 2px; }
#bNext .prev img { width: 26px; height: 26px; object-fit: contain; filter: drop-shadow(0 1px 0 rgba(0,0,0,.4)); }
#bNext.busy { background: linear-gradient(#b9a6d9, #8a74b5); }
#bNext.busy .prev { display: none; }
#bNext .ring { position: absolute; inset: -3px; width: calc(100% + 6px); height: calc(100% + 6px); pointer-events: none; overflow: visible; }
#bNext .ring rect { fill: none; stroke: var(--gold); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 100 200; stroke-dashoffset: 100; }
#bNext.glow { animation: glow 1s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 5px 0 var(--ink), 0 0 0 8px rgba(255, 210, 63, .8); transform: scale(1.04); } }
.lay-tb #bNext { flex-direction: row; }

#bossBar { left: 50%; transform: translateX(-50%); top: calc(64px + var(--sat)); width: min(420px, 70vw); text-align: center; pointer-events: none; }
.lay-side #bossBar { top: calc(8px + var(--sat)); }
#bossBar .bname { font-family: 'Lilita One'; color: #fff; font-size: 16px; text-shadow: 0 2px 0 var(--ink), 0 0 6px var(--ink); }
#bossBar .btrack { height: 14px; border-radius: 8px; border: 3px solid var(--ink); background: #fff; overflow: hidden; }
#bossBar .bfill { height: 100%; width: 0; background: linear-gradient(90deg, #ffd36b, #ff6fa5); transition: width .15s; }

#hint { left: 50%; top: calc(64px + var(--sat)); transform: translateX(-50%); max-width: min(520px, 86vw); text-align: center;
  background: var(--cream); border: 3px solid var(--ink); border-radius: 16px; padding: 8px 14px; font-size: 16px; box-shadow: var(--shadow);
  pointer-events: none; animation: hintIn .35s ease-out; }
.lay-side #hint { top: auto; bottom: calc(10px + var(--sab)); }
@keyframes hintIn { from { transform: translate(-50%, -12px); opacity: 0; } }

/* ---------- popups (build menu, tower info) ---------- */
#popup { position: absolute; z-index: 20; background: var(--cream); border: 3px solid var(--ink); border-radius: 18px;
  box-shadow: 0 6px 0 rgba(59,35,82,.5); padding: 8px; max-width: calc(100vw - 16px); animation: popIn .16s ease-out; }
@keyframes popIn { from { transform: scale(.85); opacity: 0; } }
#popup .ptitle { font-family: 'Lilita One'; font-size: 18px; line-height: 1.1; }
#popup .pdesc { font-size: 13px; font-weight: 600; opacity: .85; margin: 2px 0 6px; max-width: 300px; }
#popup .grid { display: grid; grid-template-columns: repeat(4, 64px); gap: 6px; }
#popup .tb { position: relative; width: 64px; height: 72px; border-radius: 14px; background: linear-gradient(#fff, #f3e6ff); border: 2px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink); padding: 2px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; }
#popup .tb img.t { width: 52px; height: 46px; object-fit: contain; }
#popup .tb .c { display: flex; align-items: center; gap: 2px; font-family: 'Lilita One'; font-size: 14px; }
#popup .tb .c img { width: 14px; height: 14px; }
#popup .tb.poor { filter: grayscale(.9); opacity: .6; }
#popup .tb.sel { background: linear-gradient(#fff6c2, #ffd76a); transform: translateY(-2px); }
#popup .tb.sel::after { content: '✓ tap again'; position: absolute; top: -14px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 10px; background: var(--ink); color: #fff; border-radius: 6px; padding: 0 5px; }
#popup .tb .key { position: absolute; top: 1px; left: 4px; font-size: 10px; opacity: .55; }
#popup .row2 { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
#popup .row2 .btn { font-size: 15px; padding: 7px 10px; border-radius: 12px; min-width: 0; flex: 1; }
#popup .stats { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; margin: 4px 0; }
#popup .stats b { font-family: 'Lilita One'; font-weight: 400; }
#popup .lvstars { color: var(--orange2); font-size: 16px; letter-spacing: 1px; }
#popup .perk { font-size: 12px; background: #fff0c9; border-radius: 8px; padding: 3px 6px; margin: 4px 0; max-width: 300px; }
#popup .head { display: flex; gap: 8px; align-items: center; }
#popup .head img { width: 46px; height: 46px; object-fit: contain; }
#popup .xp { height: 8px; background: #eee; border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; margin: 4px 0; }
#popup .xp div { height: 100%; background: linear-gradient(90deg, #7fd7ff, #7a4fd0); }

/* ---------- Phazmoar speech ---------- */
#phazSay { position: absolute; z-index: 15; left: 50%; top: calc(56px + var(--sat)); transform: translateX(-50%); display: flex; align-items: center; gap: 4px;
  pointer-events: none; animation: phazIn .45s cubic-bezier(.2, 1.6, .5, 1); max-width: 94vw; }
.lay-side #phazSay { top: calc(6px + var(--sat)); }
.lay-tb.has-boss #phazSay { top: calc(106px + var(--sat)); }
.lay-side.has-boss #phazSay { top: calc(52px + var(--sat)); }
#phazSay img { width: 74px; height: 74px; object-fit: contain; filter: drop-shadow(0 3px 0 rgba(0,0,0,.3)); animation: wobble 1s ease-in-out infinite; }
#phazSay .bubble { position: relative; background: #f4ebff; border: 3px solid var(--purple2); border-radius: 16px; padding: 8px 12px; font-size: 15px; max-width: 340px; box-shadow: 0 4px 0 rgba(59,35,82,.4); }
#phazSay .bubble::before { content: ''; position: absolute; left: -12px; top: 50%; margin-top: -8px; border: 8px solid transparent; border-right: 12px solid var(--purple2); border-left: 0; }
#phazSay.out { animation: phazOut .3s ease-in forwards; }
@keyframes phazIn { from { transform: translate(-50%, -120px); } }
@keyframes phazOut { to { transform: translate(-50%, -160px); opacity: 0; } }
@keyframes wobble { 50% { transform: rotate(-6deg) translateY(-3px); } }

/* ---------- banners & flashes ---------- */
#banner { position: absolute; left: 0; right: 0; top: 38%; text-align: center; pointer-events: none; z-index: 12; }
#banner .b { display: inline-block; font-family: 'Lilita One'; font-size: clamp(34px, 8vw, 72px); color: #fff; letter-spacing: 1px;
  -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 6px 0 var(--ink); animation: banner 2s ease-in-out forwards; }
#banner .b small { display: block; font-size: .42em; -webkit-text-stroke: 2px var(--ink); color: var(--gold); }
#banner .b.boss { color: #ffb3d4; }
@keyframes banner { 0% { transform: scale(.2) rotate(-8deg); opacity: 0; } 15% { transform: scale(1.12) rotate(2deg); opacity: 1; } 25% { transform: scale(1) rotate(0); } 80% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.1) translateY(-30px); opacity: 0; } }
#flash { position: absolute; inset: 0; pointer-events: none; z-index: 11; opacity: 0; }
#flash.red { background: radial-gradient(ellipse at center, transparent 50%, rgba(255, 40, 80, .5)); animation: flash .5s; }
#flash.rush { background: radial-gradient(ellipse at center, transparent 45%, rgba(255, 180, 230, .55)); opacity: 1; transition: opacity .4s; }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- screens ---------- */
.screen { position: absolute; inset: 0; z-index: 30; display: none; }
.screen.show { display: flex; }
.screen.dim { background: rgba(30, 15, 50, .62); align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.card { background: var(--cream); border: 4px solid var(--ink); border-radius: 26px; box-shadow: 0 8px 0 var(--ink); padding: 18px 22px; text-align: center;
  display: flex; flex-direction: column; gap: 12px; align-items: center; max-width: 420px; width: 100%; max-height: calc(100% - 8px); overflow: auto; }
.card h3 { margin: 0; font-size: 34px; color: var(--purple2); }
.card .row, .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.card .col { display: flex; flex-direction: column; gap: 10px; }
.pop { animation: cardPop .4s cubic-bezier(.2, 1.5, .5, 1); }
@keyframes cardPop { from { transform: scale(.4) rotate(-6deg); opacity: 0; } }

#scrLoading { background: radial-gradient(circle at 50% 40%, #7a4fd0, #2d1f4a); align-items: center; justify-content: center; }
.loadbox { text-align: center; color: #fff; }
.loadbox img.spin { width: 110px; animation: bounce .6s ease-in-out infinite alternate; }
@keyframes bounce { to { transform: translateY(-14px) rotate(6deg); } }
.lbar { width: 220px; height: 16px; border: 3px solid #fff; border-radius: 10px; margin: 12px auto 8px; overflow: hidden; }
#lfill { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--pink)); transition: width .2s; }

#scrTitle { align-items: stretch; justify-content: center; }
.titlebg { position: absolute; inset: 0; background: #87c6ff url(../assets/img/title_wide.jpg) center/cover no-repeat; }
@media (max-aspect-ratio: 1/1) { .titlebg { background-image: url(../assets/img/title_tall.jpg); background-position: center bottom; } }
.titlebg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(40,20,80,.0) 55%, rgba(40,20,80,.35)); }
.titlefg { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: space-between; width: 100%;
  padding: calc(14px + var(--sat)) 16px calc(22px + var(--sab)); gap: 12px; }
.titlefg .logo { width: min(560px, 82vw); max-height: 38vh; object-fit: contain; filter: drop-shadow(0 6px 0 rgba(59,35,82,.45)); animation: logoIn 1s cubic-bezier(.2, 1.5, .5, 1), floaty 3.5s 1s ease-in-out infinite; }
@keyframes logoIn { from { transform: scale(.3) rotate(-10deg); opacity: 0; } }
@keyframes floaty { 50% { transform: translateY(-8px) rotate(-1deg); } }
.titlefg .row { margin-top: 8px; }
.titlefg > div:last-child { display: flex; flex-direction: column; align-items: center; }
@media (max-height: 500px) { .titlefg .logo { max-height: 46vh; } .btn.big { font-size: 30px; padding: 10px 40px; } }

.panelwrap { margin: auto; width: min(980px, 100%); height: 100%; display: flex; flex-direction: column; padding: calc(10px + var(--sat)) calc(12px + var(--sar)) calc(10px + var(--sab)) calc(12px + var(--sal)); }
#scrLevels, #scrShop, #scrPedia { background: radial-gradient(circle at 50% 0%, #a983ff, #4b2f8c 70%); }
#scrLevels::before, #scrShop::before, #scrPedia::before { content: ''; position: absolute; inset: 0; opacity: .12; pointer-events: none;
  background-image: radial-gradient(#fff 2px, transparent 2.5px); background-size: 28px 28px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: relative; }
.topbar h2 { margin: 0; color: #fff; font-size: clamp(22px, 5vw, 34px); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink); text-align: center; flex: 1; }
.panelwrap > .sub { color: #fff; text-align: center; font-size: 14px; margin: 6px 0; position: relative; }
.panelwrap > .sub .link { color: #ffe27a; }
#levelList, #shopList, #pediaList { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 4px 20px; position: relative; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
#levelList { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; align-content: start; }
.lvl { position: relative; background: var(--cream); border: 4px solid var(--ink); border-radius: 22px; box-shadow: 0 6px 0 var(--ink); overflow: hidden; text-align: left; padding: 0; display: flex; flex-direction: column; }
.lvl canvas { width: 100%; aspect-ratio: 16/9; display: block; border-bottom: 3px solid var(--ink); }
.lvl .info { padding: 8px 12px 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lvl .nm { font-family: 'Lilita One'; font-size: 20px; line-height: 1.05; }
.lvl .meta { font-size: 12px; opacity: .75; }
.lvl .st { display: flex; gap: 1px; }
.lvl .st img { width: 24px; height: 24px; }
.lvl .st img.off { filter: grayscale(1) brightness(1.3); opacity: .35; }
.lvl .num { position: absolute; top: 8px; left: 8px; width: 36px; height: 36px; border-radius: 50%; background: var(--orange); border: 3px solid var(--ink); color: #fff; font-family: 'Lilita One'; font-size: 20px; display: grid; place-items: center; text-shadow: 0 2px 0 var(--ink); }
.lvl.locked canvas { filter: grayscale(1) brightness(.6) blur(1px); }
.lvl.locked::after { content: '🔒'; position: absolute; top: 28%; left: 50%; transform: translate(-50%, -50%); font-size: 46px; }
.lvl .endless { position: absolute; top: 8px; right: 8px; font-size: 13px; padding: 5px 10px; }
.lvl:not(.locked):active { transform: translateY(3px); }

#shopList { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; align-content: start; }
.up { background: var(--cream); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 5px 0 var(--ink); padding: 10px; display: flex; gap: 10px; align-items: center; }
.up > img { width: 52px; height: 52px; object-fit: contain; }
.up .tx { flex: 1; }
.up .tx b { font-family: 'Lilita One'; font-weight: 400; font-size: 18px; display: block; }
.up .tx span { font-size: 13px; opacity: .8; }
.up .pips { display: flex; gap: 3px; margin-top: 3px; }
.up .pips i { width: 14px; height: 8px; border-radius: 4px; background: #ddd; border: 1.5px solid var(--ink); }
.up .pips i.on { background: var(--green); }
.up .btn { font-size: 16px; padding: 8px 10px; min-width: 64px; }

#pediaList { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; align-content: start; }
.pd { background: var(--cream); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 5px 0 var(--ink); padding: 8px; text-align: center; }
.pd img.m { width: 90px; height: 90px; object-fit: contain; }
.pd b { font-family: 'Lilita One'; font-weight: 400; display: block; font-size: 17px; }
.pd p { font-size: 12px; margin: 4px 0; opacity: .85; }
.pd .likes { justify-content: center; }
.pd.unk img.m { filter: brightness(0) opacity(.35); }

.likes { display: flex; gap: 8px; }
.like { display: flex; align-items: center; gap: 4px; background: #ffe0ef; border: 2px solid var(--ink); border-radius: 12px; padding: 3px 8px; font-size: 13px; }
.like img { width: 24px; height: 24px; object-fit: contain; }
.like.meh { background: #e8e8ef; }
.like:empty { display: none; }

#scrCard .card { overflow: visible; padding-top: 26px; }
#scrCard .card img#cardImg { width: 150px; height: 150px; object-fit: contain; animation: floaty 2s ease-in-out infinite; }
#scrCard h3 { font-size: 30px; }
#scrCard p { margin: 0; font-size: 16px; }
.cardtag { font-family: 'Lilita One'; background: var(--pink); color: #fff; padding: 4px 14px; border-radius: 12px; border: 3px solid var(--ink); margin-top: -44px; text-shadow: 0 2px 0 var(--ink); }

/* story */
#scrStory { background: #1d1233; flex-direction: column; }
.storyimg { position: absolute; inset: 0; background: center/cover no-repeat; transition: opacity .5s; }
.storyimg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 45%, rgba(20, 10, 40, .7)); }
.dlg { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 12px calc(12px + var(--sab)); display: flex; justify-content: center; }
.dlg .box { position: relative; width: min(760px, 100%); background: var(--cream); border: 4px solid var(--ink); border-radius: 22px; box-shadow: 0 6px 0 var(--ink); padding: 14px 18px 22px; min-height: 96px; z-index: 2; }
.dlg .who { position: absolute; top: -18px; left: 18px; font-family: 'Lilita One'; font-size: 18px; color: #fff; background: var(--purple); border: 3px solid var(--ink); border-radius: 12px; padding: 1px 12px; text-shadow: 0 2px 0 var(--ink); }
.dlg .who.big { background: #e64a4a; } .dlg .who.lil { background: #3f7fe0; } .dlg .who.nar { background: var(--orange2); }
.dlg .txt { font-size: clamp(16px, 2.6vw, 21px); line-height: 1.35; }
.dlg .tapnext { position: absolute; right: 14px; bottom: 4px; font-size: 12px; opacity: .6; animation: pulse 1s infinite; }
.dlg .por { position: absolute; bottom: calc(80px + var(--sab)); height: min(42vh, 300px); z-index: 1; transition: transform .3s, opacity .3s, filter .3s; filter: drop-shadow(0 6px 0 rgba(0,0,0,.3)); }
.dlg .por.left { left: max(2vw, calc(50% - 470px)); }
.dlg .por.right { right: max(2vw, calc(50% - 470px)); }
.dlg .por.dimmed { filter: brightness(.55) drop-shadow(0 6px 0 rgba(0,0,0,.3)); transform: scale(.92) translateY(10px); }
.dlg .por.hide { opacity: 0; }
.dlg .por.talk { animation: talk .5s ease-in-out infinite alternate; }
@keyframes talk { to { transform: translateY(-6px) rotate(-1deg); } }
.skip { position: absolute; top: calc(10px + var(--sat)); right: calc(10px + var(--sar)); z-index: 3; }
@media (max-height: 500px) { .dlg .por { height: 52vh; bottom: calc(70px + var(--sab)); } .dlg .box { min-height: 76px; padding: 10px 16px 18px; } }

/* results */
.result .stars { display: flex; gap: 6px; align-items: flex-end; }
.result .stars img { width: 64px; height: 64px; opacity: .15; filter: grayscale(1); transform: scale(.6); transition: all .35s cubic-bezier(.2, 1.8, .5, 1); }
.result .stars img:nth-child(2) { width: 80px; height: 80px; }
.result .stars img.on { opacity: 1; filter: none; transform: scale(1); }
.result .resimg { width: 120px; height: 120px; object-fit: contain; }
.result p { margin: 0; font-size: 16px; }
.toggles { justify-content: center; }

@media (max-aspect-ratio: 1/1) { .withimg .dlg .por { display: none; } }

/* ---------- upgrade preview ---------- */
#popup .gain { font-size: 12px; background: #e6f8e6; border: 2px solid #5ccf6a; border-radius: 8px; padding: 3px 7px; margin: 4px 0; max-width: 300px; }
#popup .gain b { font-family: 'Lilita One'; font-weight: 400; }
#popup .gain b.big { color: #2f9a3d; font-size: 14px; }
#banner .b img.bimg { width: 1.3em; height: 1.3em; object-fit: contain; vertical-align: middle; -webkit-text-stroke: 0; }
#pCrave img { width: 30px; height: 30px; animation: pulse 1s ease-in-out infinite; }
#flash.zap { background: rgba(160, 235, 255, .32); animation: zap .35s steps(3); }
@keyframes zap { 0% { opacity: 1; } 33% { opacity: .2; } 66% { opacity: .8; } 100% { opacity: 0; } }
#bResEndless { margin-top: -2px; }

/* ---------- NEON (Shibu Snack Attack) ---------- */
#app.neon { background: #050816; }
.neon .pill { background: rgba(8, 14, 40, .92); color: #bff8ff; border-color: #4ff3ff; box-shadow: 0 0 12px rgba(79, 243, 255, .55), 0 3px 0 #0a3a5a; }
.neon .pill .lbl { color: #ff8fe6; opacity: 1; }
.neon .rbtn { background: linear-gradient(#18224f, #0b1233); border-color: #4ff3ff; color: #bff8ff; box-shadow: 0 0 10px rgba(79,243,255,.5), 0 4px 0 #0a3a5a; }
.neon .rbtn svg { fill: #bff8ff; }
.neon .abil { border-color: #4ff3ff; box-shadow: 0 0 12px rgba(79,243,255,.6), 0 4px 0 #0a3a5a; }
.neon .abil .nm { background: #ff4fd8; }
.neon #bNext { background: linear-gradient(#ff6fe0, #b02fd0); border-color: #4ff3ff; box-shadow: 0 0 16px rgba(255,79,216,.6), 0 5px 0 #3a0a5a; }
.neon #bNext.busy { background: linear-gradient(#26306a, #151d48); }
.neon #banner .b { color: #4ff3ff; -webkit-text-stroke-color: #1a0a3a; text-shadow: 0 0 18px #4ff3ff, 0 6px 0 #ff4fd8; }
.neon #banner .b small { color: #ff8fe6; }
.neon #phazSay .bubble { background: #0d1538; color: #bff8ff; border-color: #4ff3ff; }
.neon #phazSay .bubble::before { border-right-color: #4ff3ff; }
.neon #bossBar .btrack { border-color: #4ff3ff; background: #0b1233; }
.neon #bossBar .bfill { background: linear-gradient(90deg, #4ff3ff, #ff4fd8); }
.neon #hint { background: #0d1538; color: #bff8ff; border-color: #4ff3ff; }

/* Shibu mode card on the level select */
.lvl.shibu { grid-column: 1 / -1; background: #0a1030; border-color: #4ff3ff; box-shadow: 0 0 22px rgba(79,243,255,.55), 0 6px 0 #ff4fd8; color: #bff8ff; }
.lvl.shibu canvas { aspect-ratio: 16/6; object-fit: cover; border-bottom-color: #4ff3ff; }
.lvl.shibu .nm { color: #4ff3ff; text-shadow: 0 0 10px #4ff3ff; font-size: 24px; }
.lvl.shibu .meta { color: #ff8fe6; opacity: 1; }
.lvl.shibu .num { background: #ff4fd8; width: auto; padding: 0 10px; border-radius: 14px; font-size: 14px; }
.lvl.shibu .dogs { position: absolute; left: 0; right: 0; top: 6%; display: flex; justify-content: center; align-items: flex-end; gap: 2%; pointer-events: none; height: 46%; }
.lvl.shibu .dogs img { height: 100%; object-fit: contain; filter: drop-shadow(0 0 10px rgba(79,243,255,.8)); animation: bounce .5s ease-in-out infinite alternate; }
.lvl.shibu .dogs img:nth-child(2) { height: 130%; animation-delay: .15s; }
.lvl.shibu .dogs img:nth-child(3) { height: 75%; animation-delay: .3s; }
.lvl.shibu.locked .dogs img { filter: brightness(0) drop-shadow(0 0 8px rgba(79,243,255,.9)); animation: none; }
.lvl.shibu.locked::after { content: '?'; color: #4ff3ff; font-family: 'Lilita One'; font-size: 64px; text-shadow: 0 0 16px #4ff3ff; }
.lvl.shibu .endless { background: linear-gradient(#ff6fe0, #b02fd0); }
.lvl .endless { font-size: 15px !important; padding: 7px 12px !important; }
#levelList { grid-auto-rows: max-content; }
.lvl > * { flex-shrink: 0; }
