:root {
  color-scheme: dark;
  --bg: #07130f;
  --panel: #0d201a;
  --panel-hi: #132d24;
  --ink: #f4f7f2;
  --muted: #b6cfc2;
  --gold: #f0c35e;
  --gold-hi: #fde68a;
  --emerald: #10b981;
  --emerald-bright: #34d399;
  --line: rgba(52, 211, 153, 0.28);
  --line-gold: rgba(240, 195, 94, 0.45);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: radial-gradient(circle at 18% 0%, #103227 0%, var(--bg) 52%);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
}
a { color: inherit; }
button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}

.site-header, footer {
  max-width: 1180px;
  margin: auto;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 13px;
}
.site-header {
  border-bottom: 1px solid var(--line);
}
.brand-link {
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.brand-link span { color: var(--gold); margin-left: 6px; }
.header-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.edition, .eyebrow, .console-top, .station-state, .road-label, .station-badge {
  font: 700 11px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.1em;
}
.edition { color: var(--muted); }
.nav-play-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(240, 195, 94, 0.14);
  border: 1px solid var(--line-gold);
  color: var(--gold-hi);
  text-decoration: none;
  font-weight: 700;
  font-size: 12.5px;
  min-height: 36px;
}
.nav-play-link:hover { background: rgba(240, 195, 94, 0.24); }

main {
  max-width: 1180px;
  margin: auto;
  padding: 20px 24px 48px;
}

/* FIRST-SCREEN HERO STAGE */
.hero-stage {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line-gold);
  min-height: 360px;
  display: flex;
  align-items: flex-end;
  margin-bottom: 24px;
  background: #0a1b15;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.48);
}
.hero-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  filter: saturate(1.06) brightness(0.76);
}
.hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(95deg, rgba(6, 18, 14, 0.94) 0%, rgba(6, 18, 14, 0.78) 56%, rgba(6, 18, 14, 0.35) 100%);
}
.hero-content {
  position: relative;
  z-index: 2;
  padding: 36px 36px 32px;
  max-width: 680px;
}
.eyebrow {
  color: var(--gold);
  text-transform: uppercase;
  margin: 0 0 10px;
}
h1 {
  font: 800 clamp(38px, 5.4vw, 66px)/1.02 Georgia, serif;
  letter-spacing: -0.03em;
  margin: 0 0 14px;
}
h1 em { font-style: italic; color: var(--gold); font-weight: 700; }
.lede {
  margin: 0 0 20px;
  color: #dcebe3;
  font-size: 16.5px;
  max-width: 560px;
}
.lede strong { color: var(--gold-hi); }

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.btn-hero-primary, .btn-hero-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 15px;
  text-decoration: none;
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}
.btn-hero-primary {
  background: linear-gradient(135deg, #34d399, #10b981);
  color: #041911;
  border: 1px solid #6ee7b7;
  box-shadow: 0 10px 26px rgba(16, 185, 129, 0.28);
}
.btn-hero-primary:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn-hero-secondary {
  background: rgba(13, 32, 26, 0.88);
  color: var(--gold-hi);
  border: 1px solid var(--line-gold);
}
.btn-hero-secondary:hover { background: rgba(240, 195, 94, 0.16); transform: translateY(-1px); }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tags span {
  background: rgba(7, 19, 15, 0.72);
  border: 1px solid var(--line);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
}

/* MISSION CONSOLE */
.console {
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42);
  transition: border-color 0.6s ease;
}
body[data-signal="3"] .console {
  border-color: var(--gold);
  box-shadow: 0 24px 70px rgba(16, 185, 129, 0.18);
}
.console-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 15px 24px;
  background: var(--panel-hi);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.signal-pill { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); }
#live-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: #e08256;
  border-radius: 50%;
}
#live-dot.on {
  background: var(--emerald-bright);
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.85);
}
.progress-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.progress-track {
  width: 110px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--emerald), var(--gold));
  transition: width 0.45s ease;
}
body[data-signal="1"] .progress-fill { width: 33.3%; }
body[data-signal="2"] .progress-fill { width: 66.6%; }
body[data-signal="3"] .progress-fill { width: 100%; }

/* INTERACTIVE SCENE */
.scene {
  position: relative;
  min-height: 310px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 28px 24px 44px;
  background: #0b1c17;
}
.scene-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 65%;
  opacity: 0.34;
  transition: opacity 0.8s ease, filter 0.8s ease;
}
body[data-signal="1"] .scene-art { opacity: 0.48; filter: brightness(1.04); }
body[data-signal="2"] .scene-art { opacity: 0.62; filter: brightness(1.1); }
body[data-signal="3"] .scene-art { opacity: 0.78; filter: brightness(1.16) saturate(1.15); }
.scene-wash {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 19, 15, 0.78) 0%, rgba(7, 19, 15, 0.46) 55%, rgba(7, 19, 15, 0.92) 100%);
}
.wires {
  position: absolute;
  top: 46%;
  left: 8%;
  right: 8%;
  height: 2px;
  background: linear-gradient(90deg, rgba(182, 207, 194, 0.25), rgba(240, 195, 94, 0.45), rgba(182, 207, 194, 0.25));
  z-index: 1;
  transition: background 0.6s ease, box-shadow 0.6s ease;
}
body[data-signal="3"] .wires {
  background: linear-gradient(90deg, var(--emerald-bright), var(--gold-hi), var(--emerald-bright));
  box-shadow: 0 0 18px rgba(52, 211, 153, 0.7);
}

.station-row {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
}
.building {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 18px 14px 14px;
  border-radius: 16px;
  border: 1.5px solid rgba(182, 207, 194, 0.26);
  background: rgba(11, 27, 22, 0.88);
  color: var(--ink);
  min-height: 164px;
  justify-content: space-between;
  transition: transform 0.2s ease, border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}
