:root {
  color-scheme: dark;
  --ink: #f8f6ff;
  --muted: #8c89a4;
  --faint: #57556f;
  --panel: rgba(12, 10, 25, 0.78);
  --panel-solid: #0d0b1b;
  --line: rgba(164, 151, 219, 0.14);
  --pink: #ff4fb5;
  --violet: #9e6cff;
  --blue: #4d9dff;
  --cyan: #5ee8e2;
  --gold: #ffd36d;
  --radius: 22px;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 38%, rgba(70, 42, 125, 0.16), transparent 34%),
    linear-gradient(145deg, #080711 0%, #070611 50%, #0a0713 100%);
}

button,
input {
  font: inherit;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  color: inherit;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 36vw;
  height: 36vw;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.08;
  pointer-events: none;
}
.ambient-one {
  top: 20%;
  left: -22%;
  background: var(--blue);
}
.ambient-two {
  right: -22%;
  bottom: -10%;
  background: var(--pink);
}

.topbar {
  height: 76px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 6, 17, 0.78);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.16em;
}
.brand strong {
  display: block;
  font-size: 14px;
}
.brand small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 79, 181, 0.35);
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(255, 79, 181, 0.15), rgba(77, 157, 255, 0.1));
  transform: rotate(45deg);
}
.brand-mark span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 0 10px var(--pink),
    0 0 22px var(--violet);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sync-status {
  min-width: 112px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #b7f2dc;
  border: 1px solid rgba(93, 231, 181, 0.15);
  border-radius: 999px;
  background: rgba(93, 231, 181, 0.05);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sync-status[data-state="error"] {
  color: #ff9ab0;
  border-color: rgba(255, 79, 111, 0.2);
}
.sync-status[data-state="loading"] {
  color: #c7b4ff;
}
.sync-status[data-state="recalling"] {
  color: #ff8bd1;
  border-color: rgba(255, 79, 181, 0.4);
  background: linear-gradient(110deg, rgba(255, 79, 181, 0.12), rgba(158, 108, 255, 0.14));
  box-shadow: 0 0 22px rgba(201, 91, 255, 0.16);
}
.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.sync-status[data-state="loading"] .sync-dot {
  animation: pulse 1.3s ease-in-out infinite;
}
.sync-status[data-state="recalling"] .sync-dot {
  animation: recall-pulse 0.9s ease-in-out infinite;
}
.ghost-link,
.icon-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  text-decoration: none;
}
.ghost-link {
  padding: 9px 13px;
  font-size: 12px;
}
.icon-button {
  width: 38px;
  cursor: pointer;
  font-size: 19px;
}
.ghost-link:hover,
.icon-button:hover {
  color: var(--ink);
  border-color: rgba(158, 108, 255, 0.4);
}

.shell {
  max-width: 1800px;
  margin: 0 auto;
  padding: 44px 32px 32px;
}
.intro {
  display: flex;
  justify-content: space-between;
  gap: 48px;
  align-items: end;
  margin-bottom: 26px;
}
.eyebrow {
  margin: 0 0 10px;
  color: #9d8cbd;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
}
.intro h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 4vw, 56px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.035em;
}
.intro h1 span {
  color: transparent;
  background: linear-gradient(90deg, #ff76c6, #b391ff 50%, #74b4ff);
  background-clip: text;
}
.intro-copy-spacer {
  width: min(470px, 34vw);
  min-height: 50px;
  margin: 0 0 5px;
  flex: 0 1 470px;
}

.explorer {
  min-height: 680px;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 280px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}
.filter-panel,
.detail-panel {
  padding: 24px 20px;
  background: rgba(10, 9, 22, 0.6);
}
.filter-panel {
  border-right: 1px solid var(--line);
}
.detail-panel {
  border-left: 1px solid var(--line);
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.18em;
}
.panel-heading button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
}
.filter-list {
  display: grid;
  gap: 5px;
}
.filter-button {
  width: 100%;
  min-height: 38px;
  padding: 8px 9px;
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #aaa6bf;
  cursor: pointer;
  text-align: left;
  font-size: 11px;
}
.filter-button:hover,
.filter-button[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.035);
  color: #eeebf9;
}
.filter-button[aria-pressed="false"] {
  opacity: 0.42;
}
.filter-swatch {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--filter-color);
  box-shadow: 0 0 8px color-mix(in srgb, var(--filter-color) 80%, transparent);
}
.filter-count {
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.panel-rule {
  height: 1px;
  margin: 22px 0;
  background: var(--line);
}
.data-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.5;
}
.data-note p {
  margin: 0;
}
.data-note strong {
  color: var(--muted);
  font-weight: 600;
}
.data-note-icon {
  color: var(--violet);
}

