:root {
  color-scheme: dark;
  --bg: #000;
  --ink: #f7ffe8;
  --muted: rgba(247, 255, 232, 0.68);
  --soft: rgba(247, 255, 232, 0.1);
  --line: rgba(168, 224, 0, 0.2);
  --lime: #a8e000;
  --lime-strong: #c7ff17;
  --cyan: #53ffd6;
  --violet: #ad6bff;
  --glass: rgba(8, 12, 8, 0.58);
  --glass-strong: rgba(11, 17, 12, 0.78);
  --shadow: 0 0 32px rgba(168, 224, 0, 0.18);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000;
  color: var(--ink);
}

body::before,
body::after {
  position: fixed;
  inset: auto;
  content: "";
  pointer-events: none;
  z-index: 0;
  border-radius: 999px;
  filter: blur(24px);
}

body::before {
  top: -22rem;
  right: -18rem;
  width: 42rem;
  height: 42rem;
  background:
    radial-gradient(circle at center, rgba(168, 224, 0, 0.24), rgba(0, 0, 0, 0) 62%),
    radial-gradient(circle at 35% 60%, rgba(49, 255, 214, 0.14), rgba(0, 0, 0, 0) 54%);
}

body::after {
  left: -26rem;
  bottom: -28rem;
  width: 54rem;
  height: 54rem;
  background:
    radial-gradient(circle at center, rgba(112, 40, 255, 0.16), rgba(0, 0, 0, 0) 60%),
    radial-gradient(circle at 65% 30%, rgba(168, 224, 0, 0.12), rgba(0, 0, 0, 0) 52%);
}

button,
input {
  font: inherit;
}

button {
  color: var(--ink);
}

#particles {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  opacity: 0.72;
  pointer-events: none;
}

.shell {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
  height: 100vh;
  padding: 18px;
}

.topbar,
.view-switcher,
.node-panel,
.hint,
.login-card {
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(135deg, rgba(168, 224, 0, 0.04), rgba(255, 255, 255, 0.012)),
    var(--glass);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(18px) saturate(1.1);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(260px, 0.9fr);
  align-items: center;
  gap: 14px;
  min-height: 92px;
  padding: 14px;
  border-radius: 8px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 16px;
}

.brand-mark {
  position: relative;
  flex: 0 0 54px;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(168, 224, 0, 0.8);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(168, 224, 0, 0.95) 0 8%, transparent 9%),
    conic-gradient(from 80deg, transparent, rgba(168, 224, 0, 0.8), transparent 45%),
    radial-gradient(circle, rgba(168, 224, 0, 0.16), transparent 62%);
  box-shadow: 0 0 38px rgba(168, 224, 0, 0.46);
  animation: pulse 3.4s ease-in-out infinite;
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  inset: 10px;
  content: "";
  border: 1px solid rgba(168, 224, 0, 0.34);
  border-radius: inherit;
}

.brand-mark::after {
  inset: 20px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 6px;
  color: var(--lime);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-weight: 780;
  letter-spacing: 0;
}

h1 {
  max-width: 15ch;
  font-size: clamp(2.3rem, 4.6vw, 5.35rem);
  line-height: 0.82;
  font-variation-settings: "SOFT" 70, "WONK" 1;
  text-wrap: balance;
  background: linear-gradient(102deg, #ffffff 0%, #f7ffe8 38%, #c7ff17 66%, #53ffd6 100%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  text-shadow:
    0 0 34px rgba(168, 224, 0, 0.26),
    0 18px 58px rgba(83, 255, 214, 0.1);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(76px, 1fr));
  gap: 8px;
}

.stats article {
  min-width: 74px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)),
    rgba(0, 0, 0, 0.32);
}

.stats span {
  display: block;
  color: var(--lime-strong);
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  font-weight: 700;
}

.stats small,
.panel-meta {
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.45;
  font-weight: 500;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.search-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
  width: min(100%, 360px);
  height: 44px;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.5);
}

.search-wrap span {
  color: var(--lime);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
}

.search-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 500;
}

.icon-button,
.seg,
#enter,
.login-submit,
.close {
  border: 1px solid rgba(168, 224, 0, 0.35);
  border-radius: 8px;
  background: rgba(168, 224, 0, 0.09);
  cursor: pointer;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  height: 44px;
  gap: 8px;
  padding: 0 14px;
  white-space: nowrap;
}

.icon-button:hover,
.seg:hover,
#enter:hover,
.login-submit:hover {
  border-color: rgba(168, 224, 0, 0.85);
  background: rgba(168, 224, 0, 0.17);
  box-shadow: 0 0 24px rgba(168, 224, 0, 0.2);
  transform: translateY(-1px);
}

.view-switcher {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  gap: 6px;
  padding: 6px;
  border-radius: 8px;
  overflow-x: auto;
}