.station-badge {
  position: absolute;
  top: 10px;
  left: 12px;
  color: var(--muted);
}
.station-ico { font-size: 32px; line-height: 1.1; margin-top: 8px; }
.building strong {
  font: 800 13.5px/1.25 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.05em;
}
.station-sub { font-size: 12px; color: var(--muted); }
.station-state {
  width: 100%;
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(7, 19, 15, 0.85);
  color: var(--muted);
  margin-top: 4px;
}
.building:disabled { cursor: default; opacity: 0.62; }
.building.active {
  border-color: var(--gold);
  background: rgba(20, 44, 34, 0.96);
  box-shadow: 0 0 0 3px rgba(240, 195, 94, 0.26), 0 14px 28px rgba(0, 0, 0, 0.42);
  transform: translateY(-2px);
}
.building.active .station-state {
  background: rgba(240, 195, 94, 0.18);
  color: var(--gold-hi);
}
.building.done {
  opacity: 1;
  border-color: var(--emerald-bright);
  background: rgba(12, 54, 40, 0.94);
  box-shadow: 0 0 24px rgba(52, 211, 153, 0.26);
}
.building.done .station-state {
  background: rgba(16, 185, 129, 0.24);
  color: #a7f3d0;
}

.neighbors {
  position: absolute;
  bottom: 26px;
  left: 22%;
  right: 22%;
  display: flex;
  justify-content: space-between;
  z-index: 2;
  pointer-events: none;
}
.neighbors span {
  color: var(--gold);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.8s ease, transform 0.8s ease;
  font-size: 14px;
}
body[data-signal="1"] .neighbors span:first-child,
body[data-signal="2"] .neighbors span:nth-child(-n+3),
body[data-signal="3"] .neighbors span { opacity: 1; transform: translateY(0); }

.road-label {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(182, 207, 194, 0.78);
  font-size: 10px;
  z-index: 2;
}

.neighborhood-response {
  margin: 0;
  padding: 16px 24px;
  background: #102921;
  color: var(--gold-hi);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font: italic 17.5px/1.45 Georgia, serif;
}

.mission {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  padding: 24px;
  align-items: center;
}
h2 { font: 700 26px/1.18 Georgia, serif; margin: 0 0 8px; }
.mission-copy p { color: var(--muted); margin: 0 0 8px; }

.puzzle-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px;
  border-radius: 14px;
  background: rgba(7, 19, 15, 0.55);
  border: 1px solid var(--line);
  min-height: 92px;
}
.dial, .primary, .secondary {
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #163329;
  font-weight: 700;
}
.dial {
  font: 800 22px ui-monospace, SFMono-Regular, Menlo, monospace;
  min-width: 60px;
  border-color: var(--line-gold);
}
.dial:hover { background: #1e4537; }
.primary {
  background: linear-gradient(135deg, var(--gold), #dfa63a);
  color: #081812;
  border-color: var(--gold-hi);
}
.primary:hover { filter: brightness(1.06); }
.secondary { font-size: 13px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.secondary:hover { border-color: var(--gold); }
.hint { margin: 0; font-size: 14px; color: var(--muted); text-align: center; }
.complete-cta {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, #34d399, #10b981);
  color: #041911;
  font-weight: 800;
  text-decoration: none;
  min-height: 44px;
}

#feedback {
  border-top: 1px solid var(--line);
  margin: 0;
  padding: 14px 24px;
  color: var(--gold-hi);
  font-size: 14.5px;
  min-height: 52px;
}
.console-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 0 24px 20px;
  font-size: 12.5px;
  color: var(--muted);
}
.console-bottom-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.after {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 36px;
  padding: 36px 0 12px;
  align-items: start;
}
.after p { color: var(--muted); margin-top: 0; }
.after-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
}
.after-cta {
  display: inline-flex;
  align-items: center;
  padding: 11px 18px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid var(--emerald-bright);
  color: #a7f3d0;
  font-weight: 800;
  text-decoration: none;
}
.after-sub { color: var(--gold); font-size: 14px; font-weight: 600; }

footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  flex-wrap: wrap;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scene-art, .building, .wires, .neighbors span, .progress-fill, .btn-hero-primary, .btn-hero-secondary {
    transition: none;
  }
}

@media (max-width: 720px) {
  .site-header, footer { padding: 14px 16px; }
  .edition { display: none; }
  main { padding: 14px 14px 36px; }
  .hero-stage { min-height: 320px; }
  .hero-content { padding: 22px 18px 20px; }
  .hero-cta-row { flex-direction: column; align-items: stretch; }
  .scene { padding: 20px 14px 38px; }
  .station-row { grid-template-columns: 1fr; gap: 10px; }
  .building { min-height: auto; flex-direction: row; text-align: left; padding: 12px 14px; gap: 12px; }
  .station-badge { position: static; }
  .station-ico { margin-top: 0; font-size: 24px; }
  .station-sub { display: none; }
  .station-state { width: auto; margin-top: 0; margin-left: auto; white-space: nowrap; font-size: 10px; }
  .mission, .after { grid-template-columns: 1fr; gap: 16px; padding: 18px 16px; }
  .console-top { padding: 12px 16px; }
  #feedback { padding: 12px 16px; }
  .console-bottom { padding: 0 16px 16px; }
  .neighborhood-response { padding: 14px 16px; font-size: 15.5px; }
}

/* Incremental Station Environment Artwork */
.station-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(240, 195, 94, 0.35);
  margin: 4px 0 8px;
  display: block;
}
