:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #eef2f7;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --panel-border: #dce3ed;
  --muted: #69758a;
  --blue: #2563eb;
  --blue-dark: #1748b8;
  --surface: #ffffff;
  --soft-surface: #f6f8fb;
  --branch: #526175;
  --branch-muted: #cbd3df;
  --focus: #0ea5e9;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  min-width: 320px;
  min-height: 100vh;
  overflow: hidden;
}

button, input, select { font: inherit; }
button, select, input { outline-offset: 2px; }
button:focus-visible, select:focus-visible, input:focus-visible, .drop-zone:focus-within {
  outline: 3px solid color-mix(in srgb, var(--focus) 35%, transparent);
}

.topbar {
  height: 66px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  background: #111827;
  color: white;
  border-bottom: 1px solid #293244;
}

.brand-mark {
  width: 34px;
  height: 34px;
  position: relative;
  flex: 0 0 auto;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  left: 8px;
  width: 18px;
  height: 1px;
  background: #93c5fd;
  transform-origin: left center;
}
.brand-mark::before { top: 9px; transform: rotate(33deg); }
.brand-mark::after { top: 24px; transform: rotate(-33deg); }
.brand-mark span {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.13);
}
.brand-mark span:nth-child(1) { left: 3px; top: 13px; }
.brand-mark span:nth-child(2) { right: 2px; top: 3px; }
.brand-mark span:nth-child(3) { right: 2px; bottom: 3px; }

.brand-copy { display: flex; flex-direction: column; line-height: 1.12; }
.brand-copy strong { font-size: 16px; letter-spacing: 0.01em; }
.brand-copy span { margin-top: 4px; font-size: 11px; color: #aeb8ca; letter-spacing: 0.04em; }

.local-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid #344155;
  border-radius: 999px;
  color: #cbd5e1;
  font-size: 12px;
}
.local-dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.12); }

.app-shell {
  height: calc(100vh - 66px);
  display: grid;
  grid-template-columns: 286px minmax(520px, 1fr) 286px;
  background: #eef2f7;
}

.control-panel,
.details-panel {
  min-height: 0;
  overflow-y: auto;
  background: var(--surface);
}
.control-panel { border-right: 1px solid var(--panel-border); }
.details-panel { border-left: 1px solid var(--panel-border); padding: 24px 20px; }

.panel-section { padding: 21px 20px; border-bottom: 1px solid var(--panel-border); }
.section-heading { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 15px; }
.section-heading.compact { margin-bottom: 14px; align-items: center; }
.section-heading h2, .diagnostics-section h2, .details-panel h2 { margin: 0; font-size: 14px; color: #1f2937; }
.section-heading p { margin: 4px 0 0; font-size: 11px; color: var(--muted); }
.step-number {
  width: 23px;
  height: 23px;
  border-radius: 7px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--blue);
  background: #eaf2ff;
  font-weight: 700;
  font-size: 11px;
}

.drop-zone {
  min-height: 126px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1.5px dashed #aab7ca;
  border-radius: 12px;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--blue); background: #eff6ff; transform: translateY(-1px); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-zone strong { font-size: 13px; }
.drop-zone span:not(.drop-icon) { color: var(--muted); font-size: 11px; }
.drop-icon { font-size: 26px; color: var(--blue); line-height: 1; }

