* {
  box-sizing: border-box;
  font-family: 'Space Grotesk', 'JetBrains Mono', system-ui;
}
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  background: #020109;
  color: #e8faff;
}
#airlock {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: radial-gradient(1200px 60% at 50% 80%, rgba(18,25,48,0.7), rgba(2,1,9,0.98) 60%);
  backdrop-filter: blur(6px) saturate(120%);
  transition: opacity 900ms ease 250ms, visibility 0s linear 1150ms;
}
#airlock.open {
  opacity: 0;
  visibility: hidden;
}
#airlock .doors {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  pointer-events: none;
}
#airlock .door {
  background: linear-gradient(180deg, rgba(35,45,78,0.9), rgba(12,14,28,0.95));
  border-right: 1px solid rgba(255,255,255,0.06);
  box-shadow: inset 0 0 120px rgba(0,0,0,0.5), 0 20px 80px rgba(0,0,0,0.45);
  transform: translateX(0);
  transition: transform 900ms cubic-bezier(.2,.8,.2,1);
}
#airlock .door.right { border-right: 0; border-left: 1px solid rgba(255,255,255,0.06); }
#airlock.open .door.left { transform: translateX(-102%); }
#airlock.open .door.right { transform: translateX(102%); }
#airlock .airlock-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem 2.4rem;
  border-radius: 1.2rem;
  background: rgba(10,14,28,0.4);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(8px);
}
#airlock h1 {
  margin: 0 0 0.6rem 0;
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  letter-spacing: 0.6rem;
}
#airlock p {
  margin: 0 0 1.2rem 0;
  color: rgba(255,255,255,0.7);
}
.airlock-controls { display: flex; gap: 1rem; align-items: center; justify-content: center; }
.airlock-controls .audio-opt { font-size: 0.85rem; opacity: 0.9; }
.airlock-controls #enterDeck {
  pointer-events: all;
  background: linear-gradient(180deg, rgba(110,242,255,0.25), rgba(110,242,255,0.08));
  color: #dffcff;
  border: 1px solid rgba(110,242,255,0.6);
  border-radius: 999px;
  padding: 0.7rem 1.4rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.25rem;
}

#forge-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#ion-trail {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}
.ion-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  margin-top: -5px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #a8ffff, #43e0ff 60%, transparent 70%);
  filter: blur(0.4px);
  opacity: 0.0;
  transition: opacity 140ms ease;
}
.ion-dot.live { opacity: 0.8; }

#glyph-canvas {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.35;
}

