:root {
  --bg: #03070d;
  --bg-soft: #07101a;
  --ink: #f1ede3;
  --ink-soft: rgba(232, 236, 241, 0.72);
  --muted: rgba(169, 184, 201, 0.62);
  --faint: rgba(142, 160, 181, 0.42);
  --line: rgba(215, 228, 244, 0.13);
  --line-soft: rgba(215, 228, 244, 0.07);
  --accent: #e9b36a;
  --accent-rgb: 233, 179, 106;
  --blue: #8fb8e8;
  --blue-rgb: 143, 184, 232;
  --panel: rgba(8, 13, 21, 0.78);
  --panel-deep: rgba(5, 9, 15, 0.92);
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --page-x: 36px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }

.app {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 75% 55% at 56% 42%, rgba(34, 55, 88, 0.24), transparent 72%),
    radial-gradient(ellipse 38% 35% at 76% 25%, rgba(97, 129, 178, 0.1), transparent 70%),
    linear-gradient(160deg, #02050a 0%, #050b14 48%, #02050a 100%);
}

.map-stage { position: absolute; inset: 0; z-index: 1; }
.map-stage canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.map-stage canvas:active { cursor: grabbing; }

.sky-wash {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 45% 55% at 62% 40%, rgba(74, 105, 154, 0.12), transparent 75%),
    radial-gradient(ellipse 25% 30% at 77% 62%, rgba(171, 119, 76, 0.05), transparent 75%);
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(1, 4, 8, 0.58) 0%, rgba(1, 4, 8, 0.24) 24%, transparent 45%),
    linear-gradient(270deg, rgba(1, 4, 8, 0.48) 0%, transparent 34%),
    linear-gradient(180deg, rgba(1, 4, 8, 0.55) 0%, transparent 15%, transparent 84%, rgba(1, 4, 8, 0.45) 100%);
}

.grain {
  position: fixed;
  inset: -30%;
  z-index: 9;
  pointer-events: none;
  opacity: 0.038;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.8'/%3E%3C/svg%3E");
  animation: grain 0.4s steps(2) infinite;
}
@keyframes grain {
  0% { transform: translate3d(0, 0, 0); }
  25% { transform: translate3d(-1%, 1%, 0); }
  50% { transform: translate3d(1%, -1%, 0); }
  75% { transform: translate3d(1%, 1%, 0); }
  100% { transform: translate3d(-1%, -1%, 0); }
}

/* Header ------------------------------------------------------------------ */
.topbar {
  position: fixed;
  z-index: 40;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px var(--page-x) 0;
  pointer-events: none;
}
.topbar a, .topbar button { pointer-events: auto; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}
.brand-mark {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
}
.brand-core {
  position: absolute;
  left: 13px;
  top: 13px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.7);
}
.brand-orbit {
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(206, 224, 243, 0.34);
  border-radius: 50%;
  transform: rotate(-26deg) scaleY(0.58);
}
.brand-orbit--b { inset: 3px 8px; transform: rotate(34deg) scaleY(0.54); border-color: rgba(var(--accent-rgb), 0.3); }
.brand-copy { display: flex; flex-direction: column; gap: 3px; text-align: left; }
.brand-name { font-family: var(--serif); font-size: 17px; letter-spacing: 0.24em; line-height: 1; }
.brand-sub { color: var(--muted); font-family: var(--mono); font-size: 6px; letter-spacing: 0.18em; text-transform: uppercase; }

.topbar-note { display: flex; align-items: center; gap: 12px; color: var(--faint); font-family: var(--mono); font-size: 6.5px; letter-spacing: 0.18em; }
.note-line { width: 44px; height: 1px; background: var(--line); }
.note-roman { color: rgba(var(--accent-rgb), 0.58); }

