:root {
  /* One dark theme, in the style of hermeias.org: warm near-black, off-white text,
     Newsreader headlines over Inter body text, hairline borders. */
  color-scheme: dark;
  --serif: Newsreader, ui-serif, Georgia, serif;
  --sans: Inter, ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --bg: #0f0e0d;
  --surface: #151413;
  --surface-2: #1f1d1b;
  --border: rgb(250 250 249 / .1);
  --border-strong: rgb(250 250 249 / .25);
  --text: #fafaf9;
  --text-2: #b8b4ae;
  --text-3: #9a958e;
  --accent: #3987e5;
  --focus: #fafaf9;
  /* Cancer types, validated all-pairs for a scatter on a dark surface. */
  --cat-1: #256abf;
  --cat-2: #d95926;
  --cat-3: #199e70;
  --cat-4: #9085e9;
  --cat-5: #d55181;
  --cat-6: #008300;
  --mutated: #d95926;
  --wild: #6b6a64;
  --unknown: #3a3a37;
  --ord-1: #184f95;
  --ord-2: #2a78d6;
  --ord-3: #6da7ec;
  --ord-4: #b7d3f6;
  --ring: #fafaf9;
  --halo: #0f0e0d;
  --banner: #2a2418;
  --banner-text: #e9d9b0;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}
a { color: var(--text); text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--text); }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Header */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; background: var(--bg); border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--serif); font-size: 26px; line-height: 1; letter-spacing: -.02em; }
.brand em { font-style: italic; color: var(--text-3); }
.logo { display: none; }
.badge {
  font: 500 11px/1.6 var(--sans); padding: 1px 8px; border-radius: 4px;
  background: var(--banner); color: var(--banner-text);
}
.tabs { display: flex; gap: 4px; }
.tabs button {
  background: none; border: 0; padding: 6px 12px; border-radius: 4px; cursor: pointer; color: var(--text-3); font-size: 14px;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); box-shadow: inset 0 -1px 0 var(--text); border-radius: 0; }
.demo-banner {
  background: var(--banner); color: var(--banner-text); padding: 8px 16px; font-size: 14px;
}

main { flex: 1; min-height: 0; display: flex; }
.view { flex: 1; min-height: 0; }

/* Map view */
.map-view { display: grid; grid-template-columns: 1fr 360px; min-height: 0; }
.stage { position: relative; min-height: 0; background: var(--bg); overflow: hidden; }
#map { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#map.dragging { cursor: grabbing; }
.map-hint {
  position: absolute; left: 12px; bottom: 12px; font-size: 12px; color: var(--text-3);
  background: color-mix(in srgb, var(--bg) 85%, transparent); padding: 2px 8px; border-radius: 4px;
  pointer-events: none;
}
.zoom-buttons { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 4px; }
.zoom-buttons button {
  width: 34px; height: 34px; border-radius: 4px; border: 1px solid var(--border-strong);
  background: var(--bg); cursor: pointer; font-size: 18px; line-height: 1;
}
.zoom-buttons button:hover { background: var(--surface-2); }
.loading {
  position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-2); background: var(--bg); font-family: var(--serif); font-size: 22px; font-style: italic;
}
.tooltip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 4px;
  box-shadow: 0 8px 32px rgb(0 0 0 / .5); padding: 8px; display: flex; gap: 10px; align-items: center;
  max-width: 300px; font-size: 13px;
}
.tooltip img { width: 72px; height: 72px; border-radius: 2px; image-rendering: auto; flex: none; }
.tooltip .t-title { font-weight: 600; }
.tooltip .t-sub { color: var(--text-2); }

