:root {
  --bg: #09090b;
  --bg-soft: rgba(8, 8, 12, 0.62);
  --bg-heavy: rgba(8, 8, 12, 0.8);
  --bg-light: rgba(8, 8, 12, 0.42);
  --border-soft: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text-primary: rgba(255, 255, 255, 0.86);
  --text-secondary: rgba(255, 255, 255, 0.58);
  --text-muted: rgba(255, 255, 255, 0.28);
  --plum: rgba(43, 0, 48, 0.24);
  --yellow: #ffca01;
  --orange: #ff6500;
  --scarlet: #ff2000;
  --cerise: #ea00ad;
  --radius: 2px;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.46);
  --content-max: 1600px;
  --content-left: max(32px, calc((100vw - var(--content-max)) / 2 + 32px));
  --content-right: max(80px, calc((100vw - var(--content-max)) / 2 + 80px));
  font-family: "DM Sans", sans-serif;
  color: var(--text-primary);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden; /* For Observer scrollytelling */
  background: var(--bg);
  color: var(--text-primary);
}

button, input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

/* ==========================================================================
   THE STAGE (Background layers)
   ========================================================================== */
.stage-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

#stage-webgl {
  opacity: 0.76;
  transition: opacity 0.8s ease;
}

/* ==========================================================================
   GLOBAL TOPBAR
   ========================================================================== */
#global-topbar {
  opacity: 0;
  pointer-events: none;
  position: fixed;
  top: 24px;
  left: var(--content-left);
  right: var(--content-right);
  z-index: 100;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(220px, 280px) 1fr;
  padding: 14px 18px;
  transform: translateY(-20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

#global-topbar.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.query-dock {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
}

/* ==========================================================================
   NAVIGATION DOTS
   ========================================================================== */
.dot-nav {
  position: fixed;
  right: 32px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 50;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  padding: 0;
}

.dot:hover {
  background: rgba(255, 255, 255, 0.6);
  transform: scale(1.5);
}

.dot.active {
  background: var(--yellow);
  box-shadow: 0 0 10px var(--orange);
  transform: scale(1.5);
}

/* ==========================================================================
   DIGITAL GUIDE
   ========================================================================== */
.digital-guide {
  position: fixed;
  bottom: 32px;
  left: 32px;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  transition: opacity 0.32s ease, transform 0.32s ease;
}

.digital-guide.lab-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
}

.guide-icon {
  width: 48px;
  height: 48px;
  cursor: pointer;
  position: relative;
}

.guide-ring {
  fill: none;
  stroke: rgba(255, 255, 255, 0.4);
  stroke-width: 1;
  transform-origin: center;
}

.guide-panel {
  width: 280px;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.95);
  transform-origin: bottom left;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.digital-guide.open .guide-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.digital-guide.open .guide-center {
  fill: var(--yellow);
}

#guide-title {
  margin-bottom: 8px;
}

#guide-copy {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* ==========================================================================
   GLASS PANELS
   ========================================================================== */
.glass-panel {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.glass-heavy { background: var(--bg-heavy); }
.glass-primary { background: var(--bg-soft); }
.glass-light, .glass-login { background: var(--bg-light); }

.machine-label, .status-pill, .runtime-meta, .toggle-copy, .upload-chip, .legend-dot, .panel-empty {
  font-family: "Fira Code", monospace;
}

.machine-label {
  color: rgba(255, 255, 255, 0.32);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ==========================================================================
   LAYERS
   ========================================================================== */
#layers-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
}

.layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.layer.active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

/* ==========================================================================
   LAYER 1: THE HOOK
   ========================================================================== */
.hook-panel {
  width: min(920px, calc(100vw - 64px));
  max-width: none;
  padding: 48px clamp(24px, 5vw, 56px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: center;
}

.hero-kicker {
  margin-bottom: 16px;
}

#hook-title {
  margin: 0 0 32px;
  font-size: 1.8rem;
  font-weight: 500;
  align-self: stretch;
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  line-height: 1.05;
}

.hook-title-line {
  display: block;
}

.hook-title-line-accent {
  color: rgba(255, 255, 255, 0.94);
}

.hook-dock {
  width: 100%;
  max-width: 100%;
  display: block; /* Override grid from query-dock */
}

.query-input-shell {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.query-input-wrapper {
  position: relative;
  width: 100%;
}

.query-actions {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 4px;
  pointer-events: none;
  opacity: 0.6;
  transition: opacity 200ms ease;
  z-index: 5;
}

.query-input-wrapper:focus-within .query-actions,
.query-input-wrapper:hover .query-actions {
  opacity: 1;
  pointer-events: auto;
}

.query-action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 2px;
  cursor: pointer;
  pointer-events: auto;
  transition: all 200ms ease;
  white-space: nowrap;
}

.query-action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.enter-btn:hover {
  background: rgba(255, 202, 1, 0.1);
  border-color: rgba(255, 202, 1, 0.3);
  color: var(--yellow);
}

.hook-results {
  display: flex;
  gap: 16px;
  margin-top: 32px;
  justify-content: center;
  min-height: 56px;
  flex-wrap: wrap;
}

.hook-emoji {
  font-size: 2.8rem;
  line-height: 1;
  display: inline-block;
  filter: drop-shadow(0 0 12px rgba(255, 202, 1, 0.15));
}

.omnibar-input {
  padding-left: 34px !important;
  padding-right: 120px !important; /* Make room for buttons */
}

.hook-dock input {
  padding-right: 120px !important;
}

.query-input-shell input {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  outline: none;
  padding: 0 16px;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  transition: border-color 200ms ease, box-shadow 200ms ease;
  font-size: 1.1rem;
  width: 100%;
}

.query-input-shell input:focus {
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 0 20px rgba(43, 0, 48, 0.25);
}

.query-input-shell input::placeholder {
  color: rgba(255, 255, 255, 0.34);
  transition: color 180ms ease;
}

.omnibar-shell {
  position: relative;
}

.omnibar-input {
  padding-left: 34px;
  min-height: 52px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)),
    rgba(255, 255, 255, 0.03);
  transition:
    border-color 200ms ease,
    box-shadow 200ms ease,
    background 220ms ease,
    transform 220ms ease;
}

