/* Shared soft corners. Viewport surfaces stay full bleed for iframe embedding. */
:root{--ui-control-radius:12px;--ui-panel-radius:20px;--ui-small-radius:8px}
button,input,select{border-radius:var(--ui-control-radius)!important}
.title-menu,.chooser-art,.level-art,.game-dialog,.admin-login,.admin-row,.score-table-wrap,.story-art,.rescue-art{border-radius:var(--ui-panel-radius)}
.chooser-level{border-radius:18px!important}
.title-ribbon,.title-ribbon::before,.title-ribbon::after{border-radius:16px}
.admin-row,.chooser-art,.level-art{overflow:hidden}
.hud{border-radius:0 0 18px 18px}
.progress,.progress i,.boost-track,.boost-track i,.shutdown-time-track{border-radius:999px}
.notice,.time-calculation,.combo-badge,.score-save-panel,.cutscene-message p{border-radius:var(--ui-small-radius)}
.game-dialog{border-radius:24px}
/* Scene end is drawn and animated in CSS, over the final video frame. */
.cutscene-ending{position:absolute;inset:0;z-index:5;background:#000;opacity:0;pointer-events:auto}
.cutscene-ending[data-phase="fade"]{animation:cutsceneFadeToBlack .75s ease-in both}
.cutscene-ending[data-phase="hold"]{opacity:1}
.cutscene-continued{position:absolute;right:max(42px,env(safe-area-inset-right));bottom:max(38px,env(safe-area-inset-bottom));margin:0;color:#fff;font-family:Biotif,Arial,sans-serif;font-size:clamp(20px,3vw,38px);font-weight:500;line-height:1.2;letter-spacing:.15px;text-align:right;opacity:0;animation:cutsceneContinuedText .4s ease-out both}
.cutscene-end-clock{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}
.cutscene-ending[data-phase="hold"] .cutscene-end-clock{animation:cutsceneEndHold 3s linear both}
@keyframes cutsceneFadeToBlack{from{opacity:0}to{opacity:1}}
@keyframes cutsceneContinuedText{from{opacity:0}to{opacity:1}}
@keyframes cutsceneEndHold{from{transform:translateX(0)}to{transform:translateX(1px)}}
@media(max-width:720px){.cutscene-continued{right:max(24px,env(safe-area-inset-right));bottom:max(24px,env(safe-area-inset-bottom));font-size:24px}.game-dialog{border-radius:20px}.hud{border-radius:0 0 14px 14px}}
@media(prefers-reduced-motion:reduce){.cutscene-ending[data-phase="fade"],.cutscene-continued{animation-duration:1ms}.cutscene-ending[data-phase="hold"] .cutscene-end-clock{animation-duration:1.8s}}

/* Mobile play: status stays in its own rail; the world keeps a clear centre. */
@media (max-width:720px),(pointer:coarse),(max-width:1024px) and (max-height:550px){
 .game-stage{--mobile-top:calc(78px + env(safe-area-inset-top));--mobile-bottom:calc(142px + env(safe-area-inset-bottom));--thumb-bottom:max(44px,calc(env(safe-area-inset-bottom) + 24px));background:#071747}
 .game-stage::after{content:"";position:absolute;left:0;right:0;bottom:0;height:var(--mobile-bottom);background:linear-gradient(180deg,#0c2357,#071538);border-top:1px solid #2ed1f738;pointer-events:none}
 .game-stage>canvas{top:var(--mobile-top);bottom:var(--mobile-bottom);height:calc(100% - var(--mobile-top) - var(--mobile-bottom))}
 #hud2[data-mobile]{width:100%;height:var(--mobile-top);transform:none;background:linear-gradient(100deg,#041579,#132fc2);border-bottom:1px solid #2ed1f770;z-index:2}
 #hud2[data-mobile] .hx-route{top:auto;bottom:0;left:0;width:100%}
 #hud2[data-mobile] .c-route{height:3px;border:0}
 #hud2[data-mobile] .c-route .fill::after{display:none}
 #hud2[data-mobile] .hx-life-pos{left:max(12px,env(safe-area-inset-left));top:calc(14px + env(safe-area-inset-top))}
 #hud2[data-mobile] .c-life,#hud2[data-mobile] .c-life .bar{width:72px;height:22px}
 #hud2[data-mobile] .c-life .bar{position:static;transform:none;background:none;border:0;box-shadow:none;padding:0;gap:5px}
 #hud2[data-mobile] .c-life .cell{height:20px;border-radius:5px}
 #hud2[data-mobile] .c-life .cell svg{width:14px;height:14px;transform:none}
 #hud2[data-mobile] .c-life .name,#hud2[data-mobile] .c-life .line{display:none}
 #hud2[data-mobile] .hx-time-pos{left:calc(max(12px,env(safe-area-inset-left)) + 88px);top:calc(8px + env(safe-area-inset-top))}
 #hud2[data-mobile] .c-time{width:74px;gap:0}
 #hud2[data-mobile] .c-time .row{justify-content:flex-start;gap:0}
 #hud2[data-mobile] .c-time .digits{font-size:26px;line-height:1.15;padding:0;margin:0;letter-spacing:0}
 #hud2[data-mobile] .c-time .cap,#hud2[data-mobile] .c-time .meta,#hud2[data-mobile] .c-time .track{display:none}
 #hud2[data-mobile] .hx-score-pos{right:calc(max(12px,env(safe-area-inset-right)) + 54px);left:auto;top:calc(11px + env(safe-area-inset-top));width:clamp(86px,28vw,160px)}
 #hud2[data-mobile] .c-score{gap:0}
 #hud2[data-mobile] .c-score .num{font-size:22px;line-height:1.2;white-space:nowrap;letter-spacing:0}
 #hud2[data-mobile] .c-score .num small{font-size:8px;margin-left:3px;letter-spacing:0}
 #hud2[data-mobile] .c-score .combo,#hud2[data-mobile] .c-score .combo-bar{display:none}
 #hud2[data-mobile] .hx-coins-pos{left:max(12px,env(safe-area-inset-left));right:auto;top:calc(44px + env(safe-area-inset-top))}
 #hud2[data-mobile] .liaa-coin-slots{gap:5px}
 #hud2[data-mobile] .liaa-coin-slots img{width:20px;height:20px;padding:2px}
 #hud2[data-mobile] .hx-ring-pos{left:calc(max(12px,env(safe-area-inset-left)) + 88px);right:auto;top:calc(43px + env(safe-area-inset-top));transform:none}
 #hud2[data-mobile] .c-ring{width:62px;gap:0}
 #hud2[data-mobile] .c-ring .disc{width:62px;height:24px;background:none;box-shadow:none;border-radius:0}
 #hud2[data-mobile] .c-ring .val{position:static;width:62px;height:24px;flex-direction:row;gap:4px;font-size:13px}
 #hud2[data-mobile] .c-ring .val small{font-size:6px;letter-spacing:0;max-width:28px;line-height:1.1;margin:0}
 #hud2[data-mobile] .c-ring svg,#hud2[data-mobile] .c-ring .pips,#hud2[data-mobile] .c-ring .lbl,#hud2[data-mobile] .c-ring .hx-repair{display:none}
 #hud2[data-mobile] .hx-boost-pos{left:auto;right:calc(max(12px,env(safe-area-inset-right)) + 54px);top:calc(43px + env(safe-area-inset-top));width:clamp(90px,28vw,140px)}
 #hud2[data-mobile] .c-boost,#hud2[data-mobile] .c-boost .body{position:static;width:100%;height:26px;padding:0;background:none;border:0;box-shadow:none;transform:none;animation:none}
 #hud2[data-mobile] .c-boost .un{transform:none}
 #hud2[data-mobile] .c-boost .key,#hud2[data-mobile] .c-boost .foot,#hud2[data-mobile] .c-boost .badge{display:none}
 #hud2[data-mobile] .c-boost .head{line-height:1;align-items:center;gap:4px;white-space:nowrap}
 #hud2[data-mobile] .boost-desktop-title{display:none}
 #hud2[data-mobile] .c-boost .head .t{font-size:7px;letter-spacing:.08em}
 #hud2[data-mobile] .c-boost .head .n{font-size:12px;white-space:nowrap}
 #hud2[data-mobile] .c-boost .head .n small{font-size:8px}
 #hud2[data-mobile] .c-boost .cells{height:5px;margin-top:5px;box-shadow:none;--bw:140px}
 #hud2[data-mobile] .hx-mission-pos,#hud2[data-mobile] .hx-defeated-pos,#hud2[data-mobile] .hx-gauge-pos,#hud2[data-mobile] .hx-world-pos,#hud2[data-mobile] .hx-gadget-pos,#hud2[data-mobile] .hx-ride-pos{display:none}
 #hud2[data-mobile] .hx-super-pos{display:block;left:auto;right:max(12px,env(safe-area-inset-right));top:calc(var(--mobile-top) + 10px)}
 #hud2[data-mobile] .hx-super{min-width:0;padding:5px 10px;transform:none}
 #hud2[data-mobile] .hx-super:not([data-active="true"]){display:none}
 #hud2[data-mobile] .hx-super .un{transform:none;font-size:9px;gap:5px}
 #hud2[data-mobile] .hx-super b{font-size:13px;min-width:28px}
 #hud2[data-mobile] .hx-super-bar{display:none}
 #hud2[data-mobile] .notice{left:12px;top:calc(var(--mobile-top) + 10px);max-width:min(380px,calc(100vw - 24px));width:max-content;max-height:44px;overflow:hidden;padding:6px 10px;font-size:11px;line-height:1.3;border-radius:10px}
 .game-shell[data-level="5"] #hud2[data-mobile] .notice{top:calc(var(--mobile-top) + 94px)}
 .game-shell[data-level="5"] .shutdown-countdown{top:calc(var(--mobile-top) + 8px);width:210px;padding:6px 10px;font-size:10px}
 .game-shell[data-level="5"] .shutdown-countdown b{font-size:26px}
 .game-shell[data-level="5"] .shutdown-countdown small{font-size:8px}
 .game-shell[data-level="5"] .shutdown-instruction{font-size:8px}
 .menu-fab{top:calc(10px + env(safe-area-inset-top));right:max(12px,env(safe-area-inset-right));width:44px;height:54px;padding:0;justify-content:center;z-index:5}
 .menu-fab-text{display:none}
 .touch-controls{display:block;inset:0;width:100%;height:100%;z-index:4;pointer-events:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
 .touch-controls[data-playing="false"]{visibility:hidden}
 .touch-controls>div{position:absolute;gap:10px}
 .touch-controls .touch-direction{left:max(18px,env(safe-area-inset-left));bottom:var(--thumb-bottom);display:grid;grid-template-columns:repeat(2,68px)}
 .touch-controls button{height:68px;min-height:44px;min-width:0;padding:0 10px;border:2px solid #cfe3ffb0;background:linear-gradient(150deg,#183a80f5,#0b2051ed);box-shadow:0 5px 0 #020d2d,0 7px 18px #020d2d50,inset 0 1px 0 #ffffff30;font-size:26px;color:#fff;touch-action:none;transition:background .1s}
 .touch-controls button[data-pressed="true"],.touch-controls button:active{background:#0071fa;border-color:#fff;box-shadow:0 2px 0 #020d2d,inset 0 0 18px #2ed1f770}
 .touch-controls .touch-context{left:max(18px,env(safe-area-inset-left));right:max(18px,env(safe-area-inset-right));bottom:calc(var(--thumb-bottom) + 80px);display:flex;justify-content:space-between;align-items:end}
 .touch-controls .touch-context button{height:44px;min-height:44px;border-width:1px;padding:0 10px;font-size:10px;box-shadow:none}
 .touch-controls #cycle{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:1px;font-size:10px;height:auto;min-height:44px;max-width:145px;padding:5px 10px}
 .touch-controls #cycle small{font-size:8px;color:#b9f6ed}
 .touch-cycle-label{font-size:7px;letter-spacing:.08em;color:#cfe3ff}
 .touch-controls #jump-touch{display:none}
 .touch-controls .touch-actions{right:max(18px,env(safe-area-inset-right));bottom:var(--thumb-bottom);display:flex;gap:8px}
 .touch-controls #repair-touch{width:68px;height:68px;font-size:10px;font-weight:900;letter-spacing:.03em;border-color:#77d8c4}
 .touch-controls #repair-touch::after{content:"HOLD";display:block;margin-top:4px;font-size:8px;color:#cfe3ff}
 .touch-controls #repair-touch:disabled{opacity:.5}
 .touch-controls #repair-touch:not(:disabled){background:linear-gradient(145deg,#168c80,#30c0a2);border-color:#d0fff3}
 .touch-controls #repair-touch[hidden]+#boost-touch{width:88px}
 .touch-controls #boost-touch{position:static;width:68px;height:68px;min-width:0;font-size:13px;font-weight:900;letter-spacing:.04em;background:linear-gradient(145deg,#132fc2,#0071fa);border-color:#2ed1f7}
 .touch-controls #boost-touch:disabled{opacity:.5}
 .touch-controls #boost-touch:not(:disabled),.touch-controls #boost-touch.boost-active{background:linear-gradient(145deg,#FAB716,#FF5100);border-color:#fff;color:#041579}
 .touch-tip{position:absolute;left:10px;right:10px;bottom:max(12px,env(safe-area-inset-bottom));text-align:center;color:#a9c5ee;font-size:8px;font-weight:700;letter-spacing:.08em;pointer-events:none}
 .game-shell[data-level="5"] .touch-direction{grid-template-columns:repeat(2,52px);gap:6px;bottom:max(20px,env(safe-area-inset-bottom))}
 .game-shell[data-level="5"] .touch-direction button{height:52px;font-size:22px}
 .game-shell[data-level="5"] .touch-tip{display:none}
 .menu-touch{display:block;font-size:12px!important;line-height:1.5}
 .menu-controls dl.menu-keys-keyboard,.menu-controls h3 .menu-keys-keyboard{display:none}
 .menu-controls h3::after{content:"TOUCH CONTROLS"}
 .using-gamepad .menu-controls h3::after{content:none}
}
@media (max-width:360px){
 .touch-controls .touch-direction{grid-template-columns:repeat(2,60px);gap:8px;left:12px}
 .touch-controls .touch-actions{right:12px}
 #hud2[data-mobile] .c-score .num{font-size:19px}
 #hud2[data-mobile] .c-time .digits{font-size:23px}
}
@media (orientation:landscape) and (max-height:550px){
 .game-stage{--mobile-top:calc(70px + env(safe-area-inset-top));--mobile-bottom:0px;--thumb-bottom:max(22px,env(safe-area-inset-bottom))}
 .game-stage::after{display:none}
 .touch-controls .touch-direction{grid-template-columns:repeat(2,64px)}
 .touch-controls button,.touch-controls #boost-touch,.touch-controls #repair-touch{height:64px}
 .touch-controls .touch-context{left:50%;right:auto;transform:translateX(-50%);bottom:var(--thumb-bottom);gap:10px}
 .touch-controls .touch-tip{display:none}
 .game-shell[data-level="5"] .touch-direction{grid-template-columns:repeat(4,52px);bottom:var(--thumb-bottom)}
}