/* Side panel */
.panel {
  border-left: 1px solid var(--border); background: var(--surface); overflow-y: auto; min-height: 0;
  display: flex; flex-direction: column;
}
.controls { padding: 20px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-3); }
.field select, .field input {
  padding: 8px 10px; border-radius: 4px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--text);
  font-size: 14px; letter-spacing: normal; text-transform: none;
}
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.legend button {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 4px;
  border: 0; background: none; cursor: pointer; text-align: left;
}
.legend button:hover { background: var(--surface-2); }
.legend button[aria-pressed="false"] { opacity: .4; }
.legend button[aria-pressed="false"] .label { text-decoration: line-through; }
.swatch { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.legend .label { flex: 1; }
.legend .count, .stats, .hint-small, .muted { color: var(--text-3); font-size: 12px; }
.hint-small, .stats { margin: 0; }
.legend .count { font-variant-numeric: tabular-nums; }

.detail { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.empty { color: var(--text-2); }
.tile-head { display: flex; gap: 12px; align-items: flex-start; }
.tile-head img { width: 136px; height: 136px; border-radius: 2px; flex: none; background: var(--surface-2); }
.tile-head h2 { font: 400 24px/1.15 var(--serif); letter-spacing: -.02em; margin: 0 0 8px; }
.facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 13px; }
.facts dt { color: var(--text-3); }
.facts dd { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  font: 12px/1.6 var(--mono); padding: 1px 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border);
}
.row-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  padding: 8px 16px; border-radius: 4px; border: 1px solid var(--border-strong); background: transparent; cursor: pointer;
  font-size: 14px; text-decoration: none; color: var(--text);
}
.btn:hover { border-color: var(--text); }
.btn[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 500; }
.section-title { font-size: 13px; font-weight: 500; color: var(--text-3); margin: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.section-title .muted { font-weight: 400; letter-spacing: normal; text-transform: none; }
.similar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.similar button {
  padding: 0; border: 0; background: none; cursor: pointer; display: flex; flex-direction: column; gap: 2px;
  font-size: 13px; color: var(--text-2); text-align: left;
}
.similar img { width: 100%; aspect-ratio: 1; border-radius: 2px; display: block; background: var(--surface-2); }
.similar .bar { height: 3px; border-radius: 2px; }
.similar button:hover img { outline: 2px solid var(--ring); outline-offset: 1px; }
.check { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text-2); }

/* Prose pages */
.prose { overflow-y: auto; padding: 56px 20px 80px; }
.prose > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.eyebrow { font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 16px; }
.prose h1 { font: 400 clamp(40px, 7vw, 60px)/1.02 var(--serif); letter-spacing: -.02em; margin: 0 auto 24px; }
.prose h1 em, .prose h2 em { font-style: italic; color: var(--text-3); }
.prose .lede { font-size: 18px; line-height: 1.65; color: var(--text-2); }
.prose h2 { font: 400 32px/1.1 var(--serif); letter-spacing: -.02em; margin: 56px auto 12px; padding-top: 40px; border-top: 1px solid var(--border); }
.prose p, .prose li { color: var(--text-2); line-height: 1.7; }
.prose strong { color: var(--text); font-weight: 500; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 16px auto; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 20px; }
.card .big { font: 400 52px/1 var(--serif); letter-spacing: -.02em; margin: 8px 0 6px; font-variant-numeric: tabular-nums; }
.card .label { color: var(--text-3); font-size: 13px; font-weight: 500; }
.card .vs { color: var(--text-3); font-size: 13px; margin-top: 4px; }
.compare { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.compare .row { display: grid; grid-template-columns: 92px 1fr 44px; gap: 8px; align-items: center; font-size: 12px; color: var(--text-2); }
.compare .track { height: 10px; background: var(--surface-2); border-radius: 0 4px 4px 0; }
.compare .fill { height: 100%; border-radius: 0 4px 4px 0; background: var(--cat-1); }
.compare .fill.base { background: var(--wild); }
.compare .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
table.data { border-collapse: collapse; font-size: 13px; width: 100%; }
table.data th, table.data td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; }
table.data td.n { font-family: var(--mono); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
table.data th { color: var(--text-2); font-weight: 500; }
table.data tr:first-child th { color: var(--text-3); font-size: 13px; }
.table-wrap { overflow-x: auto; }
.confusion td.cell { text-align: center; font-variant-numeric: tabular-nums; min-width: 56px; }

@media (max-width: 760px) {
  body { height: auto; min-height: 100%; }
  main { display: block; }
  .map-view { display: flex; flex-direction: column; }
  .stage { height: 62vh; min-height: 340px; }
  .panel { border-left: 0; border-top: 1px solid var(--border); overflow: visible; }
  .tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .tabs button { padding: 6px 8px; white-space: nowrap; flex: none; }
  .similar { grid-template-columns: repeat(3, 1fr); }
}

/* Solid and quiet button variants */
.btn-solid { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 500; }
.btn-solid:hover { background: #e7e5e2; }
.btn-quiet { border-color: transparent; color: var(--text-3); }
.btn-quiet:hover { color: var(--text); border-color: transparent; }
.btn-big { padding: 12px 24px; font-size: 16px; }
.btn:disabled { opacity: .4; cursor: default; }

/* Map: tour and constellation controls */
.stage-actions { position: absolute; left: 16px; top: 16px; display: flex; gap: 8px; flex-wrap: wrap; z-index: 2; }
.stage-actions .btn:not(.btn-solid) { background: color-mix(in srgb, var(--bg) 80%, transparent); color: var(--text); font-weight: 400; }
.stage-actions .btn[aria-pressed="true"]::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--text); margin-right: 8px; vertical-align: 2px; }
.stage-actions .btn[aria-pressed="false"] { color: var(--text-3); }
.tour {
  position: absolute; left: 16px; bottom: 16px; z-index: 3; max-width: 420px;
  background: var(--bg);
  border: 1px solid var(--border-strong); border-radius: 4px; padding: 20px;
}
.tour h2 { font: 400 28px/1.1 var(--serif); letter-spacing: -.02em; margin: 0 0 8px; }
.tour p { margin: 0 0 14px; color: var(--text-2); font-size: 14px; }
.tour .tour-step { margin: 0 0 8px; font-size: 13px; font-weight: 500; color: var(--text-3); }

