:root {
  --bg-deep: #04060f;
  --bg-base: #070b18;
  --surface: rgba(8, 18, 40, 0.72);
  --surface-strong: rgba(10, 24, 52, 0.88);
  --cyan: #5ce1ff;
  --cyan-dim: #2aa8c9;
  --violet: #9b7dff;
  --blue: #4d7cff;
  --earth: #3ddeb2;
  --mars: #ff7a4d;
  --amber: #ffc857;
  --text: #e8f4ff;
  --text-muted: #93a8c4;
  --danger: #ff5d7a;
  --line: rgba(92, 225, 255, 0.28);
  --glow-cyan: 0 0 18px rgba(92, 225, 255, 0.45);
  --glow-violet: 0 0 22px rgba(155, 125, 255, 0.4);
  --radius: 16px;
  --font-display: "Orbitron", sans-serif;
  --font-ui: "Exo 2", sans-serif;
  --font-mono: "Share Tech Mono", monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --header-h: 92px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 18px;
  line-height: 1.55;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
}

#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.scanlines,
.vignette,
.ambient,
.planet {
  position: fixed;
  pointer-events: none;
  z-index: 1;
}

.scanlines {
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.03) 0 1px,
    transparent 1px 4px
  );
  opacity: 0.18;
  mix-blend-mode: overlay;
}

.vignette {
  inset: 0;
  box-shadow: inset 0 0 180px 40px rgba(0, 0, 0, 0.72);
}

.ambient-cyan {
  width: 46vw;
  height: 46vw;
  top: -12vw;
  right: -10vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(92, 225, 255, 0.16), transparent 68%);
  filter: blur(8px);
  animation: drift 18s ease-in-out infinite alternate;
}

.ambient-violet {
  width: 50vw;
  height: 50vw;
  bottom: -18vw;
  left: -16vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(155, 125, 255, 0.18), transparent 70%);
  filter: blur(10px);
  animation: drift 22s ease-in-out infinite alternate-reverse;
}

.planet {
  border-radius: 50%;
  filter: blur(0.2px);
  opacity: 0.55;
}

