/*! Solar System Repair Co. | Source: https://orbitalforest.com */
/* Repair celebrations never resize or animate the machine's outer chassis. */
#game-shell .dialogue-panel.is-puzzle-success { animation: none; }
#game-shell .puzzle-sparkles { overflow: hidden; contain: layout paint; }
#game-shell .puzzle-sparkles.is-sparkling::before { animation: none; }

/* Large amber service keys, with a deep rim and a short physical press. */
#game-shell .dialogue-console.is-puzzle-mode :is(
  .machine-test, .math-test, .concept-test, .pressure-test, .packing-test,
  .signal-actions .button-primary, #next-question-button, #mission-dialogue-next) {
  min-height: 62px;
  min-width: min(210px, 100%);
  max-width: 100%;
  border: 14px solid transparent;
  border-image: var(--repair-amber-key) 73 100 fill / 14px stretch;
  padding: 8px 18px;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 6px 0 #302617) drop-shadow(0 9px 7px #0007);
  color: #281c10;
  text-shadow: 0 1px #ffe5b2;
  font-size: .88rem;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: .04em;
  touch-action: manipulation;
}
#game-shell .dialogue-console.is-puzzle-mode :is(
  .machine-test, .math-test, .concept-test, .pressure-test, .packing-test,
  .signal-actions .button-primary, #next-question-button, #mission-dialogue-next):is(:hover, :focus-visible):not(:disabled) {
  filter: brightness(1.12) drop-shadow(0 6px 0 #302617) drop-shadow(0 9px 7px #0007);
}
#game-shell .dialogue-console.is-puzzle-mode :is(
  .machine-test, .math-test, .concept-test, .pressure-test, .packing-test,
  .signal-actions .button-primary, #next-question-button, #mission-dialogue-next):active:not(:disabled) {
  transform: translateY(3px);
  filter: brightness(.96) drop-shadow(0 3px 0 #302617) drop-shadow(0 5px 4px #0007);
}

/* The 192x186 bezel opens at x25..167, y27..161. v163 atlases share a
   registered 128px cell and safe 8px gutter; fit the square without stretching
   or magnifying the painted edge into the gasket. */
#game-shell .cockpit-portrait-aperture { inset: 14.51613% 13.02083% 13.44086%; }
#game-shell .cockpit-camera { position: absolute; inset: 0; transform: translate3d(0, 0, 0); }
#game-shell .cockpit-portrait-window .cockpit-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  animation: none;
}
#game-shell.is-engine-firing .cockpit-camera { animation: cockpit-engine-vibration 84ms steps(1, end) infinite; }
#game-shell.is-retro-firing .cockpit-camera { animation: cockpit-retro-vibration 110ms steps(1, end) infinite; }
@keyframes cockpit-engine-vibration {
  0%, 100% { transform: translate3d(0, 0, 0); }
  20% { transform: translate3d(.65px, -.55px, 0); }
  40% { transform: translate3d(-.65px, .4px, 0); }
  60% { transform: translate3d(.3px, .7px, 0); }
  80% { transform: translate3d(-.4px, -.5px, 0); }
}
@keyframes cockpit-retro-vibration {
  0%, 100% { transform: translate3d(0, 0, 0); }
  25% { transform: translate3d(-.45px, .45px, 0); }
  50% { transform: translate3d(.5px, -.55px, 0); }
  75% { transform: translate3d(-.25px, .3px, 0); }
}
body.reduce-motion #game-shell .cockpit-camera { animation: none; transform: none; }
@media (prefers-reduced-motion: reduce) { #game-shell .cockpit-camera { animation: none !important; transform: none; } }

/* Julia, Chester and mission speakers share one conversation chassis. */
#game-shell .dialogue-console.is-conversation-mode {
  top: 50%; left: 50%; bottom: auto;
  width: min(820px, calc(100% - 24px));
  height: min(390px, calc(100% - 24px));
  grid-template-columns: 120px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  transform: translate(-50%, -50%) scale(var(--panel-fit, 1));
  overflow: hidden;
}
#game-shell .dialogue-console.is-conversation-mode .dialogue-portrait { grid-column: 1; grid-row: 1; width: 120px; height: 120px; align-self: start; }
#game-shell .dialogue-console.is-conversation-mode .dialogue-content { display: flex; flex-direction: column; grid-column: 2; grid-row: 1; height: 100%; min-height: 0; gap: 12px; overflow: auto; }
#game-shell .dialogue-console.is-conversation-mode .dialogue-content > * { flex-shrink: 0; }
#game-shell .dialogue-console.is-conversation-mode .dialogue-heading { display: block; align-self: stretch; margin: 0 20px 0 0; }
#game-shell .dialogue-console.is-conversation-mode .dialogue-heading .eyebrow { margin: 0; color: #f5e7cb; font-size: .88rem; line-height: 1.4; font-weight: 900; letter-spacing: .02em; text-transform: none; }
#game-shell .dialogue-console.is-conversation-mode .dialogue-heading :is(.attempts, .dialogue-counter),
#game-shell .dialogue-console.is-conversation-mode .dialogue-heading strong:empty { display: none; }
#game-shell .dialogue-console.is-conversation-mode .mission-dialogue-close { top: 6px; right: 6px; }
@media (max-width: 700px) {
  #game-shell .dialogue-console.is-conversation-mode { grid-template-columns: 76px minmax(0, 1fr); height: min(350px, calc(100% - 16px)); gap: 12px; padding: 12px; }
  #game-shell .dialogue-console.is-conversation-mode .dialogue-portrait { width: 76px; height: 76px; }
}

