/* ── Design tokens ──────────────────────────────────────────────────────── */
:root {
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --s2: #F0F2F5;
  --s3: #E8EBF0;
  --border: #E0E3EA;
  --border2: #EAECF1;

  --text: #141820;
  --text2: #3D4460;
  --text3: #8892AE;
  --text4: #a4abbe;
  --text5: #6c748b;
  --inv: #FFFFFF;
  --icon: #a3abbf;

  --red: #C8102E;
  --red-s: rgba(200, 16, 46, .08);
  --red-m: rgba(200, 16, 46, .18);
  --gold: #A4804A;
  --gold-s: rgba(164, 128, 74, .10);
  --gold-m: rgba(164, 128, 74, .22);
  --green: #2E7D52;

  --f-serif: 'Source Serif 4', Georgia, serif;
  --f-sans: 'DM Sans', -apple-system, sans-serif;

  --hh: 54px;
  /* header height */

  --pl: clamp(240px, 22vw, 320px);
  /* left panel width */

  --pr: clamp(240px, 22vw, 320px);
  /* right panel width */

  --r: 5px;
  /* border radius */

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  /* expo-out — default easing for panels, overlays, slides */

  /* ── Typography scale (large screen ≥ 1920px default) ──────────────── */

  /* h0: tutorial title, credits heading */
  --fs-h0: 24px;

  /* h1: scholar name in profile card, section headings, load screen title */
  --fs-name: 22px;

  /* h1: section headings, load screen title */
  --fs-h1: 17px;

  /* h2: nav tabs, data-stats numbers, sub-headings */
  --fs-h2: 15px;

  /* section: scholar name in profile card, section headings, load screen title */
  --fs-sec: 14px;

  /* h3: secondary text, collaborator names, panel sub-headings */
  --fs-h3: 13px;

  /* body: base body text, search input, search result names */
  --fs-body: 12px;

  /* body-m: filter buttons, legend items, sr-college, tree labels */
  --fs-body-m: 11px;

  /* body-s: small secondary labels */
  --fs-body-s: 10px;

  /* note: chart axis ticks, ALL-CAPS section labels, nano glyphs */
  --fs-note: 9px;

  /* note-s: chart annotations, bar value labels, legend annotations */
  --fs-note-s: 8px;

  /* metric: h-index, citation counts in profile card (not responsive) */
  --fs-metric: 22px;

  /* icon: canvas control buttons +/−/⊙ (not responsive) */
  --fs-icon: 14px;

  /* ── College colors ──────────────────────────────────────────────── */
  --col-bouve: #A0DAC8;
  --col-camd: #beb5da;
  --col-eng: #E29191;
  --col-cps: #E3A1C5;
  --col-sci: #AECF91;
  --col-cssh: #ed8355;
  --col-dmsb: #FFC672;
  --col-khoury: #8DAED2;
  --col-law: #CFAB9B;
  --col-mills: #8CE2E5;
  --col-london: #aec272;
  --col-centers: #B6B8C4;
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-sans);
  font-size: var(--fs-body);
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: var(--f-sans);
  cursor: pointer;
}

a {
  text-decoration: none;
}

/* ── Loading ────────────────────────────────────────────────────────────── */
#loading {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.load-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.load-logo {
  animation: spin 4s linear infinite;
  opacity: .7;
}

.load-title {
  font-family: var(--f-serif);
  font-size: var(--fs-h1);
  font-weight: 600;
  color: var(--text);
}

.load-inst {
  font-size: var(--fs-body);
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--red);
}

.load-bar-wrap {
  width: 140px;
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

#load-bar {
  height: 100%;
  width: 0;
  background: var(--red);
  transition: width .3s;
}

#load-msg {
  font-size: var(--fs-body-m);
  color: var(--text3);
}

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

/* ── App grid ───────────────────────────────────────────────────────────── */
#app {
  display: grid;
  grid-template-rows: var(--hh) 1fr;
  height: 100vh;
  width: 100vw;
  position: relative;
}

#layout {
  position: relative;
  overflow: hidden;
  height: 100%;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
#header {
  grid-column: 1/-1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

#hd-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-width: 340px;
}

#hd-brand-home {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

#hd-logo {
  opacity: .9;
  margin-top: 4px;
}

.hd-t1 {
  font-family: var(--f-serif);
  font-size: var(--fs-h1);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.01em;
  line-height: 1.2;
}

.hd-t2 {
  font-size: var(--fs-body);
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--red);
  margin-top: 1px;
}

/* Search */
#canvas-search {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 480px;
  z-index: 20;
  transition: opacity 0.2s ease;
}

#hd-search-wrap {
  position: relative;
  width: 100%;
}

.hd-search-icon {
  position: absolute;
  left: 10px;
  top: 48%;
  transform: translateY(-50%);
  color: var(--text3);
  pointer-events: none;
  z-index: 1;
}

#hd-search {
  width: 100%;
  background: rgba(255, 255, 255, .4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(163, 171, 191, 0.7);
  color: var(--text);
  padding: 7px 30px 7px 30px;
  font-family: var(--f-sans);
  font-size: var(--fs-sec);
  border-radius: 6px;
  outline: none;
  height: 36px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .04);
  transition: border-color .15s, box-shadow .15s, background .15s;
}

#hd-search::placeholder {
  color: var(--text5);
}

#hd-search:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 2.5px var(--red-s);
  background: rgba(255, 255, 255, .90);
}

#hd-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text3);
  font-size: var(--fs-body);
  padding: 2px 4px;
  line-height: 1;
  z-index: 1;
}

/* Nav */
#hd-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  min-width: auto;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  border-radius: 0;
  color: var(--text3);
  font-size: var(--fs-sec);
  font-weight: 500;
  padding: 0 12px;
  height: var(--hh);
  position: relative;
  transition: color .15s;
  white-space: nowrap;
}

.nav-tab-label {
  display: block;
  position: relative;
}

.nav-tab-label::before {
  content: attr(data-text);
  font-size: var(--fs-sec);
  font-weight: 600;
  visibility: hidden;
  height: 0;
  max-height: 0;
  overflow: hidden;
  display: block;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--red);
  background: none;
}

.nav-tab.active {
  color: var(--red);
}

.nav-tab.active .nav-tab-label {
  font-weight: 600;
}

.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0px;
  left: 12px;
  right: 12px;
  height: 2px;
  background: var(--red);
  border-radius: 1px;
}

.nav-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 6px;
}

#hd-feedback {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--gold);
  font-size: var(--fs-sec);
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--r);
  transition: color .15s;
  margin-left: 6px;
}

#hd-feedback:hover {
  color: var(--red);
}

/* ── Search overlay ──────────────────────────────────────────────────────── */
#search-overlay {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 300;
}

#search-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 24px rgba(20, 24, 32, .1);
  max-height: 380px;
  overflow-y: auto;
}

#search-hint {
  font-size: var(--fs-h3);
  color: var(--red);
  padding: 6px 14px;
  background: var(--red-s);
  border-bottom: 1px solid var(--red-m);
}

.sr-group-label {
  font-size: var(--fs-h3);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 10px 14px 5px;
}

.sr-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background .1s;
}

.sr-item:hover {
  background: var(--s2);
}

.sr-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sr-name {
  flex: 1;
  font-size: var(--fs-h3);
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sr-college {
  font-size: var(--fs-body-m);
  color: var(--text3);
  white-space: nowrap;
}

.sr-badge {
  font-size: var(--fs-body);
  background: var(--gold-s);
  border: 1px solid var(--gold-m);
  color: var(--gold);
  padding: 1px 6px;
  border-radius: 5px;
  font-weight: 400;
  position: relative;
  z-index: 1;
}

.sr-hidden-tag {
  font-size: var(--fs-body);
  color: var(--text3);
  background: var(--s2);
  padding: 1px 5px;
  border-radius: 6px;
}

.sr-item.hidden-node .sr-name {
  opacity: .5;
}

/* ── Left panel ──────────────────────────────────────────────────────────── */
#panel-left {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: var(--pl);
  overflow: visible;
  z-index: 10;
  transform: translateX(0);
  will-change: transform;
  transition: transform 0.25s var(--ease);
}