.omnibar-shell:has(.omnibar-input:placeholder-shown)::after {
  content: "";
  position: absolute;
  left: 16px;
  bottom: 14px;
  width: 2px;
  height: 22px;
  border-radius: 2px;
  background: rgba(255, 202, 1, 0.9);
  box-shadow: 0 0 12px rgba(255, 202, 1, 0.55);
  animation: omnibar-caret-blink 1.05s steps(1, end) infinite;
  pointer-events: none;
}

.omnibar-shell:has(.omnibar-input:placeholder-shown) .omnibar-input {
  border-color: rgba(255, 202, 1, 0.18);
  background:
    linear-gradient(90deg, rgba(255, 202, 1, 0.08), rgba(234, 0, 173, 0.02) 42%, rgba(255, 255, 255, 0)),
    rgba(255, 255, 255, 0.04);
  box-shadow:
    inset 0 0 0 1px rgba(255, 202, 1, 0.04),
    0 0 0 1px rgba(255, 202, 1, 0.04),
    0 0 30px rgba(255, 202, 1, 0.07);
}

.omnibar-shell:has(.omnibar-input:placeholder-shown) .omnibar-input::placeholder {
  color: rgba(255, 255, 255, 0.52);
}

.omnibar-shell:has(.omnibar-input:focus)::after {
  background: rgba(255, 202, 1, 1);
  box-shadow: 0 0 14px rgba(255, 202, 1, 0.75);
}

@keyframes omnibar-caret-blink {
  0%, 46% {
    opacity: 1;
  }

  47%, 100% {
    opacity: 0.15;
  }
}

#regex-hud {
  font-size: 11px;
  color: var(--yellow);
  height: 14px;
}

/* ==========================================================================
   LAYER 2: THE REVEAL (SPLIT SCREEN)
   ========================================================================== */
#layer-reveal {
  align-items: stretch;
  padding: 142px var(--content-right) 36px var(--content-left);
}

.compare-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(340px, 440px) minmax(0, 1fr);
  width: 100%;
  max-width: none;
  margin: 0;
  height: 100%;
}

.panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 24px;
  position: relative;
  height: 100%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    rgba(8, 8, 12, 0.46);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-header h3 {
  margin: 6px 0 0;
  font-size: 1.35rem;
  font-weight: 500;
}

.status-pill {
  align-self: flex-start;
  min-height: 28px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-pill-accent {
  color: rgba(255, 250, 232, 0.88);
  border-color: rgba(255, 202, 1, 0.24);
  background: linear-gradient(180deg, rgba(255, 202, 1, 0.12), rgba(255, 101, 0, 0.06));
}

.scanner {
  position: relative;
  min-height: 220px;
  padding: 20px 18px 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
    rgba(5, 5, 8, 0.72);
  overflow: hidden;
}

.scanner::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.22;
  pointer-events: none;
}

.scanner-bar {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 202, 1, 0.85), transparent);
  box-shadow: 0 0 20px rgba(255, 202, 1, 0.45);
  animation: scanner-sweep 2.6s linear infinite;
}

.scanner-rows {
  position: relative;
  display: grid;
  gap: 10px;
  z-index: 1;
}

