html, body { margin: 0; height: 100%; background: #030108; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#app { position: fixed; inset: 0; overflow: hidden; color: #e8e0f4; font-weight: 700; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; display: block; transition: filter .3s; }
/* the route replay between the passes looks like a memory: warm and faded */
#view.replay { filter: sepia(.45) saturate(1.3) hue-rotate(-12deg) brightness(1.05); }
.hidden { display: none !important; }
.screen { position: absolute; inset: 0; z-index: 20; }
.outline { text-shadow: -2px -2px 0 #12061c, 2px -2px 0 #12061c, -2px 2px 0 #12061c, 2px 2px 0 #12061c, 0 3px 0 #000; }

/* panels & buttons in the game's own art */
.panel { border: 22px solid transparent; border-image: url(assets/ui-panel.webp) 30% fill / 22px stretch; background-clip: padding-box; filter: drop-shadow(0 4px 0 rgba(0,0,0,.6)); }
.btn { position: relative; min-height: 48px; min-width: 48px; padding: 4px 18px; border: 16px solid transparent; border-image: url(assets/ui-button.webp) 32% fill / 16px stretch; background: none; color: #dffaf2; font: inherit; font-size: 17px; font-weight: 900; cursor: pointer; text-shadow: -2px -2px 0 #0c0414, 2px -2px 0 #0c0414, -2px 2px 0 #0c0414, 2px 2px 0 #0c0414; transition: transform .12s, filter .12s; box-sizing: border-box; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn:active { transform: scale(.94); }
.btn.focus, .btn:hover { filter: brightness(1.35) drop-shadow(0 0 6px #5fffd8); transform: scale(1.04); }
.btn.primary { color: #fff2c8; }
.btn img { width: 26px; height: 26px; image-rendering: pixelated; }
.btn.small { min-height: 44px; font-size: 15px; padding: 0 10px; }

/* title */
#title { background: #030108 url(assets/cover-bg.webp) center / cover no-repeat; cursor: pointer; }
#title::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(3,1,8,.35), rgba(3,1,8,0) 40%, rgba(3,1,8,0) 70%, rgba(3,1,8,.7)); pointer-events: none; }
#logo { position: absolute; left: 50%; top: 6%; width: 82%; max-height: 30%; object-fit: contain; transform: translateX(-50%); z-index: 2; animation: logoIn .7s cubic-bezier(.3,1.6,.5,1) both, logoFloat 4s ease-in-out .8s infinite; filter: drop-shadow(0 0 14px rgba(95,255,216,.35)); }
@keyframes logoIn { from { opacity: 0; transform: translateX(-50%) scale(.6); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
@keyframes logoFloat { 0%,100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-6px); } }
#startPrompt { position: absolute; left: 8%; right: 8%; bottom: 12%; text-align: center; font-size: 22px; z-index: 2; color: #e9fff8; animation: pulse 1.6s ease-in-out infinite; }
#keyHint { position: absolute; left: 6%; right: 6%; bottom: calc(12% - 30px); text-align: center; font-size: 14px; z-index: 2; color: #b8a8d0; opacity: .85; }
@keyframes pulse { 0%,100% { opacity: .55; transform: scale(.97); } 50% { opacity: 1; transform: scale(1.03); } }

/* level select */
#levels { background: radial-gradient(ellipse at 50% 30%, #1b0f2c 0%, #07030e 70%); display: flex; flex-direction: column; align-items: center; padding: max(12px, env(safe-area-inset-top)) 12px 12px; box-sizing: border-box; overflow-y: auto; }
#levels .topbar { width: 100%; max-width: 380px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
#levels .topbar .btn { justify-self: start; }
#levels h1 { text-align: center; margin: 0; font-size: 24px; font-weight: 900; color: #d8fff4; }
#fullPanel { width: 100%; max-width: 380px; box-sizing: border-box; margin-top: 10px; padding: 0 4px; display: flex; flex-direction: column; gap: 8px; animation: pop .3s cubic-bezier(.3,1.6,.5,1); }
#fullPitch { font-size: 14px; line-height: 1.4; text-align: center; color: #ffe0a8; }
#levelGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 380px; margin-top: 10px; }
.lvbtn { flex-direction: column; min-height: 96px; padding: 4px 6px; gap: 2px; }
.lvbtn .num { font-size: 26px; color: #8fffe0; line-height: 1; }
.lvbtn .nm { font-size: 14px; line-height: 1.15; text-align: center; }
.lvbtn .st { font-size: 16px; color: #ffcf5a; letter-spacing: 2px; }
.lvbtn .st .off { color: #4a3e5a; }
.lvbtn .best { font-size: 12px; color: #b8a8d0; }
.lvbtn .tag { display: flex; align-items: center; gap: 4px; font-size: 13px; color: #ffcf5a; }
.lvbtn .tag img { width: 18px; height: 18px; }
.lvbtn.locked { filter: grayscale(1) brightness(.55); }
.lvbtn.paid .num { color: #ffcf5a; }

/* HUD */
#hud { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
#hudPanel { position: absolute; left: max(8px, env(safe-area-inset-left)); top: max(8px, env(safe-area-inset-top)); padding: 2px 6px; border-width: 14px; border-image-width: 14px; max-width: calc(100% - 100px); }
#hudLevel { font-size: 15px; color: #d8fff4; }
#hudPass { font-size: 13px; color: #ffcf8a; margin-top: 1px; }
#hudStats { display: flex; gap: 10px; align-items: center; margin-top: 4px; font-size: 17px; flex-wrap: wrap; }
#hudStats:empty { display: none; }
#hudStats .it { display: flex; align-items: center; gap: 2px; }
#hudStats img { width: 24px; height: 24px; image-rendering: pixelated; }
#hudTime { display: flex; align-items: center; gap: 4px; margin-top: 3px; font-size: 17px; color: #efe6ff; font-variant-numeric: tabular-nums; white-space: nowrap; }
#hudTime img { width: 20px; height: 20px; image-rendering: pixelated; }
#hudTime small { font-size: 13px; color: #b8a8d0; }
#hudTime.over b { color: #ff8aa0; }
.heart { width: 18px; height: 16px; display: inline-block; }
#timeline { position: absolute; left: max(10px, env(safe-area-inset-left)); right: 72px; top: 118px; height: 8px; background: rgba(10,4,18,.8); border: 2px solid #3a2a50; }
#timeFill { height: 100%; width: 0; background: linear-gradient(90deg, #ffb35c, #ffe2a0); }
#tip { position: absolute; left: 50%; transform: translateX(-50%); top: 136px; width: calc(100% - 40px); max-width: 420px; font-size: 15px; line-height: 1.4; padding: 0 4px; border-width: 16px; border-image-width: 16px; color: #f1e9ff; animation: tipIn .3s cubic-bezier(.3,1.5,.5,1); box-sizing: border-box; }
@keyframes tipIn { from { opacity: 0; transform: translate(-50%, -10px) scale(.95); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
#banner { position: absolute; left: 0; right: 0; top: 34%; text-align: center; font-size: 26px; font-weight: 900; color: #fff0c8; opacity: 0; transition: opacity .25s; padding: 0 16px; }
#susp { position: absolute; font-size: 28px; font-weight: 900; color: #ffd060; transform: translate(-50%, -100%); display: none; }

/* amber arrows to the items the future self may pick up: a bobbing arrow over each one,
   or pinned to the screen edge and turned toward it when it is out of view */
#arrows { position: absolute; inset: 0; pointer-events: none; }
.itemArrow { position: absolute; left: 0; top: 0; width: 30px; height: 30px; margin: -15px 0 0 -15px; will-change: transform; }
.itemArrow svg { display: block; width: 100%; height: 100%; filter: drop-shadow(2px 0 0 #2a1200) drop-shadow(-2px 0 0 #2a1200) drop-shadow(0 2px 0 #2a1200) drop-shadow(0 -2px 0 #2a1200) drop-shadow(0 0 6px rgba(255,170,60,.85)); }
.itemArrow.over svg { animation: arrowBob .7s ease-in-out infinite; }
.itemArrow.edge svg { animation: arrowPulse .8s ease-in-out infinite; }
.itemArrow.pop { animation: arrowIn .3s cubic-bezier(.3,1.7,.5,1) both; }
@keyframes arrowBob { 0%,100% { transform: translateY(-5px); } 50% { transform: translateY(3px); } }
@keyframes arrowPulse { 0%,100% { transform: scale(.9); opacity: .8; } 50% { transform: scale(1.12); opacity: 1; } }
@keyframes arrowIn { from { opacity: 0; } to { opacity: 1; } }

/* fast-forward replay of the boy's route between the passes */
#replayCap { position: absolute; left: 50%; bottom: 13%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; white-space: nowrap; animation: capIn .3s cubic-bezier(.3,1.6,.5,1) both; }
#replayLabel { font-size: 24px; font-weight: 900; color: #ffd38a; letter-spacing: 1px; }
#replayBar { width: 180px; height: 8px; background: rgba(10,4,18,.85); border: 2px solid #5a3a20; }
#replayFill { height: 100%; width: 0; background: linear-gradient(90deg, #ff9a3c, #ffe2a0); }
#replaySkip { font-size: 14px; color: #c8b8e0; }
@keyframes capIn { from { opacity: 0; transform: translate(-50%, 12px) scale(.9); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }

/* modal */
#modal { display: flex; align-items: center; justify-content: center; background: rgba(3,1,8,.55); }
.modal-box { width: min(88%, 380px); max-height: 92%; overflow: hidden; display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 6px 4px; box-sizing: border-box; animation: pop .28s cubic-bezier(.3,1.6,.5,1); }
@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#mTitle { text-align: center; font-size: 26px; font-weight: 900; color: #8fffe0; }
#mTitle.bad { color: #ff6a8a; }
#mText { text-align: center; font-size: 15px; line-height: 1.45; color: #efe6ff; white-space: pre-line; }
#mText:empty, #mTip:empty, #mGold:empty, #mStars:empty { display: none; }
#mTip { text-align: center; font-size: 14px; line-height: 1.4; color: #ffcf8a; white-space: pre-line; }
#mStars { display: flex; justify-content: center; gap: 10px; }
#mStars .s { display: flex; flex-direction: column; align-items: center; font-size: 12px; color: #a898c0; text-align: center; max-width: 33%; }
#mStars .s b { font-size: 34px; color: #3a2e48; transition: transform .2s; }
#mStars .s.on b { color: #ffcf5a; animation: starIn .4s cubic-bezier(.3,1.8,.5,1) both; }
@keyframes starIn { from { transform: scale(0) rotate(-40deg); } to { transform: scale(1) rotate(0); } }
#mGold { display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 18px; color: #efe6ff; font-variant-numeric: tabular-nums; }
#mGold .tm { display: flex; align-items: baseline; gap: 6px; }
#mGold .tm small { font-size: 13px; color: #b8a8d0; }
#mGold .tm.ok b { color: #9fffe6; }
#mGold .tm.bad b { color: #ff8aa0; }
#mGold .nb { font-size: 14px; color: #ffcf5a; animation: starIn .4s cubic-bezier(.3,1.8,.5,1) .5s both; }
#mGold img { width: 22px; height: 22px; align-self: center; }
#mBtns { display: flex; flex-direction: column; gap: 8px; }

/* intro + overlays */
#intro { background: #000 url(assets/cover-bg.webp) center / cover no-repeat; z-index: 40; }
#introVideo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
#skipBtn { position: absolute; right: max(12px, env(safe-area-inset-right)); top: max(12px, env(safe-area-inset-top)); z-index: 2; }
.subtitle { position: absolute; left: 6%; right: 6%; bottom: 9%; text-align: center; font-size: 17px; color: #fff; z-index: 45; pointer-events: none; opacity: 0; transition: opacity .3s; }
/* in-game voice subtitles sit under the maze's middle, clear of the HUD, the tips and the banner */
#subtitle { top: 60%; bottom: auto; z-index: 12; }
#fade { position: absolute; inset: 0; z-index: 30; background: #050010; opacity: 0; pointer-events: none; transition: opacity .5s; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 22px; padding: 0 24px; color: #cfe9ff; }
#fade.on { opacity: 1; pointer-events: auto; }
#fade.quick { transition: opacity .3s; }
#flash { position: absolute; inset: 0; z-index: 11; pointer-events: none; background: #ff2050; opacity: 0; transition: opacity .35s; }
