/*! Solar System Repair Co. | Source: https://orbitalforest.com */
/* Phone chrome stays outside the dynamic viewport. Compact controls keep
   44px touch targets; pictures, floors and puzzle geometry stay unchanged. */
#game-shell[data-scene][data-ui-layout="portrait"] {
  grid-template-rows: calc(64px + var(--safe-top)) minmax(0, 1fr) calc(64px + var(--safe-bottom));
}
#game-shell[data-scene][data-ui-layout="portrait"] > .top-hud {
  grid-template-rows: 44px 12px;
  padding: var(--safe-top) max(6px, var(--safe-right)) 0 max(6px, var(--safe-left));
  border-width: 4px; border-image-width: 4px; gap: 0 4px;
}
#game-shell[data-scene][data-ui-layout="portrait"] .brand-lockup .brand-name { width: 84px; height: 32px; }
#game-shell[data-scene][data-ui-layout="portrait"] > .top-hud #scene-label { font-size: 9px; line-height: 12px; }
#game-shell[data-scene][data-ui-layout="landscape"] {
  grid-template-rows: calc(46px + var(--safe-top)) minmax(0, 1fr) calc(44px + var(--safe-bottom));
}
#game-shell[data-scene][data-ui-layout="landscape"] > .top-hud {
  border-block-width: 0; border-image-width: 0 12px;
  padding-block: var(--safe-top) 0; padding-inline: max(4px, var(--safe-left)) max(4px, var(--safe-right));
}

/* Give the objective a complete line above the small source credit. This
   also replaces the flight rail whose painted end caps obscured phone text. */
html:not([data-puzzle-lab="true"]) #game-shell[data-scene][data-ui-layout]:not([data-ui-layout="desktop"]):not(:has(#mission-dialogue-console.is-puzzle-mode:not([hidden]))) > .bottom-hud {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto;
  align-content: center; align-items: center; gap: 2px 10px;
  border: 5px solid transparent;
  border-image: url("assets/workshop-bezel-v1.webp") 190 200 / 5px stretch;
  background: #081b20; background-clip: padding-box; box-shadow: none;
  padding: 3px max(9px, var(--safe-right)) calc(3px + var(--safe-bottom)) max(12px, var(--safe-left));
}
#game-shell[data-scene]:is([data-scene="flight"], [data-scene="return"])[data-ui-layout]:not([data-ui-layout="desktop"]) > .bottom-hud::before { content: none; }
html:not([data-puzzle-lab="true"]) #game-shell[data-scene][data-ui-layout]:not([data-ui-layout="desktop"]) > .bottom-hud > #objective-text {
  display: block; grid-column: 1 / -1; grid-row: 1;
  font-size: 11px; line-height: 1.3; white-space: normal; margin: 0;
  min-width: 0; max-height: 2.6em; overflow: hidden; text-align: left;
}
html:not([data-puzzle-lab="true"]) #game-shell[data-scene][data-ui-layout]:not([data-ui-layout="desktop"]) > .bottom-hud > .watermark-hud {
  grid-column: 1; grid-row: 2; margin: 0; font-size: 9px; align-self: center;
}
html:not([data-puzzle-lab="true"]) #game-shell[data-scene][data-ui-layout]:not([data-ui-layout="desktop"]) > .bottom-hud > :is(#workshop-interact-prompt, #mission-interact-prompt, #backyard-interact-prompt, #beach-interact-prompt) {
  grid-column: 2; grid-row: 2; min-width: 0; justify-self: end; font-size: 9px;
  line-height: 1.2; max-width: 100%; white-space: normal; text-align: right;
}
html:not([data-puzzle-lab="true"]) #game-shell[data-scene]:is([data-scene="flight"], [data-scene="return"])[data-ui-layout="portrait"] {
  grid-template-rows: calc(64px + var(--safe-top)) minmax(0, 1fr) calc(48px + var(--safe-bottom));
}
html:not([data-puzzle-lab="true"]) #game-shell[data-scene][data-ui-layout="landscape"] > .bottom-hud > #objective-text { font-size: 10px; max-height: 1.3em; }

/* The movement strip is centred below the world rather than pushed against
   the screen edge. A short USE label fits the physical interaction key. */