/* The optional brewer is one fitted instrument, without inherited two-column
   conversation placement or a kettle/cup row wider than the machine screen. */
#game-shell #mission-dialogue-console.is-tea-mode { width: min(760px, calc(100% - 24px)); }
#game-shell #mission-dialogue-console.is-tea-mode .dialogue-content { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
#game-shell #mission-dialogue-console.is-tea-mode .dialogue-content > * { grid-column: 1; grid-row: auto; min-width: 0; margin: 0; }
#game-shell #mission-dialogue-console.is-tea-mode .dialogue-heading { display: flex; flex-wrap: wrap; gap: 5px 12px; justify-content: space-between; }
#game-shell #mission-dialogue-console.is-tea-mode #dialogue-line { font-size: .85rem; line-height: 1.4; }
#game-shell .is-tea-mode .tea-brew-board { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; padding: 10px; }
#game-shell .is-tea-mode .tea-machine { box-sizing: border-box; width: 100%; min-width: 0; padding: 8px 12px; }
#game-shell .is-tea-mode .tea-brew-readout { min-width: 0; gap: 8px; }
#game-shell .is-tea-mode .tea-brew-button { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 700px) {
  #game-shell .is-tea-mode .tea-machine { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 6px; }
  #game-shell .is-tea-mode .tea-kettle { justify-self: center; transform: scale(.72); margin: -9px -16px; }
  #game-shell .is-tea-mode .tea-cup { justify-self: center; width: 48px; height: 42px; }
  #game-shell .is-tea-mode .tea-pour-tube { display: none; }
  #game-shell .is-tea-mode .tea-timer { grid-column: 1 / -1; justify-self: center; margin: 0; }
  #game-shell .is-tea-mode .tea-brew-readout { grid-template-columns: 1fr 1fr; }
  #game-shell .is-tea-mode .tea-brew-gauge { grid-column: 1 / -1; }
  #game-shell .is-tea-mode .tea-process { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #game-shell .is-tea-mode .tea-brew-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Cover branding: angular charcoal stencil, safety-yellow enamel and a
   bolted teal edge, kept as a crisp vector at every HUD size. */
#game-shell .brand-lockup .brand-mark { display: none; }
#game-shell .brand-lockup .brand-name { position: relative; display: block; width: 148px; height: 47px; flex: 0 0 148px; }
#game-shell .brand-wordmark { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 2px 1px #0008); }
#game-shell .brand-name > span { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
@media (max-width: 700px) {
  #game-shell .brand-lockup .brand-name { width: 126px; height: 40px; flex-basis: 126px; }
}
@media (max-height: 480px) {
  #game-shell .brand-lockup .brand-name { width: 113px; height: 36px; flex-basis: 113px; }
}

