/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w: 260px;
  --detail-w:  360px;
  --sidebar-bg: #111827;
  --sidebar-text: #e5e7eb;
  --sidebar-muted: #9ca3af;
  --sidebar-border: rgba(255,255,255,0.08);
  --main-bg: #f9fafb;
  --card-bg: #ffffff;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --accent: #3b82f6;
  --radius: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.06);
  --transition: 200ms ease;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
}

html, body { height: 100%; font-family: var(--font); background: var(--main-bg); color: var(--text-primary); }

/* ── App shell ────────────────────────────────────────────── */
#app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--detail-w);
  grid-template-rows: 100vh;
  grid-template-areas: "sidebar timeline detail";
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────── */
#sidebar {
  grid-area: sidebar;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--sidebar-border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.brand-mark {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 18px; color: #fff;
  flex-shrink: 0;
}
.brand-name  { font-weight: 700; font-size: 15px; line-height: 1.2; }
.brand-sub   { font-size: 11px; color: var(--sidebar-muted); line-height: 1.4; margin-top: 1px; }

.sidebar-search {
  position: relative;
  padding: 16px 16px 12px;
  flex-shrink: 0;
}
.search-icon {
  position: absolute; left: 28px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--sidebar-muted); pointer-events: none;
}
#search {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--sidebar-border);
  border-radius: 8px;
  padding: 9px 12px 9px 34px;
  font-size: 13px; color: var(--sidebar-text);
  outline: none; transition: border-color var(--transition);
}
#search::placeholder { color: var(--sidebar-muted); }
#search:focus { border-color: var(--accent); }

.sidebar-section {
  padding: 0 16px 16px;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--sidebar-muted);
  margin-bottom: 8px;
}

/* School filter list */
.school-filter-list {
  display: flex; flex-direction: column; gap: 2px;
  max-height: min(260px, 28vh); overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.school-filter-list::-webkit-scrollbar { width: 4px; }
.school-filter-list::-webkit-scrollbar-track { background: transparent; }
.school-filter-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.school-filter-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px;
  cursor: pointer; transition: background var(--transition);
  font-size: 12px; color: var(--sidebar-muted);
  user-select: none;
}
.school-filter-item:hover { background: rgba(255,255,255,0.06); color: var(--sidebar-text); }
.school-filter-item.active { background: rgba(255,255,255,0.10); color: var(--sidebar-text); }
.school-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
}
.school-filter-item .school-count {
  margin-left: auto; font-size: 10px; color: var(--sidebar-muted); flex-shrink: 0;
}

/* Era filter list */
.era-filter-list { display: flex; flex-direction: column; gap: 2px; }
.era-filter-item {
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
  font-size: 12px; color: var(--sidebar-muted);
  transition: background var(--transition); user-select: none;
}
.era-filter-item:hover { background: rgba(255,255,255,0.06); color: var(--sidebar-text); }
.era-filter-item.active { background: rgba(255,255,255,0.10); color: var(--sidebar-text); }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}
#count-display { font-size: 11px; color: var(--sidebar-muted); }
.reset-btn {
  background: none; border: 1px solid var(--sidebar-border);
  color: var(--sidebar-muted); border-radius: 6px;
  padding: 5px 10px; font-size: 11px; cursor: pointer;
  transition: all var(--transition);
}
.reset-btn:hover { border-color: var(--accent); color: var(--accent); }
.reset-btn.light { border-color: rgba(0,0,0,0.15); color: var(--text-secondary); }
.reset-btn.light:hover { border-color: var(--accent); color: var(--accent); }

/* ── Mobile header (hidden on desktop) ───────────────────── */
#mobile-header { display: none; }

/* ── Timeline pane ────────────────────────────────────────── */
#timeline-pane {
  grid-area: timeline;
  overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--main-bg);
}

#timeline-scroll {
  flex: 1; overflow-y: auto;
  padding: 24px 24px 40px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