.graph-column {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(560px, 1fr) auto;
}
.graph-toolbar {
  min-height: 62px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}
.search-box {
  width: min(390px, 55%);
  min-height: 38px;
  padding: 0 11px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--faint);
}
.search-box:focus-within {
  border-color: rgba(158, 108, 255, 0.48);
  box-shadow: 0 0 0 3px rgba(158, 108, 255, 0.07);
}
.search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}
.search-box input::placeholder {
  color: var(--faint);
}
kbd {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--faint);
  font:
    9px ui-monospace,
    monospace;
}
.view-switch {
  padding: 3px;
  display: flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}
.view-switch button {
  padding: 7px 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  font-size: 10px;
}
.view-switch button.active {
  background: rgba(158, 108, 255, 0.12);
  color: #e2d9ff;
}

.graph-stage {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  background: radial-gradient(circle at center, rgba(54, 33, 92, 0.15), transparent 54%);
}
#brain-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}
#brain-canvas.dragging {
  cursor: grabbing;
}
.canvas-hint {
  position: absolute;
  top: 15px;
  left: 17px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(140, 137, 164, 0.55);
  pointer-events: none;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.13em;
}
.canvas-hint i {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: currentColor;
}
.canvas-controls {
  position: absolute;
  right: 15px;
  bottom: 15px;
  padding: 3px;
  display: grid;
  grid-template-columns: repeat(4, 34px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(9, 8, 20, 0.82);
  backdrop-filter: blur(12px);
}
.canvas-controls button {
  width: 34px;
  height: 32px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.canvas-controls button:last-child {
  border-right: 0;
}
.canvas-controls button:hover {
  color: white;
}
.tooltip {
  position: absolute;
  z-index: 5;
  max-width: 250px;
  padding: 9px 11px;
  border: 1px solid rgba(180, 159, 255, 0.22);
  border-radius: 8px;
  background: rgba(12, 10, 27, 0.94);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  color: #e9e5f6;
  opacity: 0;
  transform: translate(10px, 10px);
  pointer-events: none;
  font-size: 10px;
  line-height: 1.45;
  transition: opacity 120ms ease;
}
.tooltip.visible {
  opacity: 1;
}

.state-card {
  position: absolute;
  inset: 50% auto auto 50%;
  width: min(350px, calc(100% - 40px));
  padding: 30px;
  transform: translate(-50%, -50%);
  text-align: center;
}
.state-card strong {
  display: block;
  margin: 14px 0 7px;
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 400;
}
.state-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}
.state-card button {
  margin-top: 16px;
  padding: 9px 15px;
  border: 1px solid rgba(158, 108, 255, 0.35);
  border-radius: 9px;
  background: rgba(158, 108, 255, 0.1);
  cursor: pointer;
}
.state-symbol {
  width: 42px;
  height: 42px;
  margin: auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(158, 108, 255, 0.35);
  border-radius: 50%;
  color: #cfbcff;
}
.neural-loader {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.neural-loader span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 0 14px var(--violet);
  animation: neural 1.3s ease-in-out infinite;
}
.neural-loader span:nth-child(2) {
  background: var(--pink);
  animation-delay: 160ms;
}
.neural-loader span:nth-child(3) {
  background: var(--blue);
  animation-delay: 320ms;
}

.list-view {
  position: absolute;
  inset: 0;
  padding: 18px;
  overflow: auto;
  background: rgba(8, 7, 18, 0.96);
}
.list-group-title {
  margin: 18px 4px 8px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.list-group-title:first-child {
  margin-top: 0;
}
.memory-list-button {
  width: 100%;
  padding: 11px 12px;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid rgba(164, 151, 219, 0.08);
  background: transparent;
  color: #cbc6db;
  cursor: pointer;
  text-align: left;
  font-size: 11px;
}
.memory-list-button:hover,
.memory-list-button:focus-visible {
  background: rgba(158, 108, 255, 0.07);
  color: white;
  outline: none;
}
.memory-list-button small {
  color: var(--faint);
}

.graph-footer {
  min-height: 68px;
  padding: 12px 20px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  border-top: 1px solid var(--line);
}
.stat {
  padding: 0 17px;
  border-right: 1px solid var(--line);
}
.stat:first-child {
  padding-left: 0;
}
.stat:last-child {
  border: 0;
}
.stat strong {
  display: block;
  color: #e4dff0;
  font:
    17px Georgia,
    serif;
}
.stat span {
  color: var(--faint);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.detail-panel {
  min-width: 0;
}
.detail-empty {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}
.detail-empty h2,
.detail-content h2 {
  margin: 3px 0 12px;
  font:
    27px/1.1 Georgia,
    serif;
  font-weight: 400;
}
.detail-empty > p:last-child {
  margin: 0 auto;
  max-width: 210px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}
.orbit-icon {
  position: relative;
  width: 70px;
  height: 70px;
  margin: 0 auto 22px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(158, 108, 255, 0.18);
  border-radius: 50%;
}
.orbit-icon::before {
  content: "";
  position: absolute;
  inset: 11px -7px;
  border: 1px solid rgba(255, 79, 181, 0.16);
  border-radius: 50%;
  transform: rotate(-28deg);
}
.orbit-icon span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 0 13px var(--pink),
    0 0 28px var(--violet);
}
.orbit-icon i {
  position: absolute;
  top: 8px;
  right: 6px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 8px var(--blue);
}
.detail-content {
  padding-top: 8px;
}
.detail-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.detail-kicker span:first-child {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--node-color);
  box-shadow: 0 0 9px var(--node-color);
}
.detail-content h2 {
  overflow-wrap: anywhere;
}
.detail-owner {
  margin: -3px 0 14px;
  color: #a78ddc;
  font-size: 11px;
}
.detail-copy {
  padding: 13px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: #aaa6ba;
  font-family: Georgia, serif;
  font-size: 13px;
  line-height: 1.65;
}
.detail-meta {
  margin: 21px 0 8px;
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.15em;
}
.detail-meta strong {
  color: var(--muted);
}
.connection-list {
  max-height: 260px;
  overflow: auto;
}
.connection-button {
  width: 100%;
  padding: 9px 3px;
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr);
  gap: 9px;
  border: 0;
  border-bottom: 1px solid rgba(164, 151, 219, 0.08);
  background: transparent;
  color: #9b97ad;
  cursor: pointer;
  text-align: left;
  font-size: 10px;
  line-height: 1.35;
}
.connection-button:hover {
  color: white;
}
.connection-button i {
  width: 5px;
  height: 5px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--connection-color);
}
.back-to-drift {
  width: 100%;
  margin-top: 20px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
}
.back-to-drift:hover {
  color: white;
  border-color: rgba(158, 108, 255, 0.35);
}

