:root {
  --bg: #04060e;
  --bg-2: #070b18;
  --bg-3: #0a1124;
  --fg: #eaf1fb;
  --muted: rgba(234, 241, 251, 0.62);
  --dim: rgba(234, 241, 251, 0.38);
  --faint: rgba(234, 241, 251, 0.12);
  --accent: #5eead4;
  --accent-strong: #2dd4bf;
  --accent-2: #38bdf8;
  --accent-3: #a78bfa;
  --accent-4: #f472b6;
  --border: rgba(94, 234, 212, 0.16);
  --border-strong: rgba(94, 234, 212, 0.28);
  --panel-bg: rgba(8, 12, 24, 0.78);
  --grid: rgba(94, 234, 212, 0.07);
  --feature-color: var(--accent);
  --feature-color-rgb: 94, 234, 212;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  letter-spacing: -0.01em;
}
body.home { overflow: hidden; }
body.page { overflow-x: hidden; overflow-y: auto; }

a { color: inherit; }

/* ---------- Background layers ---------- */

.bg-base {
  position: fixed; inset: 0;
  background:
    radial-gradient(1400px 900px at 60% 30%, rgba(56, 189, 248, 0.05), transparent 60%),
    radial-gradient(900px 700px at 20% 80%, rgba(167, 139, 250, 0.045), transparent 65%),
    radial-gradient(700px 500px at 80% 90%, rgba(94, 234, 212, 0.04), transparent 65%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 60%, var(--bg-3) 100%);
  z-index: 0;
}

.bg-gradient {
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 900px 700px at 70% 45%, rgba(94, 234, 212, 0.10), transparent 55%),
    radial-gradient(ellipse 700px 500px at 75% 65%, rgba(56, 189, 248, 0.06), transparent 55%);
  z-index: 1;
  pointer-events: none;
}

.bg-grid {
  position: fixed; inset: 0;
  background-image:
    radial-gradient(circle, rgba(94, 234, 212, 0.10) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: 0 0;
  z-index: 1;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 90% 100% at 50% 50%, black 35%, transparent 90%);
  -webkit-mask-image: radial-gradient(ellipse 90% 100% at 50% 50%, black 35%, transparent 90%);
}

.bg-vignette {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse 90% 70% at 50% 100%, rgba(0,0,0,0.6), transparent 65%);
  z-index: 2;
  pointer-events: none;
}

/* ---------- Navbar ---------- */

.navbar {
  position: relative;
  z-index: 10;
  padding: 18px 36px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  background: linear-gradient(180deg, rgba(4, 6, 14, 0.6), rgba(4, 6, 14, 0.0));
}

.nav-inner {
  max-width: 1500px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--fg);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  filter: drop-shadow(0 0 8px rgba(94, 234, 212, 0.5));
}

.brand-logo {
  height: 30px;
  width: auto;
  display: block;
}

.brand-name {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
}

.brand-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  color: var(--accent);
  background: rgba(94, 234, 212, 0.08);
  padding: 3px 7px;
  border-radius: 5px;
  border: 1px solid var(--border);
  letter-spacing: 0.04em;
  margin-left: 4px;
}

.nav-links {
  display: flex;
  gap: 30px;
  list-style: none;
  font-size: 14px;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
  position: relative;
}

.nav-links a:hover { color: var(--fg); }

.nav-cta {
  display: flex;
  align-items: center;
  gap: 18px;
}

.link {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s ease;
}
.link:hover { color: var(--fg); }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: #022;
  font-weight: 600;
  font-size: 13.5px;
  border-radius: 9px;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.15s ease;
  box-shadow:
    0 6px 22px rgba(94, 234, 212, 0.22),
    inset 0 1px 0 rgba(255,255,255,0.3),
    inset 0 -1px 0 rgba(0,0,0,0.08);
  letter-spacing: -0.005em;
  border: 0;
  cursor: pointer;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow:
    0 12px 28px rgba(94, 234, 212, 0.32),
    inset 0 1px 0 rgba(255,255,255,0.3),
    inset 0 -1px 0 rgba(0,0,0,0.08);
  filter: brightness(1.04);
}

