/* ═══════════════════════════════════════════════════════════════
   Roadmap v2 — Sunburst Concept Map
   Depends on: ../shared/tokens.css, ../shared/layout.css
   ═══════════════════════════════════════════════════════════════ */

/* ── LAYOUT ── */
html {
  -webkit-text-size-adjust: none;
  -moz-text-size-adjust: none;
  text-size-adjust: none;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── ROADMAP-SPECIFIC HEADER ELEMENTS ── */
.header-stats .hs-item + .hs-item { margin-left: 8px; }
.header-stats .hs-num { font-weight: 600; }

/* ── HEADER BACK BUTTON ── */
.header-back {
  display: none;
  cursor: pointer;
}
.header-back.active {
  display: inline-flex;
}

/* ── LEGEND (hover tooltip from ?) ── */
.legend-wrap {
  position: relative;
}

.legend-trigger {
  cursor: default;
}

.legend-tooltip {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 14px;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 0;
  padding: 8px 12px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-3);
  white-space: nowrap;
  z-index: 1000;
  pointer-events: none;
  text-align: right;
}

.legend-wrap:hover .legend-tooltip {
  display: block;
}


/* ── MAIN AREA ── */
.main {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

svg#viz {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--bg);
  position: relative;
  z-index: 1;
}

/* ── TOOLTIP (hidden — using corner detail panels instead) ── */
#tooltip {
  position: fixed;
  pointer-events: none;
  display: none;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12px;
  max-width: 320px;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

#tooltip .tt-label   { font-weight: 600; font-size: 14px; margin-bottom: 4px; color: var(--text); }
#tooltip .tt-papers  { color: var(--text-2); font-size: 12px; margin-top: 2px; font-style: italic; }
#tooltip .tt-children { color: var(--accent); font-size: 11px; margin-top: 4px; }
#tooltip .tt-path    { color: var(--text-3); font-size: 10px; margin-top: 4px; font-style: italic; }
#tooltip .tt-type    { color: var(--text-2); font-size: 11px; margin-top: 2px; }
#tooltip .tt-crosslinks { color: #92700a; font-size: 10px; margin-top: 3px; }

/* ── STATS BADGE (top-right, hidden — stats now in header) ── */
#stats-badge {
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 10;
  font-size: 11px;
  color: var(--text-3);
  text-align: right;
  pointer-events: none;
}

/* ── DETAIL PANEL (v1-style: corner-positioned, transparent border-left) ── */
.detail-panel {
  position: fixed;
  width: min(420px, 28vw);
  max-height: calc(100vh - 80px);
  overflow: auto;
  background: #fff;
  border: none;
  border-left: 2px solid #cbd5e1;
  border-radius: 0;
  padding: 10px 12px 12px 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-2);
  display: none;
  z-index: 9999;
  pointer-events: auto;
}

.detail-panel.visible { display: block; }

/* Corner positions (quadrant-aware placement, offset for 44px header) */
.detail-panel.detail-corner-top-right    { top: 70px; right: 14px; left: auto; bottom: auto; }
.detail-panel.detail-corner-top-left     { top: 70px; left: 14px; right: auto; bottom: auto; }
.detail-panel.detail-corner-bottom-right { bottom: 26px; right: 14px; left: auto; top: auto; }
.detail-panel.detail-corner-bottom-left  { bottom: 26px; left: 14px; right: auto; top: auto; }

.detail-panel .dt {
  display: inline;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin: 0;
  line-height: 1.2;
}

.detail-panel .detail-authors {
  display: inline;
  margin: 0;
  font-size: 11px;
  color: var(--text-3);
}

.detail-panel .detail-authors:not(:empty)::before {
  content: ' ';
}

.detail-panel .dmeta {
  display: block;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
  margin-bottom: 16px;
}

.detail-panel .dquestion {
  font-size: 12px;
  font-style: italic;
  color: var(--text);
  line-height: 1.4;
  margin-top: 0;
}

.detail-panel .dabstract {
  font-size: 12px;
  color: #334155;
  line-height: 1.5;
  margin-top: 8px;
  text-align: justify;
}

