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

:root {
  --bg: #000000;
  --bg2: rgba(0, 0, 0, 0.85);
  --bg3: rgba(10, 10, 10, 0.9);
  --border: rgba(255, 255, 255, 0.08);
  --text: #999999;
  --text-dim: #555555;
  --white: #ffffff;
  --red: #FF0000;
  --accent: #ffffff;
  --accent-dim: rgba(255, 255, 255, 0.08);
  --font-mono: 'OCR-A', 'Microgramma', 'SF Mono', 'Fira Code', monospace;
  --font-ui: 'Univers Next Pro', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  overflow: hidden;
  cursor: grab;
}
body:active { cursor: grabbing; }

/* ── Reveal ────────────────────────────────────────────────────────────── */
#reveal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: revealFade 1.5s ease-in 2.5s forwards;
  pointer-events: none;
}
#reveal-logo {
  width: min(50vw, 400px);
  height: auto;
  animation: revealLogoIn 1.2s ease-out 0.3s both;
  filter: brightness(0) invert(1);
}
#reveal-sub {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.5em;
  color: #555;
  margin-top: 20px;
  animation: revealSubIn 1s ease-out 1s both;
}

@keyframes revealLogoIn {
  from { opacity: 0; transform: scale(0.8); filter: brightness(0) invert(1) blur(20px); }
  to   { opacity: 1; transform: scale(1); filter: brightness(0) invert(1) blur(0); }
}
@keyframes revealSubIn {
  from { opacity: 0; letter-spacing: 1em; }
  to   { opacity: 1; letter-spacing: 0.5em; }
}
@keyframes revealFade {
  to { opacity: 0; visibility: hidden; }
}

#globe {
  position: fixed;
  inset: 0;
  z-index: 0;
}

canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ── UI Overlay ─────────────────────────────────────────────────────────── */
#ui {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  animation: uiFadeIn 1s ease-out 3.5s forwards;
}
@keyframes uiFadeIn {
  to { opacity: 1; }
}

#ui > * {
  pointer-events: auto;
}

/* ── Top Bar ────────────────────────────────────────────────────────────── */
#top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 24px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
}

#logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
#logo-svg {
  height: 16px;
  width: auto;
  filter: brightness(0) invert(1);
}
#logo .dim {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--text-dim);
}

#search-wrap {
  flex: 1;
  max-width: 320px;
}

#search {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 8px 14px;
  border-radius: 0;
  outline: none;
  transition: border-color 0.2s;
}
#search:focus { border-color: var(--white); }
#search::placeholder { color: var(--text-dim); }

#stats {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
}
#stats .dim { color: var(--text-dim); }

/* ── Categories ─────────────────────────────────────────────────────────── */
#categories {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  background: var(--bg3);
  border: 1px solid var(--border);
  padding: 3px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.cat-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.cat-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.cat-btn.active {
  color: var(--white);
  background: rgba(255, 255, 255, 0.1);
}

/* ── Info Panel ──────────────────────────────────────────────────────────── */
#panel {
  position: absolute;
  top: 70px;
  right: 24px;
  width: 300px;
  background: var(--bg3);
  border: 1px solid var(--border);
  padding: 20px;
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  transition: opacity 0.25s, transform 0.25s;
}
#panel.hidden {
  opacity: 0;
  transform: translateX(20px);
  pointer-events: none;
}

#panel-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
#panel-close:hover { color: var(--white); }

#sat-image-wrap {
  width: 100%;
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--bg);
  display: none;
}
#sat-image-wrap img {
  width: 100%;
  display: block;
  opacity: 0.9;
}

#sat-name {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 400;
  color: var(--white);
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  padding-right: 20px;
  text-transform: uppercase;
}

.meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

.data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.data-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.data-value {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--white);
  word-break: break-word;
}

.data-grid + .divider + .data-grid .data-value {
  color: var(--text);
}

#sat-tle {
  font-size: 9px;
  color: var(--text-dim);
  line-height: 1.6;
  word-break: break-all;
}

.mono { font-family: var(--font-mono); }

/* ── Search Results ──────────────────────────────────────────────────────── */
#search-results {
  position: absolute;
  top: 54px;
  left: 24px;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg3);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
#search-results.hidden { display: none; }

.search-item {
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--border);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: rgba(255, 255, 255, 0.04); }
.search-item-name {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--white);
}
.search-item-id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
}

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 0; }

/* ── Mobile ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #top-bar {
    padding: 10px 12px;
    gap: 8px;
  }
  #logo-svg { height: 12px; }
  #logo .dim { font-size: 8px; }
  #search-wrap { max-width: 160px; }
  #search { font-size: 10px; padding: 6px 10px; }
  #stats { font-size: 10px; }

  #categories {
    bottom: 12px;
    gap: 1px;
    padding: 2px;
    max-width: calc(100vw - 16px);
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  .cat-btn {
    font-size: 8px;
    padding: 5px 8px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  #panel {
    top: auto;
    bottom: 60px;
    right: 8px;
    left: 8px;
    width: auto;
    max-height: 50vh;
    overflow-y: auto;
    padding: 14px;
  }

  #search-results {
    top: 46px;
    left: 12px;
    width: calc(100vw - 24px);
    max-height: 300px;
  }

  #sat-name { font-size: 12px; }
  .data-grid { gap: 8px; }
  .data-value { font-size: 11px; }

  #reveal-logo { width: 70vw; }
}
