/* Keep the controls in the visible browser viewport, including when its chrome expands. */
#panel:is([data-view=inventory],[data-view=item],[data-view=hint]) .panel-head{
  align-items:center;gap:8px;padding:10px clamp(10px,2vw,18px);
}
#panel:is([data-view=inventory],[data-view=item],[data-view=hint]) .panel-head>div:first-child{
  display:flex;flex-wrap:wrap;align-items:baseline;gap:3px 11px;min-width:0;
}
#panel:is([data-view=inventory],[data-view=item],[data-view=hint]) #panelTitle{order:-1;margin:0;font-size:clamp(17px,2.8vw,23px)}
#panel:is([data-view=inventory],[data-view=item],[data-view=hint]) #panelKicker{font-size:9px;letter-spacing:.05em}
.library-item-heading{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;margin-bottom:9px}
.library-item-heading .library-item-title,.crt-terminal .panel-body .item-use-action{margin:0}
.crt-terminal .panel-body .item-use-action{min-height:36px;padding:6px 10px;background:#b2df9c;border-color:#b2df9c;color:#08130a}
.crt-terminal .panel-body .item-use-action:hover{background:#d3f4c7}
#panel .item-scroll-cue{grid-column:2;display:block;width:100%;min-height:28px;padding:4px 8px;border:0;border-top:1px solid var(--crt-line);background:#13271a;color:var(--crt-bright);font:700 11px/1.25 var(--crt-mono);text-align:center}
#panel .item-scroll-cue[hidden]{display:none}
@media(max-height:550px){
  #panel:is([data-view=inventory],[data-view=item],[data-view=hint]) .panel-head{padding:9px 15px}
  #panel:is([data-view=inventory],[data-view=item],[data-view=hint]) .panel-workspace{margin-bottom:9px}
  #panel .inventory-pane,#panel .inventory-pane:not([hidden])~.panel-body{height:clamp(94px,calc(100dvh - 175px),275px)}
}
#briefing{overflow:hidden}
.crt-terminal .receive-frame--compact{
  height:100%;min-height:0;grid-template-rows:auto minmax(0,1fr) auto;align-content:stretch;
  gap:clamp(5px,1vh,9px);padding:clamp(7px,2vh,18px) clamp(8px,2.6vw,34px);
}
.receive-frame--compact .receive-grid{min-height:0}
.receive-frame--compact .briefing-copy{display:grid;min-height:0;grid-template-rows:auto minmax(0,1fr) auto;gap:5px}
.receive-frame--compact .briefing-message-header{margin:0}
.receive-frame--compact .message-surface{min-height:0;overflow:hidden}
.receive-frame--compact .command-message p[hidden],.receive-frame--compact .briefing-pages[hidden]{display:none}
.briefing-pages{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:11px;color:var(--crt-bright)}
.receive-frame--compact .briefing-pages button{min-height:29px;padding:4px 8px;font-size:11px}
.receive-frame--compact .crt-plot--drone{min-height:0}
.receive-frame--compact .crt-plot--drone .crt-map{height:100%;max-height:none}
.receive-frame--compact .briefing-view-toggle{display:none;margin:0}
.receive-frame--compact .crt-status-row,.receive-frame--compact .crt-status-cell{min-width:0}
.receive-frame--compact .crt-command .login-form button{white-space:normal}

@media(min-width:620px) and (max-width:1050px){
  .crt-terminal .receive-frame--compact .receive-grid{grid-template-columns:minmax(0,1.47fr) minmax(0,1fr)}
  .receive-frame--compact .crt-status-row{grid-template-columns:1fr .95fr 1.27fr;gap:6px}
  .receive-frame--compact .crt-command{grid-column:auto}
}
@media(max-width:619px){
  .receive-frame--compact .receive-grid{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr)}
  .receive-frame--compact .crt-status-row{grid-template-columns:minmax(0,1fr)}
  .receive-frame--compact .crt-status-cell:not(.crt-command),.receive-frame--compact .crt-plot--drone{display:none}
  .receive-frame--compact .briefing-view-toggle{display:inline-flex;min-height:30px;padding:5px 7px;font-size:10px}
  #briefing[data-pane=radar] .crt-plot--drone{display:grid}
  #briefing[data-pane=radar] .briefing-copy{display:none}
}
@media(max-height:535px){
  .receive-frame--compact .receive-top{padding-block:3px}
  .receive-frame--compact .crt-emblem{width:33px;height:33px}
  .receive-frame--compact .receive-grid :is(.briefing-copy,.crt-plot){padding:6px}
  .receive-frame--compact .command-message p{font-size:12px;line-height:1.4;margin-bottom:5px}
  .receive-frame--compact .briefing-drone-image{height:47px}
  .receive-frame--compact .crt-status-row{grid-template-columns:minmax(0,1fr)}
  .receive-frame--compact .crt-status-cell:not(.crt-command){display:none}
  .receive-frame--compact .crt-command{grid-column:1/-1;padding:5px}
  .receive-frame--compact .crt-command .login-form{grid-template-columns:auto minmax(0,1fr) minmax(94px,max-content)}
  .receive-frame--compact .crt-command .login-form button{grid-column:auto;max-width:min(42vw,215px);min-height:32px;padding:4px 6px}
  .receive-frame--compact .mission-loading{margin-top:3px}
}

.crt-terminal .shell:has(.compact-console:not(.hidden)){
  height:100dvh;min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr);overflow:hidden;
}
.crt-terminal .shell:has(.compact-console:not(.hidden)) .topbar{height:auto;min-height:39px;padding-block:3px}
.crt-terminal .shell:has(.compact-console:not(.hidden)) .footer{display:none}
.crt-terminal .compact-console{display:grid;min-height:0;grid-template-rows:auto minmax(0,1fr)}
.crt-terminal .compact-console .game-grid{display:grid;min-height:0;padding:5px 0;gap:7px}
.crt-terminal .compact-console .main-column{display:grid;min-height:0;grid-template-rows:minmax(0,1fr) auto}
.compact-console .camera-console{display:grid;min-height:0;grid-template-rows:auto minmax(0,1fr)}
.crt-terminal .compact-console .camera-console .room{height:auto;min-height:0;aspect-ratio:auto}
.compact-console .room-navigation{margin-top:4px}
.compact-console .compact-status-button{display:none}
.crt-terminal .status-checklist ul{margin:0}
.crt-terminal #panel[data-view=status] .panel-body{padding:10px clamp(16px,3vw,26px) 16px}
.crt-terminal #panel[data-view=status] .panel-head{padding:9px clamp(16px,3vw,26px)}
.crt-terminal #panel[data-view=status] #panelTitle{font-size:clamp(19px,3vw,26px)}

