:root {
  --bg: #090b10;
  --bg-elevated: #11161d;
  --bg-pane: rgba(13, 17, 24, 0.78);
  --bg-muted: rgba(23, 30, 40, 0.94);
  --bg-hover: rgba(34, 43, 56, 0.96);
  --bg-glass: rgba(9, 12, 18, 0.62);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.15);
  --ink: #dbe4f1;
  --ink-soft: #aab5c6;
  --ink-faint: #738097;
  --accent: #7f8fff;
  --accent-soft: rgba(127, 143, 255, 0.18);
  --cyan: #71dfff;
  --shadow: 0 24px 72px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 0%, rgba(127, 143, 255, 0.12), transparent 24%),
    radial-gradient(circle at 80% 20%, rgba(113, 223, 255, 0.08), transparent 18%),
    linear-gradient(180deg, #05070b, #090b10 45%, #07090d);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 30px 30px;
  opacity: 0.16;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.94), transparent 95%);
}

.workspace-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.workspace-shell.connectome-immersive .vault-sidebar,
.workspace-shell.connectome-immersive .note-pane,
.workspace-shell.connectome-immersive .stage-header,
.workspace-shell.connectome-immersive .stage-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.mobile-menu-bar,
.mobile-panel-toggle {
  display: none;
}

.vault-sidebar,
.note-pane,
.stage-pane,
.stage-header,
.stage-overlay {
  min-width: 0;
  min-height: 0;
}

.vault-sidebar,
.note-pane,
.stage-header,
.stage-overlay {
  transition: opacity 160ms ease;
}