#timeline-scroll::-webkit-scrollbar { width: 6px; }
#timeline-scroll::-webkit-scrollbar-track { background: transparent; }
#timeline-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Era headers */
.era-group { margin-bottom: 8px; }
.era-header {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 20px 0 10px;
  position: sticky; top: 0;
  background: var(--main-bg);
  z-index: 1;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

/* Economist rows */
.economist-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  border: 1px solid transparent;
}
.economist-row:hover {
  background: var(--card-bg);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.economist-row.selected {
  background: var(--card-bg);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.economist-spine {
  display: flex; flex-direction: column; align-items: center;
  flex-shrink: 0; width: 16px;
}
.econ-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--card-bg);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

.economist-photo {
  width: 40px; height: 40px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  background: var(--border);
  border: 2px solid var(--card-bg);
}
.economist-photo.no-img { display: none; }
.photo-placeholder {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  display: grid; place-items: center;
  font-size: 15px; font-weight: 700; color: #6366f1;
  flex-shrink: 0;
}

.economist-info { flex: 1; min-width: 0; }
.economist-name {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.3;
}
.economist-meta { display: flex; align-items: center; gap: 6px; margin-top: 3px; flex-wrap: wrap; }
.birth-year { font-size: 11px; color: var(--text-muted); }
.school-pill {
  display: inline-block; padding: 2px 7px; border-radius: 20px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.02em;
  white-space: nowrap;
}

.economist-score {
  flex-shrink: 0; width: 6px;
}
.score-bar {
  border-radius: 3px;
  background: var(--border);
  position: relative;
  overflow: hidden;
}

/* ── Detail panel ─────────────────────────────────────────── */
#detail-panel {
  grid-area: detail;
  background: var(--card-bg);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
#detail-panel.detail-hidden {
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
}

.detail-drag-handle { display: none; }

#detail-scroll {
  flex: 1; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
#detail-scroll::-webkit-scrollbar { width: 5px; }
#detail-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.detail-top-bar {
  display: flex; justify-content: flex-end;
  padding: 12px 16px 0;
  position: sticky; top: 0; background: var(--card-bg); z-index: 2;
}
#detail-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px; border-radius: 6px;
  transition: color var(--transition), background var(--transition);
  display: grid; place-items: center;
}
#detail-close:hover { color: var(--text-primary); background: var(--main-bg); }

/* Hero */
.detail-hero {
  display: flex; gap: 16px; padding: 8px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.detail-photo-wrap { position: relative; flex-shrink: 0; }
#detail-img {
  width: 80px; height: 80px; border-radius: 12px;
  object-fit: cover; display: block;
  border: 1px solid var(--border);
}
.detail-img-placeholder {
  width: 80px; height: 80px; border-radius: 12px;
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  display: none;
}

.detail-hero-info { flex: 1; min-width: 0; }
#detail-name {
  font-size: 18px; font-weight: 700; line-height: 1.25;
  color: var(--text-primary); margin-bottom: 4px;
}
.detail-dates { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.wiki-link {
  display: inline-block; margin-top: 8px;
  font-size: 11px; color: var(--accent);
  text-decoration: none;
}
.wiki-link:hover { text-decoration: underline; }

/* Bio */
.detail-bio-section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.detail-bio {
  font-size: 13px; line-height: 1.7;
  color: var(--text-secondary);
}
.detail-bio.loading { color: var(--text-muted); font-style: italic; }

/* Mini network */
.detail-network-section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.section-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px;
}
#mini-network svg { display: block; width: 100%; }
#mini-network .no-connections { font-size: 12px; color: var(--text-muted); font-style: italic; }

/* Connections list */
.detail-connections-section { padding: 18px 20px 32px; }
.connections-group { margin-bottom: 20px; }
.connections-group-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px;
}
.connection-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  cursor: pointer; transition: background var(--transition);
  margin-bottom: 2px;
}
.connection-item:hover { background: var(--main-bg); }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.conn-name { font-size: 13px; color: var(--text-primary); font-weight: 500; flex: 1; }
.conn-year { font-size: 11px; color: var(--text-muted); }
.conn-school { font-size: 10px; color: var(--text-muted); }
.no-connections-note { font-size: 12px; color: var(--text-muted); font-style: italic; padding: 4px 10px; }