.secondary-button {
  border: 1px solid #cbd5e1;
  background: white;
  color: #334155;
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 650;
  font-size: 12px;
}
.secondary-button:hover { border-color: #94a3b8; background: #f8fafc; }
.file-button { display: inline-flex; justify-content: center; align-items: center; margin-top: 0; text-decoration: none; }
.hidden-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.full-width { width: 100%; margin-top: 10px; }
.privacy-note { margin: 10px 2px 0; color: var(--muted); font-size: 10.5px; line-height: 1.45; }

.field-label { display: block; margin: 14px 0 6px; color: #475569; font-size: 11px; font-weight: 700; }
.field-label:first-of-type { margin-top: 0; }
select, .search-field {
  width: 100%;
  border: 1px solid #cfd8e6;
  border-radius: 8px;
  background: white;
}
select { height: 38px; padding: 0 32px 0 10px; color: #1f2937; cursor: pointer; }
.control-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.control-grid .field-label { margin-top: 14px; }
.control-grid select { padding-left: 8px; padding-right: 24px; font-size: 10.5px; }
.search-field { display: flex; align-items: center; height: 38px; padding: 0 8px 0 10px; gap: 7px; }
.search-field.has-query { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12); }
.search-field > span { color: #8b98aa; font-size: 17px; }
.search-field input { min-width: 0; flex: 1; border: 0; outline: 0; color: #1f2937; background: transparent; }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-field input::placeholder { color: #9aa5b5; }
.clear-search-button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 6px;
  background: #edf4ff;
  color: #2457a7;
  padding: 4px 7px;
  cursor: pointer;
  font-size: 9.5px;
  font-weight: 750;
}
.clear-search-button:hover { background: #dbeafe; }
.clear-search-button[hidden] { display: none; }
.field-hint { min-height: 17px; margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.field-hint a { color: var(--blue); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.field-hint a:hover { text-decoration-thickness: 2px; }

.legend-list { display: grid; gap: 7px; }
.legend-item { display: grid; grid-template-columns: 11px minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: 10.5px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; }
.legend-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #344054; }
.legend-count { color: #98a2b3; font-variant-numeric: tabular-nums; }
.muted-copy { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.diagnostics-section { background: #fffaf0; }
.diagnostics-section ul { margin: 9px 0 0; padding-left: 18px; color: #7c5d22; font-size: 10.5px; line-height: 1.45; }
.diagnostics-section li + li { margin-top: 5px; }

.sequence-detail-section {
  padding: 18px 20px 0;
  border-top: 1px solid var(--panel-border);
}
.sequence-detail-section h2 {
  margin: 0 0 10px;
  font-size: 13px;
  color: #1f2937;
}
.sequence-details {
  display: grid;
  gap: 10px;
  padding-bottom: 10px;
}
.sequence-summary {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #d8e0ea;
  border-radius: 10px;
  background: #f8fbff;
}
.sequence-summary .summary-line { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; }
.sequence-summary .summary-label { color: #6b7280; }
.sequence-summary .summary-value { color: #1f2937; font-weight: 650; text-align: right; overflow-wrap: anywhere; }
.sequence-diff-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}
.sequence-diff-item {
  padding: 6px 8px;
  border-radius: 8px;
  background: #eef4ff;
  color: #1e3a8a;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}
.sequence-warning {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 10.5px;
  line-height: 1.45;
}

.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 20px 20px 14px;
  gap: 12px;
}

.dataset-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 0 3px; }
.eyebrow { margin: 0 0 5px; color: #8a96a8; font-size: 9px; font-weight: 800; letter-spacing: 0.14em; }
.dataset-header h1 { margin: 0; max-width: 720px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 19px; letter-spacing: -0.015em; }
.dataset-metrics { display: flex; align-items: center; flex: 0 0 auto; }
.dataset-metrics div { min-width: 70px; padding: 0 13px; border-left: 1px solid #d5dde8; text-align: right; }
.dataset-metrics strong, .dataset-metrics span { display: block; }
.dataset-metrics strong { color: #1e293b; font-size: 14px; font-variant-numeric: tabular-nums; }
.dataset-metrics span { margin-top: 2px; color: #8290a4; font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; }

.tree-stage {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid #d7dee9;
  border-radius: 12px;
  background:
    linear-gradient(rgba(231, 236, 244, 0.45) 1px, transparent 1px),
    linear-gradient(90deg, rgba(231, 236, 244, 0.45) 1px, transparent 1px),
    white;
  background-size: 24px 24px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.045);
}
#treeSvg { display: block; width: 100%; height: 100%; min-height: 360px; cursor: grab; touch-action: none; user-select: none; }
#treeSvg:active { cursor: grabbing; }
.canvas-background { fill: transparent; }

.view-toolbar {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  display: flex;
  overflow: hidden;
  border: 1px solid #cad4e2;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.08);
}
.view-toolbar button { min-width: 34px; height: 32px; border: 0; border-left: 1px solid #d9e0e9; background: transparent; color: #354154; cursor: pointer; font-size: 13px; font-weight: 700; }
.view-toolbar button:first-child { border-left: 0; }
.view-toolbar button:hover { background: #f1f5f9; color: var(--blue); }
.interaction-hint { position: absolute; left: 13px; bottom: 10px; z-index: 2; color: #8a96a8; font-size: 9.5px; pointer-events: none; }
.drop-overlay { position: absolute; inset: 12px; z-index: 6; display: grid; place-items: center; border: 2px dashed var(--blue); border-radius: 10px; background: rgba(239, 246, 255, 0.94); color: var(--blue-dark); font-size: 15px; font-weight: 750; pointer-events: none; }
.drop-overlay[hidden] { display: none; }

.status-strip { display: flex; align-items: center; gap: 8px; min-height: 20px; padding: 0 3px; color: #677489; font-size: 10.5px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }
.status-strip.is-error { color: #b42318; }
.status-strip.is-error .status-dot { background: #ef4444; }
.status-strip.is-busy .status-dot { background: #f59e0b; animation: pulse 1.1s infinite alternate; }
@keyframes pulse { to { opacity: 0.35; } }

.details-header { padding-bottom: 15px; border-bottom: 1px solid var(--panel-border); }
.details-panel h2 { font-size: 16px; }
.node-details { padding-top: 16px; }
.empty-details { min-height: 260px; display: grid; place-content: center; justify-items: center; color: #8995a7; text-align: center; }
.empty-details-icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 50%; background: #f2f5f9; font-size: 25px; }
.empty-details p { max-width: 170px; margin: 12px 0; font-size: 11px; line-height: 1.5; }
.node-name { margin: 0 0 4px; color: #182230; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.node-kind { display: inline-flex; margin-bottom: 16px; padding: 4px 7px; border-radius: 999px; background: #eef4ff; color: #2457a7; font-size: 9px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.detail-list { margin: 0; }
.detail-row { display: grid; grid-template-columns: minmax(72px, 0.8fr) minmax(0, 1.2fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid #edf0f4; }
.detail-row dt { color: #7b8799; font-size: 10px; overflow-wrap: anywhere; }
.detail-row dd { margin: 0; color: #27364b; font-size: 10.5px; font-weight: 620; text-align: right; overflow-wrap: anywhere; }

.axis-domain, .axis-tick, .scale-bar, .scale-bar-tick { stroke: #8f9cae; stroke-width: 1; vector-effect: non-scaling-stroke; }
.axis-layer, .scale-layer, .branch-vertical, .branch-horizontal, .branch-unrooted { pointer-events: none; }
.axis-tick-label, .axis-title { fill: #718096; font-size: 10px; font-family: inherit; }
.axis-title { font-size: 10.5px; font-weight: 700; }
.scale-bar-label { fill: #718096; font-size: 10px; font-family: inherit; }
.branch-vertical { stroke: #9aa6b7; stroke-width: 1.25; fill: none; vector-effect: non-scaling-stroke; transition: opacity 90ms linear; }
.branch-horizontal, .branch-unrooted {
  stroke: var(--branch-color, var(--branch));
  stroke-width: 1.9;
  stroke-linecap: round;
  fill: none;
  vector-effect: non-scaling-stroke;
  transition: opacity 90ms linear, stroke-width 90ms linear;
}
.tree-node {
  fill: var(--node-color, white);
  stroke: var(--branch-color, #526175);
  stroke-width: 1.35;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: opacity 90ms linear, stroke-width 90ms linear;
}
.tree-node.leaf { stroke-width: 1.7; }
.tree-node.internal { fill: white; }
#treeSvg[data-view-mode="unrooted"] .tree-node.root-node { opacity: 0; pointer-events: none; }
.tip-label { fill: #344054; font-family: inherit; font-size: 10.5px; dominant-baseline: central; cursor: pointer; paint-order: stroke; stroke: rgba(255,255,255,0.92); stroke-width: 2.4px; stroke-linejoin: round; transition: opacity 90ms linear; }
.tree-node:hover, .tree-node:focus-visible { stroke: #0f172a; stroke-width: 2.8; outline: none; }
.tree-node.is-selected { stroke: #111827; stroke-width: 3; filter: drop-shadow(0 0 2px rgba(15, 23, 42, 0.4)); }
.branch-horizontal.is-dimmed, .branch-unrooted.is-dimmed { opacity: 0.48; }
.branch-vertical.is-dimmed { opacity: 0.3; }
.tree-node.is-dimmed { opacity: 0.78; }
.tip-label.is-dimmed { opacity: 0.2; }
.branch-horizontal.is-match, .branch-unrooted.is-match { stroke-width: 3.1; opacity: 1; }
.tree-node.is-match { stroke: #111827; stroke-width: 2.5; opacity: 1; filter: drop-shadow(0 0 1.5px rgba(15, 23, 42, 0.35)); }
.tip-label.is-match, .tip-label.is-selected { fill: #111827; font-weight: 800; opacity: 1; }
.tip-label.labels-hidden { display: none; }
.tip-label.labels-hidden.is-match, .tip-label.labels-hidden.is-selected { display: block; }

noscript { display: block; margin: 20px; color: #b42318; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 260px minmax(480px, 1fr); }
  .details-panel { display: none; }
}

@media (max-width: 780px) {
  body { overflow: auto; }
  .topbar { position: sticky; top: 0; z-index: 20; }
  .local-badge { font-size: 0; padding: 8px; }
  .app-shell { height: auto; min-height: calc(100vh - 66px); grid-template-columns: 1fr; }
  .control-panel { border-right: 0; border-bottom: 1px solid var(--panel-border); overflow: visible; }
  .workspace { min-height: 650px; padding: 15px; }
  .panel-section { padding: 16px; }
  .control-grid { grid-template-columns: 1fr; gap: 0; }
  .dataset-header { align-items: flex-start; flex-direction: column; }
  .dataset-metrics div:first-child { border-left: 0; padding-left: 0; }
  .tree-stage { min-height: 520px; }
  #treeSvg { min-height: 520px; }
}

/* PhyloLocal branding and application modes */
[hidden] { display: none !important; }
.brand-logo {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid #334155;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.24);
}
.mode-switch {
  display: flex;
  gap: 4px;
  margin-left: 22px;
  padding: 4px;
  border: 1px solid #334155;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.78);
}
.mode-button {
  min-height: 32px;
  border: 0;
  border-radius: 7px;
  padding: 0 13px;
  color: #aeb8ca;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
}
.mode-button:hover { color: #ffffff; background: #253047; }
.mode-button.is-active { color: #0f172a; background: #ffffff; }
.new-badge {
  margin-left: 5px;
  padding: 2px 5px;
  border-radius: 999px;
  background: #22c55e;
  color: #052e16;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.08em;
  vertical-align: 1px;
}

/* Reassortment Radar */
.radar-shell {
  height: calc(100vh - 66px);
  display: grid;
  grid-template-columns: 310px minmax(620px, 1fr) 350px;
  background: #eef2f7;
}
.radar-control-panel,
.radar-results-panel {
  min-height: 0;
  overflow-y: auto;
  background: #ffffff;
}
.radar-control-panel { border-right: 1px solid var(--panel-border); }
.radar-results-panel {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--panel-border);
}
.radar-workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 20px 20px 14px;
  gap: 12px;
}
.radar-header h1 { font-size: 18px; }
.radar-metrics div { min-width: 88px; }
.radar-stage { min-height: 440px; }
#radarSvg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 440px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
#radarSvg:active { cursor: grabbing; }

.radar-file-slot {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 66px;
  margin-top: 10px;
  padding: 10px;
  border: 1px dashed #b6c2d2;
  border-radius: 10px;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}
.radar-file-slot:hover,
.radar-file-slot.is-dragging { border-color: var(--blue); background: #eff6ff; transform: translateY(-1px); }
.radar-file-slot input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.segment-letter {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: white;
  font-weight: 850;
}
.tree-a-accent { background: #2563eb; }
.tree-b-accent { background: #10b981; }
.radar-file-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.radar-file-copy strong { color: #273449; font-size: 11px; }
.radar-file-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #778499; font-size: 9.5px; }
.slot-action { color: #2563eb; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }
.range-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.range-label-row strong { color: #7c3aed; font-size: 11px; }
.score-range { width: 100%; accent-color: #7c3aed; }
.score-scale { display: flex; justify-content: space-between; color: #8793a5; font-size: 8.5px; }
.radar-color-key { display: flex; justify-content: space-between; margin-top: 13px; font-size: 9.5px; color: #5d687a; }
.radar-color-key span { display: inline-flex; align-items: center; gap: 5px; }
.radar-color-key i { width: 9px; height: 9px; display: inline-block; border-radius: 50%; }
.key-low { background: #0ea5e9; }
.key-mid { background: #f59e0b; }
.key-high { background: #ef4444; }

.radar-results-heading { padding: 23px 20px 14px; border-bottom: 1px solid var(--panel-border); }
.radar-results-heading h2 { margin: 0; font-size: 16px; }
.radar-results-heading p:last-child { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.candidate-list {
  flex: 0 0 min(42%, 360px);
  min-height: 150px;
  overflow-y: auto;
  padding: 8px 10px;
  border-bottom: 1px solid var(--panel-border);
}
.candidate-row {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  margin: 2px 0;
  padding: 9px 8px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #283549;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.candidate-row:hover { background: #f5f7fb; }
.candidate-row.is-selected { border-color: #bfdbfe; background: #eff6ff; }
.candidate-rank { color: #99a4b4; font-size: 9px; font-variant-numeric: tabular-nums; }
.candidate-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10.5px; font-weight: 700; }
.candidate-score { color: var(--score-color); font-size: 10px; font-weight: 850; text-align: right; }
.candidate-bar {
  position: absolute;
  left: 40px;
  right: 8px;
  bottom: 5px;
  height: 2px;
  border-radius: 999px;
  background: #e7ebf1;
}
.candidate-bar::after {
  content: "";
  display: block;
  width: var(--score-width);
  height: 100%;
  border-radius: inherit;
  background: var(--score-color);
}
.radar-detail-section { padding: 20px; }
.radar-detail-heading { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.radar-detail-heading h3 { max-width: 100%; overflow-wrap: anywhere; }
.discordance-badge {
  display: inline-flex;
  padding: 5px 8px;
  border: 1px solid color-mix(in srgb, var(--score-color) 30%, white);
  border-radius: 999px;
  color: var(--score-color);
  background: color-mix(in srgb, var(--score-color) 8%, white);
  font-size: 9px;
  font-weight: 850;
}
.neighbor-title { margin: 16px 0 7px; color: #46536a; font-size: 10px; }
.tree-a-title { color: #1d4ed8; }
.tree-b-title { color: #047857; }
.neighbor-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.neighbor-chip {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid #d6deea;
  border-radius: 999px;
  padding: 4px 7px;
  color: #4b586d;
  background: #f8fafc;
  cursor: pointer;
  font-size: 8.5px;
}
.neighbor-chip:hover { border-color: #93c5fd; background: #eff6ff; }
.neighbor-chip.is-empty { cursor: default; color: #97a2b2; }
.tree-a-neighbors .neighbor-chip { border-color: #bfdbfe; background: #eff6ff; color: #1d4ed8; }
.tree-b-neighbors .neighbor-chip { border-color: #a7f3d0; background: #ecfdf5; color: #047857; }
.shared-neighbors .neighbor-chip { border-color: #ddd6fe; background: #f5f3ff; color: #6d28d9; }
.scientific-caution { margin: 17px 0 0; padding: 10px; border-radius: 8px; background: #fff7ed; color: #8a4b16; font-size: 9px; line-height: 1.5; }

.radar-tree-title { fill: #263449; font-size: 12px; font-weight: 800; }
.radar-center-title { fill: #8490a3; font-size: 8.5px; letter-spacing: 0.03em; }
.radar-axis-note { fill: #8a96a8; font-size: 8.5px; }
.radar-tree-branch { fill: none; stroke: #aab4c3; stroke-width: 1.15; }
.radar-tree-branch.is-selected-path { stroke: #111827; stroke-width: 2.35; }
.radar-tree-node { fill: #ffffff; stroke: #8e9aab; stroke-width: 1; cursor: pointer; }
.radar-tree-node.is-leaf { fill: #64748b; stroke: #ffffff; stroke-width: 0.7; }
.radar-node-a.is-neighbor-tip { fill: #2563eb; r: 4px; }
.radar-node-b.is-neighbor-tip { fill: #10b981; r: 4px; }
.radar-tree-node.is-selected-tip { fill: #ef4444; stroke: #111827; stroke-width: 1.6; r: 5px; }
.radar-connector {
  fill: none;
  stroke: var(--score-color);
  stroke-width: 1.2;
  stroke-opacity: var(--score-opacity);
  cursor: pointer;
  transition: stroke-opacity 100ms ease, stroke-width 100ms ease;
}
.radar-connector:hover { stroke-opacity: 0.95; stroke-width: 2.2; }
.radar-connector.is-below-threshold { stroke-opacity: 0.07; }
.radar-connector.is-selected { stroke: #ef4444; stroke-opacity: 1; stroke-width: 4; }
.radar-tip-label {
  fill: #64748b;
  font-size: 8.2px;
  dominant-baseline: central;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 2.5px;
  cursor: pointer;
}
.radar-tip-label.is-selected { fill: #111827; font-weight: 900; font-size: 9.5px; }

@media (max-width: 1180px) {
  .radar-shell { grid-template-columns: 270px minmax(520px, 1fr) 300px; }
  .mode-switch { margin-left: 8px; }
  .local-badge { display: none; }
}

@media (max-width: 900px) {
  body { overflow: auto; }
  .topbar { height: auto; min-height: 66px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .mode-switch { order: 3; width: 100%; margin: 0; }
  .mode-button { flex: 1; }
  .app-shell,
  .radar-shell { height: auto; min-height: calc(100vh - 66px); grid-template-columns: 1fr; }
  .radar-control-panel,
  .radar-results-panel { overflow: visible; border: 0; }
  .radar-workspace { min-height: 720px; }
  .candidate-list { max-height: 300px; }
}
.radar-sample-name { margin: 0; color: #172033; font-size: 15px; line-height: 1.25; }
