:root {
  --ink: #1d2340; --cream: #fff8ea; --accent: #ff7a59; --accent2: #7c5cff; --sea: #2fb6e4;
  --font: "Baloo 2", "Fredoka", "Nunito", "Segoe UI Rounded", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9fdcf5; font-family: var(--font); color: var(--ink);
  user-select: none; -webkit-user-select: none; touch-action: none; overscroll-behavior: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* outlined game text */
.out, #timer, #score, #banner, .floater, #combo, .label, h1, h2, #lvlNum {
  text-shadow: 0 2px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink), 2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink), 0 5px 0 rgba(29,35,64,.35);
  color: #fff; font-weight: 800; letter-spacing: .5px;
}

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; zoom: var(--ui, 1); padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left)); }
#lvl { position: absolute; left: max(12px, env(safe-area-inset-left)); top: max(10px, env(safe-area-inset-top)); width: 58px; height: 58px; }
#lvl svg { width: 100%; height: 100%; transform: rotate(-90deg); filter: drop-shadow(0 3px 0 rgba(29,35,64,.35)); }
#lvl circle { fill: rgba(29,35,64,.55); stroke-width: 7; }
#lvl .track { stroke: rgba(255,255,255,.35); }
#lvl .fill { fill: none; stroke: #ffd54a; stroke-linecap: round; stroke-dasharray: 169.6; stroke-dashoffset: 169.6; transition: stroke-dashoffset .25s ease-out; }
#lvlNum { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; }
#lvl.pop { animation: pop .45s cubic-bezier(.2,1.6,.4,1); }
#scoreBox { position: absolute; left: calc(max(12px, env(safe-area-inset-left)) + 66px); top: max(12px, env(safe-area-inset-top)); }
#score { font-size: 26px; line-height: 1; }
#sizeName { font-size: 13px; font-weight: 800; color: #fff; opacity: .95; text-shadow: 0 1px 0 var(--ink), 1px 0 0 var(--ink), -1px 0 0 var(--ink), 0 -1px 0 var(--ink); margin-top: 4px; }
#timer { position: absolute; left: 50%; top: max(10px, env(safe-area-inset-top)); transform: translateX(-50%); font-size: 34px; }
#timer.low { color: #ffd0c4; animation: throb 1s infinite; }
#board { position: absolute; right: max(12px, env(safe-area-inset-right)); top: max(10px, env(safe-area-inset-top)); margin: 0; padding: 6px 8px; list-style: none;
  background: rgba(29,35,64,.42); border-radius: 12px; min-width: 140px; font-size: 13px; color: #fff; font-weight: 800; }
#board li { display: flex; gap: 6px; align-items: center; padding: 1px 0; transition: transform .25s; }
#board li .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(255,255,255,.7); }
#board li .nm { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 90px; }
#board li.me { color: #ffe27a; }
#board li.out2 { opacity: .5; }
#combo { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); font-size: 26px; opacity: 0; transition: opacity .2s; color: #ffe27a; white-space: nowrap; }
#combo.on { opacity: 1; }
#combo.bump { animation: bump .25s ease-out; }
.iconbtn { position: fixed; right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); width: 46px; height: 46px; border-radius: 50%;
  border: 0; background: rgba(29,35,64,.45); color: #fff; font-size: 22px; z-index: 30; cursor: pointer; zoom: var(--ui, 1); }

#banner { position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%) scale(0); font-size: clamp(34px, 9vw, 76px); pointer-events: none; white-space: nowrap; z-index: 20; text-align: center; }
#banner.show { animation: banner 1.1s cubic-bezier(.2,1.4,.4,1) forwards; }
#banner.count { animation: count .9s cubic-bezier(.2,1.6,.4,1) forwards; }
#banner small { display: block; font-size: .42em; margin-top: 4px; }

#labels, #floaters { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.label { position: absolute; left: 0; top: 0; font-size: calc(14px * var(--ui, 1)); white-space: nowrap; will-change: transform; transform-origin: 50% 100%; }
.label.me { color: #ffe27a; font-size: calc(15px * var(--ui, 1)); }
.floater { position: absolute; left: 0; top: 0; font-size: calc(20px * var(--ui, 1)); white-space: nowrap; will-change: transform, opacity; animation: floatUp .9s ease-out forwards; }
.floater.big { font-size: calc(30px * var(--ui, 1)); color: #ffe27a; }

#joy { position: fixed; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; background: rgba(255,255,255,.18); border: 3px solid rgba(255,255,255,.55);
  pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 15; }
#joy.on { opacity: 1; }
#joyKnob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(255,255,255,.85); box-shadow: 0 3px 0 rgba(29,35,64,.3); }

/* screens */
.screen > * { zoom: var(--uis, 1); }
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; z-index: 40; text-align: center;
  padding: 20px; background: radial-gradient(ellipse at 50% 30%, rgba(255,248,234,.92), rgba(170,226,247,.88) 60%, rgba(47,182,228,.9)); }
