:root{color-scheme:dark;font-family:system-ui,'Malgun Gothic',sans-serif;background:#10151f;color:#edf2fa}*{box-sizing:border-box}body{margin:0;min-width:340px}button,select{font:inherit}button{cursor:pointer;background:#293c51;border:1px solid #49627d;color:#edf2fa;border-radius:7px;padding:9px 12px;transition:.12s}button:hover{border-color:#86edcb;background:#37506a}button:disabled{opacity:.4;cursor:not-allowed}.primary{background:#497c75;border-color:#84cfb1}.gold{color:#f5cf65!important}.topbar{display:flex;gap:20px;align-items:center;padding:12px max(18px,2.4vw);background:#192637;border-bottom:1px solid #34465d}.brand{font-size:20px;font-weight:800;letter-spacing:.05em;flex:1}.brand small{display:block;color:#91a8c2;font-size:11px;font-weight:500;letter-spacing:0}.back{color:#a4d9e1;text-decoration:none;white-space:nowrap}.tool-buttons{display:flex;gap:7px}main{max-width:1800px;margin:auto;padding:12px 18px 18px}.hud{display:grid;grid-template-columns:1fr .95fr .8fr 1fr 2.25fr .65fr auto;gap:2px;background:#1b2433;border:1px solid #34465d;border-radius:9px;padding:10px;margin-bottom:9px}.stat{padding:1px 8px;border-right:1px solid #354455;min-width:0}.stat:last-of-type{border:0}.stat small,.stat span{color:#91a8c2;display:block;font-size:12px}.stat strong{font-size:23px;display:block;font-weight:700}.stat.resources strong{font-size:13px;margin:12px 0 3px;color:#d6e7d9;white-space:normal}.speedlabel{font-size:12px;color:#91a8c2;padding:4px;display:flex;flex-direction:column;gap:6px}select{background:#283b50;color:#fff;border:1px solid #53708d;border-radius:5px;padding:5px}.layout{display:grid;grid-template-columns:minmax(0,1fr) 315px;gap:12px}.battle-column{min-width:0}.boardframe{width:100%;position:relative;overflow:hidden;aspect-ratio:3/2;background:#101b29;border:2px solid #4a607d;border-radius:9px;user-select:none}canvas{display:block;width:100%;height:100%;touch-action:none;cursor:crosshair}.sprite-layer{pointer-events:none;position:absolute;inset:0;overflow:hidden}.sprite{position:absolute;object-fit:contain;transform-origin:center;image-rendering:auto;pointer-events:none;will-change:left,top}.board-label{position:absolute;top:7px;left:50%;transform:translateX(-50%);background:#132637dd;border:1px solid #4b6b86;border-radius:7px;color:#c3ebd7;padding:6px 12px;font-size:13px;pointer-events:none;text-align:center;max-width:85%}.statusline{padding:8px 3px;display:flex;flex-wrap:wrap;justify-content:space-between;gap:8px;font-size:12px;color:#98aac0}.selected-bar{padding:10px 12px;background:#182437;border:1px solid #30445b;border-radius:8px;min-height:95px}.selected-bar h3,.logbox h3{font-size:13px;color:#dce6f7;margin:0 0 8px}.chiplist{display:flex;gap:6px;flex-wrap:wrap;color:#91a8c2;font-size:13px;max-height:108px;overflow:auto}.chip{font-size:12px;padding:5px 8px}.chip.on{border-color:#55e599;background:#235142}.sidebar{background:#1b2433;border:1px solid #34465d;border-radius:9px;display:flex;flex-direction:column;min-width:0;min-height:560px}.tabs{display:grid;grid-template-columns:repeat(4,1fr);gap:2px;padding:6px;border-bottom:1px solid #31445c}.tab{padding:10px 3px;font-size:12px}.tab.active{border-color:#81e7b5;background:#305c55}.sidepanel{padding:14px;min-height:340px}.sidepanel.hide{display:none}.sidepanel h2{margin:0 0 13px;font-size:18px}.portrait{min-height:90px;background:#101b29;border:1px solid #2d4961;border-radius:8px;display:grid;place-items:center;color:#7089a5;overflow:hidden}.portrait img{max-height:145px;max-width:100%;object-fit:contain}.explain{font-size:12px;line-height:1.7;color:#b3c2d8}.muted{color:#91a8c2}.tiny{font-size:12px}.warning-text{font-size:12px;color:#eab9a9;line-height:1.6}.actions{display:flex;gap:6px;flex-wrap:wrap;margin:14px 0}.actions button{font-size:12px;flex:1}.danger-btn{border-color:#84515c;color:#ffacb4}.vertical{display:grid;gap:8px}.vertical button{text-align:left;font-size:13px}.wide{width:100%;margin:10px 0}.logbox{padding:12px;border-top:1px solid #35475b;flex:1;max-height:265px;min-height:130px;overflow:hidden}.logbox #log{max-height:216px;overflow:auto;font-size:12px;line-height:1.7;color:#aabbd2}.logline{border-bottom:1px solid #2d3e50;padding:3px 0}.bottom{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:12px;color:#91a8c2;font-size:12px}.veil{position:fixed;inset:0;z-index:100;background:#060d1bd9;display:grid;place-items:center;padding:20px}.veil.hide{display:none}.modalbox{width:min(100%,460px);padding:28px;border:1px solid #506e8e;border-radius:16px;background:#1c2c42;box-shadow:0 20px 100px #0009;text-align:center}.modalbox h1{margin:0 0 12px}.modalbox p{line-height:1.7;color:#c6d7e7}.modalbox select{margin-left:8px}.modalActions{margin:16px 0}.modalActions button{font-size:16px;padding:12px 30px;font-weight:700}#details{font-size:13px;line-height:1.8;margin-top:10px}#missionStatus{margin-top:10px;line-height:1.7}@media(max-width:1120px){.layout{grid-template-columns:1fr}.sidebar{min-height:360px}.hud{grid-template-columns:repeat(4,1fr)}.resources{grid-column:span 2}.speedlabel{grid-column:span 2;flex-direction:row;align-items:center}.logbox{max-height:150px}.sidepanel{min-height:220px}}@media(max-width:650px){main{padding:7px}.hud{grid-template-columns:repeat(3,1fr)}.stat strong{font-size:17px}.resources{grid-column:span 3}.board-label{font-size:10px}.topbar{gap:7px}.brand{font-size:15px}.tool-buttons button{font-size:11px;padding:7px}.stat small,.stat span{font-size:10px}}

/* ================================================================
   Responsive fit-to-window stage (2026-10-12)
   Keep the original 1080x720 logical game coordinates and HUD layout.
   The entire game stage scales uniformly with the browser viewport.
   No outer page scrolling is needed at smaller desktop resolutions.
   ================================================================ */
html,body{width:100%;height:100%;overflow:hidden;min-width:0}
body{margin:0;overscroll-behavior:none}
.viewport{position:fixed;inset:0;overflow:hidden;display:flex;align-items:center;justify-content:center}
.game-shell{
  width:1600px;height:950px;flex:none;overflow:hidden;
  display:flex;flex-direction:column;
  transform-origin:center center;
  transform:scale(var(--viewport-scale,1));
  background:#10151f;
}
.game-shell .topbar{flex:none;min-height:54px;height:54px;padding:8px 22px}
.game-shell main{
  flex:1;min-height:0;width:100%;max-width:none;
  display:flex;flex-direction:column;
  gap:9px;padding:9px 17px 12px;
}
.game-shell .hud{
  flex:none;min-height:81px;margin:0;padding:8px 9px;
  grid-template-columns:1fr .95fr .8fr 1fr 2.25fr .65fr auto;
}
.game-shell .hud .stat strong{font-size:22px}
.game-shell .hud .stat.resources strong{font-size:13px}
.game-shell .hud .stat small,.game-shell .hud .stat span{font-size:12px}
.game-shell .hud .resources{grid-column:auto}
.game-shell .hud .speedlabel{grid-column:auto;flex-direction:column;align-items:stretch}
.game-shell .layout{
  flex:1;min-height:0;display:grid;
  grid-template-columns:minmax(0,1fr) 325px;gap:12px;
}
.game-shell .battle-column{
  min-height:0;min-width:0;display:flex;flex-direction:column;
}
.game-shell .board-space{
  flex:1;min-height:0;min-width:0;
  display:flex;justify-content:center;align-items:center;
}
.game-shell .boardframe{
  width:auto;height:100%;max-width:100%;flex:none;
  aspect-ratio:3 / 2;
}
.game-shell .statusline{
  flex:none;padding:6px 3px;min-height:29px;
  white-space:normal;
}
.game-shell .selected-bar{
  flex:none;height:82px;min-height:0;padding:9px 12px;overflow:hidden;
}
.game-shell .chiplist{max-height:51px;overflow:auto}
.game-shell .sidebar{
  min-width:0;min-height:0;max-height:100%;overflow:hidden;
  display:flex;flex-direction:column;
}
.game-shell .tabs{flex:none}
.game-shell .sidepanel{
  flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;
  scrollbar-width:thin;
}
.game-shell .logbox{
  flex:none;height:142px;max-height:142px;min-height:0;overflow:hidden;
}
.game-shell .logbox #log{height:105px;max-height:105px;overflow-y:auto}
.game-shell .bottom{flex:none;margin-top:0;min-height:28px}
/* Keep the modal usable at any window size, including after scaling. */
.veil{padding:clamp(8px,2vw,20px)}
.modalbox{max-height:calc(100dvh - 20px);overflow-y:auto}
@media(max-width:1120px){
  /* Override old responsive column-stacking: shell is scaled as one canvas. */
  .game-shell .layout{grid-template-columns:minmax(0,1fr) 325px}
  .game-shell .sidebar{min-height:0}
  .game-shell .hud{grid-template-columns:1fr .95fr .8fr 1fr 2.25fr .65fr auto}
  .game-shell .logbox{height:142px;max-height:142px}
  .game-shell .sidepanel{min-height:0}
}
@media(max-width:650px){
  .game-shell main{padding:9px 17px 12px}
  .game-shell .topbar{gap:20px}
  .game-shell .brand{font-size:20px}
  .game-shell .tool-buttons button{font-size:inherit;padding:9px 12px}
  .game-shell .hud{grid-template-columns:1fr .95fr .8fr 1fr 2.25fr .65fr auto}
  .game-shell .hud .stat strong{font-size:22px}
  .game-shell .hud .stat small,.game-shell .hud .stat span{font-size:12px}
  .game-shell .board-label{font-size:13px}
}

/* Keep the existing responsive game layout; add only lightweight controls. */
.mission-nav{display:flex;gap:5px;flex-wrap:wrap;align-items:center} .mission-nav button,#homeView{font-size:11px;padding:4px 7px;white-space:nowrap} .mission-nav .active-mission{background:#255a78;border-color:#8cd7ea;color:#e8ffff} .aircraft-detail{margin-top:10px;padding:8px 4px;border-top:1px solid #546070;font-size:12px;line-height:1.75;color:#93d4e1}
