:root {
  color-scheme: dark;
  font-family: ui-rounded, system-ui, sans-serif;
  background: #0d1423;
  color: #f4f6ff;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 0%, #1b2a41 0%, #0d1423 69%);
}

.game {
  width: min(100%, 1280px, max(460px, calc((100svh - 178px) * 16 / 9)));
  overflow: hidden;
  border: 1px solid #3a4b65;
  border-radius: 24px;
  background: #151f32;
  box-shadow: 0 24px 80px #04091388;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  padding: 10px 25px;
}

.title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mission-mark {
  width: 23px;
  height: 23px;
  border: 1px solid #85b6ee;
  border-radius: 50%;
  background: radial-gradient(circle at 62% 32%, #ffdcaa 0 2px, transparent 2.5px),
    linear-gradient(145deg, transparent 45%, #769ed0 46% 50%, #3e5e87 51%);
}

h1, .phase, .hint, .ending { margin: 0; }
h1 { font-size: clamp(16px, 2.4vw, 23px); letter-spacing: -0.035em; }

.phase {
  color: #b7c9e3;
  text-align: right;
  font-size: clamp(12px, 1.5vw, 15px);
  font-weight: 600;
}

.viewport {
  position: relative;
  aspect-ratio: 16 / 9;
  isolation: isolate;
  background: #212e4b;
}

canvas { display: block; width: 100%; height: 100%; }

.countdown, .ending {
  position: absolute;
  color: #fff6e2;
  line-height: 1;
  font-weight: 800;
  text-shadow: 0 3px 24px #17203ee6;
}

.countdown {
  top: 30%;
  left: 60%;
  font-size: clamp(56px, 11vw, 125px);
  font-variant-numeric: tabular-nums;
}

.ending {
  left: 0;
  right: 0;
  top: 16%;
  padding-inline: 12px;
  text-align: center;
  font-size: clamp(22px, 4.4vw, 53px);
  letter-spacing: -0.035em;
}

.altimeter {
  --altitude: 0;
  position: absolute;
  top: 9%;
  bottom: 9%;
  right: 2.2%;
  display: flex;
  gap: clamp(6px, 0.9vw, 11px);
  opacity: 0;
  transition: opacity 0.9s ease;
  pointer-events: none;
}

.altimeter.is-visible { opacity: 1; }

/* Band heights follow the ascent progress where each layer begins (see Mission.atmosphere). */
.altimeter-layers {
  display: grid;
  grid-template-rows: 34fr 20fr 46fr;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: right;
}

.altimeter-layers li {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  color: #e4ecfb9a;
  font-size: clamp(10px, 1.25vw, 15px);
  font-weight: 700;
  text-shadow: 0 1px 8px #0b1226;
  transition: color 0.6s ease, transform 0.6s ease;
}

.altimeter-layers li.is-current {
  color: #fff6e6;
  transform: scale(1.12);
  transform-origin: right center;
}

.altimeter-icon { font-size: 1.35em; line-height: 1; }

.altimeter-track {
  position: relative;
  width: clamp(5px, 0.6vw, 8px);
  border-radius: 999px;
  background: linear-gradient(to top, #ffd2b4 0 30%, #8eaee0 46% 66%, #2a3768 66%);
  box-shadow: 0 0 0 1px #0d16304d, 0 0 14px #0b122655;
}

.altimeter-marker {
  position: absolute;
  left: 50%;
  bottom: calc(var(--altitude) * 100%);
  width: clamp(14px, 1.9vw, 24px);
  transform: translate(-50%, 50%);
  filter: drop-shadow(0 0 6px #ffd9a0);
}

.orbit-call {
  position: absolute;
  top: 6%;
  left: 5%;
  margin: 0;
  color: #f4e4cf;
  font-size: clamp(12px, 2vw, 22px);
  font-weight: 600;
  text-shadow: 0 2px 16px #111830;
}

.hint, .destinations, .destination {
  display: flex;
  align-items: center;
  justify-content: center;
}

.destinations {
  position: absolute;
  gap: 10px;
  left: 0;
  right: 0;
  bottom: 5%;
}

.destination {
  gap: 8px;
  min-width: clamp(84px, 12vw, 140px);
  padding: 8px 14px;
  border: 1px solid #8096b979;
  border-radius: 999px;
  background: #111b32de;
  color: #d4def2;
  font-size: clamp(13px, 2vw, 21px);
  font-weight: 700;
}

.destination[aria-current="true"] {
  background: #263a59;
  border-color: #badcff;
  color: #fff;
  box-shadow: 0 0 16px #92b4ee48;
}

.planet {
  width: clamp(13px, 2vw, 23px);
  height: clamp(13px, 2vw, 23px);
  border-radius: 50%;
}

.planet-moon {
  background: radial-gradient(circle at 37% 65%, #a8adb8 0 17%, transparent 18%),
    radial-gradient(circle at 64% 35%, #bbc1ce 0 15%, transparent 16%),
    radial-gradient(circle at 34% 26%, #fbf9ef, #b9bbca 64%, #6c7894);
}

.planet-mars {
  background: radial-gradient(circle at 35% 21%, #ffce93, #c97b5f 60%, #87475a);
}

.hint {
  flex-wrap: wrap;
  column-gap: 9px;
  row-gap: 5px;
  min-height: 64px;
  padding: 11px 14px;
  text-align: center;
  color: #e0eafd;
  font-size: clamp(14px, 2vw, 19px);
  font-weight: 600;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  min-height: 29px;
  padding: 2px 8px;
  border: 1px solid #768eae;
  border-bottom-width: 2px;
  border-radius: 7px;
  background: #273854;
  font: inherit;
  font-size: 0.9em;
  color: #f8fbff;
}

@media (max-width: 600px) {
  body { padding: 10px; }
  .game { border-radius: 16px; }
  .game-header { min-height: 50px; padding: 8px 12px; }
  .title-group { gap: 7px; }
  .mission-mark { width: 17px; height: 17px; }
  .destination { padding: 5px 10px; }
}

@media (min-width: 601px) and (max-height: 440px) {
  body { padding: 8px; }
  .game { width: min(100%, calc((100svh - 110px) * 16 / 9)); }
  .game-header { min-height: 44px; padding: 6px 14px; }
  .hint { min-height: 46px; padding: 5px 10px; }
  .countdown { font-size: 70px; }
  .ending { font-size: 30px; }
}