#game-shell[data-scene][data-ui-layout="portrait"] :is(#workshop-explore, #mission-scene, #backyard-scene, #beach-scene) .mission-move-pad {
  right: 50%; transform: translateX(50%); gap: 7px;
}
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) :is(#workshop-explore, #mission-scene, #backyard-scene, #beach-scene) .mission-move-pad .mission-interact-button { font-size: 0; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .mission-interact-button::before { content: "USE"; font: 700 9px/1 ui-monospace, monospace; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .mission-interact-button span { font-size: 18px; }

/* Flight instruments use 110px, leaving more of the centre for navigation. */
#game-shell[data-scene][data-ui-layout="portrait"] .flight-readout {
  top: 4px; left: 8px; width: calc(100% - 16px); height: 24px;
  border-width: 3px; border-image-width: 3px; padding: 2px 6px;
}
#game-shell[data-scene][data-ui-layout="portrait"] .flight-readout h1 { font-size: 11px; }
#game-shell[data-scene][data-ui-layout="portrait"] .flight-meters {
  top: 32px; left: 8px; right: 8px; height: 78px; overflow: hidden;
  border-width: 4px; border-image-width: 4px; padding: 4px; gap: 3px 4px;
}
#game-shell[data-scene][data-ui-layout="portrait"] .flight-data-grid { gap: 3px; }
#game-shell[data-scene][data-ui-layout="portrait"] .flight-data-grid > div { padding: 2px 3px; }
#game-shell[data-scene][data-ui-layout="portrait"] .flight-data-grid span { font-size: 8px; }
#game-shell[data-scene][data-ui-layout="portrait"] .flight-data-grid strong { font-size: 10px; }
#game-shell[data-scene][data-ui-layout="portrait"] .flight-meters > .meter-label { font-size: 9px; }
#game-shell[data-scene][data-ui-layout="portrait"] .flight-meters .meter { height: 7px; }
#game-shell[data-scene][data-ui-layout="portrait"] .nav-status { font-size: 9px; line-height: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#game-shell[data-scene][data-ui-layout="portrait"] #flight-canvas { top: 116px; bottom: 66px; height: calc(100% - 182px); }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .cockpit-portrait figcaption { display: none; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) .cockpit-portrait { width: 46px; flex-basis: 46px; }
#game-shell[data-scene][data-ui-layout="portrait"] .flight-cockpit-crew { bottom: 70px; }

