* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--hac-paper);
  color: var(--hac-ink);
  font-family: var(--font-body);
}

.sim-bg-plate {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: var(--hac-paper);
  background-image:
    radial-gradient(circle at 12px 12px, var(--hac-n-30) 0.6px, transparent 1.4px),
    linear-gradient(var(--hac-n-30) 0.5px, transparent 0.5px),
    linear-gradient(90deg, var(--hac-n-30) 0.5px, transparent 0.5px);
  background-size: 24px 24px, 24px 2px, 2px 24px;
  background-position: 0 0, 0 11.7px, 11.7px 0;
  opacity: 0.72;
}

.sim-bg-vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 35% 50%, transparent 34%, rgba(255,255,255,0.62) 78%),
    linear-gradient(90deg, transparent 0 62%, rgba(255,255,255,0.78) 76% 100%);
}

.sim-frame {
  position: fixed;
  z-index: 9;
  width: 28px;
  height: 28px;
  color: var(--hac-ink);
  pointer-events: none;
}
.sim-frame::before,
.sim-frame::after {
  content: "";
  position: absolute;
  background: currentColor;
}
.sim-frame::before { width: 100%; height: 1px; top: 50%; left: 0; }
.sim-frame::after { width: 1px; height: 100%; left: 50%; top: 0; }
.sim-frame.tl { top: 24px; left: 24px; }
.sim-frame.tr { top: 24px; right: 24px; }
.sim-frame.bl { bottom: 24px; left: 24px; }
.sim-frame.br { bottom: 24px; right: 24px; }

.sim-nav {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 56px 16px;
  pointer-events: none;
}
.sim-nav > * { pointer-events: auto; }
.sim-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--hac-ink);
  text-decoration: none;
  border: 0;
}
.sim-mark {
  width: 28px;
  height: 28px;
  display: block;
}
.sim-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.sim-wordmark {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1;
}
.sim-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--fg-2);
}
.sim-pulse {
  width: 8px;
  height: 8px;
  background: var(--hac-teal);
  border-radius: 50%;
  animation: simPulse 1.6s ease-in-out infinite;
}
@keyframes simPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.42; transform: scale(0.72); }
}

.sim-app {
  position: relative;
  z-index: 2;
  height: 100%;
  min-height: 100%;
}

.sim-scene {
  position: fixed;
  inset: 0;
  z-index: 2;
}

#sim-svg {
  width: 100%;
  height: 100%;
  display: block;
}

#sim-limb {
  fill: rgba(255,255,255,0.48);
  stroke: var(--hac-ink);
  stroke-width: 2.4;
}
#sim-graticule {
  fill: none;
  stroke: var(--hac-n-30);
  stroke-width: 0.9;
  opacity: 0.74;
}
#sim-equator {
  fill: none;
  stroke: var(--hac-ink);
  stroke-width: 1.4;
  opacity: 0.56;
}
#sim-land {
  fill: none;
  stroke: var(--hac-ink);
  stroke-width: 1.25;
  opacity: 0.78;
}
#sim-accent {
  fill: var(--hac-yellow);
  stroke: var(--hac-ink);
  stroke-width: 1.2;
  opacity: 0.96;
}

.sim-orbit-front,
.sim-orbit-back {
  fill: none;
  stroke: var(--hac-ink);
  stroke-width: 1;
}
.sim-orbit-front { opacity: 0.36; }
.sim-orbit-back {
  opacity: 0.16;
  stroke-dasharray: 6 8;
}

.sim-sat {
  transition: opacity 120ms ease;
}
.sim-sat-body {
  fill: var(--hac-paper);
  stroke: var(--hac-ink);
  stroke-width: 1.4;
}
.sim-sat-panel {
  fill: var(--hac-teal-soft);
  stroke: var(--hac-ink);
  stroke-width: 0.8;
}
.sim-sat-core { fill: var(--hac-yellow); }
.sim-sat-occulted { opacity: 0.2; }
.sim-sat-active .sim-sat-body { fill: var(--hac-yellow); }