.top-actions { display: flex; align-items: center; gap: 10px; }
.back-link {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.1em;
  text-decoration: none;
  transition: color 0.25s ease, border-color 0.25s ease;
}
.back-link:hover { color: var(--ink); border-color: rgba(var(--accent-rgb), 0.5); }
.catalog-btn {
  padding: 8px 13px;
  border: 1px solid rgba(var(--accent-rgb), 0.32);
  border-radius: 99px;
  background: rgba(var(--accent-rgb), 0.055);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease;
}
.catalog-btn span { color: var(--accent); }
.catalog-btn:hover { border-color: rgba(var(--accent-rgb), 0.65); background: rgba(var(--accent-rgb), 0.11); }

/* Left rail --------------------------------------------------------------- */
.left-panel {
  position: fixed;
  z-index: 25;
  top: 98px;
  left: var(--page-x);
  width: 312px;
  max-height: calc(100vh - 178px);
  overflow: auto;
  padding: 22px 0 0;
  scrollbar-width: none;
}
.left-panel::-webkit-scrollbar { display: none; }
.eyebrow { display: flex; align-items: center; gap: 10px; margin: 0 0 17px; color: rgba(var(--accent-rgb), 0.8); font-family: var(--mono); font-size: 6.5px; letter-spacing: 0.18em; }
.eyebrow-line { width: 26px; height: 1px; background: rgba(var(--accent-rgb), 0.48); }
.left-panel h1 { margin: 0; font-family: var(--serif); font-size: 48px; font-weight: 400; line-height: 1; letter-spacing: 0.08em; }
.left-panel h1 span { display: block; margin-top: 6px; color: rgba(230, 234, 239, 0.4); font-family: var(--mono); font-size: 7px; letter-spacing: 0.28em; }
.big-count { display: flex; align-items: flex-end; gap: 14px; margin-top: 24px; }
.big-count strong { color: var(--ink); font-family: var(--serif); font-size: 56px; font-weight: 400; line-height: 0.82; letter-spacing: 0.01em; }
.big-count > span { padding-bottom: 3px; color: var(--muted); font-family: var(--mono); font-size: 7px; line-height: 1.9; letter-spacing: 0.08em; }
.big-count i { color: rgba(var(--accent-rgb), 0.8); font-style: normal; }
.intro { max-width: 292px; margin: 17px 0 0; color: var(--muted); font-family: var(--serif); font-size: 12px; line-height: 1.85; }
.intro-note { max-width: 292px; margin: 8px 0 0; color: rgba(185, 200, 216, 0.42); font-size: 8.5px; line-height: 1.75; }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  margin-top: 20px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(6, 11, 18, 0.54);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: border-color 0.25s ease, background 0.25s ease;
}
.search-box:focus-within { border-color: rgba(var(--accent-rgb), 0.5); background: rgba(8, 14, 22, 0.78); }
.search-box svg { width: 14px; height: 14px; fill: none; stroke: var(--faint); stroke-width: 1.4; flex: 0 0 14px; }
.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 10px;
  letter-spacing: 0.04em;
}
.search-box input::placeholder { color: var(--faint); }
.search-clear { display: none; width: 20px; height: 20px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; }
.search-box.has-value .search-clear { display: block; }