.btn-lg {
  padding: 13px 22px;
  font-size: 15px;
  border-radius: 11px;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 18px;
  background: transparent;
  border: 1px solid var(--faint);
  color: var(--fg);
  font-weight: 500;
  font-size: 14px;
  border-radius: 11px;
  text-decoration: none;
  transition: all 0.15s ease;
  cursor: pointer;
}
.btn-ghost:hover {
  border-color: var(--border-strong);
  background: rgba(94, 234, 212, 0.05);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  height: calc(100vh - 73px - 56px);
  min-height: 600px;
  overflow: hidden;
  z-index: 3;
}

#grid-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 4;
  opacity: 1;
}

/* Visual state driven by inline styles in script.js update() — JS lerps the values
   so we don't need a CSS transition (which kept getting interrupted by per-frame work). */
.hero-overlay.dim { /* see script.js update() */ }
.hero-overlay.hidden { pointer-events: none; }
.hero-overlay.caught { /* see script.js update() */ }

.hero-text {
  max-width: 560px;
  padding: 24px;
  pointer-events: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: rgba(94, 234, 212, 0.07);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 999px;
  margin-bottom: 28px;
  font-weight: 500;
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.hero-title {
  font-size: clamp(28px, 3.4vw, 48px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 18px;
  color: var(--fg);
}

.hero-title em {
  font-style: normal;
  background: linear-gradient(120deg, var(--accent) 10%, var(--accent-2) 60%, var(--accent-3) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 20px rgba(94, 234, 212, 0.18));
}

.hero-subtitle {
  font-size: 15px;
  line-height: 1.55;
  color: var(--muted);
  margin-bottom: 26px;
  max-width: 480px;
}

.hero-subtitle em {
  font-style: italic;
  color: var(--fg);
  font-weight: 500;
}

.hero-meta {
  display: flex;
  gap: 34px;
  margin-bottom: 36px;
  padding: 18px 22px;
  background: rgba(8, 14, 28, 0.4);
  border: 1px solid var(--faint);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  width: fit-content;
}

.hero-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-meta-item strong {
  font-size: 26px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-meta-item span {
  font-size: 11.5px;
  color: var(--dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 22px;
}

.hero-actions .btn-ghost { padding: 9px 14px; font-size: 13px; }

.hero-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--dim);
  letter-spacing: 0.02em;
  font-weight: 400;
  animation: hint-pulse 3.4s ease-in-out infinite;
}
.hero-hint svg { color: var(--accent); opacity: 0.7; }

@keyframes hint-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.95; }
}

/* ---------- Hover card (mouse-near-feature-dot) ---------- */

.hover-card {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  background: rgba(8, 14, 28, 0.92);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow:
    0 14px 36px rgba(0,0,0,0.5),
    0 0 0 1px rgba(94, 234, 212, 0.08),
    0 0 30px rgba(var(--feature-color-rgb), 0.18);
  opacity: 0;
  transform: translate(-50%, calc(-100% - 18px)) scale(0.92);
  transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  white-space: nowrap;
}

.hover-card.visible {
  opacity: 1;
  transform: translate(-50%, calc(-100% - 22px)) scale(1);
}

.hover-card::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: rgba(8, 14, 28, 0.92);
  border-right: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
}

.hover-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(var(--feature-color-rgb), 0.22), rgba(var(--feature-color-rgb), 0.08));
  border: 1px solid rgba(var(--feature-color-rgb), 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--feature-color);
  flex-shrink: 0;
}
.hover-icon svg { width: 16px; height: 16px; }

.hover-meta { display: flex; flex-direction: column; gap: 2px; }

.hover-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--feature-color);
  font-weight: 500;
}

.hover-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.01em;
}

.hover-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--dim);
  margin-left: 4px;
  padding-left: 10px;
  border-left: 1px solid var(--faint);
}

/* ---------- Feature panel (expanded) ---------- */