/* Mini network SVG styling */
.mini-link { stroke: #d1d5db; stroke-width: 1.5px; }
.mini-node { cursor: pointer; }
.mini-label { font-size: 9px; font-family: var(--font); fill: var(--text-secondary); pointer-events: none; }
.mini-node-center { cursor: default; }

/* ── Scrollbar for school list (dark variant) ─────────────── */
.school-filter-list.dark {
  scrollbar-color: rgba(0,0,0,0.1) transparent;
}

/* ── Mobile styles ────────────────────────────────────────── */
@media (max-width: 768px) {
  #app {
    display: flex; flex-direction: column;
    grid-template-areas: none;
    height: 100dvh; overflow: hidden;
  }

  #sidebar { display: none; }

  #mobile-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    background: var(--sidebar-bg);
    color: #fff; flex-shrink: 0;
    z-index: 10;
  }
  .mobile-brand { display: flex; align-items: center; gap: 8px; }
  .brand-mark-sm {
    width: 28px; height: 28px; background: var(--accent);
    border-radius: 6px; display: grid; place-items: center;
    font-weight: 800; font-size: 14px; color: #fff;
  }
  .mobile-title { font-size: 15px; font-weight: 700; color: #fff; }
  .mobile-filter-btn {
    display: flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,0.1); border: none;
    color: #fff; border-radius: 8px;
    padding: 7px 12px; font-size: 13px; cursor: pointer;
    font-family: var(--font);
  }

  /* Mobile search bar */
  #timeline-pane { flex: 1; overflow: hidden; }
  #timeline-scroll { padding: 12px 16px 40px; }

  /* Filter drawer */
  #mobile-filter-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 40; backdrop-filter: blur(2px);
  }
  #mobile-filter-overlay.hidden { display: none; }

  #mobile-filter-drawer {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--sidebar-bg); color: var(--sidebar-text);
    border-radius: 20px 20px 0 0;
    z-index: 50; max-height: 80dvh; overflow-y: auto;
    transform: translateY(0);
  }
  #mobile-filter-drawer.hidden { display: none; }

  .drawer-handle-bar {
    display: flex; justify-content: center; padding: 12px 0 8px;
    flex-shrink: 0;
  }
  .drawer-handle-bar::before {
    content: ''; width: 36px; height: 4px;
    background: rgba(255,255,255,0.2); border-radius: 2px;
  }
  .drawer-inner { padding: 8px 20px 32px; }
  .drawer-search input {
    width: 100%; background: rgba(255,255,255,0.07);
    border: 1px solid var(--sidebar-border); border-radius: 8px;
    padding: 10px 14px; font-size: 14px; color: var(--sidebar-text);
    outline: none; margin-bottom: 20px; font-family: var(--font);
  }
  .drawer-section { margin-bottom: 20px; }
  .drawer-label {
    font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--sidebar-muted); margin-bottom: 8px;
  }
  .school-filter-list.dark .school-filter-item:hover { background: rgba(255,255,255,0.06); }
  .era-filter-list.dark .era-filter-item:hover { background: rgba(255,255,255,0.06); }
  .era-filter-list.dark { color: var(--sidebar-muted); }

  /* Detail panel as bottom sheet */
  #detail-panel {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 90dvh; z-index: 30;
    border-radius: 20px 20px 0 0;
    border-left: none; border-top: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1), opacity 0.3s ease;
  }
  #detail-panel.detail-hidden {
    transform: translateY(100%); opacity: 1; pointer-events: none;
  }
  #detail-panel:not(.detail-hidden) { transform: translateY(0); }

  .detail-drag-handle {
    display: flex; justify-content: center;
    padding: 12px 0 4px; flex-shrink: 0; cursor: grab;
  }
  .handle-pill {
    width: 36px; height: 4px;
    background: var(--border); border-radius: 2px;
  }

  /* Tighten detail layout on mobile */
  .detail-hero { flex-direction: row; }
  #detail-img { width: 64px; height: 64px; }
  .detail-img-placeholder { width: 64px; height: 64px; }
  #detail-name { font-size: 16px; }
}

/* ── Tablet adjustments ───────────────────────────────────── */
@media (min-width: 769px) and (max-width: 1100px) {
  :root { --sidebar-w: 220px; --detail-w: 300px; }
}


/* ================================================================
   FEATURE ADDITIONS: intro modal, school tooltips, typed connections,
   surprise me, copy link
   ================================================================ */