#panel-left.slide-out {
  transform: translateX(calc(-1 * var(--pl)));
  pointer-events: none;
}

#panel-left .panel-inner {
  width: 100%;
  height: 100%;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

#left-content {
  padding: 12px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  user-select: none;
  transition: opacity 0.2s ease;
  cursor: default;
}

/* Section header */
.sec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 7px;
}

.sec-title {
  font-size: var(--fs-sec);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  flex: 1;
}

.sec-reset {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-body);
  color: var(--text4);
  background: none;
  border: none;
  padding: 0;
  margin-top: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: color .12s;
}

.sec-reset:hover {
  color: var(--red);
}

/* Button groups */
.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.btn-group-break {
  flex-basis: 100%;
  height: 0;
}


.filter-btn,
.vc-btn,
.cb-btn {
  background: var(--s2);
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 3px 9px;
  font-size: var(--fs-h3);
  font-weight: 500;
  border-radius: 5px;
  transition: color .15s, border-color .15s, background .15s;
}

.filter-btn:hover,
.vc-btn:hover,
.cb-btn:hover {
  background: var(--red-s);
  border-color: var(--red);
  color: var(--red);
}

.filter-btn.active,
.vc-btn.active,
.cb-btn.active {
  background: var(--red);
  color: var(--inv);
  border-color: var(--red);
}

.filter-btn.active:hover,
.vc-btn.active:hover,
.cb-btn.active:hover {
  background: var(--red);
  color: var(--inv);
  border-color: var(--red);
}

/* Addon filter buttons: Former, Retired, etc. */
.addon-btn {
  color: var(--text3);
  border-style: dashed;
  display: inline-flex;
  align-items: center;
}
.addon-btn:hover {
  border-style: dashed;
}
.addon-btn.active {
  border-style: solid;
}
.addon-btn::before {
  content: "+";
  display: inline-block;
  max-width: 1em;
  margin-right: 3px;
  overflow: hidden;
  opacity: 1;
  transition: max-width 0.2s ease, margin-right 0.2s ease, opacity 0.2s ease;
}
.addon-btn.active::before {
  max-width: 0;
  margin-right: 0;
  opacity: 0;
}

/* Research units tree */
.units-section {
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 6px;
}

.units-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: var(--s2);
  cursor: pointer;
  user-select: none;
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--text2);
}

.units-section-header:hover {
  background: var(--s3);
}

.units-count {
  font-size: var(--fs-body-m);
  color: var(--text3);
  font-weight: 500;
  margin-left: auto;
  margin-right: 6px;
}

.units-chevron {
  font-size: var(--fs-body);
  color: var(--text3);
  transition: transform .2s;
}

.units-chevron.open {
  transform: rotate(90deg);
}

.college-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px 5px 8px;
  cursor: pointer;
  transition: background .1s;
  border-top: 1px solid var(--border2);
}

.college-row:hover {
  background: var(--s2);
}

.college-row.faded {
  opacity: .3;
}

.college-left {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
}

.college-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.college-name {
  font-size: var(--fs-body-m);
  font-weight: 500;
  color: var(--text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.college-depts {
  font-size: var(--fs-body);
  color: var(--text3);
  white-space: nowrap;
  margin-right: 4px;
}

.college-chevron {
  font-size: var(--fs-body-m);
  color: var(--text3);
  flex-shrink: 0;
  transition: transform .18s;
}

.college-chevron.open {
  transform: rotate(90deg);
}

.dept-list {
  background: var(--surface);
}

.dept-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px 4px 26px;
  cursor: pointer;
  transition: background .1s;
  border-top: 1px solid var(--border2);
}

.dept-row:hover {
  background: var(--s2);
}

.dept-row.faded {
  opacity: .3;
}

.dept-name {
  font-size: var(--fs-body-m);
  color: var(--text2);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dept-members {
  font-size: var(--fs-body);
  color: var(--text3);
  font-weight: 500;
  white-space: nowrap;
}

.center-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px 4px 10px;
  cursor: pointer;
  transition: background .1s;
  border-top: 1px solid var(--border2);
}

.center-row:hover {
  background: var(--s2);
}

.center-row.faded {
  opacity: .3;
}

.center-name {
  font-size: var(--fs-body-m);
  color: var(--text2);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.center-members {
  font-size: var(--fs-body);
  color: var(--text3);
  font-weight: 500;
  white-space: nowrap;
}

/* Sliders */
.slider-row {
  margin-bottom: 9px;
}

.slider-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.slider-label {
  font-size: var(--fs-h3);
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 4px;
}

.slider-val {
  font-size: var(--fs-h3);
  font-weight: 600;
  color: var(--red);
}

/* Custom dual-handle range slider */
.crs-wrap {
  position: relative;
  height: 20px;
  margin: 4px 8px;
  user-select: none;
}
.crs-track {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  cursor: pointer;
  transition: background .15s;
}
.crs-track.crs-single {
  background: var(--red);
  opacity: 0.5;
}
.crs-fill {
  position: absolute;
  top: 0; height: 100%;
  background: var(--red);
  border-radius: 2px;
  opacity: 0.4;
  pointer-events: none;
}
.crs-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--surface);
  border: 2px solid var(--red);
  border-radius: 50%;
  cursor: grab;
  transform: translate(-50%, -50%);
  top: 50%;
  z-index: 2;
  transition: transform .15s;
}
.crs-handle:hover {
  transform: translate(-50%, -50%) scale(1.3);
}
.crs-handle:active {
  cursor: grabbing;
}

input[type=range] {
  width: 100%;
  accent-color: var(--red);
  height: 3px;
  cursor: pointer;
  display: block;
}

/* Colored by */
.colored-by-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.colored-by-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--text3);
  white-space: nowrap;
}


/* ── Canvas area ──────────────────────────────────────────────────────────── */
#canvas-area {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--bg);
}

.view {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.view.active {
  opacity: 1;
  pointer-events: auto;
}

.view-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 14px;
  color: var(--text3);
  font-size: var(--fs-body);
  text-align: center;
  line-height: 1.7;
}

.view-placeholder span {
  font-size: var(--fs-body-m);
}

#view-collab {
  user-select: none;
  -webkit-user-select: none;
}

#view-collab #hd-search {
  user-select: text;
  -webkit-user-select: text;
}

#v1-canvas {
  width: 100%;
  height: 100%;
  display: block;
  position: absolute;
  inset: 0;
  opacity: 1;
  transition: opacity 0.2s ease;
}

#vc-container {
  opacity: 1;
  transition: opacity 0.2s ease;
}

/* canvas overlay elements: fade in place only */
#canvas-bottom-left,
#data-overview,
#canvas-controls {
  transition: opacity 0.2s ease;
}

/* When left panel is hidden, remove panel offset from canvas overlays */
#layout.no-left-panel #data-overview,
#layout.no-left-panel #canvas-bottom-left {
  left: 14px;
}

/* Data overview top-left — offset by left panel width */
#data-overview {
  position: absolute;
  top: 14px;
  left: calc(var(--pl) + 14px);
  right: calc(50% + 240px + 14px);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  pointer-events: none;
}

#data-stats {
  display: flex;
  gap: 10px;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  background: rgba(255, 255, 255, .55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 5px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .04);
  font-size: var(--fs-body);
  color: var(--text3);
}

#data-stats b {
  color: var(--text);
  font-weight: 600;
  font-size: var(--fs-body);
}

#topic-badge {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  min-height: 30px;
  height: auto;
  padding: 6px 10px 6px 12px;
  min-width: 120px;
  background: rgba(255, 255, 255, .55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(163, 171, 191, 0.6);
  border-left: 3px solid var(--gold);
  border-radius: 5px;
  font-size: var(--fs-body);
  color: var(--text2);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .04);
  pointer-events: all;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#topic-badge.visible {
  opacity: 1;
  pointer-events: all;
}