.vault-sidebar {
  position: absolute;
  top: 1rem;
  left: 1rem;
  bottom: 1rem;
  width: 278px;
  z-index: 10;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0.8rem;
  padding: 0.9rem;
  background: rgba(9, 12, 18, 0.55);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  align-content: start;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.vault-sidebar::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.note-pane {
  position: absolute;
  top: 1rem;
  right: 1rem;
  bottom: 1rem;
  width: 320px;
  z-index: 10;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: rgba(9, 12, 18, 0.55);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.stage-pane {
  position: relative;
  min-height: 100vh;
}

.sidebar-head,
.sidebar-panel,
.stage-header,
.stage-shell,
.note-card {
  background: var(--bg-pane);
  border: 1px solid var(--border);
}

.sidebar-head,
.sidebar-panel,
.stage-header,
.stage-shell {
  border-radius: 16px;
}

.sidebar-head,
.sidebar-panel {
  padding: 0.8rem;
}

.sidebar-head {
  position: sticky;
  top: 0;
  z-index: 2;
  align-self: start;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.tree-panel {
  display: grid;
  gap: 0.65rem;
  align-content: start;
  min-height: auto;
  overflow: visible;
}

.headline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.sidebar-head h1,
.stage-header h2,
.note-header h3 {
  margin: 0;
  line-height: 0.96;
  letter-spacing: -0.03em;
}

.sidebar-head h1 {
  font-size: clamp(1.5rem, 1.8vw, 2rem);
}

.stage-header {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: start;
  width: min(760px, calc(100vw - 690px));
  padding: 0.8rem 0.9rem;
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
}

.stage-meta {
  display: grid;
  gap: 0.5rem;
  align-self: stretch;
  min-width: 232px;
}

.stage-headline {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 0.48rem;
}

.stage-header h2 {
  font-size: clamp(1.25rem, 1.9vw, 1.8rem);
}

.stage-copy {
  margin: 0;
}

.stage-header .legend {
  grid-column: 1 / -1;
}

.stage-copy,
.lede,
.article-summary {
  color: var(--ink-soft);
  line-height: 1.55;
}

.eyebrow,
.article-kicker,
.stat-label {
  margin: 0 0 0.42rem;
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.version-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.2rem;
  padding: 0.26rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(127, 143, 255, 0.3);
  background: rgba(127, 143, 255, 0.14);
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.control-panel {
  display: grid;
  gap: 0.8rem;
}

.control-group {
  display: grid;
  gap: 0.42rem;
}

.control-group > label,
.control-group > span,
.wikipedia-language-control span {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.wikipedia-language-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(7.5rem, auto);
  gap: 0.65rem;
  align-items: center;
  margin-top: 0.15rem;
}

.wikipedia-language-control select {
  padding-block: 0.58rem;
}

.source-accordion {
  display: grid;
  gap: 0.7rem;
}

.source-accordion-item {
  display: grid;
  grid-template-rows: auto 0fr;
  gap: 0;
  padding: 0.55rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015)),
    rgba(255, 255, 255, 0.02);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 10px 22px rgba(0, 0, 0, 0.16);
  overflow: hidden;
  transition:
    grid-template-rows 260ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 220ms ease,
    background 220ms ease,
    box-shadow 220ms ease,
    transform 220ms ease;
  position: relative;
}

.source-accordion-item.active {
  grid-template-rows: auto 1fr;
  border-color: rgba(127, 143, 255, 0.28);
  background:
    linear-gradient(180deg, rgba(127, 143, 255, 0.14), rgba(127, 143, 255, 0.04)),
    rgba(127, 143, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 16px 30px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.source-accordion-item::after {
  content: "";
  position: absolute;
  right: 0.8rem;
  top: 0.82rem;
  width: 0.7rem;
  height: 0.7rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  opacity: 0.42;
  transform: skew(-14deg, -14deg) rotate(5deg);
  pointer-events: none;
}

.source-accordion-trigger {
  width: 100%;
  justify-content: flex-start;
  padding: 0.68rem 0.72rem;
  background: transparent;
  border-color: transparent;
  color: var(--ink-soft);
  position: relative;
  z-index: 1;
}

.source-accordion-trigger::after {
  content: "";
  position: absolute;
  right: 0.8rem;
  top: 50%;
  width: 0.56rem;
  height: 0.56rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-60%) rotate(45deg);
  opacity: 0.8;
  transition: transform 220ms ease, opacity 220ms ease;
}

.source-accordion-trigger.active {
  background: rgba(127, 143, 255, 0.12);
  border-color: rgba(127, 143, 255, 0.26);
  color: var(--ink);
}

.source-accordion-trigger.active::after {
  transform: translateY(-40%) rotate(225deg);
}

.source-accordion-panel {
  display: grid;
  min-height: 0;
  overflow: hidden;
  opacity: 0;
  transform-origin: top center;
  transform: perspective(900px) rotateX(-12deg) translateY(-0.3rem);
  transition:
    opacity 220ms ease,
    transform 280ms cubic-bezier(0.22, 1, 0.36, 1),
    padding 220ms ease,
    filter 220ms ease;
  filter: saturate(0.86);
}

.source-accordion-panel-inner {
  display: grid;
  gap: 0.65rem;
  margin: 0 0.15rem 0.12rem;
  padding: 0.55rem 0.6rem 0.62rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015)),
    rgba(4, 6, 10, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 8px 18px rgba(0, 0, 0, 0.14);
}

.source-accordion-item.active .source-accordion-panel {
  padding-top: 0.18rem;
  opacity: 1;
  transform: perspective(900px) rotateX(0deg) translateY(0);
  filter: saturate(1);
}

.source-accordion-item:not(.active) .source-accordion-panel {
  pointer-events: none;
}

.button-row-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.search-meta {
  margin: 0;
  font-size: 0.72rem;
  color: var(--ink-faint);
  line-height: 1.45;
}

.search-suggestions {
  display: grid;
  gap: 0.35rem;
  padding: 0.45rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(11, 15, 22, 0.92);
}

.search-suggestions[hidden] {
  display: none;
}

.search-suggestion {
  display: grid;
  gap: 0.16rem;
  width: 100%;
  padding: 0.56rem 0.62rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  text-align: left;
}

.search-suggestion:hover,
.search-suggestion.active {
  background: var(--bg-hover);
  border-color: var(--border);
}

.search-suggestion-title {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
}

.search-suggestion-snippet {
  font-size: 0.74rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.76rem 0.82rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-muted);
  color: var(--ink);
  outline: none;
}

input::placeholder {
  color: var(--ink-faint);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(127, 143, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(127, 143, 255, 0.14);
}

textarea {
  resize: vertical;
  min-height: 14rem;
  line-height: 1.6;
}

.button-row {
  display: flex;
  gap: 0.55rem;
}

button {
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.72rem 0.9rem;
  background: var(--bg-muted);
  color: var(--ink);
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: var(--bg-hover);
}

button:disabled {
  cursor: default;
  opacity: 0.55;
  transform: none;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.02);
}

#random-focus {
  background: var(--accent-soft);
  border-color: rgba(127, 143, 255, 0.42);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.65rem;
  color: var(--ink-faint);
  font-size: 0.78rem;
}