.feature-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(620px, 58vw, 920px);
  height: clamp(380px, 58vh, 580px);
  transform: translate(-50%, -50%) scale(0.94);
  background:
    linear-gradient(160deg, rgba(15, 22, 42, 0.94), rgba(6, 10, 22, 0.96));
  border: 1px solid rgba(var(--feature-color-rgb), 0.28);
  border-radius: 22px;
  box-shadow:
    0 60px 120px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 0 60px rgba(var(--feature-color-rgb), 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  z-index: 6;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.36s cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 0.44s cubic-bezier(0.2, 0.8, 0.2, 1),
    border-color 0.4s ease,
    box-shadow 0.4s ease;
  /* overflow visible so prongs and chat drawer can sit outside the panel box */
  overflow: visible;
}

.feature-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(800px 400px at 80% -10%, rgba(var(--feature-color-rgb), 0.15), transparent 60%);
  pointer-events: none;
  border-radius: inherit;
}

/* The inner container clips its own content — the panel box itself stays overflow:visible
   so that prongs and the chat drawer can extend outside. */
.feature-panel .panel-inner {
  border-radius: inherit;
  overflow: hidden;
}

.feature-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.panel-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  z-index: 3;
}
.panel-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--fg);
  border-color: rgba(255,255,255,0.16);
  transform: rotate(90deg);
}

.panel-inner {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  height: 100%;
  gap: 0;
  position: relative;
  z-index: 1;
}

.panel-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 40px;
  min-width: 0;
}

.panel-icon-wrap { margin-bottom: 22px; }

.panel-icon {
  width: 62px;
  height: 62px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 30% 30%, rgba(var(--feature-color-rgb), 0.32), rgba(var(--feature-color-rgb), 0.08) 70%);
  border: 1px solid rgba(var(--feature-color-rgb), 0.34);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--feature-color);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 0 30px rgba(var(--feature-color-rgb), 0.18);
}
.panel-icon svg { width: 30px; height: 30px; }

.panel-tag {
  display: inline-block;
  align-self: flex-start;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--feature-color);
  background: rgba(var(--feature-color-rgb), 0.10);
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid rgba(var(--feature-color-rgb), 0.22);
  margin-bottom: 16px;
  font-weight: 500;
}

.panel-title {
  font-size: clamp(26px, 2.6vw, 36px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin-bottom: 12px;
  color: var(--fg);
}

.panel-subtitle {
  font-size: 15px;
  line-height: 1.4;
  color: var(--feature-color);
  margin-bottom: 16px;
  font-weight: 500;
  font-style: italic;
  letter-spacing: -0.01em;
  opacity: 0.92;
}

.panel-description {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 22px;
  max-width: 460px;
}

.panel-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}

.panel-stat {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  transition: all 0.2s ease;
}

.panel-stat:hover {
  border-color: rgba(var(--feature-color-rgb), 0.28);
  background: rgba(var(--feature-color-rgb), 0.04);
}

.panel-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--feature-color);
  letter-spacing: -0.02em;
  display: block;
  margin-bottom: 3px;
  font-family: 'Inter', sans-serif;
}

.panel-stat-label {
  font-size: 11px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.panel-actions {
  display: flex;
  gap: 12px;
}

.panel-right {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(var(--feature-color-rgb), 0.04), rgba(0,0,0,0.0));
  border-left: 1px solid rgba(255, 255, 255, 0.04);
}

.panel-graphic {
  position: absolute;
  inset: 0;
}

#panel-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.panel-grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(var(--feature-color-rgb), 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--feature-color-rgb), 0.06) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black, transparent 85%);
}

.panel-spec {
  position: absolute;
  bottom: 24px;
  left: 24px;
  right: 24px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--dim);
  line-height: 1.65;
  background: rgba(4, 8, 18, 0.7);
  border: 1px solid var(--faint);
  border-radius: 10px;
  padding: 14px 16px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.panel-spec-line { display: flex; justify-content: space-between; gap: 14px; }
.panel-spec-key { color: var(--dim); }
.panel-spec-val { color: var(--feature-color); font-weight: 500; }

/* ---------- Footer ---------- */

.footer {
  position: relative;
  z-index: 5;
  padding: 18px 36px;
  border-top: 1px solid rgba(255,255,255,0.04);
  background: rgba(4, 6, 14, 0.5);
  backdrop-filter: blur(8px);
}