.scan-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  color: rgba(255, 255, 255, 0.62);
  font-family: "Fira Code", monospace;
  font-size: 11px;
  line-height: 1.5;
}

.scan-row .emoji {
  font-size: 16px;
  line-height: 1;
}

.scan-row code {
  white-space: normal;
  word-break: break-word;
}

.scan-hit {
  color: rgba(255, 250, 232, 0.94);
  background: rgba(255, 202, 1, 0.14);
}

.keyword-results {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.keyword-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.025);
}

.keyword-card .emoji {
  font-size: 24px;
  line-height: 1;
}

.keyword-card h4 {
  margin: 0 0 4px;
  font-size: 0.98rem;
  font-weight: 500;
}

.keyword-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.panel-empty {
  display: none;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
}

.empty-copy {
  margin: 0 0 14px;
}

.empty-groups {
  display: grid;
  gap: 12px;
}

.empty-group {
  display: grid;
  gap: 8px;
}

.empty-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.empty-chip {
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  border-radius: 999px;
  font-size: 12px;
}

.empty-chip:hover {
  border-color: rgba(255, 202, 1, 0.24);
  background: rgba(255, 202, 1, 0.08);
}

/* Right Panel (Vector) */
.vector-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0)),
    radial-gradient(circle at 74% 22%, rgba(234, 0, 173, 0.08), transparent 26%),
    radial-gradient(circle at 86% 76%, rgba(255, 101, 0, 0.05), transparent 30%),
    rgba(5, 5, 8, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 120px rgba(255, 255, 255, 0.02);
}

.vector-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: 500px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    radial-gradient(circle at 72% 20%, rgba(234, 0, 173, 0.08), transparent 22%),
    radial-gradient(circle at 88% 74%, rgba(255, 101, 0, 0.05), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)),
    rgba(6, 6, 10, 0.62);
}

.vector-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.024) 1px, transparent 1px);
  background-size: 80px 80px;
  opacity: 0.18;
  mask-image: radial-gradient(circle at 35% 50%, black 35%, transparent 90%);
  -webkit-mask-image: radial-gradient(circle at 35% 50%, black 35%, transparent 90%);
  pointer-events: none;
}

.vector-connections {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  z-index: 1;
}

.vector-rail {
  fill: none;
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 1;
}

.vector-rail-primary {
  stroke: rgba(255, 202, 1, 0.28);
}

.vector-latitude {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 1;
}

.vector-connection {
  fill: none;
  stroke: rgba(255, 255, 255, 0.28);
  stroke-width: 1.15;
}

.vector-connection-exact {
  stroke: rgba(255, 202, 1, 0.9);
  stroke-width: 1.8;
}

.vector-chip-leader {
  fill: none;
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 0.95;
  stroke-dasharray: 2 6;
}

.vector-chip-leader-exact {
  stroke: rgba(255, 202, 1, 0.46);
  stroke-width: 1.15;
}

.vector-ring {
  fill: none;
  stroke: rgba(255, 255, 255, 0.22);
}

.vector-ring-exact {
  stroke: rgba(255, 202, 1, 0.8);
}

.score-label {
  fill: rgba(255, 255, 255, 0.48);
  font-family: "Fira Code", monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
}

.vector-cluster {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.vector-idle {
  position: absolute;
  right: 9%;
  bottom: 12%;
  max-width: 240px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(7, 7, 11, 0.58);
  color: var(--text-secondary);
}

.vector-idle p {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.55;
}

.query-orb {
  position: absolute;
  left: 16%;
  top: 50%;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.88);
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 38% 38%, rgba(255, 255, 255, 0.94), rgba(241, 241, 248, 0.78) 28%, rgba(255, 255, 255, 0.16) 54%, transparent 72%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.08), inset 0 0 16px rgba(255, 255, 255, 0.06);
  opacity: 0;
  z-index: 3;
}

.query-orb.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  transition: opacity 320ms ease, transform 420ms ease;
}

.query-orb::before,
.query-orb::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 50%;
}

.query-orb::after {
  inset: -16px;
  border-color: rgba(255, 202, 1, 0.09);
}

#query-orb-label {
  max-width: 60px;
  text-align: center;
  font-family: "Fira Code", monospace;
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.9);
}

.vector-chip {
  position: absolute;
  left: calc(var(--x, 50) * 1%);
  top: calc(var(--y, 50) * 1%);
  transform: translate(-50%, -50%);
  min-width: 132px;
  max-width: 172px;
  padding: 10px 12px 10px 40px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
    rgba(7, 7, 11, 0.76);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.24);
  opacity: var(--alpha, 0.9);
}

.vector-chip::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.18);
}

.vector-chip.is-exact {
  border-color: rgba(255, 202, 1, 0.28);
  box-shadow: 0 16px 48px rgba(255, 202, 1, 0.12);
}

