:root {
  color-scheme: dark;
  --black: #000;
  --cyan: #59ffe1;
  --cyan-dim: #1c9f91;
  --amber: #ffd36a;
  --muted: #83aaa5;
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--black);
}

body {
  min-width: 320px;
  min-height: 440px;
}

button,
kbd {
  font: inherit;
}

#game {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  isolation: isolate;
  background: #000;
  color: var(--cyan);
  user-select: none;
}

#view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

#hud {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  font-size: clamp(0.78rem, 1.15vw, 1rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-shadow: 0 0 10px rgba(69, 255, 218, 0.45);
  transition: opacity 600ms ease;
}

#hud.cinematic {
  opacity: 0.18;
}

#hud.intro {
  opacity: 0;
}

#hud.cinematic #mission-hud,
#hud.cinematic #locator-bar,
#hud.cinematic #reticle,
#hud.cinematic #status-line {
  opacity: 0;
}

#locator-bar {
  position: absolute;
  top: clamp(18px, 3vw, 34px);
  left: 50%;
  width: min(380px, 42vw);
  min-width: 240px;
  transform: translateX(-50%);
  color: var(--cyan);
  text-align: center;
  transition: opacity 240ms ease;
}

#locator-bar.inactive {
  opacity: 0.38;
}

.locator-copy {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.7em;
  min-height: 18px;
  margin-bottom: 5px;
  white-space: nowrap;
}

.locator-copy span,
.locator-copy small {
  color: var(--cyan-dim);
  font-size: 0.62em;
}

.locator-copy strong {
  overflow: hidden;
  max-width: 18ch;
  color: #d7fff7;
  font-size: 0.72em;
  text-overflow: ellipsis;
}

.locator-track {
  position: relative;
  height: 8px;
  border: 1px solid rgba(89, 255, 225, 0.28);
  background:
    repeating-linear-gradient(
      90deg,
      rgba(89, 255, 225, 0.2) 0 1px,
      transparent 1px 25%
    ),
    rgba(0, 13, 12, 0.72);
  box-shadow: 0 0 14px rgba(0, 255, 210, 0.08);
}

.locator-center {
  position: absolute;
  top: -3px;
  bottom: -3px;
  left: 50%;
  width: 1px;
  background: rgba(215, 255, 247, 0.8);
}

#locator-marker {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  color: var(--amber);
  transition: left 120ms ease-out, color 180ms ease, filter 180ms ease;
}

#locator-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 11px;
  height: 11px;
  transform: translate(-50%, -50%) rotate(45deg);
  border: 1px solid rgba(255, 255, 255, 0.88);
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
  transition: width 160ms ease, height 160ms ease;
}

#locator-elevation,
#locator-direction {
  position: absolute;
  color: currentColor;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 0 7px currentColor;
}

#locator-elevation {
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  font-size: 0.62rem;
}

#locator-elevation.below {
  top: 8px;
  bottom: auto;
}

#locator-direction {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.72rem;
}

.hud-block {
  position: absolute;
  top: clamp(18px, 3vw, 34px);
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid rgba(89, 255, 225, 0.65);
  color: var(--cyan);
  background: linear-gradient(180deg, rgba(0, 28, 25, 0.52), transparent);
}

.hud-left {
  left: clamp(14px, 3vw, 38px);
}

.hud-right {
  right: clamp(14px, 3vw, 38px);
  text-align: right;
}

.hud-block div {
  display: grid;
  grid-template-columns: auto 4ch auto;
  align-items: baseline;
  gap: 0.75em;
}

.hud-right div {
  grid-template-columns: auto 5ch;
}

.hud-block span,
.hud-block small {
  color: var(--cyan-dim);
  font-size: 0.72em;
}

.hud-block strong {
  color: #c9fff5;
  font-weight: 700;
}

#reticle {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  gap: 7px;
  transform: translate(-50%, -50%);
  color: var(--cyan);
}

#reticle i {
  width: 10px;
  height: 1px;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

#reticle b {
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
}

#status-line {
  position: absolute;
  left: 50%;
  bottom: clamp(16px, 3vw, 32px);
  transform: translateX(-50%);
  color: rgba(89, 255, 225, 0.82);
  font-size: 0.72em;
  white-space: nowrap;
}

#mission-hud {
  top: auto;
  right: auto;
  bottom: clamp(46px, 6vw, 66px);
  left: clamp(14px, 3vw, 38px);
  width: min(310px, calc(100vw - 28px));
  gap: 5px;
  border-top-color: rgba(255, 211, 106, 0.65);
  background: linear-gradient(180deg, rgba(30, 21, 8, 0.88), rgba(7, 12, 11, 0.78));
  text-align: left;
}

