/* v4 must-fix 3+4: landscape readability + side panels. Only the first three HUD-zoom rules also apply in portrait. */
/* (the three zoom rules above apply in portrait too: --hz=u there, i.e. the old zoom without the leaked menu-fit factor) */
/* In-run HUD: scale with the short side (--hz, set in resize) instead of u*mf; small labels get a 12px floor. */
body:not(.menu-home):not(.over-ui) #hud>div{zoom:var(--hz,1)!important}
body:not(.menu-home):not(.over-ui) #mute{zoom:calc(1 / var(--hz,1))}
#mHud{zoom:calc(1 / var(--hz,1))}
html.land #mHud{zoom:1.08}
html.land #meter{width:170px;height:16px}html.land #meter span{font-size:12px;line-height:16px;letter-spacing:2px}
html.land #best{font-size:12px}html.land #best b{font-size:17px}html.land #coins{font-size:14px}
html.land #pause{width:40px;height:40px;font-size:13px}html.land #langb{font-size:13px}
html.land #mult{font-size:13px}html.land .record-hint{font-size:13px}
html.land #recordHint{font-size:13px}
/* Menu + game-over small labels */
html.land .menu-short-label{font-size:12px!important}
html.land #over.compact-over .over-iconbutton{font-size:12px}
/* Game over in landscape: two columns (result left; continue/restart right) so the secondary lines never sit under a button. */
html.land #over.compact-over{grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto 52px minmax(0,1fr) 64px;column-gap:24px;padding-top:calc(env(safe-area-inset-top) + 58px)}
html.land #over.compact-over .over-result{grid-column:1;grid-row:1 / 5;align-self:center;justify-self:end;width:min(100%,380px)}
html.land #over.compact-over .btns.over-continue{grid-column:2;grid-row:2;justify-self:start;align-self:end}
html.land #over.compact-over .btns.over-restart{grid-column:2;grid-row:3;justify-self:start}
html.land #over.compact-over .btns.over-actions{grid-column:1 / -1;grid-row:5}
/* Side panels */
.side-panel{position:fixed;top:50%;box-sizing:border-box;padding:14px 16px;border-radius:18px;background:#070f22cc;border:1px solid #7fb6e055;box-shadow:0 0 24px #00000066;color:#dff3ff;font:700 13px/1.35 system-ui,-apple-system,"Segoe UI",sans-serif;pointer-events:none;z-index:2;letter-spacing:0}
.side-panel[hidden]{display:none!important}
#sideL{left:calc(env(safe-area-inset-left) + 22px)}#sideR{right:calc(env(safe-area-inset-right) + 22px)}
.side-panel p{margin:0}
.side-panel .sp-k{font-size:12px;font-weight:900;letter-spacing:1.5px;text-transform:uppercase;color:#8ff3e6}
.side-panel .sp-big{margin-top:4px;font-size:20px;font-weight:900;color:#fff;overflow-wrap:anywhere}
.side-panel .sp-s{margin-top:6px;font-size:13px;color:#b9cbe0;overflow-wrap:anywhere}
.side-panel .sp-bar{margin-top:8px;height:10px;border-radius:6px;background:#ffffff14;border:1px solid #9a7bff66;overflow:hidden}
.side-panel .sp-bar i{display:block;height:100%;width:0;background:linear-gradient(90deg,#2ff3e0,#ff4fd8);transition:width .12s linear}
.side-panel .sp-bar[hidden]{display:none}
.side-panel .sp-ctrl{margin-top:12px;padding-top:10px;border-top:1px solid #ffffff1f;font-size:13px;color:#ffd9f4;white-space:pre-line}
.side-panel .sp-beast{display:flex;align-items:center;gap:10px;margin:6px 0 10px}
.side-panel .sp-beast canvas{width:72px;height:63px;flex-shrink:0}
.side-panel .sp-name{font-size:16px;font-weight:900;color:#fff}
.side-panel .sp-perk{margin-top:3px}
.side-panel.bm .sp-mk{color:#ffe14f}.side-panel.bm .sp-meter{border-color:#ffe14f}
.side-panel .sp-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin-top:10px;text-align:center}
.side-panel .sp-stats b{display:block;font-size:18px;color:#fff}.side-panel .sp-stats small{display:block;font-size:12px;color:#b9cbe0}
@media (prefers-reduced-motion:reduce){.side-panel .sp-bar i{transition:none}}
html.fine-pointer #menu.compact-menu #mbox #bDrive{width:min(360px,92vw)}
/* Short portrait screens (e.g. 360x540): the result column fits above the continue button instead of scrolling under it. */
@media (max-height:620px) and (orientation:portrait){html:not(.land) #over.compact-over{padding-top:calc(env(safe-area-inset-top) + 54px);gap:8px}html:not(.land) #over.compact-over .over-result{gap:3px}html:not(.land) #over.compact-over #os{font-size:44px}html:not(.land) #over.compact-over h1{font-size:14px}html:not(.land) #over.compact-over .over-secondary{gap:2px}}
/* Large landscape screens (fullscreen 1280x720 ... 1920x1080): overlays scale with the short side like the world does (--hz, 1 at <=520px high). */
html.land :is(#menu.compact-menu,#over.compact-over,.panel,#pov,#missionComplete,#streakPop,#lvlUp,#obReady,#obRail,#tutorial,#edgeHint,#inputPip,.side-panel){zoom:var(--hz,1)}
html.land body.menu-home #hud>.r,html.land body.over-ui #hud>.r{zoom:var(--hz,1)!important}
/* Menu panels in landscape: 12px floor for the small card/notice labels (portrait keeps its sizes). */
html.land .panel :is(.phd .wal,.phd .wal span,.phd .wv,.vnotice,.card p,.card .tag,.lvl-badge,.lvl-xp,.lvl-perk,.missioncard p,.worldcard p){font-size:12px!important}
html.land .panel .card .tag{line-height:1.3}
