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

:root {
  --bg: #07090f;
  --bg-card: #0e1320;
  --bg-card2: #131929;
  --border: #1e2a40;
  --accent: #4a90e2;
  --accent-dim: #2a5a9a;
  --text: #d8e0f0;
  --text-dim: #7a8aaa;
  --green: #3ecf8e;
  --tab-active: #1a2540;
  --tab-hover: #111825;
  --radius: 6px;
  --font: 'Segoe UI', system-ui, sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}
body {
  display: flex;
  flex-direction: column;
}

#app-header {
  position: relative;
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--border);
  background: #060810;
  text-align: center;
}
#app-header h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: .04em; color: #fff; }
.subtitle { font-size: .8rem; color: var(--text-dim); margin-top: 2px; }
.rqm-header-link {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  color: #9fd0ff;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .03em;
  line-height: 1.1;
  text-shadow:
    0 0 1px rgba(0, 0, 0, 0.85),
    0 0 8px rgba(74, 144, 226, 0.35);
}
.rqm-header-link:hover {
  color: #c6e3ff;
  text-decoration: underline;
}
.rqm-header-icon-link {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  text-decoration: none;
  color: #9fd0ff;
  box-shadow:
    0 0 0 1px rgba(130, 198, 255, 0.45) inset,
    0 0 10px rgba(74, 144, 226, 0.35);
}
.rqm-header-icon-link:hover {
  color: #d9f2ff;
  box-shadow:
    0 0 0 1px rgba(166, 219, 255, 0.75) inset,
    0 0 14px rgba(74, 144, 226, 0.55);
}
.rqm-header-icon {
  width: 30px;
  height: 30px;
  display: block;
}

#mission-nav {
  display: flex;
  flex-direction: column;
  background: #070a11;
  border-bottom: 1px solid var(--border);
}
#mission-strip {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 8;
  max-width: min(560px, calc(100% - 24px));
  padding: 0;
  border: none;
  text-align: right;
  pointer-events: none;
  text-shadow:
    0 0 2px rgba(0, 0, 0, 0.98),
    0 0 8px rgba(0, 0, 0, 0.95),
    0 2px 10px rgba(0, 0, 0, 0.95);
}
#mission-strip h2 {
  margin: 0 0 2px;
  font-size: 1rem;
  color: #f8fbff;
}
#mission-strip .muted {
  margin: 0;
  font-size: .8rem;
  color: #dce9ff;
}
#mission-strip .status-msg {
  margin-top: 3px;
  min-height: 1.1em;
  color: #f8fbff;
}
#mission-tabs { display: flex; justify-content: center; gap: 2px; padding: 6px 12px 0; background: #070a11; overflow-x: auto; scrollbar-width: thin; }
.tab-btn { padding: 7px 16px; border: 1px solid transparent; border-bottom: none; border-radius: var(--radius) var(--radius) 0 0; background: transparent; color: var(--text-dim); cursor: pointer; font-size: .82rem; white-space: nowrap; }
.tab-btn:hover:not(.tab-disabled) { background: var(--tab-hover); color: var(--text); }
.tab-btn.tab-active { background: var(--tab-active); border-color: var(--border); color: #fff; }
.tab-btn.tab-disabled { opacity: .35; cursor: not-allowed; }

#app-main { display: grid; grid-template-columns: 1fr 320px; flex: 1; min-height: 0; }
#scene-panel { position: relative; background: #000; overflow: hidden; }
#three-canvas { display: block; width: 100%; height: 100%; }
.scene-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 32px; text-align: center; background: rgba(7,9,15,.75); color: var(--text-dim); font-size: .9rem; line-height: 1.7; pointer-events: none; }
.scene-overlay.hidden { display: none; }
.scene-mode-disclaimer {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 9;
  max-width: min(520px, calc(100% - 24px));
  border: 1px solid #45618d;
  border-radius: 6px;
  padding: 8px 10px;
  background: rgba(8, 16, 30, 0.86);
  color: #d9e7ff;
  font-size: .75rem;
  line-height: 1.35;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}