.note-tree {
  display: grid;
  gap: 0.85rem;
  min-height: auto;
  overflow: visible;
  padding-right: 0;
  scrollbar-gutter: auto;
}

.tree-group {
  display: grid;
  gap: 0.38rem;
  min-width: 0;
}

.tree-group-title {
  font-size: 0.69rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.tree-item {
  display: flex;
  align-items: center;
  gap: 0.52rem;
  width: 100%;
  min-width: 0;
  padding: 0.45rem 0.58rem;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.tree-item span:last-child {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-item.active {
  background: rgba(127, 143, 255, 0.17);
  border-color: rgba(127, 143, 255, 0.36);
  color: var(--ink);
}

.tree-item:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}

.tree-swatch,
.swatch,
.tag-dot,
.tag-anchor-dot {
  width: 0.66rem;
  height: 0.66rem;
  border-radius: 999px;
  flex: 0 0 auto;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 0.45rem;
  min-width: 0;
}

.stat-strip div {
  padding: 0.62rem 0.72rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.stat-strip strong {
  display: block;
  font-size: 1.14rem;
}

.graph-view-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0.22rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.graph-view-switch[hidden] {
  display: none;
}

.graph-view-switch button {
  min-width: 0;
  padding: 0.46rem 0.58rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 650;
}

.graph-view-switch button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.045);
}

.graph-view-switch button.active {
  color: var(--ink);
  background: rgba(127, 143, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(127, 143, 255, 0.24);
}

.stage-action-button {
  width: 100%;
  padding: 0.68rem 0.8rem;
  background: rgba(127, 143, 255, 0.12);
  border-color: rgba(127, 143, 255, 0.28);
}

.stage-action-button:hover {
  background: rgba(127, 143, 255, 0.18);
}

.stage-shell {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 50%, rgba(127, 143, 255, 0.08), transparent 28%),
    radial-gradient(circle at 56% 60%, rgba(113, 223, 255, 0.06), transparent 32%),
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.02), transparent 18%),
    linear-gradient(180deg, #04060b, #05070b 48%, #04060a);
  border: none;
  border-radius: 0;
}

.graph-viewport,
.label-layer {
  position: absolute;
  inset:
    var(--graph-top-inset, 0)
    var(--graph-right-inset, 0)
    0
    var(--graph-left-inset, 0);
}

.graph-viewport {
  touch-action: none;
}

.label-layer {
  pointer-events: none;
  z-index: 3;
}

.selected-node-label {
  --selected-accent: #7f8fff;
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: min(30rem, 68%);
  padding: 0.52rem 0.82rem;
  transform: translate(-50%, -50%);
  border: 1px solid color-mix(in srgb, var(--selected-accent) 68%, white 14%);
  border-radius: 999px;
  background: rgba(10, 14, 21, 0.9);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--selected-accent) 16%, transparent),
    0 12px 30px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
  color: #f1f5ff;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}

.selected-node-label[hidden] {
  display: none;
}

.stage-overlay {
  position: absolute;
  z-index: 4;
}

.top-left {
  top: 0.85rem;
  left: 0.85rem;
}