#topic-badge-text {
  font-weight: 500;
  color: var(--text);
  white-space: normal;
  word-break: break-word;
  flex: 1;
  min-width: 0;
}

#topic-badge-clear {
  background: none;
  border: none;
  color: var(--text3);
  font-size: var(--fs-body-m);
  padding: 0 2px;
  flex-shrink: 0;
  cursor: pointer;
  line-height: 1;
  align-self: flex-start;
  margin-top: 2.5px;
  transition: color .1s;
}

#topic-badge-clear:hover {
  color: var(--red);
}

/* Canvas controls top-right */
#canvas-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#view-switcher {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vs-btn {
  width: 130px;
  height: 30px;
  padding: 0;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text3);
  font-size: var(--fs-h3);
  font-weight: 500;
  border-radius: 5px;
  display: flex;
  align-items: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
  white-space: nowrap;
}

.vs-btn:not(.active):hover {
  background: var(--red);
  color: var(--inv);
  border-color: var(--red);
}

.vs-btn.active {
  border-color: var(--red);
  color: var(--red);
}

.vs-btn.active .vs-btn-label {
  font-weight: 600;
}

.vs-btn-label {
  display: block;
}

.vs-btn-label::before {
  content: attr(data-text);
  font-size: var(--fs-h3);
  font-weight: 600;
  visibility: hidden;
  height: 0;
  max-height: 0;
  overflow: hidden;
  display: block;
  white-space: nowrap;
}

.cc-btn {
  width: 26px;
  height: 26px;
  background: rgba(255, 255, 255, .55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: var(--fs-icon);
  line-height: 1;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .03);
  transition: all .12s;
}

.cc-btn:hover {
  border-color: var(--red);
  color: var(--red);
}

.cc-btn.active {
  background: var(--red);
  color: var(--inv);
  border-color: var(--red);
}

/* Canvas bottom-left: legend + zoom controls — offset by left panel width */
#canvas-bottom-left {
  position: absolute;
  bottom: 14px;
  left: calc(var(--pl) + 14px);
  z-index: 10;
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: flex-end;
}

#legend-box {
  background: rgba(255, 255, 255, .55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .04);
}

.legend-title {
  font-size: var(--fs-body);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 5px;
}

#legend-grid {
  display: grid;
  grid-template-columns: repeat(2, 90px);
  grid-template-rows: repeat(6, auto);
  grid-auto-flow: column;
  gap: 2px 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-body-m);
  color: var(--text2);
  white-space: nowrap;
  cursor: default;
  border-radius: 3px;
  padding: 1px 4px;
  transition: background .12s;
  user-select: none;
  -webkit-user-select: none;
}

.legend-item[data-college] {
  cursor: pointer;
}

.legend-item[data-college]:hover {
  background: var(--s2);
}

.legend-item.legend-active {
  background: var(--s3);
  font-weight: 600;
  color: var(--text);
}

.legend-item .info-icon {
  width: 11px;
  height: 11px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  min-width: 7px;
  min-height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Isolated zone */
#isolated-zone {
  position: absolute;
  bottom: 44px;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(244, 245, 247, .97), rgba(244, 245, 247, .85));
  border-top: 1px solid var(--border);
  padding: 8px 14px 10px;
  max-height: 110px;
}

.iso-header {
  font-size: var(--fs-note);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 5px;
}

#iso-list {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  max-height: 60px;
  overflow-y: auto;
}

.iso-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px 8px;
  font-size: var(--fs-body-m);
  color: var(--text2);
  cursor: pointer;
  transition: border-color .1s;
}

.iso-chip:hover {
  border-color: var(--red);
  color: var(--red);
}

.iso-chip-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

/* ── University Overview drawer — resizable bottom sheet ────────────────── */
/*
 * Three states:
 *   collapsed  : only the handle bar is visible (--drawer-collapsed-h = 30px)
 *   open       : default expanded height (--drawer-open-h = 260px)
 *   fullscreen : fills canvas from header to bottom
 *
 * Resize is handled by JS drag on #drawer-resize-handle.
 */

#univ-drawer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--surface);
  border-top: 2px solid var(--border);
  /* height is set dynamically by JS; default collapsed */
  height: 35px;
  display: flex;
  flex-direction: column;
  transition: height 0.25s cubic-bezier(.4, 0, .2, 1);
  /* allow transition to be cancelled during drag */
  will-change: height;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, .06);
}

/* Drag handle strip — always visible at top of drawer */
#drawer-resize-handle {
  position: relative;
  flex-shrink: 0;
  height: 34px;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 14px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

#drawer-resize-handle:hover {
  background: var(--s2);
}

/* Drag grip dots (center of handle) */
#drawer-grip {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 3px;
  align-items: center;
  pointer-events: none;
}

#drawer-grip span {
  display: block;
  width: 28px;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.15s;
}

/* Left side: label */
#univ-drawer-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text3);
  font-size: var(--fs-sec);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 0;
  cursor: pointer;
  transition: color .12s;
  pointer-events: none;
  /* clicks handled by handle wrapper */
}

/* Right side: control buttons */
#drawer-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  z-index: 1;
}

.drawer-ctrl-btn {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--text3);
  font-size: var(--fs-body-m);
  line-height: 1;
  transition: background .1s, color .1s;
}

.drawer-ctrl-btn:hover {
  background: var(--s2);
  color: var(--text2);
}

/* Scrollable content area */
#univ-drawer-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  /* hidden when collapsed */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#univ-drawer.is-open #univ-drawer-content {
  opacity: 1;
  pointer-events: auto;
}

#univ-drawer-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

#univ-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.univ-stat-box {
  background: var(--s2);
  border-radius: 5px;
  padding: 10px 12px;
}

.univ-stat-label {
  font-size: var(--fs-note);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
}

.univ-stat-value {
  font-family: var(--f-serif);
  font-size: var(--fs-metric);
  font-weight: 600;
  color: var(--red);
  margin-top: 3px;
}

.univ-stat-sub {
  font-size: var(--fs-body);
  color: var(--text3);
  margin-top: 1px;
}

/* ── Right panel ──────────────────────────────────────────────────────────── */
#panel-right {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: var(--pr);
  overflow: visible;
  z-index: 10;
  transform: translateX(var(--pr));
  transition: transform 0.25s var(--ease);
}

#panel-right.open {
  transform: translateX(0);
}

#panel-right .panel-inner {
  width: 100%;
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}


#right-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 10px;
  color: var(--text3);
  font-size: var(--fs-body);
  text-align: center;
  line-height: 1.6;
}

/* ── Scholar Profile Card ─────────────────────────────────────────────────── */
#right-card {
  padding: 14px 13px;
}

.rp-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 2px;
}

.rp-avatar-svg {
  flex-shrink: 0;
  align-self: center;
}

.rp-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.rp-name {
  font-family: var(--f-serif);
  font-size: var(--fs-name);
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  flex: 1;
  min-width: 0;
}

.rp-quality-badge {
  font-size: var(--fs-body);
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 8px;
  background: var(--s2);
  border: 1px solid var(--border);
  color: var(--text3);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 3px;
}

.rp-quality-badge.flagged {
  background: rgba(200, 16, 46, .07);
  border-color: var(--red-m);
  color: var(--red);
}

.rp-role {
  font-size: var(--fs-h2);
  color: var(--text3);
  margin: 3px 0 12px;
}

.rp-role em {
  font-size: var(--fs-sec);
}

/* Bridge badge */
.rp-bridge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-h3);
  font-weight: 600;
  color: var(--gold);
  background: var(--gold-s);
  border: 1.5px solid var(--gold-m);
  padding: 3px 9px;
  border-radius: 5px;
  margin-bottom: 14px;
}

/* Affiliation block */
.rp-affil {
  margin-bottom: 14px;
}

.rp-affil-row {
  display: flex;
  align-items: flex-start;
  font-size: var(--fs-sec);
  color: var(--text2);
  line-height: 1.5;
  padding: 1px 0;
  border-left: 2.5px solid var(--border);
  padding-left: 8px;
  margin-bottom: 2px;
}