.footer-inner {
  max-width: 1500px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-brand {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--dim);
  letter-spacing: 0.02em;
}

.footer-links {
  display: flex;
  gap: 22px;
}
.footer-links a {
  color: var(--dim);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color 0.15s ease;
}
.footer-links a:hover { color: var(--fg); }

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .nav-links { display: none; }
  .hero-text { margin-left: 24px; padding-right: 24px; }
  .hero-meta { gap: 22px; padding: 14px 18px; }
  .hero-meta-item strong { font-size: 22px; }
  .panel-inner { grid-template-columns: 1fr; }
  .panel-right { display: none; }
  .feature-panel { width: 92vw; height: 82vh; }
  .panel-left { padding: 40px 28px; }
  .panel-title { font-size: 32px; }
}

@media (max-width: 640px) {
  .hero-title { font-size: 40px; }
  .hero-subtitle { font-size: 15px; }
  .hero-meta { flex-wrap: wrap; }
  .navbar { padding: 14px 18px; }
  .nav-cta { gap: 10px; }
  .brand-tag { display: none; }
}

/* ===================================================================
   Throbbing prongs — sub-feature pills floating outside the panel
   =================================================================== */

.panel-prongs {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.prong {
  position: absolute;
  left: var(--anchor-x);
  top: var(--anchor-y);
  width: 0;
  height: 0;
  pointer-events: none;
}

.prong-line {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
  width: 1px;
  height: 1px;
  opacity: 0;
  animation: prong-line-throb 4.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  animation-delay: calc(var(--i) * 0.45s + 0.3s);
}

@keyframes prong-line-throb {
  0%, 100% { opacity: 0.42; }
  50%      { opacity: 0.95; }
}

.prong-chip {
  position: absolute;
  left: var(--dx);
  top: var(--dy);
  transform: translate(-50%, -50%);
  padding: 8px 12px;
  background: linear-gradient(180deg, rgba(8, 14, 28, 0.94), rgba(6, 10, 22, 0.94));
  border: 1px solid rgba(var(--feature-color-rgb), 0.34);
  border-radius: 10px;
  white-space: nowrap;
  pointer-events: auto;
  cursor: default;
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(var(--feature-color-rgb), 0.06);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  /* slow throb — out of phase per prong */
  animation: prong-throb 4.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  animation-delay: calc(var(--i) * 0.45s);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  z-index: 3;
}

@keyframes prong-throb {
  0%, 100% {
    box-shadow:
      0 8px 22px rgba(0, 0, 0, 0.42),
      0 0 0 0 rgba(var(--feature-color-rgb), 0);
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    box-shadow:
      0 14px 32px rgba(0, 0, 0, 0.5),
      0 0 22px rgba(var(--feature-color-rgb), 0.28);
    transform: translate(-50%, -50%) scale(1.05);
  }
}

.prong-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.005em;
}

.prong-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translate(-50%, 4px);
  padding: 8px 12px;
  background: rgba(4, 8, 18, 0.96);
  border: 1px solid rgba(var(--feature-color-rgb), 0.32);
  border-radius: 8px;
  font-size: 11.5px;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.01em;
  max-width: 240px;
  white-space: normal;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.prong-chip:hover {
  border-color: rgba(var(--feature-color-rgb), 0.7);
  background: linear-gradient(180deg, rgba(12, 20, 38, 0.98), rgba(8, 14, 28, 0.98));
  animation-play-state: paused;
  transform: translate(-50%, -50%) scale(1.08);
}

.prong-chip:hover .prong-tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Side-aware tooltip flipping for prongs near top/bottom of panel */
.prong[data-side="bottom"] .prong-tooltip {
  top: auto;
  bottom: calc(100% + 8px);
  transform: translate(-50%, -4px);
}
.prong[data-side="bottom"] .prong-chip:hover .prong-tooltip { transform: translate(-50%, 0); }

/* ===================================================================
   Chat-first drawer — slides out the right side of the feature panel
   =================================================================== */

