:root {
  --void: #05060e;
  --abyss: #070912;
  --ink: #dbe0f0;
  --silver: #9aa2b8;
  --mute: #6f7890;
  --violet: #8a7cff;
  --violet-soft: #b3a8ff;
  --hairline: rgba(219, 224, 240, 0.12);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", Consolas, ui-monospace, monospace;
}

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

html,
body {
  height: 100%;
}

body {
  background: radial-gradient(120% 100% at 50% 0%, #0a0c18 0%, var(--void) 55%, #03040a 100%);
  color: var(--ink);
  font-family: var(--font-body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

body.is-interactive .scene {
  cursor: grab;
}

body.is-dragging .scene {
  cursor: grabbing;
}

body.has-node .scene {
  cursor: pointer;
}

.constellations {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  color: rgba(150, 160, 255, 0.08);
  opacity: 0;
  transition: opacity 700ms var(--ease-out);
}
.constellations.is-open {
  opacity: 1;
}

.node-ring {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 2;
  width: 16px;
  height: 16px;
  border: 1px solid rgba(220, 226, 255, 0.5);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 300ms var(--ease-out), transform 300ms var(--ease-out);
  box-shadow: 0 0 18px -2px rgba(138, 124, 255, 0.5);
}
.node-ring.is-open {
  opacity: 1;
  transform: scale(1);
}

.node-line {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 2;
  height: 1px;
  background: linear-gradient(90deg, rgba(220, 226, 255, 0.5), rgba(220, 226, 255, 0.12));
  pointer-events: none;
  opacity: 0;
  transition: opacity 300ms var(--ease-out);
}
.node-line.is-open {
  opacity: 1;
}

.popup {
  position: fixed;
  z-index: 3;
  pointer-events: auto;
  padding: 14px 16px 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--abyss) 82%, transparent);
  border: 1px solid var(--hairline);
  backdrop-filter: blur(18px) saturate(120%);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  box-shadow: 0 18px 50px -24px rgba(0, 0, 0, 0.9), 0 0 40px -20px rgba(138, 124, 255, 0.35);
  opacity: 0;
  transform: translateY(6px) scale(0.97);
  filter: blur(2px);
  transition: opacity 320ms var(--ease-out), transform 320ms var(--ease-out), filter 320ms var(--ease-out);
}
.popup.is-open {
  opacity: 1;
  transform: none;
  filter: none;
}
.popup[hidden] {
  display: none;
}
.popup__media {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 9px;
  overflow: hidden;
  margin-bottom: 10px;
  background: linear-gradient(160deg, rgba(138, 124, 255, 0.16), rgba(91, 124, 240, 0.1)), var(--abyss);
}
.popup__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 500ms var(--ease-out);
}
.popup__media img.is-loaded {
  opacity: 1;
}
.popup__category {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--violet);
}
.popup__title {
  margin-top: 5px;
  font-family: var(--font-display);
  font-size: 19px;
  line-height: 1.1;
  color: var(--ink);
}
.popup__desc {
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--silver);
}
.popup__open {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  border-top: 1px solid var(--hairline);
  padding-top: 9px;
  transition: color 200ms var(--ease-out);
}
.popup__open:hover {
  color: var(--violet-soft);
}
.popup__platform {
  font-family: var(--font-mono);
  color: var(--violet-soft);
}

.signature {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
  transition: opacity 1600ms var(--ease-out), transform 1600ms var(--ease-out);
}
.signature.is-open {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.signature__name {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.42em;
  color: var(--ink);
}
.signature__line {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--mute);
}

.sound-toggle {
  position: fixed;
  right: 20px;
  bottom: 22px;
  z-index: 2;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(219, 224, 240, 0.35);
  background: transparent;
  opacity: 0.28;
  cursor: pointer;
  transition: opacity 300ms var(--ease-out), box-shadow 300ms var(--ease-out), border-color 300ms var(--ease-out);
}
.sound-toggle:hover {
  opacity: 0.85;
  border-color: var(--violet);
  box-shadow: 0 0 12px rgba(138, 124, 255, 0.5);
}
.sound-toggle.is-on {
  border-color: var(--violet);
  background: var(--violet);
  box-shadow: 0 0 12px rgba(138, 124, 255, 0.6);
  opacity: 0.7;
}
.sound-toggle[hidden] {
  display: none;
}

.fallback {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 18px;
  padding: 24px;
  background: radial-gradient(120% 100% at 50% 0%, #0a0c18 0%, var(--void) 60%, #03040a 100%);
}
.fallback[hidden] {
  display: none;
}
.fallback h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 4.6rem);
  font-weight: 400;
  letter-spacing: 0.18em;
}
.fallback__tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--mute);
}
.fallback ul {
  margin-top: 18px;
  display: grid;
  gap: 10px;
  list-style: none;
}
.fallback a {
  display: flex;
  gap: 12px;
  align-items: baseline;
  color: var(--silver);
  text-decoration: none;
  font-size: 14px;
  transition: color 200ms var(--ease-out);
}
.fallback a:hover {
  color: var(--violet-soft);
}
.fallback__cat {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--mute);
}

@media (prefers-reduced-motion: reduce) {
  .popup,
  .node-ring,
  .node-line,
  .constellations,
  .signature,
  .sound-toggle {
    transition-duration: 0.001ms;
  }
  .signature.is-open {
    opacity: 1;
  }
}
