:root {
  color-scheme: light;
  --font-sans: "BuckeyeSans", "HelveticaNeue", "Helvetica", "Arial", sans-serif;
  --font-serif: "BuckeyeSerif", "Georgia", serif;
  --scarlet: #ba0c2f;
  --scarlet-dark-40: #70071c;
  --scarlet-dark-60: #4a0513;
  --gray: #a7b1b7;
  --gray-light-20: #bfc6cb;
  --gray-light-40: #cfd4d8;
  --gray-light-60: #dfe3e5;
  --gray-light-80: #eff1f2;
  --gray-light-90: #f6f7f8;
  --gray-dark-20: #868e92;
  --gray-dark-40: #646a6e;
  --gray-dark-60: #3f4443;
  --gray-dark-80: #212325;
  --shared: #00707a;
  --white: #ffffff;
  --ink: var(--gray-dark-80);
  --muted: var(--gray-dark-40);
  --line: var(--gray-light-40);
  --soft: var(--gray-light-90);
  --paper: var(--white);
  --shadow: 0 8px 28px rgba(33, 35, 37, 0.08);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--soft);
  font-family: var(--font-sans);
}

button,
input {
  font: inherit;
}

button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
}

button:hover,
button:focus-visible {
  border-color: var(--scarlet);
  outline: none;
}

button:disabled {
  color: var(--muted);
  background: var(--gray-light-90);
  cursor: default;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.top-actions {
  display: grid;
  gap: 7px;
  justify-items: end;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.view-tabs {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
}

.view-tabs button {
  min-height: 32px;
  padding: 0 10px;
  color: var(--gray-dark-60);
  font-size: 0.78rem;
  font-weight: 800;
}

.view-tabs button[aria-pressed="true"] {
  border-color: var(--scarlet);
  color: var(--scarlet-dark-40);
  background: var(--gray-light-90);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--scarlet);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
}

h2 {
  font-size: 0.98rem;
  font-weight: 700;
}

.source-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.source-row a {
  color: var(--scarlet-dark-40);
  text-decoration: none;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-right: 1px solid var(--line);
  background: var(--gray-light-80);
  min-height: 0;
  overflow: hidden;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.detail-drawer {
  min-width: 0;
  min-height: 0;
  padding: 0;
}

.detail-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.detail-panel > .panel-heading {
  position: sticky;
  top: 0;
  z-index: 4;
  padding-bottom: 8px;
  background: var(--paper);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.detail-actions button {
  min-height: 30px;
  padding: 4px 8px;
  color: var(--scarlet-dark-40);
  font-size: 0.74rem;
  font-weight: 800;
}

.mobile-detail-close {
  display: none;
}

.panel,
.graph-panel,
.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.panel {
  padding: 14px;
}

.panel-heading,
.graph-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.area-label {
  margin-top: 12px;
}

.area-menu {
  position: relative;
}

.area-menu-button {
  width: 100%;
  min-height: 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 10px;
  gap: 9px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--scarlet);
  border-radius: 7px;
  color: var(--ink);
  background: var(--white);
  font-weight: 700;
  text-align: left;
}

.area-menu-button::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--scarlet);
}

.area-menu-button[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

.area-menu-button:hover,
.area-menu-button:focus-visible {
  border-color: var(--scarlet);
  outline: none;
}

.area-menu-current {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.area-menu-count {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.area-menu-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 5;
  max-height: min(48vh, 370px);
  padding: 5px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  box-shadow: 0 14px 34px rgba(33, 35, 37, 0.18);
}

.area-menu-option {
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  text-align: left;
}

.area-menu-option:hover,
.area-menu-option:focus-visible,
.area-menu-option.is-selected {
  background: var(--gray-light-90);
}

.area-menu-option.is-selected {
  color: var(--scarlet-dark-40);
}

.area-menu-option-name {
  overflow-wrap: anywhere;
  font-weight: 700;
  line-height: 1.18;
}

.area-menu-option-count {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.area-summary {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.3;
}

.faculty-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.faculty-compare-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-style: italic;
  line-height: 1.3;
}

.mini-actions {
  display: flex;
  gap: 6px;
}

.mini-actions button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.text-button {
  min-height: 30px;
  padding: 0 9px;
  color: var(--scarlet-dark-40);
  font-size: 0.78rem;
  font-weight: 800;
}

.field-label {
  display: block;
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.search-input {
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
}

.search-input:focus {
  border-color: var(--scarlet);
  outline: none;
}

.faculty-list {
  display: grid;
  flex: 1 1 auto;
  gap: 7px;
  margin-top: 12px;
  min-height: 0;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
}

.faculty-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--gray-light-90);
}

.faculty-item:focus-within {
  border-color: var(--scarlet);
}

.faculty-item input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--scarlet);
}

