/* Nerddi OS Run 50 · Command Screen Priority Pass
   Presentation-only layer loaded last. Keeps transport/input authority untouched. */

.controller-app:not(.controller-studio-mode){
  grid-template-areas:"header" "hud" "link" "profile" "footer";
  grid-template-rows:auto auto auto minmax(0,1fr) auto;
  min-height:0;
  gap:0;
}
.controller-app:not(.controller-studio-mode)>header{grid-area:header}
.controller-app:not(.controller-studio-mode)>.controller-hud{grid-area:hud}
.controller-app:not(.controller-studio-mode)>.nerddi-link-panel{grid-area:link}
.controller-app:not(.controller-studio-mode)>.profile-shell{grid-area:profile}
.controller-app:not(.controller-studio-mode)>footer{grid-area:footer}

.profile-shell{grid-area:profile;height:100%;min-height:0}
.controller-stage{min-height:0!important;height:100%}
.controller-stage[data-controldeck-chassis="gamepad"]{min-height:0!important;height:100%;overflow:hidden}
.controller-stage[data-controldeck-chassis="gamepad"] .controldeck-gamepad{min-height:0;height:100%}
.controller-stage[data-controldeck-chassis="gamepad"] .deck-center,
.controller-stage[data-controldeck-chassis="gamepad"] .deck-screen,
.controller-stage[data-controldeck-chassis="gamepad"] .deck-screen .private-game-screen{min-width:0;min-height:0;height:100%}