/* Four contracts per page remain. Compact cards and a hidden one-page pager
   free room for the actual request and keep the launch action visible. */
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .mission-computer-card {
  width: calc(100% - 12px); height: calc(100% - 12px); padding: 3px;
  border-width: 8px; border-image-width: 8px; gap: 4px;
}
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .mission-computer-card .mission-board {
  padding: 4px; max-height: none;
}
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .mission-computer-card .mission-board-heading {
  margin: 0 0 5px; padding: 0; font-size: 10px; line-height: 1.3;
}
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) #mission-progress-note { margin: 0; font-size: 10px; line-height: 1.3; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .mission-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, 44px); height: 92px; gap: 4px; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .mission-card { min-height: 44px; height: 44px; padding: 4px 6px; font-size: 13px; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .mission-card > :not(.mission-card-destination) { display: none; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .mission-card .mission-card-destination { display: block; font-size: 13px; line-height: 1.2; letter-spacing: 0; color: var(--cream); }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .mission-pagination { height: 44px; margin-top: 4px; gap: 4px; }
#game-shell[data-scene="workshop"] .mission-pagination:has(#mission-page-previous:disabled):has(#mission-page-next:disabled) { display: none; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .mission-pagination :is(button, #mission-page-status) { min-height: 44px; padding: 4px; font-size: 10px; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .mission-computer-card .mission-terminal {
  display: grid; grid-template-rows: 44px minmax(0, 1fr); overflow: hidden;
}
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .mission-terminal .terminal-bar { min-height: 44px; padding: 0 4px; gap: 5px; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) #call-link-label { font-size: 9px; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .terminal-exit { min-height: 44px; padding: 6px; font-size: 10px; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .mission-terminal .terminal-screen { display: contents; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .mission-computer-card .call-copy.dialogue-panel {
  --caller-size: 64px; height: auto; min-height: 0; overflow: hidden; align-self: stretch; grid-row: 2;
  padding: 6px; gap: 4px 8px; grid-template-rows: auto auto minmax(0, 1fr) auto auto auto;
}
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .mission-computer-card .call-copy .dialogue-portrait { grid-row: 1 / 3; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .mission-computer-card .call-copy .caller-meta { align-self: center; font-size: 11px; gap: 2px; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) #call-copy .caller-meta strong { font-size: 12px; line-height: 1.2; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .call-copy .caller-meta :is(.eyebrow, .dialogue-counter) { font-size: 9px; letter-spacing: 0; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) #call-copy #workshop-title { margin: 0; font-size: 16px; line-height: 1.15; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) #call-copy .caller-meta .eyebrow { margin: 0; line-height: 1.2; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) #call-copy #call-line {
  grid-column: 1 / -1; grid-row: 3; align-self: stretch; overflow: auto;
  margin: 0; padding: 2px 0; font-size: 13px; line-height: 1.4; min-height: 0;
}
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .call-copy .mission-facts { grid-row: 4; gap: 5px; padding-top: 4px; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .call-copy .mission-facts dt { font-size: 8px; margin: 0; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .call-copy .mission-facts dd { font-size: 11px; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) #call-copy #mission-facts > div { min-height: 0; padding: 2px 4px; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) #call-copy #mission-facts dt { margin: 0; font-size: 8px; line-height: 1.2; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) #call-copy #mission-facts dd { margin: 0; font-size: 11px; line-height: 1.2; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .call-copy .terminal-actions { grid-row: 5; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .call-copy .call-controls { grid-row: 6; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .call-copy :is(.terminal-actions, .call-controls) button { min-height: 44px; padding: 6px; font-size: 13px; }
#game-shell[data-scene="workshop"][data-ui-layout]:not([data-ui-layout="desktop"]) .watermark-terminal { font-size: 9px; }
#game-shell[data-scene="workshop"][data-ui-layout="portrait"] .mission-computer-card { grid-template-rows: auto minmax(0, 1fr) auto; }
#game-shell[data-scene="workshop"][data-ui-layout="portrait"] .mission-computer-card .mission-board { overflow: visible; }
#game-shell[data-scene="workshop"][data-ui-layout="landscape"] .mission-computer-card { grid-template-columns: minmax(140px, 25%) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
#game-shell[data-scene="workshop"][data-ui-layout][data-ui-layout="landscape"] .mission-computer-card .mission-terminal { grid-template-rows: minmax(0, 1fr); }
#game-shell[data-scene="workshop"][data-ui-layout][data-ui-layout="landscape"] .mission-terminal .terminal-bar { position: absolute; z-index: 2; top: 0; right: 0; padding: 0; background: transparent; border: 0; }
#game-shell[data-scene="workshop"][data-ui-layout][data-ui-layout="landscape"] .terminal-bar > span { display: none; }
#game-shell[data-scene="workshop"][data-ui-layout][data-ui-layout="landscape"] .mission-computer-card .call-copy.dialogue-panel { --caller-size: 40px; grid-row: 1; gap: 2px 8px; }
#game-shell[data-scene="workshop"][data-ui-layout][data-ui-layout="landscape"] .mission-computer-card .call-copy :is(.caller-meta, h1) { padding-right: 96px; }
#game-shell[data-scene="workshop"][data-ui-layout][data-ui-layout="landscape"] .call-copy .dialogue-counter { display: none; }

/* Portrait and name share the first row. Speech uses the full width below;
   actions have their own fixed row, so scrolling text cannot hide Continue. */
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) :is(#mission-dialogue-console.is-conversation-mode, #mission-dialogue-console.is-completion-mode, #backyard-dialogue-console.is-conversation-mode, #beach-dialogue-console:not(.is-coastal-fishing):not(.is-bench-mode).is-conversation-mode) {
  width: calc(100% - 16px); height: min(310px, calc(100% - 16px));
  display: grid; grid-template-columns: 64px minmax(0, 1fr); grid-template-rows: 64px minmax(0, 1fr) auto;
  gap: 8px; padding: 8px; border-width: 8px; border-image-width: 8px; overflow: hidden;
  transform: translate(-50%, -50%);
}
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) :is(#mission-dialogue-console, #backyard-dialogue-console, #beach-dialogue-console:not(.is-coastal-fishing):not(.is-bench-mode)).is-conversation-mode .dialogue-portrait,
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #mission-dialogue-console.is-completion-mode .dialogue-portrait { grid-column: 1; grid-row: 1; width: 64px; height: 64px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) :is(#backyard-dialogue-console, #beach-dialogue-console:not(.is-coastal-fishing):not(.is-bench-mode)).is-conversation-mode .dialogue-content { display: contents; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) :is(#mission-dialogue-console, #backyard-dialogue-console, #beach-dialogue-console:not(.is-coastal-fishing):not(.is-bench-mode)):is(.is-conversation-mode, .is-completion-mode) .dialogue-heading {
  grid-column: 2; grid-row: 1; align-self: center; margin: 0;
  padding: 0 34px 0 0; font-size: 13px;
}
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) :is(#mission-dialogue-console, #backyard-dialogue-console, #beach-dialogue-console:not(.is-coastal-fishing):not(.is-bench-mode)):is(.is-conversation-mode, .is-completion-mode) .dialogue-heading .eyebrow { font-size: 13px; line-height: 1.3; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) :is(#mission-dialogue-console, #backyard-dialogue-console, #beach-dialogue-console:not(.is-coastal-fishing):not(.is-bench-mode)):is(.is-conversation-mode, .is-completion-mode) .mission-dialogue-close { min-width: 44px; min-height: 44px; width: 44px; height: 44px; top: 4px; right: 4px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) :is(#backyard-dialogue-console, #beach-dialogue-console:not(.is-coastal-fishing):not(.is-bench-mode)).is-conversation-mode .dialogue-line,
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #mission-dialogue-console:is(.is-conversation-mode, .is-completion-mode) .dialogue-content {
  grid-column: 1 / -1; grid-row: 2; min-height: 0; height: 100%; overflow: auto;
  margin: 0; padding: 6px; scrollbar-gutter: auto;
}
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) :is(#mission-dialogue-console, #backyard-dialogue-console, #beach-dialogue-console:not(.is-coastal-fishing):not(.is-bench-mode)):is(.is-conversation-mode, .is-completion-mode) .dialogue-line { font-size: 14px; line-height: 1.5; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #mission-dialogue-console:is(.is-conversation-mode, .is-completion-mode) .dialogue-actions,
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) :is(#backyard-dialogue-console, #beach-dialogue-console:not(.is-coastal-fishing):not(.is-bench-mode)).is-conversation-mode :is(.next-button, .backyard-dialogue-choices) { grid-column: 1 / -1; grid-row: 3; margin: 0; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) :is(#mission-dialogue-console, #backyard-dialogue-console, #beach-dialogue-console:not(.is-coastal-fishing):not(.is-bench-mode)):is(.is-conversation-mode, .is-completion-mode) :is(.next-button, .backyard-dialogue-choices button) { min-height: 44px; padding: 6px; font-size: 12px; }
#game-shell[data-ui-layout][data-ui-layout="landscape"] :is(#mission-dialogue-console.is-conversation-mode, #mission-dialogue-console.is-completion-mode, #backyard-dialogue-console.is-conversation-mode, #beach-dialogue-console:not(.is-coastal-fishing):not(.is-bench-mode).is-conversation-mode) { grid-template-columns: 48px minmax(0, 1fr); grid-template-rows: 48px minmax(0, 1fr) auto; gap: 4px; }
#game-shell[data-ui-layout][data-ui-layout="landscape"] :is(#mission-dialogue-console, #backyard-dialogue-console, #beach-dialogue-console:not(.is-coastal-fishing):not(.is-bench-mode)):is(.is-conversation-mode, .is-completion-mode) .dialogue-portrait { width: 48px; height: 48px; }

/* Fishing has no walking controls. Return their strip to the view of the
   dock, and keep the close key clear of the fishing instructions. */
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #beach-scene.is-dock-fishing .world-viewport { width: 100%; height: 100%; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #beach-scene.is-dock-fishing::after { content: none; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #beach-dialogue-console.is-coastal-fishing:not(.is-inspecting-fish) { bottom: 8px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #beach-dialogue-console.is-coastal-fishing :is(.coastal-fishing-header, .coastal-status) { padding-right: 44px; }

/* The original number-choice repairs need readable, shorter text blocks on
   phones. Their answer keys stay larger than the 44px touch minimum. */
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #mission-dialogue-console.is-puzzle-mode:has(#answer-grid > .answer-button) #dialogue-line { font-size: 14px; line-height: 1.4; padding: 6px 8px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #mission-dialogue-console.is-puzzle-mode:has(#answer-grid > .answer-button) .dialogue-content { gap: 6px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #mission-dialogue-console.is-puzzle-mode:has(#answer-grid > .answer-button) #question-prompt { font-size: 18px; line-height: 1.3; padding: 6px 8px; }
#game-shell[data-ui-layout]:not([data-ui-layout="desktop"]) #mission-dialogue-console.is-puzzle-mode:has(#answer-grid > .answer-button) #answer-grid > .answer-button { min-height: 56px; height: 56px; padding: 6px; font-size: 24px; line-height: 1.1; }
#game-shell[data-ui-layout="landscape"] #mission-dialogue-console.is-puzzle-mode:has(#answer-grid > .answer-button) .dialogue-content::after { display: none; }
/* In short landscape the complete question already repeats this hint. Show
   the question once so the answers remain clear of the floating TEST key. */
#game-shell[data-ui-layout="landscape"] #mission-dialogue-console.is-puzzle-mode:has(#answer-grid > .answer-button) #dialogue-line { display: none; }

/* Fill portrait intro screens instead of surrounding the film with black.
   Loading and credits remain in their own clear bottom band. */
@media (max-aspect-ratio: 4/5) {
  .title-frame img { object-fit: cover; object-position: 58% center; }
  #mission-launch-card .launch-caption { left: 16px; width: calc(100% - 32px); max-width: none; }
  #mission-launch-card .launch-caption h1 { font-size: clamp(22px, 6vw, 30px); line-height: 1.1; }
}
@media (max-width: 480px), (max-height: 480px) {
  .title-loader-label { font-size: 11px; }
  #graphics-loading-dialog .loading-dialog-copy, #asset-loading-progress { max-width: 280px; font-size: 13px; line-height: 1.5; }
}