.scene-mode-disclaimer.disclaimer-official {
  border-color: #4b87d6;
}
.scene-mode-disclaimer.disclaimer-archived {
  border-color: #af7b52;
}
.scene-telem-row {
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.scene-telem-label {
  color: #d9e7ff;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: 0.92;
}
.scene-telem-value {
  color: #f8fbff;
  font-family: 'Courier New', monospace;
  font-size: .8rem;
}
.scene-phase {
  color: #fff3b2;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .05em;
  margin-bottom: 4px;
  text-transform: uppercase;
}
#scene-telemetry {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  pointer-events: none;
  text-shadow:
    0 0 2px rgba(0, 0, 0, 0.98),
    0 0 8px rgba(0, 0, 0, 0.95),
    0 2px 10px rgba(0, 0, 0, 0.95);
}
.scene-hud-meta {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: min(440px, calc(100% - 24px));
}
.scene-hud-events {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  align-items: flex-start;
  text-align: left;
  max-width: min(440px, calc(100% - 24px));
}
.scene-hud-events .scene-telem-label {
  min-width: 90px;
}
.scene-hud-events .scene-telem-value {
  max-width: min(340px, calc(100vw - 48px));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scene-hud-metrics {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  max-width: calc(100% - 24px);
}
.scene-metric {
  width: 108px;
  min-height: 108px;
  border-radius: 50%;
  border: 1px solid rgba(196, 226, 255, 0.62);
  background:
    radial-gradient(circle at 50% 36%, rgba(204, 232, 255, 0.2), rgba(10, 19, 33, 0.22) 56%, rgba(8, 14, 24, 0.45) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 9px 10px;
  box-shadow:
    0 0 0 1px rgba(140, 184, 226, 0.16) inset,
    0 0 12px rgba(126, 186, 255, 0.18);
}
.scene-metric-value {
  color: #f6fbff;
  font-family: 'Courier New', monospace;
  font-size: .94rem;
  line-height: 1.15;
  text-align: center;
  word-break: break-word;
}
.scene-metric-label {
  margin-top: 8px;
  color: #d6e8ff;
  font-size: .58rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.2;
}
.scene-hud-meta #sb-frame,
.scene-hud-meta #sb-sample-count {
  opacity: 0.92;
}
.scene-debug-overlay {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 8;
  margin: 0;
  padding: 7px 8px;
  max-width: min(440px, 92%);
  border: 1px solid #2a3a58;
  border-radius: 6px;
  background: rgba(6, 10, 18, 0.72);
  color: #a9c2ef;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.35;
  pointer-events: none;
  white-space: pre-wrap;
}
.controls-hint {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 9;
  max-width: min(360px, calc(100% - 24px));
  padding: 10px 10px 8px;
  border: 1px solid #3d5b8f;
  border-radius: 8px;
  background: rgba(9, 15, 26, 0.9);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.35);
}
.controls-hint.hidden { display: none; }
.controls-hint-text {
  margin: 0 0 8px;
  font-size: .75rem;
  line-height: 1.45;
  color: #d9e7ff;
}
.controls-hint-dismiss {
  flex: 0;
  min-width: 74px;
}

