:root { --f: "Fredoka", "Arial Rounded MT Bold", "Trebuchet MS", sans-serif; --navy: #161a40; --cream: #fff7ec; --mag: #ff4fa0; --cyan: #3fd8f0; --yel: #ffd84a; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d0b26; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; font-family: var(--f); }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; }
.hidden { display: none !important; }
.outline { color: var(--cream); font-weight: 900; text-shadow: 2px 0 0 var(--navy), -2px 0 0 var(--navy), 0 2px 0 var(--navy), 0 -2px 0 var(--navy), 2px 2px 0 var(--navy), -2px 2px 0 var(--navy), 2px -2px 0 var(--navy), -2px -2px 0 var(--navy), 0 4px 0 var(--navy); }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.hudpanel { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); border: 14px solid transparent; border-image: url(../assets/ui-panel.webp) 30% fill / 14px stretch; padding: 2px 4px; color: var(--cream); font-weight: 900; box-sizing: border-box; }
#hudLeft { left: calc(8px + env(safe-area-inset-left, 0px)); width: 122px; }
#hudCenter { left: calc(138px + env(safe-area-inset-left, 0px)); right: calc(62px + env(safe-area-inset-right, 0px)); max-width: 240px; text-align: center; }
#hearts { flex-wrap: wrap; gap: 2px 4px; }
.row { display: flex; align-items: center; gap: 5px; min-height: 24px; }
.row.center { justify-content: center; gap: 8px; }
.num { font-size: 19px; text-shadow: 0 2px 0 var(--navy), 2px 0 0 var(--navy), -2px 0 0 var(--navy), 0 -2px 0 var(--navy); }
.num.score { color: var(--yel); }
.ico { width: 22px; height: 22px; object-fit: contain; display: inline-block; }
.ico.umb { background: no-repeat center/contain url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M2 12a10 9 0 0 1 20 0z' fill='%23ff4fa0' stroke='%23161a40' stroke-width='1.6' stroke-linejoin='round'/><path d='M12 12v7a2 2 0 0 1-4 0' fill='none' stroke='%23161a40' stroke-width='2' stroke-linecap='round'/><circle cx='12' cy='2.6' r='1.4' fill='%23ffd84a' stroke='%23161a40'/></svg>"); }
#hearts svg { width: 20px; height: 20px; transition: transform .2s; }
#hearts svg.lost { opacity: .28; transform: scale(.8); }
.label { font-size: 16px; text-shadow: 0 2px 0 var(--navy), 2px 0 0 var(--navy), -2px 0 0 var(--navy), 0 -2px 0 var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 10px; margin: 4px 2px 2px; border-radius: 6px; background: rgba(255,255,255,.15); border: 2px solid var(--navy); overflow: hidden; }
#timeFill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--cyan), var(--mag)); }
.badge { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--cyan); color: var(--navy); border: 2px solid var(--navy); white-space: nowrap; }
.badge.mirror { background: var(--mag); color: var(--cream); }

/* wet markers above passers-by */
#markers, #pops { position: fixed; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.mk { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; border: 2.5px solid var(--navy); box-sizing: border-box; display: flex; align-items: center; justify-content: center; }
.mk::after { content: ""; width: 12px; height: 15px; background: no-repeat center/contain url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 16'><path d='M6 1C4 5 1 8 1 11a5 5 0 0 0 10 0c0-3-3-6-5-10z' fill='%23fff7ec' stroke='%23161a40' stroke-width='1.4'/></svg>"); }
.mk.edge { width: 36px; height: 36px; margin: -18px 0 0 -18px; }
.mk.urgent { animation: pulse .4s infinite alternate; }
@keyframes pulse { to { transform: scale(1.18); } }
.pop { position: absolute; font-size: 20px; font-weight: 900; color: var(--yel); transform: translate(-50%, -50%); white-space: nowrap; animation: popUp 1s ease-out forwards; }
@keyframes popUp { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.5); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -160%) scale(1); } }