.rp-affil-row.center-row-affil {
  border-left-color: var(--col-centers);
  color: var(--text3);
}

/* Metrics grid */
.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 14px 0;
}

.metric-box {
  background: var(--bg);
  border: 1.5px solid var(--border);
  padding: 8px 10px;
  border-radius: 5px;
  position: relative;
}

.metric-box .info-icon {
  position: absolute;
  top: 6px;
  right: 6px;
}

.metric-label {
  font-size: var(--fs-body);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 3px;
}

.metric-value {
  font-family: var(--f-serif);
  font-size: var(--fs-metric);
  font-weight: 600;
  color: var(--gold);
  margin-top: 3px;
  line-height: 1.2;
}

.metric-sub {
  font-size: var(--fs-note);
  color: var(--text3);
  margin-top: 1px;
}

.metric-value.gold {
  color: var(--gold);
}

/* Collabs list */
.rp-collabs-header {
  font-size: var(--fs-sec);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text3);
  margin: 16px 0 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 5px;
}

.rp-isolated-reason {
  font-size: var(--fs-body);
  color: var(--text3);
  line-height: 1.55;
  padding: 8px 10px;
  background: var(--bg2);
  border-radius: 5px;
  margin-top: 7px;
  margin-bottom: 4px;
}

.rp-collabs-box {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border2);
  border-radius: 5px;
  margin-top: 7px;
}

.rp-collabs-box.no-border {
  border: none;
  border-radius: 0;
}

.collab-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 9px;
  cursor: pointer;
  border-bottom: 1px solid var(--border2);
  transition: background .1s;
}

.collab-row:last-child {
  border-bottom: none;
}

.collab-row:hover {
  background: var(--s2);
}

.collab-row.hidden-node {
  opacity: .6;
}

.collab-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.collab-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  top: 1px;
}

.collab-name {
  font-size: var(--fs-sec);
  color: var(--text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collab-hidden-tag {
  font-size: var(--fs-body-m);
  color: var(--text3);
  font-style: italic;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 4px;
  margin-right: 5px;
}

.collab-weight {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--text3);
  white-space: nowrap;
}

/* Ego network section */
.rp-ego-header {
  font-size: var(--fs-sec);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  margin: 16px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.rv1-ego-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}

.rv1-ego-btn {
  flex: 1;
  padding: 5px 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text3);
  font-size: var(--fs-body);
  font-weight: 700;
  letter-spacing: .06em;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.rv1-ego-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.rv1-ego-btn.active {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-s);
}

.rv1-ego-btn--off,
.rv1-ego-btn[disabled] {
  opacity: 0.28;
  cursor: not-allowed;
  pointer-events: none;
}

/* Research interests */
.rp-interests-header {
  font-size: var(--fs-sec);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  margin: 16px 0 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.rv1-fields {
  margin-top: 7px;
}

/* Research interests — 3-level interactive layout */
.rv1-field-block {
  margin-bottom: 10px;
}

.rv1-field-name {
  font-size: var(--fs-body);
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--gold);
  margin-bottom: 5px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

/* Subfield tags */
.rv1-sf-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 5px;
}

.rv1-sf-tag {
  font-size: var(--fs-body-m);
  color: var(--text2);
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 7px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}

.rv1-sf-tag:hover {
  border-color: var(--text3);
}

.rv1-sf-tag.selected {
  background: var(--gold-s);
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 500;
}

/* Topic tags */
.rv1-topic-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.rv1-topic-tag {
  font-size: var(--fs-body-m);
  color: var(--text3);
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 3px;
  padding: 2px 7px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}

.rv1-topic-tag:hover {
  border-color: var(--text3);
  color: var(--text2);
}

.rv1-topic-tag.selected {
  background: var(--red-s);
  border-color: var(--red);
  color: var(--red);
  font-weight: 500;
}

/* Explore button */
.rp-explore-btn {
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  background: var(--red-s);
  border: 1.5px solid var(--red);
  color: var(--red);
  font-size: var(--fs-sec);
  font-weight: 600;
  border-radius: 6px;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.rp-explore-btn:hover {
  background: var(--red);
  color: var(--inv);
}

/* Data note */
.rp-data-note {
  font-size: var(--fs-body);
  color: var(--text3);
  line-height: 1.5;
  margin-top: 12px;
  border-top: 1.5px solid var(--border2);
  padding-top: 10px;
}

/* ── Tooltip ──────────────────────────────────────────────────────────────── */
#tooltip {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: var(--fs-h3);
  padding: 7px 11px;
  pointer-events: none;
  z-index: 600;
  border-radius: 5px;
  line-height: 1.55;
  box-shadow: 0 4px 16px rgba(20, 24, 32, .10);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

#tooltip.visible {
  opacity: 1;
  visibility: visible;
}

/* ── Info tooltip icon ──────────────────────────────────────────────────────── */
.info-icon {
  width: 14px;
  height: 14px;
  color: var(--icon);
  cursor: help;
  flex-shrink: 0;
  display: inline-flex;
  vertical-align: middle;
}

.info-icon--gold {
  color: var(--gold);
}

/* ── Scrollbars ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ── Screen size overlay ─────────────────────────────────────────────────── */
#size-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: #fff;
  font-family: var(--f-sans);
  font-size: var(--fs-h2);
  text-align: center;
  padding: 40px;
}

#size-overlay.visible {
  display: flex;
}

#size-overlay svg {
  opacity: 0.5;
  margin-bottom: 4px;
}

#size-overlay p {
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.6;
}

/* ── Tutorial ───────────────────────────────────────────────────────────── */
#tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.6s ease;
}

#tutorial-card {
  max-width: 480px;
  width: 90%;
  text-align: center;
  padding: 48px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(20, 24, 32, .10);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tut-title {
  font-family: var(--f-serif);
  font-size: var(--fs-h0);
  font-weight: 600;
  color: var(--text);
  margin: 16px 0 4px;
  letter-spacing: -.01em;
}

.tut-inst {
  font-size: var(--fs-h2);
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--red);
  margin-bottom: 20px;
}

.tut-desc {
  font-size: var(--fs-h3);
  color: var(--text2);
  line-height: 1.7;
  margin-bottom: 24px;
}

.tut-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
  margin-bottom: 28px;
}

.tut-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0;
}


.tut-stat-num {
  font-size: var(--fs-h1);
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.tut-stat-label {
  font-size: var(--fs-body);
  color: var(--text3);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.tut-features {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 28px;
  text-align: left;
}

.tut-feat {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-body);
  color: var(--text2);
}

.tut-feat-icon {
  color: var(--red);
  font-size: var(--fs-icon);
  width: 20px;
  text-align: center;
}

#tut-enter-btn {
  background: var(--red);
  color: var(--inv);
  border: none;
  padding: 11px 32px;
  font-family: var(--f-sans);
  font-size: var(--fs-h2);
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity .15s;
}

#tut-enter-btn:hover {
  opacity: .75;
}

.tut-note {
  font-size: var(--fs-body);
  color: var(--text3);
  margin-top: 16px;
}

#credits-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#credits-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.credits-name-link {
  cursor: pointer;
  transition: color .15s;
}

.credits-name-link:hover {
  color: var(--red);
}

#credits-card {
  max-width: 480px;
  width: 90%;
  text-align: center;
  padding: 48px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(20, 24, 32, .10);
}

.credits-section {
  margin-bottom: 4px;
}

.credits-role {
  font-size: var(--fs-sec);
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--text3);
  margin-bottom: 8px;
}

.credits-name {
  font-size: var(--fs-h2);
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: color .15s;
  line-height: 1.9;
}

.credits-name:hover {
  color: var(--red);
}

.credits-divider {
  width: 32px;
  height: 1px;
  background: var(--border);
  margin: 20px auto;
}

#credits-back-btn {
  background: var(--red);
  color: var(--inv);
  border: none;
  padding: 11px 32px;
  font-family: var(--f-sans);
  font-size: var(--fs-h2);
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity .15s;
  margin-top: 28px;
}

#credits-back-btn:hover {
  opacity: .75;
}