/* Live data from the GDC */
.live .section-title { justify-content: flex-start; align-items: center; }
.live .facts { margin-top: 8px; }
.live p { margin: 0; }
.live-line { color: var(--text-2); }
.tile-open { padding: 0; border: 0; background: none; cursor: zoom-in; flex: none; }
.tile-open img { display: block; }
.tile-open:hover img { outline: 1px solid var(--text); outline-offset: 2px; }

/* Whole slide viewer */
.slide-viewer {
  width: min(1200px, calc(100vw - 32px)); height: min(860px, calc(100vh - 32px)); max-width: none; max-height: none;
  padding: 0; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--bg); color: var(--text);
  display: none; flex-direction: column;
}
.slide-viewer[open] { display: flex; }
.slide-viewer::backdrop { background: rgb(0 0 0 / .7); }
.sv-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.sv-head .eyebrow { margin: 0 0 6px; }
.sv-head h2 { font: 400 26px/1.1 var(--serif); letter-spacing: -.02em; margin: 0; }
.sv-head h2 em { color: var(--text-3); }
.sv-stage { position: relative; flex: 1; min-height: 0; background: #000; }
#osd { position: absolute !important; inset: 0; }  /* OpenSeadragon sets position: relative inline */
.sv-status { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; font: italic 22px var(--serif); color: var(--text-2); pointer-events: none; }
.sv-foot { margin: 0; padding: 10px 20px; font-size: 12px; border-top: 1px solid var(--border); }
.sv-mark { border: 2px solid #fff; box-shadow: 0 0 0 2px rgb(0 0 0 / .6), 0 0 24px rgb(255 255 255 / .5); }
.sv-mark.sv-other { border: 1px solid rgb(255 255 255 / .45); box-shadow: none; }

/* Game */
#game > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.g-score {
  display: flex; gap: 24px; justify-content: flex-start; font-size: 12px; font-weight: 500; color: var(--text-3); padding-bottom: 16px; margin-bottom: 24px; border-bottom: 1px solid var(--border);
}
.g-score strong { color: var(--text); font: 400 20px var(--serif); letter-spacing: 0; margin-left: 6px; }
.g-round { display: grid; grid-template-columns: minmax(0, 360px) 1fr; gap: 32px; align-items: start; }
.g-tile img { width: 100%; aspect-ratio: 1; display: block; border-radius: 2px; image-rendering: auto; }
.g-side h2 { font: 400 32px/1.1 var(--serif); letter-spacing: -.02em; margin: 0 0 16px; padding: 0; border: 0; }
.g-options { display: grid; gap: 8px; margin-bottom: 20px; }
.g-opt { text-align: left; padding: 12px 16px; font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.g-opt:disabled { opacity: 1; cursor: default; color: var(--text-3); }
.g-opt.g-right { border-color: var(--cat-3); color: var(--text); background: color-mix(in srgb, var(--cat-3) 18%, transparent); }
.g-opt.g-wrong { border-color: var(--cat-2); color: var(--text); background: color-mix(in srgb, var(--cat-2) 18%, transparent); }
.g-ai { font: 500 11px/1.6 var(--sans); padding: 0 6px; border: 1px solid var(--border-strong); border-radius: 4px; color: var(--text-2); }
.g-verdict { font: 400 22px/1.3 var(--serif); color: var(--text) !important; margin: 0 0 6px; }
#g-reveal .live { margin: 16px 0; padding: 14px 16px; border: 1px solid var(--border); border-radius: 4px; }
.g-recap { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 24px auto; }
.g-recap button { padding: 0; border: 0; background: none; cursor: pointer; display: flex; flex-direction: column; gap: 2px; text-align: left; font-size: 12px; }
.g-recap img { width: 100%; aspect-ratio: 1; border-radius: 2px; display: block; margin-bottom: 4px; }
.g-recap .ok { color: var(--text); }
.g-recap .no { color: var(--text-3); text-decoration: line-through; }

@media (max-width: 760px) {
  .tour { left: 8px; right: 8px; bottom: 8px; max-width: none; padding: 12px 14px; }
  .tour h2 { font-size: 20px; margin-bottom: 4px; }
  .tour p { font-size: 13px; line-height: 1.45; margin-bottom: 10px; }
  .tour .btn { padding: 6px 12px; font-size: 13px; }
  .stage { height: 70vh; }
  .g-round { grid-template-columns: 1fr; gap: 20px; }
  .g-tile { width: min(100%, 42vh); margin: 0 auto; }
  .g-recap { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .slide-viewer { width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
  .sv-head { padding: 12px 16px; }
  .sv-head h2 { font-size: 20px; }
}

/* News */
.tabs button.has-new::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--cat-3); margin-left: 6px; vertical-align: 3px; }
.news-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px auto 8px; }
.news-filters .count { color: var(--text-3); margin-left: 4px; font-variant-numeric: tabular-nums; }
.news-filters .btn[aria-pressed="true"] .count { color: var(--bg); opacity: .7; }
ol.news { list-style: none; padding: 0; margin: 8px auto 32px; }
ol.news li { padding: 28px 0; border-bottom: 1px solid var(--border); }
ol.news h2 { font: 400 24px/1.2 var(--serif); letter-spacing: -.01em; margin: 6px 0 8px; padding: 0; border: 0; }
ol.news h2 a { text-decoration: none; }
ol.news h2 a:hover { text-decoration: underline; text-decoration-color: var(--border-strong); }
ol.news p { margin: 0; }
.news-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; font-weight: 500; color: var(--text-3); }
.news-by { font-size: 13px; color: var(--text-3) !important; margin-bottom: 6px !important; }
.news-tag { color: var(--text); border: 1px solid var(--border-strong); border-radius: 4px; padding: 0 6px; letter-spacing: .08em; }
@media (max-width: 760px) { ol.news h2 { font-size: 20px; } }

