/* Phone shell. Positions share the measured HUD edge and the device safe area. */
:root{--hud-end:60px;--edge:max(10px,env(safe-area-inset-left));--right:max(10px,env(safe-area-inset-right));--floor:max(12px,env(safe-area-inset-bottom));--ink:#203552;--paper:#fff9e9;--gold:#f5ce66}
#hud[hidden],#bj-hud-guide[hidden],#bj-view-toggle[hidden],#bj-touch-pad[hidden],#zoom button[hidden]{display:none!important}
#bj-hud-guide,#bj-view-toggle{font:800 12px/1 Nunito,system-ui,sans-serif;color:var(--ink);background:var(--paper);border:1px solid #cbbd9c;border-radius:12px;padding:0 12px;min-height:40px;cursor:pointer;touch-action:manipulation}
#bj-touch-pad{position:absolute;bottom:var(--floor);left:var(--edge);width:86px;height:86px;touch-action:none;user-select:none;border-radius:50%;border:2px solid #fff9;background:radial-gradient(circle,#33475955 49%,#e3eef270 50%,#e3eef270 53%,#293a4ebd 54%);box-shadow:0 3px 10px #19243540;z-index:11}
.bj-touch-knob{position:absolute;top:50%;left:50%;display:block;width:38%;aspect-ratio:1;background:var(--paper);border:2px solid var(--gold);border-radius:50%;transform:translate(-50%,-50%);pointer-events:none}
#prompt{touch-action:manipulation}
#prompt small{display:block;font:700 11px/1.2 Nunito,system-ui,sans-serif;white-space:normal;overflow-wrap:anywhere}
#zoom button:is(#movementMode,#viewProfile,#viewFull,#viewGrid){width:auto;min-width:40px;padding:4px 8px;font:800 12px/1.2 Nunito,system-ui,sans-serif}
#tourWrap>div:last-child{max-height:calc(100dvh - 16px);overflow:auto!important;overscroll-behavior:contain}
#tourWrap .btn{min-height:40px}
#modal .card>.card-b,#modal .card>.card-f,#dialog{min-height:0;max-width:100%;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
#modal .card>.card-b{overflow-y:auto}
#modal .card>.card-h{flex:0 0 auto}
#modal .card>.card-h h2{min-width:0;overflow-wrap:anywhere}
#modal .card>.card-f>.btn,#dialog button{white-space:normal;overflow-wrap:anywhere}
#modal .card.bj-answer-scroll>.card-f>.btn{flex-shrink:0}
#bjCityTour .bj-map-stage{align-self:center;width:min(100%,calc(100dvh - 244px),430px)!important;max-height:none!important;aspect-ratio:1;flex:none}
#bjCityTour .bj-map-stage>.cmplan{position:static!important;width:100%!important;height:auto!important;display:block;aspect-ratio:1}
#bjCityTour .bj-city-tour-panel{overflow:auto}
@media(pointer:coarse),(max-width:700px){
 #hud:not([hidden]){display:grid!important;grid-template-columns:minmax(0,1.35fr) minmax(0,1fr) minmax(0,.72fr) minmax(0,1.08fr);
 grid-template-areas:"day cash gems needs" "career build sound phone";align-items:stretch!important;gap:4px!important;
 position:absolute;top:max(5px,env(safe-area-inset-top))!important;left:var(--edge)!important;right:var(--right)!important;width:auto!important;max-width:580px!important;margin:0 auto;box-sizing:border-box;padding:5px!important;border:1px solid #42516c;border-radius:16px;background:#1c2e48;box-shadow:0 3px 12px #12253c50;z-index:15!important}
 #hud .spacer,#hud .dayc #hDow,#hud .gplus,#hud #btnCareer .ct small{display:none!important}
 #hud>.chip{margin:0!important;padding:0 4px!important;width:100%!important;max-width:100%!important;min-width:0!important;height:40px!important;box-sizing:border-box;align-items:center!important;justify-content:center!important;
 border:0!important;border-radius:9px!important;box-shadow:none!important;gap:4px!important;
 font:800 13px/1.12 Nunito,system-ui,sans-serif!important;touch-action:manipulation}
 #hud>.chip[hidden]{display:none!important}
 #hud #hDayBtn{grid-area:day;background:#f3ce6e;color:#1a2d44}
 #hud #cashChip{grid-area:cash;background:#f5f2e6;color:#29593d;font-variant-numeric:tabular-nums}
 #hud #hMoney{font-size:clamp(11px,3.2vw,15px);white-space:normal;overflow-wrap:anywhere;line-height:1.05}
 #hud #hGems{grid-area:gems;background:#eee8fa;color:#593e84}
 #hud #bars{grid-area:needs;background:#f4f0e6;display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:2px 3px!important;padding:4px!important}
 #bars .bar,#bars .track{min-width:0!important;width:100%!important}#bars .bar svg{width:12px;height:12px;flex:none}
 #hud #btnCareer{grid-area:career}#hud #btnBuild{grid-area:build}#hud #btnSound{grid-area:sound}#hud #btnPhone{grid-area:phone}
 #hud :is(#btnCareer,#btnBuild,#btnSound,#btnPhone){background:#304764;color:#fff9e9}
 #hud #btnCareer .ring{flex:0 0 24px!important;width:24px!important;height:24px!important;margin:0}
 #hud #btnCareer .ct{display:block!important;min-width:0;overflow:hidden}#btnCareer .ct b{display:block;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:100%;font-size:11px}
 #hud #btnSound svg,#hud #btnPhone svg{width:18px!important;height:18px!important}
 #hud #btnPhone:after{content:var(--phone-word,"Phone");font-size:11px}
 #hud:has(#btnBuild[hidden]){grid-template-areas:"day cash gems needs" "career career sound phone"}
 #bj-hud-guide:not([hidden]){position:absolute;top:calc(100% + 7px);left:0;min-height:36px;border-radius:18px;background:var(--paper);z-index:2}
 #bj-view-toggle{position:absolute;z-index:12;bottom:var(--floor);left:calc(var(--edge) + 94px);height:40px;min-width:62px}
 #game:has(#bj-touch-pad[hidden]) #bj-view-toggle{left:var(--edge)}
 #zoom:not([hidden]){display:none!important}body.bj-tools-open #zoom:not([hidden]){
 display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));grid-auto-rows:minmax(40px,auto);gap:5px!important;
 position:absolute!important;left:var(--edge)!important;right:auto!important;top:auto!important;bottom:calc(var(--floor) + 96px)!important;
 width:min(238px,75vw)!important;max-height:calc(100dvh - var(--hud-end) - 114px);overflow:auto;z-index:17!important;padding:6px;border:1px solid #a8b0b5;border-radius:13px;background:var(--paper);box-shadow:0 6px 16px #17284159}
 #zoom button{width:100%!important;height:auto!important;min-height:40px!important;margin:0!important;touch-action:manipulation}
 #zoom #movementMode{grid-column:span 2}
 #minimap:not([hidden]){position:absolute!important;top:calc(var(--hud-end) + 7px)!important;right:var(--right)!important;left:auto!important;bottom:auto!important;width:82px!important;height:82px!important;box-sizing:border-box;border:3px solid var(--paper)!important;border-radius:16px!important;box-shadow:0 2px 8px #16243866;z-index:9;cursor:pointer;touch-action:manipulation}
 #goals:not([hidden]){top:calc(var(--hud-end) + 7px)!important;left:var(--edge)!important;width:min(187px,51vw)!important;max-height:min(38dvh,290px)!important;overflow:auto!important;z-index:10!important}
 #game:has(#bj-hud-guide:not([hidden])) #goals:not([hidden]){top:calc(var(--hud-end) + 49px)!important}
 #goals.min:not([hidden]){width:max-content!important;max-width:50vw!important;padding:0!important;border-radius:12px}
 #goals.min :is(.goal-rent,.bj-bills-one-line,.bj-mission-mini){display:none!important}
 #goals.min h4{padding:10px!important;margin:0!important;min-height:36px;box-sizing:border-box}
 #needsPanel:not([hidden]){top:calc(var(--hud-end) + 7px)!important;right:var(--right)!important;left:auto!important;width:min(260px,76vw)!important;max-height:52dvh;overflow:auto;z-index:18!important}
 #prompt:not([hidden]),#slice-near-action:not([hidden]){position:absolute!important;left:auto!important;right:var(--right)!important;bottom:var(--floor)!important;transform:none!important;
 width:auto!important;max-width:min(45vw,160px);min-height:48px!important;padding:6px 13px!important;border:2px solid #d6a64b;border-radius:14px;background:#ffdb7c;color:#2a3040;z-index:13}
 #game:has(#needsPanel:not([hidden])) #minimap,#game:has(#gemMenu:not([hidden])) #minimap,body:has(.bj-admin-visible #slice-near-action:not([hidden])) #prompt{visibility:hidden}
 #tut:not([hidden]){max-height:25dvh!important;overflow:auto;top:calc(var(--hud-end) + 8px)!important}
 #toasts,#toasts:not(.x){pointer-events:none!important;left:auto!important;right:var(--right)!important;top:auto!important;bottom:calc(var(--floor) + 59px)!important;transform:none!important;max-width:min(230px,64vw);z-index:12!important}
 body.modalup #toasts,body:has(#tourWrap,#bjCityTour) #toasts{visibility:hidden}
 #dialog{max-height:calc(100dvh - var(--hud-end) - 18px)!important;overflow:auto!important}
 #modal .card{min-height:0;max-height:calc(100dvh - max(16px,env(safe-area-inset-top)) - env(safe-area-inset-bottom))!important}
 #modal .card>.card-b{min-height:0!important;overflow-y:auto!important}
 #modal .card>.card-f{flex:0 1 auto!important;min-height:0!important;max-height:39dvh!important;overflow-y:auto!important}
 #modal .card>.card-f .btn,#modal .card-h button,#dialog button{min-height:40px;touch-action:manipulation}
 #modal .card-h h2{font-size:clamp(15px,4vw,20px)!important}
}
@media(orientation:landscape) and (max-height:550px){
 #hud:not([hidden]){right:auto!important;max-width:min(57vw,510px)!important;width:min(57vw,510px)!important}
 #hud>.chip{height:35px!important}
 #minimap:not([hidden]){top:max(6px,env(safe-area-inset-top))!important;width:70px!important;height:70px!important}
 #bj-touch-pad{width:68px;height:68px}
 #bj-view-toggle{left:calc(var(--edge) + 76px)}
 body.bj-tools-open #zoom:not([hidden]){bottom:calc(var(--floor) + 48px)!important;left:calc(var(--edge) + 76px)!important;max-height:calc(100dvh - var(--hud-end) - 60px)}
 #game:has(#bj-hud-guide:not([hidden])) #goals:not([hidden]){left:calc(var(--edge) + 89px)!important;top:calc(var(--hud-end) + 7px)!important}
 #bjCityTour .bj-city-tour-panel{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);width:min(700px,94vw);max-height:96dvh}
 #bjCityTour .bj-city-tour-head{grid-column:span 2}
 #bjCityTour .bj-map-stage{grid-row:span 2;width:min(100%,calc(100dvh - 95px))!important}
 #bjCityTour .bj-city-tour-info{align-self:center}
}
@media(pointer:coarse),(max-width:700px){
 #hud #btnCareer .ring b{color:#203552;width:18px;height:18px;font-size:11px}
 #hud #btnBuild:disabled{opacity:.6}
 #hud #btnPhone{display:flex!important;flex-flow:row nowrap!important}
 #hud #btnPhone:after{position:static!important;inset:auto!important;transform:none!important;order:1}
 #rotate{display:none!important}
}
@media(pointer:fine) and (min-width:701px){
 #minimap:not([hidden]){top:calc(var(--hud-end) + 10px);bottom:auto;right:12px;width:110px;height:110px}
 #hud #bj-hud-guide{margin-left:3px}
 #zoom{max-height:calc(100dvh - var(--hud-end) - 20px);overflow:auto}
}
@media(pointer:fine) and (min-width:701px){
 #game #prompt:not([hidden]){position:absolute!important;inset:auto auto 16px 50%!important;transform:translateX(-50%)!important;z-index:14;min-height:46px;padding:5px 18px}
}
@media(pointer:coarse),(max-width:700px){
 #hud .chip::after{content:none!important}
 #hud #btnPhone::after{content:var(--phone-word,"Phone")!important;width:auto!important;height:auto!important;min-width:0!important;min-height:0!important;pointer-events:none}
}
#tourWrap button:focus-visible,#bj-hud-guide:focus-visible,#minimap:focus-visible{outline:3px solid #d4931c;outline-offset:2px}