/* ── CONCEPT CHIPS (matches home search fp-chip style) ── */
.meta-tags {
  margin-top: 2px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

/* Chip overrides for roadmap detail panel — base styles in shared/concepts.css */
.meta-tags .fp-chip {
  padding: 2px 7px;
  font-weight: 500;
  border: none;
  color: #fff;
  background: #999;
}


/* ── PAPERVIEW LINK (v1-style) ── */
.pv-link {
  display: none;
  align-items: center;
  gap: 4px;
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.15s ease;
  pointer-events: auto;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.01em;
  margin-top: 3px;
}

.pv-link.visible { display: inline-flex; }
.pv-link:hover { color: #334155; }
.pv-link svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── DETAIL SUMMARY (for non-paper nodes) ── */
.detail-summary {
  margin-top: 6px;
  color: #334155;
}

/* ── DETAIL STATS ── */
.detail-stats {
  margin-top: 6px;
  color: #475569;
  font-size: 11px;
}

/* ── DETAIL ACTION ROW ── */
.detail-action-row {
  margin-top: 8px;
  display: flex;
  justify-content: flex-start;
}

/* ── EXIT FOCUS BUTTON (v1-style: large chevron) ── */
#exit-focus-btn {
  position: absolute;
  left: auto;
  right: auto;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  width: auto;
  height: auto;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 84px;
  line-height: 1;
  cursor: pointer;
  z-index: 30;
  box-shadow: none;
  transition: color 0.15s;
}

#exit-focus-btn:hover { color: #64748b; }
#exit-focus-btn.active { display: block; }
#exit-focus-btn.side-left { left: 10px; right: auto; transform: scaleX(-1); }
#exit-focus-btn.side-right { right: 44px; left: auto; }

/* ── ZOOM CONTROLS OVERLAY ── */
.zoom-controls {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.25s;
}
.zoom-controls.active {
  display: flex;
  opacity: 1;
}
.zoom-controls button {
  width: 32px;
  height: 32px;
  border: 1px solid #94a3b8;
  border-radius: 8px;
  background: rgba(241,245,249,0.95);
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.zoom-controls button:hover {
  color: #1e293b;
  background: #fff;
}
/* zoom-back button removed — back is now in header */
#pan-ring {
  cursor: pointer;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.08)) drop-shadow(0 0 1px rgba(0,0,0,0.04));
}
#pan-ring .pan-arc {
  fill: rgba(255,255,255,0.92);
  stroke: #cbd5e1;
  stroke-width: 0.6;
  transition: fill 0.15s;
}
#pan-ring .pan-arc:hover {
  fill: rgba(241,245,249,0.96);
}
#pan-ring .pan-arrow {
  fill: #94a3b8;
  pointer-events: none;
}
#pan-ring .zoom-center {
  fill: rgba(255,255,255,0.95);
  stroke: #cbd5e1;
  stroke-width: 0.6;
}
#pan-ring .zoom-btn {
  fill: #94a3b8;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  font-family: var(--font);
}
#pan-ring .zoom-btn:hover {
  fill: #64748b;
}

/* ── BREADCRUMB ── */
.breadcrumb {
  position: absolute;
  top: 8px;
  left: 14px;
  font-size: 11px;
  color: var(--text-3);
  z-index: 10;
  display: flex;
  gap: 3px;
  align-items: center;
}

.breadcrumb span { cursor: pointer; }
.breadcrumb span:hover { color: var(--text-2); text-decoration: underline; }
.breadcrumb .sep { color: var(--border); cursor: default; }
.breadcrumb .sep:hover { text-decoration: none; }
.breadcrumb .current { color: var(--text-2); font-weight: 500; cursor: default; }
.breadcrumb .current:hover { text-decoration: none; }

/* ── LOADING ── */
.loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text-2);
  z-index: 50;
}

.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── SVG ELEMENT TRANSITIONS ── */
.leaf-tile   { transition: fill-opacity 0.3s; }
.subcat-tile { transition: fill-opacity 0.3s, stroke-opacity 0.3s; }