/* Kicker above the slide viewer title, and the site footer (hidden on the full height map). */
.sv-kicker { margin: 0 0 4px; font-size: 13px; color: var(--text-3); }
.site-foot { border-top: 1px solid var(--border); padding: 20px; }
.site-foot p { max-width: 760px; margin: 0 auto; font-size: 13px; color: var(--text-3); }
.site-foot .foot-name { font-family: var(--serif); font-size: 16px; color: var(--text-2); }
body[data-view="map"] .site-foot, body:not([data-view]) .site-foot { display: none; }
@media (max-width: 760px) { body[data-view="map"] .site-foot, body:not([data-view]) .site-foot { display: block; } }

/* The model's reading of a whole slide */
.sv-mark { --c: #fff; }
.sv-reading-on .sv-mark { background: color-mix(in srgb, var(--c) 55%, transparent); border: 2px solid var(--c); box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 45%, transparent); }
.sv-reading-on .sv-mark:not(.sv-other) { border: 3px solid #fff; box-shadow: 0 0 0 2px rgb(0 0 0 / .6); }
.sv-reading { margin: 0; padding: 10px 20px 0; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 13px; color: var(--text-2); border-top: 1px solid var(--border); }
.sv-read-item { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-variant-numeric: tabular-nums; }

/* Journey between two cancers */
.journey { position: absolute; left: 16px; right: 16px; bottom: 16px; z-index: 3; background: var(--bg);
  border: 1px solid var(--border-strong); border-radius: 4px; padding: 16px; max-width: 760px; }
.journey-main { display: grid; grid-template-columns: 132px 1fr; gap: 16px; align-items: start; }
.journey-main img { width: 132px; height: 132px; border-radius: 2px; display: block; }
.journey h2 { font: 400 24px/1.15 var(--serif); margin: 0 0 6px; }
.journey p { margin: 0 0 10px; color: var(--text-2); font-size: 14px; }
.journey .tour-step { font-size: 13px; color: var(--text-3); margin-bottom: 4px; }
.journey-strip { display: flex; gap: 4px; overflow-x: auto; margin-top: 12px; padding-bottom: 2px; scrollbar-width: thin; }
.journey-strip button { flex: none; padding: 0; border: 2px solid transparent; background: none; cursor: pointer; border-radius: 2px; }
.journey-strip button.on { border-color: var(--text); }
.journey-strip img { width: 44px; height: 44px; display: block; }
select.btn { appearance: auto; }
@media (max-width: 760px) {
  .journey { left: 8px; right: 8px; bottom: 8px; padding: 12px; }
  .journey-main { grid-template-columns: 84px 1fr; gap: 12px; }
  .journey-main img { width: 84px; height: 84px; }
  .journey h2 { font-size: 18px; }
  .journey .btn { padding: 5px 10px; font-size: 13px; }
}

/* 3-D star field */
#sky { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#sky[hidden] { display: none; }
#map[hidden] { display: none; }

/* Dropping an image on the map */
.stage.drop::after { content: "Drop the image to search"; position: absolute; inset: 12px; display: grid; place-items: center;
  border: 2px dashed var(--border-strong); border-radius: 4px; background: color-mix(in srgb, var(--bg) 70%, transparent);
  font: italic 24px var(--serif); color: var(--text); pointer-events: none; z-index: 4; }
