:root {
  --bg: #070b16;
  --bg2: #0d1424;
  --panel: rgba(18, 26, 45, 0.72);
  --border: rgba(120, 160, 220, 0.14);
  --cyan: #22d3ee;
  --violet: #a78bfa;
  --text: #e6edf7;
  --muted: #8ba0bd;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(34,211,238,0.10), transparent 60%),
    radial-gradient(900px 600px at 90% 10%, rgba(167,139,250,0.12), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: 'Newsreader', Georgia, serif;
  min-height: 100vh;
}

/* faint constellation dots */
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 34px 34px;
  pointer-events: none;
  z-index: 0;
}

.app-root { position: relative; z-index: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* Header */
.hdr {
  display: flex; align-items: center; gap: 18px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(7,11,22,0.6);
  backdrop-filter: blur(10px);
  flex-wrap: wrap;
  position: sticky; top: 0; z-index: 30;
}
.hdr-brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 30px; filter: drop-shadow(0 0 10px rgba(34,211,238,0.5)); }
.brand-name {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800; font-size: 26px; line-height: 1;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: -0.5px;
}
.brand-tag { font-size: 12px; color: var(--muted); font-style: italic; margin-top: 3px; }

.search-wrap { position: relative; flex: 1; min-width: 220px; max-width: 520px; }
.search-input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 16px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.search-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34,211,238,0.15);
}
.sug-box {
  position: absolute; top: 110%; left: 0; right: 0;
  background: #0e1626; border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; z-index: 40;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.sug-item {
  padding: 10px 16px; cursor: pointer; font-size: 14px;
  font-family: 'JetBrains Mono', monospace; color: var(--text);
}
.sug-item:hover { background: rgba(34,211,238,0.12); color: var(--cyan); }

.btn-random {
  background: linear-gradient(135deg, var(--violet), #7c5cff);
  border: none; color: white; padding: 11px 16px;
  border-radius: 12px; font-weight: 600; cursor: pointer;
  font-family: 'Bricolage Grotesque', sans-serif; font-size: 14px;
  transition: transform .15s, box-shadow .15s; white-space: nowrap;
}
.btn-random:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(124,92,255,0.4); }

/* Breadcrumb */
.breadcrumb {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 22px; border-bottom: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  background: rgba(13,20,36,0.4);
}
.crumb-rabbit { color: var(--cyan); font-weight: 600; }
.crumb-sep { color: var(--muted); }
.crumb-chain { display: inline-flex; align-items: center; gap: 8px; }
.crumb {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-family: inherit; font-size: 12px; padding: 2px 4px; border-radius: 4px;
}
.crumb:hover { color: var(--text); }
.crumb-active { color: var(--violet); font-weight: 600; }
.crumb-arrow { color: rgba(139,160,189,0.4); }

/* Mobile tabs */
.mobile-tabs { display: none; padding: 10px 16px; gap: 10px; border-bottom: 1px solid var(--border); }
.mtab {
  flex: 1; padding: 9px; border-radius: 10px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); cursor: pointer;
  font-family: 'Bricolage Grotesque', sans-serif; font-weight: 600; font-size: 14px;
}
.mtab-on { background: rgba(34,211,238,0.14); color: var(--cyan); border-color: var(--cyan); }

/* Split */
.split { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px 22px; min-height: 0; }
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  min-height: 0;
  backdrop-filter: blur(6px);
}
.article-panel { display: flex; flex-direction: column; }
.article-scroll, .empty-state { padding: 26px 30px; overflow-y: auto; height: 100%; }
.empty-state { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; color: var(--muted); }

.article-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800; font-size: 40px; line-height: 1.05;
  margin: 0 0 16px; letter-spacing: -1px;
  color: #f4f9ff;
}
.tldr {
  border-left: 3px solid var(--cyan);
  background: linear-gradient(90deg, rgba(34,211,238,0.10), rgba(34,211,238,0.02));
  padding: 14px 18px; border-radius: 0 12px 12px 0; margin-bottom: 22px;
}
.tldr-label {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--cyan); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 6px; font-weight: 600;
}
.tldr-text { margin: 0; font-size: 16px; line-height: 1.5; color: #d5e3f2; font-style: italic; }
.article-body { font-size: 18px; line-height: 1.7; color: #cdd9e8; margin: 0; }

.links-header {
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  color: var(--violet); letter-spacing: 0.5px; margin: 0; text-transform: uppercase;
}
.internal-link {
  background: rgba(167,139,250,0.10);
  border: 1px dashed rgba(167,139,250,0.5);
  color: #cbb8ff; padding: 6px 12px; border-radius: 999px;
  font-family: 'JetBrains Mono', monospace; font-size: 12.5px;
  cursor: pointer; transition: all .15s;
}
.internal-link:hover, .link-active {
  background: rgba(167,139,250,0.25); color: #fff; border-style: solid;
  transform: translateY(-1px);
}

/* Graph panel */
.graph-panel { display: flex; flex-direction: column; }
.graph-controls {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.ctrl { display: flex; flex-direction: column; gap: 4px; }
.ctrl label { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); }
.ctrl label b { color: var(--cyan); }
.ctrl input[type=range] { width: 130px; accent-color: var(--cyan); }
.btn-reset, .btn-save {
  border: 1px solid var(--border); background: rgba(255,255,255,0.05);
  color: var(--text); padding: 8px 12px; border-radius: 10px; cursor: pointer;
  font-family: 'Bricolage Grotesque', sans-serif; font-weight: 600; font-size: 13px;
  transition: all .15s;
}
.btn-reset:hover { border-color: var(--cyan); color: var(--cyan); }
.btn-save { background: rgba(34,211,238,0.12); border-color: rgba(34,211,238,0.4); color: var(--cyan); }
.btn-save:hover:not(:disabled) { background: rgba(34,211,238,0.22); }
.btn-save:disabled { opacity: 0.6; cursor: wait; }

.legend-bar { padding: 8px 18px; border-bottom: 1px solid var(--border); }
.graph-canvas { position: relative; flex: 1; min-height: 360px; }
.graph-loading {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; z-index: 5;
  color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 13px;
  background: rgba(7,11,22,0.35); backdrop-filter: blur(2px);
}
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(34,211,238,0.2); border-top-color: var(--cyan);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* SVG node animations */
.main-node { filter: drop-shadow(0 0 12px rgba(34,211,238,0.8)); }
.conn-node { transition: r .2s; }
.edge-line { transition: stroke-opacity .2s; }
.pulse-core { animation: pulseCore 3s ease-in-out infinite; transform-origin: center; }
@keyframes pulseCore {
  0%,100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.9; transform: scale(1.15); }
}

/* Shimmer */
.shimmer {
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.13) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* Toast */
.toast {
  position: fixed; bottom: 78px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #05121a; font-weight: 700; padding: 12px 22px; border-radius: 999px;
  font-family: 'Bricolage Grotesque', sans-serif; font-size: 14px; z-index: 50;
  box-shadow: 0 10px 40px rgba(34,211,238,0.4); animation: toastIn .3s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Footer */
.ftr {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 14px 22px; border-top: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted);
}
.remix-link { color: var(--cyan); text-decoration: none; font-weight: 600; }
.remix-link:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .mobile-tabs { display: flex; }
  .hide-mobile { display: none; }
  .article-title { font-size: 30px; }
  .article-body { font-size: 16px; }
  .brand-tag { display: none; }
}