.rp-metric-box {
  background: var(--s2);
  border-radius: 5px;
  padding: 8px 10px;
  text-align: center;
}

.rp-metric-val {
  font-size: var(--fs-h1);
  font-weight: 600;
  color: var(--text);
}

.rp-metric-lbl {
  font-size: var(--fs-body);
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--text3);
  margin-top: 2px;
}

.rp-section-label {
  font-size: var(--fs-note);
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--text3);
  margin: 10px 0 5px;
}

/* ── View 2 — Unit Collaboration ─────────────────────────────────────────── */
#v2-wrap {
  position: absolute;
  inset: 0;
}

#v2-svg {
  width: 100%;
  height: 100%;
  transition: opacity 0.2s ease;
}

.unit-hex {
  cursor: pointer;
}

.unit-hex path {
  transition: fill-opacity .15s, stroke-opacity .15s;
}

.unit-hex:hover path {
  filter: brightness(1.08);
}

.unit-link {
  transition: stroke-opacity .15s, stroke-width .15s;
}

/* ── View 3 — Individual View ────────────────────────────────────────────── */
#v3-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#v3-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text3);
  font-size: var(--fs-body);
  text-align: center;
}

.ego-node {
  cursor: pointer;
}

.ego-node:hover circle:first-child {
  opacity: 1 !important;
}

/* ══════════════════════════════════════════════════════════════════════════
 * v6 NEW CSS — panel module classes
 * Organized by module. All new classes use module-prefixed names
 * to be traceable: lv1- (LeftV1), lv2- (LeftV2), lv3- (LeftV3),
 * rv1- (RightV1), rv2- (RightV2), rv3- (RightV3), dv1/2/3- (Drawer)
 * ══════════════════════════════════════════════════════════════════════════ */

/* ── Right panel: v1 / v2 / v3 containers ───────────────────────────────── */
/* Used by: index.html right panel wrapper */
#rv1-placeholder,
#rv2-placeholder,
#rv3-placeholder {
  padding: 14px;
  cursor: default;
}

#rv1-placeholder,
#rv3-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 10px;
  color: var(--text4);
  font-size: var(--fs-sec);
  text-align: center;
  line-height: 1.6;
}

#rv2-card,
#rv3-card {
  display: none;
  flex: 1;
  transition: opacity 0.18s ease;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  min-height: 0;
}

#rv1-card {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.18s ease;
  padding: 0;
  min-height: 0;
}

.rv1-scroll-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  min-height: 0;
  scrollbar-gutter: stable;
}

.rv1-sticky-footer {
  position: relative;
  padding: 8px 14px 14px;
  background: var(--surface);
  flex-shrink: 0;
}

.rv1-sticky-footer::before {
  content: '';
  position: absolute;
  top: -24px;
  left: 0;
  right: 0;
  height: 24px;
  background: linear-gradient(to bottom, transparent, var(--surface));
  pointer-events: none;
}

/* ── RightV1 — Scholar card ─────────────────────────────────────────────── */
/* Used by: right/right_v1.js */
.rv1-overview-title {
  font-size: var(--fs-h2);
  font-weight: 600;
  font-family: var(--f-serif);
  color: var(--text);
  margin-bottom: 4px;
}

.rv1-overview-hint {
  font-size: var(--fs-body-m);
  color: var(--text3);
  margin-bottom: 12px;
}

.rv1-stat-grid {
  margin-bottom: 14px;
}

.rv1-stat-box {
  text-align: center;
}

.rv1-stat-red {
  color: var(--red);
  font-weight: 600;
}

.rv1-top-label {
  font-size: var(--fs-note);
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--text3);
  margin-bottom: 6px;
}

.rv1-top-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  border-bottom: 1px solid var(--border2);
  cursor: pointer;
}

.rv1-top-dot {
  width: 8px;
  height: 8px;
  border-radius: 1px;
  flex-shrink: 0;
}

.rv1-top-name {
  font-size: var(--fs-body-m);
  color: var(--text2);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rv1-top-count {
  font-size: var(--fs-body-m);
  color: var(--text3);
}

.rv1-center-affil {
  color: var(--gold);
}

.rv1-gold {
  color: var(--gold);
}

.rv1-field-count {
  font-size: var(--fs-note);
  color: var(--text3);
  font-weight: 400;
  margin-left: 4px;
}

.rv1-explore-btn {
  /* inherits from rp-explore-btn */
}

/* ── RightV2 — Unit card ────────────────────────────────────────────────── */
/* Used by: right/right_v2.js */
.rv2-overview-title {
  font-size: var(--fs-h2);
  font-weight: 600;
  font-family: var(--f-serif);
  color: var(--text);
  margin-bottom: 4px;
}

.rv2-overview-hint {
  font-size: var(--fs-body-m);
  color: var(--text3);
  margin-bottom: 12px;
}

.rv2-stat-grid {
  margin-bottom: 14px;
}

.rv2-stat-red {
  color: var(--red);
  font-weight: 600;
}

.rv2-section-label {
  font-size: var(--fs-note);
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--text3);
  margin: 10px 0 5px;
}

.rv2-sos-legend {
  margin-bottom: 14px;
}

.rv2-sos-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}

.rv2-sos-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rv2-sos-type {
  font-size: var(--fs-body-m);
  color: var(--text2);
}

.rv2-sos-desc {
  font-size: var(--fs-body-m);
  color: var(--text3);
}

.rv2-top-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  border-bottom: 1px solid var(--border2);
  cursor: pointer;
}

.rv2-top-dot {
  width: 8px;
  height: 8px;
  border-radius: 1px;
  flex-shrink: 0;
}

.rv2-top-name {
  font-size: var(--fs-body-m);
  color: var(--text2);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rv2-top-count {
  font-size: var(--fs-body-m);
  color: var(--text3);
}

.rv2-unit-card {}

.rv2-unit-header {
  border-left: 3px solid transparent;
  padding-left: 10px;
  margin-bottom: 12px;
}

.rv2-unit-name {
  font-size: var(--fs-h2);
  font-weight: 600;
  font-family: var(--f-serif);
  color: var(--text);
}

.rv2-unit-sub {
  font-size: var(--fs-body-m);
  color: var(--text3);
  margin-top: 2px;
}

.rv2-sos-badge {
  font-size: var(--fs-body-m);
  font-weight: 600;
  margin-bottom: 8px;
}

.rv2-metrics {
  margin-bottom: 14px;
}

.rv2-idr {
  margin-bottom: 12px;
}

.rv2-idr-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-body-m);
  margin-bottom: 3px;
}

.rv2-idr-score {
  color: var(--text);
  font-weight: 600;
}

.rv2-idr-bar {
  background: var(--border2);
  border-radius: 3px;
  height: 5px;
  margin-bottom: 6px;
}

.rv2-idr-fill {
  height: 100%;
  border-radius: 3px;
}

.rv2-idr-sub {
  font-size: var(--fs-body-m);
  color: var(--text3);
}

.rv2-topics {
  margin-bottom: 12px;
}

.rv2-topic-row {
  font-size: var(--fs-body-m);
  color: var(--text2);
  padding: 2px 0;
  border-bottom: 1px solid var(--border2);
}

.rv2-partners {
  margin-bottom: 12px;
}

.rv2-partner-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  border-bottom: 1px solid var(--border2);
}

.rv2-partner-dot {
  width: 7px;
  height: 7px;
  border-radius: 1px;
  flex-shrink: 0;
}

.rv2-partner-name {
  font-size: var(--fs-body-m);
  color: var(--text2);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rv2-partner-weight {
  font-size: var(--fs-body-m);
  color: var(--text3);
}

.rv2-explore-btn {
  /* inherits from rp-explore-btn */
}

.rv2-compare-overview {}

.rv2-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 14px;
}

.rv2-compare-col-label {
  font-size: var(--fs-note);
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--text3);
}

.rv2-compare-stat {}

.rv2-compare-legend {
  font-size: var(--fs-body-m);
  color: var(--text3);
  line-height: 1.9;
}