/* ── PAPER DOTS ── */
.paper-links {
  pointer-events: auto;
}

.paper-relation-link {
  mix-blend-mode: normal;
}

.paper-dot {
  transition: fill-opacity 0.15s, r 0.15s, stroke-opacity 0.15s, stroke-width 0.15s;
}

.paper-dot.link-source {
  stroke: #0f172a;
  stroke-opacity: 0.95;
  stroke-width: 2.4;
}

.paper-dot.link-target {
  fill-opacity: 0.88;
}

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .detail-panel { width: min(460px, 48vw); }
}
@media (max-width: 768px) {
  .search-wrap { flex: 1 1 auto; }
  .header-title, .header-stats { display: none; }
  .legend-wrap { display: none; }
  .detail-panel { width: min(360px, 80vw); font-size: 11px; padding: 8px 10px; }
  .detail-panel .detail-title { font-size: 13px; }
  .detail-panel .detail-stats { font-size: 10px; }
  #tooltip { font-size: 11px; max-width: 260px; padding: 8px 10px; }
  #tooltip .tt-label { font-size: 12px; }
  .breadcrumb { font-size: 10px; }
  #exit-focus-btn { font-size: 60px; }
  .zoom-controls button { width: 36px; height: 36px; font-size: 16px; }
  #paper-sidebar { width: min(390px, 85vw); }
}

@media (max-width: 480px) {
  .header {
    height: 48px;
    padding: 0 8px;
    gap: 6px;
    flex-wrap: nowrap;
  }
  .search-wrap {
    flex: 1 1 auto;
    min-width: 0;
  }
  .search-wrap input {
    font-size: 16px;
  }
  .header-logo { font-size: 12px; }
  .detail-panel {
    font-size: 11px;
    width: min(320px, 92vw);
    max-height: 50vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .detail-panel .detail-title { font-size: 13px; }
  #tooltip { font-size: 11px; max-width: 240px; }
  #tooltip .tt-label { font-size: 12px; }
  .breadcrumb { font-size: 10px; }
  #exit-focus-btn { font-size: 48px; }
  #paper-sidebar { width: 100vw; }
  #paper-sidebar .sb-t { font-size: 11px; }
  #paper-sidebar .sb-id { font-size: 9px; }

  /* Touch-friendly zoom controls */
  .zoom-controls button {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  /* Mobile bar: bigger touch target */
  #mobile-bar {
    min-height: 60px;
    padding: 12px 16px;
  }
}

/* ── CONCEPT EXPLORER BUBBLES ── */
.concept-bubbles circle.concept-bubble {
  transition: fill-opacity 0.12s, stroke-width 0.12s;
}

/* ── PAPER SIDEBAR (concept explorer) ── */
#paper-sidebar {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 390px;
  background: rgba(255, 255, 255, 0.97);
  border-right: 1px solid var(--border, #e5e7eb);
  z-index: 100;
  flex-direction: column;
  overflow: hidden;
}
#paper-sidebar.visible {
  display: flex;
}

#paper-sidebar-head {
  display: none;
}

#paper-sidebar-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#paper-sidebar-list::-webkit-scrollbar { display: none; }

/* Paper rows — matching home page .pr pattern */
#paper-sidebar .sb-row {
  display: flex;
  align-items: baseline;
  gap: 0;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border-subtle, #f0f0f0);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
#paper-sidebar .sb-row:last-child { border-bottom: none; }
#paper-sidebar .sb-row:hover .sb-t { color: var(--accent, #0056b3); }
#paper-sidebar .sb-row.highlighted { background: rgba(0, 86, 179, 0.06); }

#paper-sidebar .sb-id {
  font-family: var(--mono, monospace);
  font-size: 10px;
  color: var(--accent, #0056b3);
  white-space: nowrap;
  flex-shrink: 0;
}

#paper-sidebar .sb-body {
  flex: 1;
  min-width: 0;
  margin: 0 8px;
}

#paper-sidebar .sb-t {
  font-size: 12px;
  font-weight: 500;
  color: var(--text, #1a1a1a);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.1s;
}