.vector-chip.is-exact::before {
  background: rgba(255, 202, 1, 0.96);
  box-shadow: 0 0 20px rgba(255, 202, 1, 0.3);
}

.vector-chip .emoji {
  position: absolute;
  left: 42px;
  top: 9px;
  font-size: 18px;
  line-height: 1;
}

.vector-chip strong {
  display: block;
  margin-left: 28px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
}

.vector-chip small {
  display: block;
  margin-left: 28px;
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.3;
}

.vector-chip mark {
  display: inline-block;
  margin-left: 28px;
  margin-top: 8px;
  padding: 2px 6px;
  background: rgba(255, 202, 1, 0.12);
  color: rgba(255, 245, 220, 0.92);
  font-family: "Fira Code", monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.vector-legend {
  display: flex;
  gap: 18px;
  margin-top: auto;
  padding-top: 16px;
  background: rgba(8, 8, 12, 0.5);
  backdrop-filter: blur(8px);
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  align-self: flex-end; /* Move to right to avoid digital-guide */
}

.vector-legend > div {
  align-items: center;
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-dot {
  border-radius: 999px;
  display: inline-block;
  height: 10px;
  width: 10px;
}

.legend-dot-query { background: var(--yellow); }
.legend-dot-hit { background: rgba(255, 255, 255, 0.62); }

.scanner.hidden {
  display: none;
}


/* ==========================================================================
   LAYER 3: THE LAB (Vector Collider)
   ========================================================================== */
#layer-lab {
  align-items: stretch;
  justify-content: flex-start;
  padding: 40px var(--content-right) 16px var(--content-left);
}

.lab-shell {
  width: 100%;
  max-width: 1680px;
  height: calc(100vh - 56px);
  display: grid;
  grid-template-columns: minmax(248px, 288px) minmax(0, 1fr);
  gap: 20px;
}

.collider-panel,
.collider-stage-panel,
.collider-inspector {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.collider-main {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
}

.collider-controls {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    rgba(5, 4, 10, 0.82);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.collider-controls h3,
.collider-stage-panel h3 {
  margin: 6px 0 0;
  font-size: 1.42rem;
  font-weight: 500;
}

.collider-intro {
  margin: 10px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}

.collider-source-block,
.collider-mode-group,
.collider-slider-block,
.collider-preset-bank {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.collider-input-shell {
  display: grid;
  gap: 8px;
}

.collider-anchor-bank {
  display: grid;
  gap: 8px;
}

.collider-anchor-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 44px;
}

.collider-anchor-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
  border-radius: 10px;
}

.collider-anchor-option:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
}

.collider-anchor-option.is-active {
  border-color: rgba(255, 202, 1, 0.32);
  background: linear-gradient(180deg, rgba(255, 202, 1, 0.16), rgba(255, 101, 0, 0.08));
}

.collider-anchor-option .emoji {
  font-size: 22px;
  line-height: 1;
}

.collider-anchor-empty {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.collider-input-shell input {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  outline: none;
  padding: 0 14px;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  transition: border-color 200ms ease, box-shadow 200ms ease;
  font-size: 1rem;
}

.collider-input-shell input:focus {
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 0 24px rgba(234, 0, 173, 0.12);
}

.collider-mode-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.collider-mode,
.collider-preset,
.collider-action {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  transition: border-color 200ms ease, background-color 200ms ease, transform 200ms ease;
}

.collider-mode {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.collider-mode:hover,
.collider-preset:hover,
.collider-action:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
}

.collider-mode.is-active {
  border-color: rgba(255, 202, 1, 0.3);
  background: linear-gradient(180deg, rgba(255, 202, 1, 0.16), rgba(255, 101, 0, 0.08));
  color: rgba(255, 248, 228, 0.96);
}

.collider-slider-head,
.projection-card-head,
.score-card-top,
.score-card-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.collider-slider-head strong {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 250, 232, 0.9);
}

.collider-slider-block input[type="range"] {
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 101, 0, 0.3), rgba(255, 202, 1, 0.65), rgba(234, 0, 173, 0.35));
  outline: none;
}

.collider-slider-block input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 248, 230, 0.98);
  box-shadow: 0 0 0 4px rgba(255, 202, 1, 0.08);
}

.collider-slider-block input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 248, 230, 0.98);
  box-shadow: 0 0 0 4px rgba(255, 202, 1, 0.08);
}

.collider-slider-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 12px;
}