.planet-earth {
  width: 180px;
  height: 180px;
  right: 6vw;
  bottom: 12vh;
  background:
    radial-gradient(circle at 30% 30%, #7ee7ff, transparent 28%),
    radial-gradient(circle at 60% 55%, #1f8a63 0 18%, transparent 42%),
    radial-gradient(circle at 40% 70%, #163d8a, #06203a 70%);
  box-shadow: 0 0 40px rgba(61, 222, 178, 0.25);
  animation: float 14s ease-in-out infinite;
}

.planet-mars {
  width: 90px;
  height: 90px;
  left: 7vw;
  top: 18vh;
  background:
    radial-gradient(circle at 35% 30%, #ffb087, transparent 32%),
    radial-gradient(circle at 70% 60%, #c24a2a, #5a1c12 72%);
  box-shadow: 0 0 28px rgba(255, 122, 77, 0.28);
  animation: float 11s ease-in-out infinite reverse;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-4%, 6%, 0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@keyframes scan {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(220%); }
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 50;
  background: var(--cyan);
  color: #041018;
  padding: 8px 12px;
  font-weight: 700;
}

.skip-link:focus {
  top: 12px;
}

.hud-header,
.app,
.hud-footer {
  position: relative;
  z-index: 2;
}

.hud-header {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(240px, 2fr) minmax(140px, 1fr);
  gap: 16px;
  align-items: center;
  padding: 14px 24px 10px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(4, 10, 24, 0.92), rgba(4, 10, 24, 0.55));
  backdrop-filter: blur(10px);
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hud-logo {
  width: 42px;
  height: 42px;
  color: var(--cyan);
  filter: drop-shadow(0 0 8px rgba(92, 225, 255, 0.6));
}

.hud-kicker,
.section-kicker {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
}

.hud-code {
  margin: 2px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.progress-wrap {
  min-width: 0;
}

.progress-label {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.progress-track {
  height: 6px;
  border-radius: 99px;
  background: rgba(92, 225, 255, 0.12);
  overflow: hidden;
  border: 1px solid var(--line);
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  box-shadow: var(--glow-cyan);
  transition: width 400ms var(--ease);
}

.progress-steps {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.progress-steps li.done,
.progress-steps li.current {
  color: var(--cyan);
}

.progress-steps li.current {
  text-shadow: var(--glow-cyan);
}

.hud-meta {
  text-align: right;
}

.hud-clock {
  margin: 0;
  font-family: var(--font-mono);
  color: var(--cyan);
  font-size: 16px;
}

.hud-status {
  margin: 4px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--earth);
}

.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--earth);
  box-shadow: 0 0 10px var(--earth);
  animation: pulse 1.6s ease-in-out infinite;
}

.app {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 80px;
  min-height: calc(100dvh - var(--header-h) - 48px);
}

.screen {
  animation: fade-in 420ms var(--ease);
}

.screen[hidden] {
  display: none !important;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.hud-frame {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: inset 0 0 40px rgba(77, 124, 255, 0.08), 0 20px 50px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
}

.hud-frame::before,
.hud-frame::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--cyan);
  pointer-events: none;
}

.hud-frame::before {
  top: 8px;
  left: 8px;
  border-right: 0;
  border-bottom: 0;
}

.hud-frame::after {
  right: 8px;
  bottom: 8px;
  border-left: 0;
  border-top: 0;
}

.display-title,
.boot-title,
h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  line-height: 1.15;
}

.display-title {
  font-size: clamp(2rem, 6vw, 3.6rem);
  margin: 8px 0 12px;
  text-shadow: 0 0 24px rgba(92, 225, 255, 0.35);
}

.lead {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 46rem;
}

.home-hero,
.phase-head {
  text-align: center;
  margin-bottom: 28px;
}

.home-hero .lead,
.phase-head .lead {
  margin-left: auto;
  margin-right: auto;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 28px 0;
}

.choice-grid.two {
  margin-top: 18px;
}

.choice-card,
.option-btn,
.btn,
.stepper button {
  cursor: pointer;
  touch-action: manipulation;
}

.choice-card {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  min-height: 220px;
}

.earth-card {
  border-color: rgba(61, 222, 178, 0.45);
  box-shadow: 0 0 24px rgba(61, 222, 178, 0.12);
}

.space-card {
  border-color: rgba(155, 125, 255, 0.5);
  box-shadow: 0 0 24px rgba(155, 125, 255, 0.14);
}

.choice-card h2 {
  margin: 8px 0 10px;
  font-size: 1.4rem;
}

.choice-card p,
.option-btn em,
.helper,
.disclaimer,
.narrative-note,
.science-note,
.classified-warn,
.discuss-prompt,
.hud-footer p {
  color: var(--text-muted);
}

.card-icon {
  width: 56px;
  height: 56px;
  color: var(--cyan);
}

.card-icon svg {
  width: 100%;
  height: 100%;
}

.cta-row,
.nav-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

.nav-row {
  justify-content: space-between;
}

.btn {
  appearance: none;
  border: 1px solid var(--cyan);
  background: transparent;
  color: var(--cyan);
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  min-height: 52px;
  padding: 12px 22px;
  border-radius: 10px;
  transition: transform 180ms var(--ease), background 180ms var(--ease), box-shadow 180ms var(--ease);
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: var(--glow-cyan);
  outline: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: linear-gradient(180deg, rgba(92, 225, 255, 0.18), rgba(77, 124, 255, 0.22));
  color: #f4fbff;
  border-color: var(--cyan);
}

.btn-xl {
  min-height: 64px;
  padding: 16px 36px;
  font-size: 1.05rem;
}

.btn-ghost {
  border-color: rgba(147, 168, 196, 0.45);
  color: var(--text);
}

.disclaimer {
  text-align: center;
  font-size: 0.9rem;
  max-width: 42rem;
  margin: 20px auto 0;
}

.narrative {
  max-width: 760px;
  margin: 0 auto;
}

.narrative-text {
  font-size: 1.15rem;
}

.budget-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  margin-bottom: 18px;
  color: var(--text-muted);
}

.budget-total strong {
  color: var(--cyan);
  font-size: 1.4rem;
}

.budget-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  padding: 14px 0;
  border-top: 1px solid rgba(92, 225, 255, 0.12);
}

.budget-item h3 {
  margin: 0;
  font-size: 1rem;
}

.budget-item p {
  margin: 4px 0 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stepper button {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  border: 1px solid var(--cyan);
  background: rgba(92, 225, 255, 0.08);
  color: var(--cyan);
  font-size: 1.4rem;
  cursor: pointer;
}

.stepper button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.stepper output {
  min-width: 2ch;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--text);
}

.helper {
  margin: 12px 0 0;
  font-size: 0.92rem;
}

.summary-grid,
.final-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}

.bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 2.5rem;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
  font-size: 0.92rem;
}