.faculty-name {
  display: block;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
  font-weight: 700;
}

.faculty-name-link,
.chain-faculty-link {
  color: var(--scarlet-dark-40);
  text-decoration: none;
}

button.chain-faculty-link {
  display: inline;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-weight: 800;
}

.faculty-name-link:hover,
.faculty-name-link:focus-visible,
.chain-faculty-link:hover,
.chain-faculty-link:focus-visible {
  text-decoration: underline;
  outline: none;
}

.faculty-title {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.faculty-areas {
  display: block;
  margin-top: 4px;
  color: var(--gray-dark-60);
  font-size: 0.72rem;
  line-height: 1.25;
}

.faculty-select-spacer {
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

.metrics {
  display: none;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
}

.metric {
  min-height: 76px;
  padding: 12px;
}

.metric .label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.metric .value {
  margin-top: 5px;
  font-size: 1.55rem;
  font-weight: 800;
}

.metric:nth-child(2) .value {
  color: var(--gray-dark-60);
}

.metric:nth-child(3) .value {
  color: var(--scarlet-dark-40);
}

.metric:nth-child(4) .value {
  color: var(--gray-dark-40);
}

.graph-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px;
  overflow: hidden;
}

.graph-toolbar {
  align-items: flex-start;
  margin-bottom: 10px;
  position: relative;
}

.graph-toolbar > div:first-child {
  min-width: 0;
}

#graphSubtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.question-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.question-strip[hidden] {
  display: none;
}

.question-strip button {
  display: grid;
  gap: 3px;
  min-height: 56px;
  padding: 8px 10px;
  text-align: left;
}

.question-strip strong {
  color: var(--scarlet-dark-40);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.question-strip span {
  overflow: hidden;
  color: var(--gray-dark-60);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graph-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.graph-breadcrumbs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 9px;
  color: var(--scarlet-dark-40);
  font-size: 0.78rem;
  font-weight: 800;
}

.graph-breadcrumbs button:disabled {
  color: var(--gray-dark-60);
  cursor: default;
}

.graph-breadcrumbs span {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.graph-search {
  position: relative;
  flex: 0 1 440px;
  width: min(440px, 44vw);
}

.graph-ancestor-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.graph-ancestor-presets[hidden] {
  display: none;
}

.graph-preset {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 3px 8px;
  border-color: var(--gray-light-40);
  background: var(--gray-light-90);
  color: var(--gray-dark-60);
  font-size: 0.74rem;
  font-weight: 800;
}

.graph-preset.is-active {
  border-color: var(--scarlet);
  background: var(--white);
  color: var(--scarlet-dark-40);
}

.graph-preset small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.graph-search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 6;
  display: grid;
  gap: 4px;
  max-height: 310px;
  padding: 6px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  box-shadow: 0 14px 34px rgba(33, 35, 37, 0.18);
}

.graph-search-results[hidden] {
  display: none;
}

.graph-search-results button {
  display: grid;
  gap: 2px;
  min-height: 42px;
  padding: 7px 9px;
  border: 0;
  border-radius: 5px;
  text-align: left;
}

.graph-search-results button:hover,
.graph-search-results button:focus-visible,
.graph-search-results button[aria-selected="true"] {
  background: var(--gray-light-90);
}

.graph-search-results strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graph-search-results span,
.graph-search-results small,
.graph-search-empty {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.25;
}

.graph-search-results small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graph-search-empty {
  padding: 8px;
}

.selection-chips {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 7px;
  margin: 0 0 10px;
  padding: 7px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--gray-light-90);
  scrollbar-width: thin;
}

.selection-chips[hidden] {
  display: none;
}

.selection-chip-label,
.selection-chip-extra {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.selection-chip-extra {
  min-height: 28px;
  padding: 3px 8px;
  border-color: var(--gray-light-40);
  background: var(--white);
  color: var(--scarlet-dark-40);
}

.selection-chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  max-width: 210px;
  min-height: 28px;
  padding: 3px 8px;
  border-color: var(--gray-light-40);
  background: var(--white);
  color: var(--gray-dark-60);
  font-size: 0.76rem;
  font-weight: 700;
}