.search-results {
  display: none;
  max-height: 260px;
  margin-top: 6px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(6, 11, 18, 0.95);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  padding: 4px;
}
.search-results.is-open { display: block; }
.search-result {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 8px 9px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.search-result:hover, .search-result:focus-visible { background: rgba(var(--accent-rgb), 0.08); outline: none; }
.search-result strong { color: var(--ink-soft); font-size: 10px; font-weight: 400; letter-spacing: 0.03em; }
.search-result span { color: var(--faint); font-family: var(--mono); font-size: 6.5px; letter-spacing: 0.06em; }
.search-empty { padding: 14px 10px; color: var(--faint); font-family: var(--mono); font-size: 7px; letter-spacing: 0.06em; text-align: center; }

.filter-head { display: flex; align-items: baseline; justify-content: space-between; margin-top: 22px; color: var(--faint); font-family: var(--mono); font-size: 6px; letter-spacing: 0.12em; }
.filter-head span:last-child { color: rgba(227, 233, 240, 0.46); }
.filter-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.filter-chip {
  min-height: 25px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: transparent;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.filter-chip:hover { color: var(--ink-soft); border-color: rgba(224, 234, 246, 0.26); }
.filter-chip.is-active { border-color: rgba(var(--accent-rgb), 0.55); background: rgba(var(--accent-rgb), 0.085); color: var(--ink); }

.all-worlds {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 40px;
  margin-top: 22px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(219, 231, 246, 0.025);
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease;
}
.all-worlds:hover { border-color: rgba(var(--accent-rgb), 0.42); background: rgba(var(--accent-rgb), 0.05); }
.all-worlds-arrow { display: grid; place-items: center; width: 23px; height: 23px; border: 1px solid rgba(var(--accent-rgb), 0.25); border-radius: 50%; color: var(--accent); font-size: 11px; }
.source-note { margin: 17px 0 0; color: var(--faint); font-family: var(--mono); font-size: 6px; line-height: 1.9; letter-spacing: 0.03em; }

/* System panel ------------------------------------------------------------ */
.system-panel {
  position: fixed;
  z-index: 34;
  top: 94px;
  right: var(--page-x);
  width: 428px;
  max-height: calc(100vh - 174px);
  padding: 20px 23px 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(155deg, rgba(16, 23, 34, 0.95), rgba(7, 11, 18, 0.94)),
    var(--panel-deep);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  -webkit-backdrop-filter: blur(28px) saturate(120%);
  backdrop-filter: blur(28px) saturate(120%);
  opacity: 0;
  visibility: hidden;
  transform: translateX(20px) scale(0.985);
  transition: opacity 0.38s var(--ease), transform 0.45s var(--ease), visibility 0.38s;
  scrollbar-width: thin;
  scrollbar-color: rgba(219, 229, 243, 0.16) transparent;
}
.system-panel.is-open { opacity: 1; visibility: visible; transform: translateX(0) scale(1); }
.system-panel::-webkit-scrollbar { width: 3px; }
.system-panel::-webkit-scrollbar-thumb { background: rgba(219, 229, 243, 0.16); }
.system-panel::before { content: ""; position: absolute; top: 0; left: 26px; right: 26px; height: 1px; background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.55), transparent); }
.panel-topline {
  position: sticky;
  top: -6px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -6px 0 0;
  padding: 8px 0 10px;
  background: linear-gradient(180deg, rgba(11, 17, 27, 0.98) 65%, rgba(11, 17, 27, 0));
  color: var(--faint);
  font-family: var(--mono);
  font-size: 6px;
  letter-spacing: 0.14em;
}
.panel-close { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.panel-close svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.panel-close:hover { color: var(--ink); border-color: rgba(var(--accent-rgb), 0.45); }
.system-heading { margin-top: 17px; }
.system-type { color: rgba(var(--accent-rgb), 0.75); font-family: var(--mono); font-size: 7px; letter-spacing: 0.13em; }
.system-heading h2 { margin: 7px 0 0; font-family: var(--serif); font-size: 32px; font-weight: 400; letter-spacing: 0.03em; line-height: 1.05; }
.system-heading p { margin: 8px 0 0; color: var(--muted); font-family: var(--mono); font-size: 7px; line-height: 1.7; letter-spacing: 0.03em; }

.orbit-wrap { position: relative; margin: 10px 0 2px; padding: 3px 0 12px; border-bottom: 1px solid var(--line-soft); }
#orbitCanvas { display: block; width: 100%; height: 116px; }
.orbit-caption { position: absolute; right: 2px; bottom: 5px; color: var(--faint); font-family: var(--mono); font-size: 5.5px; letter-spacing: 0.12em; }

.planet-list { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.planet-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 27px;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.planet-row:hover { background: rgba(221, 232, 246, 0.035); }
.planet-row.is-active { border-color: rgba(var(--accent-rgb), 0.26); background: rgba(var(--accent-rgb), 0.055); }
.planet-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dot-color, var(--accent)); box-shadow: 0 0 8px var(--dot-color, var(--accent)); flex: 0 0 6px; }
.planet-row-name { flex: 1; color: var(--ink-soft); font-size: 9.5px; letter-spacing: 0.03em; }
.planet-row-meta { color: var(--faint); font-family: var(--mono); font-size: 6.5px; letter-spacing: 0.03em; }
.planet-row.is-active .planet-row-name { color: var(--ink); }