#toast { position: fixed; left: 50%; top: calc(122px + env(safe-area-inset-top, 0px)); transform: translate(-50%, -10px); z-index: 6; max-width: 84%; padding: 8px 16px; border-radius: 16px; background: rgba(22,26,64,.86); border: 3px solid var(--cream); color: var(--cream); font-weight: 900; font-size: 15px; text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s cubic-bezier(.3,1.6,.6,1); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#banner { position: fixed; left: 0; right: 0; top: 34%; z-index: 7; text-align: center; font-size: 38px; pointer-events: none; opacity: 0; padding: 0 16px; line-height: 1.15; }
#banner .sub { display: block; font-size: 17px; margin-top: 10px; }
#banner.show { animation: slam 2.2s ease-out forwards; }
@keyframes slam { 0% { opacity: 0; transform: scale(2.4) rotate(-6deg); } 12% { opacity: 1; transform: scale(.94) rotate(-4deg); } 18% { transform: scale(1.04) rotate(-4deg); } 80% { opacity: 1; transform: scale(1) rotate(-4deg); } 100% { opacity: 0; transform: scale(1) rotate(-4deg); } }
#subtitle { position: fixed; left: 50%; top: calc(176px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); z-index: 31; width: 86%; text-align: center; font-size: 16px; line-height: 1.35; opacity: 0; pointer-events: none; transition: opacity .25s; color: var(--cream); font-weight: 800; }
#subtitle span { background: rgba(10,8,30,.78); padding: 4px 10px; border-radius: 10px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
#subtitle.show { opacity: 1; }
#flash { position: fixed; inset: 0; z-index: 8; pointer-events: none; opacity: 0; background: radial-gradient(circle at 50% 55%, rgba(255,255,255,.95), rgba(63,216,240,.75) 35%, rgba(255,79,160,.5) 70%, rgba(22,10,60,.2)); }