.selection-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-chip strong {
  color: var(--scarlet-dark-40);
  font-size: 0.88rem;
  line-height: 1;
}

.selection-chip-action {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 3px 8px;
  color: var(--scarlet-dark-40);
  font-size: 0.74rem;
  font-weight: 800;
}

.canvas-wrap {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--gray-light-90);
  overflow: hidden;
}

.viewport-chip-stack {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: grid;
  gap: 6px;
  width: min(520px, calc(100% - 224px));
  max-height: 86px;
  overflow: visible;
  pointer-events: none;
}

.viewport-chip-stack > * {
  pointer-events: auto;
}

.loading-state {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  color: var(--gray-dark-60);
  background: var(--gray-light-90);
  font-weight: 800;
}

.loading-state[hidden] {
  display: none;
}

#graphCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: pan-y;
}

#graphCanvas.dragging {
  cursor: grabbing;
}

.overview-canvas {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 1;
  width: 168px;
  height: 112px;
  border: 1px solid rgba(207, 212, 216, 0.95);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 18px rgba(33, 35, 37, 0.12);
  cursor: pointer;
}

.graph-tooltip {
  position: absolute;
  z-index: 2;
  max-width: 260px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  font-size: 0.82rem;
  pointer-events: none;
}

.graph-tooltip strong {
  display: block;
  margin-bottom: 2px;
}

.graph-tooltip span {
  color: var(--muted);
}

.graph-selection-card {
  position: absolute;
  left: 12px;
  top: 58px;
  z-index: 4;
  width: min(340px, calc(100% - 204px));
  padding: 11px;
  border: 1px solid rgba(186, 12, 47, 0.34);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 26px rgba(33, 35, 37, 0.14);
}

.graph-selection-card[hidden] {
  display: none;
}

.graph-density-note {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 1;
  max-width: min(460px, calc(100% - 220px));
  padding: 7px 9px;
  border: 1px solid rgba(207, 212, 216, 0.95);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--gray-dark-60);
  font-size: 0.74rem;
  font-weight: 700;
}

.graph-density-note[hidden] {
  display: none;
}

.graph-gesture-hint {
  display: none;
}

.floating-zoom-controls {
  position: absolute;
  right: 12px;
  top: 50%;
  z-index: 3;
  display: grid;
  gap: 6px;
  width: 58px;
  padding: 6px;
  border: 1px solid rgba(207, 212, 216, 0.95);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 24px rgba(33, 35, 37, 0.14);
  transform: translateY(-50%);
}

.floating-zoom-controls button {
  width: 44px;
  min-height: 34px;
  padding: 0 4px;
  color: var(--scarlet-dark-40);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
}

.selection-card-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.selection-card-heading strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.2;
}

.selection-card-heading button {
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 800;
}

.selection-card-meta,
.selection-card-stats,
.selection-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.selection-card-meta,
.selection-card-stats {
  color: var(--muted);
  font-size: 0.76rem;
}

.selection-card-meta a {
  color: var(--scarlet-dark-40);
  text-decoration: none;
}

.selection-card-stats span {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--gray-light-90);
  color: var(--gray-dark-60);
}

.selection-card-actions button {
  min-height: 30px;
  padding: 0 9px;
  color: var(--scarlet-dark-40);
  font-size: 0.76rem;
  font-weight: 800;
}

.selection-card-actions button:disabled {
  color: var(--muted);
  cursor: default;
}

.graph-legend {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  max-width: min(420px, calc(100% - 24px));
  padding: 7px 9px;
  border: 1px solid rgba(207, 212, 216, 0.95);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.graph-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.faculty-dot {
  background: var(--scarlet);
}

.shared-dot {
  background: var(--shared);
}

.ancestor-dot {
  background: var(--gray-dark-20);
}

.table-panel,
.detail-panel {
  min-height: 310px;
}

.shared-ancestor-panel {
  min-height: 0;
  margin-top: 12px;
  padding: 0;
}

.shared-answer-callout {
  margin-top: 8px;
}

.shared-ancestor-panel[open] {
  padding: 0;
}

.shared-ancestor-panel > summary {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--gray-light-90);
  box-shadow: var(--shadow);
}