.seg {
  flex: 0 0 auto;
  min-width: 86px;
  height: 38px;
  padding: 0 13px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.seg.active {
  color: #071000;
  background: linear-gradient(135deg, var(--lime), #ebff7c);
  border-color: rgba(239, 255, 134, 0.9);
  box-shadow: 0 0 32px rgba(168, 224, 0, 0.42);
}

.stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(168, 224, 0, 0.13);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 48%, rgba(247, 255, 232, 0.14) 0%, rgba(168, 224, 0, 0.105) 16%, rgba(83, 255, 214, 0.052) 30%, transparent 52%),
    radial-gradient(circle at 50% 50%, transparent 0 42%, rgba(0, 0, 0, 0.45) 76%, rgba(0, 0, 0, 0.92) 100%),
    linear-gradient(rgba(168, 224, 0, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(168, 224, 0, 0.035) 1px, transparent 1px),
    #000;
  background-size: auto, auto, 58px 58px, 58px 58px, auto;
}

.stage::before {
  position: absolute;
  inset: 12%;
  content: "";
  border: 1px solid rgba(168, 224, 0, 0.09);
  border-radius: 50%;
  box-shadow:
    0 0 80px rgba(168, 224, 0, 0.08),
    inset 0 0 80px rgba(168, 224, 0, 0.05);
  pointer-events: none;
  animation: orbitGlow 12s linear infinite;
}

.stage::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(247, 255, 232, 0.18), rgba(168, 224, 0, 0.14) 16%, transparent 34%),
    radial-gradient(circle at 50% 50%, transparent 0 46%, rgba(0, 0, 0, 0.64) 78%, rgba(0, 0, 0, 0.96) 100%),
    conic-gradient(
      from 0deg,
      rgba(168, 224, 0, 0.06),
      rgba(53, 215, 255, 0.04),
      rgba(173, 107, 255, 0.05),
      rgba(255, 138, 31, 0.04),
      rgba(168, 224, 0, 0.06)
    );
  mix-blend-mode: screen;
  transition: opacity 420ms ease;
}

.stage.is-radial::after {
  opacity: 0.88;
}

.stage.is-galaxy {
  background:
    radial-gradient(circle at 50% 52%, rgba(247, 255, 232, 0.16) 0%, rgba(168, 224, 0, 0.12) 18%, rgba(83, 255, 214, 0.08) 34%, transparent 58%),
    radial-gradient(circle at 50% 50%, transparent 0 40%, rgba(0, 0, 0, 0.5) 76%, rgba(0, 0, 0, 0.98) 100%),
    linear-gradient(rgba(168, 224, 0, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(168, 224, 0, 0.018) 1px, transparent 1px),
    #000;
  background-size: auto, auto, 72px 72px, 72px 72px, auto;
}

.graph-plane {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 420ms ease,
    filter 420ms ease;
  filter: saturate(0.92) contrast(0.96);
}

.graph-plane.active {
  opacity: 1;
  pointer-events: auto;
  filter: saturate(1.08) contrast(1.04);
}

.node-panel {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: min(330px, calc(100% - 36px));
  padding: 16px;
  border-radius: 8px;
  transform: translateZ(0);
}

.node-panel h2 {
  margin-bottom: 8px;
  font-size: clamp(1.6rem, 2.8vw, 2.25rem);
  line-height: 0.9;
  letter-spacing: 0;
  font-variation-settings: "SOFT" 65, "WONK" 1;
}

.node-panel button {
  width: 100%;
  height: 42px;
  margin-top: 14px;
  font-weight: 800;
}

.hint {
  position: absolute;
  left: 18px;
  bottom: 18px;
  max-width: 360px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.45;
}

#login-modal {
  width: min(420px, calc(100% - 28px));
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}

#login-modal::backdrop {
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
}

.login-card {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 24px;
  border-radius: 8px;
}

.login-card h2 {
  font-size: 2.8rem;
  line-height: 0.88;
}

.login-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
}

.login-card input {
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  outline: 0;
  background: rgba(0, 0, 0, 0.52);
  color: var(--ink);
  padding: 0 12px;
}

.login-submit {
  height: 46px;
  font-weight: 800;
}

.close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--muted);
  font-size: 1.4rem;
}

#login-status {
  min-height: 20px;
  color: var(--lime);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
}

.graph-tooltip {
  color: #f7ffe8;
  font-family: Inter, sans-serif;
  font-size: 12px;
  line-height: 1.55;
  letter-spacing: 0.01em;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.82;
  }
  50% {
    transform: scale(1.04);
    opacity: 1;
  }
}

@keyframes orbitGlow {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .shell {
    min-height: 100vh;
    height: auto;
    padding: 10px;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .actions {
    justify-content: stretch;
  }

  .search-wrap {
    width: 100%;
  }

  .stage {
    min-height: 68vh;
  }

  .node-panel {
    right: 10px;
    bottom: 10px;
    padding: 12px;
  }

  .hint {
    display: none;
  }
}

@media (max-width: 600px) {
  .shell {
    gap: 8px;
    padding: 8px;
  }

  .topbar {
    min-height: auto;
    padding: 10px;
  }

  .brand-mark {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
  }

  h1 {
    max-width: none;
    font-size: 2.24rem;
  }

  .stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .actions {
    flex-direction: column;
  }

  .icon-button {
    justify-content: center;
    width: 100%;
  }

  .view-switcher {
    width: 100%;
  }

  .seg {
    min-width: max-content;
  }

  .stage {
    min-height: 70vh;
  }

  .node-panel {
    width: calc(100% - 20px);
  }
}