.collider-actions {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.collider-preset-bank {
  margin-top: auto;
  padding-top: 10px;
}

.collider-presets {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.collider-preset {
  min-height: 60px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 25px;
  line-height: 1;
}

.collider-preset-glyphs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.collider-stage-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    rgba(4, 3, 9, 0.84);
}

.collider-stage-head {
  align-items: flex-start;
}

.collider-stage-chrome {
  display: flex;
  align-items: center;
  gap: 14px;
}

.collider-inline-toggle .toggle-copy {
  min-width: auto;
}

.collider-stage {
  position: relative;
  flex: 1;
  min-height: clamp(500px, 56vh, 620px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at 50% 36%, rgba(66, 5, 72, 0.06), transparent 26%),
    radial-gradient(circle at 50% 68%, rgba(255, 202, 1, 0.028), transparent 22%),
    linear-gradient(180deg, rgba(10, 1, 14, 0.985), rgba(3, 2, 7, 0.995));
  overflow: hidden;
}

.collider-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 54%, rgba(255, 255, 255, 0.01), transparent 32%),
    linear-gradient(180deg, rgba(255, 101, 0, 0.016), transparent 18%, transparent 82%, rgba(234, 0, 173, 0.02));
  pointer-events: none;
}

.collider-stage.is-computing::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 202, 1, 0.08), transparent);
  animation: collider-scan 1s linear infinite;
  pointer-events: none;
}

.collider-stage.is-sampling {
  box-shadow: inset 0 0 120px rgba(255, 202, 1, 0.08);
}

