:root {
  --ink: #1b1430; --card: rgba(255, 252, 245, 0.94); --accent: #ff5d8f; --accent2: #22c3ee;
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #bfe6f7; font-family: var(--font); color: var(--ink);
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

#labels, #popups { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.hlabel { position: absolute; left: 0; top: 0; white-space: nowrap; font-weight: 800; font-size: 13px; color: #fff;
  padding: 3px 8px 3px 4px; border-radius: 999px; background: rgba(20, 14, 40, 0.55); display: flex; align-items: center; gap: 5px;
  will-change: transform; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.hlabel i { font-style: normal; min-width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; color: #1b1430; }
.hlabel.me { background: rgba(20, 14, 40, 0.8); font-size: 14px; }
.hlabel.ghost { opacity: .45; }

.pop { position: absolute; left: 0; top: 0; font-weight: 900; color: #fff; font-size: 18px; pointer-events: none;
  text-shadow: 0 2px 0 rgba(0,0,0,.25), 0 0 12px rgba(0,0,0,.2); animation: rise .9s ease-out forwards; white-space: nowrap; }
.pop.big { font-size: 28px; color: #ffe066; }
.pop.lvl { font-size: 34px; color: #fff; -webkit-text-stroke: 1px rgba(0,0,0,.15); }
@keyframes rise { 0% { opacity: 0; translate: -50% 0; scale: .6; } 15% { opacity: 1; scale: 1.15; } 30% { scale: 1; }
  100% { opacity: 0; translate: -50% -70px; } }

#stick { position: fixed; left: 0; top: 0; border-radius: 50%; border: 3px solid rgba(255,255,255,.55); background: rgba(27,20,48,.12);
  opacity: 0; pointer-events: none; transition: opacity .15s; display: grid; place-items: center; }
#knob { width: 44%; height: 44%; border-radius: 50%; background: rgba(255,255,255,.8); box-shadow: 0 3px 10px rgba(0,0,0,.2); }

#hud { position: fixed; inset: 0; pointer-events: none; }
#timer { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); font-size: 30px; font-weight: 900;
  color: #fff; background: rgba(27,20,48,.6); padding: 4px 18px; border-radius: 14px; font-variant-numeric: tabular-nums; }
#timer.hurry { background: #ff4d6d; animation: pulse .5s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: translateX(-50%) scale(1.08); } }
#board { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 12px; min-width: 170px; background: rgba(27,20,48,.55); color: #fff;
  border-radius: 14px; padding: 8px 10px; font-size: 13px; font-weight: 700; }
#board .r { display: flex; gap: 6px; align-items: center; padding: 2px 0; }
#board .r.me { color: #ffe066; }
#board .r .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }
#board .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
#board .s { font-variant-numeric: tabular-nums; opacity: .9; }
#sizebox { position: absolute; bottom: max(16px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); text-align: center; color: #fff;
  background: rgba(27,20,48,.6); padding: 8px 16px 8px; border-radius: 16px; min-width: 200px; }
#sizeLabel { font-weight: 900; font-size: 20px; }
#sizeBar { height: 10px; border-radius: 6px; background: rgba(255,255,255,.2); margin: 5px 0 4px; overflow: hidden; }
#sizeBar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #22c3ee, #ff5d8f); border-radius: 6px; transition: width .2s; }
#eatCount { font-size: 12px; opacity: .85; font-weight: 700; }
#combo { position: absolute; right: 18px; top: 45%; font-weight: 900; font-size: 34px; color: #fff; text-align: right;
  text-shadow: 0 3px 0 rgba(0,0,0,.2); opacity: 0; transition: opacity .2s; }
#combo small { display: block; font-size: 14px; opacity: .9; }
#combo.on { opacity: 1; }
#combo.bump { animation: bump .18s ease-out; }
@keyframes bump { from { transform: scale(1.35); } to { transform: scale(1); } }
#banner { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); font-weight: 900; font-size: 26px; color: #fff;
  background: rgba(27,20,48,.7); padding: 10px 22px; border-radius: 16px; opacity: 0; transition: opacity .25s; white-space: nowrap; }
#banner.on { opacity: 1; }
#countdown { position: absolute; inset: 0; display: grid; place-items: center; font-size: 120px; font-weight: 900; color: #fff;
  text-shadow: 0 6px 0 rgba(0,0,0,.18); }
#countdown.go { animation: cd .7s ease-out; }
@keyframes cd { from { transform: scale(1.6); opacity: 0; } 30% { opacity: 1; transform: scale(1); } }