.top-right {
  top: 0.85rem;
  right: 0.85rem;
}

.bottom-right {
  right: 0.85rem;
  bottom: 0.85rem;
}

.bottom-left {
  left: 0.85rem;
  bottom: 0.85rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  max-width: 100%;
  margin-top: 0.18rem;
}

.legend-chip,
.neighbor-chip,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.42rem 0.68rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  color: var(--ink);
  font-size: 0.8rem;
}

.controls-stack {
  display: grid;
  gap: 0.45rem;
  bottom: 4.85rem;
}

.icon-button {
  width: 2.35rem;
  height: 2.35rem;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  border-radius: 12px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  font-size: 1rem;
}

.icon-button.active {
  background: rgba(127, 143, 255, 0.2);
  border-color: rgba(127, 143, 255, 0.38);
}

.graph-tag {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-9999px, -9999px);
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  padding: 0.22rem 0.42rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(12, 16, 22, 0.72);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
  color: var(--ink);
  font-size: 0.61rem;
  pointer-events: auto;
  cursor: grab;
  user-select: none;
  white-space: nowrap;
}

.graph-tag.hidden {
  display: none;
}

.graph-tag.active {
  border-color: rgba(255, 255, 255, 0.44);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 10px 24px rgba(0, 0, 0, 0.28);
}

.graph-tag.dragging {
  cursor: grabbing;
}

.tag-title {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.tooltip {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  padding: 0.5rem 0.68rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(10, 13, 18, 0.95);
  color: var(--ink);
  box-shadow: var(--shadow);
  transform: translate(14px, 14px);
}

.tab-bar {
  display: flex;
  gap: 0.35rem;
  padding: 0.7rem 0.7rem 0;
}

.tab {
  padding: 0.5rem 0.72rem;
  background: transparent;
  border-color: transparent;
  color: var(--ink-faint);
}

.tab.active {
  background: var(--bg-pane);
  border-color: var(--border);
  color: var(--ink);
}

.note-panel[hidden] {
  display: none;
}

.assistant-shell {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 16;
  width: 3.2rem;
  max-width: min(410px, calc(100vw - 2rem));
  border: 1px solid rgba(127, 143, 255, 0.3);
  border-radius: 999px;
  background:
    radial-gradient(circle at 26% 32%, rgba(127, 143, 255, 0.26), transparent 42%),
    linear-gradient(180deg, rgba(13, 18, 28, 0.92), rgba(10, 14, 22, 0.88));
  box-shadow:
    0 16px 36px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  backdrop-filter: blur(20px);
  overflow: hidden;
  pointer-events: auto;
  transition:
    width 180ms ease,
    border-radius 180ms ease,
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    backdrop-filter 180ms ease;
}

.assistant-shell:hover,
.assistant-shell:focus-within {
  width: 6.65rem;
}

.assistant-shell[data-open="true"] {
  width: min(410px, calc(100vw - 2rem));
  border-color: rgba(127, 143, 255, 0.2);
  border-radius: 36px;
  background:
    radial-gradient(circle at 14% 10%, rgba(127, 143, 255, 0.22), transparent 24%),
    radial-gradient(circle at 86% 16%, rgba(113, 223, 255, 0.14), transparent 22%),
    radial-gradient(circle at 56% 110%, rgba(127, 143, 255, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(7, 10, 16, 0.96), rgba(9, 13, 19, 0.94));
  backdrop-filter: blur(24px);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.assistant-panel {
  position: relative;
  width: 100%;
  max-height: min(78vh, 760px);
  display: grid;
  gap: 0.95rem;
  padding: 1.08rem 1.05rem 1rem;
  overflow: auto;
  border-radius: inherit;
  background: transparent;
  transform-origin: calc(100% - 2.1rem) calc(100% - 2.1rem);
  animation: assistant-chamber-in 180ms ease;
}

.assistant-panel[hidden] {
  display: none;
}

.assistant-panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
}

.assistant-panel-head h3 {
  margin: 0;
  line-height: 1.03;
  font-size: clamp(1.16rem, 1.6vw, 1.48rem);
}

.assistant-close {
  width: 2rem;
  height: 2rem;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink-soft);
  font-size: 1.15rem;
  line-height: 1;
}

.assistant-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

.assistant-bubble {
  width: 100%;
  height: 3.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  justify-content: flex-start;
  padding: 0 0.58rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  color: inherit;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.assistant-bubble[aria-expanded="true"] {
  position: relative;
  width: 100%;
  height: 2.85rem;
  padding: 0 0.95rem 0.95rem;
  align-self: stretch;
  transform: none;
  justify-content: flex-start;
  z-index: auto;
}

.assistant-shell[data-open="true"] .assistant-bubble {
  width: 100%;
  transform: none;
}

.assistant-bubble-orb {
  width: 2.05rem;
  height: 2.05rem;
  border-radius: 999px;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.2) 16%, transparent 34%),
    radial-gradient(circle at 70% 72%, rgba(88, 217, 255, 0.86), transparent 48%),
    radial-gradient(circle at 44% 56%, rgba(94, 140, 255, 1), rgba(94, 140, 255, 0.18) 64%, transparent 78%),
    radial-gradient(circle at 52% 58%, rgba(6, 12, 28, 0.42), transparent 74%);
  box-shadow:
    0 0 18px rgba(94, 140, 255, 0.22),
    0 0 34px rgba(88, 217, 255, 0.12);
  flex: 0 0 auto;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    filter 180ms ease;
}