.planet-detail { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 13px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.planet-detail[hidden] { display: none; }
.portrait-wrap { position: relative; align-self: start; }
#planetPortrait { display: block; width: 88px; height: 88px; border-radius: 50%; box-shadow: 0 0 25px rgba(0, 0, 0, 0.4); }
.portrait-badge { display: block; margin-top: 7px; color: var(--faint); font-family: var(--mono); font-size: 4.8px; line-height: 1.4; letter-spacing: 0.08em; text-align: center; }
.planet-class { color: rgba(var(--accent-rgb), 0.78); font-family: var(--mono); font-size: 6.5px; letter-spacing: 0.1em; }
.planet-info h3 { margin: 5px 0 0; font-family: var(--serif); font-size: 22px; font-weight: 400; line-height: 1.1; letter-spacing: 0.02em; }
.planet-unknown { margin: 8px 0 0; color: var(--muted); font-size: 8.5px; line-height: 1.7; }
.planet-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 13px; margin: 13px 0 0; }
.planet-stat dt { color: var(--faint); font-family: var(--mono); font-size: 5.8px; letter-spacing: 0.06em; }
.planet-stat dd { margin: 3px 0 0; color: var(--ink-soft); font-size: 9px; }
.planet-stat dd em { margin-left: 3px; color: var(--faint); font-family: var(--mono); font-size: 6px; font-style: normal; }
.panel-source { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--line-soft); color: var(--faint); font-family: var(--mono); font-size: 5.8px; letter-spacing: 0.04em; }

/* Map labels / legend ----------------------------------------------------- */
.map-labels { position: fixed; inset: 0; z-index: 12; pointer-events: none; }
.map-label {
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(3, 8, 14, 0.5);
  color: rgba(232, 238, 246, 0.72);
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.25s ease;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.map-label i { width: 3px; height: 3px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 5px var(--accent); }
.map-label.is-visible { opacity: 0.88; }

.map-legend {
  position: fixed;
  z-index: 20;
  left: var(--page-x);
  bottom: 46px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 9px;
  width: 330px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 5.8px;
  letter-spacing: 0.08em;
  pointer-events: none;
}
.legend-caption { flex: 0 0 100%; }
.legend-key { display: inline-flex; align-items: center; gap: 4px; }
.legend-key i { width: 4px; height: 4px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); }
.legend-note { margin-left: auto; color: rgba(199, 215, 232, 0.38); line-height: 1.6; text-align: right; }
.map-footer {
  position: fixed;
  z-index: 20;
  left: var(--page-x);
  right: var(--page-x);
  bottom: 17px;
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 5.5px;
  letter-spacing: 0.12em;
  pointer-events: none;
}
.footer-center { color: rgba(232, 238, 245, 0.36); }