#mission-hud > span,
#mission-hud > small {
  color: #9d8150;
  font-size: 0.7em;
}

#mission-hud > strong {
  color: #ffe1a0;
  font-size: 0.88em;
}

#restoration-status {
  display: flex;
  grid-template-columns: none;
  gap: 12px;
  margin-top: 4px;
  color: #806f59;
  font-size: 0.68em;
}

#restoration-status b {
  font-weight: 600;
}

#restoration-status b.complete {
  color: var(--cyan);
}

#restoration-banner {
  position: absolute;
  top: clamp(18px, 4vh, 42px);
  left: 50%;
  z-index: 5;
  width: min(520px, calc(100vw - 40px));
  transform: translateX(-50%);
  padding: 14px 18px;
  border: 1px solid rgba(89, 255, 225, 0.36);
  background: rgba(0, 10, 10, 0.76);
  text-align: center;
  letter-spacing: 0.12em;
  box-shadow: 0 0 28px rgba(0, 255, 210, 0.1);
}

#restoration-banner > span {
  display: block;
  color: var(--cyan-dim);
  font-size: 0.68rem;
}

#restoration-banner > strong {
  display: block;
  margin-top: 6px;
  color: #d7fff7;
  font-size: clamp(0.9rem, 2vw, 1.15rem);
}

.restoration-progress {
  height: 4px;
  margin: 11px 0 6px;
  overflow: hidden;
  background: rgba(89, 255, 225, 0.12);
}

.restoration-progress i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
}

#restoration-percent {
  color: var(--cyan);
  font-size: 0.72rem;
}

#intro-overlay {
  position: absolute;
  bottom: clamp(34px, 7vh, 78px);
  left: clamp(28px, 6vw, 112px);
  z-index: 5;
  width: min(680px, calc(100vw - 56px));
  padding: 20px 24px;
  border-left: 2px solid rgba(255, 211, 106, 0.8);
  background: rgba(8, 12, 11, 0.84);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.34);
  color: #f3e7cf;
  text-shadow: 0 2px 4px #000, 0 0 14px rgba(0, 0, 0, 0.96);
  transition: opacity 500ms ease, transform 700ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

#intro-overlay.fading {
  opacity: 0;
  transform: translateY(12px);
}

.intro-heading {
  display: flex;
  align-items: baseline;
  gap: 16px;
}

#intro-index {
  color: #ffd18a;
  font-size: clamp(0.82rem, 0.82vw, 0.95rem);
  font-weight: 800;
  letter-spacing: 0.16em;
}

#intro-title {
  color: #fff5df;
  font-family: "Microsoft YaHei UI", "PingFang SC", sans-serif;
  font-size: clamp(1.65rem, 2.2vw, 2.4rem);
  font-weight: 800;
  letter-spacing: 0.1em;
}

#intro-copy {
  margin: 11px 0 18px;
  color: #fff3dc;
  font-family: "Microsoft YaHei UI", "PingFang SC", sans-serif;
  font-size: clamp(1rem, 1.15vw, 1.25rem);
  font-weight: 600;
  line-height: 1.55;
  letter-spacing: 0.04em;
}

.intro-progress {
  width: min(420px, 72vw);
  height: 3px;
  overflow: hidden;
  background: rgba(230, 192, 137, 0.2);
}

.intro-progress i {
  display: block;
  width: 0;
  height: 100%;
  background: #ffd36a;
  box-shadow: 0 0 12px rgba(255, 190, 93, 0.72);
}

#intro-skip {
  display: block;
  margin-top: 12px;
  color: rgba(255, 211, 106, 0.82);
  font-size: clamp(0.76rem, 0.75vw, 0.86rem);
  font-weight: 700;
  letter-spacing: 0.12em;
}

.screen-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  width: min(420px, calc(100vw - 36px));
  transform: translate(-50%, -50%);
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid rgba(89, 255, 225, 0.62);
  background: rgba(0, 8, 8, 0.86);
  box-shadow:
    0 0 0 1px rgba(89, 255, 225, 0.08) inset,
    0 0 42px rgba(0, 255, 210, 0.11);
  text-align: center;
}

.screen-panel::before,
.screen-panel::after {
  content: "";
  position: absolute;
  width: 30px;
  height: 8px;
  border-top: 2px solid var(--cyan);
}

.screen-panel::before {
  top: -2px;
  left: -1px;
  border-left: 2px solid var(--cyan);
}

.screen-panel::after {
  right: -1px;
  bottom: -2px;
  border-right: 2px solid var(--cyan);
  border-top: 0;
  border-bottom: 2px solid var(--cyan);
}