.shared-ancestor-panel[open] > summary {
  border: 1px solid var(--line);
  background: var(--gray-light-90);
  box-shadow: var(--shadow);
}

.shared-ancestor-panel:not([open]) {
  box-shadow: none;
}

.shared-ancestor-panel:not([open]) > summary {
  box-shadow: var(--shadow);
}

.shared-ancestor-panel[open] > summary small {
  display: none;
}

.table-wrap {
  margin: 10px -2px 0;
  max-height: clamp(220px, 34vh, 380px);
  overflow-x: hidden;
  overflow-y: auto;
}

.table-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.86rem;
}

th:first-child,
td:first-child {
  width: auto;
}

th:nth-child(2),
td:nth-child(2) {
  width: 68px;
}

#ancestorMatchedHeader {
  white-space: normal;
}

th,
td {
  box-sizing: border-box;
  padding: 8px 7px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: var(--paper);
  font-size: 0.76rem;
  line-height: 1.18;
  text-transform: uppercase;
}

td.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#ancestorRows tr:hover,
#ancestorRows tr:focus-within {
  background: var(--gray-light-90);
}

.table-person-button {
  display: inline;
  display: -webkit-box;
  width: 100%;
  max-width: 100%;
  max-height: 2.7em;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  border: 0;
  color: var(--scarlet-dark-40);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
  text-align: left;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.table-person-button:hover,
.table-person-button:focus-visible {
  text-decoration: underline;
}

td a,
.node-detail a {
  color: var(--scarlet-dark-40);
  text-decoration: none;
}

.summary-panel {
  min-width: 0;
  margin-top: 12px;
}

.answer-callout {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(186, 12, 47, 0.28);
  border-left: 4px solid var(--scarlet);
  border-radius: 7px;
  background: var(--white);
}

.answer-callout strong {
  color: var(--ink);
  font-size: 0.94rem;
  line-height: 1.25;
}

.answer-callout span {
  color: var(--gray-dark-60);
  font-size: 0.8rem;
  line-height: 1.3;
}

.detail-section,
.shared-ancestor-panel {
  overflow: hidden;
}

.detail-section:not([open]),
.shared-ancestor-panel:not([open]) {
  min-height: 45px;
  overflow: visible;
}

.detail-section summary,
.shared-ancestor-panel summary,
.relationship-more-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--gray-light-90);
  list-style: none;
}

.detail-section summary,
.shared-ancestor-panel summary {
  cursor: pointer;
}

.relationship-more-header {
  cursor: pointer;
}

.detail-section summary::-webkit-details-marker,
.shared-ancestor-panel summary::-webkit-details-marker,
.relationship-more-header::-webkit-details-marker {
  display: none;
}

.detail-section summary span:first-child,
.relationship-more-header span:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.shared-summary-copy {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.shared-ancestor-panel summary:has(.shared-answer-callout:not([hidden])) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
}

.shared-ancestor-panel summary:has(.shared-answer-callout:not([hidden])) .shared-answer-callout {
  grid-column: 1 / -1;
}

.detail-section summary strong,
.shared-ancestor-panel summary strong,
.relationship-more-header strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.detail-section summary small,
.shared-ancestor-panel summary small,
.relationship-more-header small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.18;
  overflow-wrap: anywhere;
  white-space: normal;
}

.relationship-more-header small {
  overflow: visible;
  overflow-wrap: anywhere;
  line-height: 1.2;
  text-overflow: clip;
  white-space: normal;
}

.relationship-via-button {
  display: inline;
  font: inherit;
  font-weight: 700;
  overflow-wrap: anywhere;
  vertical-align: baseline;
}

.summary-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid rgba(186, 12, 47, 0.24);
  border-radius: 6px;
  color: var(--scarlet-dark-40);
  background: var(--white);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.shared-ancestor-panel summary {
  cursor: default;
}

.shared-ancestor-panel .summary-toggle {
  cursor: pointer;
}

details[open] > summary .summary-toggle {
  border-color: var(--line);
  color: var(--gray-dark-60);
  background: var(--gray-light-80);
}

details[open] > summary .summary-toggle::before {
  margin-right: 0.25em;
  content: "Hide";
}

details:not([open]) > summary .summary-toggle::before {
  margin-right: 0.25em;
  content: "Show";
}

