.part-card {
  cursor: grab;
  user-select: none;
}
.part-card:hover {
  background: #1b2732;
  border-radius: 6px;
}
.part-visual {
  width: 70px;
  height: 68px;
  flex-shrink: 0;
  position: relative;
  background: #17212b;
  border: 1px solid #33414e;
  border-radius: 6px;
  overflow: hidden;
  touch-action: none;
}
.part-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.part-visual span {
  position: absolute;
  bottom: 0;
  right: 4px;
  color: #92a6b5;
  font-size: 14px;
}
.part-size {
  opacity: 0.8;
}
.view-tools {
  flex-wrap: wrap;
}
.placing-part,
.placing-part * {
  cursor: grabbing !important;
  user-select: none;
}
#dragHint {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  max-width: 280px;
  padding: 10px 13px;
  border: 1px solid #ba8160;
  border-radius: 8px;
  background: #34291ff5;
  color: #ffe2b9;
  font-size: 11px;
  line-height: 1.6;
  box-shadow: 0 5px 20px #0008;
}
#dragHint.valid {
  background: #152e28f5;
  border-color: #78cfa9;
  color: #b9f2d7;
}
@media (max-width: 1050px) {
  .part-visual {
    width: 56px;
    height: 58px;
  }
}
@media (max-width: 740px) {
  .part-visual {
    width: 46px;
    height: 53px;
  }
  .part-size {
    display: none !important;
  }
}
@media (orientation: portrait) and (max-width: 740px) {
  .catalog .part-card {
    position: relative;
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 5px;
    padding: 6px 1px 22px;
  }
  .catalog .part-card button {
    position: absolute;
    right: 1px;
    bottom: 2px;
    width: 23px;
    min-height: 22px;
  }
  .catalog .part-card .part-copy {
    min-width: 0;
  }
  .catalog .part-card small {
    font-size: 8px;
  }
  .catalog #categories::-webkit-scrollbar {
    height: 3px;
  }
  .catalog #categories {
    flex-wrap: nowrap;
    overflow-x: auto;
    touch-action: pan-x;
    flex-shrink: 0;
  }
  .catalog #categories button {
    flex-shrink: 0;
    white-space: nowrap;
  }
  .catalog .panel-heading .eyebrow {
    display: none;
  }
  .catalog .panel-heading h2 {
    margin: 0;
  }
  .catalog #search {
    margin-bottom: 6px;
  }
  .catalog .list-heading {
    padding: 7px;
  }
  .catalog .list-heading span + span {
    font-size: 8px;
  }
}
@font-face {
  font-family: system;
  src: local("Segoe UI");
}
* {
  box-sizing: border-box;
}
:root {
  color-scheme: dark;
  --bg: #0b1015;
  --panel: #131a21;
  --line: #2a333e;
  --text: #e8edf1;
  --muted: #8795a4;
  --accent: #e8ad58;
  --mint: #92cab6;
}
body {
  margin: 0;
  background: var(--bg);
  font:
    13px system-ui,
    "Yu Gothic UI",
    sans-serif;
  color: var(--text);
  overflow: hidden;
  touch-action: none;
}
button,
input,
select {
  font: inherit;
}
button {
  border: 1px solid var(--line);
  background: #1b242d;
  color: var(--text);
  border-radius: 5px;
  cursor: pointer;
  min-height: 34px;
  padding: 7px 10px;
  transition: background 0.15s;
}
button:hover {
  background: #303b46;
}
button:active {
  transform: translateY(1px);
}
button.active {
  background: #3b3327;
  border-color: #9e7847;
  color: #ffd69a;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input,
select {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #0e151d;
  color: var(--text);
  padding: 9px;
  min-width: 0;
}
select {
  width: 100%;
}
button.primary {
  background: var(--accent);
  color: #1b1a17;
  border-color: var(--accent);
  font-weight: 750;
}
button.primary:hover {
  background: #f8c37d;
}
button.primary span {
  margin-left: 15px;
}
#viewport {
  position: absolute;
  inset: 32px 0 0;
}
#viewport canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
header {
  height: 32px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: #10161c;
  position: relative;
  z-index: 4;
}
.brand {
  display: flex;
  gap: 7px;
  align-items: center;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 1.5px;
}
.brand small {
  display: none;
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 2.1px;
  color: var(--muted);
  margin-top: 4px;
}
.brand-mark {
  font-size: 20px;
  font-weight: 900;
  position: relative;
  color: var(--accent);
  font-style: italic;
}
.brand-mark span {
  font-size: 10px;
  position: absolute;
  top: -3px;
  right: -9px;
}
nav {
  display: flex;
  height: 100%;
  gap: 8px;
}
nav button {
  background: none;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  padding: 0 18px;
  min-height: 0;
  font: 12px system-ui, "Yu Gothic UI", sans-serif;
}
nav button span {
  margin-left: 10px;
  font-family: system-ui;
}
nav button.active {
  background: transparent;
  border-bottom: 2px solid var(--accent);
}
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.offline {
  font: 10px monospace;
  letter-spacing: 1px;
  color: var(--muted);
}
i {
  display: inline-block;
}
.offline i,
.flight-status i {
  width: 5px;
  height: 5px;
  background: var(--mint);
  border-radius: 50%;
  margin-right: 7px;
}
.icon-button {
  border-radius: 50%;
  width: 24px;
  min-height: 24px;
  padding: 0;
  color: var(--muted);
}
.panel {
  position: absolute;
  top: 48px;
  bottom: 102px;
  background: #121920ee;
  border: 1px solid var(--line);
  border-radius: 9px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(14px);
}
.catalog {
  left: 16px;
  width: 258px;
}
.inspector {
  right: 16px;
  width: 242px;
}
.panel-heading {
  padding: 18px 16px 12px;
}
.eyebrow {
  color: var(--muted);
  font: 9px monospace;
  letter-spacing: 1.6px;
}
h2 {
  font-size: 16px;
  margin: 8px 0 0;
  font-weight: 650;
}
h2 em {
  font-style: normal;
  font: 10px monospace;
  color: var(--accent);
  padding: 3px 5px;
  border: 1px solid #605037;
  border-radius: 4px;
  margin-left: 6px;
}
#search {
  margin: 0 12px 12px;
  font-size: 12px;
}
#categories {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 12px 12px;
}
#categories button {
  font-size: 11px;
  padding: 5px 8px;
  min-height: 28px;
  background: transparent;
}
#categories button.active {
  background: #493a28;
}
.list-heading {
  display: flex;
  justify-content: space-between;
  color: #bac5ce;
  font-size: 11px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.list-heading span + span {
  color: var(--muted);
  font-size: 10px;
}
#partList {
  overflow-y: auto;
  flex: 1;
  padding: 5px 7px;
  touch-action: pan-y;
}
.part-card {
  display: flex;
  align-items: center;
  padding: 8px 6px;
  border-bottom: 1px solid #232c35;
  gap: 9px;
  min-height: 64px;
}
.part-icon {
  width: 38px;
  height: 44px;
  flex-shrink: 0;
  color: #d7dadd;
}
.part-card .part-copy {
  flex: 1;
  min-width: 0;
}
.part-card b {
  font-size: 11px;
  font-weight: 550;
  display: block;
  line-height: 1.5;
}
.part-card small {
  font: 10px monospace;
  color: var(--muted);
  display: block;
  margin-top: 4px;
}
.part-card button {
  padding: 3px;
  width: 27px;
  min-height: 27px;
  color: var(--accent);
  font-size: 17px;
}
.catalog-foot {
  padding: 12px;
  font-size: 10px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.canvas-overlay {
  position: absolute;
  left: 294px;
  right: 278px;
  top: 66px;
  bottom: 105px;
  pointer-events: none;
}
.workspace-title h1 {
  font-size: 23px;
  font-weight: 500;
  letter-spacing: 0.5px;
  margin: 10px 0;
}
.workspace-title p {
  color: var(--muted);
  font-size: 11px;
  margin: 0;
}
.view-tools {
  display: flex;
  gap: 6px;
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: auto;
}
.view-tools button {
  background: #131b22bd;
  width: 34px;
  height: 34px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}
.view-tools button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.view-label {
  position: absolute;
  bottom: 45px;
  display: flex;
  align-items: center;
  gap: 12px;
  font: 9px monospace;
  line-height: 1.6;
  letter-spacing: 1.5px;
  color: var(--muted);
}
.view-label b {
  font-weight: 400;
  color: #566676;
}
.crosshair {
  font-size: 30px;
  color: #455463;
}
.canvas-tip {
  position: absolute;
  bottom: 10px;
  font-size: 10px;
  color: #7f8a95;
  width: 100%;
  text-align: center;
}
.actions-row {
  display: flex;
  gap: 5px;
  padding: 0 12px 12px;
}
.actions-row button {
  font-size: 10px;
  padding: 6px;
  flex: 1;
}
.config-block {
  padding: 0 12px 12px;
}
.config-block label {
  font-size: 10px;
  color: var(--muted);
  display: block;
  margin: 10px 0 7px;
}
.config-block label span {
  float: right;
  font-size: 9px;
}
.segmented {
  display: flex;
  gap: 5px;
}
.segmented button {
  flex: 1;
  font-size: 11px;
}
.config-block select {
  font-size: 11px;
  padding: 7px;
}
#craftTree {
  flex: 1;
  min-height: 80px;
  overflow-y: auto;
  padding: 6px;
  touch-action: pan-y;
}
.tree-item {
  display: flex;
  align-items: center;
  border: 0;
  background: none;
  width: 100%;
  font-size: 10px;
  text-align: left;
  min-height: 29px;
  padding: 4px 5px;
  color: #aeb9c3;
  gap: 5px;
  white-space: nowrap;
}
.tree-item.active {
  background: #3a3225;
  color: #f2d7ac;
  border: 0;
}
.tree-item .stage-chip {
  font: 9px monospace;
  background: #303b46;
  color: #c0c9d1;
  padding: 3px 5px;
  margin-left: auto;
}
.tree-item .tree-label {
  overflow: hidden;
  text-overflow: ellipsis;
}
.tree-branch {
  color: #54616c;
}
#selection {
  padding: 12px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  min-height: 116px;
}
#selection b {
  font-size: 12px;
  display: block;
  margin-bottom: 8px;
}
#selection p {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.6;
  margin: 7px 0;
}
.selection-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.selection-row input {
  width: 53px;
  padding: 5px;
}
.selection-row button {
  margin-left: auto;
  color: #e5a9a1;
  font-size: 10px;
}
.build-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 84px;
  background: #121920;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 0;
}
.metric {
  padding: 0 28px;
  border-right: 1px solid var(--line);
  min-width: 155px;
}
.metric:first-child {
  padding-left: 0;
}
.metric span {
  color: var(--muted);
  font-size: 10px;
  display: block;
  margin-bottom: 8px;
}
.metric strong {
  font: 22px monospace;
  letter-spacing: -1px;
}
.metric small {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0;
}
.build-footer > .primary {
  margin-left: auto;
  width: 190px;
  min-height: 46px;
  font-size: 14px;
}
#toast {
  position: absolute;
  z-index: 30;
  bottom: 105px;
  left: 50%;
  transform: translateX(-50%);
  background: #292f35f5;
  border: 1px solid #726042;
  color: #ffe2b9;
  border-radius: 8px;
  padding: 13px 20px;
  max-width: 90%;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