.panel-kicker {
  color: var(--cyan-dim);
  font-size: 0.72rem;
  letter-spacing: 0.24em;
}

h1,
h2 {
  margin: 12px 0 26px;
  color: #e9fffb;
  font-size: clamp(2.5rem, 10vw, 4.8rem);
  line-height: 0.9;
  letter-spacing: -0.09em;
  text-shadow: 0 0 22px rgba(89, 255, 225, 0.36);
}

.complete-title {
  color: var(--cyan);
  font-size: clamp(2.2rem, 8vw, 4rem);
  line-height: 0.95;
  text-shadow: 0 0 24px rgba(89, 255, 225, 0.42);
}

h1 em {
  color: var(--cyan);
  font-style: normal;
}

h2 {
  margin-bottom: 14px;
  color: #ff665f;
  text-shadow: 0 0 22px rgba(255, 72, 72, 0.42);
}

.controls {
  display: grid;
  gap: 10px;
  margin: 0 auto 28px;
  text-align: left;
}

.controls div {
  display: grid;
  grid-template-columns: 34px 34px 1fr;
  align-items: center;
  gap: 6px;
}

.controls .single-control {
  grid-template-columns: 74px 1fr;
}

.controls span {
  padding-left: 8px;
  color: var(--muted);
  font-size: 0.83rem;
  letter-spacing: 0.15em;
}

kbd {
  min-width: 32px;
  padding: 6px 8px;
  border: 1px solid rgba(89, 255, 225, 0.38);
  border-bottom-color: rgba(89, 255, 225, 0.72);
  color: #d8fff8;
  background: rgba(28, 159, 145, 0.12);
  text-align: center;
  font-size: 0.8rem;
}

.screen-panel button {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--cyan);
  border-radius: 0;
  color: #001a16;
  background: var(--cyan);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: background 120ms ease, box-shadow 120ms ease;
}

.screen-panel button:hover,
.screen-panel button:focus-visible {
  outline: none;
  background: #bafff2;
  box-shadow: 0 0 22px rgba(89, 255, 225, 0.38);
}

.screen-panel .secondary-button {
  min-height: 34px;
  margin-top: 9px;
  border-color: rgba(89, 255, 225, 0.32);
  color: #74aaa1;
  background: transparent;
  font-size: 0.66rem;
}

.screen-panel .secondary-button:hover,
.screen-panel .secondary-button:focus-visible {
  color: #c9fff5;
  background: rgba(89, 255, 225, 0.1);
}

.screen-panel p {
  margin: 16px 0 0;
  color: #709791;
  font-size: 0.72rem;
  line-height: 1.6;
}

.flight-time {
  margin: 28px 0;
  color: #8aa19e;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
}

.flight-time strong {
  display: block;
  margin-top: 8px;
  color: #fff;
  font-size: 1.6rem;
}

.hidden {
  display: none;
}

#scanlines {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0.16;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 3px,
    rgba(60, 255, 220, 0.08) 4px
  );
  mix-blend-mode: screen;
}

#audio-toggle {
  position: absolute;
  right: clamp(12px, 2vw, 24px);
  bottom: clamp(12px, 2vw, 22px);
  z-index: 8;
  min-width: 128px;
  padding: 8px 12px;
  border: 1px solid rgba(89, 255, 225, 0.4);
  color: #bffff4;
  background: rgba(0, 18, 16, 0.9);
  box-shadow: 0 0 18px rgba(0, 255, 210, 0.08);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  cursor: pointer;
}

#audio-toggle:hover,
#audio-toggle:focus-visible {
  outline: none;
  border-color: var(--cyan);
  color: #fff;
  box-shadow: 0 0 18px rgba(89, 255, 225, 0.2);
}

#audio-toggle.muted {
  border-color: rgba(131, 170, 165, 0.3);
  color: #6f918c;
  box-shadow: none;
}

@media (max-width: 600px) {
  .hud-block {
    top: 12px;
    padding: 7px 8px;
  }

  .hud-left {
    left: 8px;
  }

  .hud-right {
    right: 8px;
  }

  #locator-bar {
    top: 82px;
    width: calc(100vw - 40px);
  }

  #mission-hud {
    right: 8px;
    bottom: 42px;
    left: 8px;
    width: auto;
  }

  .screen-panel {
    padding: 26px 24px;
  }

  #intro-overlay {
    bottom: 30px;
    left: 22px;
    width: calc(100vw - 44px);
  }

  #audio-toggle {
    right: 8px;
    bottom: 8px;
    min-width: 112px;
    padding: 7px 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .screen-panel button {
    transition: none;
  }

  #scanlines {
    display: none;
  }
}
