:root {
  --bg: #0f1420;
  --panel: #182131;
  --panel-2: #1e293b;
  --ink: #e8edf5;
  --muted: #93a1b5;
  --line: #2b3a52;
  --accent: #5db2ff;
  --accent-2: #7ee0b8;
  --warn: #ffcf7a;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}

.hidden { display: none !important; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #16202f, #111826);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 30px; }
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: .04em; }
.tagline { margin: 0; font-size: 12px; color: var(--muted); }
.api-link {
  color: var(--accent); text-decoration: none; font-size: 13px;
  border: 1px solid var(--line); padding: 6px 12px; border-radius: 6px;
}
.api-link:hover { border-color: var(--accent); }

main { max-width: 1180px; margin: 0 auto; padding: 20px; }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 16px; box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.panel h2 { margin: 0 0 12px; font-size: 15px; }
.hint { color: var(--muted); font-weight: 400; font-size: 12px; }

/* input panel */
.source-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tab {
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
  padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.tab.active { color: var(--ink); border-color: var(--accent); background: #223148; }

form label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
form input[type=text], form input[type=number], form input[type=file], form select {
  display: block; width: 100%; margin-top: 4px;
  background: #0d1420; color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: 14px;
}
label.checkbox { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); font-size: 13px; }
label.checkbox input { width: auto; margin: 0; }

.source-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.params { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 6px 0 14px; }
.params legend { font-size: 12px; color: var(--muted); padding: 0 6px; }
.params { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.params legend { grid-column: 1 / -1; }

button.run {
  background: var(--accent); color: #07223c; border: none; font-weight: 600;
  padding: 11px 22px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
button.run:hover { filter: brightness(1.08); }
button.run:disabled { opacity: .55; cursor: default; }

.status { font-size: 13px; margin: 12px 0 0; min-height: 18px; }
.status.err { color: var(--warn); }
.status.ok { color: var(--accent-2); }

/* results */
.recommendation { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.recommendation .badge {
  background: #12362a; color: var(--accent-2); border: 1px solid #245844;
  padding: 4px 12px; border-radius: 20px; font-weight: 600; font-size: 14px;
}
.recommendation .meta { color: var(--muted); font-size: 13px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid .panel { margin-bottom: 0; }
@media (max-width: 820px) { .grid { grid-template-columns: 1fr; } .source-fields, .params { grid-template-columns: 1fr; } }

.scroll { max-height: 360px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; position: sticky; top: 0; background: var(--panel); }
tr.best td { background: #12362a33; }
tr.best td:first-child { color: var(--accent-2); font-weight: 700; }
td.num { font-variant-numeric: tabular-nums; text-align: right; }

.blocks .block { margin-bottom: 12px; }
.blocks .block-head { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 4px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.blocks .genes { color: var(--muted); font-size: 12px; word-break: break-word; }

canvas { display: block; width: 100%; max-width: 440px; margin: 0 auto; background: #0d1420; border-radius: 8px; }
svg#network { display: block; width: 100%; max-width: 640px; margin: 0 auto; background: #0d1420; border-radius: 8px; }

/* force-directed network legend + hub table (mirrors the reference figure) */
.net-legend {
  display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 10px auto 0; max-width: 640px;
  font-size: 11px; color: var(--muted); padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2);
}
.net-legend .lg-group { min-width: 130px; }
.net-legend .lg-title { color: var(--ink); font-weight: 700; font-size: 11px; margin-bottom: 5px; }
.net-legend .lg-row { display: flex; align-items: center; gap: 7px; line-height: 1.7; }
.net-legend .lg-n { color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.net-legend .lg-total { margin-top: 6px; color: var(--ink); font-size: 11px; }
.net-legend .lg-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.net-legend .lg-line { width: 26px; border-radius: 2px; flex: none; }
.net-legend .lg-shape { width: 11px; height: 11px; flex: none; background: var(--muted); }
.net-legend .lg-shape.circle { border-radius: 50%; }
.net-legend .lg-shape.square { border-radius: 1px; }
.net-legend .lg-shape.diamond { border-radius: 1px; transform: rotate(45deg) scale(0.82); }
.hub-panel { margin: 10px auto 0; max-width: 640px; }
.hub-panel h3 { margin: 0 0 6px; font-size: 13px; color: var(--accent); }
.hub-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.hub-table th, .hub-table td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.hub-table th { color: var(--muted); font-weight: 600; }
.hub-table td.num, .hub-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.hub-table td .lg-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: baseline; }

/* "Top gene pairs" — clickable list, one click away from a STRING search */
.pairs-panel { margin: 10px auto 0; max-width: 640px; }
.pairs-panel h3 { margin: 0 0 6px; font-size: 13px; color: var(--accent); }
.pairs-panel h3 .hint { margin-left: 8px; font-weight: 400; }
.pairs-list { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow: auto;
  border: 1px solid var(--line); border-radius: 8px; }
.pair-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 12px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.pair-row:last-child { border-bottom: none; }
.pair-row:hover { background: #223148; }
.pair-row.active { background: #12362a; }
.pair-row .pn { font-weight: 600; }
.pair-row .arrow { color: var(--muted); }
.pair-row .cov { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.pair-row .cov.pos { color: #ff8f7a; }
.pair-row .cov.neg { color: #7fb0ff; }
.legend { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); margin-top: 8px; justify-content: center; }
.legend .bar { height: 10px; width: 160px; border-radius: 3px;
  background: linear-gradient(90deg, #3b6fe0, #0d1420 50%, #e0563b); }

.tooltip {
  position: fixed; pointer-events: none; z-index: 10;
  background: #05285cee; border: 1px solid var(--accent); color: var(--ink);
  padding: 4px 8px; border-radius: 6px; font-size: 12px;
}

/* GEO keyword search */
.geo-search { grid-column: 1 / -1; margin-bottom: 8px; }
.search-row { display: flex; gap: 8px; align-items: stretch; margin-top: 4px; }
.search-row input[type=text] { margin-top: 0; }
button.mini {
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--accent);
  border-radius: 6px; padding: 0 16px; cursor: pointer; font-size: 13px; white-space: nowrap;
}
button.mini:hover { background: #223148; }
button.mini:disabled { opacity: .55; cursor: default; }
.search-results { list-style: none; margin: 8px 0 0; padding: 0; max-height: 260px; overflow: auto;
  border: 1px solid var(--line); border-radius: 8px; }
.search-results .hit { padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.search-results .hit:last-child { border-bottom: none; }
.search-results .hit:hover { background: #223148; }
.search-results .hit.selected { background: #12362a; }
.hit-head { display: flex; gap: 8px; align-items: baseline; }
.hit-head .acc { color: var(--accent); font-weight: 600; font-size: 13px; white-space: nowrap; }
.hit-head .hit-title { font-size: 13px; color: var(--ink); }
.hit-meta { color: var(--muted); font-size: 11px; margin-top: 2px; }

/* protein id translator */
.tool textarea {
  display: block; width: 100%; margin: 4px 0 10px;
  background: #0d1420; color: var(--ink); border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 10px; font-size: 13px; font-family: inherit; resize: vertical;
}
.tool-row { display: flex; gap: 14px; align-items: flex-end; margin-bottom: 4px; }
.tool-row label { margin-bottom: 0; }
.tool-row select { min-width: 160px; }
#protein-table a { color: var(--accent); text-decoration: none; }
#protein-table a:hover { text-decoration: underline; }
#protein-table tr.unmatched td { color: var(--muted); }

/* network toolbar (organism + symbol status) */
.net-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; color: var(--muted); }
label.inline select { width: auto; margin-top: 0; padding: 4px 8px; font-size: 13px; }

/* interactive network / heatmap cursors + hover */
svg#network line { cursor: pointer; }
svg#network line.hot { stroke-opacity: 1 !important; }
svg#network .node { cursor: pointer; }
svg#network text.node-label {
  fill: var(--ink); font-size: 9px; font-weight: 600; pointer-events: none;
  paint-order: stroke; stroke: #0d1420; stroke-width: 2.4px; stroke-linejoin: round;
}
canvas#heatmap { cursor: crosshair; }

/* click-to-inspect detail panels (edge + heatmap cell) */
.detail {
  margin-top: 10px; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; background: var(--panel-2); font-size: 13px;
}
.detail h3 { margin: 0 0 8px; font-size: 13px; color: var(--accent); }
.detail .pair { display: flex; align-items: stretch; gap: 10px; }
.detail .endpoint { flex: 1; min-width: 0; }
.detail .endpoint .sym { font-weight: 700; font-size: 14px; }
.detail .endpoint .sub { color: var(--muted); font-size: 11px; word-break: break-word; }
.detail .link {
  align-self: center; color: var(--muted); font-variant-numeric: tabular-nums;
  text-align: center; white-space: nowrap;
}
.detail .cov { font-weight: 700; }
.detail .cov.pos { color: #ff8f7a; }
.detail .cov.neg { color: #7fb0ff; }
.detail .rna-tag {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 10px;
  font-size: 10px; border: 1px solid var(--line); color: var(--muted); vertical-align: middle;
}
.detail button.mini { margin-top: 10px; }

/* STRING interaction results */
.interactions { margin-top: 10px; }
.interactions .direct { font-size: 12px; color: var(--accent-2); margin-bottom: 6px; }
.interactions ul { list-style: none; margin: 0; padding: 0; max-height: 200px; overflow: auto; }
.interactions li {
  display: flex; align-items: center; gap: 8px; padding: 4px 0;
  border-bottom: 1px solid var(--line); font-size: 12px;
}
.interactions li:last-child { border-bottom: none; }
.interactions .pn { font-weight: 600; }
.interactions .arrow { color: var(--muted); }
.interactions .meter {
  flex: 1; height: 6px; border-radius: 3px; background: #0d1420; overflow: hidden; min-width: 40px;
}
.interactions .meter > span { display: block; height: 100%; background: var(--accent); }
.interactions .sc { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

footer {
  display: flex; justify-content: space-between; max-width: 1180px; margin: 0 auto;
  padding: 16px 20px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line);
}
