:root {
  color-scheme: dark;
  --bg: #020409;
  --panel: rgba(8, 14, 28, 0.64);
  --panel-border: rgba(128, 177, 255, 0.18);
  --text-main: rgba(237, 244, 255, 0.96);
  --text-muted: rgba(189, 203, 224, 0.78);
  --accent-blue: #5ac8fa;
  --accent-purple: #8b5cf6;
  --accent-orange: #ff6a3d;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --blur: blur(18px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
}

body {
  font-family: "Inter", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at 18% 20%, rgba(113, 55, 194, 0.22), transparent 30%),
    radial-gradient(circle at 82% 22%, rgba(58, 123, 255, 0.16), transparent 26%),
    radial-gradient(circle at 50% 78%, rgba(90, 200, 250, 0.12), transparent 30%),
    var(--bg);
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

#cosmosCanvas,
.cosmos-noise {
  position: fixed;
  inset: 0;
}

#cosmosCanvas {
  z-index: 0;
}

.cosmos-noise {
  pointer-events: none;
  z-index: 1;
  opacity: 0.18;
  background-image:
    linear-gradient(transparent 0, rgba(255, 255, 255, 0.015) 50%, transparent 100%),
    radial-gradient(circle, rgba(255, 255, 255, 0.12) 0.65px, transparent 0.8px);
  background-size: 100% 100%, 14px 14px;
  mix-blend-mode: screen;
}

.glass-panel,
.top-shell,
.mobile-toolbar,
.noscript-note {
  position: fixed;
  z-index: 3;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.top-shell {
  top: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border-radius: 24px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 250px;
}

.brand-orbit {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #86d1ff 28%, #4d7cff 56%, rgba(77, 124, 255, 0.12) 72%, transparent 74%);
  box-shadow: 0 0 22px rgba(90, 200, 250, 0.45);
}

.brand-orbit::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  transform: rotate(24deg);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-copy strong {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-copy small,
.panel-copy,
.timeline-copy,
.search-status,
.radar-meta,
.tag-row,
#detailDesc {
  color: var(--text-muted);
}

.search-shell {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-width: 280px;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
}

.search-form input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(105, 153, 255, 0.18);
  background: rgba(5, 10, 22, 0.78);
  color: var(--text-main);
  outline: none;
}

.search-form input:focus {
  border-color: rgba(90, 200, 250, 0.58);
  box-shadow: 0 0 0 4px rgba(90, 200, 250, 0.12);
}

