@font-face{font-family:RallyPixel;src:url(assets/fonts/rally-pixel.woff) format("woff");font-display:swap}
*{box-sizing:border-box}body{margin:0;min-height:100svh;display:grid;place-items:center;background:#07090f;color:#f8f9ff;font:16px var(--rally-pixel,RallyPixel),monospace}main{width:min(94vw,760px);padding:20px 0}header,footer{display:flex;align-items:center;justify-content:space-between;gap:10px;font-weight:bold;letter-spacing:.12em}header{margin-bottom:12px}small{color:#a9b5ca}button{font:inherit;color:inherit;background:#22263c;border:1px solid #70788b;padding:8px 14px;cursor:pointer}button:focus-visible{outline:3px solid #95c9ee}canvas{width:100%;display:block;background:#22263c;image-rendering:auto;outline:3px solid #41475f}footer{margin:15px 0}.pad{display:grid;grid-template-columns:repeat(3,46px);justify-content:center;gap:3px}.pad button{touch-action:none;user-select:none;padding:7px}.pad button:first-child{grid-column:2}.pad button:nth-child(2){grid-column:1}#start{background:#f8f9ff;color:#22263c;font-weight:bold;border:0;min-width:10em}@media(max-height:530px) and (min-width:650px){main{width:min(65vw,520px)}}
body.expanded main{width:min(98vw,calc((100dvh - 100px)*1.4545));padding:0}body.expanded header,body.expanded footer{margin:4px 0}@media(pointer:coarse){body.expanded .pad{display:grid}body.expanded main{width:min(98vw,calc((100dvh - 180px)*1.4545))}}
canvas{aspect-ratio:16/11;touch-action:manipulation}
@media(orientation:portrait) and (max-width:700px){
 body{display:block;min-height:100svh;overscroll-behavior:none}
 main,body.expanded main{width:100%;min-height:100svh;padding:max(10px,env(safe-area-inset-top)) 0 max(14px,env(safe-area-inset-bottom));display:flex;flex-direction:column}
 header,body.expanded header{padding:0 12px;margin:0 0 12px;letter-spacing:.02em}header button{padding:8px;min-height:42px}
 canvas{outline:none;box-shadow:0 2px #41475f}
 footer,body.expanded footer{margin:10px 14px;min-height:44px;letter-spacing:0}footer small{max-width:54%}#start{min-width:0;min-height:46px}
 .pad,body.expanded .pad{--key:clamp(48px,8.5svh,78px);display:grid;grid-template:repeat(3,var(--key))/repeat(3,var(--key));gap:4px;margin:auto auto clamp(6px,5svh,40px);padding-top:8px}
 .pad button{border-radius:10px;background:#263047;border-color:#4b5b74;box-shadow:0 3px #111927;font-size:24px;-webkit-tap-highlight-color:transparent}
 .pad button:active{background:#485c7e;transform:translateY(2px)}
 .pad button:nth-child(1){grid-area:1/2}.pad button:nth-child(2){grid-area:2/1}.pad button:nth-child(3){grid-area:3/2}.pad button:nth-child(4){grid-area:2/3}


}
header{justify-content:flex-end}

.game-window{position:relative}
#start.title-start{position:absolute;top:54%;left:50%;transform:translateX(-50%);min-width:6.8em;min-height:0;padding:.22em 1em .3em;background:#172641;color:white;border:2px solid white;box-shadow:3px 3px #d84445;font: bold clamp(16px,3vw,25px) var(--rally-pixel,RallyPixel),monospace;letter-spacing:.12em}
@media(orientation:portrait) and (max-width:700px){canvas{aspect-ratio:256/224;max-height:50svh;width:100%;height:min(87.5vw,50svh)}}
@media(orientation:portrait) and (max-width:700px) and (max-height:650px){header,body.expanded header{margin-bottom:4px}footer,body.expanded footer{margin:3px 10px;min-height:32px}.pad,body.expanded .pad{margin-bottom:0;padding-top:0;--key:46px}main,body.expanded main{padding-top:4px;padding-bottom:4px}}header,body.expanded header{position:static;width:100%;min-height:44px;flex:none;background:#000;padding:0 12px;margin:0}
#page-score{margin-right:auto;color:white;letter-spacing:.1em;font-variant-numeric:tabular-nums}

canvas,button,#start.title-start,.pad button{border:0;box-shadow:none}canvas{outline:0}
#health{display:flex;gap:3px;margin-left:auto}#health[hidden]{display:none}#health svg{width:clamp(15px,3.8vw,21px);height:auto;fill:#ed434c}#health .spent{filter:grayscale(1);opacity:.34}.pad button:nth-child(1){grid-area:1/2}.pad button:nth-child(2){grid-area:2/1}.pad button:nth-child(3){grid-area:3/2}.pad button:nth-child(4){grid-area:2/3}
#pad-ok{grid-area:2/2;border-radius:50%;background:#cd3545;color:#fff;font-family:var(--rally-pixel,RallyPixel),monospace;font-weight:bold;font-size:1rem;min-height:36px}
#pad-ok:disabled{background:#303744;color:#a6aebf}
@media(max-height:530px) and (min-width:650px){.game-controls{position:fixed;right:max(8px,env(safe-area-inset-right));bottom:max(8px,env(safe-area-inset-bottom))}main{width:min(60vw,calc((100svh - 105px)*1.4545))}}
#skip-intro{position:absolute;right:3%;bottom:calc(38% + 12px);min-height:36px;padding:5px 12px;border-radius:4px;background:rgba(12,18,31,.82);color:white;font-size:14px}@media(pointer:coarse){#skip-intro{min-height:44px}}.game-controls{display:grid;justify-content:center;gap:8px}
#access-controls{display:flex;justify-content:center;gap:9px;align-items:center}
#access-controls #sound{min-width:84px}
#access-controls button{min-width:56px;min-height:44px;padding:8px 12px;font-size:19px;line-height:1}
#access-controls #pause-game{font-size:23px}
.pad-spacer{visibility:hidden;pointer-events:none;font:inherit;padding:7px}
#pause-menu{color:white;background:#141b2d;border:0;text-align:center;padding:22px 26px;font:inherit}
#pause-menu::backdrop{background:rgba(4,8,16,.72)}#pause-menu h2{margin:0 0 15px;font-size:18px}#pause-menu button{margin:3px}
.game-window{container-type:inline-size}#rank-open{position:absolute;left:50%;top:calc(50% + 22.07cqw);transform:translate(-50%,-50%);width:42%;height:max(44px,5.5cqw);background:transparent;border:0}#rank-open:focus-visible{outline:2px solid white}
#rank-menu{width:min(88vw,350px);background:#141b2d;color:white;border:0;padding:22px;font:inherit;text-align:center}
#rank-menu::backdrop{background:#080b14bc}#rank-menu h2{font-size:18px;margin:0 0 14px}#rank-menu ol{padding:0;list-style:none}#rank-menu li{display:flex;justify-content:space-between;padding:6px 12px}#rank-menu li:first-child{color:#ffe5a0}
#start.title-start,#start.return-title,#rank-back{background:#172641;color:white;border:2px solid white;box-shadow:3px 3px #d84445;font:bold clamp(16px,3vw,25px) var(--rally-pixel,RallyPixel),monospace;letter-spacing:.12em;padding:.22em 1em .3em;min-width:6.8em}
@media(min-width:701px), (orientation:landscape){
 .pad,body.expanded .pad{--key:clamp(48px,8.5svh,78px);grid-template-columns:repeat(3,var(--key));grid-template-rows:0 var(--key) 0;gap:4px}
 .pad button[data-dir]{border-radius:10px;font-size:24px}
 #pad-ok{font-size:20px}
 #skip-intro{min-height:44px}
}
#continue-route{position:absolute;top:54%;left:71%;transform:translateX(-50%);background:#172641;color:white;border:2px solid white;box-shadow:3px 3px #d84445;font:bold clamp(16px,3vw,25px) var(--rally-pixel,RallyPixel),monospace;padding:.22em .6em .3em;white-space:nowrap}
.game-window:has(#continue-route:not([hidden])) #start.title-start{left:29%}
#start.title-start.title-selected,#continue-route.title-selected,#rank-open.title-selected{outline:3px solid #ffe5a0;outline-offset:2px}
#rank-open.title-selected{background:rgba(255,229,160,.09)}
#boot-screen{position:fixed;inset:0;z-index:99;background:#080911;color:#fff;display:grid;place-content:center;justify-items:center;gap:16px;font:16px var(--rally-pixel,RallyPixel),monospace}
#boot-screen[hidden],#boot-screen [hidden]{display:none}#boot-screen small{letter-spacing:.16em}#boot-screen strong{font-size:clamp(15px,2.6vw,22px);font-weight:400}
#boot-screen.ready strong{animation:boot-hop .52s ease-out both}
@keyframes boot-hop{0%,100%{transform:translateY(0)}40%{transform:translateY(-9px)}}
@media(prefers-reduced-motion:reduce){#boot-screen.ready strong{animation:none}}
#route-meter{position:relative;flex:1 1 0;max-width:300px;min-width:24px;height:30px;margin:auto}
#route-meter[hidden]{display:none}.route-track{position:absolute;left:7px;right:13px;top:22px;height:4px;background:#454a60}.route-fill{display:block;width:var(--distance,0%);height:100%;background:#ffcd69}
.route-runner{position:absolute;left:var(--distance,0%);bottom:1px;transform:translateX(-50%)}
#route-meter canvas{display:block;width:18px;height:24px;max-height:none;aspect-ratio:auto;image-rendering:pixelated;background:transparent;outline:0;box-shadow:none}
.route-flag{position:absolute;right:0;bottom:6px;width:13px;height:19px}
#pause-menu{font:16px var(--rally-pixel,RallyPixel),monospace;color:#fff;background:#172641;border:2px solid #fff;box-shadow:4px 4px #d84445;padding:20px 24px;max-width:92vw}
#pause-menu h2{font:bold 22px var(--rally-pixel,RallyPixel),monospace;letter-spacing:.12em;color:#ffda80;margin:0 0 14px}
#pause-menu button{display:block;width:100%;min-width:10em;min-height:44px;margin:6px 0 0;padding:8px 22px;font:16px var(--rally-pixel,RallyPixel),monospace;position:relative;color:white;background:#222f48;border:0}
#pause-menu button:is(:hover,:focus){background:#384765;color:#ffda80;outline:0}
#pause-menu button:is(:hover,:focus)::before{content:"";position:absolute;left:10px;top:50%;transform:translateY(-50%);border-block:5px solid transparent;border-left:7px solid #ffda80}
#card-actions:not([hidden]){display:flex;flex-direction:column;justify-content:center;align-items:center;gap:8px;flex-wrap:wrap;margin:4px auto}@font-face{font-family:ResultPixel;src:url(assets/fonts/result-pixel.woff) format('woff')}
#card-actions{font:16px/1.4 ResultPixel,var(--rally-pixel,RallyPixel),monospace;color:#ffda80}#card-actions button{font:16px ResultPixel,var(--rally-pixel,RallyPixel),monospace;min-height:44px;padding:6px 20px;background:#172641;color:#fff;border:2px solid #fff;box-shadow:3px 3px #d84445}#card-actions button:focus-visible{outline:2px solid #ffda80;outline-offset:3px}#card-note:empty{display:none}

body.stage-result main>header{min-height:0;height:0;padding:0;margin:0}#continue-route[hidden]{display:none!important}#return-choice:not([hidden]){display:grid;justify-items:center;gap:4px;margin-top:5px}#return-choice span{font:12px var(--rally-pixel,RallyPixel),monospace;letter-spacing:.08em;color:#ffda80}.pad .pad-spacer{visibility:hidden;min-height:0;height:0;padding:0;overflow:hidden}
footer:has(#status:empty):not(:has(#start:not([hidden]))){display:none}
body.stage-result main>header{min-height:44px;height:44px;background:#22263c}
@media(min-width:701px),(orientation:landscape){html{scrollbar-gutter:stable}body{align-items:center}}
@media(orientation:portrait) and (max-width:700px){
 .game-controls{margin-top:auto}
 .pad,body.expanded .pad{grid-template-rows:0 var(--key) 0;row-gap:0;margin:0}
}
body.loss-result main>header{background:#22263c}
body{background:#22263c}
.pad button[data-dir],#access-controls button{background:#465879;color:#fff;box-shadow:inset 0 2px #7589a8,inset 0 -3px #344461}
.pad button[data-dir]:active,#access-controls button:active{background:#354661;box-shadow:inset 0 3px #25334c;transform:translateY(2px)}
.pad button:focus-visible,#access-controls button:focus-visible{outline:3px solid #ffe5a0;outline-offset:2px}
@font-face{font-family:RallyPixelPractice;src:url(assets/fonts/rally-pixel-practice.woff) format("woff");font-display:swap}

body[data-entry="practice"],body[data-entry="boss-home"]{
 --rally-pixel:RallyPixelPractice;
}
#photo-picker{text-align:center;margin:4px}
#photo-picker button[aria-pressed="true"]{color:#ffda80;outline:1px solid currentColor}
.game-controls[hidden]{display:none}
@media(hover:hover) and (pointer:fine) and (min-height:531px){
 .game-controls{margin-top:18px}
}