/* ── RightV3 — Ego network stats ─────────────────────────────────────────── */
/* Used by: right/right_v3.js */
.rv3-stats-title {
  font-size: var(--fs-h2);
  font-weight: 600;
  font-family: var(--f-serif);
  color: var(--text);
  margin-bottom: 2px;
}

.rv3-stats-sub {
  font-size: var(--fs-body);
  font-weight: 600;
  margin-bottom: 10px;
}

.rv3-hop-indicator {
  font-size: var(--fs-body-m);
  color: var(--text3);
  margin-bottom: 10px;
}

.rv3-hop-badge {
  display: inline-block;
  background: var(--red-s);
  color: var(--red);
  font-size: var(--fs-body-m);
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  margin-right: 4px;
}

.rv3-metrics {
  margin-bottom: 14px;
}

.rv3-section-label {
  font-size: var(--fs-note);
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--text3);
  margin-bottom: 6px;
}

.rv3-colleges {}

.rv3-college-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
}

.rv3-college-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rv3-college-name {
  font-size: var(--fs-body-m);
  color: var(--text2);
  width: 42px;
  flex-shrink: 0;
}

.rv3-college-bar-wrap {
  flex: 1;
  height: 5px;
  background: var(--border2);
  border-radius: 3px;
  overflow: hidden;
}

.rv3-college-bar {
  display: block;
  height: 100%;
  border-radius: 3px;
}

.rv3-college-count {
  font-size: var(--fs-body-m);
  color: var(--text3);
  width: 20px;
  text-align: right;
}

/* ── LeftV1 — University Network filters ────────────────────────────────── */
/* Used by: left/left_v1.js */
.lv1-section {
  margin-bottom: 2px;
}

.lv1-filter-group {
  margin-bottom: 16px;
}

.lv1-filter-label {
  font-size: var(--fs-h3);
  color: var(--text3);
  font-weight: 600;
  letter-spacing: .05em;
  margin-bottom: 4px;
}

.lv1-units-section {
  margin-bottom: 6px;
}

.lv1-collapsible {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.15s ease-in;
}
.lv1-collapsible.open {
  max-height: 3000px;
  transition: max-height 0.6s ease-out;
}

.lv1-units-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lv1-units-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 5px 4px 3px;
  font-size: var(--fs-h3);
  color: var(--text2);
  font-weight: 600;
  border-bottom: 1px solid var(--border2);
  transition: color .15s;
}
.lv1-units-header:hover {
  color: var(--red);
}
.lv1-units-header:hover .lv1-chevron {
  color: var(--red);
}

.lv1-chevron {
  font-size: var(--fs-note-s);
  color: var(--text3);
  transition: transform .15s;
}

.lv1-chevron.open {
  transform: rotate(90deg);
}

.lv1-college-row {
  display: flex;
  align-items: center;
  padding: 2px 4px;
  min-height: 30px;
}

.lv1-college-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  margin-left: -4px;
  padding: 2px 4px 2px 4px;
  border-radius: 5px;
  transition: background .15s;
}
.lv1-college-left:hover {
  background: var(--s2);
}
.lv1-college-left.active {
  background: var(--s3);
}
.lv1-college-left.active .lv1-college-name {
  color: var(--text);
  font-weight: 500;
}

.lv1-college-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.lv1-college-name {
  font-size: var(--fs-sec);
  color: var(--text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lv1-college-expand {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 2px 0 2px 4px;
  border-radius: 3px;
}
.lv1-college-expand:hover .lv1-college-depts,
.lv1-college-expand:hover .lv1-college-chevron {
  color: var(--red);
  transition: color .15s, transform .15s;
}

.lv1-college-depts {
  font-size: var(--fs-body);
  color: var(--text3);
  display: flex;
  align-items: center;
  align-self: center;
}

.lv1-college-chevron {
  font-size: var(--fs-note-s);
  color: var(--text3);
  transition: transform .15s;
}

.lv1-college-chevron.open {
  transform: rotate(90deg);
}

.lv1-dept-list {
  padding-left: 7.5px;
}

.lv1-dept-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 4px 10px;
  font-size: var(--fs-h3);
  cursor: pointer;
  min-height: 30px;
  border-left: 2.5px solid var(--border);
}

.lv1-dept-row:hover {
  background: var(--s2);
}

.lv1-dept-row.active {
  background: var(--s2);
}

.lv1-dept-row.active .lv1-dept-name {
  color: var(--text);
  font-weight: 500;
}

.lv1-dept-row.faded {
  opacity: 0.4;
}

.lv1-dept-name {
  color: var(--text2);
  flex: 1;
}

.lv1-dept-members {
  font-size: var(--fs-note);
  color: var(--text3);
  flex-shrink: 0;
}

#lv1-centers-list {
  padding-left: 7.5px;
}

.lv1-center-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 4px 10px;
  font-size: var(--fs-body-m);
  cursor: pointer;
  min-height: 30px;
  border-left: 2.5px solid var(--col-centers);
}

.lv1-center-row:hover {
  background: var(--s2);
}

.lv1-center-row.empty {
  opacity: 0.35;
  pointer-events: none;
}

.lv1-center-row.active {
  background: var(--s2);
}

.lv1-center-row.active .lv1-center-name {
  color: var(--text);
  font-weight: 500;
}

.lv1-center-row.faded {
  opacity: 0.4;
}

.lv1-center-name {
  font-size: var(--fs-sec);
  color: var(--text2);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lv1-center-members {
  font-size: var(--fs-note);
  color: var(--text3);
  flex-shrink: 0;
}

.lv1-advanced-toggle {
  font-size: var(--fs-note);
  color: var(--text3);
  font-weight: 600;
  letter-spacing: .05em;
  cursor: pointer;
  margin-top: 10px;
  margin-bottom: 6px;
  min-height: 32px;
  display: flex;
  align-items: center;
}

/* ── LeftV2 — Unit Collaboration ────────────────────────────────────────── */
/* Used by: left/left_v2.js */
.lv2-section {
  padding: 0;
}

.lv2-switcher {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 2px;
}

.lv2-switcher .vs-btn {
  width: 100%;
  height: 30px;
  text-align: left;
  padding: 0 10px;
  font-size: var(--fs-body-m);
}

.lv2-sos-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.lv2-sos-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lv2-sos-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.lv2-sos-label {
  font-size: var(--fs-body-m);
  color: var(--text2);
  font-weight: 600;
  flex-shrink: 0;
}

.lv2-sos-desc {
  font-size: var(--fs-body-m);
  color: var(--text3);
}

.lv2-hint-box {
  font-size: var(--fs-body-m);
  color: var(--text3);
  line-height: 1.7;
  padding: 8px;
  background: var(--s2);
  border-radius: 5px;
}

.lv2-hint-row {
  margin-bottom: 2px;
}

.lv2-hint-key {
  color: var(--text2);
  font-weight: 600;
}

/* ── LeftV3 — Scholar Profile ego panel ─────────────────────────────────── */
/* Used by: left/left_v3.js */
.lv3-empty {
  padding: 0;
}

.lv3-empty-text {
  font-size: var(--fs-body);
  color: var(--text3);
  line-height: 1.6;
  margin-top: 8px;
}

.lv3-profile {}

.lv3-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.lv3-name-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.lv3-name {
  font-size: var(--fs-h2);
  font-weight: 600;
  font-family: var(--f-serif);
  color: var(--text);
  line-height: 1.3;
}

.lv3-role {
  font-size: var(--fs-body);
  color: var(--text3);
  margin-bottom: 5px;
}

.lv3-bridge {
  margin-bottom: 8px;
}

.lv3-affil {
  margin-bottom: 10px;
}

.lv3-center-affil {
  color: var(--gold);
}

.lv3-metrics {
  margin-bottom: 12px;
}

.lv3-small-val {
  font-size: var(--fs-h3) !important;
}

.lv3-hop-section {
  margin-bottom: 10px;
}

.lv3-filter-label {
  font-size: var(--fs-note);
  color: var(--text3);
  font-weight: 600;
  letter-spacing: .05em;
  margin-bottom: 5px;
}

.lv3-collabs-header {
  font-size: var(--fs-note);
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--text3);
  margin-bottom: 5px;
}