@media(min-width:760px) and (max-width:849px), (min-width:760px) and (max-height:599px){
  .crt-terminal .compact-console .game-grid{grid-template-columns:minmax(0,1fr) clamp(164px,24vw,230px);grid-template-rows:minmax(0,1fr)}
  .crt-terminal .compact-console .sidebar{display:grid;grid-template-columns:minmax(0,1fr);align-content:start;min-height:0;overflow:auto}
}
@media(max-width:759px), (max-height:545px){
  .compact-console .sidebar>:not(.mission-tools){display:none}
  .compact-console .compact-status-button{display:inline-flex}
  .crt-terminal .compact-console .mission-strip{margin:4px 0 0}
  .crt-terminal .compact-console .mission-strip>div{padding:3px 5px}
  .compact-console .mission-strip .eyebrow{font-size:8px}
  .compact-console .mission-strip strong:not(.timer){font-size:clamp(10px,2.1vw,14px)}
  .compact-console .mission-strip .timer{font-size:clamp(18px,4vw,26px)}
  .compact-console .camera-bar{padding:3px 5px;gap:3px 7px}
  .compact-console #toggleLabels{min-height:25px}
  .compact-console .mission-tools{padding:5px}
  .compact-console .mission-tools .gripper-status{margin-top:3px;font-size:10px}
  .crt-terminal .compact-console .mission-tool-buttons .secondary{min-height:33px;padding:3px 5px}
}
@media(max-width:1050px){
  .compact-console .sidebar>:is(.checklist,.camera-event){display:none}
  .compact-console .compact-status-button{display:inline-flex}
}
@media(max-width:900px){
  .compact-console .room{--camera-left:.5;--camera-top:.5}
  .crt-terminal .compact-console .room-art{background-size:contain;background-repeat:no-repeat}
  .crt-terminal .compact-console .room #hotspots .hotspot{
    --camera-width:min(100cqw,calc(100cqh * var(--camera-ratio)));
    --camera-height:min(100cqh,calc(100cqw / var(--camera-ratio)));
  }
}
@media(min-width:760px) and (max-width:1050px), (min-width:760px) and (max-height:545px){
  .crt-terminal .compact-console .mission-tools{padding:6px}
  .compact-console .mission-tool-buttons{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px}
  .crt-terminal .mission-tool-buttons .secondary{padding-inline:3px;gap:4px}
}
@media(max-width:759px){
  .crt-terminal .shell:has(.compact-console:not(.hidden)){padding-inline:7px}
  .crt-terminal .compact-console .game-grid{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto}
  .compact-console .sidebar{display:block}
  .compact-console :is(.camera-feed-name,.camera-index),.shell:has(.compact-console:not(.hidden)) .build-tag{display:none}
}
@media(max-height:545px){
  .crt-terminal .compact-console .mission-strip{grid-template-columns:repeat(4,minmax(0,1fr))}
  .crt-terminal .compact-console .mission-strip>div:nth-child(n+3){border-top:0}
  .crt-terminal .compact-console .mission-strip>div:nth-child(3){border-left:1px solid var(--crt-line)}
  .compact-console .nav-arrow{min-height:28px}
}