#toast.show {
  opacity: 1;
}
dialog {
  max-width: 600px;
  width: calc(100% - 32px);
  max-height: 85vh;
  background: #17212b;
  color: var(--text);
  border: 1px solid #485461;
  border-radius: 12px;
  padding: 30px;
  line-height: 1.8;
  touch-action: pan-y;
}
dialog::backdrop {
  background: #000a;
  backdrop-filter: blur(4px);
}
dialog .close {
  float: right;
  font-size: 22px;
  padding: 0 10px;
}
.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 15px;
  background: #111923;
  font-size: 12px;
}
.guide-grid b {
  font-weight: 400;
  color: var(--muted);
}
.muted {
  color: var(--muted);
  font-size: 11px;
}
.flight-top {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, 64%);
  pointer-events: none;
}
.telemetry {
  display: flex;
  justify-content: space-between;
  padding: 17px 22px;
  border: 1px solid #35414d;
  background: #101820df;
  border-radius: 8px;
}
.telemetry span {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 7px;
}
.telemetry strong {
  font: 23px monospace;
}
.telemetry small {
  font: 11px monospace;
  color: var(--muted);
}
.flight-status {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 12px;
  font-size: 11px;
  color: var(--mint);
}
.flight-status i {
  margin-top: 5px;
}
.flight-status #bodyName {
  color: var(--muted);
  border-left: 1px solid var(--line);
  padding-left: 12px;
}
.flight-left,
.flight-right {
  position: absolute;
  top: 163px;
  background: #111b24df;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  width: 190px;
}
.flight-left {
  left: 16px;
}
.flight-right {
  right: 16px;
}
.orbit-row {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  font-size: 10px;
  color: var(--muted);
}
.orbit-row b {
  font: 12px monospace;
  color: var(--text);
}
.flight-left button {
  display: block;
  width: 100%;
  margin-top: 10px;
  font-size: 11px;
}
.flight-left label {
  font-size: 10px;
  color: var(--muted);
  display: block;
  margin: 14px 0;
}
.flight-left select {
  font-size: 11px;
  margin-top: 6px;
}
.resource {
  margin-top: 13px;
}
.resource label {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
}
.resource progress {
  width: 100%;
  height: 5px;
  accent-color: var(--mint);
  margin-top: 7px;
}
.stage-box {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 15px;
}
.stage-box > span {
  font: 9px monospace;
  color: var(--muted);
  display: block;
  letter-spacing: 2px;
}
.stage-box > strong {
  font: 38px monospace;
  color: var(--accent);
}
.stage-box p {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.5;
}
.stage-box button {
  width: 100%;
  font-size: 12px;
}
.stage-box button span {
  font-size: 8px;
  margin-left: 5px;
}
#flightParts {
  font-size: 10px;
  color: var(--muted);
  margin-top: 12px;
}
.flight-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 60px;
  pointer-events: none;
}
.flight-bottom > * {
  pointer-events: auto;
}
#joystick {
  width: 132px;
  height: 132px;
  border: 1px solid #5c6b7a;
  border-radius: 50%;
  position: relative;
  background: radial-gradient(circle, #182632e0 0, #101922de 70%);
  touch-action: none;
}
#joystick:before,
#joystick:after {
  content: "";
  position: absolute;
  background: #465461;
}
#joystick:before {
  width: 1px;
  top: 10px;
  bottom: 10px;
  left: 50%;
}
#joystick:after {
  height: 1px;
  left: 10px;
  right: 10px;
  top: 50%;
}
#joystick span {
  position: absolute;
  left: 48px;
  bottom: 15px;
  color: #8b99a6;
  font-size: 10px;
}
#joystick b {
  position: absolute;
  top: 6px;
  left: 60px;
  color: var(--accent);
}
#stick {
  position: absolute;
  left: 46px;
  top: 46px;
  width: 40px;
  height: 40px;
  background: #465461;
  border: 1px solid #8795a4;
  border-radius: 50%;
  z-index: 1;
}
.roll-buttons {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.roll-buttons button {
  width: 63px;
}
.nav-cluster {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
#navball {
  width: 154px;
  height: 154px;
  filter: drop-shadow(0 5px 16px #0008);
}
.guidance {
  display: flex;
  gap: 5px;
}
.guidance button {
  font-size: 11px;
  min-height: 32px;
}
.guidance select {
  width: 96px;
  font-size: 10px;
  padding: 5px;
}
.throttle-panel {
  width: 155px;
  background: #121c25e8;
  border: 1px solid var(--line);
  padding: 15px;
  border-radius: 8px;
}
.throttle-panel label {
  font: 10px monospace;
  color: var(--muted);
}
.throttle-panel label b {
  float: right;
  color: var(--accent);
}
.throttle-panel input {
  width: 100%;
  padding: 0;
  margin: 18px 0;
  accent-color: var(--accent);
  height: 30px;
}
.throttle-panel > div {
  display: flex;
  gap: 7px;
}
.throttle-panel button {
  font-size: 11px;
  flex: 1;
}
.throttle-panel p {
  margin: 12px 0 0;
  font: 12px monospace;
  color: var(--muted);
}
[hidden] {
  display: none !important;
}
::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-thumb {
  background: #414b56;
  border-radius: 5px;
}
@media (max-width: 1050px) {
  header {
    padding: 0 15px;
  }
  .catalog {
    width: 218px;
    left: 10px;
  }
  .inspector {
    width: 210px;
    right: 10px;
  }
  .canvas-overlay {
    left: 245px;
    right: 237px;
  }
  .metric {
    min-width: 130px;
    padding: 0 18px;
  }
  .metric strong {
    font-size: 19px;
  }
  .build-footer > .primary {
    width: 155px;
  }
  .workspace-title h1 {
    font-size: 18px;
  }
  .flight-left,
  .flight-right {
    width: 168px;
    padding: 12px;
  }
  .flight-bottom {
    gap: 25px;
  }
  .telemetry {
    padding: 13px;
  }
  .telemetry strong {
    font-size: 18px;
  }
  .flight-top {
    width: 70%;
  }
}
@media (max-height: 650px) {
  header {
    height: 24px;
  }
  #viewport {
    top: 24px;
  }
  .panel {
    top: 35px;
    bottom: 73px;
  }
  .panel-heading {
    padding: 10px 12px;
  }
  .eyebrow {
    font-size: 8px;
  }
  h2 {
    font-size: 13px;
  }
  .config-block {
    padding-bottom: 5px;
  }
  .config-block label {
    margin: 5px 0;
  }
  .actions-row {
    padding-bottom: 2px;
  }
  .catalog-foot {
    padding: 6px;
    font-size: 9px;
  }
  #selection {
    min-height: 95px;
    padding: 8px;
  }
  .build-footer {
    height: 62px;
  }
  .canvas-overlay {
    top: 46px;
    bottom: 74px;
  }
  .view-tools {
    top: 0;
  }
  .workspace-title p {
    display: none;
  }
  .metric span {
    margin-bottom: 4px;
  }
  #categories {
    gap: 3px;
    padding-bottom: 7px;
  }
  #categories button {
    font-size: 10px;
    padding: 4px 6px;
    min-height: 23px;
  }
  .flight-top {
    top: 34px;
  }
  .flight-left,
  .flight-right {
    top: 108px;
  }
  .flight-left {
    padding: 10px;
  }
  .flight-left button {
    min-height: 27px;
    margin-top: 6px;
    padding: 4px;
  }
  .flight-left label {
    margin: 6px 0;
  }
  .orbit-row {
    margin-top: 8px;
  }
  .flight-bottom {
    bottom: 10px;
    gap: 23px;
  }
  #navball {
    width: 105px;
    height: 105px;
  }
  #joystick {
    width: 100px;
    height: 100px;
  }
  #stick {
    left: 30px;
    top: 30px;
  }
  #joystick span {
    left: 34px;
    bottom: 10px;
  }
  #joystick b {
    left: 44px;
  }
  .roll-buttons button {
    width: 47px;
    min-height: 27px;
  }
  #resources .resource {
    margin-top: 6px;
  }
  .stage-box {
    margin-top: 10px;
    padding-top: 8px;
  }
  .stage-box > strong {
    font-size: 26px;
  }
  .stage-box p {
    margin: 5px 0;
  }
  .throttle-panel {
    padding: 10px;
  }
  .throttle-panel input {
    margin: 8px 0;
  }
  .flight-status {
    margin: 6px;
  }
  .telemetry {
    padding: 10px;
  }
  .telemetry span {
    margin-bottom: 4px;
  }
}
@media (max-width: 740px) {
  .brand {
    font-size: 14px;
    letter-spacing: 1.5px;
  }
  .brand small,
  .offline {
    display: none;
  }
  nav button {
    padding: 0 12px;
    font-size: 10px;
  }
  nav button span {
    margin-left: 3px;
  }
  .header-right {
    gap: 6px;
  }
  .catalog {
    width: 170px;
    left: 6px;
  }
  .inspector {
    width: 165px;
    right: 6px;
  }
  .panel-heading {
    padding: 10px;
  }
  .panel-heading .eyebrow {
    font-size: 7px;
    letter-spacing: 0.6px;
  }
  h2 {
    font-size: 12px;
  }
  h2 em {
    font-size: 8px;
    margin-left: 3px;
  }
  .part-card {
    gap: 4px;
    padding: 5px 2px;
  }
  .part-icon {
    width: 25px;
    height: 34px;
  }
  .part-card b {
    font-size: 10px;
  }
  .part-card small {
    font-size: 8px;
  }
  .canvas-overlay {
    left: 190px;
    right: 182px;
  }
  .workspace-title h1 {
    font-size: 15px;
  }
  .workspace-title .eyebrow {
    font-size: 7px;
  }
  .view-tools {
    flex-wrap: wrap;
  }
  .view-tools button {
    font-size: 9px;
    padding: 5px;
  }
  .view-label,
  .canvas-tip {
    display: none;
  }
  .metric {
    min-width: 95px;
    padding: 0 12px;
  }
  .metric strong {
    font-size: 16px;
  }
  .metric.dv {
    display: none;
  }
  .build-footer {
    padding: 0 12px;
  }
  .build-footer > .primary {
    width: 120px;
    font-size: 12px;
    min-height: 38px;
  }
  .flight-left,
  .flight-right {
    width: 136px;
    padding: 9px;
    left: 8px;
  }
  .flight-right {
    left: auto;
    right: 8px;
  }
  .orbit-row {
    font-size: 9px;
  }
  .orbit-row b {
    font-size: 10px;
  }
  .flight-top {
    width: 90%;
  }
  .telemetry strong {
    font-size: 16px;
  }
  .telemetry span {
    font-size: 8px;
  }
  .flight-bottom {
    gap: 12px;
  }
  .throttle-panel {
    width: 116px;
  }
  .guidance select {
    width: 76px;
  }
  .guidance button {
    padding: 5px;
  }
  .stage-box button {
    font-size: 10px;
  }
  .stage-box button span {
    display: none;
  }
}
@media (orientation: portrait) and (max-width: 740px) {
  header {
    height: 26px;
  }
  .brand {
    font-size: 12px;
  }
  .brand-mark {
    font-size: 22px;
  }
  #viewport {
    top: 26px;
  }
  .catalog {
    top: 34px;
    bottom: 47%;
    width: 150px;
  }
  .inspector {
    top: 54%;
    bottom: 80px;
    left: 6px;
    right: 6px;
    width: auto;
    display: grid;
    grid-template-columns: 145px 1fr;
    grid-template-rows: 40px 38px 1fr;
  }
  .inspector .panel-heading {
    grid-column: 1;
    grid-row: 1;
  }
  .inspector .panel-heading .eyebrow {
    display: none;
  }
  .inspector .actions-row {
    grid-column: 1;
    grid-row: 2;
    padding: 2px 5px;
  }
  .inspector .config-block {
    grid-column: 1;
    grid-row: 3;
    padding: 0 7px;
  }
  .inspector .list-heading {
    display: none;
  }
  #craftTree {
    grid-column: 2;
    grid-row: 1/3;
  }
  #selection {
    grid-column: 2;
    grid-row: 3;
    overflow-y: auto;
    touch-action: pan-y;
  }
  .canvas-overlay {
    top: 49px;
    left: 172px;
    right: 12px;
    bottom: 48%;
  }
  .workspace-title h1 {
    font-size: 16px;
  }
  .view-tools {
    top: auto;
    bottom: 0;
  }
  .build-footer {
    height: 72px;
    gap: 8px;
  }
  .metric {
    min-width: 66px;
    padding: 0 6px;
  }
  .metric strong {
    font-size: 13px;
  }
  .metric span {
    font-size: 8px;
  }
  .build-footer > .primary {
    width: 95px;
  }
  .flight-top {
    top: 39px;
    width: 96%;
  }
  .telemetry {
    padding: 10px 8px;
  }
  .telemetry strong {
    font-size: 14px;
  }
  .flight-left,
  .flight-right {
    top: 124px;
    width: 132px;
  }
  .flight-bottom {
    bottom: 20px;
    gap: 7px;
  }
  #navball {
    width: 110px;
    height: 110px;
  }
  #joystick {
    width: 95px;
    height: 95px;
  }
  #joystick b {
    left: 41px;
  }
  #joystick span {
    left: 31px;
  }
  #stick {
    left: 27px;
    top: 27px;
  }
  .roll-buttons button {
    width: 44px;
  }
  .throttle-panel {
    width: 105px;
    padding: 8px;
  }
  .guidance {
    flex-wrap: wrap;
    width: 108px;
    justify-content: center;
  }
  .guidance select {
    width: 100%;
  }
  .flight-status {
    font-size: 10px;
  }
  nav button {
    padding: 0 6px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .flight-left,
  .flight-right {
    top: 96px;
    bottom: 8px;
    width: 145px;
    overflow-y: auto;
    touch-action: pan-y;
    padding: 9px;
  }
  .flight-left {
    left: 8px;
  }
  .flight-right {
    right: 8px;
    display: flex;
    flex-direction: column;
  }
  .flight-right > .eyebrow {
    flex-shrink: 0;
  }
  #resources {
    min-height: 28px;
    overflow-y: auto;
    flex: 1;
    touch-action: pan-y;
  }
  .stage-box {
    flex-shrink: 0;
    margin-top: 6px;
    padding-top: 6px;
  }
  .stage-box > strong {
    font-size: 22px;
  }
  .stage-box > span {
    font-size: 8px;
  }
  .stage-box p {
    max-height: 25px;
    overflow: hidden;
    font-size: 9px;
    margin: 3px 0;
  }
  .stage-box button {
    min-height: 32px;
    font-size: 11px;
  }
  #flightParts {
    font-size: 9px;
    margin-top: 5px;
  }
  .flight-left .orbit-row {
    margin-top: 7px;
    font-size: 9px;
  }
  .flight-left .orbit-row b {
    font-size: 10px;
  }
  .flight-left button {
    font-size: 10px;
    margin-top: 5px;
  }
  .flight-left label {
    font-size: 9px;
    margin: 5px 0;
  }
  .flight-left select {
    padding: 4px;
    font-size: 10px;
  }
  .flight-bottom {
    gap: 17px;
  }
  #navball {
    width: 88px;
    height: 88px;
  }
  .throttle-panel {
    width: 130px;
  }
  .nav-cluster {
    gap: 5px;
  }
  .catalog .panel-heading .eyebrow {
    display: none;
  }
  .catalog .panel-heading h2 {
    margin: 0;
  }
  #categories {
    flex-wrap: nowrap;
    overflow-x: auto;
    touch-action: pan-x;
    flex-shrink: 0;
    padding-bottom: 6px;
  }
  #categories button {
    white-space: nowrap;
    flex-shrink: 0;
  }
  #search {
    margin-bottom: 7px;
    padding: 6px;
  }
  .inspector {
    display: block;
    overflow-y: auto;
    touch-action: pan-y;
  }
  .inspector .panel-heading .eyebrow {
    display: none;
  }
  .inspector .panel-heading h2 {
    margin: 0;
  }
  #craftTree {
    height: 100px;
    min-height: 100px;
  }
  .workspace-title .eyebrow {
    display: none;
  }
  .view-tools {
    top: 0;
  }
  .canvas-tip,
  .view-label {
    display: none;
  }
}
/* Assembly editor: accessible controls and independent scrolling. */
.inspector {
  width: 330px;
  overflow-y: auto;
  display: block;
  padding-bottom: 12px;
}
.canvas-overlay {
  right: 354px;
}
#craftTree {
  max-height: 150px;
  overflow: auto;
}
#selection {
  padding: 0;
  border-top: 1px solid #35434b;
  overflow: visible;
  max-height: none;
}
.editor-tabs {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #151e25;
  padding: 8px;
  gap: 4px;
}
.editor-tabs button {
  flex: 1;
  padding: 9px 2px;
}
.editor-tabs .active {
  background: #a57539;
  color: white;
}
.editor-content {
  padding: 12px;
}
.editor-content h3 {
  font-size: 13px;
  margin: 18px 0 10px;
  color: #e3bd83;
}
.editor-content p {
  font-size: 12px;
  line-height: 1.6;
}
.selected-preview {
  display: flex;
  align-items: center;
  gap: 10px;
}
.selected-preview img {
  width: 96px;
  height: 78px;
  object-fit: contain;
}
.editor-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  margin: 9px 0;
}
.editor-field input,
.editor-field select {
  width: 110px;
  min-height: 34px;
}
.editor-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin: 12px 0;
}
.editor-check input {
  width: 18px;
  height: 18px;
}
.spec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  font-size: 11px;
  gap: 10px;
}
.spec-grid dd {
  margin: 0;
  text-align: right;
}
.spec-grid dt {
  color: #91a2ad;
}
.transform-fields {
  display: flex;
  gap: 5px;
  align-items: center;
  margin: 10px 0;
  font-size: 11px;
}
.transform-fields span {
  width: 48px;
}
.transform-fields label {
  width: 65px;
}
.transform-fields input {
  width: 100%;
  padding: 5px;
  min-height: 32px;
}
.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 14px;
}
.editor-actions button {
  padding: 8px;
  font-size: 11px;
}
.stage-card {
  padding: 10px;
  margin: 10px 0;
  background: #101a21;
  border: 1px solid #344753;
  border-radius: 6px;
}
.stage-card > div:first-child {
  display: flex;
  gap: 6px;
  align-items: center;
}
.stage-card b {
  flex: 1;
}
.stage-part {
  padding-top: 7px;
  display: flex;
  gap: 5px;
  align-items: center;
}
.stage-part button {
  display: flex;
  align-items: center;
  flex: 1;
  text-align: left;
  font-size: 10px;
  min-width: 0;
}
.stage-part img {
  width: 42px;
  height: 38px;
  object-fit: contain;
}
.stage-part select {
  width: 82px;
  font-size: 11px;
}
.inspector .config-block {
  padding: 10px;
}
.inspector .panel-heading {
  padding: 12px 15px;
}
.inspector .config-block label {
  margin-top: 6px;
}
.inspector .list-heading {
  padding: 8px 12px;
}
@media (max-width: 740px) {
  .inspector {
    width: auto;
    display: block;
    overflow-y: auto;
  }
  .canvas-overlay {
    right: 12px;
  }
  .editor-content {
    padding: 10px;
  }
  #craftTree {
    max-height: 90px;
  }
  .editor-tabs {
    position: sticky;
    top: 0;
  }
  .inspector .config-block {
    display: block;
  }
  .inspector #selection {
    display: block;
    grid-column: auto;
  }
}
@media (max-height: 500px) and (min-width: 741px) {
  .inspector {
    width: 280px;
  }
  .canvas-overlay {
    right: 292px;
  }
}
@media (max-width: 740px) {
  .inspector .actions-row {
    display: flex;
    position: sticky;
    top: 0;
    background: #151e25;
    z-index: 3;
    padding: 8px;
    margin: 0;
  }
  .inspector .panel-heading {
    display: none;
  }
  .inspector .config-block {
    padding: 8px;
  }
  .inspector #craftTree {
    max-height: 70px;
  }
  .editor-tabs {
    top: 48px;
  }
}
#flightMenu {
  width: min(380px, calc(100vw - 32px));
  padding: 28px;
  border: 1px solid #63717b;
  border-radius: 12px;
  background: #172129;
  color: #e7ecef;
  box-shadow: 0 20px 90px #0009;
}
#flightMenu::backdrop {
  background: #05090cc9;
  backdrop-filter: blur(4px);
}
#flightMenu h2 {
  margin: 12px 0 22px;
}
#flightMenu button {
  display: block;
  width: 100%;
  padding: 14px;
  margin: 10px 0;
  text-align: center;
}
#flightMenu button:focus-visible {
  outline: 2px solid #e3bd83;
  outline-offset: 2px;
}
#flightMenu p {
  font-size: 13px;
  line-height: 1.6;
}
#flightMenu small {
  display: block;
  margin-top: 20px;
  color: #94a5af;
}
#resumeFlight {
  background: #98703a;
}
.tutorial-menu-button {
  min-height: 25px;
  padding: 3px 8px;
  font-size: 10px;
  color: #f4cf94;
  border-color: #79603d;
  background: #2d281f;
}

