/*! Solar System Repair Co. | Source: https://orbitalforest.com */
/* Phone pass from the user's Chrome screenshots, v119/v120. Desktop keeps its
   existing cockpit; compact modes have their own usable world viewport. */
#game-shell { grid-template-columns: minmax(0, 1fr); }
#game-shell > :is(.top-hud, #game-stage, .bottom-hud) { min-width: 0; }
.world-viewport { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; }
#game-shell [data-action],
#game-shell [data-action] * {
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}
#game-shell [data-action] > * { pointer-events: none; }
#game-shell :is(.scene-art, .mission-world-art, .mission-sprite) img {
  pointer-events: none; -webkit-touch-callout: none; -webkit-user-drag: none;
  -webkit-user-select: none; user-select: none;
}

/* Explicitly override the older scene-specific rails. A narrow header must
   not contribute an oversized min-content grid track. */
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) > .top-hud {
  min-width: 0; min-height: 0; gap: 4px;
  padding: var(--safe-top) 4px 0;
  border-width: 3px 20px; border-image-width: 3px 20px;
}
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .credit-balance {
  border: 0; border-image: none; background: none; box-shadow: none;
  padding: 0; font-size: 9px; letter-spacing: 0;
}
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .hud-actions .icon-button { flex: 0 0 44px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #audio-button { display: inline-grid; place-items: center; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) > .bottom-hud {
  min-height: 0; height: 100%; gap: 2px;
  padding: 4px 8px calc(4px + var(--safe-bottom));
  border-width: 1px 26px; border-image-width: 1px 26px;
}
#game-shell[data-scene][data-ui-layout="portrait"] { grid-template-rows: calc(72px + var(--safe-top)) minmax(0, 1fr) calc(64px + var(--safe-bottom)); }
#game-shell[data-scene][data-ui-layout="portrait"] > .bottom-hud { padding-block: 8px calc(8px + var(--safe-bottom)); }
#game-shell[data-scene][data-ui-layout="portrait"] > .top-hud {
  grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 44px 16px;
  border-block-width: 6px; border-image-width: 6px 20px;
}
#game-shell[data-scene][data-ui-layout="portrait"] .brand-lockup .brand-name { width: 96px; height: 34px; }
#game-shell[data-scene][data-ui-layout="landscape"] { grid-template-rows: calc(50px + var(--safe-top)) minmax(0, 1fr) calc(50px + var(--safe-bottom)); }
#game-shell[data-scene][data-ui-layout="landscape"] #scene-label { font-size: 9px; margin-left: 0; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) > .bottom-hud :is(#workshop-interact-prompt, #backyard-interact-prompt, #beach-interact-prompt, #mission-interact-prompt) {
  flex: 0 1 auto; font-size: 10px; line-height: 1.2;
}
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) > .bottom-hud :is(#workshop-interact-prompt, #backyard-interact-prompt, #beach-interact-prompt, #mission-interact-prompt) kbd { min-height: 16px; padding: 1px 4px; font-size: 10px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .workshop-aside-button { max-height: 28px; min-height: 24px; padding-block: 0; }
/* The wide ground rail's painted aperture occupies only a third of its
   height. Use the existing nine-slice bezel in compact walking layouts so
   both objective and interaction lines stay inside the actual glass. */
#game-shell:is([data-scene="workshop"], [data-scene="mission"], [data-scene="backyard"], [data-scene="beach"])[data-ui-layout]:not([data-ui-layout="desktop"]) > .bottom-hud {
  border: 6px solid transparent;
  border-image: url("assets/workshop-bezel-v1.webp") 190 200 / 6px stretch;
  background: #081b20; background-clip: padding-box; box-shadow: none;
  padding: 2px 8px calc(2px + var(--safe-bottom));
}
#game-shell:is([data-scene="workshop"], [data-scene="mission"], [data-scene="backyard"], [data-scene="beach"])[data-ui-layout="portrait"][data-ui-layout] { grid-template-rows: calc(72px + var(--safe-top)) minmax(0, 1fr) calc(72px + var(--safe-bottom)); }
#game-shell:is([data-scene="workshop"], [data-scene="mission"], [data-scene="backyard"], [data-scene="beach"])[data-ui-layout="portrait"][data-ui-layout] > .bottom-hud {
  border-width: 8px; border-image-width: 8px;
  padding: 4px 8px calc(4px + var(--safe-bottom));
}
#game-shell[data-scene]:is([data-scene="flight"], [data-scene="return"])[data-ui-layout="portrait"] > .bottom-hud { --flight-bottom-height: 64px; border: 0; border-image: none; }
#game-shell[data-scene]:is([data-scene="flight"], [data-scene="return"])[data-ui-layout="landscape"] > .bottom-hud { --flight-bottom-height: 50px; border: 0; border-image: none; }