.hidden {
  display: none !important;
}
@keyframes neural {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  50% {
    transform: translateY(-8px);
    opacity: 1;
  }
}
@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}
@keyframes recall-pulse {
  0%,
  100% {
    transform: scale(0.8);
    box-shadow: 0 0 7px currentColor;
  }
  50% {
    transform: scale(1.45);
    box-shadow: 0 0 16px currentColor;
  }
}

@media (max-width: 1180px) {
  .explorer {
    grid-template-columns: 190px minmax(0, 1fr);
  }
  .detail-panel {
    display: none;
  }
}
@media (max-width: 780px) {
  .topbar {
    height: 66px;
    padding: 0 18px;
  }
  .ghost-link,
  .sync-status {
    display: none;
  }
  .shell {
    padding: 28px 14px 18px;
  }
  .intro {
    display: block;
  }
  .intro-copy-spacer {
    width: 100%;
    min-height: 74px;
    margin: 17px 0 5px;
  }
  .explorer {
    display: block;
    min-height: 0;
  }
  .filter-panel {
    padding: 13px;
    border: 0;
    border-bottom: 1px solid var(--line);
  }
  .panel-heading,
  .panel-rule,
  .data-note {
    display: none;
  }
  .filter-list {
    display: flex;
    overflow-x: auto;
  }
  .filter-button {
    width: auto;
    min-width: max-content;
    grid-template-columns: 10px 1fr;
  }
  .filter-count {
    display: none;
  }
  .graph-toolbar {
    align-items: stretch;
  }
  .search-box {
    width: 100%;
  }
  kbd {
    display: none;
  }
  .view-switch {
    display: none;
  }
  .graph-column {
    grid-template-rows: auto 62vh auto;
  }
  .graph-stage {
    min-height: 0;
  }
  .canvas-hint {
    display: none;
  }
  .graph-footer {
    padding: 10px;
  }
  .stat {
    padding: 0 8px;
  }
  .stat strong {
    font-size: 14px;
  }
  .stat span {
    font-size: 6px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