.assistant-shell:not([data-open="true"]) .assistant-bubble:hover .assistant-bubble-orb,
.assistant-shell:not([data-open="true"]) .assistant-bubble:focus-visible .assistant-bubble-orb {
  transform: scale(1.03);
  filter: saturate(1.08);
  box-shadow:
    0 0 24px rgba(94, 140, 255, 0.28),
    0 0 38px rgba(88, 217, 255, 0.14);
}

@keyframes assistant-chamber-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.92);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.assistant-bubble-label {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
  white-space: nowrap;
  transform: translateX(-0.35rem);
  transition:
    max-width 180ms ease,
    opacity 180ms ease,
    transform 180ms ease;
}

.assistant-shell:not([data-open="true"]) .assistant-bubble:hover .assistant-bubble-label,
.assistant-shell:not([data-open="true"]) .assistant-bubble:focus-visible .assistant-bubble-label {
  max-width: 4rem;
  opacity: 1;
  transform: translateX(0);
}

.assistant-shell[data-open="true"] .assistant-bubble-label {
  display: inline;
  max-width: 4rem;
  opacity: 1;
  transform: translateX(0);
}

.note-card {
  margin: 0.7rem;
  border-radius: 16px;
  padding: 0.95rem;
  overflow: auto;
}

.note-header {
  display: grid;
  gap: 0.45rem;
}

.note-header h3 {
  font-size: clamp(1.3rem, 1.6vw, 1.8rem);
}

.source-link {
  width: fit-content;
  padding: 0.38rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  text-decoration: none;
}

