:root {
  color-scheme: dark;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  background: #091624;
  color: #edf7fa;
  --ice: #a6f1fa;
  --line: #96d0dd50;
  --surface: #0c1f30ee;
  --key: #16394c;
}
* { box-sizing: border-box; }
body { margin: 0; }
#flight {
  position: relative;
  height: 100vh;
  height: 100dvh;
  min-height: 340px;
  overflow: hidden;
  isolation: isolate;
  background: #34455a;
}
#world, #cockpit { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
#world { touch-action: none; cursor: crosshair; }
#world:active { cursor: grabbing; }
#world:focus { outline: none; }
#cockpit { display: none; pointer-events: none; }
.cockpit-view #cockpit { display: block; }
header, .telemetry, .heading, .map, footer, .touch-controls, .reticle { position: absolute; z-index: 1; }
header, .telemetry, .heading, .map, footer p, button {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 3px 14px #09162424;
}
header { top: 20px; left: 24px; z-index: 3; display: flex; align-items: center; }
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  padding: 9px 12px;
  font-size: .86rem;
  font-weight: 800;
  letter-spacing: .07em;
}
h1 {
  font-size: .85rem;
  font-weight: 500;
  color: var(--ice);
  margin: 0;
  padding: 9px 12px;
  border-left: 1px solid var(--line);
}
.telemetry { top: 20px; right: 24px; display: flex; }
.telemetry div { padding: 7px 12px; }
.telemetry div+div { border-left: 1px solid var(--line); }
.telemetry span, .telemetry output { display: block; white-space: nowrap; }
.telemetry span { font-size: .69rem; color: #c0d4da; margin-bottom: 3px; }
.telemetry output { font-size: .87rem; color: var(--ice); min-width: 6ch; }
.low #clearance, .high #alt { color: #ffdb82; }
.heading {
  left: 50%;
  top: 20px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  color: var(--ice);
  font-size: .82rem;
  pointer-events: none;
}
.heading span {
  width: 29px;
  height: 7px;
  background: repeating-linear-gradient(90deg,currentColor 0 1px,transparent 1px 6px);
  opacity: .55;
}
.reticle {
  top: 43%;
  left: 50%;
  width: 34px;
  height: 22px;
  transform: translate(-50%,-50%);
  color: #dcfbfc;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px #143f57);
}
.reticle::before, .reticle::after { content: ""; width: 7px; height: 10px; position: absolute; top: 5px; }
.reticle::before { left: 0; border: 1px solid; border-right: 0; }
.reticle::after { right: 0; border: 1px solid; border-left: 0; }
.overhead .reticle, .cockpit-view .reticle, .cockpit-view .heading, .cockpit-view .map { display: none; }
.cockpit-view .telemetry { clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
.map { right: 24px; bottom: 76px; padding: 8px; font-size: .69rem; }
.map canvas { display: block; width: 112px; height: 112px; margin: 0 auto 8px; image-rendering: pixelated; }
.map div+div { margin-top: 4px; }
.map i { display: inline-block; width: 7px; height: 7px; margin-right: 4px; }
.covered { background: #527a9d; }
.exposed { background: #263c51; }
.base { background: #7dddda; }
.intro {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: clamp(22px,7vw,112px);
  background: linear-gradient(90deg,#081829f5 0%,#0b2035b8 35%,#173a5370 52%,transparent 76%);
  z-index: 2;
  pointer-events: none;
}
.intro[hidden] { display: none; }
.intro-body { width: min(100%,420px); text-shadow: 0 2px #09192788; }
.eyebrow { font-size: .79rem; font-weight: 700; letter-spacing: .13em; color: var(--ice); margin: 0 0 14px; }
h2 {
  font-family: system-ui, sans-serif;
  margin: 0;
  font-size: clamp(3rem,7.2vw,6.25rem);
  font-weight: 820;
  line-height: .89;
  letter-spacing: -.075em;
}
h2 span { color: var(--ice); }
.intro-body>p:not(.eyebrow) { margin: 18px 0 22px; line-height: 1.55; max-width: 34ch; }
.started .intro h2 { font-size: clamp(2.65rem,5.9vw,5rem); }
button { font: inherit; color: inherit; font-size: .86rem; min-height: 40px; border-radius: 0; padding: 9px 12px; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }
@media(hover:hover) { button:hover:not(:disabled) { border-color: var(--ice); } }
#launch { pointer-events: auto; background: var(--ice); color: #102737; font-weight: 800; padding: 12px 18px; box-shadow: 3px 3px #285970; }
footer {
  z-index: 3;
  bottom: 18px;
  left: 24px;
  right: 24px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}
footer p { margin: 0; padding: 5px 8px; font-size: .77rem; line-height: 1.65; }
footer .desktop { min-width: 0; max-width: min(58vw, 92ch); }
.control { white-space: nowrap; display: inline-block; margin-right: 3px; }
kbd { font: inherit; color: var(--ice); background: var(--key); padding: 1px 3px; }
.actions { display: flex; gap: 7px; pointer-events: auto; flex-shrink: 0; }
.views { display: flex; }
.views button {
  position: relative;
  padding-inline: 9px;
  color: #d7e5ed;
}
.views button+button { margin-left: -1px; }
.views button:focus-visible { z-index: 2; }
.views button kbd { font-size: .78em; padding-inline: 4px; }
.views button[aria-pressed="true"] {
  z-index: 1;
  color: var(--ice);
  border-color: #6ab6c3;
  background: #163447f2;
  box-shadow: inset 0 -2px var(--ice);
}
.touch-controls { display: none; }
@media(pointer:fine) {
  .cockpit-view footer .desktop { max-width: min(35vw, 46ch); }
}
@media(pointer:coarse) {
  #flight { min-height: 0; }
  .desktop, .views kbd { display: none; }
  .touch-controls {
    z-index: 3;
    pointer-events: none;
    position: absolute;
    left: max(15px, env(safe-area-inset-left));
    right: max(15px, env(safe-area-inset-right));
    bottom: calc(69px + env(safe-area-inset-bottom));
    display: none;
    justify-content: space-between;
    align-items: end;
    user-select: none;
    -webkit-touch-callout: none;
  }
  #flight.flying .touch-controls { display: flex; }
  .stick-control {
    display: grid;
    gap: 6px;
    justify-items: center;
  }
  #stick {
    position: relative;
    width: clamp(104px, 30vw, 128px);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    pointer-events: auto;
    touch-action: none;
    border: 1px solid #9cdbed82;
    border-radius: 50%;
    background: radial-gradient(circle, #28556b98 0 35%, #15374bba 68%, #0b2338ea 70%);
    box-shadow: inset 0 0 0 4px #0c213d61, 0 4px 14px #091f3380;
  }
  #stick span { position: absolute; pointer-events: none; }
  .stick-track {
    inset: 15%;
    border-radius: 50%;
    border: 1px solid #b5e0ed46;
    background:
      linear-gradient(#b8e6f94f,#b8e6f94f) center / 1px 100% no-repeat,
      linear-gradient(#b8e6f94f,#b8e6f94f) center / 100% 1px no-repeat;
  }
  .stick-marks {
    inset: 6%;
    background:
      linear-gradient(var(--ice),var(--ice)) center top / 9px 2px no-repeat,
      linear-gradient(var(--ice),var(--ice)) center bottom / 9px 2px no-repeat,
      linear-gradient(var(--ice),var(--ice)) left center / 2px 9px no-repeat,
      linear-gradient(var(--ice),var(--ice)) right center / 2px 9px no-repeat;
    opacity: .70;
  }
  .stick-knob {
    left: 50%;
    top: 50%;
    width: 34%;
    aspect-ratio: 1;
    border-radius: 50%;
    transform: translate(-50%,-50%) translate(var(--stick-x, 0px),var(--stick-y, 0px));
    border: 1px solid #c7f2f8a5;
    background: radial-gradient(circle at 38% 31%, #85becd 4%, #467189 49%, #264558 75%);
    box-shadow: 0 2px 6px #08192ad1, inset 0 0 0 4px #d7f5ff12;
    transition: transform .14s ease-out;
  }
  #stick[data-held] { border-color: var(--ice); }
  #stick[data-held] .stick-knob { transition: none; background: radial-gradient(circle at 38% 31%, #c2f4f8 1%, #58adbb 44%, #2b5c73 78%); }
  #stick-help {
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 3px 6px;
    font-size: .70rem;
    text-align: center;
  }
  #touch-boost {
    align-self: end;
    margin-bottom: 17px;
    pointer-events: auto;
    touch-action: none;
    width: clamp(63px, 18vw, 76px);
    aspect-ratio: 1;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 5px;
    padding: 0;
    border-color: #f7ce8fa2;
    border-radius: 50%;
    color: #ffe7ba;
    background: radial-gradient(circle, #583d34eb, #2c2a38ee 70%);
    box-shadow: inset 0 0 0 4px #b0764b50, 0 4px 14px #091f3380;
  }
  .boost-mark {
    width: 20px;
    height: 16px;
    background: currentColor;
    clip-path: polygon(50% 0,100% 41%,100% 66%,50% 26%,0 66%,0 41%,0 76%,50% 36%,100% 76%,100% 100%,50% 60%,0 100%);
  }
  #touch-boost[data-held] { color: #302320; background: #ffd58c; border-color: #fff2c8; }
  .actions { margin-inline: auto; gap: 6px; }
  .actions button { min-height: 44px; padding: 6px 9px; }
}
@media(max-width:900px) {
  .heading { top: 72px; }
}
@media(max-width:760px) {
  header { left: 12px; top: 12px; }
  .telemetry { right: 12px; top: 12px; }
  .telemetry div { padding: 6px 8px; }
  .telemetry output { min-width: 0; }
  .heading { top: 60px; }
  .map { right: 12px; bottom: 70px; }
  .map canvas { width: 80px; height: 80px; }
  footer { left: 12px; right: 12px; bottom: 12px; }
  footer p { font-size: .72rem; }
}
@media(max-width:610px) {
  .telemetry div:first-child { display: none; }
}
@media(max-width:550px) {
  .map { top: 94px; bottom: auto; }
  .map canvas { width: 62px; height: 62px; }
  .intro { background: linear-gradient(90deg,#091829eb,#102c41aa 66%,transparent); }
}
@media(max-width:430px) {
  .brand { font-size: .68rem; gap: 4px; padding: 8px; }
  .brand img { width: 18px; height: 18px; }
  h1 { font-size: .72rem; padding: 8px; }
  .telemetry div { padding: 6px; }
  .telemetry span { font-size: .60rem; }
  .telemetry output, button { font-size: .75rem; }
}
@media(max-width:350px) {
  .telemetry div:nth-child(2) { display: none; }
}
@media(max-height:500px) {
  .heading, .map { display: none; }
  .intro-body>p:not(.eyebrow) { margin: 9px 0 13px; }
  .intro .eyebrow { margin-bottom: 8px; }
  .intro h2 { font-size: 2.85rem; }
}

@media(pointer:coarse) {
  header { top: max(12px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); }
  .telemetry { top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); }
  .map { right: max(12px, env(safe-area-inset-right)); top: calc(82px + env(safe-area-inset-top)); bottom: auto; }
  footer {
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    bottom: calc(12px + env(safe-area-inset-bottom));
  }
  @media(orientation:landscape) and (max-height:500px) {
    .touch-controls { bottom: calc(13px + env(safe-area-inset-bottom)); }
    #stick { width: clamp(86px, 23vh, 106px); }
    #stick-help { display: none; }
    #touch-boost { margin-bottom: 2px; }
    .actions button { padding-inline: 8px; }
  }
}
@media(prefers-reduced-motion:reduce) {
  .stick-knob { transition: none; }
}

/* The survey interface borrows its pearl, brass and cyan accents from the
   ship in the skyport scene. The world stays the focus while flying. */
:root { --ice:#a8f2ee; --line:#b9e8e044; --surface:#102a38c9; --key:#25505b; }
#world, #cockpit { image-rendering:auto; }
header, .telemetry, .heading, .map, footer p, button {
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 28px #07192738, inset 0 1px #ffffff14;
}
header { border-radius: 12px; overflow:hidden; }
.brand { letter-spacing:.12em; padding:12px 15px; }
h1 { color:#d3f4ed; padding:12px 15px; }
.telemetry { border-radius:12px; overflow:hidden; }
.telemetry div { padding:10px 15px; }
.telemetry span { color:#b4d0ce; letter-spacing:.09em; }
.telemetry output { color:#f1fffb; font-weight:700; }
.heading { border-radius:100px; padding:8px 14px; }
.map { border-radius:12px; padding:12px; color:#d6e9e6; }
.map canvas { image-rendering:auto; border-radius:5px; }
.map i { border-radius:50%; }
.intro { background:linear-gradient(90deg,#0b2130f5 0%,#102e3bcc 31%,#17415278 54%,transparent 82%); }
.intro-body { width:min(100%,480px); text-shadow:0 2px 18px #071e29a8; }
.eyebrow { color:#b2e7da; letter-spacing:.2em; }
h2 { color:#fffaf0; font-weight:750; letter-spacing:-.065em; line-height:.95; }
h2 span { color:#e0ad69; }
.intro-body>p:not(.eyebrow) { color:#deedeb; font-family:system-ui,sans-serif; font-size:1.05rem; max-width:34ch; }
button { border-radius:8px; }
#launch { background:#f2d3a2; color:#1a3138; box-shadow:0 8px 28px #07192760, inset 0 1px #fff8; padding:14px 22px; }
footer p { border-radius:9px; }
kbd { border-radius:4px; }
.views button:first-child { border-radius:8px 0 0 8px; }
.views button:last-child { border-radius:0 8px 8px 0; }
.views button[aria-pressed="true"] { background:#24505aed; box-shadow:inset 0 -2px #a8f2ee; }
@media(max-width:760px) {
  .brand, h1 { padding:9px 10px; }
  .telemetry div { padding:7px 9px; }
  .map { padding:8px; }
}

/* In cockpit view the touch surface sits over the illustrated trackball.
   Its center marker moves with the thumb, keeping the globe visible beneath. */
@media(pointer:coarse) {
  .cockpit-view #stick {
    background: transparent;
    border-color: #b9efea5c;
    box-shadow: inset 0 0 0 1px #d9f9ed1c, 0 2px 12px #081c2870;
  }
  .cockpit-view #stick .stick-track { border-color:#bce8e344; background: none; }
  .cockpit-view #stick .stick-marks { opacity:.5; }
  .cockpit-view #stick .stick-knob {
    width:19%; background:#d5fff52b; border:1px solid #d7fff3c9;
    box-shadow:0 0 10px #a8f3e280;
  }
  .cockpit-view #stick[data-held] .stick-knob { background:#d5fff54d; }
}