.summary-section .summary-grid,
.chain-section .chain-list,
.chain-section .chain-empty,
.relationship-more > p,
.relationship-more .relationship-stats,
.relationship-more .relationship-paths,
.relationship-more .relationship-actions,
.shared-ancestor-panel .table-note,
.shared-ancestor-panel .table-answer-callout,
.shared-ancestor-panel .table-wrap {
  margin-top: 10px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.summary-card {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--scarlet);
  border-radius: 7px;
  background: var(--gray-light-90);
}

.summary-card span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-card strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.18;
}

.summary-card a {
  color: var(--scarlet-dark-40);
  text-decoration: none;
}

.summary-link-list {
  display: grid;
  gap: 4px;
  justify-items: start;
}

.summary-link-list a {
  display: inline-block;
}

.summary-card a:hover,
.summary-card a:focus-visible {
  text-decoration: underline;
  outline: none;
}

.summary-inline-button {
  min-height: 30px;
  padding: 4px 8px;
  color: var(--scarlet-dark-40);
  font-size: 0.78rem;
  font-weight: 800;
}

.summary-link-button {
  display: inline-flex;
  align-items: center;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--scarlet-dark-40);
  background: transparent;
  font-weight: 800;
  text-align: left;
  text-decoration: underline;
}

.summary-link-button:hover,
.summary-link-button:focus-visible {
  color: var(--scarlet);
  outline: none;
}

.summary-card em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
  line-height: 1.2;
}

.faculty-profile-section {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
}

.faculty-profile-section > summary {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 7px 7px 0 0;
  background: var(--paper);
}

.faculty-profile-section:not([open]) > summary {
  border-bottom: 0;
  border-radius: 7px;
}

.faculty-profile {
  display: grid;
  gap: 7px;
  padding: 10px 12px 12px;
  color: var(--gray-dark-60);
  font-size: 0.88rem;
  line-height: 1.35;
}

.faculty-profile p {
  margin: 0;
}

.faculty-profile strong {
  color: var(--ink);
  font-weight: 800;
}

.faculty-profile-links {
  display: grid;
  gap: 4px;
  margin-top: 2px;
  justify-items: start;
}

.faculty-profile-links a {
  color: var(--scarlet-dark-40);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
}

.faculty-profile-links a:hover,
.faculty-profile-links a:focus-visible {
  text-decoration: underline;
  outline: none;
}

.empty-details-body {
  display: grid;
  gap: 10px;
  padding: 10px 12px 12px;
  color: var(--gray-dark-60);
  font-size: 0.88rem;
  line-height: 1.35;
}

.empty-details-body p {
  margin: 0;
}

.empty-details-body .summary-inline-button {
  justify-self: start;
}

