/* Orbital Atlas — sci-fi HUD theme */
:root {
  --bg-0: #02060a;
  --bg-1: #0a1a24;
  --panel: rgba(13, 27, 38, 0.82);
  --panel-border: rgba(63, 208, 224, 0.28);
  --accent: #3fd0e0;
  --accent-strong: #5fe0ee;
  --text: #eaf4f8;
  --text-dim: #8fa8b8;
  --text-faint: #5c7484;
  --star: #ffffff;
  --sun: #f5b45a;
  --font: "Segoe UI", "Inter", system-ui, -apple-system, Roboto, sans-serif;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

#app, .universe-page { position: relative; width: 100%; height: 100%; }

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}
#scene:active { cursor: grabbing; }

.universe-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 20% 0%, rgba(63, 208, 224, 0.10), transparent 55%),
    radial-gradient(140% 120% at 50% 50%, transparent 60%, rgba(0, 0, 0, 0.55) 100%);
}

/* ---------- Top bar ---------- */
.universe-topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 22px;
  pointer-events: none;
  z-index: 10;
}
.universe-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}
.brand-mark { color: var(--accent); }
.brand-name {
  display: flex;
  flex-direction: column;
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 13px;
  line-height: 1.1;
}
.brand-name small {
  font-weight: 400;
  letter-spacing: 0.08em;
  font-size: 9px;
  color: var(--text-faint);
  text-transform: uppercase;
}
.universe-context {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}
.universe-context span {
  display: block;
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.universe-context h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.topbar-actions {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

/* ---------- Buttons ---------- */
.hud-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 9px;
  border: 1px solid var(--panel-border);
  background: rgba(13, 27, 38, 0.6);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
  backdrop-filter: blur(6px);
  text-decoration: none;
}
.hud-button:hover { background: rgba(20, 40, 54, 0.85); border-color: var(--accent); }
.hud-button:active { transform: translateY(1px); }
.hud-button.icon { padding: 9px; }
.hud-button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #04222a;
  font-weight: 600;
}
.hud-button.primary:hover { background: var(--accent-strong); }
.hud-button.outline { background: rgba(13, 27, 38, 0.6); }
.hud-button.block { width: 100%; justify-content: center; }

.fab {
  position: absolute;
  right: 22px;
  bottom: 22px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  justify-content: center;
  padding: 0;
  background: var(--accent);
  border-color: var(--accent);
  color: #04222a;
  z-index: 10;
  box-shadow: 0 4px 18px rgba(63, 208, 224, 0.35);
}
.fab:hover { background: var(--accent-strong); }

.scale-back {
  position: absolute;
  left: 22px;
  bottom: 22px;
  z-index: 10;
}
.scale-back[hidden] { display: none; }

/* ---------- Loading ---------- */
.universe-scene-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-dim);
  font-size: 13px;
  letter-spacing: 0.06em;
  z-index: 5;
  transition: opacity .6s;
}
.universe-scene-state.hidden { opacity: 0; pointer-events: none; }
.universe-scene-state[hidden] { display: none; }
.loading-orbit { animation: spin 2.4s linear infinite; color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Details card ---------- */
.universe-details {
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  width: 300px;
  max-width: calc(100vw - 44px);
  padding: 20px;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  backdrop-filter: blur(10px);
  z-index: 10;
  animation: fadeIn .4s ease;
}
.universe-details[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-50%) translateX(12px); } to { opacity: 1; transform: translateY(-50%) translateX(0); } }