.lv3-collabs-list {
  overflow-y: auto;
  max-height: 200px;
}

.lv3-collab-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 2px;
  cursor: pointer;
  border-bottom: 1px solid var(--border2);
  min-height: 36px;
  /* touch target */
}

.lv3-collab-row:hover {
  background: var(--s2);
}

.lv3-collab-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.lv3-collab-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.lv3-collab-name {
  font-size: var(--fs-body-m);
  color: var(--text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lv3-collab-weight {
  font-size: var(--fs-body-m);
  color: var(--text3);
  flex-shrink: 0;
}

/* ── Drawer — shared layout ─────────────────────────────────────────────── */
/* Used by: drawer/drawer_v1.js, drawer_v2.js, drawer_v3.js */
.dv1-stat-row {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.dv1-stat-card {
  flex: 1;
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  min-width: 0;
}

.dv1-stat-label {
  font-size: var(--fs-body);
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--text3);
  margin-bottom: 3px;
}

.dv1-stat-value {
  font-size: var(--fs-h1);
  font-weight: 600;
  color: var(--red);
  line-height: 1.2;
}

.dv1-stat-sub {
  font-size: var(--fs-body);
  color: var(--text3);
  margin-top: 2px;
}

.dv3-empty {
  padding: 20px;
  text-align: center;
}

.dv3-empty-text {
  font-size: var(--fs-body);
  color: var(--text3);
}

/* ── View-switcher v2/v3 (in-canvas buttons) ────────────────────────────── */
/* Used by: index.html canvas overlays */
#view-switcher-v1,
#view-switcher-v2,
#view-switcher-v3 {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Right panel: per-view container switching ──────────────────────────── */
/* Used by: index.html #panel-right, Panels._updateRight */
.rp-view {
  display: none;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.rp-view.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#rv-bridging-card {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  min-height: 0;
}

/* dv3-scholar-name: truncating name in drawer stat card
   Used by: drawer/drawer_v3.js stat row */
.dv3-scholar-name {
  font-size: var(--fs-body-m);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dv1-layout,
.dv2-layout,
.dv3-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 10px 16px 8px;
}

/* Handle bar chevron transition */
#univ-drawer-btn svg {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

/* Snap button active state */
#drawer-btn-max.is-active {
  background: var(--red-s);
  color: var(--red);
  border-color: var(--red-m);
}

/* ── Drawer layout continued ─────────────────────────────────────────────── */
/* Chart row fills remaining height */
.dv1-charts-row {
  flex: 1 1 0;
  min-height: 80px;
  gap: 14px;
}

/* Chart block: flex column, SVG fills it */
.dv1-chart-block {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
}

.dv1-chart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text3);
  letter-spacing: .05em;
  margin-bottom: 4px;
  flex-shrink: 0;
  padding-bottom: 4px;
}

/* Wider chart gets 2x flex */
.dv1-chart-wide {
  flex: 2.2 1 0;
}

/* SVG fills all available height in chart block */
.dv1-chart-svg {
  flex: 1 1 0;
  min-height: 80px;
  overflow: visible;
}

#drawer-resize-handle:hover #drawer-grip span {
  background: var(--text3);
}

.dq-warn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--gold);
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  flex-shrink: 0;
  font-style: normal;
  text-transform: none;
  vertical-align: middle;
  margin-left: 4px;
}

/* ── Responsive: laptop screens (≤ 1470px — MacBook Air / laptop class) ──── */
/* Desktop/external monitors (> 1470px) use the :root defaults above.          */
/* Minimum supported viewport: 1280 × 740 px                                   */
@media (max-width: 1470px) {
  :root {
    --hh: 48px;
    --pl: clamp(200px, 17vw, 250px);
    --pr: clamp(200px, 17vw, 250px);

    /* Typography — scaled down ~1–2 px per step for laptop density */
    --fs-h0:     20px;
    --fs-name:   18px;
    --fs-metric: 16px;
    --fs-h1:     14px;
    --fs-h2:     13px;
    --fs-sec:    12px;
    --fs-h3:     11px;
    --fs-body:   11px;
    --fs-body-m: 10px;
    --fs-body-s:  9px;
    --fs-note:    8px;
    --fs-note-s:  7px;
    --fs-icon:   13px;
  }

  #canvas-search {
    width: 360px;
  }

  #hd-search {
    border-width: 1px;
  }

  #search-overlay {
    width: 360px;
  }

  #hd-brand {
    min-width: 240px;
  }

  /* Hide feedback link text — icon is enough at this width */
  #hd-feedback {
    display: none;
  }

  .nav-tab {
    padding: 0 6px;
  }

  #data-stats b {
    font-size: var(--fs-body-m);
  }

  #data-stats {
    font-size: var(--fs-body-m);
    line-height: 0.8;
  }

  /* Remove right constraint on data-overview at narrower canvas widths */
  #data-overview {
    right: auto;
    max-width: 280px;
  }

  /* ── Panel spacing — more compact on laptop screens ── */
  #left-content {
    padding: 10px 10px 12px;
    gap: 6px;
  }

  .sec-header {
    padding-bottom: 4px;
    margin-bottom: 5px;
  }

  .lv1-filter-group {
    margin-bottom: 10px;
  }

  #right-card {
    padding: 10px 11px;
  }

  .rp-section-label {
    margin: 7px 0 4px;
  }

  .slider-row {
    margin-bottom: 6px;
  }

  .slider-label-row {
    margin-bottom: 2px;
  }

  .crs-wrap {
    height: 16px;
    margin: 2px 6px;
  }

  .crs-handle {
    width: 13px;
    height: 13px;
  }

  .lv1-college-row {
    min-height: 24px;
  }

  .lv1-dept-row {
    min-height: 24px;
    padding: 2px 4px 2px 10px;
  }

  .lv1-center-row {
    min-height: 24px;
    padding: 2px 4px 2px 10px;
  }

  .btn-group-break {
    margin-top: -4px;
  }

  .btn-group-track {
    row-gap: 6px;
  }

  .lv1-units-section {
    margin-bottom: 3px;
  }

  .lv1-units-header {
    padding: 3px 4px 2px;
  }
}