.bar-track {
  height: 16px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  transition: width 500ms var(--ease);
}

.bar-fill.space { background: linear-gradient(90deg, #6a5bff, var(--cyan)); }
.bar-fill.health { background: linear-gradient(90deg, #2aa8c9, var(--earth)); }
.bar-fill.env { background: linear-gradient(90deg, #1f8a63, #7ee7ff); }

.alert-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto 20px;
  padding: 10px 16px;
  max-width: 720px;
  border: 1px solid rgba(255, 122, 77, 0.5);
  color: var(--mars);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.85rem;
  background: rgba(255, 122, 77, 0.08);
}

.alert-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--mars);
  box-shadow: 0 0 12px var(--mars);
  animation: pulse 1.1s ease-in-out infinite;
}

.options-list {
  border: 0;
  padding: 0;
  margin: 0 auto;
  max-width: 820px;
  display: grid;
  gap: 12px;
}

.options-list legend {
  font-family: var(--font-display);
  margin-bottom: 10px;
}

.option-btn {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  text-align: left;
  width: 100%;
  min-height: 88px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-ui);
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease), transform 180ms var(--ease);
}

.option-btn.tall {
  flex-direction: column;
  min-height: 140px;
}

.option-btn strong {
  display: block;
  font-size: 1.05rem;
}

.option-btn em {
  display: block;
  margin-top: 6px;
  font-style: normal;
}

.option-btn.selected,
.option-btn:focus-visible {
  border-color: var(--cyan);
  box-shadow: var(--glow-cyan);
  outline: none;
}

.option-key {
  flex: 0 0 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-family: var(--font-display);
}

.chosen-tag {
  font-family: var(--font-mono);
  color: var(--cyan);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.science-note,
.classified-warn,
.narrative-note {
  border-left: 3px solid var(--amber);
  padding-left: 14px;
}

.classified-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--amber);
  margin-bottom: 12px;
}

.classified {
  overflow: hidden;
}

.classified::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 35%;
  height: 2px;
  background: var(--amber);
  animation: scan 2.8s linear infinite;
}

.profile-card h3 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
}

.decision-log {
  list-style: none;
  margin: 0;
  padding: 0;
}

.decision-log li {
  padding: 10px 0;
  border-bottom: 1px solid rgba(92, 225, 255, 0.12);
}

.decision-log strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
}

.reflection {
  margin: 28px auto 0;
  max-width: 760px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  background: rgba(155, 125, 255, 0.08);
  font-size: 1.12rem;
}

.discuss-prompt {
  text-align: center;
  margin-top: 18px;
}

.boot-panel {
  max-width: 640px;
  margin: 12vh auto 0;
}

.boot-tag {
  font-family: var(--font-mono);
  color: var(--cyan);
  letter-spacing: 0.2em;
}

.boot-title {
  font-size: clamp(1.4rem, 4vw, 2rem);
}

.boot-log {
  min-height: 160px;
  list-style: none;
  padding: 0;
  font-family: var(--font-mono);
  color: var(--earth);
  font-size: 0.95rem;
}

.boot-log li {
  margin: 6px 0;
}

.hud-footer {
  padding: 12px 16px 20px;
  text-align: center;
  font-size: 0.82rem;
}

.feedback-flash {
  animation: flash 420ms var(--ease);
}

@keyframes flash {
  0% { box-shadow: 0 0 0 rgba(92, 225, 255, 0); }
  40% { box-shadow: 0 0 28px rgba(92, 225, 255, 0.55); }
  100% { box-shadow: none; }
}

@media (max-width: 900px) {
  .hud-header {
    grid-template-columns: 1fr 1fr;
  }
  .hud-meta {
    display: none;
  }
  .choice-grid,
  .summary-grid,
  .final-grid {
    grid-template-columns: 1fr;
  }
  .planet-earth,
  .planet-mars {
    opacity: 0.28;
  }
}

@media (max-width: 640px) {
  html { font-size: 16px; }
  .hud-header {
    grid-template-columns: 1fr;
    text-align: left;
  }
  .nav-row {
    flex-direction: column-reverse;
  }
  .nav-row .btn,
  .cta-row .btn {
    width: 100%;
  }
  .bar-row {
    grid-template-columns: 1fr auto;
  }
  .bar-row span:first-child {
    grid-column: 1 / -1;
  }
  .app {
    width: calc(100% - 20px);
    padding-top: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .scanlines,
  .planet,
  .ambient {
    display: none;
  }
}