/* Catalog ----------------------------------------------------------------- */
.catalog-modal { position: fixed; inset: 0; z-index: 80; visibility: hidden; pointer-events: none; }
.catalog-modal.is-open { visibility: visible; pointer-events: auto; }
.catalog-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; padding: 0; background: rgba(1, 4, 9, 0.72); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); opacity: 0; transition: opacity 0.35s ease; }
.catalog-modal.is-open .catalog-backdrop { opacity: 1; }
.catalog-panel {
  position: absolute;
  top: 26px;
  bottom: 26px;
  left: 50%;
  display: flex;
  flex-direction: column;
  width: min(1060px, calc(100vw - 60px));
  padding: 24px 27px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(155deg, rgba(15, 22, 33, 0.98), rgba(6, 10, 17, 0.98));
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.62);
  transform: translate(-50%, 18px) scale(0.985);
  opacity: 0;
  transition: opacity 0.35s var(--ease), transform 0.45s var(--ease);
}
.catalog-modal.is-open .catalog-panel { transform: translate(-50%, 0) scale(1); opacity: 1; }
.catalog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.catalog-head .eyebrow { margin-bottom: 10px; }
.catalog-head h2 { margin: 0; font-family: var(--serif); font-size: 35px; font-weight: 400; letter-spacing: 0.05em; }
.catalog-sub { margin: 8px 0 0; color: var(--faint); font-family: var(--mono); font-size: 6.5px; letter-spacing: 0.05em; }
.catalog-tools { display: flex; align-items: center; gap: 13px; margin-top: 18px; }
.search-box--catalog { flex: 0 1 300px; height: 34px; margin: 0; }
.catalog-filter { display: flex; flex-wrap: wrap; gap: 4px; }
.catalog-filter .filter-chip { min-height: 23px; padding: 0 8px; font-size: 7.5px; }
.catalog-table-head { display: grid; grid-template-columns: 1.4fr 1.2fr 0.6fr 0.7fr 0.8fr 0.55fr; gap: 10px; margin-top: 18px; padding: 0 9px 8px; border-bottom: 1px solid var(--line); color: var(--faint); font-family: var(--mono); font-size: 5.8px; letter-spacing: 0.08em; }
.catalog-table { flex: 1; overflow: auto; scrollbar-width: thin; scrollbar-color: rgba(219, 229, 243, 0.15) transparent; }
.catalog-row {
  display: grid;
  grid-template-columns: 1.4fr 1.2fr 0.6fr 0.7fr 0.8fr 0.55fr;
  gap: 10px;
  width: 100%;
  padding: 9px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--ink-soft);
  font-size: 8.5px;
  text-align: left;
  cursor: pointer;
}
.catalog-row:hover { background: rgba(var(--accent-rgb), 0.05); }
.catalog-row span:nth-child(n + 3) { color: var(--muted); font-family: var(--mono); font-size: 7px; }
.catalog-row strong { font-weight: 400; color: var(--ink); }
.catalog-pager { display: flex; align-items: center; justify-content: space-between; padding-top: 13px; color: var(--faint); font-family: var(--mono); font-size: 6.5px; letter-spacing: 0.05em; }
.catalog-pager > div { display: flex; align-items: center; gap: 12px; }
.catalog-pager button { width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.catalog-pager button:disabled { opacity: 0.24; cursor: default; }

/* Loader ------------------------------------------------------------------ */
.loader { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: #03070d; opacity: 1; visibility: visible; transition: opacity 0.9s var(--ease), visibility 0.9s; }
.loader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-inner { display: flex; flex-direction: column; align-items: center; width: min(300px, calc(100vw - 56px)); text-align: center; }
.loader-orbit { position: relative; width: 112px; height: 112px; margin-bottom: 33px; }
.loader-star { position: absolute; left: 49px; top: 49px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 28px rgba(var(--accent-rgb), 0.75); }
.loader-ring { position: absolute; inset: 14px; border: 1px solid rgba(203, 223, 242, 0.2); border-radius: 50%; transform: rotate(-24deg) scaleY(0.45); }
.loader-planet { position: absolute; top: 29px; left: 69px; width: 5px; height: 5px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 9px var(--blue); animation: loaderOrbit 6s linear infinite; transform-origin: -14px 27px; }
@keyframes loaderOrbit { to { transform: rotate(360deg); } }
.loader-brand { margin: 0; font-family: var(--serif); font-size: 21px; letter-spacing: 0.32em; }
.loader-sub { margin: 9px 0 0; color: var(--faint); font-family: var(--mono); font-size: 6.5px; letter-spacing: 0.2em; }
.loader-label { margin: 37px 0 0; color: var(--muted); font-family: var(--mono); font-size: 6.5px; letter-spacing: 0.1em; }
.loader-track { width: 100%; height: 1px; margin-top: 14px; background: rgba(215, 229, 243, 0.12); overflow: hidden; }
.loader-track span { display: block; width: 0%; height: 100%; background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.15), var(--accent)); box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.5); transition: width 0.3s ease; }
.loader-meta { display: flex; justify-content: space-between; width: 100%; margin-top: 8px; color: var(--faint); font-family: var(--mono); font-size: 5.5px; letter-spacing: 0.1em; }