/* ── INTRO MODAL ──────────────────────────────────────────────── */

.intro-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  transition: opacity 0.3s ease;
}

.intro-overlay.intro-hiding {
  opacity: 0;
  pointer-events: none;
}

.intro-card {
  background: #fff;
  border-radius: 20px;
  padding: 36px 32px 28px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 24px 80px rgba(0,0,0,0.22);
  animation: introSlideUp 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
}

@keyframes introSlideUp {
  from { transform: translateY(20px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

.intro-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.intro-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #0f172a;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.intro-brand-text {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #0f172a;
}

.intro-desc {
  font-size: 15px;
  color: #475569;
  line-height: 1.6;
  margin: 0 0 22px;
}

.intro-tips {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 26px;
}

.intro-tip {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.intro-tip-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  background: #0f172a;
  color: #fff;
  border-radius: 8px;
  display: grid;
  place-items: center;
}

.intro-tip span {
  font-size: 13.5px;
  color: #334155;
  line-height: 1.5;
  padding-top: 5px;
}

.intro-tip span strong { color: #0f172a; }

.intro-start-btn {
  width: 100%;
  padding: 13px;
  background: #0f172a;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  letter-spacing: 0.01em;
}

.intro-start-btn:hover  { background: #1e293b; }
.intro-start-btn:active { transform: scale(0.98); }

/* ── SCHOOL TOOLTIP BUBBLE ────────────────────────────────────── */

#school-tip {
  position: fixed;
  background: #1e293b;
  color: #f1f5f9;
  font-size: 12.5px;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 8px;
  max-width: 220px;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

#school-tip.school-tip--visible {
  opacity: 1;
  transform: translateX(0);
}

/* ── SURPRISE ME BUTTON ───────────────────────────────────────── */

.surprise-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}

.surprise-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-main);
  background: var(--hover-bg);
}

/* ── COPY LINK BUTTON ─────────────────────────────────────────── */

.detail-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  margin-top: 8px;
}

.detail-copy-btn:hover  { border-color: var(--text-muted); color: var(--text-main); }
.detail-copy-btn.copied { color: #16a34a; border-color: #16a34a; background: #f0fdf4; }

/* ── TYPED CONNECTIONS ────────────────────────────────────────── */

.conn-section-head {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 14px 0 6px;
  padding: 0 4px;
}

.conn-section-head:first-child { margin-top: 0; }


/* ── LANDING ANIMATION OVERLAY ─────────────────────────────────── */

.landing-overlay {
  position: fixed;
  inset: 0;
  background: #0f172a;
  z-index: 150;
  overflow: hidden;
}

.landing-overlay.landing-hiding {
  animation: landingFadeOut 0.45s cubic-bezier(0.4,0,1,1) forwards;
}

@keyframes landingFadeOut {
  to { opacity: 0; transform: scale(1.015); }
}

/* Network canvas fills the background */
.landing-network {
  position: absolute;
  inset: 0;
}

.landing-network svg { display: block; }

/* Centered content sits above the network */
.landing-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  pointer-events: none; /* clicks pass through to network nodes */
}

.landing-logo {
  width: 56px;
  height: 56px;
  background: #fff;
  color: #0f172a;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 18px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.15), 0 8px 32px rgba(0,0,0,0.4);
}

.landing-title {
  font-size: clamp(32px, 6vw, 52px);
  font-weight: 800;
  letter-spacing: -1.5px;
  color: #f8fafc;
  line-height: 1.1;
  margin-bottom: 14px;
}

.landing-sub {
  font-size: 15px;
  color: rgba(148,163,184,0.9);
  max-width: 420px;
  line-height: 1.65;
  margin-bottom: 32px;
}

/* CTA buttons — pointer-events re-enabled here */
.landing-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.landing-actions.landing-actions--visible {
  opacity: 1;
  transform: translateY(0);
}