#paper-sidebar .sb-a {
  font-size: 10px;
  color: var(--text-2, #6b7280);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#paper-sidebar .sb-cite {
  font-size: 9px;
  color: var(--text-3, #9ca3af);
  white-space: nowrap;
  flex-shrink: 0;
  text-align: right;
  align-self: flex-start;
}

#paper-sidebar .sb-divider {
  display: flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-2, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-2, #f8f8f8);
  border-top: 1px solid var(--border, #e5e7eb);
  border-bottom: 1px solid var(--border, #e5e7eb);
}

#paper-sidebar .sb-divider:first-child {
  border-top: none;
}

#paper-sidebar .sb-row.sb-adjacent {
  opacity: 0.7;
}

#paper-sidebar .sb-role {
  display: block;
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 5px;
  border-radius: 4px;
  margin-top: 3px;
  text-align: right;
}

/* ── MOBILE BOTTOM BAR ── */
#mobile-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  z-index: 200;
  transform: translateY(100%);
  transition: transform 0.2s ease-out;
}
#mobile-bar.visible {
  transform: translateY(0);
}
.mb-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.mb-meta {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.4;
}
.mb-hint {
  font-size: 9px;
  color: var(--text-3);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

@media (max-width: 768px) {
  #mobile-bar { display: block; }
}

/* ═══════════════════════════════════════════════════════════════ */
/* Learning Path (renders into paper sidebar on LHS)               */
/* ═══════════════════════════════════════════════════════════════ */

/* ── Mode toggle (EXPLORE | NAVIGATE) ── */
.mode-toggle {
  display: flex;
  align-items: center;
  gap: 0;
  margin-right: 4px;
}

.mode-btn {
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text-3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 8px;
  letter-spacing: 0.6px;
  transition: color 0.12s;
}

.mode-btn:hover {
  color: var(--text-2);
}

.mode-btn.active {
  color: var(--accent, #0056b3);
}

.mode-sep {
  width: 1px;
  height: 12px;
  background: var(--border, #e5e7eb);
}

/* Truncate header stats in navigate mode to give nav bar room */
.header-stats {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: none;
}
.source-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: rgba(120, 200, 255, 0.15);
  color: rgba(120, 200, 255, 0.9);
  border: 1px solid rgba(120, 200, 255, 0.3);
  vertical-align: middle;
}
body.mode-navigate .header-stats {
  max-width: 260px;
}

/* Hide explore search dropdown in navigate mode */
body.mode-navigate #search-results {
  display: none !important;
}
/* Hide map tooltip only when route is active */
body[data-route-state="route_active"] #tooltip,
body[data-route-state="route_loading"] #tooltip,
body[data-route-state="paper_focus"] #tooltip {
  display: none !important;
}
/* Hide paper stats in navigate mode (keep domain/subfield/program/concept counts) */
body.mode-navigate .hs-item:nth-child(n+5) {
  display: none;
}

/* Detail panel should not cover nav dropdowns */
body.mode-navigate .detail-panel {
  z-index: 1;
}

/* Map recentering handled by D3 zoom transforms in roadmap-paths.js */

/* ── Navigate search bar (from → to) ── */
.nav-search-wrap {
  position: relative;
  flex: 1 1 360px;
  max-width: 420px;
}

.nav-input-pair {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  background: var(--bg, #fff);
  height: 30px;
}

.nav-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 10px;
  font-size: 13px;
  font-family: var(--font);
  font-weight: 400;
  border: none;
  background: none;
  color: var(--text);
  outline: none;
  transition: background 0.12s;
}

.nav-input:focus {
  background: none;
}

/* Border-radius on first/last inputs (no overflow:hidden on parent) */
#nav-from-box .nav-input {
  border-radius: 6px 0 0 6px;
}

.nav-input::placeholder {
  color: var(--text-3);
}