.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding-inline: 0.55rem 0.72rem;
  background: rgba(246, 247, 248, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.source-badge::before {
  content: "W";
  width: 1.2rem;
  height: 1.2rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #f4f6fa;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.source-link:hover {
  background: var(--bg-hover);
}

.source-link[hidden] {
  display: none;
}

.article-summary {
  margin: 0.9rem 0 0;
}

.editor-panel {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 0.9rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.editor-panel[hidden] {
  display: none;
}

.editor-field {
  display: grid;
  gap: 0.42rem;
}

.editor-field span {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.note-editor-active .article-summary,
.note-editor-active .infobox,
.note-editor-active .tag-block,
.note-editor-active .neighbor-block {
  display: none;
}

.infobox {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0.95rem 0 0;
}

.infobox div {
  padding: 0.74rem 0.78rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.infobox dt {
  margin: 0 0 0.24rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
}

.infobox dd {
  margin: 0;
  font-weight: 600;
}

.tag-block,
.neighbor-block {
  margin-top: 1rem;
}

.tag-list,
.neighbor-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.neighbor-chip {
  cursor: pointer;
}

.agent-presence {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.58;
}

.agent-primary {
  display: grid;
  gap: 0.9rem;
}

.agent-reveal-button {
  width: 100%;
  justify-content: center;
  padding-block: 0.78rem;
  border-radius: 999px;
  border: 1px solid rgba(127, 143, 255, 0.34);
  background:
    linear-gradient(135deg, rgba(127, 143, 255, 0.22), rgba(113, 223, 255, 0.14));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.22);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.agent-reveal-button:hover {
  border-color: rgba(127, 143, 255, 0.46);
  background:
    linear-gradient(135deg, rgba(127, 143, 255, 0.3), rgba(113, 223, 255, 0.18));
}

.agent-bridge-list {
  display: grid;
  gap: 0.72rem;
}

.agent-bridge-placeholder,
.agent-bridge-card {
  display: grid;
  gap: 0.45rem;
  padding: 0.88rem 0.92rem;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.agent-bridge-placeholder {
  color: var(--ink-soft);
  line-height: 1.55;
}

.agent-bridge-placeholder strong {
  color: var(--ink);
}

.agent-bridge-kicker {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.agent-bridge-card strong {
  font-size: 1rem;
  line-height: 1.25;
}

.agent-bridge-card p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.52;
}

.agent-bridge-concept {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 0.34rem 0.62rem;
  border-radius: 999px;
  background: rgba(127, 143, 255, 0.12);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 600;
}

.agent-bridge-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.1rem;
}

.agent-section {
  display: grid;
  gap: 0.6rem;
}

.agent-draft-panel {
  display: grid;
  gap: 0.7rem;
  padding: 0.88rem 0.92rem;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.agent-draft-panel[hidden] {
  display: none;
}

.agent-draft-panel textarea {
  min-height: 12rem;
  resize: vertical;
}

.agent-chat-section {
  padding-top: 0.1rem;
}

.agent-chat-log {
  display: grid;
  gap: 0.6rem;
  max-height: 180px;
  overflow: auto;
  padding-right: 0.2rem;
}

.agent-message {
  display: grid;
  gap: 0.28rem;
  padding: 0.74rem 0.82rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.agent-message.user {
  background: rgba(127, 143, 255, 0.12);
  border-color: rgba(127, 143, 255, 0.22);
}

.agent-message p,
.agent-message ul {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.52;
}

.agent-message ul {
  padding-left: 1.05rem;
}

.agent-message strong {
  color: var(--ink);
}

.agent-message-label {
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.agent-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
}

.agent-chat-form input {
  min-width: 0;
}

.metric-chip {
  align-items: flex-start;
  padding-inline: 0.72rem;
}

.metric-chip strong {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
}

.metric-chip span {
  display: block;
  margin-top: 0.18rem;
  color: var(--ink);
  font-size: 0.84rem;
}

@media (max-width: 1260px) {
  .vault-sidebar {
    width: 250px;
  }

  .note-pane {
    width: 290px;
  }

  .stage-header {
    width: min(680px, calc(100vw - 600px));
  }

  .assistant-shell {
    width: min(340px, calc(100vw - 2rem));
  }
}

@media (max-width: 1040px) {
  .workspace-shell {
    display: flex;
    flex-direction: column;
    overflow: auto;
  }

  .workspace-shell.connectome-immersive {
    height: 100svh;
    min-height: 100svh;
    overflow: hidden;
  }

  .workspace-shell:not(.connectome-immersive) {
    padding-bottom: calc(5.4rem + env(safe-area-inset-bottom));
  }

  .workspace-shell.connectome-immersive .vault-sidebar,
  .workspace-shell.connectome-immersive .note-pane {
    display: none;
  }

  .stage-pane {
    min-height: 100svh;
  }

  .stage-shell {
    min-height: 100svh;
    padding-top: 100svh;
    overflow: visible;
  }

  .workspace-shell.connectome-immersive .stage-shell {
    height: 100svh;
    min-height: 100svh;
    padding-top: 0;
    overflow: hidden;
  }

  .graph-viewport,
  .label-layer {
    top: 0;
    right: 0;
    bottom: auto;
    left: 0;
    height: 100svh;
  }

  .selected-node-label {
    max-width: min(28rem, 72%);
    font-size: 0.94rem;
  }

  .mobile-menu-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    height: calc(4.4rem + env(safe-area-inset-bottom));
    display: block;
    border-top: 1px solid rgba(127, 143, 255, 0.28);
    background: rgba(7, 10, 16, 0.9);
    box-shadow:
      0 -14px 34px rgba(0, 0, 0, 0.34),
      inset 0 1px 0 rgba(255, 255, 255, 0.035);
    backdrop-filter: blur(22px);
  }

  .mobile-panel-toggle {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.58rem;
    padding:
      0.15rem
      5.5rem
      env(safe-area-inset-bottom)
      1rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    box-shadow: none;
    backdrop-filter: none;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1;
  }

  .mobile-panel-toggle:hover,
  .mobile-panel-toggle:focus-visible {
    background: rgba(127, 143, 255, 0.1);
  }

  .mobile-menu-icon {
    font-size: 1.1rem;
  }

  .mobile-menu-label {
    letter-spacing: 0;
  }

  .mobile-menu-state {
    color: var(--ink-faint);
    font-size: 1rem;
    transition: transform 160ms ease;
  }

  .mobile-panel-toggle[aria-expanded="true"] .mobile-menu-state {
    transform: rotate(180deg);
  }

  .vault-sidebar,
  .note-pane {
    position: static;
    width: auto;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    margin: 1rem;
    background: rgba(9, 12, 18, 0.78);
  }

  .vault-sidebar {
    order: 2;
    height: min(920px, calc(100svh + 4.75rem));
    overflow: hidden;
  }

  .vault-sidebar .tree-panel {
    min-height: 0;
    overflow: hidden;
  }

  .vault-sidebar .note-tree {
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.35rem;
    scrollbar-gutter: stable;
  }

  .note-pane {
    order: 3;
    min-height: 72vh;
  }

  .stage-pane {
    order: 1;
    min-height: 100svh;
  }

  #search-mode-meta,
  .source-accordion-panel .search-meta {
    display: none;
  }

  .stage-header {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: auto;
    margin: 1rem;
    transform: none;
  }

  .controls-stack {
    top: max(0.85rem, calc(100svh - 18.4rem));
    bottom: auto;
  }

  .assistant-shell {
    right: 0.75rem;
    bottom: calc(0.6rem + env(safe-area-inset-bottom));
  }

  .assistant-shell:not([data-open="true"]) {
    left: auto;
    width: 3.2rem;
  }
}

@media (max-width: 720px) {
  .stage-header {
    grid-template-columns: 1fr;
    top: auto;
  }

  .button-row-stack {
    grid-template-columns: 1fr;
  }

  .assistant-panel {
    max-height: 60vh;
  }

  .assistant-shell[data-open="true"] {
    width: min(100vw - 2rem, 100%);
  }

  .assistant-bubble-label {
    display: none;
  }
}

@media (max-width: 520px) {
  .button-row-stack {
    grid-template-columns: 1fr;
  }

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

  .button-row {
    flex-wrap: wrap;
  }

  .top-right {
    position: static;
  }

  .stage-shell {
    display: block;
    min-height: 100svh;
  }

  .graph-viewport,
  .label-layer {
    top: 0;
    right: 0;
    bottom: auto;
    left: 0;
  }

  .selected-node-label {
    max-width: 76%;
    padding: 0.48rem 0.72rem;
    font-size: 0.88rem;
  }

  .legend {
    max-width: 100%;
  }

  .assistant-shell {
    right: 0.75rem;
    bottom: calc(0.6rem + env(safe-area-inset-bottom));
  }

}