#topbtns { position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px; display: flex; gap: 8px; z-index: 5; }
button { font-family: var(--font); cursor: pointer; border: 0; }
.icon { width: 42px; height: 42px; border-radius: 12px; background: rgba(27,20,48,.6); color: #fff; font-size: 18px; font-weight: 900; }
.icon.off { opacity: .5; text-decoration: line-through; }

.screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: radial-gradient(ellipse at center, rgba(27,20,48,.15), rgba(27,20,48,.55)); z-index: 4; overflow-y: auto; }
.card { background: var(--card); border-radius: 26px; padding: 22px 26px; max-width: 520px; width: 100%; text-align: center;
  box-shadow: 0 20px 60px rgba(27,20,48,.35), inset 0 -4px 0 rgba(0,0,0,.06); animation: pop .35s cubic-bezier(.2,1.4,.4,1); }
.card.narrow { max-width: 320px; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.logo { margin: 0; font-size: 64px; font-weight: 900; letter-spacing: -2px; line-height: 1;
  background: linear-gradient(180deg, #2b1f52, #120c24); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo span { background: linear-gradient(90deg, #22c3ee, #ff5d8f); -webkit-background-clip: text; background-clip: text; }
.tag { margin: 8px 0 14px; font-size: 15px; opacity: .8; }
h2 { margin: 4px 0 10px; font-size: 30px; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 10px 0; }
.col { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.big { font-size: 22px; font-weight: 900; padding: 13px 30px; border-radius: 16px; color: #fff; background: linear-gradient(180deg, #ff6f9c, #f0457c);
  box-shadow: 0 5px 0 #b82c5b, 0 10px 20px rgba(240,69,124,.35); transition: transform .08s; }
.big.alt { background: linear-gradient(180deg, #3fd3f5, #13a8cf); box-shadow: 0 5px 0 #0b7b99, 0 10px 20px rgba(19,168,207,.3); }
.big:active, .small:active { transform: translateY(3px); }
.big small { display: block; font-size: 11px; font-weight: 700; opacity: .9; }
.small { font-size: 15px; font-weight: 800; padding: 8px 18px; border-radius: 12px; background: #ece6da; color: var(--ink); }
.league { font-weight: 800; font-size: 14px; margin: 6px 0; }
.league b { color: #f0457c; }
.skins-wrap { margin: 8px 0; }
.label { font-size: 12px; font-weight: 800; opacity: .6; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.skins { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.skin { width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; position: relative; box-shadow: inset 0 0 0 6px #1b1430; }
.skin.sel { border-color: #1b1430; transform: scale(1.1); }
.skin.locked { opacity: .35; cursor: not-allowed; }
.skin.locked::after { content: attr(data-need); position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%); font-size: 9px; font-weight: 800; white-space: nowrap; }
.how { text-align: left; font-size: 13px; background: rgba(27,20,48,.06); border-radius: 14px; padding: 10px 14px; margin: 16px 0 8px; line-height: 1.6; }
.how b { display: inline-block; min-width: 46px; color: #f0457c; }
.bests { font-size: 13px; font-weight: 700; opacity: .75; margin-top: 6px; }
.rankbig { font-size: 72px; font-weight: 900; line-height: 1; background: linear-gradient(90deg, #22c3ee, #ff5d8f); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.stats div { background: rgba(27,20,48,.06); border-radius: 12px; padding: 8px 4px; font-size: 12px; font-weight: 700; }
.stats b { display: block; font-size: 22px; }
.finalboard { font-size: 13px; text-align: left; max-width: 300px; margin: 8px auto; }
.finalboard .r { display: flex; gap: 8px; padding: 3px 8px; border-radius: 8px; align-items: center; }
.finalboard .r.me { background: #ffe9a8; font-weight: 800; }
.finalboard .dot { width: 10px; height: 10px; border-radius: 50%; }
.finalboard .n { flex: 1; }
.unlocks { font-weight: 800; color: #f0457c; min-height: 4px; font-size: 14px; }

@media (max-width: 560px) {
  .logo { font-size: 48px; }
  .card { padding: 18px 16px; }
  .big { font-size: 18px; padding: 11px 20px; }
  #board { font-size: 11px; min-width: 130px; padding: 6px 8px; }
  #board .r .n { max-width: 80px; }
  #timer { font-size: 22px; top: max(60px, env(safe-area-inset-top)); }
  #combo { font-size: 26px; }
}
@media (max-height: 520px) {
  .how { display: none; }
  .tag { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .card, #combo.bump, #countdown.go, #timer.hurry { animation: none !important; }
}