body:has(#orientationNotice[open]){overflow:hidden}
body:has(#orientationNotice[open]) .shell{display:none}
#orientationNotice[open]{display:grid;justify-items:center;gap:9px;width:min(350px,calc(100% - 24px));max-height:calc(100dvh - 18px);padding:23px 17px;text-align:center;background:var(--crt-panel);border-color:var(--crt-line);color:var(--crt-ink);font-family:var(--crt-mono)}
#orientationNotice::backdrop{background:#06100b}
#orientationNotice h2,#orientationNotice p{margin:0}
#orientationNotice h2{font-size:clamp(16px,5vw,23px);color:var(--crt-bright)}
#orientationNotice h2:focus{outline:none}
.orientation-icon{display:grid;place-items:center;width:49px;height:49px;border:1px solid var(--crt-line);color:var(--crt-bright);font-size:31px}

@media(orientation:landscape){
  .crt-terminal .shell:has(:is(#intro,#battle,#ending):not(.hidden)){height:100dvh;min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr);overflow:hidden}
  .crt-terminal .shell:has(:is(#intro,#battle,#ending):not(.hidden)) .topbar{height:auto;min-height:39px;padding-block:3px}
  .crt-terminal .shell:has(:is(#intro,#battle,#ending):not(.hidden)) .footer{display:none}
  .crt-terminal #intro{min-height:0;margin:6px 0;align-items:stretch;grid-template-rows:auto minmax(0,1fr)}
  .crt-terminal .cover-console{grid-template-columns:minmax(0,1fr) minmax(0,1fr);min-height:0}
  .crt-terminal .cover-monitor{align-self:stretch;height:auto;min-height:0}
  .crt-terminal .cover-copy{padding:clamp(9px,3vw,48px)}

  .crt-terminal #battle{display:grid;grid-template-rows:auto auto minmax(0,1fr) auto;gap:5px;padding:5px 0;overflow:hidden}
  .crt-terminal .battle-heading,.crt-terminal .battle-hud{margin:0}
  .crt-terminal .battle-heading h2{margin:2px 0 3px;font-size:clamp(21px,4.2vh,51px)}
  .crt-terminal .battle-clock{display:flex;min-width:92px;padding:3px 7px}
  .crt-terminal .battle-clock strong{font-size:clamp(20px,3.8vh,31px)}
  .crt-terminal .battle-hud{grid-template-columns:repeat(4,minmax(0,1fr));gap:4px}
  .crt-terminal .battle-hud>div{padding:3px 5px;min-width:0}
  .crt-terminal .battle-hud strong{font-size:clamp(12px,3.5vh,22px)}
  .crt-terminal .battle-hud span{font-size:clamp(8px,1.4vh,10px);letter-spacing:0}
  .crt-terminal .battle-layout{grid-template-columns:minmax(0,1fr) clamp(148px,24vw,260px);gap:5px;min-height:0}
  .crt-terminal .attack-viewport{display:grid;grid-template-rows:auto minmax(0,1fr);min-height:0;width:auto;align-self:stretch}
  .attack-flight{display:grid;place-items:center;min-height:0;container-type:size}
  .crt-terminal #attackCanvas{width:min(100cqw,calc(100cqh * 2));height:auto}
  .crt-terminal .battle-controls{min-height:0;padding:5px;overflow:auto}
  .crt-terminal .battle-live .combat-dock{position:static;display:grid;grid-template-columns:minmax(0,1fr);margin:0;padding:0;background:none;border:0;box-shadow:none}
  .crt-terminal .battle-live .combat-dock>*{grid-column:auto;grid-row:auto}
  .crt-terminal .battle-live .flight-actions #fireBtn{grid-column:auto;margin:0}
  .crt-terminal .flight-actions{grid-template-columns:repeat(3,minmax(0,1fr));gap:3px}
  .crt-terminal .battle-controls :is(.flight-actions button,.power-options button){min-height:29px;padding:3px;font-size:11px}
  .crt-terminal .battle-controls .power-routing{margin:5px 0;padding:3px}
  .crt-terminal .battle-controls #battleLog{margin:4px 0;font-size:11px;line-height:1.3}
  .crt-terminal .battle-result{margin:0;padding:5px 8px}
  .crt-terminal .battle-result h3{font-size:17px;margin:0}
  .crt-terminal .battle-result p{font-size:11px;margin:3px 0}
  .crt-terminal .battle-result button{margin:2px 5px 0 0;min-height:29px;padding:4px 7px}

  .crt-terminal #ending{overflow:hidden;min-height:0;padding:5px 0;align-items:center}
  .crt-terminal #ending .ending-card{display:grid;grid-template-rows:auto minmax(0,1fr);max-height:100%}
  .crt-terminal .ending-layout{grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);min-height:0}
  .crt-terminal .ending-art{min-height:0;border-right:1px solid var(--report-line)}
  .crt-terminal .ending-image{flex:1 1 auto;min-height:0;height:auto;aspect-ratio:auto}
  .crt-terminal .ending-report{min-height:0;overflow:auto}
}
@media(orientation:landscape) and (max-height:545px){
  .crt-terminal .cover-copy h1{font-size:clamp(28px,8vh,51px)}
  .crt-terminal .cover-copy p:not(.eyebrow){font-size:clamp(12px,3.3vh,15px);margin:8px 0}
  .crt-terminal .cover-copy .primary{min-height:32px;padding:5px 8px}
  .crt-terminal .battle-heading p:not(.eyebrow),.crt-terminal .battle-instructions{display:none}
  .crt-terminal .radar-top{padding:3px 5px;font-size:8px}
  .crt-terminal .attack-ready{padding:3px}
  .crt-terminal .attack-ready>div{padding:5px;max-height:100%;overflow:auto}
  .crt-terminal .attack-ready h3{font-size:16px}
  .crt-terminal .attack-ready p{font-size:11px;margin:4px 0}
  .crt-terminal .attack-ready :is(.primary,.secondary){min-height:29px;margin:0;padding:3px 6px;font-size:11px}
  .crt-terminal .aim-assist{margin:5px 0;font-size:11px}
  .crt-terminal .ending-report{padding:7px}
  .crt-terminal .ending .ending-report h1{font-size:clamp(20px,6vh,34px);margin-bottom:5px}
  .crt-terminal .ending-report #endingBody,.crt-terminal .ending-report .command-receipt{font-size:11px;line-height:1.3}
  .crt-terminal .ending-report .command-receipt,.crt-terminal .ending-report .ending-stats{margin:5px 0;padding:4px}
  .crt-terminal .ending-stats div{padding:3px}
  .crt-terminal .mission-timing{margin-top:5px;font-size:11px}
}