.collider-geometry {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.collider-empty {
  position: absolute;
  left: 28px;
  top: 28px;
  z-index: 2;
  display: grid;
  gap: 10px;
  max-width: 320px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(6, 5, 10, 0.72);
  color: var(--text-secondary);
}

.collider-empty p {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
}

.collider-stage-overlay {
  position: absolute;
  left: 22px;
  top: 22px;
  z-index: 2;
  width: min(340px, calc(100% - 44px));
}

.collider-axis {
  fill: none;
  stroke: rgba(255, 255, 255, 0.28);
  stroke-width: 1.3;
}

.collider-grid-line {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.collider-grid-line-soft {
  stroke-opacity: 0.6;
}

.collider-axis-label,
.collider-origin-label,
.collider-mix-label,
.collider-result-score,
.collider-result-label,
.collider-node-label,
.collider-context-label,
.collider-formula,
.projection-card code {
  font-family: "Fira Code", monospace;
}

.collider-axis-label {
  fill: rgba(255, 255, 255, 0.46);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.collider-origin-ring,
.collider-mix-orb {
  fill: rgba(10, 10, 14, 0.88);
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 1.3;
}

.collider-origin-core {
  fill: rgba(255, 248, 230, 0.96);
}

.collider-origin-label,
.collider-mix-label {
  fill: rgba(255, 248, 230, 0.82);
  font-size: 10px;
}

.collider-mix-beam {
  fill: none;
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 1.1;
  stroke-dasharray: 6 8;
}

.collider-normalize-path {
  fill: none;
  stroke: rgba(255, 202, 1, 0.42);
  stroke-width: 1.4;
  stroke-dasharray: 4 7;
}

.collider-vector {
  fill: none;
  stroke-width: 2.3;
}

.collider-vector-a {
  stroke: rgba(255, 101, 0, 0.86);
}

.collider-vector-b {
  stroke: rgba(234, 0, 173, 0.84);
}

.collider-vector-r {
  stroke: rgba(180, 205, 255, 0.72);
}

.collider-vector-h {
  stroke: rgba(255, 231, 176, 0.96);
  filter: drop-shadow(0 0 12px rgba(255, 202, 1, 0.24));
}

.collider-node-ring {
  fill: rgba(10, 10, 14, 0.88);
  stroke-width: 1.6;
}

.collider-node-ring-a {
  stroke: rgba(255, 101, 0, 0.92);
}

.collider-node-ring-b {
  stroke: rgba(234, 0, 173, 0.9);
}

.collider-node-ring-r {
  stroke: rgba(172, 196, 255, 0.84);
}

.collider-node-ring-h {
  stroke: rgba(255, 232, 184, 0.98);
}

.collider-node-id {
  fill: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  font-weight: 700;
}

.collider-node-label {
  fill: rgba(255, 255, 255, 0.72);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.collider-neighbor-line {
  fill: none;
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 1;
  stroke-dasharray: 3 6;
}

.collider-context-line {
  fill: none;
  stroke-width: 1;
  stroke-dasharray: 2 7;
  opacity: 0.34;
}

.collider-context-line-a {
  stroke: rgba(255, 101, 0, 0.4);
}

.collider-context-line-b {
  stroke: rgba(234, 0, 173, 0.4);
}

.collider-context-dot {
  fill: rgba(10, 10, 14, 0.92);
  stroke-width: 1.1;
}

.collider-context-dot-a {
  stroke: rgba(255, 101, 0, 0.58);
}

.collider-context-dot-b {
  stroke: rgba(234, 0, 173, 0.58);
}

.collider-context-emoji {
  fill: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.collider-context-label {
  fill: rgba(255, 255, 255, 0.5);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.collider-result-ring {
  fill: rgba(255, 255, 255, 0.08);
  stroke: rgba(255, 255, 255, 0.38);
  stroke-width: 1.2;
}

.collider-result-emoji {
  fill: rgba(255, 255, 255, 0.88);
  font-size: 15px;
}

.collider-result-score {
  fill: rgba(255, 255, 255, 0.42);
  font-size: 9px;
}

.collider-result-label {
  fill: rgba(255, 255, 255, 0.82);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.toggle {
  align-items: center;
  display: flex;
  gap: 12px;
  cursor: pointer;
}

.toggle input { display: none; }

.toggle-track {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  display: inline-flex;
  flex: 0 0 auto;
  height: 22px;
  position: relative;
  width: 42px;
}

.toggle-track::after {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  content: "";
  height: 14px;
  left: 4px;
  position: absolute;
  top: 3px;
  transition: transform 200ms ease, background-color 200ms ease;
  width: 14px;
}

.toggle input:checked + .toggle-track { background: rgba(43, 0, 48, 0.32); }
.toggle input:checked + .toggle-track::after {
  background: var(--yellow);
  transform: translateX(18px);
}

.collider-inspector {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    rgba(5, 4, 10, 0.82);
  padding: 16px 18px;
}

.collider-inspector-block {
  display: grid;
  gap: 8px;
}

.collider-formula {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(5, 4, 10, 0.84);
  color: rgba(255, 248, 230, 0.92);
  font-size: 10px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
}

.formula-ribbon {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.formula-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 248, 230, 0.92);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.formula-chip-a {
  border-color: rgba(255, 101, 0, 0.24);
  color: rgba(255, 219, 194, 0.94);
}

.formula-chip-b {
  border-color: rgba(234, 0, 173, 0.24);
  color: rgba(255, 210, 245, 0.94);
}

.formula-chip-r {
  border-color: rgba(180, 205, 255, 0.22);
  color: rgba(220, 232, 255, 0.92);
}

.formula-chip-h {
  border-color: rgba(255, 202, 1, 0.26);
  color: rgba(255, 240, 192, 0.96);
}

.formula-arrow {
  color: rgba(255, 255, 255, 0.34);
  font-size: 11px;
}

.formula-equation {
  display: block;
  margin-top: 10px;
  color: rgba(255, 244, 216, 0.88);
  font-size: 11px;
  line-height: 1.55;
}

.formula-note {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.45;
}

.collider-projection {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.projection-card {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.025);
  min-height: 106px;
}

.projection-card strong {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.86);
}

.projection-card code {
  display: block;
  margin-top: 6px;
  color: rgba(255, 244, 216, 0.86);
  font-size: 10px;
  line-height: 1.35;
}

.projection-card p {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
}

.projection-card-a {
  border-color: rgba(255, 101, 0, 0.18);
}

.projection-card-b {
  border-color: rgba(234, 0, 173, 0.18);
}

.projection-card-h {
  border-color: rgba(255, 202, 1, 0.22);
}

.collider-scoreboard {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.score-card {
  padding: 11px 12px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  min-height: 90px;
}

.score-card.is-empty p {
  margin: 6px 0 0;
}

.score-card-label {
  justify-content: flex-start;
}

.score-card-label .emoji {
  font-size: 18px;
}

.score-card strong {
  font-size: 12px;
  font-weight: 500;
}

.score-card-value {
  color: rgba(255, 250, 232, 0.88);
  font-family: "Fira Code", monospace;
  font-size: 11px;
}

.score-card p {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.35;
}

.score-bar {
  height: 5px;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.score-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, rgba(255, 101, 0, 0.8), rgba(255, 202, 1, 0.9));
}

.collider-explainer {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
  grid-column: 1 / -1;
  padding-top: 2px;
}

.runtime-meta {
  margin: 0;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.5;
}

.collider-runtime-meta {
  display: none;
}

@keyframes collider-scan {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@media (max-width: 1480px) {
  .lab-shell {
    grid-template-columns: minmax(252px, 288px) minmax(0, 1fr);
  }

  .collider-projection,
  .collider-scoreboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  #layer-lab {
    padding-top: 36px;
  }

  .lab-shell {
    grid-template-columns: 1fr;
    height: auto;
    overflow-y: auto;
    padding-right: 12px;
  }

  .collider-controls {
    order: 0;
  }

  .collider-preset-bank {
    margin-top: 18px;
  }

  .collider-stage {
    min-height: 560px;
  }

  .collider-inspector {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  #layer-lab {
    padding-top: 28px;
  }

  .collider-stage {
    min-height: 480px;
  }

  .collider-stage-chrome {
    flex-direction: column;
    align-items: flex-end;
  }

  .collider-projection,
  .collider-scoreboard {
    grid-template-columns: 1fr;
  }

  .collider-presets {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   LAYER 3: NETWORK EXPLORER
   ========================================================================== */
#layer-network {
  align-items: stretch;
  justify-content: flex-start;
  padding: 116px var(--content-right) 20px var(--content-left);
}

.network-shell {
  width: 100%;
  height: calc(100vh - 136px);
}

.network-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at 18% 22%, rgba(255, 202, 1, 0.028), transparent 20%),
    radial-gradient(circle at 78% 28%, rgba(234, 0, 173, 0.035), transparent 22%),
    radial-gradient(circle at 62% 74%, rgba(124, 51, 181, 0.05), transparent 26%),
    linear-gradient(180deg, rgba(7, 2, 12, 0.92), rgba(2, 3, 8, 0.98));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03), 0 28px 80px rgba(0, 0, 0, 0.28);
}

.network-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 52%, rgba(255, 255, 255, 0.02), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.01), transparent 22%, transparent 78%, rgba(255, 255, 255, 0.015));
  pointer-events: none;
  z-index: 0;
}

.network-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.network-copy,
.network-hud,
.network-legend {
  position: absolute;
  z-index: 3;
}

.network-copy {
  left: 24px;
  top: 24px;
  width: min(420px, calc(100% - 48px));
  padding: 18px;
  background: rgba(6, 5, 10, 0.78);
}

.network-copy h3 {
  margin: 8px 0 0;
  font-size: 1.5rem;
  font-weight: 500;
}

.network-copy p {
  margin: 10px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}

.network-hud {
  right: 24px;
  top: 24px;
  width: min(360px, calc(100% - 48px));
  padding: 16px 18px;
  display: grid;
  gap: 14px;
  background: rgba(6, 5, 10, 0.8);
}

.network-hud-head,
.network-metrics {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.network-hud-head strong,
.network-metric strong {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 245, 214, 0.94);
}

.network-action {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(255, 202, 1, 0.24);
  background: linear-gradient(180deg, rgba(255, 202, 1, 0.16), rgba(255, 101, 0, 0.08));
  color: rgba(255, 248, 228, 0.94);
}

.network-slider-shell {
  display: grid;
  gap: 8px;
}

.network-slider-shell input[type="range"] {
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 101, 0, 0.28), rgba(255, 202, 1, 0.7), rgba(234, 0, 173, 0.34));
}