.hud-kicker {
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.universe-details h2 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: 0.01em;
}
.details-description {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.source-note {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.5;
  margin-bottom: 8px;
}
.universe-source {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text);
  margin-bottom: 4px;
}
.universe-source svg { color: var(--accent); }
.details-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.details-actions .hud-button { flex: 1; justify-content: center; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 10, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  animation: fadeInBackdrop .25s ease;
}
.modal-backdrop[hidden] { display: none; }
@keyframes fadeInBackdrop { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 420px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  overflow: auto;
  border-radius: 16px;
  border: 1px solid var(--panel-border);
  background: rgba(9, 20, 29, 0.96);
  padding: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.modal-head h3 {
  font-size: 18px;
  letter-spacing: 0.12em;
  margin-bottom: 4px;
}
.modal-sub { font-size: 12px; color: var(--text-dim); }
.modal-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--panel-border);
  margin-bottom: 18px;
}
.tab {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 13px;
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .25s ease; }
.panel-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 10px;
}
.segmented {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}
.seg {
  flex: 1;
  padding: 9px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: rgba(13, 27, 38, 0.5);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.seg.active { background: var(--accent); border-color: var(--accent); color: #04222a; font-weight: 600; }
.modal-actions { display: flex; flex-direction: column; gap: 8px; }

#search {
  width: 100%;
  padding: 11px 13px;
  border-radius: 9px;
  border: 1px solid var(--panel-border);
  background: rgba(13, 27, 38, 0.6);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
#search:focus { border-color: var(--accent); }
#search::placeholder { color: var(--text-faint); }
.results-count { font-size: 11px; color: var(--text-faint); margin: 8px 0; }
.search-results { max-height: 300px; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.search-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 9px 11px;
  border-radius: 8px;
  border: none;
  background: none;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.search-item:hover { background: rgba(63, 208, 224, 0.12); }
.search-item .name { font-size: 13px; font-weight: 500; }
.search-item .path { font-size: 11px; color: var(--text-faint); }

.settings-list { display: flex; flex-direction: column; }
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 4px;
  border: none;
  border-bottom: 1px solid rgba(63, 208, 224, 0.12);
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.setting-row:hover { color: var(--accent); }
.setting-value { color: var(--text-faint); font-size: 12px; }

.about-text { font-size: 13px; line-height: 1.6; color: var(--text-dim); margin-bottom: 10px; }
.about-text.muted { color: var(--text-faint); font-size: 12px; }
.modal h4 { font-size: 16px; margin-bottom: 8px; }

/* ---------- Guide ---------- */
.guide {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  background: rgba(9, 20, 29, 0.7);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 16px;
  z-index: 9;
  pointer-events: none;
  backdrop-filter: blur(6px);
}
.guide .muted { color: var(--text-faint); font-size: 11px; margin-top: 3px; }
.guide[hidden] { display: none; }

/* ---------- Explorer deck ---------- */
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.universe-topbar { padding: 25px 30px; background: linear-gradient(#02060ab3, transparent); }
.brand-name small { margin-top: 6px; color: var(--text-dim); }
.universe-context { padding: 8px 28px; border: 1px solid #ffffff14; border-radius: 30px; background: #09141d80; backdrop-filter: blur(12px); }
.universe-context span { color: var(--accent); }
.explore-dock { position: absolute; left: 30px; top: 50%; transform: translateY(-50%); width: 285px; z-index: 8; }
.dock-heading { display: flex; align-items: center; gap: 8px; color: var(--accent); font-size: 9px; letter-spacing: .13em; }
.live-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px #3fd0e080; }
.dock-number { margin-left: auto; color: var(--text-faint); }
.explore-dock h2 { font-size: 38px; font-weight: 400; line-height: 1.15; letter-spacing: -.04em; margin: 22px 0 16px; }
.explore-dock h2 em { font-style: normal; color: var(--accent); }
.explore-dock > p { font-size: 12px; color: var(--text-dim); line-height: 1.8; }
.dock-search { width: 100%; justify-content: space-between; margin: 23px 0 28px; padding: 13px 15px; }
kbd { font: inherit; color: var(--text-dim); border: 1px solid #ffffff25; padding: 0 6px; border-radius: 4px; }
.destination-label { font-size: 9px; letter-spacing: .18em; color: var(--text-faint); margin-bottom: 10px; }
.destinations { display: grid; gap: 7px; }
.destination { display: flex; align-items: center; gap: 15px; width: 100%; text-align: left; padding: 12px 15px; border-radius: 12px; border: 1px solid #ffffff12; background: linear-gradient(110deg, #152a36b3, #09131d80); backdrop-filter: blur(12px); color: var(--text); cursor: pointer; font: 500 13px var(--font); transition: border-color .2s, transform .2s; }
.destination:hover { border-color: var(--accent); transform: translateX(4px); }
.destination small { display: block; color: var(--text-dim); font-size: 10px; margin-top: 4px; font-weight: 400; }
.destination-arrow { margin-left: auto; color: var(--text-faint); }
.mini-planet { width: 29px; height: 29px; flex-shrink: 0; border-radius: 50%; box-shadow: inset -9px -4px 10px #000b, 0 0 18px #3fd0e016; }
.mini-planet.earth { background: radial-gradient(ellipse at 35% 30%, #a4d4cc 0 12%, transparent 14%), radial-gradient(ellipse at 50% 65%, #648e64 0 22%, transparent 25%), #387aa6; }
.mini-planet.mars { background: radial-gradient(ellipse at 30% 40%, #9e5037 0 20%, transparent 24%), #d18d65; }
.mini-planet.saturn { position: relative; background: repeating-linear-gradient(12deg, #b8a37c 0 4px, #d8c5a2 5px 8px); }
.mini-planet.saturn::after { content: ''; position: absolute; inset: 8px -8px; border: 3px solid #c8b791aa; border-radius: 50%; transform: rotate(-25deg); }
.flight-status { position: absolute; left: 30px; bottom: 30px; display: flex; align-items: center; gap: 9px; color: var(--text-dim); font-size: 9px; letter-spacing: .12em; pointer-events: none; }
.flight-status > span:last-child { margin-left: 22px; color: var(--text-faint); }
body[data-view]:not([data-view="universe"]) .flight-status { display: none; }
body[data-view="planet"] .explore-dock { display: none; }
.universe-details { border-color: #ffffff26; box-shadow: 0 24px 80px #0006; background: linear-gradient(145deg, #152a36e6, #08121ee6); }
.tab-panel.active { animation: fadeInBackdrop .25s ease; }
@media (max-width: 1000px) {
  .explore-dock { width: 225px; left: 20px; }
  .explore-dock h2 { font-size: 31px; }
  .flight-status > span:last-child { display: none; }
}
@media (max-width: 720px) {
  .universe-topbar { padding: 18px; }
  .explore-dock { top: auto; bottom: 85px; left: 16px; right: 16px; width: auto; transform: none; }
  .dock-heading, .explore-dock h2, .explore-dock > p, .destination-label { display: none; }
  .dock-search { margin: 0 0 9px; background: #09141dd9; }
  .destinations { grid-template-columns: repeat(3, 1fr); }
  .destination { padding: 12px 8px; gap: 8px; font-size: 11px; }
  .destination small, .destination-arrow { display: none; }
  .mini-planet { width: 21px; height: 21px; }
  .flight-status { left: 18px; bottom: 33px; font-size: 8px; }
  .guide { bottom: 210px; width: calc(100% - 32px); }
  .universe-details { max-height: calc(100dvh - 180px); overflow: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .universe-details {
    right: 12px;
    left: 12px;
    top: auto;
    bottom: 84px;
    transform: none;
    width: auto;
    animation: none;
  }
  .universe-context { display: none; }
  .brand-name { font-size: 11px; }
  .scale-back span { display: none; }
  .scale-back { padding: 9px; }
}
