:root {
  color-scheme: dark;
  font:
    16px system-ui,
    sans-serif;
  color: #bfeee4;
  background: #03090c;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  overflow: hidden;
}
[hidden] {
  display: none !important;
}
#game {
  position: fixed;
  inset: 0;
}
/* Fit 4:3–16:9: retain tablet height without revealing the cockpit's open sides. */
#viewport {
  position: absolute;
  width: min(100vw, 177.777778dvh);
  height: min(100dvh, 75vw);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  overflow: hidden;
}
#viewport canvas {
  outline: none;
}
button,
select {
  font: inherit;
  color: inherit;
  border: 1px solid #86ead640;
  border-radius: 5px;
  background: #08181e;
  padding: 0.65rem 1rem;
}
button {
  cursor: pointer;
}
button:hover,
button:focus-visible,
select:focus-visible,
input:focus-visible {
  border-color: #86ead6;
  outline: 2px solid #86ead680;
  outline-offset: 2px;
}
button:disabled {
  opacity: 0.45;
  cursor: wait;
}
.primary {
  border-color: #86ead6;
  background: #16443e;
}
#game > nav {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
}
kbd {
  font: inherit;
  opacity: 0.55;
  margin-left: 0.5rem;
}
#flight-feedback {
  position: absolute;
  left: 50%;
  top: 1rem;
  transform: translateX(-50%);
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  background: #061116c9;
  border-radius: 5px;
  pointer-events: none;
}
#flight-feedback:empty {
  display: none;
}
.scene-panel {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #02080be8;
  backdrop-filter: blur(8px);
  overflow: auto;
  padding: clamp(1rem, 4vw, 3rem);
}
.entry-card {
  text-align: center;
  width: min(30rem, 100%);
  padding: 2rem;
}
.entry-card button {
  display: block;
  width: 100%;
  margin-top: 0.8rem;
}
.eyebrow {
  letter-spacing: 0.3em;
  color: #86ead6;
  font-size: 0.75rem;
}
h1 {
  font-weight: 400;
  font-size: clamp(2rem, 6vw, 3.5rem);
  margin: 0.5rem 0 1rem;
}
h2 {
  font-size: 1.2rem;
  font-weight: 400;
  margin-top: 2rem;
}
.muted,
#loading {
  color: #92aaa8;
  line-height: 1.6;
  font-size: 0.9rem;
}
.settings-card {
  width: min(56rem, 100%);
  margin: auto;
}
.settings-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.preferences {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem 2rem;
  padding: 1.5rem 0;
  border-block: 1px solid #86ead626;
}
.preferences label {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.preferences .check {
  flex-direction: row;
  align-items: center;
}
input {
  accent-color: #86ead6;
}
.range-line {
  display: flex;
  gap: 1rem;
  align-items: center;
}
.range-line input {
  width: 100%;
}
output {
  min-width: 3rem;
}
#bindings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 2rem;
}
.binding-row {
  display: grid;
  grid-template-columns: 1fr minmax(6rem, 1fr) 2rem;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid #86ead61c;
  font-size: 0.85rem;
}
.binding-row button {
  padding: 0.5rem 0.3rem;
  overflow-wrap: anywhere;
  min-width: 0;
}
.settings-card footer {
  position: sticky;
  bottom: -1rem;
  padding: 1rem 0;
  background: #030d12fa;
  border-top: 1px solid #86ead640;
}
.settings-card footer [role='status'] {
  min-height: 1.5rem;
  font-size: 0.9rem;
  color: #86ead6;
}
.settings-card footer > div {
  display: flex;
  justify-content: flex-end;
  gap: 0.7rem;
}
#touch-controls {
  position: fixed;
  inset: auto 0 0;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
#touch-controls > * {
  pointer-events: auto;
}
.rocket-input-activation {
  display: none;
}
@media (max-width: 650px) {
  #game > nav {
    top: 0.5rem;
    right: 0.5rem;
  }
  #flight-feedback {
    top: auto;
    bottom: 1rem;
    width: max-content;
    max-width: 94vw;
  }
  #bindings,
  .preferences {
    grid-template-columns: 1fr;
  }
  .settings-card header {
    align-items: start;
  }
  .settings-card header button {
    font-size: 0.8rem;
  }
  #touch-controls {
    --virtual-button-size: 36px;
  }
}
/* Keep the first controls visible on laptop-height viewports. */
.settings-card h1 {
  font-size: 2.5rem;
  margin: 0.35rem 0 0.5rem;
}
.settings-card h2 {
  margin-top: 1rem;
}
.settings-card .preferences {
  gap: 1rem 2rem;
  padding: 1rem 0;
}
.settings-card footer {
  padding: 0.65rem 0;
}
.settings-card footer [role='status'] {
  margin: 0.25rem 0 0.5rem;
  min-height: 1.25rem;
}