.network-slider-shell input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 248, 230, 0.98);
  box-shadow: 0 0 0 4px rgba(255, 202, 1, 0.08);
}

.network-slider-shell input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 248, 230, 0.98);
  box-shadow: 0 0 0 4px rgba(255, 202, 1, 0.08);
}

.network-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.network-metric {
  display: grid;
  gap: 4px;
}

.network-metric span {
  color: var(--text-secondary);
  font-size: 12px;
}

.network-legend {
  left: 24px;
  bottom: 24px;
  width: calc(100% - 48px);
  padding: 12px 14px;
  background: rgba(6, 5, 10, 0.76);
}

.network-legend.is-search {
  padding: 6px 0 0;
  background: linear-gradient(180deg, rgba(6, 5, 10, 0), rgba(6, 5, 10, 0.16) 58%, rgba(6, 5, 10, 0.24));
  border-color: rgba(255, 255, 255, 0.03);
  box-shadow: none;
  backdrop-filter: none;
}

.network-legend-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.network-legend-grid::-webkit-scrollbar {
  display: none;
}

.network-cluster-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  padding: 8px 10px;
  min-width: 148px;
  max-width: 168px;
  flex: 0 0 148px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  transition: opacity 180ms ease, border-color 180ms ease, background 180ms ease;
}

.network-legend.is-search .network-cluster-card {
  min-width: 128px;
  max-width: 168px;
  flex: 0 0 128px;
  padding: 6px 8px;
  background: rgba(10, 10, 14, 0.34);
  border-color: rgba(255, 255, 255, 0.05);
}

.network-cluster-card.is-active {
  border-color: rgba(255, 202, 1, 0.26);
  background: rgba(255, 255, 255, 0.045);
}

.network-cluster-card.is-inactive {
  opacity: 0.38;
}

.network-cluster-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.network-cluster-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.network-cluster-label strong {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.88);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.network-cluster-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.network-cluster-meta {
  color: var(--text-secondary);
  font-family: "Fira Code", monospace;
  font-size: 10px;
  flex-shrink: 0;
  white-space: nowrap;
}