.landing-start-btn {
  background: #fff;
  color: #0f172a;
  border: none;
  padding: 13px 28px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: -0.2px;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.landing-start-btn:hover  { transform: translateY(-1px); box-shadow: 0 6px 28px rgba(0,0,0,0.4); }
.landing-start-btn:active { transform: scale(0.98); }

.landing-about-link {
  font-size: 13px;
  color: rgba(148,163,184,0.75);
  text-decoration: none;
  transition: color 0.15s;
  letter-spacing: 0.01em;
}

.landing-about-link:hover { color: rgba(148,163,184,1); }

/* ── SIDEBAR FOOTER BUTTONS ROW ────────────────────────────────── */

.sidebar-footer-btns {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── BIO PREVIEW IN TIMELINE ROWS ──────────────────────────────── */

.economist-bio-preview {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Slightly muted on non-hovered row to reduce visual noise */
.economist-row:not(:hover):not(.selected) .economist-bio-preview {
  opacity: 0.7;
}


/* ── AI CONTRIBUTION SUMMARY SECTION ───────────────────────────── */

.detail-contrib-section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.ai-badge {
  display: inline-block;
  padding: 1px 5px;
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  vertical-align: middle;
  margin-left: 6px;
  line-height: 1.6;
}

.detail-contrib-text {
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-secondary);
  margin: 10px 0 12px;
}

.detail-keyword-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}

.detail-keyword-pill {
  padding: 3px 9px;
  border-radius: 12px;
  background: var(--main-bg);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: default;
  transition: border-color var(--transition), color var(--transition);
}

.detail-keyword-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── KEYWORD PILLS IN TIMELINE ROWS ─────────────────────────────── */

.economist-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 4px;
}

.keyword-pill {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--main-bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}

/* Slightly muted on non-hovered rows */
.economist-row:not(:hover):not(.selected) .keyword-pill {
  opacity: 0.75;
}

/* ── EXTRA NARROW DESKTOP BREAKPOINT (high zoom) ───────────────── */

@media (min-width: 769px) and (max-width: 900px) {
  :root { --sidebar-w: 200px; --detail-w: 260px; }
  .sidebar-section { padding: 0 12px 12px; }
  .brand { padding: 18px 14px 16px; }
  .brand-name { font-size: 14px; }
  .sidebar-search { padding: 12px 12px 10px; }
}

/* ═══════════════════════════════════════════════════════════════
   INTELLECTUAL DEBATES OVERLAY
   ═══════════════════════════════════════════════════════════════ */

/* ── Sidebar trigger button ─────────────────────────────────── */
.debates-sidebar-btn {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid #334155;
  color: #94a3b8;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.debates-sidebar-btn:hover {
  border-color: #60a5fa;
  color: #e2e8f0;
  background: linear-gradient(135deg, #1e3a5f 0%, #0f2040 100%);
}

/* ── Full-screen overlay ────────────────────────────────────── */
.dt-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: opacity 0.25s;
}
.dt-overlay.dt-hidden {
  opacity: 0;
  pointer-events: none;
}

/* ── Panel ───────────────────────────────────────────────────── */
.dt-panel {
  width: 100%;
  max-width: 860px;
  height: 100dvh;
  background: #09090b;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 80px rgba(0,0,0,0.8);
}