#settings-scene .settings-card {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.settings-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 0.5rem 0.8rem 0;
  scrollbar-gutter: stable;
}
.settings-card header,
.settings-card footer {
  flex-shrink: 0;
}
.settings-card footer {
  position: static;
}
.settings-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0 1rem;
  flex-shrink: 0;
}
.settings-tabs [aria-selected='true'] {
  background: #16443e;
  border-color: #86ead6;
}
#render-resolution {
  color: #86ead6;
  line-height: 1.6;
}

/* Original supplied title art; controls remain real HTML. */
#entry {
  background:
    linear-gradient(0deg, #02080bf2, #02080b30 65%),
    url('./assets/farwake-wastebound-v3-uppercase.png') center / cover no-repeat;
  backdrop-filter: none;
}
#entry .entry-card {
  position: absolute;
  left: clamp(1rem, 5vw, 6rem);
  bottom: clamp(1rem, 6vh, 5rem);
  width: min(24rem, calc(100% - 2rem));
  padding: 1rem;
  text-align: left;
  background: #02080b99;
  border-radius: 8px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
@media (max-aspect-ratio: 1/1) {
  #entry {
    background: #02080b url('./assets/farwake-wastebound-v3-uppercase.png')
      center top / 100% auto no-repeat;
  }
}

/* Game-specific layout: engine controllers stay independently customizable. */
#touch-controls .rocket-virtual-controls {
  --virtual-size: 104px;
  --virtual-button-size: 48px;
}
@media (pointer: coarse) {
  #touch-controls {
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom)
      env(safe-area-inset-left);
  }
  #touch-controls .rocket-virtual-controls {
    --virtual-size: clamp(112px, 22vw, 160px);
    --virtual-button-size: 56px;
  }
  #touch-controls .rocket-virtual-corner .rocket-virtual-buttons button {
    font-size: 12px;
  }
  #game > nav button {
    min-height: 48px;
  }
}
@media (pointer: coarse) and (max-width: 480px) {
  #touch-controls .rocket-virtual-controls {
    --virtual-size: clamp(96px, 27vw, 128px);
    --virtual-button-size: 48px;
  }
  #touch-controls .rocket-virtual-corner {
    gap: 4px;
    padding-inline: 0;
  }
}

#game:fullscreen {
  background: #03090c;
}
#screen-status {
  position: absolute;
  top: 4.5rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(32rem, 90vw);
  margin: 0;
  padding: 0.5rem 0.8rem;
  border-radius: 5px;
  background: #061116e8;
  font-size: 0.8rem;
  text-align: center;
  pointer-events: none;
}
#screen-status:empty,
#rotate-hint {
  display: none;
}
@media (pointer: coarse) and (orientation: portrait) {
  #rotate-hint {
    display: block;
    position: absolute;
    top: 22%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: max-content;
    max-width: 90vw;
    padding: 1rem;
    border: 1px solid #86ead640;
    border-radius: 8px;
    background: #061116ed;
    text-align: center;
    pointer-events: none;
  }
}

#fps-counter {
  position: absolute;
  top: max(0.75rem, env(safe-area-inset-top));
  left: max(0.75rem, env(safe-area-inset-left));
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  background: #03090ccc;
  color: #bfeee4;
  font:
    14px ui-monospace,
    monospace;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.fps-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
}

/* Inspection rooms use the same supported viewport range, with separate game UI. */
#interior-scene {
  position: absolute;
  inset: 0;
  background: #03090c;
}
#interior-viewport {
  position: absolute;
  width: min(100vw, 177.777778dvh);
  height: min(100dvh, 75vw);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  overflow: hidden;
}
#interior-viewport canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.interior-header {
  position: absolute;
  inset: max(1rem, env(safe-area-inset-top))
    max(1rem, env(safe-area-inset-right)) auto
    max(1rem, env(safe-area-inset-left));
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}
.interior-header h1 {
  margin: 0;
  padding: 0.5rem 0.8rem;
  font-size: clamp(1rem, 2vw, 1.5rem);
  background: #061116ce;
  border-radius: 5px;
}
#interior-choices {
  position: absolute;
  left: max(1rem, env(safe-area-inset-left));
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.4rem;
  background: #03090cbf;
  border-radius: 6px;
  scrollbar-width: thin;
}
#interior-choices button {
  flex: 0 0 auto;
  min-height: 44px;
}
#interior-choices button[aria-current='page'] {
  background: #16443e;
  border-color: #86ead6;
}