.network-cluster-exemplars {
  display: flex;
  gap: 6px;
  font-size: 16px;
  min-height: 18px;
}

.network-cluster-caption {
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.3;
  min-height: 26px;
}

.network-legend.is-search .network-cluster-caption {
  min-height: 0;
  max-height: 28px;
  overflow: hidden;
}

.network-frame,
.network-depth-line,
.network-cluster-link,
.network-query-link {
  fill: none;
}

.network-frame {
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 1;
}

.network-depth-line {
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 1;
  stroke-dasharray: 3 14;
}

.network-halo {
  filter: blur(14px);
  opacity: 0.1;
}

.network-halo.is-active {
  opacity: 0.18;
}

.network-cluster-anchor {
  fill: rgba(255, 255, 255, 0.46);
}

.network-cluster-anchor.is-active {
  filter: drop-shadow(0 0 8px rgba(255, 202, 1, 0.16));
}

.network-cluster-title {
  fill: rgba(255, 255, 255, 0.32);
  font-family: "Fira Code", monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.network-cluster-title.is-active {
  fill: rgba(255, 255, 255, 0.68);
}

.network-point {
  transition: opacity 220ms ease, transform 220ms ease;
}

.network-point.is-dim {
  opacity: 0.06;
}

.network-point.is-cluster {
  opacity: 0.28;
}

.network-hit-ring {
  fill: rgba(10, 10, 14, 0.88);
  stroke: rgba(255, 255, 255, 0.54);
  stroke-width: 1.3;
}

.network-hit-core {
  stroke-width: 1.1;
}

.network-hit-emoji {
  fill: rgba(255, 255, 255, 0.92);
  font-size: 16px;
}

.network-hit-label,
.network-hit-score {
  font-family: "Fira Code", monospace;
}

.network-hit-guide {
  fill: none;
  stroke: rgba(255, 255, 255, 0.24);
  stroke-width: 0.95;
  stroke-dasharray: 2 6;
  stroke-linecap: round;
  opacity: 0.72;
}

.network-hit-label {
  fill: rgba(255, 255, 255, 0.88);
  font-size: 11px;
  letter-spacing: 0.03em;
}

.network-hit-score {
  fill: rgba(255, 255, 255, 0.42);
  font-size: 9px;
}

.network-cluster-link {
  stroke-width: 1.1;
  stroke-dasharray: 3 8;
  opacity: 0.34;
}

.network-query-link {
  stroke: rgba(255, 245, 214, 0.34);
  stroke-width: 1.2;
  opacity: 0.42;
}

@media (max-width: 1180px) {
  #layer-network {
    padding-top: 108px;
  }

  .network-shell {
    height: calc(100vh - 124px);
  }

  .network-copy,
  .network-hud,
  .network-legend {
    width: min(100%, calc(100% - 32px));
    left: 16px;
    right: 16px;
  }

  .network-copy,
  .network-hud {
    position: absolute;
  }

  .network-copy {
    top: 16px;
  }

  .network-hud {
    top: auto;
    bottom: 16px;
  }

  .network-legend {
    display: none;
  }
}

@media (max-width: 820px) {
  #layer-network {
    padding-top: 96px;
  }

  .network-shell {
    height: calc(100vh - 108px);
  }

  .network-copy {
    max-width: none;
  }

  .network-hud-head,
  .network-metrics {
    grid-template-columns: 1fr;
  }
}

.xray-enabled .vector-stage {
  background:
    radial-gradient(circle at 15% 50%, rgba(255, 202, 1, 0.16), transparent 18%),
    radial-gradient(circle at 65% 25%, rgba(234, 0, 173, 0.1), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)),
    rgba(4, 4, 6, 0.82);
}

.xray-enabled .collider-stage {
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 202, 1, 0.045), transparent 32%),
    linear-gradient(180deg, rgba(9, 1, 13, 0.99), rgba(3, 2, 7, 0.995));
}

.xray-enabled .collider-axis {
  stroke: rgba(255, 255, 255, 0.28);
}

.xray-enabled .collider-neighbor-line {
  stroke: rgba(255, 255, 255, 0.32);
}

.xray-enabled .collider-context-line {
  opacity: 0.56;
}

.xray-enabled .collider-result-ring {
  stroke: rgba(255, 255, 255, 0.62);
}

.xray-enabled .collider-vector-h {
  filter: drop-shadow(0 0 18px rgba(255, 202, 1, 0.34));
}

.xray-enabled .vector-chip {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.32);
}

.xray-enabled .vector-connection {
  stroke: rgba(255, 255, 255, 0.42);
}

.xray-enabled .vector-connection-exact {
  stroke: rgba(255, 202, 1, 0.98);
}

@keyframes scanner-sweep {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(220px);
  }
}
