:root {
  color-scheme: dark;
  --ink: #dcecf2;
  --muted: #8299a2;
  --cyan: #63e6eb;
  --cyan-soft: rgba(99, 230, 235, 0.14);
  --amber: #de9d4b;
  --amber-soft: rgba(222, 157, 75, 0.13);
  --red: #f06b5f;
  --night: #03070a;
  --panel: #071017;
  --line: rgba(150, 209, 216, 0.2);
}

* { box-sizing: border-box; }

html { background: var(--night); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Avenir Next Condensed", "DIN Condensed", "Trebuchet MS", sans-serif;
  background:
    linear-gradient(rgba(99, 230, 235, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 230, 235, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 12% 8%, rgba(31, 102, 112, 0.2), transparent 30rem),
    #03070a;
  background-size: 34px 34px, 34px 34px, auto, auto;
}

button { font: inherit; }

.mission-shell {
  width: min(1600px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 18px;
}

.mission-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 0 4px 15px;
  border-bottom: 1px solid var(--line);
}

.mission-kicker,
.telemetry-label,
.viewport-caption,
.mission-footer,
.signal-strip {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.mission-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--amber);
  font-size: 0.68rem;
  font-weight: 800;
}

.mission-lockup h1 {
  margin: 0;
  font-size: clamp(2.7rem, 6vw, 5.6rem);
  line-height: 0.77;
  letter-spacing: -0.035em;
  font-weight: 550;
  color: #eef9fb;
}

.mission-lockup h1 strong {
  color: var(--amber);
  font-weight: 850;
  text-shadow: 0 0 26px rgba(222, 157, 75, 0.32);
}

.signal-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 18px;
  color: #9cb3ba;
  font-size: 0.66rem;
  font-weight: 800;
}

.signal-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
}

.signal-dot--cyan { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.signal-dot--amber { background: var(--amber); box-shadow: 0 0 10px var(--amber); }

.console-button {
  border: 1px solid rgba(99, 230, 235, 0.38);
  padding: 7px 10px;
  color: var(--cyan);
  background: rgba(99, 230, 235, 0.06);
  cursor: pointer;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.console-button:hover,
.console-button:focus-visible {
  color: #041014;
  background: var(--cyan);
  outline: none;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 286px;
  gap: 16px;
  margin-top: 16px;
}

.viewport-frame {
  position: relative;
  align-self: start;
  padding: 8px;
  border: 1px solid rgba(99, 230, 235, 0.28);
  background: #020507;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.48), inset 0 0 28px rgba(99, 230, 235, 0.05);
}

.viewport-frame::before {
  content: "";
  position: absolute;
  inset: 8px 8px 26px;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(180deg, transparent 0 3px, rgba(0, 0, 0, 0.07) 4px);
  mix-blend-mode: multiply;
}

#space-bugs-2-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1280 / 972;
  background: #02070a;
  outline: none;
  cursor: crosshair;
}

#space-bugs-2-canvas:focus-visible {
  box-shadow: 0 0 0 2px var(--amber), 0 0 24px rgba(222, 157, 75, 0.26);
}

.viewport-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 3px 0;
  color: #5f7880;
  font-size: 0.58rem;
}

.frame-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  z-index: 3;
  pointer-events: none;
  border-color: var(--amber);
}

.frame-corner--tl { top: 3px; left: 3px; border-top: 2px solid; border-left: 2px solid; }
.frame-corner--tr { top: 3px; right: 3px; border-top: 2px solid; border-right: 2px solid; }
.frame-corner--bl { bottom: 23px; left: 3px; border-bottom: 2px solid; border-left: 2px solid; }
.frame-corner--br { right: 3px; bottom: 23px; border-right: 2px solid; border-bottom: 2px solid; }

.mission-rail {
  display: grid;
  align-content: start;
  gap: 10px;
}

.telemetry-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  padding: 13px;
  background:
    linear-gradient(135deg, rgba(99, 230, 235, 0.035), transparent 46%),
    rgba(7, 16, 23, 0.9);
}

.telemetry-card::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--cyan);
  opacity: 0.5;
}

.telemetry-card--primary {
  min-height: 168px;
  background:
    radial-gradient(circle at 95% 0%, rgba(222, 157, 75, 0.17), transparent 56%),
    rgba(7, 16, 23, 0.94);
}

.telemetry-card--primary::after { background: var(--amber); opacity: 0.9; }

.telemetry-label {
  display: block;
  margin-bottom: 5px;
  color: #6c868e;
  font-size: 0.59rem;
  font-weight: 800;
}

.telemetry-card strong {
  color: #edf9fb;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 1.32rem;
  letter-spacing: 0.04em;
}

.telemetry-card--primary > strong {
  display: block;
  color: var(--amber);
  font-size: 2.7rem;
  line-height: 1;
}

.telemetry-card h2 {
  margin: 5px 0 7px;
  font-size: 1.08rem;
  letter-spacing: 0.08em;
}

.telemetry-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.48;
}

.telemetry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.controls-card dl { margin: 4px 0 10px; }

.controls-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px dotted rgba(150, 209, 216, 0.15);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.66rem;
}

.controls-card dt { color: var(--muted); }
.controls-card dd { margin: 0; color: var(--cyan); font-weight: 800; }
.controls-card p strong { color: var(--amber); }

.doctrine-card { border-color: rgba(222, 157, 75, 0.22); }
.doctrine-card::after { background: var(--amber); }

.mission-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: #526970;
  font-size: 0.58rem;
}

.mission-footer strong { color: var(--cyan); }

@media (max-width: 1060px) {
  .game-layout { grid-template-columns: 1fr; }
  .mission-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .telemetry-card--primary, .controls-card { min-height: 0; }
}

@media (max-width: 720px) {
  .mission-shell { width: min(100% - 16px, 1600px); padding-top: 12px; }
  .mission-header { align-items: flex-start; flex-direction: column; }
  .signal-strip { justify-content: flex-start; }
  .mission-rail { grid-template-columns: 1fr; }
  .mission-footer { align-items: flex-start; flex-direction: column; }
  .viewport-caption { font-size: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
