:root {
  --page: #f5f7f8;
  --panel: #ffffff;
  --ink: #172126;
  --muted: #58666d;
  --line: #d5dde1;
  --line-strong: #aebbc1;
  --brand: #006a6a;
  --brand-dark: #004f52;
  --brand-soft: #e4f2f1;
  --target: #1659a6;
  --target-soft: #e8f0fa;
  --gene: #a64b00;
  --gene-soft: #fff0e2;
  --comparison: #5f3b91;
  --comparison-soft: #f0eafa;
  --warning: #8b3b28;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--page);
}

button,
input,
select {
  font: inherit;
}

button,
a,
summary {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--brand-dark);
}

code,
.identifier {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.page {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px;
}

.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
}

.site-header h1 {
  margin: 0;
  color: var(--brand-dark);
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: 0;
}

.site-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.repo-link {
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 7px 11px;
  color: var(--ink);
  background: var(--panel);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}

.repo-link:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line-strong);
}

.tab {
  min-width: 96px;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 9px 14px 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
}

.tab:hover {
  color: var(--ink);
  background: #edf1f2;
}

.tab.is-active {
  border-bottom-color: var(--brand);
  color: var(--brand-dark);
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.card {
  min-height: 98px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.card h2 {
  margin: 0;
  color: var(--brand-dark);
  font-size: 27px;
  line-height: 1.1;
  letter-spacing: 0;
  font-weight: 700;
}

.card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 700;
}

.load-strip {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.load-strip.is-hidden {
  display: none;
}

.load-strip-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.load-strip-head strong {
  color: var(--ink);
}

.load-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: #e2e7e9;
}

.load-bar-fill {
  width: 0;
  height: 100%;
  background: var(--brand);
  transition: width 150ms ease;
}

.tab-panel[hidden] {
  display: none;
}

.search-panel,
.table-wrap,
.text-panel > section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.search-panel {
  padding: 16px;
}

.search-heading {
  margin-bottom: 12px;
}

.search-heading h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: 0;
}

.search-controls {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 110px;
  gap: 10px;
  align-items: end;
}

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

.search-controls label,
.table-controls label {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 7px 9px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(0, 106, 106, 0.14);
}

#queryButton {
  min-height: 38px;
  border: 1px solid var(--brand-dark);
  border-radius: 6px;
  padding: 7px 14px;
  color: #fff;
  background: var(--brand-dark);
  cursor: pointer;
  font-weight: 700;
}

#queryButton:hover:not(:disabled) {
  background: #003f42;
}

#queryButton:disabled {
  opacity: 0.55;
  cursor: wait;
}

.examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.examples > span {
  margin-right: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.examples button {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  color: var(--brand-dark);
  background: #f7faf9;
  cursor: pointer;
  font-size: 12px;
}

.examples button:hover {
  border-color: var(--brand);
}

.result-meta {
  min-height: 28px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.search-results {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-top: 5px;
}

.panel-card {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.panel-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.panel-card h3 {
  margin: 0;
  color: var(--target);
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
}

.marker-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.marker-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  border: 1px solid #e0b38e;
  border-radius: 5px;
  padding: 3px 6px;
  color: var(--gene);
  background: var(--gene-soft);
  cursor: pointer;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
}

.marker-chip strong {
  font-size: 9px;
  font-weight: 700;
}

.marker-chip.marker-negative {
  border-color: #c6a4a0;
  color: var(--warning);
  background: #f9ecea;
}

.marker-chip.marker-mixed {
  border-color: #9da8ad;
  color: #3f4c52;
  background: #edf1f2;
}

.marker-chip.marker-shared {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.marker-chip:hover,
.marker-chip.is-active {
  border-color: var(--brand-dark);
  color: #fff;
  background: var(--brand-dark);
  box-shadow: none;
}

.aggregate-panel {
  margin-top: 9px;
}

.aggregate-panel .marker-list {
  margin-top: 0;
}

.inline-id {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.inline-id .identifier {
  font-size: inherit;
}

.gene-evidence {
  margin-top: 12px;
  padding: 12px;
  border-top: 2px solid var(--brand);
  background: #f7faf9;
}

.gene-evidence > header {
  padding-bottom: 9px;
}

.gene-evidence h4 {
  margin: 0;
  color: var(--brand-dark);
  font-size: 15px;
  line-height: 1.3;
  letter-spacing: 0;
}

.gene-evidence > header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.evidence-record {
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.evidence-statement {
  max-width: 95ch;
  margin: 5px 0 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.evidence-paper {
  display: block;
  width: fit-content;
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
}

.evidence-paper:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}

.evidence-source {
  margin-top: 7px;
}

.evidence-source > summary {
  width: fit-content;
  cursor: pointer;
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 700;
}

.show-evidence {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--brand-dark);
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.show-evidence:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.missing-context,
.unresolved {
  color: var(--warning);
  font-size: 11px;
}

.identifier {
  color: var(--brand-dark);
  font-size: 10px;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.identifier:hover {
  text-decoration: underline;
}

blockquote {
  margin: 6px 0 0;
  padding: 7px 9px;
  border-left: 3px solid var(--line-strong);
  color: var(--muted);
  background: #f7f9fa;
  font-size: 12px;
  line-height: 1.45;
}

.additional {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.note {
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  overflow: hidden;
}

.table-guide {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.table-guide a {
  font-weight: 700;
  text-decoration: none;
}

.table-guide a:hover {
  text-decoration: underline;
}

.table-controls {
  display: grid;
  grid-template-columns: 130px 130px 140px 170px minmax(240px, 1fr);
  gap: 9px;
  align-items: end;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  background: #fafbfb;
}

.table-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.pager {
  display: flex;
  align-items: center;
  gap: 7px;
}

.pager button {
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 5px 8px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font-size: 12px;
}

.pager button:hover:not(:disabled) {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.pager button:disabled {
  opacity: 0.45;
  cursor: default;
}

.table-scroll {
  max-height: 620px;
  overflow: auto;
}

table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px 9px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted);
  background: #edf2f3;
  text-align: left;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: uppercase;
}

tbody td {
  padding: 9px;
  border-bottom: 1px solid #e8edef;
  vertical-align: top;
  font-size: 12px;
  line-height: 1.4;
}

tbody tr:hover {
  background: #fafcfc;
}

.paper-cell {
  width: 240px;
}

.paper-cell > a {
  display: block;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
}

.paper-cell > a:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}

.entity-cell {
  width: 155px;
}

.entity-cell strong {
  color: var(--target);
}

.entity-cell:nth-child(3) strong {
  color: var(--gene);
}

.direction {
  margin-right: 3px;
  color: var(--gene);
  font-weight: 700;
}

.direction-negative {
  color: var(--warning);
}

.context-cell {
  width: 170px;
}

.statement-cell {
  width: 320px;
}

.text-panel > section {
  max-width: 900px;
  padding: 22px 24px;
}

.text-panel h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: 0;
}

.text-panel h2:not(:first-child) {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.text-panel p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

@media (max-width: 1000px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-search {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .page {
    padding: 14px;
  }

  .site-header {
    align-items: center;
  }

  .site-header h1 {
    font-size: 27px;
  }

  .tabs {
    overflow-x: auto;
  }

  .tab {
    min-width: 82px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .search-controls {
    grid-template-columns: 1fr;
  }

  .search-results {
    grid-template-columns: 1fr;
  }

  .table-scroll {
    max-height: 68vh;
  }
}

@media (max-width: 520px) {
  .page {
    padding: 10px;
  }

  .site-header p {
    font-size: 13px;
  }

  .table-controls {
    grid-template-columns: 1fr;
  }

  .table-search {
    grid-column: auto;
  }

  .text-panel > section {
    padding: 17px;
  }
}