.node-detail {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.node-detail strong {
  color: var(--ink);
}

.node-detail-body {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.detail-name {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
}

.detail-descendant-block {
  display: grid;
  gap: 8px;
}

.detail-subhead {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.node-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.node-actions button {
  min-height: 32px;
  padding: 5px 9px;
  color: var(--scarlet-dark-40);
  font-size: 0.78rem;
  font-weight: 800;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-faculty-list-scroll {
  max-height: 138px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1px 3px 1px 0;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--gray-light-90);
  color: var(--gray-dark-60);
  font-size: 0.78rem;
  text-decoration: none;
}

button.tag {
  cursor: pointer;
}

.tag-action {
  color: var(--scarlet-dark-40);
  font-weight: 800;
}

a.tag:hover,
a.tag:focus-visible,
button.tag:hover,
button.tag:focus-visible {
  border-color: var(--scarlet);
  color: var(--scarlet-dark-40);
  outline: none;
}

.chain-panel {
  margin-top: 16px;
}

.relationship-panel {
  margin-top: 12px;
}

.relationship-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 11px;
  border: 1px solid rgba(186, 12, 47, 0.34);
  border-radius: 7px;
  background: var(--gray-light-90);
}

.relationship-card-primary {
  background: var(--white);
}

.relationship-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.relationship-kicker {
  color: var(--scarlet-dark-40);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.relationship-card strong {
  color: var(--ink);
  font-size: 0.96rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.relationship-card p,
.relationship-paths,
.relationship-stats {
  color: var(--gray-dark-60);
  font-size: 0.82rem;
  line-height: 1.35;
}

.relationship-card a {
  color: var(--scarlet-dark-40);
  text-decoration: none;
}

.relationship-card a:hover,
.relationship-card a:focus-visible {
  text-decoration: underline;
  outline: none;
}

.relationship-paths,
.relationship-stats {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.relationship-stats {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.relationship-paths strong {
  color: var(--gray-dark-80);
  font-weight: 700;
}

.relationship-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.relationship-actions button {
  min-height: 32px;
  padding: 5px 9px;
  color: var(--scarlet-dark-40);
  font-size: 0.78rem;
  font-weight: 800;
}

.chain-heading {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
}

.chain-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  max-height: clamp(220px, 34vh, 380px);
  overflow-y: auto;
  padding-right: 3px;
}

.chain-filter {
  display: grid;
  gap: 5px;
  margin-top: 10px;
}

.chain-filter span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.chain-status {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.chain-card {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
}

.chain-card[hidden] {
  display: none;
}

.chain-card div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.chain-card strong {
  font-weight: 700;
}

.chain-card span,
.chain-empty {
  color: var(--muted);
  font-size: 0.78rem;
}

.chain-path {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.chain-empty {
  margin-top: 6px;
  line-height: 1.35;
}

.lineage-answer-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(0, 113, 124, 0.34);
  border-radius: 7px;
  background: var(--white);
}

.lineage-answer-note {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.lineage-answer-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.lineage-answer-heading span {
  min-width: 0;
  color: var(--gray-dark-60);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.lineage-answer-heading strong {
  color: var(--scarlet-dark-40);
  font-size: 0.78rem;
  white-space: nowrap;
}

.lineage-answer-path {
  margin: 0;
  color: var(--gray-dark-60);
  font-size: 0.8rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.data-footnote {
  position: relative;
  max-width: 100%;
  padding: 0 2px max(14px, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.3;
}

.snapshot-line {
  padding: 2px 0;
}

.empty {
  padding: 12px 0;
  color: var(--muted);
}

.load-error {
  max-width: 720px;
  margin: 16vh auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.load-error p {
  margin-top: 8px;
  color: var(--muted);
}

.detail-backdrop {
  display: none;
}

@media (min-width: 981px) {
  .sidebar {
    margin: 16px 0 16px 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    box-shadow: var(--shadow);
  }

  .sidebar > .panel {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .sidebar > .panel + .panel {
    margin-top: 14px;
  }

  .workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
  }

  .metrics {
    display: none;
  }

  .data-footnote {
    display: none;
  }

  .graph-panel {
    grid-column: 1;
    height: 100%;
  }

  .detail-drawer {
    grid-column: 2;
    height: 100%;
  }

  .detail-panel {
    height: 100%;
  }

}

@media (max-width: 1220px) {
  .graph-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .graph-search {
    flex: 0 0 auto;
    width: 100%;
  }

}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .detail-drawer {
    padding: 0;
  }

  .metrics {
    grid-template-columns: 1fr 1fr;
  }

}

@media (max-width: 980px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }

  .topbar {
    position: relative;
    z-index: 10;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
  }

  .top-actions {
    display: none;
    justify-items: start;
  }

  .view-tabs {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    min-width: 0;
    overflow: hidden;
  }

  .view-tabs button {
    min-width: 0;
    width: auto;
    padding: 0 4px;
  }

  .sidebar,
  .workspace,
  .detail-drawer {
    display: none;
    min-height: 0;
  }

  .app-shell[data-active-view="faculty"] .sidebar {
    display: flex;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .app-shell[data-active-view="graph"] .workspace {
    display: flex;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .app-shell[data-active-view="details"] .workspace {
    display: flex;
    width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .app-shell[data-active-view="details"] .metrics,
  .app-shell[data-active-view="details"] .graph-panel,
  .app-shell[data-active-view="details"] .data-footnote {
    display: none;
  }

  .app-shell[data-active-view="details"] .detail-drawer {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 0;
  }

  .app-shell[data-active-view="details"] .detail-panel {
    width: 100%;
    min-width: 0;
    height: 100%;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .app-shell[data-active-view="details"] .mobile-detail-close {
    display: none;
  }

  .app-shell[data-active-view="graph"] .metrics {
    display: none;
  }

  .faculty-list {
    max-height: none;
    overflow: auto;
  }

  .current-view-bar {
    align-items: stretch;
  }

  .question-strip {
    grid-template-columns: 1fr;
  }

  .app-shell[data-details-open="true"] .detail-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: block;
    border: 0;
    border-radius: 0;
    background: rgba(33, 35, 37, 0.32);
    cursor: pointer;
  }

  .app-shell[data-details-open="true"] .detail-drawer {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 21;
    display: block;
    max-height: 82vh;
    padding: 10px;
    overflow: auto;
  }

  .app-shell[data-details-open="true"] .workspace {
    padding-bottom: calc(82vh + 16px);
  }

  .app-shell[data-details-open="true"] .detail-panel {
    max-height: calc(82vh - 20px);
    overflow: auto;
  }

  .mobile-detail-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .detail-actions {
    justify-content: flex-start;
  }

}

@media (max-width: 700px) {
  .topbar,
  .graph-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar {
    gap: 10px;
    padding: 10px 12px;
  }

  .top-actions {
    display: none;
  }

  .eyebrow {
    display: none;
  }

  h1 {
    font-size: 1.18rem;
  }

  .view-tabs button {
    min-height: 30px;
  }

  .view-tabs {
    width: 100%;
    max-width: 366px;
  }

  .source-row {
    justify-content: flex-start;
  }

  .workspace,
  .sidebar {
    height: 100%;
    padding: 12px;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .graph-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 10px;
  }

  .graph-toolbar {
    order: 1;
    gap: 7px;
    margin-bottom: 8px;
  }

  #graphSubtitle {
    margin-top: 2px;
    font-size: 0.78rem;
    line-height: 1.22;
  }

  .graph-search {
    display: grid;
    gap: 5px;
  }

  .graph-search .search-input {
    min-height: 34px;
    padding: 5px 8px;
    font-size: 0.92rem;
  }

  .graph-ancestor-presets {
    flex-wrap: nowrap;
    gap: 5px;
    margin-top: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  .graph-ancestor-presets::-webkit-scrollbar {
    display: none;
  }

  .graph-preset {
    flex: 0 0 auto;
    min-height: 26px;
    padding: 2px 7px;
    font-size: 0.7rem;
  }

  .graph-search-results {
    top: calc(100% + 4px);
    max-height: min(280px, 48vh);
  }

  .question-strip {
    order: 2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 8px;
  }

  .question-strip button {
    min-height: 48px;
    padding: 7px 8px;
  }

  .question-strip strong {
    font-size: 0.68rem;
    line-height: 1.15;
  }

  .question-strip span {
    font-size: 0.78rem;
  }

  .viewport-chip-stack {
    top: 10px;
    left: 10px;
    width: min(260px, calc(100% - 78px));
    max-height: 76px;
    overflow: visible;
  }

  .selection-chips {
    order: 3;
  }

  .canvas-wrap {
    order: 4;
    min-height: 430px;
  }

  .shared-ancestor-panel {
    order: 5;
  }

  #graphCanvas {
    height: 430px;
    touch-action: none;
  }

  .graph-selection-card {
    right: 10px;
    left: 10px;
    top: 92px;
    width: auto;
  }

  .graph-legend {
    left: 10px;
    right: auto;
    bottom: 10px;
    width: min(350px, calc(100% - 20px));
  }

  .graph-density-note {
    left: 10px;
    right: auto;
    bottom: 58px;
    width: min(350px, calc(100% - 20px));
    max-width: none;
  }

  .graph-gesture-hint {
    position: absolute;
    right: auto;
    left: 50%;
    bottom: 104px;
    z-index: 2;
    display: block;
    max-width: calc(100% - 20px);
    padding: 5px 8px;
    border: 1px solid rgba(207, 212, 216, 0.95);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--gray-dark-60);
    font-size: 0.72rem;
    font-weight: 800;
    pointer-events: none;
    transform: translateX(-50%);
  }

  .floating-zoom-controls {
    display: none;
  }

  .table-wrap {
    margin: 10px 0 0;
    max-height: none;
    overflow: visible;
  }

  .shared-ancestor-panel[open] {
    overflow: visible;
  }

  th:nth-child(2),
  td:nth-child(2) {
    width: 42px;
  }

  th,
  td {
    padding: 7px 6px;
  }

  .overview-canvas {
    display: none;
  }
}

@media (max-width: 360px) {
  .question-strip {
    grid-template-columns: 1fr;
  }
}
