/* Portrait is a playable office window above a thumb-sized control deck. */
.office-look{display:none}
html[data-touch-input] .game button:focus-visible{outline:none}
@media(max-width:1100px) and (orientation:portrait){
 .game{--safe-bottom:env(safe-area-inset-bottom,0px);height:100svh;height:100dvh;overflow:hidden}
 .game .game-hud{height:68px;background:#050605}
 .game .game-hud .clock{top:9px;right:14px}
 .game .clock strong{font-size:28px;line-height:1}
 .game .game-hud>div:first-child{top:43px;right:14px}
 .game .game-hud #pause{top:14px;left:12px;min-height:40px}
 .game .game-hud #fullscreen{top:14px;left:88px;min-height:40px}
 .game .viewport{container-type:size;top:68px;bottom:calc(248px + var(--safe-bottom));height:auto;aspect-ratio:auto}
 .game .office{inset:0 auto 0 50%;height:100%;width:auto;min-width:100%;aspect-ratio:1672 / 941;translate:-50% 0;transform:translateX(var(--look-x));transition:transform .18s ease-out}
 .reduced .game .office{transform:translateX(var(--look-x))!important;transition:none!important}
 .game .office-vignette{box-shadow:inset 0 0 50px 5px #0007}
 .game .office-look{position:absolute;inset:auto 0 0;z-index:7;display:grid;grid-template-columns:1fr .65fr 1fr;gap:4px;padding:8px;background:linear-gradient(transparent,#000d 40%)}
 .game .office-look button{min-height:44px;padding:8px 4px;font-size:10px;background:#090c09bf;border:1px solid #87917b66}
 .game .office-look button[aria-pressed='true']{color:#f3f5e9;border-color:#c1cdb1;background:#253020e8}
 .game .control-bar{inset:auto 12px calc(29px + var(--safe-bottom));padding:0;gap:8px;grid-template-columns:1fr 1fr}
 .game .control-bar :is(#left-control,#right-control,#left-light-control,#right-light-control,#monitor-control,#fridge-control){min-height:50px;padding:10px 5px;font-size:12px}
 .game .control-bar #left-control{grid-area:1 / 1}
 .game .control-bar #right-control{grid-area:1 / 2}
 .game .control-bar #left-light-control{grid-area:2 / 1}
 .game .control-bar #right-light-control{grid-area:2 / 2}
 .game .control-bar #monitor-control{grid-area:3 / 1;width:100%;font-size:11px}
 .game .control-bar #fridge-control{grid-area:3 / 2;width:100%}
 .game .game-hud .power{position:fixed;inset:auto 14px calc(205px + var(--safe-bottom));width:auto;height:34px;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:5px 16px}
 .game .power>span{font-size:12px;max-width:180px}
 .game .power small{grid-column:2;grid-row:1;font-size:10px;align-self:center}
 .game .power .meter{grid-row:2;grid-column:1 / 3;margin:0;height:6px}
 .game .game-footer{inset:auto 14px calc(7px + var(--safe-bottom));padding:0;display:flex;justify-content:space-between;gap:8px;font-size:8px;line-height:1.3}
 .game .game-footer span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 .game .radio-caption,.game .sound-caption{bottom:66px;max-width:calc(100% - 24px);font-size:11px;line-height:1.5}
 .game .tv-subtitle{font-size:8px}
 /* The monitor uses the space freed by office-only controls. */
 .game.monitor-raised .viewport{bottom:calc(112px + var(--safe-bottom))}
 .game.monitor-raised .office-look{display:none}
 .game.monitor-raised .control-bar{grid-template-columns:1fr}
 .game.monitor-raised .control-bar :is(#left-control,#right-control,#left-light-control,#right-light-control,#fridge-control){display:none}
 .game.monitor-raised .control-bar #monitor-control{grid-area:1 / 1;width:100%}
 .game.monitor-raised .game-hud .power{bottom:calc(87px + var(--safe-bottom));height:24px}
 .game .surveillance{--feed-height:min(75cqw,45cqh);container-type:size;border-width:3px;border-bottom-width:8px;inset:0;border-radius:0}
 .game .camera-room{inset:30px auto auto 50%;width:calc(var(--feed-height) * 4 / 3);height:var(--feed-height);aspect-ratio:4 / 3;translate:-50% 0}
 .game .camera-room:before{inset:0;height:100%;width:100%;min-width:0;aspect-ratio:auto;translate:none;transform:none;animation:none}
 .game .cctv-bottom{top:calc(30px + var(--feed-height) - 24px);bottom:auto}
 .game .camera-actor,.game .miroljub-actor,.game .jovanka-feed{width:auto;aspect-ratio:1 / 2}
 .game .camera-panel{right:10px;bottom:26px;width:180px}
 .game .camera-panel>#camera-map,.game .camera-panel>.eyebrow{display:none}
 .game #map-toggle{display:block;width:100%}
 .game #map-toggle,.game .camera-paging button{min-height:44px;font-size:11px}
 .game.map-open .camera-panel{--map-reserve:158px;inset:35px 8px 8px;width:auto;max-height:none;overflow:hidden;container-type:size;display:grid;grid-template-rows:44px minmax(0,1fr) 44px auto;gap:6px;padding:8px;background:#0a100af5}
 .game.map-open .camera-panel:has(#announce[hidden]){--map-reserve:108px}
 .game.map-open #map-toggle{grid-row:1}
 .game.map-open #camera-map{grid-row:2;display:block;width:min(100%,calc((100cqh - var(--map-reserve)) * 560 / 510));height:auto;max-height:none;aspect-ratio:var(--plan-ratio);align-self:center;justify-self:center}
 .game.map-open #camera-map button{min-height:32px;font-size:14px;padding:1px 0}
 .game.map-open #camera-map button small{font-size:8px}
 .game.map-open .camera-paging{grid-row:3;padding:0}
 .game.map-open #announce{grid-row:4;width:100%;margin:0;min-height:44px;padding:8px 4px;font-size:11px}
 .game.map-open .camera-panel>.eyebrow{display:none}
 .game.monitor-raised .sound-caption{bottom:calc(100% - 30px - min(75cqw,45cqh) + 10px);left:50%;max-width:95%}
 .game.monitor-raised.map-open .sound-caption{display:none}
 .game.monitor-raised.map-open .alerts{top:4px;left:8px;right:8px;max-height:70px;overflow:hidden;pointer-events:none}
}
@media(max-width:1100px) and (max-height:650px) and (orientation:portrait){
 .game.map-open #camera-map button{min-height:24px;font-size:12px}
 .game.map-open #camera-map button small{font-size:7px}
 .game.map-open #camera-map .you-marker{min-height:26px;gap:1px}
 .game.map-open #camera-map .you-label{font-size:11px}
 .game.map-open #camera-map .you-marker small{font-size:6px}
}
@media(max-width:1100px) and (orientation:portrait) and (prefers-reduced-motion:reduce){
 .game .office{transform:translateX(var(--look-x))!important;transition:none!important}
}

@media(max-width:1100px) and (min-height:761px) and (orientation:portrait){
 .game:not(.map-open) .camera-panel{--map-reserve:108px;inset:calc(38px + var(--feed-height)) 8px 8px;width:auto;max-height:none;overflow:hidden;container-type:size;display:grid;grid-template-rows:44px minmax(0,1fr) auto;gap:6px;padding:8px;background:#0a100af5}
 .game:not(.map-open) .camera-panel:has(#announce[hidden]){--map-reserve:58px}
 .game:not(.map-open) #map-toggle{grid-row:1}
 .game:not(.map-open) .camera-panel>#camera-map{grid-row:2;display:block;width:min(100%,calc((100cqh - var(--map-reserve)) * 560 / 510));height:auto;max-height:none;aspect-ratio:var(--plan-ratio);align-self:center;justify-self:center}
 .game:not(.map-open) #camera-map button{min-height:28px;font-size:12px;padding:1px 0;gap:1px}
 .game:not(.map-open) #camera-map button small{font-size:7px}
 .game:not(.map-open) #camera-map .you-marker{min-height:26px;gap:1px}
 .game:not(.map-open) #camera-map .you-label{font-size:11px}
 .game:not(.map-open) #camera-map .you-marker small{font-size:6px}
 .game:not(.map-open) .camera-paging{display:none}
 .game:not(.map-open) #announce{grid-row:3;width:100%;margin:0;min-height:44px;padding:8px 4px;font-size:11px}
}

@media(max-width:1100px) and (max-height:760px) and (orientation:portrait){
 .game .surveillance{--feed-height:min(75cqw,calc(100cqh - 110px))}
 .game .surveillance:has(#announce:not([hidden])){--feed-height:min(75cqw,calc(100cqh - 160px))}
 .game:not(.map-open) .camera-panel{inset:auto 8px 8px;width:auto;display:grid;grid-template-columns:1fr 1fr;gap:6px;padding:6px}
 .game:not(.map-open) #map-toggle{grid-area:1 / 1}
 .game:not(.map-open) .camera-paging{grid-area:1 / 2;padding:0}
 .game:not(.map-open) .camera-paging button{font-size:9px;padding:5px 1px}
 .game:not(.map-open) #announce{grid-area:2 / 1 / auto / 3;width:100%;margin:0;min-height:44px;padding:8px 4px}
 .game.monitor-raised .sound-caption{bottom:calc(100% - 30px - min(75cqw,calc(100cqh - 110px)) + 10px)}
 .game.monitor-raised:has(#announce:not([hidden])) .sound-caption{bottom:calc(100% - 30px - min(75cqw,calc(100cqh - 160px)) + 10px)}
}

/* A blackout keeps its exit controls above captions and office navigation. */
.game .outage{z-index:18;padding:16px;gap:8px}
.game .outage p{margin:0;line-height:1.5}
.game .outage #outage-countdown{color:#c4b8a5}
.outage-actions{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:8px}
.outage-actions button{min-height:44px;padding:10px 12px;font-size:11px}
/* Keyboard focus uses an underline instead of the green selection frame. */
#game:focus{outline:none}
#monitor-control:focus-visible{outline:none;text-decoration:underline;text-underline-offset:5px}

/* Labels scale with the plan, rather than inheriting fixed desktop sizes. */
#camera-map{container-type:inline-size}
.game #camera-map button{font-size:clamp(10px,4cqw,16px);min-height:0;gap:2px;padding:1px 0}
.game #camera-map button small{font-size:clamp(5px,2cqw,10px);letter-spacing:0}
.game #camera-map .you-marker{min-height:0;gap:2px;padding:1px}
.game #camera-map .you-label{font-size:clamp(9px,3cqw,14px);gap:3px}
.game #camera-map .you-marker small{font-size:clamp(5px,1.8cqw,9px)}
@container (max-width:279px){
 #camera-map button small,#camera-map .you-marker small{display:none}
}

/* Keep the sprite's 1:2 proportions and center its face during every lunge. */
@media(max-width:1100px){
 #scare[data-enemy] .scare-character{--face-x:61%;left:50%;top:12%;height:min(125svh,200vw);width:auto;aspect-ratio:1 / 2;translate:calc(-1 * var(--face-x)) 0;transform-origin:var(--face-x) 14%;animation-name:mobile-attack}
 #scare[data-enemy='ana'] .scare-character{--face-x:51%}
 #scare[data-enemy='miroljub'] .scare-character{--face-x:54%}
 #scare[data-enemy='jovanka'] .scare-character{--face-x:52%}
 #scare>span{left:12px;right:12px;bottom:8%;text-align:center;font-size:clamp(14px,4vw,28px)}
}
@keyframes mobile-attack{
 0%{transform:scale(.6);opacity:.7}
 25%{transform:scale(1.25);opacity:1}
 65%{transform:scale(2)}
 100%{transform:scale(2.6)}
}

/* Input hints follow the current device, independently of the layout width. */
html:not([data-touch-input]) .touch-hint,
html[data-touch-input] :is(kbd,.keyboard-hint,.menu-key-hint){display:none!important}
.game .control-bar .touch-hint{display:block;font:10px/1.3 var(--mono);letter-spacing:.04em;margin-top:4px}
@media(max-width:1100px) and (orientation:portrait){
 .game .control-bar kbd{display:block;width:max-content;font-size:9px;line-height:1;margin:4px auto 0;padding:2px 3px}
 .game .control-bar :is(#monitor-control,#fridge-control) kbd{margin:4px auto 0}
 html:not([data-touch-input]) .game .game-hud #pause{padding:6px 8px;font-size:10px;line-height:1.2}
 .game .game-hud #pause kbd{display:block;width:max-content;font-size:8px;line-height:1;padding:1px 3px;margin:2px auto 0;letter-spacing:0}
}

/* Reserve the same briefing space for both methods so a tap cannot move its
   own target when switching from a keyboard to touch. */
.shift-controls{display:grid}
html .shift-controls .shift-keys.keyboard-hint,
html .shift-controls .shift-keys.touch-hint{display:grid!important;grid-area:1 / 1}
html:not([data-touch-input]) .shift-controls .touch-hint,
html[data-touch-input] .shift-controls .keyboard-hint{visibility:hidden}
