/* The playfield, status rail and touch controls each get their own space. */
:root{--nav:42px;--status:96px;--dock:148px}
#wrap{height:100dvh;width:100vw;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:calc(var(--nav) + 10px) 12px 10px;overflow:hidden}
#releaseNav{position:absolute;inset:0 0 auto;height:var(--nav);display:flex;align-items:center;justify-content:space-between;gap:12px;padding:5px max(12px,env(safe-area-inset-left));background:#080d19;border-bottom:1px solid #475269;z-index:11;font:bold 10px monospace}
#releaseNav a{color:#ffe0a5;text-decoration:none;padding:8px 0;white-space:nowrap}#releaseNav>span{color:#9bb0c7;font-size:10px}.releaseTools{display:flex;align-items:center;gap:10px;flex-shrink:0}
#releaseNav button{padding:7px 10px!important;font-size:10px!important;box-shadow:none!important;min-height:32px}
#playStatus{order:1;display:none;align-items:center;justify-content:space-between;gap:18px;width:min(100%,1120px);flex-shrink:0;min-height:var(--status);padding:4px 6px;background:#0c1625;border:1px solid #455369}
.adventure-active #playStatus{display:flex}
#hudTop{position:static;display:flex;align-items:center;justify-content:space-between;gap:24px;flex:1;min-width:0;pointer-events:none;text-shadow:0 2px #000}
#hudTop .hudpanel{padding:7px 10px!important;border:0!important;box-shadow:none!important;background:transparent!important;border-radius:0;min-width:0;flex-shrink:0}
#hudTop .hudpanel:first-child{width:235px}#health,#energy{width:100%;max-width:190px}#health{height:11px!important}
#hudTop .hudpanel>small:first-child{font-size:0!important}#coreTxt{display:inline;font-size:10px;line-height:1.5}#bitsTxt{display:block;line-height:1.4}#guardHint{font-size:9px;line-height:1.5;margin-top:2px}
#questbox{flex:1!important;flex-shrink:1!important;max-width:340px;text-align:left;font-size:11px!important;line-height:1.55}#zoneTitle{font-size:12px!important;line-height:1.6;letter-spacing:.06em}#questTxt{font-size:11px!important;line-height:1.45}
#foot{position:static;display:grid;grid-template-columns:repeat(2,minmax(50px,1fr));gap:9px;flex-shrink:0;padding:5px;pointer-events:auto}
#foot button{min-height:30px;padding:6px 8px!important;font-size:10px!important;box-shadow:none!important}
#stage{order:2;flex-shrink:0;width:min(calc(100vw - 24px),calc((100dvh - var(--nav) - var(--status) - 42px)*1.777778));height:auto;aspect-ratio:16/9;overflow:hidden;transform:none}
#wrap:not(.adventure-active) #stage{width:min(calc(100vw - 24px),calc((100dvh - var(--nav) - 26px)*1.777778))}
#overlay::before{background-image:url('art/loading.webp')!important;mask-image:none;opacity:.35!important}
#overlay[data-view=title]::before{background-image:url('art/title.webp')!important;opacity:1!important}
#overlay[data-view=title]::after{display:none}
#overlay[data-view=title]{background:#0a1020;padding:2% 3%}
#overlay[data-view=title] .panel{background:#081222ed;width:60%;padding:18px!important;max-width:580px}
#overlay .panel{max-height:94%;overscroll-behavior:contain;touch-action:pan-y}
#overlay[data-view=title] .intro{font-size:11px!important;line-height:1.6!important}
#orientationHint{order:4;display:none}
#bossbar{top:10px;bottom:auto;left:25%;width:50%;font-size:10px;letter-spacing:1px}#bossbar .bar{height:10px;margin-top:4px}
#styleHud{top:auto;bottom:12px;left:12px;min-width:0;max-width:150px;transform:none!important;background:#091526d9;padding:6px 9px;border-left:2px solid #eebf79}
#styleGrade{font-size:25px;letter-spacing:0;float:left;margin-right:9px;text-shadow:2px 2px #713744}#styleLabel{font-size:9px;letter-spacing:.03em;line-height:1.4}#styleScore{font-size:8px;line-height:1.4;letter-spacing:0}
#counterTag{top:58px;font-size:clamp(12px,2.4vw,22px);letter-spacing:0;text-shadow:2px 2px #713744;max-width:75%;line-height:1.3}
#toast{top:16%;padding:7px 12px;font-size:11px;line-height:1.45;max-width:72%;border-width:1px;box-shadow:none}
#guide{display:none!important}
#mapScreen{inset:10px;overflow:auto;padding:14px;touch-action:pan-y;overscroll-behavior:contain}
.maprow{grid-template-columns:repeat(3,1fr);gap:12px;margin-top:14px}.mapcell{height:65px;font-size:10px}
#mapScreen p{line-height:1.5;margin:8px 0!important}
#touch{z-index:5;order:3;pointer-events:none}
body.touch-device #wrap{padding-bottom:calc(var(--dock) + env(safe-area-inset-bottom));gap:10px}
body.touch-device #stage{width:min(calc(100vw - 24px),calc((100dvh - var(--nav) - var(--status) - var(--dock) - 40px)*1.777778));height:auto;transform:none}
body.touch-device #wrap:not(.adventure-active) #stage{width:min(calc(100vw - 24px),calc((100dvh - var(--nav) - var(--dock) - 30px)*1.777778))}
body.touch-device #touch{position:absolute;top:auto;bottom:env(safe-area-inset-bottom);left:10px;right:10px;height:var(--dock);background:#0c1625;border-top:1px solid #455369;display:block}
body.touch-device #touch .pad{position:absolute;bottom:9px;top:auto;transform:none;max-width:none;pointer-events:none}
body.touch-device #touch .pad.left{left:5px;display:flex;gap:12px!important;align-items:center;bottom:36px}
body.touch-device #touch .pad.right{right:5px;display:grid;grid-template-columns:repeat(5,52px);gap:10px!important}
body.touch-device #touch .touchBtn{width:52px;height:52px;padding:0;font-size:10px!important;touch-action:none}
body.touch-device #touch .pad.left .touchBtn{width:65px;height:70px;font-size:24px!important}
#audioDialog{color:#f9ead1;background:#111d30;border:3px solid #dda76b;max-width:500px;width:90%;max-height:90dvh;overflow:auto;font:12px monospace;padding:20px;touch-action:pan-y}
#audioDialog::backdrop{background:#040812cc}#audioDialog label{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:18px 0}#audioDialog input[type=range]{width:65%;accent-color:#edb774}#audioDialog select{width:60%;background:#243951;color:#fff;padding:9px}#audioDialog button{margin:5px;padding:10px}#audioDialog p{line-height:1.5;color:#b8cbdc}
.expanded #wrap{position:fixed;inset:0;z-index:100}#wrap:fullscreen{background:#090c19}
#bootScreen{position:absolute;inset:0;z-index:30;display:flex;align-items:center;background:linear-gradient(90deg,#080e22e8,#080e2260),url('art/loading.webp') center/cover no-repeat;padding:5%;color:#f6d6a1;font:12px/1.5 monospace}#bootScreen[hidden]{display:none}#bootScreen b{font-size:clamp(28px,5vw,56px);text-shadow:3px 3px #673332}#bootScreen progress{accent-color:#f3b467;width:230px;max-width:70vw;height:12px}#bootStatus{font-size:10px}
/* Reduced HUD retains health, energy, objectives, map and all input. */
body.displays-hidden #hud.on{display:block!important}body.displays-hidden #styleHud,body.displays-hidden #toast,body.displays-hidden #counterTag{display:none!important}
body.cg-hud-minimal[data-cg-game=brick-boy] #styleHud{display:none!important}
#displayToggle[aria-pressed=false]{color:#ffdfa2;background:#243549}
@media(max-width:700px){
 :root{--status:104px;--dock:174px}
 #releaseNav>span{display:none}.releaseTools{gap:7px}#releaseNav{padding-left:10px;padding-right:10px;font-size:9px}
 #playStatus{gap:4px;padding:3px;flex-wrap:wrap}#hudTop{gap:12px;width:100%}#hudTop .hudpanel{padding:3px 5px!important}
 #hudTop .hudpanel:first-child{width:43%}#health,#energy{max-width:145px}#hudTop small{font-size:9px!important;letter-spacing:0}
 #coreTxt{font-size:9px!important}#zoneTitle{font-size:10px!important}#questTxt{font-size:9px!important}#questbox{max-width:54%}
 #foot{display:flex;justify-content:flex-end;width:100%;padding:0 4px 3px;gap:9px}#foot button{min-height:28px;font-size:9px!important}
 body.touch-device #touch .pad.right{grid-template-columns:repeat(4,44px);gap:9px!important}
 body.touch-device #touch .touchBtn{width:44px;height:44px;font-size:9px!important}
 body.touch-device #touch .pad.left{gap:9px!important;bottom:52px}body.touch-device #touch .pad.left .touchBtn{width:48px;height:65px}
 #overlay[data-view=title] .panel{width:96%;padding:10px!important}#overlay[data-view=title] .intro{display:none}.bigtitle{font-size:31px!important}#overlay .keyhint{font-size:8px!important;line-height:1.5!important}
 #counterTag{top:38px}#toast{font-size:9px;max-width:80%}#bossbar{top:6px;font-size:8px}
 #orientationHint{display:none}
}
@media(orientation:landscape) and (pointer:coarse),(orientation:landscape) and (max-height:500px){
 :root{--status:62px;--dock:0px;--nav:38px}
 body.touch-device #wrap{padding:calc(var(--nav) + 7px) max(184px,env(safe-area-inset-right)) 7px max(94px,env(safe-area-inset-left));gap:7px}
 body.touch-device #playStatus{width:100%;min-height:var(--status);padding:2px;gap:8px;flex-wrap:nowrap}
 body.touch-device #hudTop{gap:10px}body.touch-device #hudTop .hudpanel:first-child{width:45%}
 body.touch-device #questbox{max-width:52%}body.touch-device #guardHint{display:none}
 body.touch-device #foot{display:grid;grid-template-columns:repeat(2,1fr);width:auto;gap:6px;flex-shrink:0}
 body.touch-device #foot button{font-size:8px!important;padding:5px!important;min-height:27px}
 body.touch-device #stage{width:min(calc(100vw - 278px),calc((100dvh - var(--nav) - var(--status) - 30px)*1.777778));height:auto;transform:none}
 body.touch-device #wrap:not(.adventure-active) #stage{width:min(calc(100vw - 278px),calc((100dvh - var(--nav) - 24px)*1.777778))}
 body.touch-device #touch{inset:var(--nav) 0 0;height:auto;border:0;background:transparent}
 body.touch-device #touch .pad{top:50%;bottom:auto;transform:translateY(-50%)}
 body.touch-device #touch .pad.left{left:max(10px,env(safe-area-inset-left));display:grid;grid-template-columns:64px;gap:14px!important;height:auto}
 body.touch-device #touch .pad.left .touchBtn{width:64px;height:62px}
 body.touch-device #touch .pad.right{right:max(10px,env(safe-area-inset-right));grid-template-columns:repeat(3,48px);gap:10px!important}
 body.touch-device #touch .touchBtn{width:48px;height:48px;font-size:9px!important}
 #overlay[data-view=title] .panel{width:95%;padding:9px!important}#overlay .intro{display:none}#overlay .bigtitle{font-size:30px!important}#actions button{padding:8px!important;font-size:10px!important}.keyhint{font-size:8px!important;line-height:1.3!important}
 #mapScreen{padding:8px}.mapcell{height:50px;font-size:8px}.maprow{gap:8px}
}
@media(max-width:360px) and (orientation:portrait){#foot button{font-size:8px!important}body.touch-device #touch .pad.right{grid-template-columns:repeat(4,42px);gap:7px!important}body.touch-device #touch .touchBtn{width:42px}body.touch-device #touch .pad.left .touchBtn{width:42px}.releaseTools{gap:4px}#releaseNav a{font-size:8px}}

/* Analog movement pad: Mayhem-style thumb base, proportional 2D movement. */
body.touch-device #touch .move-pad{width:108px;height:112px!important;display:block!important;bottom:32px!important;left:9px!important}
#moveStick{position:relative;width:104px;height:104px;border-radius:50%;pointer-events:auto;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;cursor:grab;background:radial-gradient(circle at 45% 35%,#263b4d 0%,#172837 56%,#0b1520 57%,#182b39 68%,#09121d 69%);border:2px solid #9cb6bd;box-shadow:inset 0 0 0 5px #0c1b27,0 5px 0 #050c13,0 0 0 5px #142431}
#moveStick::before,#moveStick::after{position:absolute;top:40%;font:900 18px monospace;color:#b7c8c6;pointer-events:none}
#moveStick::before{content:'‹';left:8px}#moveStick::after{content:'›';right:8px}
#moveStick .stick-track{position:absolute;left:15%;right:15%;height:2px;top:50%;background:#759eab77;pointer-events:none}
#moveNub{position:absolute;left:50%;top:50%;margin:-24px 0 0 -24px;width:48px;height:48px;border-radius:50%;background:radial-gradient(circle at 35% 30%,#a8b9b4,#5b777d 48%,#29434e 52%,#1a2b36 70%);border:2px solid #d6cba9;box-shadow:0 4px 8px #0009,inset 0 0 0 4px #243c47;pointer-events:none;will-change:transform}
#moveStick.active{cursor:grabbing;border-color:#ffe0a5;box-shadow:inset 0 0 0 5px #0c1b27,0 5px 0 #050c13,0 0 0 5px #725438}
#moveStick>span{position:absolute;left:0;right:0;top:calc(100% + 8px);text-align:center;color:#c0d2d5;font:900 9px monospace;letter-spacing:2px;pointer-events:none}
@media(max-width:360px) and (orientation:portrait){body.touch-device #touch .move-pad{left:2px!important;width:100px}#moveStick{width:96px;height:96px}}
@media(orientation:landscape) and (pointer:coarse),(orientation:landscape) and (max-height:500px){
 body.touch-device #wrap{padding-left:max(116px,env(safe-area-inset-left))}
 body.touch-device #stage{width:min(calc(100vw - 300px),calc((100dvh - var(--nav) - var(--status) - 30px)*1.777778))}
 body.touch-device #wrap:not(.adventure-active) #stage{width:min(calc(100vw - 300px),calc((100dvh - var(--nav) - 24px)*1.777778))}
 body.touch-device #touch .move-pad{left:max(8px,env(safe-area-inset-left))!important;top:50%;bottom:auto!important;transform:translateY(-50%);height:112px!important}
 #moveStick{width:96px;height:96px}
}