.chat-drawer {
  position: absolute;
  top: 50%;
  /* sits just to the right of the panel */
  left: calc(50% + clamp(620px, 58vw, 920px) / 2 + 18px);
  transform: translate(-12px, -50%);
  width: 360px;
  height: clamp(420px, 64vh, 640px);
  background:
    linear-gradient(180deg, rgba(12, 18, 36, 0.94), rgba(6, 10, 22, 0.96));
  border: 1px solid rgba(var(--feature-color-rgb), 0.28);
  border-radius: 20px;
  box-shadow:
    0 50px 100px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 0 40px rgba(var(--feature-color-rgb), 0.10);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  z-index: 7;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
              transform 0.36s cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow: hidden;
}

.chat-drawer.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(0, -50%);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.chat-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chat-feature-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(var(--feature-color-rgb), 0.22), rgba(var(--feature-color-rgb), 0.08));
  border: 1px solid rgba(var(--feature-color-rgb), 0.32);
  color: var(--feature-color);
  flex-shrink: 0;
}
.chat-feature-icon svg { width: 16px; height: 16px; }

.chat-feature-text { min-width: 0; }

.chat-feature-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--feature-color);
  font-weight: 500;
}

.chat-feature-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-close {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.chat-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--fg);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

.chat-msg {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  max-width: 90%;
  word-break: break-word;
}

.chat-msg.system {
  align-self: stretch;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 12.5px;
  max-width: 100%;
}

.chat-msg.user {
  align-self: flex-end;
  background: linear-gradient(180deg, rgba(var(--feature-color-rgb), 0.22), rgba(var(--feature-color-rgb), 0.12));
  border: 1px solid rgba(var(--feature-color-rgb), 0.24);
  color: var(--fg);
}

.chat-msg.assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--fg);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.chat-msg-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--dim);
  margin-bottom: 4px;
}

.chat-msg.assistant i {
  color: var(--muted);
  font-style: italic;
}

.chat-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 14px 14px;
}
.chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(var(--feature-color-rgb), 0.55);
  animation: chat-typing-bounce 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.30s; }

@keyframes chat-typing-bounce {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50%      { opacity: 1;   transform: translateY(-3px); }
}

.chat-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.chat-chip {
  display: block;
  text-align: left;
  padding: 9px 11px;
  background: rgba(var(--feature-color-rgb), 0.06);
  border: 1px solid rgba(var(--feature-color-rgb), 0.18);
  border-radius: 10px;
  color: var(--fg);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.chat-chip:hover {
  background: rgba(var(--feature-color-rgb), 0.12);
  border-color: rgba(var(--feature-color-rgb), 0.36);
  transform: translateY(-1px);
}

.chat-input {
  display: flex;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.chat-input input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 11px;
  padding: 10px 12px;
  color: var(--fg);
  font-family: inherit;
  font-size: 13.5px;
  transition: all 0.15s;
}
.chat-input input::placeholder { color: rgba(255,255,255,0.25); }
.chat-input input:focus {
  outline: none;
  border-color: rgba(var(--feature-color-rgb), 0.55);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(var(--feature-color-rgb), 0.14);
}

.chat-input button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 11px;
  background: var(--feature-color);
  color: #022;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s;
}
.chat-input button:hover { filter: brightness(1.05); transform: translateY(-1px); }

@media (max-width: 1180px) {
  /* On narrower screens the drawer would push off-screen — overlay it on top of the panel instead */
  .chat-drawer {
    left: 50%;
    transform: translate(calc(-50% + 12px), -50%);
    width: clamp(320px, 88vw, 420px);
  }
  .chat-drawer.open { transform: translate(-50%, -50%); }
}

/* When the chat drawer is open on a wide viewport, push the panel left so the
   panel + drawer pair sits centered together. Both elements shift the same
   amount so they stay flush. Shift kept moderate so the leftmost prongs stay
   on-screen. */
@media (min-width: 1181px) {
  body.chat-open .feature-panel.open {
    transform: translate(calc(-50% - 130px), -50%) scale(1);
  }
  body.chat-open .chat-drawer.open {
    transform: translate(-130px, -50%);
  }
}