/* A separate control strip keeps room markers and characters tappable.
   Landscape reserves width; portrait reserves a single short row. */
#game-shell[data-scene][data-ui-layout="portrait"] { --ground-strip: 64px; }
#game-shell[data-scene][data-ui-layout="landscape"] { --ground-strip: 148px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) :is(#workshop-scene, #mission-scene, #backyard-scene, #beach-scene)::after {
  content: ""; position: absolute; z-index: 1; pointer-events: none;
  background: linear-gradient(145deg, #163438, #081a22);
  box-shadow: inset 0 1px #6a9c8c, inset 0 4px 10px #0008;
}
#game-shell[data-scene][data-ui-layout="portrait"] .world-viewport { height: calc(100% - var(--ground-strip)); bottom: auto; }
#game-shell[data-scene][data-ui-layout="portrait"] :is(#workshop-scene, #mission-scene, #backyard-scene, #beach-scene)::after { bottom: 0; left: 0; right: 0; height: var(--ground-strip); }
#game-shell[data-scene][data-ui-layout="landscape"] .world-viewport { width: calc(100% - var(--ground-strip)); right: auto; }
#game-shell[data-scene][data-ui-layout="landscape"] :is(#workshop-scene, #mission-scene, #backyard-scene, #beach-scene)::after { top: 0; bottom: 0; right: 0; width: var(--ground-strip); }
#game-shell[data-scene][data-ui-layout="portrait"] :is(#workshop-explore, #mission-scene, #backyard-scene, #beach-scene) .mission-move-pad {
  --ground-key-width: 48px; --ground-key-height: 48px;
  grid-template-columns: repeat(5, 48px); grid-template-rows: 48px;
  grid-template-areas: "left up down right interact";
  gap: 4px; bottom: 8px; right: 8px;
}
#game-shell[data-scene][data-ui-layout="landscape"] :is(#workshop-explore, #mission-scene, #backyard-scene, #beach-scene) .mission-move-pad {
  --ground-key-width: 44px; --ground-key-height: 44px;
  grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(2, 44px);
  grid-template-areas: ". up interact" "left down right";
  gap: 4px; top: 50%; bottom: auto; right: 4px; transform: translateY(-50%);
}
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .workshop-zone-marker { left: clamp(48px, var(--zone-x), calc(100% - 48px)); }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .workshop-zone-marker strong { max-width: 90px; font-size: 8px; padding: 3px 4px; }

/* Closed mission drawers are small handles, with a 44px total tap target.
   Expanded drawers scroll rather than growing across the control strip. */
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) :is(#mission-inventory, #mission-repair-list) {
  top: 6px; padding: 2px; border-width: 7px; border-image-width: 7px;
  max-height: calc(100% - 76px); scrollbar-gutter: auto;
}
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) :is(#mission-inventory, #mission-repair-list) > summary {
  min-height: 28px; align-items: center; flex-wrap: nowrap; font-size: 9px;
}
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #mission-inventory { left: 6px; width: 112px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #mission-inventory > summary { gap: 3px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #mission-inventory > summary > span { font-size: 8px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #mission-repair-list .repair-summary-copy {
  font-size: 10px; line-height: 1.25;
}
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #mission-repair-list:not([open]) .repair-summary-copy {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
#game-shell[data-scene][data-ui-layout="portrait"] #mission-repair-list { right: 6px; width: calc(100% - 130px); }
#game-shell[data-scene][data-ui-layout="landscape"] #mission-repair-list { right: calc(var(--ground-strip) + 6px); width: min(250px, calc(100% - var(--ground-strip) - 130px)); }
#game-shell[data-scene][data-ui-layout="landscape"] :is(#mission-inventory, #mission-repair-list) { max-height: calc(100% - 12px); }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #mission-inventory[open] { width: min(280px, calc(100% - 12px)); }
#game-shell[data-scene][data-ui-layout="landscape"] #mission-inventory[open] { width: min(280px, calc(100% - var(--ground-strip) - 12px)); }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #mission-inventory[open] { z-index: 10; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #mission-dialogue-console.is-puzzle-mode { grid-template-columns: minmax(0, 1fr); }