#cockpit-glass {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(800px 200px at 50% -40px, rgba(160,255,255,0.25), rgba(160,255,255,0.02) 40%, transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(0,0,0,0.0) 40%),
    repeating-linear-gradient(180deg, rgba(160,255,255,0.03) 0 2px, transparent 2px 6px);
}
#hud {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 2rem clamp(1rem, 3vw, 4rem);
  pointer-events: none;
  transform: perspective(1200px) rotateX(var(--tiltY, 0deg)) rotateY(var(--tiltX, 0deg));
}
#hud header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: 0.4rem;
  pointer-events: all;
}
#hud header .logo {
  font-size: clamp(1rem, 2vw, 1.4rem);
}
#hud header .flight {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}
.chip {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  color: inherit;
  cursor: pointer;
  letter-spacing: 0.18rem;
  font-size: 0.72rem;
}
.chip[aria-pressed="true"], .chip input:checked + span {
  background: rgba(110,242,255,0.18);
  border-color: rgba(110,242,255,0.55);
}
#hud header .spectrum {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}
#hud header input[type="range"] {
  width: clamp(150px, 20vw, 260px);
}
main {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  pointer-events: all;
  padding-bottom: 3rem;
}
.powered-by {
  margin-top: 2rem;
  text-transform: uppercase;
  letter-spacing: 0.4rem;
  font-size: 0.58rem;
  color: rgba(255,255,255,0.55);
  pointer-events: all;
}
.powered-by strong {
  color: #a0fffb;
  letter-spacing: 0.3rem;
  font-weight: 600;
}
.panel {
  background: rgba(2, 6, 18, 0.7);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 1.5rem;
  padding: 1.2rem;
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
  transform-style: preserve-3d;
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}
.panel:hover { transform: translateZ(8px) scale(1.01); border-color: rgba(160,255,255,0.18); box-shadow: 0 30px 80px rgba(0,0,0,0.5); }
.panel h2 {
  margin-top: 0;
  font-size: 0.9rem;
  letter-spacing: 0.3rem;
  text-transform: uppercase;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  text-transform: uppercase;
}
.metrics span {
  font-size: 1.6rem;
  display: block;
}
.metrics label {
  font-size: 0.7rem;
  letter-spacing: 0.2rem;
}
.digests ul, .anchors ul, .releases ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
}
.digests strong {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.2rem;
  color: rgba(255,255,255,0.7);
}
.hash {
  font-size: clamp(0.7rem, 2.5vw, 0.9rem);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.08rem;
  word-break: break-word;
  color: #bdf8ff;
  opacity: 0.9;
}
.stat-link {
  color: #6ef2ff;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.2rem;
  transition: color 0.2s ease;
}
.stat-link:hover,
.stat-link:focus {
  color: #adfffb;
  text-decoration: underline;
}
.console .controls {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.console input, .console select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: 0.8rem;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
  color: inherit;
}
.console textarea {
  width: 100%;
  min-height: 5.4rem;
  border-radius: 0.8rem;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
  color: inherit;
  padding: 0.8rem;
  font-family: 'JetBrains Mono', monospace;
}
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.6rem;
}
.identity-pad {
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 1rem;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.identity-pad legend {
  text-transform: uppercase;
  letter-spacing: 0.2rem;
  font-size: 0.68rem;
  color: rgba(255,255,255,0.7);
}
.mode-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}
.identity-pad input[type="text"] {
  width: 100%;
  border-radius: 0.8rem;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
  color: inherit;
  padding: 0.6rem 0.8rem;
}
.sequence-notes {
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 1rem;
  padding: 0.8rem;
  background: rgba(0,0,0,0.25);
}
.sequence-notes h3,
.sequence-notes h4 {
  margin: 0.4rem 0;
  text-transform: uppercase;
  letter-spacing: 0.2rem;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.75);
}

/* Funding panel */
.funding .controls {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.funding input[type="text"],
.funding input[type="number"] {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: 0.8rem;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
  color: inherit;
}
#fundStatus {
  min-height: 20px;
  font-size: 0.9rem;
}
#fundStatus.success {
  color: #7df7c0;
}
#fundStatus.error {
  color: #ff6b6b;
}
.sequence-notes .command-preview {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  word-break: break-word;
  overflow-wrap: anywhere;
  background: rgba(255,255,255,0.05);
  padding: 0.5rem;
  border-radius: 0.5rem;
}
.sequence-notes ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
}
.sequence-notes code {
  font-family: 'JetBrains Mono', monospace;
}
.toggle {
  background: rgba(255,255,255,0.08);
  border: 1px solid transparent;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.toggle:active { transform: translateY(1px) scale(0.99); }
.toggle.active {
  border-color: #6ef2ff;
  background: rgba(110,242,255,0.2);
}
.toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
#commandBox {
  min-height: 4rem;
  max-height: 14rem;
  background: rgba(0,0,0,0.4);
  border-radius: 0.8rem;
  padding: 0.8rem;
  border: 1px solid rgba(255,255,255,0.15);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: #7ff9ff;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
}
.trajectory-notes {
  font-size: 0.8rem;
  line-height: 1.35;
  color: rgba(255,255,255,0.78);
  margin: 0.2rem 0 0.6rem;
}
#copyCmd {
  align-self: flex-start;
  background: transparent;
  color: inherit;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 0.8rem;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
}
#copyCmd.pulse { animation: pulseGlow 650ms ease; border-color: rgba(110,242,255,0.8); }
@keyframes pulseGlow { 0% { box-shadow: 0 0 0 rgba(110,242,255,0.0);} 40% { box-shadow: 0 0 0 10px rgba(110,242,255,0.15);} 100% { box-shadow: 0 0 0 rgba(110,242,255,0.0);} }
@media (max-width: 720px) {
  #hud {
    padding: 1rem;
  }
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .panel {
    padding: 1rem;
  }
  main {
    grid-template-columns: 1fr;
  }
  .field-grid {
    grid-template-columns: 1fr;
  }
  .console textarea {
    min-height: 4rem;
  }
  .sequence-notes ul {
    padding-left: 0.9rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  #airlock, #airlock .door { transition: none !important; }
  #hud { transform: none !important; }
}