/* title */
#title { position: fixed; inset: 0; z-index: 20; background: #151436 url(../assets/cover-bg.webp) center / cover no-repeat; overflow: hidden; }
#title::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,8,30,.45), rgba(10,8,30,0) 35%, rgba(10,8,30,0) 70%, rgba(10,8,30,.55)); pointer-events: none; }
#logo { position: absolute; left: 50%; top: 9%; width: 82%; max-height: 30%; object-fit: contain; transform: translateX(-50%); z-index: 2; animation: logoIn .7s cubic-bezier(.3,1.6,.6,1) both, float 3.2s ease-in-out .7s infinite; filter: drop-shadow(0 6px 0 rgba(10,8,30,.5)); }
@keyframes logoIn { from { opacity: 0; transform: translateX(-50%) scale(.4) translateY(-40px); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
@keyframes float { 50% { transform: translateX(-50%) translateY(-7px) rotate(-1deg); } }
#prompt { position: absolute; left: 0; right: 0; margin: 0 auto; width: fit-content; max-width: 86%; box-sizing: border-box; bottom: 10%; text-align: center; font-size: 22px; z-index: 2; animation: breathe 1.6s ease-in-out infinite; padding: 8px 22px; border-radius: 999px; background: rgba(22,26,64,.62); border: 3px solid rgba(255,216,74,.85); box-shadow: 0 4px 0 rgba(10,8,30,.5); }
@keyframes breathe { 50% { opacity: .7; transform: scale(.95); } }
.corner { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); width: 48px; height: 48px; border-radius: 50%; border: 3px solid var(--cream); background: rgba(22,26,64,.62); z-index: 3; padding: 0; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform .1s; }
.corner:active { transform: scale(.9); }
.corner.left { left: calc(12px + env(safe-area-inset-left, 0px)); }
.corner.right { right: calc(12px + env(safe-area-inset-right, 0px)); }
.corner img, .corner svg { width: 30px; height: 30px; object-fit: contain; }
.pill { position: absolute; top: calc(22px + env(safe-area-inset-top, 0px)); left: calc(68px + env(safe-area-inset-left, 0px)); z-index: 3; display: flex; align-items: center; gap: 4px; padding: 2px 10px 2px 4px; border-radius: 999px; background: rgba(22,26,64,.62); border: 2px solid rgba(255,216,74,.6); color: var(--yel); font-weight: 900; font-size: 16px; }
.pill img { width: 22px; height: 22px; }

/* panels */
#panelWrap { position: fixed; inset: 0; z-index: 15; display: flex; align-items: center; justify-content: center; background: rgba(8,6,26,.55); }
.panel { width: min(84vw, 340px); box-sizing: border-box; border: 30px solid transparent; border-image: url(../assets/ui-panel.webp) 30% fill / 30px stretch; padding: 4px 6px; color: var(--cream); text-align: center; animation: panelIn .3s cubic-bezier(.3,1.5,.6,1) both; }
@keyframes panelIn { from { opacity: 0; transform: scale(.6) translateY(30px); } to { opacity: 1; transform: none; } }
.panel h2 { margin: 0 0 6px; font-size: 26px; line-height: 1.15; }
.panel p { margin: 6px 0; font-size: 15px; line-height: 1.4; font-weight: 700; }
.stars { font-size: 0; margin: 4px 0 8px; }
.stars svg { width: 44px; height: 44px; margin: 0 2px; animation: starIn .4s cubic-bezier(.3,1.8,.6,1) both; }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); } to { transform: none; } }
.stat { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 15px; font-weight: 800; padding: 3px 4px; border-bottom: 2px dashed rgba(255,255,255,.15); text-align: left; }
.stat b { font-size: 18px; color: var(--yel); display: flex; align-items: center; gap: 4px; }
.stat b img { width: 20px; height: 20px; }
.btns { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; align-items: stretch; }
.btnrow { display: flex; gap: 10px; align-items: center; }
.btn { min-height: 54px; box-sizing: border-box; border: 18px solid transparent; border-image: url(../assets/ui-button.webp) 40% fill / 18px stretch; background: none; color: var(--cream); font-family: var(--f); font-weight: 900; font-size: 18px; padding: 0 6px; cursor: pointer; transition: transform .1s, filter .15s; text-shadow: 0 2px 0 var(--navy), 2px 0 0 var(--navy), -2px 0 0 var(--navy), 0 -2px 0 var(--navy); flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.1; }
.btn img { width: 24px; height: 24px; }
.btn.alt { filter: hue-rotate(-135deg) saturate(.95); }
.btn.quiet { filter: grayscale(.85) brightness(.85); font-size: 15px; }
.btn.focus { transform: scale(1.05); filter: brightness(1.2) drop-shadow(0 0 6px rgba(255,216,74,.9)); }
.btn.alt.focus { filter: hue-rotate(-135deg) brightness(1.2) drop-shadow(0 0 6px rgba(255,216,74,.9)); }
.btn.quiet.focus { filter: grayscale(.5) brightness(1.05) drop-shadow(0 0 6px rgba(255,216,74,.9)); }
.btn:active { transform: scale(.94); }
.btn.round { flex: 0 0 58px; width: 58px; padding: 0; border-width: 12px; border-image: url(../assets/ui-button.webp) 40% fill / 12px stretch; }
.btn.round svg { width: 28px; height: 28px; flex: none; }
.btn.small { min-height: 46px; font-size: 16px; }
.help { text-align: left; }
.help p { display: flex; gap: 8px; }
.help p::before { content: "●"; color: var(--mag); }

/* intro */
#intro { position: fixed; inset: 0; z-index: 30; background: #151436 url(../assets/cover-bg.webp) center / cover; }
#intro video { width: 100%; height: 100%; object-fit: cover; display: block; }
#btnSkip { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); right: calc(14px + env(safe-area-inset-right, 0px)); flex: none; min-width: 92px; }