/* V28 phone polish */
.cal div{padding:2px 1px!important;min-width:0}
.cal b,.cal span{font-size:10px!important;line-height:1.25;white-space:nowrap;overflow-wrap:normal!important;word-break:keep-all;display:block}
@media(pointer:coarse),(max-width:700px){
 #modal .card .card-h .x,#modal .card .card-h .back,#bjCityTour .bj-city-tour-close{min-width:48px!important;min-height:48px!important;height:48px!important}
 #prompt:not([hidden]),#slice-near-action:not([hidden]){width:max-content!important;max-width:calc(100vw - 190px)!important}
 #toasts,#toasts:not(.x){max-width:min(78vw,300px)!important}
 #toasts .toast{max-width:100%!important}
}
@media(orientation:portrait) and (max-width:600px){
 #toasts,#toasts:not(.x){bottom:calc(var(--floor) + 100px)!important}
}
#hud #hDay{white-space:nowrap}
@media(max-width:380px){#hud #hDay{font-size:15px!important}#hud #hDayBtn{gap:4px!important;padding-left:4px!important;padding-right:4px!important}}

/* V29: action areas and tab bars must not be squeezed by long content above them */
#modal .card.bj-mymart>.card-f{flex:0 0 auto!important;max-height:45dvh!important}
@media(orientation:portrait){#modal .card.mapmodal>.card-f{flex:0 0 auto!important;max-height:42dvh!important}}
#modal .vt-nav{flex:0 0 auto!important}
#modal .bj-skills-list{grid-template-columns:repeat(auto-fit,minmax(min(100%,190px),1fr))!important}
#bj-quit-delivery{position:absolute;z-index:14;right:max(10px,env(safe-area-inset-right));bottom:calc(env(safe-area-inset-bottom) + 8px);min-height:44px;padding:0 16px;border-radius:12px;border:2px solid #ffd23f;background:#fffaf0;color:#14213d;font:800 14px Nunito,system-ui,sans-serif}
#bj-quit-delivery[hidden]{display:none!important}
@media(max-width:380px){#hud #hDay{font-size:12.5px!important}#hud #hDayBtn{gap:3px!important;padding-left:3px!important;padding-right:3px!important}#hud #hDayBtn .dayc{min-width:0}#hud #hDayBtn .clock{font-size:12.5px!important;padding:2px 4px!important}}
@media(orientation:landscape) and (max-height:550px){
 #modal .card.bj-mymart>.card-f{flex-direction:row!important;gap:6px!important}
 #modal .card.bj-mymart>.card-f>.btn{flex:1 1 0!important;width:auto!important}
}