.sim-baseline {
  stroke: var(--hac-teal);
  stroke-width: 1.2;
  opacity: 0.22;
  vector-effect: non-scaling-stroke;
}
.sim-baseline-web {
  stroke: var(--hac-blue);
  stroke-width: 0.8;
  opacity: 0.16;
  vector-effect: non-scaling-stroke;
}
.sim-baseline-strong {
  stroke: var(--hac-yellow-deep);
  stroke-width: 2.4;
  opacity: 0.92;
  vector-effect: non-scaling-stroke;
}
.sim-beam {
  stroke: var(--hac-yellow-deep);
  stroke-width: 1;
  opacity: 0.32;
  stroke-dasharray: 8 8;
}
.sim-photon {
  fill: var(--hac-yellow);
  stroke: var(--hac-ink);
  stroke-width: 0.7;
  opacity: 0.82;
}

.sim-imaging-frame {
  fill: rgba(255,255,255,0.84);
  stroke: var(--hac-ink);
  stroke-width: 1.2;
}
.sim-imaging-rule {
  stroke: var(--hac-ink);
  stroke-width: 1;
  opacity: 0.44;
}
.sim-imaging-label,
.sim-imaging-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  fill: var(--fg-2);
}
.sim-imaging-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.04em;
  fill: var(--hac-ink);
}
.sim-target-noise {
  fill: none;
  stroke: var(--hac-n-30);
  stroke-width: 1;
  opacity: 0.5;
}
.sim-target-ring {
  fill: none;
  stroke: var(--hac-yellow-deep);
  stroke-width: 1.2;
  opacity: 0.42;
  stroke-dasharray: 4 7;
}
.sim-target-ring-2 {
  stroke: var(--hac-ink);
  opacity: 0.26;
  stroke-dasharray: 2 6;
}
.sim-target-soft { fill: var(--hac-yellow); filter: url(#sim-blur); opacity: 0.58; }
.sim-target-core { fill: var(--hac-yellow); stroke: var(--hac-ink); stroke-width: 1.3; }
.sim-target-crater { fill: var(--hac-ink); opacity: 0.58; }
.sim-source-ring {
  fill: none;
  stroke: var(--hac-ink);
  stroke-width: 1.2;
  opacity: 0.82;
}
.sim-source-point {
  fill: var(--hac-yellow);
  stroke: var(--hac-ink);
  stroke-width: 1.2;
}
.sim-source-cross {
  stroke: var(--hac-ink);
  stroke-width: 1.1;
  opacity: 0.82;
}

.sim-hud {
  position: fixed;
  z-index: 12;
  left: 56px;
  bottom: 38px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  border: 1px solid var(--hac-ink);
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(8px);
}
.sim-hud > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 12px;
  border-right: 1px solid var(--hac-n-20);
}
.sim-hud > div:last-child { border-right: 0; }
.sim-hud-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--fg-3);
}
.sim-hud-value {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.sim-story {
  position: fixed;
  z-index: 16;
  top: 96px;
  right: 56px;
  bottom: 56px;
  width: 430px;
  max-width: calc(100vw - 112px);
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--hac-ink);
  box-shadow: 6px 6px 0 0 var(--hac-ink);
  backdrop-filter: blur(10px);
}
.sim-story-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--hac-ink);
  color: var(--hac-paper);
  padding: 10px 14px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.16em;
}
.sim-story-ix {
  width: 8px;
  height: 8px;
  background: var(--hac-yellow);
}
.sim-story-body {
  flex: 1;
  min-height: 0;
  padding: 28px;
  overflow: auto;
}
.sim-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--fg-3);
  text-transform: uppercase;
  margin-bottom: 14px;
}
#sim-title {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-size: 48px;
  line-height: 0.94;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}
#sim-body {
  margin: 0;
  max-width: none;
  font-size: 15px;
  line-height: 1.55;
  color: var(--fg-2);
}
.sim-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--hac-ink);
  border: 1px solid var(--hac-ink);
  margin-top: 24px;
}
.sim-metric {
  background: var(--hac-paper);
  padding: 12px 14px;
}
.sim-metric-k {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--fg-3);
  text-transform: uppercase;
  margin-bottom: 5px;
}
.sim-metric-v {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
}