#title { background: radial-gradient(ellipse at 50% 25%, rgba(255,248,234,.80), rgba(170,226,247,.55) 55%, rgba(47,182,228,.55)); }
.logoWrap { display: flex; flex-direction: column; align-items: center; gap: 0; }
.logoHole { width: 120px; height: 46px; border-radius: 50%; background: radial-gradient(ellipse at 50% 60%, #120a2a 40%, #3a1f7a 70%, #7c5cff 86%, #ffd54a 100%);
  box-shadow: 0 0 0 5px var(--pc, #8f6bff), 0 0 0 9px #fff, 0 0 34px 10px var(--pc, #8f6bff); animation: wob 2.4s ease-in-out infinite; }
.logoHoleIn { width: 100%; height: 100%; border-radius: 50%; background: radial-gradient(circle at 30% 45%, rgba(255,255,255,.9) 0 2px, transparent 3px), radial-gradient(circle at 70% 55%, rgba(255,255,255,.8) 0 1.5px, transparent 2.5px); animation: spin 6s linear infinite; }
h1 { font-size: clamp(56px, 15vw, 112px); margin: -6px 0 0; line-height: .95; color: #ffd54a; }
h1 span { color: #ff8fb3; }
.tag, .how { background: rgba(255,255,255,.62); border-radius: 16px; padding: 8px 14px; backdrop-filter: blur(3px); }
.tag { max-width: 520px; margin: 0; font-size: clamp(15px, 3.8vw, 19px); font-weight: 700; color: var(--ink); line-height: 1.35; }
.pickRow { display: flex; align-items: center; gap: 10px; font-weight: 800; flex-wrap: wrap; justify-content: center; }
#swatches { display: flex; gap: 8px; }
.sw { width: 36px; height: 36px; border-radius: 50%; border: 4px solid #fff; cursor: pointer; box-shadow: 0 3px 0 rgba(29,35,64,.25); transition: transform .15s; }
.sw.sel { transform: scale(1.18); box-shadow: 0 0 0 3px var(--ink), 0 3px 0 rgba(29,35,64,.25); }
button.big { font-family: var(--font); font-size: 30px; font-weight: 800; color: #fff; border: 0; border-radius: 999px; padding: 12px 54px 14px;
  background: linear-gradient(#ff9a6b, #ff6a4d); box-shadow: 0 6px 0 #c94a33, 0 10px 24px rgba(201,74,51,.35); cursor: pointer; text-shadow: 0 2px 0 rgba(0,0,0,.2); }
button.big:active { transform: translateY(4px); box-shadow: 0 2px 0 #c94a33; }
button.big:focus-visible, .sw:focus-visible { outline: 4px solid var(--accent2); outline-offset: 4px; }
button.big[disabled] { filter: grayscale(.6) opacity(.7); }
.how { margin: 0; font-size: 14px; font-weight: 700; max-width: 520px; color: #33405e; }
.best { margin: 0; font-weight: 800; }
#loading { font-weight: 800; opacity: .7; }

#results h2 { font-size: clamp(40px, 10vw, 70px); margin: 0; color: #ffd54a; }
#podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; height: 190px; margin-top: 4px; }
.pod { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; width: 96px; }
.pod .ph { width: 64px; height: 24px; border-radius: 50%; margin-bottom: 6px; box-shadow: inset 0 -6px 0 rgba(0,0,0,.45), 0 0 0 3px #fff; background: #120a2a; }
.pod .pn { font-weight: 800; font-size: 15px; margin-bottom: 4px; white-space: nowrap; }
.pod .pb { width: 100%; border-radius: 10px 10px 0 0; display: grid; place-items: start center; padding-top: 6px; font-size: 26px; font-weight: 800; color: #fff;
  text-shadow: 0 2px 0 rgba(0,0,0,.25); animation: rise .6s cubic-bezier(.2,1.4,.4,1) backwards; }
.pod.p1 .pb { height: 110px; background: linear-gradient(#ffd54a, #f2a93b); animation-delay: .5s; }
.pod.p2 .pb { height: 78px; background: linear-gradient(#dfe6ee, #aab6c4); animation-delay: .3s; }
.pod.p3 .pb { height: 56px; background: linear-gradient(#ffb98a, #d9784a); animation-delay: .1s; }
.pod.me .pn { color: #ff6a4d; }
#resList { list-style: none; padding: 0; margin: 0; width: min(360px, 90vw); font-weight: 800; }
#resList li { display: flex; justify-content: space-between; padding: 6px 12px; border-radius: 10px; background: rgba(255,255,255,.55); margin: 4px 0; }
#resList li.me { background: #fff1b8; box-shadow: 0 0 0 3px #ffb43a; }
#resBest { margin: 0; font-weight: 800; }
#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes bump { 0% { transform: translateX(-50%) scale(1.4); } 100% { transform: translateX(-50%) scale(1); } }
@keyframes throb { 50% { transform: translateX(-50%) scale(1.12); } }
@keyframes banner { 0% { transform: translate(-50%, -50%) scale(0) rotate(-8deg); opacity: 1; } 25% { transform: translate(-50%, -50%) scale(1.1) rotate(2deg); }
  40% { transform: translate(-50%, -50%) scale(1) rotate(0); } 80% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -70%) scale(.9); } }
@keyframes count { 0% { transform: translate(-50%, -50%) scale(2.2); opacity: 0; } 30% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 85% { opacity: 1; } 100% { transform: translate(-50%, -50%) scale(.8); opacity: 0; } }
@keyframes floatUp { 0% { opacity: 0; translate: 0 0; scale: .6; } 15% { opacity: 1; scale: 1.15; } 30% { scale: 1; } 100% { opacity: 0; translate: 0 -70px; } }
@keyframes rise { from { height: 0; } }
@keyframes wob { 50% { transform: scale(1.06, .94); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 600px) {
  #board { font-size: 11px; min-width: 112px; padding: 4px 6px; }
  #board li .nm { max-width: 64px; }
  #timer { font-size: 28px; top: calc(max(10px, env(safe-area-inset-top)) + 58px); }
  #score { font-size: 22px; }
  #podium { height: 160px; }
  .pod { width: 84px; }
}

.edge { position: absolute; left: 0; top: 0; width: 34px; height: 34px; margin: -17px 0 0 -17px; display: none; will-change: transform; }
.edge i { position: absolute; inset: 7px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 0 rgba(29,35,64,.4); }
.edge s { position: absolute; inset: 0; }
.edge b { position: absolute; left: 50%; top: -9px; margin-left: -8px; width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-bottom: 11px solid #fff; }
.edge.big i::after { content: '!'; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; }
#hint { position: fixed; left: 50%; bottom: calc(18% + env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 10px 18px; border-radius: 999px; background: rgba(29,35,64,.55);
  color: #fff; font-weight: 800; font-size: calc(17px * var(--ui, 1)); pointer-events: none; opacity: 0; transition: opacity .4s; white-space: nowrap; z-index: 18; }
#hint.on { opacity: 1; }
button.small { font-family: var(--font); font-size: 16px; font-weight: 800; color: var(--ink); background: rgba(255,255,255,.7); border: 0; border-radius: 999px; padding: 8px 20px; cursor: pointer; }

#levelPick { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.lvcard { font-family: var(--font); display: flex; flex-direction: column; align-items: center; gap: 1px; width: 128px; padding: 8px 6px 9px; border-radius: 16px; border: 3px solid rgba(255,255,255,.8);
  background: rgba(255,255,255,.62); color: var(--ink); cursor: pointer; box-shadow: 0 4px 0 rgba(29,35,64,.18); transition: transform .15s; }
.lvcard .em { font-size: 30px; line-height: 1.1; }
.lvcard .nm { font-weight: 800; font-size: 16px; }
.lvcard .bl { font-size: 11px; font-weight: 700; opacity: .75; }
.lvcard .bs { font-size: 12px; font-weight: 800; color: #c94a33; margin-top: 2px; }
.lvcard.sel { background: #fff; border-color: #ff7a59; transform: translateY(-3px) scale(1.04); box-shadow: 0 6px 0 #ff7a59; }
.lvcard:focus-visible { outline: 4px solid var(--accent2); outline-offset: 3px; }
body.travel .screen > :not(#loading) { opacity: .35; pointer-events: none; }
@media (max-width: 600px) { .lvcard { width: 104px; } .lvcard .bl { display: none; } }