/* Compact flight instruments share a small data row. Fuel/hull retain both
   numbers and meters; the large decorative speed dial is unnecessary here. */
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .flight-readout {
  top: 6px; left: 6px; max-width: none;
  padding: 4px 6px; border-width: 6px; border-image-width: 6px;
}
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .flight-readout .eyebrow { display: none; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .flight-readout h1 { margin: 0; font-size: 12px; line-height: 1.25; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .outer-cruise-indicator { margin: 2px 0 0; font-size: 9px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .flight-meters {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center; gap: 4px;
  padding: 4px; border-width: 6px; border-image-width: 6px;
}
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .flight-data-grid { grid-column: 1 / -1; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin: 0; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .flight-data-grid > div { min-height: 0; padding: 3px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .flight-data-grid > div:nth-child(3) { min-height: 0; padding-right: 3px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .flight-data-grid > div:nth-child(3)::before,
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .flight-data-grid > div:nth-child(3)::after { content: none; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .flight-data-grid span { font-size: 8px; letter-spacing: 0; margin: 0 0 2px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .flight-data-grid strong { font-size: 10px; white-space: nowrap; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #route-meter { display: none; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .flight-meters > .meter-label { font-size: 9px; margin: 0; gap: 3px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .flight-meters .meter { height: 8px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .nav-status { display: block; grid-column: 1 / -1; margin: 0; font-size: 10px; line-height: 1.25; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .flight-controls { grid-template-areas: "left thrust brake right"; gap: 4px; right: 6px; bottom: 8px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .flight-control { width: var(--flight-key); height: var(--flight-key); min-width: 44px; min-height: 44px; font-size: 20px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .flight-control span { font-size: 8px; margin-top: -5px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .system-map { top: auto; bottom: 8px; left: 6px; padding: 4px; width: 60px; height: 48px; border-width: 6px; border-image-width: 6px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #system-map-canvas { display: none; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .system-map .map-heading { display: none; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .system-map p { display: block; margin: 0; font-size: 10px; line-height: 1.2; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .system-map p::before { content: "MAP ↗"; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .system-map p { font-size: 0; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .system-map p::before { font-size: 10px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .flight-cockpit-crew { left: 8px; right: auto; top: auto; transform: none; gap: 6px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .cockpit-portrait { width: 52px; flex: 0 0 52px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .cockpit-portrait figcaption { white-space: normal; font-size: 8px; line-height: 1.1; letter-spacing: 0; }
#game-shell[data-scene][data-ui-layout="portrait"] .flight-readout { width: calc(100% - 12px); height: 35px; }
#game-shell[data-scene][data-ui-layout="portrait"] .flight-meters { top: 45px; left: 6px; right: 6px; width: auto; height: 104px; overflow: auto; }
#game-shell[data-scene][data-ui-layout="portrait"] .flight-controls { --flight-key: 52px; grid-template-columns: repeat(4, 52px); }
#game-shell[data-scene][data-ui-layout="portrait"] .flight-cockpit-crew { bottom: 68px; }
#game-shell[data-scene][data-ui-layout="portrait"] #flight-canvas { top: 155px; bottom: 66px; height: calc(100% - 221px); }
#game-shell[data-ui-layout="portrait"] .flight-impact-alert { top: calc(50% + 88px); width: calc(100% - 32px); }
#game-shell[data-scene][data-ui-layout="landscape"] .flight-readout { width: 144px; }
#game-shell[data-scene][data-ui-layout="landscape"] .flight-meters {
  top: 6px; bottom: 60px; left: auto; right: 6px; width: 192px; height: auto;
  grid-template-columns: auto minmax(0, 1fr); overflow: auto; align-content: start;
}
#game-shell[data-scene][data-ui-layout="landscape"] .flight-data-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#game-shell[data-scene][data-ui-layout="landscape"] .flight-controls { --flight-key: 44px; grid-template-columns: repeat(4, 44px); }
#game-shell[data-scene][data-ui-layout="landscape"] .flight-cockpit-crew { top: 62px; bottom: auto; }
#game-shell[data-scene][data-ui-layout="landscape"] #flight-canvas { top: 0; bottom: 0; left: 156px; right: 204px; width: calc(100% - 360px); height: 100%; }
#game-shell[data-ui-layout="landscape"] .flight-impact-alert { left: calc(50% - 24px); top: calc(50% + 42px); width: min(320px, calc(100% - 384px)); }

/* Very small landscape windows still have an unobstructed flight centre. */
@media (max-width: 640px) and (orientation: landscape) {
  #game-shell[data-scene][data-ui-layout="landscape"] .flight-readout { width: 108px; }
  #game-shell[data-scene][data-ui-layout="landscape"] .flight-cockpit-crew { gap: 3px; }
  #game-shell[data-scene][data-ui-layout="landscape"] .cockpit-portrait { width: 46px; flex-basis: 46px; }
  #game-shell[data-scene][data-ui-layout="landscape"] #flight-canvas { left: 120px; width: calc(100% - 324px); }
  #game-shell[data-ui-layout="landscape"] .flight-impact-alert { left: calc(50% - 42px); width: min(320px, calc(100% - 348px)); }
}

/* Keep the artwork, feet anchors and hotspots in one proportional world.
   Only this layer pans; dialogue, drawers and held controls stay screen-bound. */
.workshop-world { position: absolute; inset: 0; width: 100%; height: 100%; }
.workshop-world-art { display: none; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) :is(.mission-world, .workshop-world) {
  inset: auto; left: 0; top: 0;
  width: var(--world-camera-width, 1066px); height: var(--world-camera-height, 600px);
  transform: translate(var(--world-camera-x, 0px), var(--world-camera-y, 0px));
}
#game-shell[data-scene="workshop"][data-workshop-view="explore"][data-ui-layout]:not([data-ui-layout="desktop"]) > #game-stage > .scene-art { visibility: hidden; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .workshop-world-art { display: block; z-index: 0; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) :is(.mission-world, .workshop-world) .mission-world-art img { object-fit: fill; transform: none; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #workshop-world .mission-world-art img { filter: saturate(1.04) brightness(1.03); }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) :is(#workshop-world, #backyard-world, #beach-world) .mission-rivet { width: 10.5%; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) :is(#workshop-world, #backyard-world, #beach-world) .mission-socket { width: 8.4%; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #workshop-world .workshop-rivet { width: 10%; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #workshop-world .workshop-socket { width: 8%; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #backyard-world #backyard-julia { width: 10.2%; }
/* The location gets its own flexible space instead of crowding the logo. */
#game-shell[data-scene][data-ui-layout] > .top-hud {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
}
#game-shell[data-scene][data-ui-layout] > .top-hud #scene-label {
  display: block; min-width: 0; max-width: none; margin: 0; padding: 0 8px;
  border: 0; text-align: center; white-space: normal; text-overflow: clip;
  overflow: visible; line-height: 1.15; letter-spacing: .025em; overflow-wrap: anywhere;
}
#game-shell[data-scene][data-ui-layout="portrait"] > .top-hud {
  grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 32px 24px;
  border-image: url("assets/workshop-bezel-v1.webp") 190 200 / 6px stretch;
  border-width: 6px; background: #081b20; background-clip: padding-box;
  box-shadow: none; padding-inline: 8px;
}
#game-shell[data-scene][data-ui-layout="portrait"] .brand-name {
  width: 96px; height: 32px; flex-basis: 96px;
}
#game-shell[data-scene][data-ui-layout="portrait"] > .top-hud .hud-actions { grid-column: 2; grid-row: 1; }
#game-shell[data-scene][data-ui-layout="portrait"] > .top-hud #scene-label {
  grid-column: 1 / -1; grid-row: 2; padding: 0; font-size: 10px;
}
#game-shell[data-scene][data-ui-layout="landscape"] > .top-hud #scene-label { font-size: 10px; }