/* Orientation gate -------------------------------------------------------- */
.orientation-gate { position: fixed; inset: 0; z-index: 120; display: none; align-items: center; justify-content: center; padding: 24px; background: #03070d; text-align: center; }
.orientation-gate.is-forced { display: flex; }
.orientation-inner { max-width: 370px; }
.orientation-brand { color: var(--faint); font-family: var(--mono); font-size: 7px; letter-spacing: 0.24em; }
.rotate-device { position: relative; width: 68px; height: 94px; margin: 27px auto 25px; }
.rotate-phone { position: absolute; inset: 8px 15px; border: 1px solid rgba(220, 232, 245, 0.4); border-radius: 11px; }
.rotate-phone::after { content: ""; position: absolute; left: 50%; bottom: 7px; width: 11px; height: 1px; background: rgba(220, 232, 245, 0.35); transform: translateX(-50%); }
.rotate-arrow { position: absolute; top: 0; right: 1px; width: 21px; height: 21px; border-top: 1px solid var(--accent); border-right: 1px solid var(--accent); transform: rotate(-20deg); }
.rotate-arrow::after { content: ""; position: absolute; top: -3px; right: -3px; width: 5px; height: 5px; border-top: 1px solid var(--accent); border-right: 1px solid var(--accent); }
.orientation-inner .eyebrow { justify-content: center; margin-bottom: 17px; }
.orientation-inner h2 { margin: 0; font-family: var(--serif); font-size: 39px; font-weight: 400; letter-spacing: 0.08em; }
.orientation-inner > p:not(.eyebrow) { margin: 17px 0 0; color: var(--muted); font-size: 11px; line-height: 1.9; }
.orientation-inner button { margin-top: 26px; border: 0; background: transparent; color: var(--faint); font-family: var(--mono); font-size: 7px; letter-spacing: 0.08em; text-decoration: underline; text-underline-offset: 5px; cursor: pointer; }

.toast { position: fixed; z-index: 90; left: 50%; bottom: 74px; max-width: calc(100vw - 32px); padding: 9px 15px; border: 1px solid var(--line); border-radius: 99px; background: rgba(8, 13, 21, 0.95); color: var(--ink-soft); font-size: 8px; letter-spacing: 0.04em; opacity: 0; transform: translate(-50%, 8px); pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.noscript { position: fixed; inset: 0; z-index: 999; display: grid; place-items: center; padding: 30px; background: #03070d; color: var(--ink); text-align: center; }

/* Responsive -------------------------------------------------------------- */
@media (max-width: 1180px) {
  :root { --page-x: 24px; }
  .topbar-note { display: none; }
  .left-panel { width: 284px; }
  .left-panel h1 { font-size: 42px; }
  .big-count strong { font-size: 49px; }
  .system-panel { width: 390px; }
}

@media (max-width: 820px) {
  :root { --page-x: 14px; }
  .topbar { padding-top: 14px; }
  .brand-mark { width: 29px; height: 29px; flex-basis: 29px; }
  .brand-core { left: 11px; top: 11px; width: 7px; height: 7px; }
  .brand-name { font-size: 14px; }
  .brand-sub { font-size: 5px; }
  .top-actions { gap: 6px; }
  .back-link { padding: 7px 10px; font-size: 6px; }
  .back-link span { display: none; }
  .catalog-btn { padding: 7px 9px; font-size: 6px; }
  .catalog-btn span { display: none; }

  .left-panel {
    top: 61px;
    left: 10px;
    right: 10px;
    width: auto;
    max-height: 238px;
    padding: 13px 13px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: linear-gradient(155deg, rgba(10, 16, 25, 0.88), rgba(6, 10, 17, 0.82));
    -webkit-backdrop-filter: blur(18px) saturate(120%);
    backdrop-filter: blur(18px) saturate(120%);
    overflow: visible;
  }
  .left-panel .eyebrow, .left-panel .intro, .left-panel .intro-note, .left-panel .source-note, .left-panel .all-worlds { display: none; }
  .left-panel h1 { font-size: 27px; letter-spacing: 0.06em; }
  .left-panel h1 span { display: inline; margin-left: 8px; font-size: 5.5px; letter-spacing: 0.12em; }
  .big-count { position: absolute; top: 13px; right: 13px; display: block; margin: 0; text-align: right; }
  .big-count strong { font-size: 22px; line-height: 1; }
  .big-count > span { display: block; padding: 2px 0 0; font-size: 5px; line-height: 1.5; }
  .search-box { height: 32px; margin-top: 10px; }
  .search-box input { font-size: 9px; }
  .search-results { position: absolute; top: 83px; left: 13px; right: 13px; z-index: 4; max-height: 185px; }
  .filter-head { margin-top: 10px; }
  .filter-row { flex-wrap: nowrap; gap: 4px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .filter-row::-webkit-scrollbar { display: none; }
  .filter-chip { flex: 0 0 auto; min-height: 22px; padding: 0 8px; font-size: 7px; }

  .system-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: min(76vh, 660px);
    padding: 17px 18px max(18px, env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    transform: translateY(30px) scale(0.99);
  }
  .system-panel.is-open { transform: translateY(0) scale(1); }
  .system-heading h2 { font-size: 27px; }
  .orbit-wrap { padding-bottom: 13px; }
  #orbitCanvas { height: 106px; }
  .planet-detail { grid-template-columns: 76px minmax(0, 1fr); gap: 12px; }
  #planetPortrait { width: 76px; height: 76px; }
  .planet-info h3 { font-size: 19px; }
  .planet-unknown { font-size: 8px; }
  .planet-stats { gap: 8px 10px; }
  .map-legend { left: 14px; bottom: 31px; width: 292px; gap: 4px 8px; font-size: 4.7px; }
  .legend-note { display: none; }
  .map-footer { left: 14px; right: 14px; bottom: 11px; font-size: 4.6px; }
  .footer-center { display: none; }
  .catalog-panel { top: 12px; bottom: 12px; width: calc(100vw - 20px); padding: 17px 14px 13px; border-radius: 13px; }
  .catalog-head h2 { font-size: 26px; }
  .catalog-sub { font-size: 5.5px; }
  .catalog-tools { display: block; margin-top: 12px; }
  .search-box--catalog { width: 100%; margin: 0 0 7px; }
  .catalog-filter { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .catalog-filter .filter-chip { flex: 0 0 auto; min-height: 22px; font-size: 7px; }
  .catalog-table-head { display: none; }
  .catalog-row { grid-template-columns: 1.35fr 1fr 0.55fr; gap: 7px; padding: 8px 4px; font-size: 8px; }
  .catalog-row span:nth-child(4), .catalog-row span:nth-child(5), .catalog-row span:nth-child(6) { display: none; }
  .catalog-pager { padding-top: 9px; }
  .toast { bottom: 88px; }
  body.is-system-open .left-panel { opacity: 0; pointer-events: none; transform: translateY(-8px); }
}

@media (max-width: 380px) {
  .left-panel h1 { font-size: 23px; }
  .big-count strong { font-size: 19px; }
  .big-count > span { font-size: 4.5px; }
  .brand-sub { display: none; }
}

@media (orientation: landscape) and (max-height: 560px) and (max-width: 1000px) and (hover: none) and (pointer: coarse) {
  .orientation-gate:not(.is-dismissed) { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