/* ── Touch: enlarge interactive targets on touch devices ────────────────── */
@media (pointer: coarse) {
  .filter-btn,
  .vc-btn,
  .cb-btn,
  .vs-btn,
  .sec-reset {
    min-height: 36px;
    padding: 6px 10px;
  }

  .lv1-college-row,
  .lv1-dept-row,
  .lv1-center-row {
    min-height: 40px;
  }

  .lv3-collab-row {
    min-height: 40px;
  }

  input[type="range"] {
    height: 28px;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
 * Overview view  (view_overview.js)
 * ══════════════════════════════════════════════════════════════════════════ */

/* Scroll container is set in index.html on #overview-content */

.ov-wrap {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ── Hero ── */
.ov-hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 52px 40px 48px;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.ov-hero-inner {
  max-width: 620px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ov-label {
  font-size: var(--fs-note);
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--red);
  margin-bottom: 10px;
  text-transform: uppercase;
}

.ov-title {
  font-family: var(--f-serif);
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.015em;
  line-height: 1.25;
  margin-bottom: 14px;
}

.ov-desc {
  font-size: var(--fs-sec);
  color: var(--text2);
  line-height: 1.75;
  max-width: 480px;
  margin-bottom: 28px;
}

.ov-stats {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
}

.ov-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.ov-stat-n {
  font-size: var(--fs-h1);
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.ov-stat-l {
  font-size: var(--fs-body-m);
  color: var(--text3);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.ov-stat-sep {
  width: 1px;
  height: 28px;
  background: var(--border);
}

.ov-cta-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ov-cta-btn {
  background: var(--red);
  color: #fff;
  border: none;
  padding: 10px 28px;
  font-family: var(--f-sans);
  font-size: var(--fs-h2);
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity .15s;
}

.ov-cta-btn:hover {
  opacity: .78;
}

.ov-cta-hint {
  font-size: var(--fs-body);
  color: var(--text3);
}

/* ── Generic section ── */
.ov-section {
  padding: 40px 40px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.ov-sec-label {
  font-size: var(--fs-note);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 6px;
}

.ov-sec-intro {
  font-size: var(--fs-sec);
  color: var(--text2);
  line-height: 1.7;
  margin-bottom: 20px;
  max-width: 640px;
}

/* ── Scroll reveal ── */
.ov-reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .55s ease, transform .55s ease;
}

.ov-reveal.ov-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ── Encoding guide cards ── */
.ov-enc-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.ov-enc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: box-shadow .15s;
}

.ov-enc-card:hover {
  box-shadow: 0 2px 12px rgba(20,24,32,.06);
}

.ov-enc-vis {
  flex-shrink: 0;
  width: 100px;
  height: 72px;
  background: var(--bg);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ov-enc-body {
  flex: 1;
  min-width: 0;
}

.ov-enc-rule {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
  flex-wrap: wrap;
}

.ov-enc-channel {
  font-size: var(--fs-h3);
  font-weight: 700;
  color: var(--text);
}

.ov-enc-arrow {
  font-size: var(--fs-body);
  color: var(--text3);
}

.ov-enc-meaning {
  font-size: var(--fs-h3);
  color: var(--text2);
}

.ov-enc-desc {
  font-size: var(--fs-body);
  color: var(--text3);
  line-height: 1.65;
}

/* ── Interaction walkthrough ── */
.ov-section--walk {
  border-top: 1px solid var(--border2);
}

.ov-walk-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ov-walk-step {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  padding: 18px 0;
  border-bottom: 1px solid var(--border2);
}

.ov-walk-step:last-child {
  border-bottom: none;
}

.ov-walk-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--red-s);
  border: 1.5px solid var(--red-m);
  color: var(--red);
  font-size: var(--fs-body);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.ov-walk-body {
  flex: 1;
}

.ov-walk-title {
  font-size: var(--fs-sec);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
}

.ov-walk-desc {
  font-size: var(--fs-body);
  color: var(--text3);
  line-height: 1.65;
}

/* ── View navigation cards ── */
.ov-section--views {
  border-top: 1px solid var(--border2);
}

.ov-view-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.ov-view-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 16px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.ov-view-card:hover {
  border-color: var(--red);
  box-shadow: 0 2px 12px rgba(200,16,46,.07);
}

.ov-view-icon {
  opacity: .85;
  margin-bottom: 4px;
}

.ov-view-name {
  font-size: var(--fs-h2);
  font-weight: 700;
  color: var(--text);
}

.ov-view-desc {
  font-size: var(--fs-body);
  color: var(--text3);
  line-height: 1.65;
  flex: 1;
}

.ov-view-cta {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--red);
  margin-top: 8px;
}

/* ── Footer ── */
.ov-footer {
  padding: 24px 40px;
  border-top: 1px solid var(--border2);
  text-align: center;
}

.ov-footer-note {
  font-size: var(--fs-body);
  color: var(--text3);
}

/* ══════════════════════════════════════════════════════════════════════════
 * Methods view  (view_methods.js)
 * ══════════════════════════════════════════════════════════════════════════ */

.mth-wrap {
  min-height: 100%;
  background: var(--bg);
  display: flex;
  justify-content: center;
}

.mth-inner {
  max-width: 760px;
  width: 100%;
  padding: 48px 40px 60px;
  box-sizing: border-box;
}

/* Header */
.mth-header {
  margin-bottom: 40px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.mth-title {
  font-family: var(--f-serif);
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.015em;
  margin: 8px 0 10px;
}

.mth-subtitle {
  font-size: var(--fs-h3);
  color: var(--text2);
  line-height: 1.75;
  max-width: 580px;
}

/* Section */
.mth-section {
  margin-bottom: 36px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--border2);
}

.mth-section:last-of-type {
  border-bottom: none;
}

.mth-section--highlight {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px 24px;
  margin-bottom: 36px;
}

.mth-section--highlight .mth-sec-head {
  margin-bottom: 14px;
}

.mth-sec-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.mth-sec-num {
  font-size: var(--fs-note);
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--red);
  background: var(--red-s);
  border: 1px solid var(--red-m);
  border-radius: 4px;
  padding: 2px 7px;
  flex-shrink: 0;
}

.mth-sec-title {
  font-family: var(--f-serif);
  font-size: var(--fs-h1);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.01em;
}

.mth-text {
  font-size: var(--fs-sec);
  color: var(--text2);
  line-height: 1.8;
  margin-bottom: 12px;
}

.mth-text:last-child {
  margin-bottom: 0;
}

/* Data source chips */
.mth-chip-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.mth-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 4px 10px;
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--text2);
}

/* Formula block */
.mth-formula-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 18px 20px;
  margin: 18px 0;
}

.mth-formula-label {
  font-size: var(--fs-note);
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--text3);
  margin-bottom: 12px;
  text-transform: uppercase;
}

.mth-formula-eq {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: var(--fs-h2);
  font-weight: 500;
  color: var(--text);
  margin-bottom: 16px;
}

.mth-eq-op {
  color: var(--text3);
  font-weight: 400;
}

.mth-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.mth-frac-n,
.mth-frac-d {
  font-size: var(--fs-body-m);
  color: var(--text2);
  white-space: nowrap;
  padding: 0 4px;
}

.mth-frac-n {
  border-bottom: 1.5px solid var(--text2);
  padding-bottom: 3px;
}

.mth-eq-log {
  font-size: var(--fs-h2);
  color: var(--text);
}

/* Formula decomposition */
.mth-formula-decomp {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border2);
}

.mth-decomp-item {
  flex: 1;
}

.mth-decomp-label {
  font-size: var(--fs-body);
  font-weight: 700;
  color: var(--text2);
  margin-bottom: 3px;
}

.mth-decomp-desc {
  font-size: var(--fs-body);
  color: var(--text3);
  line-height: 1.6;
}

.mth-decomp-x {
  flex-shrink: 0;
  font-size: var(--fs-h2);
  color: var(--text3);
  padding-top: 2px;
}

/* Bridge tier block */
.mth-tier-block {
  margin-top: 20px;
}

.mth-tier-label-row {
  font-size: var(--fs-note);
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--text3);
  margin-bottom: 10px;
  text-transform: uppercase;
}

.mth-tier-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mth-tier-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}

.mth-tier-text {
  flex: 1;
}

.mth-tier-name {
  font-size: var(--fs-body);
  font-weight: 700;
  color: var(--gold);
}

.mth-tier-desc {
  font-size: var(--fs-body);
  color: var(--text3);
}

/* Encoding rows */
.mth-sec-body {
  margin-top: 0;
}

.mth-enc-row {
  display: flex;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border2);
  align-items: flex-start;
}

.mth-enc-row:last-child {
  border-bottom: none;
}

.mth-enc-label {
  flex-shrink: 0;
  width: 110px;
  font-size: var(--fs-body-m);
  font-weight: 700;
  color: var(--text2);
  padding-top: 1px;
}

.mth-enc-text {
  flex: 1;
  font-size: var(--fs-body);
  color: var(--text3);
  line-height: 1.7;
}

/* ── Back to top floating button (shared by overview + methods) ── */
.scroll-top-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 38px;
  height: 38px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(20,24,32,.10);
  color: var(--text3);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .22s ease, transform .22s ease, color .12s, border-color .12s;
  z-index: 50;
}

.scroll-top-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.scroll-top-btn:hover {
  color: var(--red);
  border-color: var(--red);
}

/* Methods footer */
.mth-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
  gap: 16px;
  flex-wrap: wrap;
}

.mth-footer-note {
  font-size: var(--fs-body);
  color: var(--text3);
}

.mth-footer-btn {
  background: var(--red-s);
  border: 1.5px solid var(--red);
  color: var(--red);
  padding: 8px 20px;
  font-family: var(--f-sans);
  font-size: var(--fs-h3);
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.mth-footer-btn:hover {
  background: var(--red);
  color: #fff;
}