/* One right-side flight-style key cluster for every walkable area. */
#game-shell :is(#workshop-explore, #mission-scene, #backyard-scene, #beach-scene) .mission-move-pad {
  --ground-key-width: 64px;
  --ground-key-height: 57px;
  position: absolute;
  top: auto; left: auto;
  right: max(18px, var(--safe-right));
  bottom: max(18px, var(--safe-bottom));
  display: grid;
  grid-template-columns: repeat(3, var(--ground-key-width));
  grid-template-rows: repeat(2, var(--ground-key-height));
  grid-template-areas: ". up interact" "left down right";
  gap: 5px;
  padding: 0;
  border: 0; border-image: none;
  background: none; box-shadow: none;
  transform: none;
}
#game-shell :is(#workshop-explore, #mission-scene, #backyard-scene, #beach-scene) .mission-move-pad :is(.mission-control, .mission-interact-button) {
  position: relative; inset: auto;
  width: var(--ground-key-width);
  height: var(--ground-key-height);
  min-width: 0; min-height: 0;
  border: 0; border-image: none;
  padding: 0; border-radius: 0;
  background: url("assets/flight-turn-key-v1.webp") center / contain no-repeat;
  box-shadow: none;
  backdrop-filter: none;
  color: #fff2d3;
  font-size: 1.35rem;
  text-shadow: 0 2px 3px #001218;
  transform: none;
  filter: drop-shadow(0 4px 0 #041218) drop-shadow(0 5px 5px #0009);
  transition: transform .08s ease-out, filter .08s ease-out;
}
#game-shell :is(#workshop-explore, #mission-scene, #backyard-scene, #beach-scene) .mission-move-pad .mission-up { background-image: url("assets/flight-thrust-key-v1.webp"); }
#game-shell :is(#workshop-explore, #mission-scene, #backyard-scene, #beach-scene) .mission-move-pad .mission-down { background-image: url("assets/flight-brake-key-v1.webp"); }
#game-shell :is(#workshop-explore, #mission-scene, #backyard-scene, #beach-scene) .mission-move-pad .mission-interact-button { grid-area: interact; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; font-size: .49rem; background-image: url("assets/flight-brake-key-v1.webp"); }
#game-shell :is(#workshop-explore, #mission-scene, #backyard-scene, #beach-scene) .mission-move-pad .mission-interact-button span { margin: 0; color: #ffe1a4; font-size: .8rem; }
#game-shell :is(#workshop-explore, #mission-scene, #backyard-scene, #beach-scene) .mission-move-pad :is(.mission-control, .mission-interact-button):is(:hover, :focus-visible) { transform: translateY(-1px); filter: brightness(1.12) drop-shadow(0 4px 0 #041218) drop-shadow(0 5px 5px #0009); }
#game-shell :is(#workshop-explore, #mission-scene, #backyard-scene, #beach-scene) .mission-move-pad :is(.mission-control, .mission-interact-button):is(:active, .is-active) { transform: translateY(3px); filter: brightness(.94) drop-shadow(0 1px 0 #041218) drop-shadow(0 2px 3px #0009); }
@media (max-width: 700px) {
  #game-shell :is(#workshop-explore, #mission-scene, #backyard-scene, #beach-scene) .mission-move-pad { --ground-key-width: 52px; --ground-key-height: 47px; right: max(12px, var(--safe-right)); bottom: max(12px, var(--safe-bottom)); }
}
@media (max-height: 480px) {
  #game-shell :is(#workshop-explore, #mission-scene, #backyard-scene, #beach-scene) .mission-move-pad { --ground-key-width: 46px; --ground-key-height: 41px; right: max(10px, var(--safe-right)); bottom: max(10px, var(--safe-bottom)); }
}
body.reduce-motion #game-shell .mission-move-pad :is(.mission-control, .mission-interact-button) { transition: none; }
@media (prefers-reduced-motion: reduce) { #game-shell .mission-move-pad :is(.mission-control, .mission-interact-button) { transition: none; } }