.search-form button,
.primary-btn,
.ghost-btn,
.detail-close,
.mobile-toolbar button {
  border: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.search-form button,
.primary-btn {
  padding: 13px 18px;
  border-radius: 16px;
  color: #04101b;
  font-weight: 700;
  background: linear-gradient(135deg, #9ce6ff 0%, #5ac8fa 45%, #7c7fff 100%);
  box-shadow: 0 12px 32px rgba(90, 200, 250, 0.24);
}

.ghost-btn {
  padding: 10px 14px;
  border-radius: 14px;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.search-form .ghost-btn {
  box-shadow: none;
}

.search-form button:hover,
.primary-btn:hover,
.ghost-btn:hover,
.detail-close:hover,
.mobile-toolbar button:hover {
  transform: translateY(-1px);
}

.gravity-panel {
  top: 108px;
  left: 20px;
  width: 330px;
  max-height: calc(100vh - 238px);
  padding: 18px;
  border-radius: 24px;
  overflow: auto;
}

.radar-panel {
  top: 108px;
  right: 20px;
  width: 280px;
  padding: 18px;
  border-radius: 24px;
}

.intro-panel {
  top: 108px;
  left: 50%;
  width: min(560px, calc(100vw - 760px));
  min-width: 320px;
  transform: translateX(-50%);
  padding: 22px 24px;
  border-radius: 26px;
}

.detail-panel {
  right: 20px;
  bottom: 128px;
  width: min(420px, calc(100vw - 40px));
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 18px;
  padding: 18px;
  border-radius: 24px;
}

.timeline-shell {
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  width: min(760px, calc(100vw - 40px));
  padding: 18px 22px;
  border-radius: 24px;
}

.mobile-toolbar {
  display: none;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.panel-heading.compact {
  margin-bottom: 14px;
}

.panel-heading h2,
.intro-panel h1,
.detail-content h2 {
  margin: 0;
}

.panel-heading h2 {
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.eyebrow {
  margin: 0 0 10px;
  color: rgba(144, 189, 255, 0.88);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.intro-panel h1 {
  font-size: clamp(1.6rem, 2vw, 2.3rem);
  line-height: 1.12;
}

.intro-copy {
  margin: 12px 0 18px;
  color: var(--text-muted);
  line-height: 1.7;
}

.intro-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.intro-stats div {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.intro-stats strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.35rem;
}

.intro-stats span,
.timeline-track,
.timeline-copy,
.radar-meta,
.panel-heading span {
  font-size: 0.87rem;
}

.gravity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.gravity-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.gravity-card.active {
  border-color: rgba(131, 185, 255, 0.22);
  box-shadow: inset 0 0 0 1px rgba(131, 185, 255, 0.1);
}

.gravity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.gravity-label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gravity-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  box-shadow: 0 0 12px currentColor;
}

.gravity-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gravity-meta strong {
  font-size: 0.95rem;
}

.gravity-meta span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.toggle-btn {
  min-width: 62px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
}

.toggle-btn.off {
  opacity: 0.48;
}

.gravity-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gravity-controls input[type="range"],
#timelineSlider {
  width: 100%;
  accent-color: var(--accent-blue);
}

.gravity-strength {
  width: 52px;
  text-align: right;
  color: rgba(155, 217, 255, 0.92);
  font-size: 0.84rem;
}

#radarCanvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 18px;
  background:
    radial-gradient(circle at center, rgba(90, 200, 250, 0.08), transparent 64%),
    rgba(0, 6, 20, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.radar-meta {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  line-height: 1.55;
}

.detail-thumb-wrap {
  position: relative;
  width: 116px;
  height: 116px;
  border-radius: 22px;
  overflow: hidden;
}

.detail-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  position: relative;
  z-index: 1;
}

.detail-thumb-glow {
  position: absolute;
  inset: -12px;
  border-radius: 28px;
  background: radial-gradient(circle, rgba(90, 200, 250, 0.22), transparent 70%);
}

.detail-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-content h2 {
  font-size: 1.4rem;
}

#detailDesc {
  margin: 0;
  line-height: 1.65;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-tag {
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid currentColor;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
}

.detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font-size: 1.1rem;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.timeline-track {
  display: flex;
  justify-content: space-between;
  margin: 10px 0 6px;
  color: rgba(193, 211, 230, 0.72);
}

#timelineSlider {
  margin: 0;
}

.timeline-copy {
  margin: 10px 0 0;
  line-height: 1.5;
}

.intro-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: auto;
}

.intro-modal {
  width: min(560px, 92vw);
  border-radius: 26px;
  background: rgba(8, 14, 28, 0.86);
  border: 1px solid rgba(128, 177, 255, 0.22);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.6);
  padding: 18px 18px 16px;
}

.intro-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.intro-modal-head h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.intro-modal-close {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  font-size: 1.2rem;
  line-height: 1;
}

.intro-modal-desc {
  margin: 0;
  color: rgba(210, 223, 245, 0.82);
  line-height: 1.7;
}

.intro-modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.intro-modal-actions .primary-btn {
  padding: 12px 16px;
}

.hidden {
  display: none;
}

.noscript-note {
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 12px 16px;
  border-radius: 16px;
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(137, 177, 255, 0.32);
}

@media (max-width: 1380px) {
  .intro-panel {
    left: auto;
    right: 320px;
    transform: none;
    width: calc(100vw - 710px);
  }
}

@media (max-width: 1180px) {
  .top-shell {
    flex-direction: column;
    align-items: stretch;
  }

  .brand-mark {
    min-width: 0;
  }

  .gravity-panel,
  .radar-panel,
  .intro-panel {
    top: 140px;
  }

  .gravity-panel {
    width: 290px;
  }

  .radar-panel {
    width: 250px;
  }

  .intro-panel {
    right: 284px;
    width: calc(100vw - 612px);
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .glass-panel,
  .top-shell {
    position: relative;
  }

  #cosmosCanvas,
  .cosmos-noise {
    position: fixed;
  }

  .top-shell,
  .gravity-panel,
  .radar-panel,
  .intro-panel,
  .detail-panel,
  .timeline-shell {
    top: auto;
    right: auto;
    left: auto;
    bottom: auto;
    transform: none;
    width: auto;
    margin: 16px;
  }

  .top-shell {
    margin-top: 20px;
  }

  .detail-panel {
    grid-template-columns: 88px 1fr;
  }

  .timeline-shell {
    margin-bottom: 96px;
  }

  .mobile-toolbar {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 4;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 10px;
    border-radius: 18px;
  }

  .mobile-toolbar button {
    padding: 12px 10px;
    border-radius: 12px;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.08);
  }
}

@media (max-width: 640px) {
  .top-shell {
    padding: 14px;
  }

  .search-form {
    grid-template-columns: 1fr;
  }

  .search-form button {
    width: 100%;
  }

  .intro-stats {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    grid-template-columns: 1fr;
  }

  .detail-thumb-wrap {
    width: 100%;
    height: 180px;
  }
}