/* NERDDI LINK remains visible but yields the premium space to the controller. */
.nerddi-link-panel{
  width:100%;
  min-height:38px;
  max-height:46px;
  margin:4px 0;
  padding:4px 7px;
  display:grid;
  grid-template-columns:minmax(132px,.82fr) minmax(110px,1.4fr) 54px auto;
  grid-template-rows:34px;
  gap:5px 8px;
  align-items:center;
  overflow:hidden;
  transition:max-height .18s ease,border-color .18s ease,background .18s ease;
}
.nerddi-link-summary{grid-column:1;grid-row:1;gap:6px}
.nerddi-link-summary>div{display:flex;align-items:baseline;gap:6px;min-width:0}
.nerddi-link-summary small{font-size:4.5px}
.nerddi-link-summary b{font-size:9px;white-space:nowrap}
.nerddi-link-summary>span{padding:3px 5px;font-size:4.5px;max-width:92px;overflow:hidden;text-overflow:ellipsis}
.nerddi-link-graph{grid-column:2;grid-row:1;width:100%;height:28px;border-radius:7px}
.nerddi-link-metrics{grid-column:3;grid-row:1;display:grid;place-items:center;overflow:visible}
.nerddi-link-metrics span{display:none!important}
.nerddi-link-metrics span:first-child{display:grid!important;justify-items:center;gap:1px}
.nerddi-link-metrics span:first-child small{font-size:4px}
.nerddi-link-metrics span:first-child b{font-size:7px;color:#d9f6ff}
.nerddi-link-toggle{grid-column:4;grid-row:1;min-width:34px;height:28px;padding:0 7px;border:1px solid #294858;border-radius:8px;background:#07121a;color:#8ba7b6;font:950 5px/1 system-ui;letter-spacing:.09em;touch-action:manipulation}
.nerddi-link-toggle:after{content:"+";margin-left:4px;color:var(--accent)}
.nerddi-link-toggle:active{transform:translateY(1px);border-color:var(--accent);color:#fff}

.nerddi-link-panel[data-expanded="true"]{
  max-height:132px;
  grid-template-columns:minmax(148px,.9fr) minmax(180px,1.5fr) auto;
  grid-template-rows:auto auto;
  padding:7px 9px;
  background:linear-gradient(135deg,#081722f5,#03090ff5);
}
.nerddi-link-panel[data-expanded="true"] .nerddi-link-summary{grid-column:1;grid-row:1}
.nerddi-link-panel[data-expanded="true"] .nerddi-link-graph{grid-column:2;grid-row:1/3;height:54px}
.nerddi-link-panel[data-expanded="true"] .nerddi-link-metrics{grid-column:1;grid-row:2;display:flex;justify-content:flex-start;gap:8px}
.nerddi-link-panel[data-expanded="true"] .nerddi-link-metrics span{display:grid!important;gap:1px}
.nerddi-link-panel[data-expanded="true"] .nerddi-link-metrics small{font-size:4px}
.nerddi-link-panel[data-expanded="true"] .nerddi-link-metrics b{font-size:5.5px}
.nerddi-link-panel[data-expanded="true"] .nerddi-link-toggle{grid-column:3;grid-row:1}
.nerddi-link-panel[data-expanded="true"] .nerddi-link-toggle:after{content:"−"}

/* BotzWar: the center computer is the controller's hero surface. */
.controller-app[data-game-skin="botzwar"] .controller-stage[data-controldeck-chassis="gamepad"] .controldeck-gamepad{
  grid-template-columns:minmax(88px,.48fr) minmax(360px,2.8fr) minmax(88px,.48fr)!important;
  gap:5px!important;
  padding:5px 6px!important;
}
.controller-app[data-game-skin="botzwar"] .deck-wing{padding:1px 2px 5px!important}
.controller-app[data-game-skin="botzwar"] .deck-center{padding:1px 2px 3px!important;gap:3px!important}
.controller-app[data-game-skin="botzwar"] .deck-center-head{min-height:24px!important}
.controller-app[data-game-skin="botzwar"] .deck-screen{border-radius:18px!important}
.controller-app[data-game-skin="botzwar"] .deck-computer-dock{height:24px!important;gap:4px!important}
.controller-app[data-game-skin="botzwar"] .deck-computer-dock>button{height:22px!important;min-width:0!important;padding:0 5px!important;font-size:4px!important}
.controller-app[data-game-skin="botzwar"] .deck-computer-dock>.deck-system-button{width:38px!important;flex-basis:38px!important}
.controller-app[data-game-skin="botzwar"] .deck-face-cluster{width:min(25vh,142px)!important}
.controller-app[data-game-skin="botzwar"] .deck-left-body .stick-rings{width:min(27vh,150px)!important;max-width:100%!important}

/* The combat computer no longer owns a hard 330px minimum. Secondary intel scrolls inside the computer instead of being cropped. */
.controller-app[data-game-skin="botzwar"] .gamescreen-tool-arcade{min-height:0!important;height:100%!important;grid-template-rows:auto minmax(78px,1fr) minmax(0,.72fr) auto!important;gap:4px!important;padding:6px!important;overflow:hidden!important;align-content:stretch!important}
.controller-app[data-game-skin="botzwar"] .gamescreen-tool-arcade>header{padding-bottom:3px!important;font-size:6px!important}
.controller-app[data-game-skin="botzwar"] .gamescreen-tool-arcade>header b{font-size:8px!important}
.controller-app[data-game-skin="botzwar"] .arcade-phone-versus{gap:5px!important;min-height:0!important}
.controller-app[data-game-skin="botzwar"] .arcade-phone-versus article{padding:5px 6px!important;border-radius:10px!important}
.controller-app[data-game-skin="botzwar"] .arcade-phone-versus article>b{font-size:clamp(13px,4vh,22px)!important}
.controller-app[data-game-skin="botzwar"] .arcade-phone-versus article>em{margin:2px 0 4px!important;font-size:5px!important}
.controller-app[data-game-skin="botzwar"] .arcade-phone-health{height:7px!important;margin-top:3px!important}
.controller-app[data-game-skin="botzwar"] .arcade-phone-meter{height:4px!important;margin-top:3px!important}
.controller-app[data-game-skin="botzwar"] .arcade-phone-versus footer{margin-top:4px!important;font-size:4.5px!important}
.controller-app[data-game-skin="botzwar"] .arcade-phone-details{min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;display:grid;align-content:start;gap:4px;padding-right:2px}
.controller-app[data-game-skin="botzwar"] .arcade-phone-details .arcade-coach,
.controller-app[data-game-skin="botzwar"] .arcade-phone-details .arcade-signature{padding:5px 7px!important;gap:5px!important;border-radius:8px!important}
.controller-app[data-game-skin="botzwar"] .arcade-phone-details .arcade-coach b,
.controller-app[data-game-skin="botzwar"] .arcade-phone-details .arcade-signature b{font-size:6px!important}
.controller-app[data-game-skin="botzwar"] .arcade-phone-details .arcade-phone-goals{gap:3px!important}
.controller-app[data-game-skin="botzwar"] .arcade-phone-details .arcade-phone-goals span{padding:3px 5px!important}
.controller-app[data-game-skin="botzwar"] .arcade-phone-details .arcade-phone-prompt{padding:4px 7px!important;font-size:9px!important}
.controller-app[data-game-skin="botzwar"] .arcade-phone-details .arcade-phone-roster{gap:3px!important}
.controller-app[data-game-skin="botzwar"] .arcade-phone-controls{font-size:5px!important;padding-top:2px}

/* Career / Command Deck windows already have a real viewport; keep only the window body scrollable. */
.controller-app[data-game-skin="botzwar"] .command-os-shell{height:100%!important;min-height:0!important;overflow:hidden!important}
.controller-app[data-game-skin="botzwar"] .command-os-desktop{min-height:0!important;grid-template-columns:48px minmax(0,1fr) minmax(74px,.27fr)!important;gap:4px!important;padding:4px!important}
.controller-app[data-game-skin="botzwar"] .command-os-workspace{min-height:0!important;gap:4px!important}
.controller-app[data-game-skin="botzwar"] .command-os-window{min-height:0!important;overflow:hidden!important}
.controller-app[data-game-skin="botzwar"] .command-os-window-body{min-height:0!important;overflow:auto!important;padding:5px!important}
.controller-app[data-game-skin="botzwar"] .command-os-notifications{min-width:0!important;overflow:auto!important}

@media(orientation:landscape) and (max-width:760px){
  .controller-app[data-game-skin="botzwar"] .controller-stage[data-controldeck-chassis="gamepad"] .controldeck-gamepad{grid-template-columns:minmax(76px,.42fr) minmax(300px,3fr) minmax(76px,.42fr)!important;gap:4px!important}
  .controller-app[data-game-skin="botzwar"] .deck-face-cluster{width:min(23vh,122px)!important}
  .controller-app[data-game-skin="botzwar"] .deck-left-body .stick-rings{width:min(24vh,130px)!important}
  .nerddi-link-panel{grid-template-columns:minmax(118px,.8fr) minmax(90px,1.2fr) 46px auto;gap:4px;padding-inline:5px}
  .nerddi-link-summary>span{display:none}
}

@media(orientation:landscape) and (max-height:650px){
  .controller-app:not(.controller-studio-mode){grid-template-rows:auto 0 auto minmax(0,1fr) 0!important;padding-top:max(env(safe-area-inset-top),2px);padding-bottom:max(env(safe-area-inset-bottom),2px)}
  .controller-app:not(.controller-studio-mode)>.controller-hud{display:none!important}
  .controller-app:not(.controller-studio-mode)>footer{display:none!important}
  .controller-app:not(.controller-studio-mode)>header{min-height:34px;padding:3px 0!important;border-bottom:0!important}
  .controller-app[data-game-skin="botzwar"] .profile-top{display:none!important}
  .controller-app[data-game-skin="botzwar"] .profile-shell{grid-template-rows:minmax(0,1fr)!important;border-radius:18px!important}
  .controller-app[data-game-skin="botzwar"] .private-game-screen-home:empty{display:none!important}
  .controller-app[data-game-skin="botzwar"] .controller-stage{padding:4px!important;gap:3px!important}
  .controller-app[data-game-skin="botzwar"] .layout-banner{display:none!important}
  .controller-app[data-game-skin="botzwar"] .deck-center-head{display:none!important}
  .controller-app[data-game-skin="botzwar"] .deck-shoulder{min-height:25px!important}
  .controller-app[data-game-skin="botzwar"] .deck-screen-chrome{top:4px;left:5px;right:5px}
  .controller-app[data-game-skin="botzwar"] .gamescreen-tool-arcade{grid-template-rows:auto minmax(66px,1fr) minmax(0,.6fr) auto!important;padding:4px!important;gap:3px!important}
  .nerddi-link-panel{margin:2px 0;min-height:34px;max-height:38px;grid-template-rows:30px}
  .nerddi-link-panel[data-expanded="true"]{max-height:112px}
}

@media(orientation:portrait){
  .controller-app:not(.controller-studio-mode){grid-template-rows:auto auto auto minmax(0,1fr) auto}
  .nerddi-link-panel{grid-template-columns:minmax(118px,1fr) minmax(90px,1fr) 42px auto;gap:4px}
  .controller-app[data-game-skin="botzwar"] .controller-stage[data-controldeck-chassis="gamepad"] .controldeck-gamepad{grid-template-columns:1fr 1fr!important;grid-template-rows:minmax(0,1fr) auto!important;gap:5px!important;overflow:auto!important}
  .controller-app[data-game-skin="botzwar"] .deck-center{grid-column:1/-1!important;grid-row:1!important;min-height:0!important;height:min(56dvh,520px);order:-1}
  .controller-app[data-game-skin="botzwar"] .deck-wing-left{grid-column:1!important;grid-row:2!important;min-height:150px}
  .controller-app[data-game-skin="botzwar"] .deck-wing-right{grid-column:2!important;grid-row:2!important;min-height:150px}
  .controller-app[data-game-skin="botzwar"] .deck-center-head{display:none!important}
  .controller-app[data-game-skin="botzwar"] .deck-screen{min-height:0!important;height:100%!important}
  .controller-app[data-game-skin="botzwar"] .gamescreen-tool-arcade{min-height:0!important}
  .controller-app[data-game-skin="botzwar"] .command-os-desktop{grid-template-columns:46px minmax(0,1fr)!important}
  .controller-app[data-game-skin="botzwar"] .command-os-notifications{display:none!important}
  .controller-app[data-game-skin="botzwar"] .deck-shoulders{display:none!important}
  .controller-app[data-game-skin="botzwar"] .deck-face-cluster{width:min(40vw,158px)!important}
  .controller-app[data-game-skin="botzwar"] .deck-left-body .stick-rings{width:min(38vw,158px)!important}
}

@media(max-width:430px) and (orientation:portrait){
  .nerddi-link-panel{grid-template-columns:minmax(104px,1fr) minmax(76px,.8fr) 36px auto;padding-inline:4px}
  .nerddi-link-summary>span{display:none}
  .nerddi-link-toggle{padding:0 5px;min-width:30px;font-size:0}.nerddi-link-toggle:after{font-size:11px;margin:0}
}

@media(prefers-reduced-motion:reduce){.nerddi-link-panel{transition:none}.nerddi-link-toggle:active{transform:none}}