.sim-controls {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 8px;
  align-items: center;
  padding: 14px;
  border-top: 1px solid var(--hac-ink);
}
.sim-icon-btn,
.sim-dot {
  appearance: none;
  border: 1px solid var(--hac-ink);
  background: var(--hac-paper);
  color: var(--hac-ink);
  cursor: pointer;
  font-family: var(--font-mono);
  font-weight: 700;
}
.sim-icon-btn {
  width: 44px;
  height: 40px;
  font-size: 15px;
}
.sim-icon-btn:hover,
.sim-icon-btn:focus-visible,
.sim-dot:hover,
.sim-dot:focus-visible {
  outline: none;
  background: var(--hac-yellow);
}
.sim-dots {
  display: grid;
  grid-template-columns: repeat(var(--sim-slide-count, 3), 1fr);
  gap: 6px;
}
.sim-dot {
  height: 40px;
  font-size: 0;
  position: relative;
}
.sim-dot::after {
  content: "";
  position: absolute;
  inset: 13px 8px;
  background: var(--hac-n-30);
}
.sim-dot.active::after { background: var(--hac-ink); }
.sim-dot.active { background: var(--hac-yellow-soft); }

.sim-booting {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--hac-paper);
  pointer-events: none;
  z-index: 5;
  transition: opacity 320ms ease;
}
.sim-booting[data-ready="true"] {
  opacity: 0;
}
.sim-booting-inner {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border: 1px solid var(--hac-ink);
  background: var(--hac-paper);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--hac-ink);
}
.sim-booting-pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--hac-yellow-deep);
  box-shadow: 0 0 0 0 var(--hac-yellow-deep);
  animation: sim-booting-pulse 1.1s ease-out infinite;
}
@keyframes sim-booting-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(0,0,0,0.18); }
  70%  { box-shadow: 0 0 0 12px rgba(0,0,0,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); }
}

body[data-slide="0"] .sim-baseline,
body[data-slide="0"] .sim-baseline-web,
body[data-slide="0"] .sim-baseline-strong,
body[data-slide="0"] .sim-beam {
  opacity: 0;
}
body[data-slide="2"] .sim-sat-body {
  stroke-width: 1;
}

@media (max-width: 1060px) {
  .sim-nav { padding: 16px 24px; }
  .sim-story {
    right: 24px;
    top: 86px;
    bottom: 24px;
    width: 390px;
  }
  .sim-hud { left: 24px; bottom: 24px; }
  #sim-title { font-size: 40px; }
}

@media (max-width: 820px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow: auto;
  }
  .sim-nav {
    position: relative;
    padding: 16px 18px 8px;
  }
  .sim-wordmark { font-size: 14px; }
  .sim-status { display: none; }
  .sim-app {
    display: flex;
    min-height: calc(100vh - 56px);
    flex-direction: column;
  }
  .sim-scene {
    position: relative;
    height: 56vh;
    min-height: 360px;
  }
  .sim-story {
    position: relative;
    inset: auto;
    width: auto;
    max-width: none;
    margin: 0 18px 24px;
    min-height: 0;
  }
  .sim-story-body { padding: 22px; }
  #sim-title { font-size: 36px; }
  .sim-hud {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 14px;
    margin: 0;
  }
  .sim-hud > div {
    flex: 1 1 120px;
    justify-content: space-between;
  }
}

@media (max-width: 480px) {
  .sim-frame { display: none; }
  .sim-brand { gap: 8px; }
  .sim-wordmark { max-width: 220px; line-height: 1.1; }
  .sim-story { margin: 0 14px 18px; }
  .sim-story-body { padding: 18px; }
  #sim-title { font-size: 30px; }
  .sim-controls { grid-template-columns: 38px 1fr 38px; gap: 6px; padding: 10px; }
  .sim-icon-btn { width: 38px; height: 36px; }
  .sim-dot { height: 36px; }
}