.career-nav{padding:8px 10px;font-size:11px;white-space:nowrap}.career-dialog{width:min(680px,calc(100vw - 28px));max-height:min(84vh,760px);overflow:auto}.career-dialog.wide{width:min(980px,calc(100vw - 28px))}.career-summary{display:flex;gap:10px;flex-wrap:wrap;margin:12px 0 18px}.career-summary>*{border:1px solid #334550;background:#111a20;padding:9px 13px}.mode-cards,.career-list,.tech-tree{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.mode-cards article,.mission-card,.tech-node,.tracked-vessel{border:1px solid #344954;background:linear-gradient(145deg,#16232a,#10181d);padding:15px}.mode-cards article{display:flex;flex-direction:column}.mode-cards b{font-size:18px}.mode-cards button{margin-top:auto}.mission-card{display:flex;gap:12px;align-items:center;justify-content:space-between}.mission-card h3,.tech-node h3,.tracked-vessel h3{margin:4px 0}.mission-card p,.tech-node p,.tracked-vessel p{margin:5px 0;color:#aab8bf}.mission-card.complete,.tech-node.unlocked{border-color:#3f8d72;background:linear-gradient(145deg,#163128,#101d19)}.mission-card button{min-width:116px}.tech-tree{grid-template-columns:repeat(3,minmax(0,1fr))}.tech-node{display:flex;flex-direction:column;min-height:190px}.tech-node>span{color:#78d5ff;margin-top:auto;padding:8px 0}.tracked-vessel{display:flex;align-items:center;gap:12px}.tracked-vessel i{width:13px;height:13px;border-radius:50%;background:#5bf2a6;box-shadow:0 0 12px #5bf2a6}.tracked-vessel i.lost{background:#ff6f64;box-shadow:0 0 12px #ff6f64}.tracking-actions{display:flex;gap:10px;margin:14px 0}.catalog-foot em{color:#78d5ff}
@media(max-width:850px){.header-right .career-nav{font-size:0;padding:8px}.header-right .career-nav:before{font-size:14px}.header-right #gameModeButton:before{content:'★'}.header-right #missionControlButton:before{content:'M'}.header-right #researchButton:before{content:'R&D'}.header-right #trackingButton:before{content:'⌖'}.tech-tree{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:560px){.mode-cards,.career-list{grid-template-columns:1fr}.mission-card{align-items:flex-start;flex-direction:column}.mission-card button{width:100%}.career-dialog{max-height:90vh}}

.tech-tree-viewport{overflow:auto;margin:12px -10px 0;padding:4px 10px 20px;scrollbar-color:#40505a transparent}.tech-tree{position:relative;display:flex;flex-direction:column;gap:58px;min-width:760px;padding:14px 20px 24px;background:radial-gradient(circle at 50% 0,rgba(45,97,119,.12),transparent 46%)}.tech-level{position:relative;z-index:2;display:flex;justify-content:space-evenly;align-items:center;gap:18px}.tech-connectors{position:absolute;inset:0;z-index:1;width:100%;height:100%;overflow:visible;pointer-events:none}.tech-connectors path{fill:none;stroke:#364047;stroke-width:3;stroke-linejoin:round}.tech-connectors path.available{stroke:#609ee4;stroke-dasharray:8 8}.tech-connectors path.unlocked{stroke:#35b94d}.tech-node{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;width:210px;min-height:88px;padding:15px 18px;text-align:left;border:2px solid #333d43;border-radius:14px;background:#14191c;color:#818a8e;box-shadow:0 8px 20px rgba(0,0,0,.2);transition:border-color .15s,transform .15s,box-shadow .15s}.tech-node:hover{transform:translateY(-2px)}.tech-node strong{font-size:16px;line-height:1.25}.tech-node span{margin-top:9px;font-size:14px}.tech-node.unlocked{border-color:#176b2a;background:#0d2915;color:#36c650}.tech-node.available{border-color:#185293;background:#0d315c;color:#7cb8ff}.tech-node.locked{border-color:#343a3e;background:#171a1c;color:#798084}.tech-node.selected{outline:3px solid #ecf4f6;outline-offset:4px;box-shadow:0 0 0 7px rgba(112,164,190,.22),0 12px 26px rgba(0,0,0,.35)}.tech-legend{display:flex;justify-content:center;gap:24px;flex-wrap:wrap;padding:12px;color:#98a4aa}.tech-legend .is-unlocked{color:#35bd4c}.tech-legend .is-available{color:#76b6ff}.tech-legend .is-locked{color:#92999c}.tech-detail{position:sticky;bottom:-1px;z-index:4;display:flex;align-items:center;justify-content:space-between;gap:22px;margin-top:8px;padding:18px 20px;border:1px solid #38454b;border-radius:16px;background:linear-gradient(145deg,rgba(25,31,35,.98),rgba(13,17,19,.98));box-shadow:0 -10px 30px rgba(0,0,0,.38)}.tech-detail h3{margin:3px 0 5px;font-size:20px}.tech-detail p{margin:0 0 6px;color:#b2bdc2}.tech-detail small{color:#72b8ff}.tech-detail span{font-size:12px;color:#859197}.tech-detail button{min-width:205px}.researchDialog .career-summary{margin-bottom:6px}@media(max-width:700px){.tech-tree{min-width:650px;padding-inline:8px}.tech-node{width:180px;min-height:82px;padding:12px}.tech-detail{align-items:stretch;flex-direction:column}.tech-detail button{width:100%;min-width:0}.tech-legend{gap:12px;font-size:12px}}
.tutorial-menu {
  width: min(700px, calc(100vw - 32px));
  padding: 28px;
  background: #172129;
}
.tutorial-menu h2 {
  margin: 10px 0;
}
.tutorial-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.tutorial-card {
  padding: 18px;
  border: 1px solid #41505b;
  border-radius: 8px;
  background: #10181f;
}
.tutorial-card > span {
  color: #d8a75e;
  font: 10px monospace;
  letter-spacing: .8px;
}
.tutorial-card h3 {
  margin: 9px 0 6px;
  font-size: 16px;
}
.tutorial-card p {
  min-height: 58px;
  margin: 0 0 14px;
  color: #aab6bf;
  font-size: 12px;
  line-height: 1.65;
}
.tutorial-card button {
  width: 100%;
}
.tutorial-menu > small {
  color: #94a5af;
}
@media (max-width: 520px) {
  .tutorial-list { grid-template-columns: 1fr; }
  .tutorial-card p { min-height: 0; }
  .tutorial-menu-button { font-size: 9px; padding: 3px 5px; }
}
/* Readable spherical attitude indicator, scaled for touch screens. */
#navball {
  width: 240px;
  height: 240px;
}
.nav-cluster {
  min-width: 240px;
}
.guidance {
  flex-wrap: wrap;
  justify-content: center;
}
.guidance select {
  max-width: 155px;
}
@media (max-width: 740px) {
  #navball {
    width: 180px;
    height: 180px;
  }
  .nav-cluster {
    min-width: 180px;
  }
  .guidance select {
    max-width: 110px;
    font-size: 11px;
  }
  .guidance button {
    padding: 6px;
  }
}
@media (max-height: 500px) {
  #navball {
    width: 155px;
    height: 155px;
  }
  .nav-cluster {
    min-width: 155px;
  }
}
.descent-hud {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  background: #101b25dc;
  border-radius: 6px;
  padding: 7px 12px;
  margin-top: 5px;
  font: 12px monospace;
  color: #cddae5;
  pointer-events: none;
}
.construction-tools {
  position: absolute; bottom: 48px; left: 16px; z-index: 5;
  pointer-events: auto; background: linear-gradient(#4a545d, #1c252d 46%, #11191f);
  border: 1px solid #73808a; border-radius: 9px; padding: 4px;
  box-shadow: inset 0 1px 1px #c6d1da66, 0 5px 15px #0009;
}
.center-tools, .placement-tools { display: flex; gap: 3px; align-items: center; }
.center-tools { margin-bottom: 4px; }
.construction-tools button {
  display: grid; place-items: center; width: 31px; height: 31px; min-width: 0; min-height: 0;
  padding: 3px; border-radius: 50%; border: 2px solid #7a8791;
  background: radial-gradient(circle at 45% 30%, #4a5b67, #18222b 75%);
  box-shadow: inset 0 1px 2px #dce5eb66, inset 0 -2px 3px #000b, 0 1px 2px #000b;
  color: #e5c631; touch-action: manipulation;
}
.construction-tools button:active { transform: none; filter: brightness(1.35); }
.construction-tools button svg { width: 100%; height: 100%; overflow: visible; }
.construction-tools .icon-line { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.construction-tools .icon-orbit { fill: none; stroke: #9ba9af; stroke-width: 1.6; }
.construction-tools .icon-fill { fill: currentColor; }
.construction-tools .mass-center { color: #ebda42; }
.construction-tools .thrust-center { color: #b782df; }
.construction-tools .lift-center { color: #6ed2ed; }
.construction-tools button[aria-pressed="true"], .construction-tools #symmetry {
  border-color: #c2d3d9; background: radial-gradient(circle at 45% 35%, #455967, #0e1a22 75%);
}
.construction-tools button[aria-pressed="true"] { box-shadow: inset 0 0 7px currentColor, 0 0 4px #b9d4de77; }
.construction-tools #symmetry { width: 41px; height: 41px; }
#symmetryIcon { display: block; width: 32px; height: 32px; }
#symmetryIcon svg { width: 100%; height: 100%; }
.construction-tools #angleSnap { width: 26px; height: 26px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
#toolHelp:not([hidden]) {
  position: absolute; bottom: calc(100% + 7px); left: 0; width: max-content; max-width: min(270px, calc(100vw - 24px));
  padding: 7px 9px; border: 1px solid #8a9ca8; border-radius: 6px;
  background: #17232bf5; color: #e8f1f3; font-size: 11px; line-height: 1.4;
  box-shadow: 0 3px 12px #000a; pointer-events: none;
}
@media (max-width: 740px), (max-height: 650px) {
  .construction-tools { bottom: 8px; left: 6px; }
}
@media (max-width: 740px) {
  .descent-hud {
    font-size: 10px;
    gap: 4px;
    padding: 5px;
  }
}
/* Selected part controls shared by the workshop and flight views. */
.part-action-window:not([hidden]) {
  position: fixed;
  z-index: 25;
  left: max(12px, calc(50% - 150px));
  top: 40px;
  width: min(300px, calc(100vw - 24px));
  max-height: min(68vh, 540px);
  color: #e8eef3;
  background: #18232e;
  border: 1px solid #526473;
  border-radius: 9px;
  box-shadow: 0 12px 35px #0009;
  display: flex;
  flex-direction: column;
}
.part-action-heading { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid #394a57; }
.part-action-heading small { color: #8ea9bb; font-size: 9px; letter-spacing: .12em; }
.part-action-heading h2 { margin: 2px 0 0; font-size: 15px; }
.part-action-heading button { border: 0; background: transparent; color: inherit; font-size: 22px; cursor: pointer; }
.part-action-body { overflow: auto; padding: 10px 12px 14px; touch-action: pan-y; }
.part-action-buttons { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.part-action-buttons button { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 44px; padding: 3px 0; border: 0; border-radius: 3px; color: #f3f5f6; background: transparent; cursor: pointer; text-align: left; font-size: 14px; line-height: 1.4; touch-action: manipulation; }
.part-action-buttons button::before { content: ''; flex: 0 0 62px; height: 22px; border: 1px solid #087e98; border-radius: 5px; background: linear-gradient(#40e0ec 0%, #19c9dc 45%, #0695b1 55%, #078ca6 100%); box-shadow: inset 0 1px 1px #c2ffffaa, 0 1px 2px #0008; }
.part-action-buttons button:hover:not(:disabled)::before { filter: brightness(1.15); }
.part-action-buttons button:active:not(:disabled)::before { background: linear-gradient(#067c96, #11b7cc); box-shadow: inset 0 2px 3px #003744aa; }
.part-action-buttons button:focus-visible { outline: 2px solid #85f3ff; outline-offset: 2px; }
.flight-part-picker { display: grid; gap: 4px; margin-top: 8px; font-size: 12px; }
.flight-part-picker select { width: 100%; min-width: 0; }
.action-groups { margin-top: 8px; flex-shrink: 0; }
.action-groups summary { cursor: pointer; min-height: 44px; padding: 12px 4px; font-size: 12px; }
.action-groups p, .action-groups small { font-size: 11px; line-height: 1.5; }
#customActionGroups { display: grid; grid-template-columns: repeat(2, minmax(44px, 1fr)); gap: 6px; margin: 8px 0; }
#customActionGroups button { min-height: 44px; padding: 6px; border: 1px solid #859096; border-radius: 4px; background: linear-gradient(#414b50, #242b30); color: #edf2ed; font-weight: 700; font-size: 16px; touch-action: manipulation; }
#customActionGroups button:disabled { opacity: .4; }
#customActionGroups button:active:not(:disabled) { background: #4f7545; }
.part-action-buttons button:disabled { opacity: .5; cursor: default; }
.part-action-field, .part-action-check, .part-action-resource { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; font-size: 12px; }
.part-action-field input { width: 74px; padding: 5px; color: inherit; background: #111b24; border: 1px solid #51616d; border-radius: 4px; }
.part-action-resource { border-bottom: 1px solid #344450; }
@media (max-width: 700px) { .part-action-window:not([hidden]) { top: 34px; left: 50%; transform: translateX(-50%); max-height: 55vh; } }
/* Shared action icons and stage sequence in construction and flight. */
.staging-heading {display:flex;justify-content:space-between;gap:8px;font-size:11px;font-weight:700;margin:12px 0 7px;color:#e2edf4}
.staging-heading span,.staging-help {font-size:10px;color:#a4b5c5}
.staging-stack {display:flex;flex-direction:column;gap:5px}
.staging-row {display:flex;gap:7px;padding:6px;border:1px solid #405165;border-radius:6px;background:#15212ddd}
.staging-row.is-next {border-color:#f5b84e;background:#49382066;box-shadow:inset 3px 0 #f5b84e}
.staging-row.is-done {opacity:.5}
.staging-number {flex:0 0 43px;display:flex;flex-direction:column;justify-content:center;text-align:center;color:#c3d0dc}
.staging-number b {font-size:21px;line-height:1.1;font-variant-numeric:tabular-nums}
.staging-number small {font-size:9px;margin-top:4px}
.is-next .staging-number {color:#ffd38a}
.staging-icons {display:flex;flex-wrap:wrap;align-items:center;gap:4px;min-width:0}
.staging-part {display:flex;flex-direction:column;align-items:center;justify-content:center;min-width:40px;min-height:47px;padding:4px;background:#253648;border:1px solid #587089;border-radius:4px;color:#ecf5ff;position:relative}
button.staging-part:hover,button.staging-part:focus-visible,.staging-part.is-selected {border-color:#73dfff;background:#244b5c;outline:2px solid #73dfff;outline-offset:1px}
.stage-icon {width:25px;height:27px;flex-shrink:0}
.stage-action {font-size:9px;white-space:nowrap;line-height:1.4}
.staging-part.is-disabled {opacity:.55;border-style:dashed}
.staging-part small {color:#ffc18a;font-size:9px}
.staging-help,.staging-empty {margin:6px 0 12px}
.stage-part button {flex-wrap:wrap}
.stage-part .stage-action {margin-right:5px}
#flightStages {max-height:32vh;overflow-y:auto;overscroll-behavior:contain;flex-shrink:1;min-height:50px;margin-top:8px}
#flightStages .staging-heading {position:sticky;top:0;background:#14202f;z-index:1;margin-top:0;padding:4px 0;flex-wrap:wrap}
@media (max-height:600px) {#flightStages {max-height:24vh}.staging-part {min-width:32px;min-height:38px;padding:2px}.stage-icon {width:20px;height:22px}.staging-number {flex-basis:34px}}
.parked-notice {padding:9px 10px;border:1px dashed #6b9db5;border-radius:5px;background:#1c3543;color:#c0e3f4;font-size:11px;line-height:1.6;margin:4px 0 10px}

/* Keep the staging action outside the scrolling information pane. */
.flight-right {
  bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  z-index: 4;
}
.flight-systems {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.flight-systems #resources { overflow: visible; }
.flight-systems #flightStages { max-height: none; overflow: visible; }
.flight-right .stage-box { flex: 0 0 auto; margin-top: 8px; padding-top: 8px; }
.flight-right .stage-box > strong { font-size: 26px; }
.flight-right .stage-box p { max-height: 2.8em; overflow-y: auto; margin: 4px 0 8px; }
#stageButton { min-height: 44px; }
.build-footer { padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.build-footer > #launch { flex-shrink: 0; }
@media (orientation: portrait) and (max-width: 740px) {
  .flight-right { bottom: max(235px, calc(210px + env(safe-area-inset-bottom))); }
}
@media (max-height: 500px) and (orientation: landscape) {
  .flight-right { bottom: max(8px, env(safe-area-inset-bottom)); }
  .flight-right .stage-box > span, .flight-right .stage-box > strong { display: inline; }
  .flight-right .stage-box > strong { margin-left: 8px; font-size: 20px; }
}

#crewDialog {width:min(620px,94vw)}
#crewList {display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:12px}
.crew-card {display:flex;align-items:center;gap:12px;padding:12px;background:#202d40;border:1px solid #59637a;border-radius:16px}
.crew-card svg {width:76px;flex-shrink:0}.crew-card small {display:block;color:#c0cada;margin:6px 0}.crew-card select {width:100%;max-width:220px}.crew-card button {margin-top:8px}
#cockpitLabel {position:fixed;top:195px;left:50%;transform:translateX(-50%);z-index:4;background:#26344de8;color:#fff0df;padding:10px 16px;border-radius:14px;pointer-events:none;max-width:85vw;font-size:12px}

@media(max-width:740px){.header-right{max-width:52vw;overflow-x:auto;flex-shrink:1}.header-right button{flex-shrink:0}#cockpitLabel{top:165px;max-width:90vw;font-size:10px}.crew-card{min-width:0}.crew-card>div{min-width:0}.crew-card select{max-width:100%}}
#maneuverDialog { width: min(480px, calc(100vw - 24px)); max-height: 88vh; overflow-y: auto; }
#maneuverForm { display: grid; gap: 12px; }
#maneuverForm label { display: grid; gap: 5px; }
#maneuverForm input { width: 100%; min-height: 44px; box-sizing: border-box; }
#maneuverForm button { min-height: 44px; }
#maneuverError { color: #ffb6a8; margin: 0; }
#maneuverReadout { color: #83caff; font-size: 12px; max-width: 210px; margin: 6px 0; }
#maneuverMapHint { color: #829eac; font-size: 10px; line-height: 1.35; }
.maneuver-map-tools { position: fixed; left: 0; top: 0; z-index: 6; width: 0; height: 0; pointer-events: none; }
.maneuver-map-tools button { position: absolute; pointer-events: auto; touch-action: none; width: 37px; height: 37px; padding: 0; border: 1px solid #78baff; border-radius: 50%; background: #102738ec; color: #c5eaff; font-size: 11px; font-weight: 700; transform: translate(-50%,-50%); box-shadow: 0 0 9px #19395f; }
.maneuver-map-tools button:hover,.maneuver-map-tools button:focus-visible { background: #22557c; }
.maneuver-map-tools .node-center { left: 0; top: 0; width: 38px; height: 38px; border: 2px solid #a5dbff; font-size: 22px; }
.maneuver-map-tools .prograde { left: 0; top: -70px; color: #e8f884; border-color: #d3e86b; }
.maneuver-map-tools .retrograde { left: 0; top: 70px; color: #e8f884; border-color: #d3e86b; }
.maneuver-map-tools .radial-out { left: 70px; top: 0; color: #8cf5f5; border-color: #60dddd; }
.maneuver-map-tools .radial-in { left: -70px; top: 0; color: #8cf5f5; border-color: #60dddd; }
.maneuver-map-tools .normal { left: 52px; top: -52px; color: #f7a4ff; border-color: #e687f0; }
.maneuver-map-tools .antinormal { left: -52px; top: 52px; color: #f7a4ff; border-color: #e687f0; }
.burn-hud { width: 172px; box-sizing: border-box; padding: 7px 9px; border: 1px solid #4a7191; border-radius: 7px; background: #102030ec; color: #d9eafa; text-align: center; }
.burn-hud strong { font: 700 13px monospace; }
.burn-hud small { display: block; font-size: 10px; line-height: 1.25; }
.burn-bar { height: 7px; margin: 5px 0; border-radius: 7px; background: #314451; overflow: hidden; }
.burn-bar span { display: block; height: 100%; width: 100%; background: #76c8ff; }
.burn-hud.low-fuel .burn-bar span { background: #e0655d; }
@media(max-width:700px) { .maneuver-map-tools button { width: 39px; height: 39px; } .maneuver-map-tools .prograde { top: -62px; } .maneuver-map-tools .retrograde { top: 62px; } .maneuver-map-tools .radial-out { left: 62px; } .maneuver-map-tools .radial-in { left: -62px; } .maneuver-map-tools .normal { left: 45px; top: -45px; } .maneuver-map-tools .antinormal { left: -45px; top: 45px; } .burn-hud { width: 145px; padding: 5px; } }