#sidebar { display: flex; flex-direction: column; gap: 10px; padding: 10px; background: var(--bg-card); border-left: 1px solid var(--border); overflow-y: auto; }
.card { background: var(--bg-card2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.card h2, .card h3 { font-size: .9rem; font-weight: 600; color: #fff; margin-bottom: 6px; }
.muted { color: var(--text-dim); font-size: .82rem; }
.status-msg { margin-top: 6px; font-size: .78rem; color: var(--green); min-height: 1.2em; }
.status-msg.status-ok { color: var(--green); }
.status-msg.status-warn { color: #f1cc6d; }
.status-msg.status-error { color: #ff8d8d; font-weight: 600; }

.legend-row { display: flex; align-items: center; gap: 8px; font-size: .78rem; margin: 4px 0; color: var(--text-dim); }
.legend-swatch { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.legend-swatch.full-route { background: rgba(121, 188, 255, .62); }
.legend-swatch.moon-route { background: rgba(215, 219, 255, .7); }
.legend-swatch.traversed-route { background: #bdeaff; }
.legend-swatch.orion-now { background: #ffef78; }
.legend-swatch.event-marker { background: #ff9fcb; }
.hint-text { color: var(--text-dim); font-size: .75rem; margin-top: 5px; }

.controls-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.controls-row.toggle-row { align-items: center; justify-content: space-between; }
.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  color: var(--text-dim);
}
.btn { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: #1a2338; color: var(--text); cursor: pointer; font-size: .77rem; }
.btn:hover { background: #1f2d48; border-color: var(--accent-dim); }
.btn-primary { background: var(--accent-dim); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent); }
.btn-live {
  border-color: #46bf89;
  background: #1d4f3d;
  color: #e8fff5;
}
.btn-live:hover {
  background: #25614b;
  border-color: #59d19a;
}
.btn.is-toggled { border-color: #7fb6ff; background: #274472; color: #f0f7ff; }
.btn:focus-visible,
.select:focus-visible,
.slider:focus-visible {
  outline: 2px solid #8fc5ff;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px rgba(143, 197, 255, 0.2);
}
.btn-sm { padding: 4px 7px; font-size: .75rem; flex: 1; }
.speed-row { align-items: center; }
.ctrl-label { font-size: .78rem; color: var(--text-dim); }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: .75rem; color: var(--text-dim); }
.zoom-row { justify-content: space-between; }
.zoom-value {
  font-size: .75rem;
  font-family: 'Courier New', monospace;
  color: #c8defe;
}

.select { flex: 1; background: #111825; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); padding: 4px 6px; font-size: .8rem; }
.select:focus { outline: none; border-color: var(--accent); }

.slider-row { display: flex; flex-direction: column; gap: 4px; }
.timeline-track-wrap { position: relative; }
.timeline-ticks { position: absolute; left: 0; right: 0; top: 0; bottom: 0; pointer-events: auto; }
.timeline-tick { position: absolute; top: -2px; width: 2px; height: 8px; background: #ff77aa; opacity: .7; transform: translateX(-1px); }
.timeline-tick:hover { opacity: 1; cursor: pointer; box-shadow: 0 0 0 1px rgba(255, 119, 170, 0.4); }
.timeline-tick[data-type="burn"] {
  height: 10px;
  background: #ff9f64;
}
.timeline-tick[data-type="milestone"] {
  background: #7cc5ff;
}
.timeline-tick[data-type="data-boundary"],
.timeline-tick[data-type="system-boundary"] {
  height: 9px;
  background: #c58cff;
}

.annotation-list { list-style: none; display: flex; flex-direction: column; gap: 7px; margin-top: 6px; }
.annotation-list li { border: 1px solid var(--border); border-radius: 5px; padding: 7px 8px; background: rgba(12, 18, 31, 0.66); }
.annotation-time { font-family: 'Courier New', monospace; font-size: .75rem; color: #9fc3ff; margin-bottom: 2px; }
.annotation-label { font-size: .76rem; color: #dce8ff; }
.annotation-note { margin-top: 2px; font-size: .75rem; color: var(--text-dim); }
.annotation-link { margin-top: 2px; display: inline-block; color: #8dbdff; font-size: .75rem; text-decoration: none; }
.annotation-link:hover { text-decoration: underline; }

.capture-note {
  margin-top: 6px;
  font-size: .75rem;
  color: #8fa7cc;
}

.faq-item + .faq-item {
  margin-top: 6px;
}
.faq-item summary {
  cursor: pointer;
  color: #cfe2ff;
  font-size: .78rem;
  font-weight: 600;
}
.faq-answer {
  margin-top: 5px;
  font-size: .74rem;
  color: #d9e7ff;
  line-height: 1.42;
}
.embed-tools {
  margin-top: 2px;
}
.embed-snippet-output {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0e1627;
  color: #cfe2ff;
  font-family: 'Courier New', monospace;
  font-size: .7rem;
  line-height: 1.4;
  padding: 7px 8px;
}
.embed-snippet-output:focus-visible {
  outline: 2px solid #8fc5ff;
  outline-offset: 2px;
}

.hidden { display: none !important; }

.artemis3-card h4 {
  font-size: .8rem;
  color: #f2f6ff;
  margin-bottom: 6px;
}
.artemis3-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.a3-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.a3-badge-official {
  border-color: #4f94ed;
  color: #d8e9ff;
  background: rgba(43, 89, 153, 0.45);
}
.a3-badge-archived {
  border-color: #b0835e;
  color: #ffe8d2;
  background: rgba(110, 74, 40, 0.45);
}
.a3-badge-proxy {
  border-color: #9b7bca;
  color: #efddff;
  background: rgba(82, 58, 126, 0.45);
}
.artemis3-profile-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 7px;
}
.a3-toggle-btn {
  min-width: 100px;
  flex: 1 1 100px;
}
.artemis3-profile-note {
  margin: 0 0 8px;
  color: #d9e7ff;
  font-size: .74rem;
  line-height: 1.35;
}
.artemis3-section + .artemis3-section {
  margin-top: 8px;
}
.a3-list {
  list-style: disc;
  margin-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: .75rem;
  color: #d7e4fd;
}
.a3-timeline {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.a3-timeline-item {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 7px;
  background: rgba(13, 22, 38, 0.75);
}
.a3-timeline-item:focus-visible {
  outline: 2px solid #8fc5ff;
  outline-offset: 1px;
}
.a3-timeline-label {
  font-size: .74rem;
  font-weight: 700;
  color: #e6f0ff;
}
.a3-timeline-detail {
  margin-top: 2px;
  font-size: .73rem;
  color: #c9d8f5;
  line-height: 1.35;
}
.a3-timeline-vehicle {
  margin-top: 2px;
  font-size: .69rem;
  color: #8eb4ef;
}
.a3-landing-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}
.a3-landing-grid li {
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 6px;
  font-size: .72rem;
  color: #dce9ff;
  background: rgba(15, 23, 40, 0.7);
}
.a3-sources {
  margin-top: 8px;
}
.a3-sources > summary {
  cursor: pointer;
  color: #cfe2ff;
  font-size: .76rem;
  font-weight: 600;
}
.a3-sources-grid {
  margin-top: 6px;
  display: grid;
  gap: 8px;
}
.a3-sources-grid h5 {
  font-size: .72rem;
  color: #e8f2ff;
  margin-bottom: 4px;
}
.a3-source-list {
  list-style: disc;
  margin-left: 16px;
  font-size: .73rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.a3-source-list a {
  color: #9fcbff;
  text-decoration: none;
}
.a3-source-list a:hover { text-decoration: underline; }

.artemis5-card h4 {
  font-size: .8rem;
  color: #f2f6ff;
  margin-bottom: 6px;
}
.artemis5-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.a5-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.a5-badge-official {
  border-color: #4f94ed;
  color: #d8e9ff;
  background: rgba(43, 89, 153, 0.45);
}
.a5-badge-archived {
  border-color: #b0835e;
  color: #ffe8d2;
  background: rgba(110, 74, 40, 0.45);
}
.a5-badge-proxy {
  border-color: #9b7bca;
  color: #efddff;
  background: rgba(82, 58, 126, 0.45);
}
.artemis5-profile-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 7px;
}
.a5-toggle-btn {
  min-width: 130px;
  flex: 1 1 130px;
}
.artemis5-profile-note {
  margin: 0 0 8px;
  color: #d9e7ff;
  font-size: .74rem;
  line-height: 1.35;
}
.artemis5-section + .artemis5-section {
  margin-top: 8px;
}
.a5-list {
  list-style: disc;
  margin-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: .75rem;
  color: #d7e4fd;
}
.a5-timeline {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.a5-timeline-item {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 7px;
  background: rgba(13, 22, 38, 0.75);
}
.a5-timeline-item:focus-visible {
  outline: 2px solid #8fc5ff;
  outline-offset: 1px;
}
.a5-timeline-label {
  font-size: .74rem;
  font-weight: 700;
  color: #e6f0ff;
}
.a5-timeline-detail {
  margin-top: 2px;
  font-size: .73rem;
  color: #c9d8f5;
  line-height: 1.35;
}
.a5-timeline-vehicle {
  margin-top: 2px;
  font-size: .69rem;
  color: #8eb4ef;
}
.a5-moonbase-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}
.a5-moonbase-grid li {
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 6px;
  font-size: .72rem;
  color: #dce9ff;
  background: rgba(15, 23, 40, 0.7);
}
.a5-sources {
  margin-top: 8px;
}
.a5-sources > summary {
  cursor: pointer;
  color: #cfe2ff;
  font-size: .76rem;
  font-weight: 600;
}
.a5-sources-grid {
  margin-top: 6px;
  display: grid;
  gap: 8px;
}
.a5-sources-grid h5 {
  font-size: .72rem;
  color: #e8f2ff;
  margin-bottom: 4px;
}
.a5-source-list {
  list-style: disc;
  margin-left: 16px;
  font-size: .73rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.a5-source-list a {
  color: #9fcbff;
  text-decoration: none;
}
.a5-source-list a:hover { text-decoration: underline; }

.slider { -webkit-appearance: none; width: 100%; height: 4px; border-radius: 2px; background: var(--border); outline: none; cursor: pointer; }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); }
.slider::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: none; }

@media (max-width: 860px) {
  #app-main { grid-template-columns: 1fr; grid-template-rows: minmax(360px, 60vw) auto; }
  #sidebar { border-left: none; border-top: 1px solid var(--border); }
  .a3-landing-grid { grid-template-columns: 1fr; }
  .a5-moonbase-grid { grid-template-columns: 1fr; }
  .scene-hud-metrics {
    bottom: 14px;
    gap: 8px;
  }
  .scene-metric {
    width: 84px;
    min-height: 84px;
    padding: 8px 7px;
  }
  .scene-metric-value {
    font-size: .74rem;
  }
  .scene-metric-label {
    margin-top: 5px;
    font-size: .5rem;
    letter-spacing: .06em;
  }
}