.nav-input.filled {
  font-weight: 500;
  color: var(--accent, #0056b3);
}

.nav-arrow-sep {
  font-size: 10px;
  color: var(--text-3);
  flex-shrink: 0;
  padding: 0 6px;
  background: var(--bg-2, #f5f5f5);
  height: 100%;
  display: flex;
  align-items: center;
  border-left: 1px solid var(--border-subtle, #f0f0f0);
  border-right: 1px solid var(--border-subtle, #f0f0f0);
}

.nav-go-btn {
  flex-shrink: 0;
  width: 36px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg, #fff);
  border: none;
  border-left: 1px solid var(--border, #e5e7eb);
  border-radius: 0 5px 5px 0;
  color: var(--text-3);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  padding: 0;
}

.nav-go-btn:hover {
  color: var(--accent, #0056b3);
  background: rgba(0, 86, 179, 0.06);
}

/* Per-input wrapper for individual dropdowns */
.nav-input-box {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  z-index: 1;
}

.nav-input-box .search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: -1px;
  right: -1px;
  z-index: 10000;
  border-radius: 6px;
  border: 1px solid var(--border, #e5e7eb);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Route summary bar */
.nav-route-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  font-size: 10px;
  color: var(--text-3);
  white-space: nowrap;
  height: 100%;
}

.nav-route-summary .route-eta {
  font-weight: 600;
  color: var(--text-2);
}

@media (max-width: 768px) {
  .mode-toggle { display: none; }
  .nav-search-wrap { display: none; }
}

/* Path-specific elements inside the paper sidebar */
.path-divider {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.path-mode-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent, #0056b3);
}

.path-close-btn {
  font-size: 14px;
  color: var(--text-3);
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
}

.path-close-btn:hover {
  color: var(--text);
}

.path-picker-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-subtle, #f0f0f0);
}

.path-picker-row .fp-chip {
  font-size: 10px;
  padding: 2px 7px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.path-chip-placeholder {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-2, #f8f8f8);
  border: 1px dashed var(--border, #e5e7eb);
  white-space: nowrap;
}

.path-arrow-icon {
  font-size: 10px;
  color: var(--text-3);
  flex-shrink: 0;
}

.path-hint-text {
  font-size: 10px;
  color: var(--text-3);
  padding: 8px 14px;
  line-height: 1.4;
}

/* Program/subfield section header */
.path-section-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.2px;
  color: var(--text, #1a1a1a);
  background: var(--bg-2, #f5f5f5);
  border-top: 2px solid var(--border, #e5e7eb);
}

.path-section-num {
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  background: var(--text-2, #6b7280);
  min-width: 18px;
  height: 18px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.path-step-divider {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 14px 6px;
  margin-top: 2px;
  background: var(--bg-2, #f8f8f8);
  border-top: 1px solid var(--border, #e5e7eb);
  border-bottom: none;
}

/* Indent paper rows under steps */
.path-step-divider ~ .sb-row {
  padding-left: 32px;
  border-bottom: 1px solid var(--border-subtle, #f5f5f5);
}
.path-step-divider ~ .sb-row:last-child,
.path-step-divider ~ .sb-row + .path-step-divider {
  border-bottom: none;
}
.path-step-divider ~ .sb-row:hover {
  background: rgba(0, 86, 179, 0.03);
}
.path-step-active ~ .sb-row:not(.path-step-divider) {
  border-left: 2px solid rgba(0, 86, 179, 0.15);
  margin-left: 14px;
  padding-left: 18px;
}

.path-step-chips {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  width: 100%;
}

.path-step-chips .fp-chip {
  font-size: 9px;
  padding: 2px 7px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.path-step-num {
  font-size: 9px;
  font-weight: 700;
  color: var(--accent, #0056b3);
  background: rgba(0, 86, 179, 0.08);
  min-width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.path-step-count,
.path-step-meta {
  font-size: 9px;
  color: var(--text-3);
  font-family: var(--mono);
  margin-left: auto;
  white-space: nowrap;
}

/* Concept trail (chip path overview) */
.path-trail {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 8px 14px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.path-trail .fp-chip {
  font-size: 9px;
  padding: 2px 7px;
}

.path-trail-arrow {
  font-size: 9px;
  color: var(--text-3);
  flex-shrink: 0;
}

/* Target star */
.path-target-star {
  color: var(--accent, #0056b3);
  font-size: 11px;
  margin-right: 2px;
}

.path-target-divider {
  margin-top: 4px;
  border-top: 2px solid var(--border, #e5e7eb);
}

.path-target-divider .fp-chip {
  font-size: 9px;
  padding: 2px 7px;
}

.path-summary {
  font-weight: 500;
  font-size: 10px;
  color: var(--text-2);
  letter-spacing: 0.3px;
}

.path-no-route {
  font-size: 11px;
  color: var(--text-3);
  padding: 14px;
  text-align: center;
}

/* Path highlighting on the map */
.tile.path-dimmed {
  opacity: 0.15;
}

.tile.path-highlight {
  opacity: 1;
  stroke: var(--accent, #0056b3) !important;
  stroke-width: 2px !important;
}

/* Route overlay (SVG lines on map) */
.route-overlay {
  pointer-events: none;
}

.route-segment {
  transition: stroke 0.2s, stroke-width 0.2s;
}

/* Step navigation in sidebar */
.path-step-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.path-nav-btn {
  width: 20px;
  height: 20px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 4px;
  background: var(--bg, #fff);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.12s, background 0.12s;
}

.path-nav-btn:hover {
  color: var(--accent, #0056b3);
  background: rgba(0, 86, 179, 0.06);
}

.path-nav-pos {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-3);
  min-width: 24px;
  text-align: center;
  font-family: var(--mono);
}

/* Active step in sidebar */
.path-step-divider.path-step-active {
  background: rgba(0, 86, 179, 0.10);
  border-left: 4px solid var(--accent, #0056b3);
  padding-left: 10px;
}

.path-step-active .path-step-num {
  background: var(--accent, #0056b3);
}

/* Loading state */
.path-loading {
  font-size: 11px;
  color: var(--text-3);
  padding: 20px 14px;
  text-align: center;
  animation: path-pulse 1.5s ease-in-out infinite;
}
@keyframes path-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Route motivation (Gemini-generated summary) */
.path-motivation {
  font-size: 11px;
  color: var(--text-2);
  padding: 8px 14px;
  line-height: 1.5;
  border-bottom: 1px solid var(--border, #e5e7eb);
}

/* Swap button (A ⇄ B) */
.path-swap-btn {
  border: none;
  background: none;
  color: var(--text-3);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.12s, background 0.12s;
}
.path-swap-btn:hover {
  color: var(--accent, #0056b3);
  background: rgba(0, 86, 179, 0.06);
}

/* Step number badge */
.path-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-3);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  margin-right: 4px;
  flex-shrink: 0;
}

/* Step title (Gemini-generated) */
.path-step-title {
  display: block;
  font-size: 11px;
  color: var(--text-2);
  margin-top: 4px;
  line-height: 1.4;
}

/* Paper note (Gemini-generated why-read) */
#paper-sidebar .sb-note {
  font-size: 10px;
  color: var(--text-3);
  font-style: italic;
  margin-top: 2px;
  line-height: 1.4;
}

/* ── Concept cross-links (Wiki, Questions) in detail panel ── */
.detail-concept-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.detail-concept-link {
  text-decoration: none;
  font-size: 9px;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.12s;
}

.detail-concept-link:hover {
  opacity: 1;
}

/* ── Go button states ── */
.nav-go-btn:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.nav-go-btn.loading {
  pointer-events: none;
}

.nav-go-btn.loading::after {
  content: '';
  display: block;
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--text-3);
  border-top-color: var(--accent, #0056b3);
  border-radius: 50%;
  animation: nav-spin 0.6s linear infinite;
}

.nav-go-btn.loading > * {
  display: none;
}

@keyframes nav-spin {
  to { transform: rotate(360deg); }
}

/* Go button primed animation (auto-trigger delay) */
.nav-go-btn--primed {
  position: relative;
  overflow: hidden;
}

.nav-go-btn--primed::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent, #0056b3);
  opacity: 0.12;
  transform-origin: left;
  animation: nav-go-fill 1.5s linear forwards;
}

@keyframes nav-go-fill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