/* ── Panel header ────────────────────────────────────────────── */
.dt-panel-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 28px 18px;
  border-bottom: 1px solid #18181b;
  flex-shrink: 0;
}
.dt-panel-title {
  font-size: 20px;
  font-weight: 700;
  color: #f4f4f5;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}
.dt-panel-sub {
  font-size: 13px;
  color: #71717a;
  margin: 0;
  max-width: 560px;
  line-height: 1.5;
}
.dt-close-btn {
  background: none;
  border: none;
  color: #52525b;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.dt-close-btn:hover { color: #f4f4f5; background: #27272a; }

/* ── Scrollable body ─────────────────────────────────────────── */
.dt-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.dt-panel-body::-webkit-scrollbar { width: 6px; }
.dt-panel-body::-webkit-scrollbar-track { background: transparent; }
.dt-panel-body::-webkit-scrollbar-thumb { background: #27272a; border-radius: 3px; }

/* ── Debate card ─────────────────────────────────────────────── */
.dt-card {
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 12px;
  padding: 20px 22px 18px;
  transition: border-color 0.2s;
}
.dt-card:hover { border-color: #3f3f46; }

/* ── Card header ─────────────────────────────────────────────── */
.dt-card-hd {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.dt-num {
  font-size: 11px;
  font-weight: 700;
  color: #52525b;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  padding-top: 3px;
}
.dt-title {
  font-size: 17px;
  font-weight: 700;
  color: #f4f4f5;
  margin: 0 0 5px;
  letter-spacing: -0.015em;
}
.dt-question {
  font-size: 13px;
  color: #a1a1aa;
  margin: 0;
  line-height: 1.5;
  font-style: italic;
}

/* ── Two sides ───────────────────────────────────────────────── */
.dt-sides {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}
.dt-vs {
  font-size: 12px;
  font-weight: 700;
  color: #52525b;
  letter-spacing: 0.04em;
  padding-top: 6px;
  align-self: flex-start;
}
.dt-side {
  background: #0f0f11;
  border: 1px solid #27272a;
  border-radius: 8px;
  padding: 10px 12px 10px;
  border-top: 3px solid var(--sc, #60a5fa);
}
.dt-side-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--sc, #60a5fa);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.dt-side-desc {
  font-size: 12px;
  color: #71717a;
  line-height: 1.55;
  margin: 0 0 10px;
}

/* ── Economist chips ─────────────────────────────────────────── */
.dt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.dt-chip {
  background: #1c1c20;
  border: 1px solid #2e2e33;
  border-radius: 20px;
  padding: 3px 9px;
  font-size: 11.5px;
  color: #d4d4d8;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.dt-chip:hover {
  background: color-mix(in srgb, var(--chip-col, #60a5fa) 12%, #1c1c20);
  border-color: var(--chip-col, #60a5fa);
  color: #f4f4f5;
}
.dt-chip-yr {
  font-size: 9.5px;
  color: #52525b;
  font-family: ui-monospace, monospace;
}
.dt-plus {
  font-size: 11px;
  color: #52525b;
  padding: 3px 6px;
}

/* ── SVG timeline ────────────────────────────────────────────── */
.dt-timeline-wrap {
  background: #0f0f11;
  border-radius: 8px;
  padding: 8px 4px 4px;
  margin-bottom: 12px;
  overflow: hidden;
}
.dt-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}
.dt-dot {
  cursor: pointer;
}
.dt-dot:hover circle:last-of-type {
  opacity: 1;
  filter: brightness(1.3) drop-shadow(0 0 4px currentColor);
}
.dt-dot:focus { outline: none; }
.dt-dot:focus circle:last-of-type {
  opacity: 1;
  stroke-width: 2;
}

/* ── Today note ──────────────────────────────────────────────── */
.dt-today {
  font-size: 12.5px;
  color: #a1a1aa;
  line-height: 1.6;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: #0f0f11;
  border-radius: 6px;
  border-left: 3px solid #27272a;
}
.dt-today-badge {
  font-size: 10px;
  font-weight: 700;
  color: #52525b;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 6px;
  vertical-align: middle;
}

/* ── Narrative toggle + content ──────────────────────────────── */
.dt-narr-toggle {
  background: none;
  border: none;
  color: #71717a;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s;
}
.dt-narr-toggle:hover { color: #a1a1aa; }
.dt-narr-chevron {
  transition: transform 0.2s;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}
.dt-narr-toggle--open .dt-narr-chevron { transform: rotate(180deg); }

.dt-narrative {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.3s;
  opacity: 0;
}
.dt-narrative.dt-narr-open {
  max-height: 600px;
  opacity: 1;
}
.dt-narrative p {
  font-size: 13px;
  color: #a1a1aa;
  line-height: 1.75;
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid #27272a;
}

/* ── Mobile: full-screen bottom sheet ───────────────────────── */
@media (max-width: 768px) {
  .dt-panel {
    max-width: 100%;
    height: 92dvh;
    margin-top: auto;
    border-radius: 16px 16px 0 0;
  }
  .dt-overlay {
    align-items: flex-end;
  }
  .dt-panel-hd { padding: 18px 18px 14px; }
  .dt-panel-body { padding: 14px 14px 32px; }
  .dt-sides {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .dt-vs { display: none; }
  .dt-card { padding: 14px 14px 12px; }
}

