:root {
  --pink: #ff1493; --orange: #ff6400; --yellow: #f0ff00; --green: #39ff14; --cyan: #00e1ff; --gold: #ffd700;
  --panel: #08080a; --panel2: #22222a;
  --font: "Arial Rounded MT Bold", "Trebuchet MS", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #000; color: #fff; font-family: var(--font); overflow: hidden;
  overscroll-behavior: none; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
#app { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; background: #000;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.hidden { display: none !important; }

/* HUD */
#hud { width: min(100vw, 560px); display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px 6px; font-size: clamp(16px, 4.6vw, 24px); font-weight: 900; letter-spacing: .02em;
  text-shadow: 0 2px 0 #1e0a3c, 0 0 12px rgba(255,255,255,.25); }
#hudScore { flex: 1; text-align: left; }
#hudSquishes { flex: 1; text-align: center; color: var(--gold); }
#hudCoins { flex: 1; text-align: right; color: var(--gold); }

/* Board */
#stage { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; min-height: 0; }
#boardwrap { position: relative; aspect-ratio: 8 / 10; width: min(100vw, calc((100dvh - 120px) * 0.8), 560px);
  background: #000; touch-action: none; }
#board { position: absolute; inset: 0; overflow: hidden; border-radius: 4px; }
#fx { position: absolute; inset: 0; pointer-events: none; z-index: 40; }

.blk { position: absolute; width: 12.5%; height: 10%; transition: top calc(.38s * var(--speed, 1)) cubic-bezier(.3, 1.45, .5, 1); z-index: 2; }
.blk.pressed { z-index: 8; }
.wob { position: absolute; inset: 0; will-change: transform; }
.body { position: absolute; inset: 1px; border-radius: 7%; background: var(--col); transform-origin: 50% 100%;
  will-change: transform; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.body::before { content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.07); }
.body .core { position: absolute; left: 17%; top: 17%; width: 66%; height: 66%; border-radius: 50%;
  background: color-mix(in srgb, var(--col) 45%, #fff); opacity: .4; animation: pulse var(--pd, 1.2s) ease-in-out infinite alternate; }
.body .glow { position: absolute; left: 10%; bottom: 6%; width: 80%; height: 22%; border-radius: 50%;
  background: color-mix(in srgb, var(--col) 65%, #fff); opacity: .5; }
.body .streak { position: absolute; left: 10%; top: 7%; width: 62%; height: 30%; border-radius: 50%; background: #fff; opacity: .22; }
.body .glint { position: absolute; left: 16%; top: 13%; width: 20%; height: 12%; border-radius: 50%; background: #fff; opacity: .92; }
@keyframes pulse { from { opacity: .18; } to { opacity: .45; } }
.c1 { --col: var(--k1, #ff1493); } .c2 { --col: var(--k2, #ff6400); } .c3 { --col: var(--k3, #f0ff00); }
.c4 { --col: var(--k4, #39ff14); } .c5 { --col: var(--k5, #00e1ff); }

/* squeeze details (curled-up sides, creases) */
.wing { position: absolute; width: 34%; height: 17%; bottom: 40%; border-radius: 50%; opacity: 0; z-index: 3;
  background: linear-gradient(#fff, var(--col)); pointer-events: none; }
.wing.l { left: -8%; transform-origin: 80% 70%; } .wing.r { right: -8%; transform-origin: 20% 70%; }
.crease { position: absolute; bottom: 1%; width: 2.6%; height: 42%; border-radius: 50%; opacity: 0; z-index: 3; pointer-events: none;
  -webkit-mask-image: linear-gradient(transparent, #000 50%, transparent); mask-image: linear-gradient(transparent, #000 50%, transparent); }
.crease.dark { background: #000; } .crease.light { background: #fff; }

.bonusicon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: min(7vw, 38px); z-index: 6; pointer-events: none; }
.particle { position: absolute; border-radius: 50%; pointer-events: none; }
.popup { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); white-space: nowrap; font-weight: 900;
  font-size: clamp(18px, 6vw, 34px); text-shadow: 0 2px 0 #1e0a3c, 0 0 10px rgba(0,0,0,.6); pointer-events: none; z-index: 45; }
.cellpopup { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; font-weight: 900; color: #ffeb78;
  font-size: clamp(13px, 3.8vw, 20px); text-shadow: 0 2px 0 #1e0a3c; pointer-events: none; z-index: 46; }

/* Panels */
.panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(92vw, 420px); max-height: 92dvh;
  overflow: auto; background: var(--panel); border-radius: 22px; padding: 20px 18px; display: flex; flex-direction: column; gap: 10px;
  align-items: center; text-align: center; box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 20px 60px rgba(0,0,0,.7); z-index: 60; }
.title { margin: 0; font-size: clamp(34px, 11vw, 52px); font-weight: 900; color: var(--pink); letter-spacing: .02em;
  text-shadow: 0 3px 0 #1e0a3c, 0 0 18px rgba(255,20,147,.5); }
.title.gold { color: var(--gold); font-size: clamp(28px, 9vw, 40px); text-shadow: 0 3px 0 #3c2a00; }
.blurb { margin: 0; font-size: 14px; line-height: 1.35; color: #e8e2ff; }
.stats { margin: 0; font-size: 17px; font-weight: 800; white-space: pre-line; line-height: 1.5; }
.stats.small { font-size: 14px; } .stats.green { color: var(--green); }
.big { margin: 0; font-size: 34px; font-weight: 900; }
.foot { margin: 2px 0 0; font-size: 12px; color: #9a94b8; } .foot a { color: #b9b2e0; }
.btn { width: 100%; padding: 14px 10px; border: 0; border-radius: 14px; font-family: var(--font); font-weight: 900; font-size: 20px;
  letter-spacing: .03em; color: #08080a; cursor: pointer; background: #fff; box-shadow: 0 4px 0 rgba(0,0,0,.45); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.45); }
.btn.green { background: var(--green); } .btn.gold { background: var(--gold); } .btn.pink { background: var(--pink); color: #fff; }
.btn.small { font-size: 15px; padding: 11px 8px; }
.row { display: flex; gap: 10px; width: 100%; } .row .btn { flex: 1; }

/* Goals */
.bar { width: 100%; height: 12px; border-radius: 99px; background: var(--panel2); overflow: hidden; flex: none; }
.bar > i { display: block; height: 100%; width: 0; background: var(--green); border-radius: 99px; transition: width .4s; }
#goalsList { width: 100%; max-height: min(48dvh, 420px); overflow: auto; display: flex; flex-direction: column; gap: 6px; text-align: left;
  -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.hdr { font-size: 16px; font-weight: 900; color: var(--gold); padding: 6px 2px 0; }
.hdr.on { color: var(--green); } .hdr.off { color: #bdb3e6; }
.goal { background: var(--panel2); border-radius: 12px; padding: 8px 10px 9px; flex: none; }
.goal .t { display: flex; justify-content: space-between; gap: 8px; font-size: 14.5px; font-weight: 800; }
.goal.done .t span:first-child { color: var(--green); } .goal .t span:last-child { color: var(--gold); white-space: nowrap; }
.goal .bar { height: 9px; margin-top: 6px; background: #0b0b10; }
.goal .bar > i { background: var(--pink); } .goal.done .bar > i { background: var(--green); } .goal.chest .bar > i { background: var(--gold); }
.helptext { text-align: left; font-size: 14.5px; line-height: 1.4; } .helptext p { margin: 0 0 8px; }

/* Toasts */
#toasts { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(94vw, 460px);
  display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; z-index: 90; }
.toast { background: rgba(20, 16, 40, .96); border: 1px solid rgba(255,255,255,.2); border-radius: 12px; padding: 9px 14px; font-weight: 800;
  font-size: 14px; text-align: center; box-shadow: 0 6px 20px rgba(0,0,0,.5); }

/* Jackpot */
.jp-flash { position: fixed; inset: 0; background: #fff0a0; z-index: 70; pointer-events: none; }
.jp-bulb { position: fixed; width: 16px; height: 16px; border-radius: 50%; z-index: 72; pointer-events: none; border: 2px solid #fff; }
.jp-coin { position: fixed; top: -60px; z-index: 74; pointer-events: none; }
.jp-banner { position: fixed; left: 50%; top: 40%; z-index: 80; transform: translate(-50%, -50%); text-align: center; pointer-events: none;
  width: 94vw; max-width: 720px; font-weight: 900; text-shadow: 0 4px 0 #461400, 0 0 24px rgba(255,200,0,.8); }
.jp-banner .a { font-size: clamp(40px, 13vw, 96px); color: var(--gold); line-height: 1; -webkit-text-stroke: 3px #461400; paint-order: stroke fill; }
.jp-banner .b { font-size: clamp(20px, 6vw, 40px); margin-top: 6px; -webkit-text-stroke: 2px #461400; paint-order: stroke fill; }
.jp-banner .c { font-size: clamp(34px, 10vw, 70px); color: var(--green); margin-top: 4px; -webkit-text-stroke: 3px #052a00; paint-order: stroke fill; }

/* ======================= DELUXE: background, frenzy, boosters, shop ======================= */
/* Reactive background (behind everything; content wrappers sit above via z-index:1) */
#bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: #000;
  --bg1: #2a0a4a; --bg2: #06203a; }
#bg i { position: absolute; display: block; }
#bg .bg-a, #bg .bg-b { width: 150vmax; height: 150vmax; border-radius: 50%; filter: blur(70px); will-change: transform; }
#bg .bg-a { left: -30vmax; top: -40vmax; opacity: .55; background: radial-gradient(circle, var(--bg1), transparent 62%); animation: drift1 19s ease-in-out infinite alternate; }
#bg .bg-b { right: -30vmax; bottom: -40vmax; left: auto; opacity: .5; background: radial-gradient(circle, var(--bg2), transparent 62%); animation: drift2 24s ease-in-out infinite alternate; }
#bg .bg-stars { inset: 0; width: 100%; height: 100%; opacity: .5;
  background-image: radial-gradient(1.5px 1.5px at 20% 30%, #fff8, transparent), radial-gradient(1.5px 1.5px at 70% 60%, #fff6, transparent),
    radial-gradient(1px 1px at 40% 80%, #fff7, transparent), radial-gradient(1.5px 1.5px at 85% 20%, #fff6, transparent),
    radial-gradient(1px 1px at 55% 15%, #fff6, transparent), radial-gradient(1.5px 1.5px at 10% 70%, #fff7, transparent),
    radial-gradient(1px 1px at 92% 85%, #fff6, transparent), radial-gradient(1px 1px at 33% 50%, #fff5, transparent);
  animation: twinkle 4s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(14vmax, 10vmax) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-12vmax, -8vmax) scale(1.2); } }
@keyframes twinkle { from { opacity: .35; } to { opacity: .65; } }
#bg.t-night  { --bg1: #2a0a4a; --bg2: #06203a; }
#bg.t-aurora { --bg1: #0a5a3a; --bg2: #103a7a; }
#bg.t-lava   { --bg1: #5a0a1e; --bg2: #6a2e06; }
#bg.t-ocean  { --bg1: #063a5a; --bg2: #0a6a6a; }
#bg.t-candy  { --bg1: #6a1a4a; --bg2: #2a2a7a; }

#hud, #frenzy, #stage, #boosterbar { position: relative; z-index: 1; }
#app { background: transparent; }

/* Frenzy meter */
#frenzy { width: min(92vw, 520px); margin: 0 auto 2px; height: 15px; border-radius: 99px; background: rgba(255,255,255,.08);
  overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
#frenzyFill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 99px;
  background: linear-gradient(90deg, var(--pink), var(--orange), var(--yellow)); transition: width .22s ease-out; }
#frenzyLabel { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 900; letter-spacing: .1em; text-shadow: 0 1px 2px rgba(0,0,0,.8); }
#frenzy.on { box-shadow: 0 0 20px var(--yellow), inset 0 0 0 1px #fff; }
#frenzy.on #frenzyFill { background: linear-gradient(90deg, #fff, var(--yellow), var(--pink), var(--cyan), #fff); background-size: 50px 100%;
  animation: frenzyflow .5s linear infinite; }
@keyframes frenzyflow { to { background-position: 50px 0; } }

/* Frenzy global state */
#app.frenzy .body { filter: brightness(1.28) saturate(1.45); }
#app.frenzy #bg .bg-a, #app.frenzy #bg .bg-b { animation-duration: 4s; opacity: .85; }
#app.frenzy #bg::after { content: ""; position: absolute; inset: 0; mix-blend-mode: screen;
  background: linear-gradient(130deg, rgba(255,20,147,.3), rgba(0,225,255,.26) 40%, rgba(240,255,0,.28) 70%, rgba(57,255,20,.28));
  animation: frenzyhue 1.1s linear infinite; }
@keyframes frenzyhue { to { filter: hue-rotate(360deg); } }
.frenzy-banner { position: fixed; left: 50%; top: 32%; transform: translate(-50%,-50%); z-index: 80; pointer-events: none;
  font-size: clamp(34px, 11vw, 80px); font-weight: 900; color: var(--yellow); text-align: center;
  -webkit-text-stroke: 3px #3c1400; paint-order: stroke fill; text-shadow: 0 0 30px rgba(255,210,0,.9); white-space: nowrap; }

/* Booster bar */
#boosterbar { width: min(100vw, 560px); display: flex; gap: 7px; padding: 6px 12px calc(6px + env(safe-area-inset-bottom)); }
.booster { flex: 1; background: rgba(34,34,42,.82); border: 1px solid rgba(255,255,255,.14); border-radius: 13px;
  padding: 7px 3px 5px; display: flex; flex-direction: column; align-items: center; gap: 1px; cursor: pointer; color: #fff;
  font-family: var(--font); line-height: 1.05; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.booster .ic { font-size: min(7vw, 25px); }
.booster .nm { font-size: 9.5px; font-weight: 800; opacity: .85; }
.booster .ct { font-size: 11px; font-weight: 900; color: var(--gold); }
.booster.empty .ct { color: #9a94b8; font-size: 10px; }
.booster:active { transform: translateY(2px); }
.booster.armed { background: var(--pink); border-color: #fff; box-shadow: 0 0 16px var(--pink); transform: translateY(-2px); }
.booster.flash { animation: boosterflash .5s ease-out; }
@keyframes boosterflash { 0% { box-shadow: 0 0 0 0 var(--green); } 100% { box-shadow: 0 0 0 14px transparent; } }
#armhint { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  background: rgba(20,16,40,.95); border: 1px solid rgba(255,255,255,.25); border-radius: 12px; padding: 7px 14px; font-weight: 800;
  font-size: 13px; pointer-events: none; box-shadow: 0 6px 20px rgba(0,0,0,.5); }

/* Shop */
#shopList { width: 100%; max-height: min(58dvh, 470px); overflow: auto; display: flex; flex-direction: column; gap: 7px; text-align: left;
  -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.shopitem { display: flex; align-items: center; gap: 10px; background: var(--panel2); border-radius: 12px; padding: 8px 10px; }
.shopitem .ic { font-size: 23px; width: 28px; text-align: center; flex: none; }
.shopitem .mid { flex: 1; min-width: 0; }
.shopitem .nm { font-weight: 800; font-size: 14px; }
.shopitem .ds { font-size: 11px; color: #b9b2e0; line-height: 1.25; }
.shopitem .buy { border: 0; border-radius: 10px; padding: 9px 11px; font-weight: 900; font-family: var(--font); background: var(--gold);
  color: #08080a; cursor: pointer; white-space: nowrap; font-size: 13px; flex: none; min-width: 70px; }
.shopitem .buy:active { transform: translateY(2px); }
.shopitem .buy.owned { background: #0b0b10; color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.shopitem .buy.active { background: var(--green); color: #052a00; }
.shopitem .buy.cant { opacity: .45; }
.swatch { display: flex; gap: 3px; margin-top: 4px; }
.swatch i { width: 13px; height: 13px; border-radius: 3px; display: block; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
