* {
  box-sizing: border-box;
}

:root {
  --bg-0: #05060f;
  --bg-1: #0b0e24;
  --card: rgba(18, 22, 48, 0.72);
  --card-border: rgba(120, 140, 255, 0.18);
  --text: #e9ecff;
  --muted: #9aa3d0;
  --accent: #7c9bff;
  --accent-2: #c58bff;
  --glow: rgba(124, 155, 255, 0.45);
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Segoe UI', 'SN Pro', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 80% -10%, #1b1442 0%, transparent 60%),
    radial-gradient(900px 600px at -10% 30%, #08203f 0%, transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0) 60%);
  overflow-x: hidden;
}

#starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.hero,
.sidebar,
.catalog,
.footer {
  position: relative;
  z-index: 1;
}

/* ---------- hero ---------- */
.hero {
  max-width: 960px;
  margin: 0 auto;
  padding: 64px 20px 24px;
  text-align: center;
}

.hero__badge {
  display: inline-block;
  padding: 6px 16px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: rgba(124, 155, 255, 0.08);
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero__title {
  margin: 22px 0 10px;
  font-size: clamp(40px, 8vw, 76px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-shadow: 0 0 40px var(--glow);
}

.accent {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__lead {
  margin: 0 auto;
  max-width: 560px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.controls {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
  padding: 12px 18px;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: rgba(10, 13, 34, 0.8);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(124, 155, 255, 0.15);
}

.search input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
}

.search input::placeholder {
  color: #6b74a8;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.chip {
  padding: 8px 16px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: rgba(18, 22, 48, 0.6);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.chip:hover {
  color: var(--text);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.chip.active {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #0a0c1d;
  font-weight: 700;
}

.counter {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- layout + sidebar ---------- */
.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px 40px;
  display: grid;
  grid-template-columns: 232px 1fr;
  gap: 26px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 18px;
  padding: 18px 14px;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  background: rgba(13, 16, 40, 0.75);
  backdrop-filter: blur(10px);
}

.sidebar__label {
  margin: 0 0 12px 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.side-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  font-size: 14.5px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}

.side-btn:hover {
  color: var(--text);
  background: rgba(124, 155, 255, 0.1);
  border-color: var(--card-border);
  transform: translateX(3px);
}

.side-btn.active {
  background: linear-gradient(90deg, rgba(124, 155, 255, 0.25), rgba(197, 139, 255, 0.18));
  border-color: var(--accent);
  color: var(--text);
  font-weight: 700;
}

.side-btn__icon {
  font-size: 18px;
  line-height: 1;
}

.side-btn__name {
  flex: 1;
}

.side-btn__count {
  min-width: 26px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(10, 13, 34, 0.7);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.side-btn.active .side-btn__count {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #0a0c1d;
  font-weight: 700;
}

/* ---------- grid ---------- */
.catalog {
  min-width: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 26px 18px 22px;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  background: var(--card);
  backdrop-filter: blur(8px);
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
  animation: fadeUp 0.5s both;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(240px 140px at 50% 0%, rgba(124, 155, 255, 0.18), transparent 70%);
  opacity: 0;
  transition: opacity 0.25s;
}

.card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5), 0 0 24px rgba(124, 155, 255, 0.2);
}

.card:hover::before {
  opacity: 1;
}

.card__tag {
  position: relative;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(197, 139, 255, 0.15);
  color: var(--accent-2);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card__name {
  position: relative;
  margin: 6px 0 0;
  font-size: 19px;
  font-weight: 700;
}

.card__sub {
  position: relative;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.empty {
  text-align: center;
  color: var(--muted);
  font-size: 17px;
  padding: 60px 0;
}

/* ---------- planet art ---------- */
.art {
  position: relative;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, var(--c-a), var(--c-b) 62%, var(--c-c));
  box-shadow:
    inset -14px -12px 30px rgba(0, 0, 0, 0.55),
    0 0 26px var(--glow-color, rgba(255, 255, 255, 0.25));
  transition: transform 0.4s;
}

.card:hover .art {
  transform: scale(1.08) rotate(4deg);
}

.art--star {
  animation: pulse 3s ease-in-out infinite;
}

.art--ring::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 168%;
  height: 44%;
  border: 5px solid rgba(214, 190, 140, 0.75);
  border-radius: 50%;
  transform: translate(-50%, -50%) rotate(-18deg);
  box-shadow: 0 0 14px rgba(214, 190, 140, 0.4);
  pointer-events: none;
}

.art--ring.art--small::after {
  width: 150%;
  height: 40%;
}

.art--galaxy {
  background:
    radial-gradient(circle at 50% 50%, #fff7d6 0%, #ffd98a 12%, rgba(140, 120, 255, 0.75) 38%, rgba(40, 30, 90, 0.9) 70%, transparent 78%),
    radial-gradient(circle at 50% 50%, transparent 40%, rgba(160, 140, 255, 0.35) 55%, transparent 70%);
  box-shadow: 0 0 40px rgba(150, 120, 255, 0.45);
}

.art--nebula {
  background:
    radial-gradient(circle at 35% 40%, rgba(255, 120, 190, 0.95), transparent 55%),
    radial-gradient(circle at 68% 62%, rgba(90, 200, 255, 0.9), transparent 55%),
    radial-gradient(circle at 55% 30%, rgba(180, 120, 255, 0.85), transparent 60%),
    #14082b;
  filter: blur(0.4px);
}

.art--hole {
  background: radial-gradient(circle at 50% 50%, #000 0 46%, #ffb347 50%, #ff6a00 57%, rgba(120, 40, 160, 0.5) 68%, transparent 78%);
  box-shadow: 0 0 34px rgba(255, 140, 60, 0.55);
}

.art--small {
  width: 78px;
  height: 78px;
}

/* реалистичный SVG-арт */
.art--svg {
  background: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}

.art--svg svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 0 18px var(--glow-color, rgba(255, 255, 255, 0.25)));
  transition: transform 0.4s;
}

.card:hover .art--svg svg {
  transform: scale(1.08) rotate(3deg);
}

@media (max-width: 880px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .sidebar {
    position: static;
    padding: 12px;
  }

  .sidebar__label {
    display: none;
  }

  .side-nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .side-btn {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
  }

  .side-btn:hover {
    transform: none;
  }
}

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 4, 12, 0.78);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.25s both;
}

.modal__dialog {
  position: relative;
  width: min(880px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--card-border);
  border-radius: 24px;
  background: linear-gradient(160deg, #12163a, #0a0d22);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), 0 0 60px rgba(124, 155, 255, 0.12);
  animation: popIn 0.3s both;
}

.modal__close,
.modal__nav {
  position: absolute;
  z-index: 2;
  border: 1px solid var(--card-border);
  border-radius: 50%;
  background: rgba(10, 13, 34, 0.85);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.modal__close {
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  font-size: 16px;
}

.modal__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  font-size: 28px;
  line-height: 1;
}

.modal__nav--prev { left: 10px; }
.modal__nav--next { right: 10px; }

.modal__close:hover,
.modal__nav:hover {
  background: var(--accent);
  color: #0a0c1d;
  border-color: transparent;
}

.modal__body {
  padding: 44px 56px 40px;
}

.modal__head {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.modal__head .art {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}

.modal__title {
  margin: 8px 0 4px;
  font-size: clamp(26px, 4vw, 38px);
}

.modal__sub {
  margin: 0;
  color: var(--accent);
  font-size: 15px;
}

.modal__desc {
  margin: 24px 0;
  color: #c6cbef;
  line-height: 1.7;
  font-size: 16px;
}

.modal__subtitle {
  margin: 0 0 12px;
  font-size: 18px;
}

.modal__hint {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.modal__close[disabled],
.modal__nav[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin: 0 0 24px;
  padding: 0;
}

.facts div {
  padding: 12px 14px;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: rgba(124, 155, 255, 0.07);
}

.facts dt {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.facts dd {
  margin: 6px 0 0;
  font-size: 16px;
  font-weight: 700;
}

.wow {
  margin: 0;
  padding: 18px 18px 18px 42px;
  border: 1px dashed rgba(197, 139, 255, 0.45);
  border-radius: 16px;
  background: rgba(197, 139, 255, 0.08);
}

.wow li {
  margin: 8px 0;
  line-height: 1.55;
  font-size: 15px;
}

.wow li::marker {
  content: '🚀 ';
}

/* ---------- footer ---------- */
.footer {
  padding: 40px 20px 48px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- animations ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.94) translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes pulse {
  0%, 100% { box-shadow: inset -14px -12px 30px rgba(0, 0, 0, 0.4), 0 0 26px var(--glow-color); }
  50% { box-shadow: inset -14px -12px 30px rgba(0, 0, 0, 0.4), 0 0 48px var(--glow-color); }
}

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .modal__body { padding: 56px 24px 32px; }
  .modal__nav { width: 38px; height: 38px; font-size: 22px; }
  .modal__head { justify-content: center; text-align: center; }
}
