@font-face {
  font-family: rubrik;
  src: url(rubrik-regular-webfont.ttf) format("truetype");
  font-display: swap;
}

/* Palette from the original KnowYourCG site: teal accent, CHOP blue, warm text */
:root {
  --teal: #26778b;
  --teal-bright: #33a0bb;
  --teal-soft: #eaf6f9;
  --blue: #005587;
  --text: #2d2a26;
  --text-warm: #665546;
  --muted: #6f6a63;
  --border: #dde6ea;
  --surface: #ffffff;
  --page: #f6f9fa;
  --ok: #4f7a1f;
  --warn: #b0175a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 42, 56, .06), 0 8px 24px rgba(16, 42, 56, .07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: rubrik, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--page);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--blue); text-decoration: underline; }
h1, h2, h3 { font-weight: normal; margin: 0; }

/* ---- header and hero ---------------------------------------------------- */

.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand img { height: 38px; display: block; }
.top-nav { display: flex; align-items: center; gap: 6px; }
.site-name { font-size: 1.5rem; color: var(--text-warm); letter-spacing: .01em; margin-right: 14px; }
.nav-link {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px;
  color: var(--teal); font-size: .92rem; border: 1px solid transparent;
}
.nav-link:hover { text-decoration: none; color: var(--teal); background: var(--teal-soft); border-color: var(--border); }

.hero {
  color: #fff;
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(51, 160, 187, .55), transparent 60%),
    linear-gradient(120deg, var(--blue) 0%, var(--teal) 100%);
  padding: 22px 0 60px;
}
.eyebrow {
  margin: 0 0 4px; font-size: .75rem; letter-spacing: .14em; text-transform: uppercase;
  color: rgba(255, 255, 255, .78);
}
.hero h1 { font-size: clamp(1.4rem, 2.4vw, 1.75rem); line-height: 1.2; }
.tagline { font-size: 1.02rem; margin: 6px 0 0; color: rgba(255, 255, 255, .92); }
.lede { max-width: 820px; margin: 6px 0 0; font-size: .92rem; color: rgba(255, 255, 255, .78); }

.title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
.stats { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.stats li {
  display: flex; align-items: baseline; gap: 6px;
  padding: 6px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22);
}
.stats b { font-weight: normal; font-size: 1.1rem; line-height: 1.2; }
.stats span { font-size: .8rem; color: rgba(255, 255, 255, .82); }
.stats li a { display: flex; align-items: baseline; gap: 6px; color: inherit; text-decoration: none; }
.stats li:has(a):hover { background: rgba(255, 255, 255, .22); }
.stats li a span { text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .5); text-underline-offset: 3px; }

/* result summary keeps the larger stacked tiles */
.summary li { flex-direction: column; align-items: flex-start; gap: 0; min-width: 120px; padding: 10px 16px; border-radius: 12px; }
.summary b { font-size: 1.5rem; }

/* ---- cards and form ----------------------------------------------------- */

main { padding-bottom: 32px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.form-card { margin-top: -44px; position: relative; padding: 8px 32px 28px; }

.step { scroll-margin-top: 76px; padding: 24px 0; border-bottom: 1px solid var(--border); }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.step-num {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--teal-soft); color: var(--teal); font-size: .95rem;
}
.step h2 { font-size: 1.3rem; color: var(--blue); }

.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
label { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-warm); }

.query-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 24px; align-items: stretch; }
.or { display: flex; flex-direction: column; align-items: center; color: var(--muted); font-size: .85rem; }
.or::before, .or::after { content: ""; flex: 1; width: 1px; background: var(--border); }
.or span { padding: 8px 0; text-transform: uppercase; letter-spacing: .1em; }

textarea, select {
  font: inherit; color: var(--text); background: #fff;
  border: 1px solid var(--border); border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
textarea {
  width: 100%; resize: vertical; min-height: 180px; padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem;
}
textarea:focus, select:focus {
  outline: none; border-color: var(--teal-bright);
  box-shadow: 0 0 0 4px rgba(51, 160, 187, .18);
}

.dropzone {
  flex: 1; min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 20px; text-align: center; cursor: pointer;
  border: 1.5px dashed #b8cfd8; border-radius: 10px; background: var(--teal-soft);
  text-transform: none; letter-spacing: 0; color: var(--text);
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--teal-bright); background: #ddf0f5; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone:focus-within { box-shadow: 0 0 0 4px rgba(51, 160, 187, .18); }
.dz-title { font-size: 1rem; }
.dz-title u { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.dz-sub { font-size: .82rem; color: var(--muted); }
.dropzone.loaded .dz-sub { color: var(--ok); }

.ic { width: 16px; height: 16px; flex: none; }
.ic-lg { width: 30px; height: 30px; color: var(--teal); }
.link-row { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.examples { margin-top: 6px; padding-top: 10px; border-top: 1px dashed var(--border); display: flex; flex-direction: column; gap: 6px; }
.ex-label { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-warm); }
.ex-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; font-size: .9rem; }
.ex-name { flex: 1 1 220px; }
.ex-name .hint { display: block; font-size: .78rem; }
.ex-row a { display: inline-flex; align-items: center; gap: 4px; }
.file-btn { cursor: pointer; color: var(--teal); text-transform: none; letter-spacing: 0; font-size: .92rem; }
.file-btn:hover { color: var(--blue); text-decoration: underline; }
.file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-btn:focus-within { outline: 2px solid var(--teal-bright); outline-offset: 2px; border-radius: 4px; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; font-size: .92rem; align-self: flex-start; }

.pill-count {
  font-size: .8rem; padding: 2px 10px; border-radius: 999px;
  background: var(--teal-soft); color: var(--teal);
}

.options-grid { display: grid; grid-template-columns: minmax(220px, 1fr) 2.2fr; gap: 28px; }
.select-wrap { position: relative; }
.select-wrap::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px; margin-top: -6px;
  border-right: 2px solid var(--teal); border-bottom: 2px solid var(--teal); transform: rotate(45deg);
  pointer-events: none;
}
select { width: 100%; appearance: none; padding: 11px 40px 11px 14px; font-size: 1rem; cursor: pointer; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: #fff;
  font-size: .9rem; letter-spacing: 0; text-transform: none; color: var(--text);
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--teal-bright); }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  border: 1.5px solid #a9bcc4; transition: background .15s, border-color .15s;
}
.chip:has(input:checked) { background: var(--teal); border-color: var(--teal); color: #fff; }
.chip:has(input:checked)::before { background: #fff; border-color: #fff; }
.chip:has(input:focus-visible) { box-shadow: 0 0 0 4px rgba(51, 160, 187, .25); }

.hint { font-size: .85rem; color: var(--muted); }
.universe-row { margin-top: 18px; }
.groups-help { margin: 0 0 2px; }
.group-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.group-actions button {
  font: inherit; font-size: .8rem; cursor: pointer; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: #fff; color: var(--teal);
}
.group-actions button:hover { border-color: var(--teal-bright); background: var(--teal-soft); }
.universe-help { margin: 0 0 4px; max-width: 70ch; line-height: 1.5; }
.summary-note { margin: -8px 0 18px; }
textarea:disabled { background: #f3f6f7; color: var(--muted); }
.cg-badge {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  font-size: .85rem; padding: 4px 6px 4px 12px; border-radius: 999px;
  background: var(--teal-soft); color: var(--teal);
}
.cg-badge button {
  border: 0; background: #fff; color: var(--teal); border-radius: 999px;
  width: 22px; height: 22px; cursor: pointer; font: inherit; line-height: 1;
}
.hint.ok { color: var(--ok); }
.hint.warn { color: var(--warn); }
.hint.error { color: #b00020; }

.submit-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding-top: 24px; }
button.primary {
  display: inline-flex; align-items: center; gap: 10px;
  font: inherit; font-size: 1.05rem; color: #fff; cursor: pointer;
  padding: 13px 30px; border: 0; border-radius: 999px;
  background: linear-gradient(120deg, var(--teal) 0%, var(--teal-bright) 100%);
  box-shadow: 0 6px 16px rgba(38, 119, 139, .28);
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
button.primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(38, 119, 139, .32); }
button.primary:disabled { opacity: .45; cursor: default; box-shadow: none; }
button.secondary {
  display: inline-flex; align-items: center; gap: 10px; font: inherit; font-size: 1rem; cursor: pointer;
  padding: 12px 24px; border-radius: 999px; border: 1.5px solid var(--teal); background: #fff; color: var(--teal);
  transition: background .15s, opacity .15s;
}
button.secondary:hover:not(:disabled) { background: var(--teal-soft); }
button.secondary:disabled { opacity: .45; cursor: default; }
button.secondary .spinner { border-color: rgba(38,119,139,.3); border-top-color: var(--teal); }
.annot-card { margin-top: 32px; padding: 22px 24px; scroll-margin-top: 90px; }
.table-wrap { max-height: 480px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.table-wrap table { border-collapse: collapse; width: 100%; font-size: .85rem; }
.table-wrap th, .table-wrap td { padding: 6px 10px; border-bottom: 1px solid #eef3f5; text-align: left; white-space: nowrap; }
.table-wrap th { position: sticky; top: 0; background: var(--teal-soft); color: var(--text-warm); font-weight: normal; }
.table-wrap td:first-child { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.table-wrap td.na { color: #b3b0ab; }
.table-wrap td.num { text-align: right; font-variant-numeric: tabular-nums; }
#genes-card .table-wrap { max-height: 420px; margin-bottom: 10px; }
#genes-table td:first-child { font-family: inherit; }
.spinner {
  display: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: spin .8s linear infinite;
}
button.busy .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- command line ------------------------------------------------------ */

.cli-card { margin-top: 24px; padding: 18px 24px; }
.cli-card summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cli-card summary::-webkit-details-marker { display: none; }
.cli-card summary::after {
  content: ""; width: 9px; height: 9px; flex: none; margin-right: 6px;
  border-right: 2px solid var(--teal); border-bottom: 2px solid var(--teal);
  transform: rotate(45deg); transition: transform .15s;
}
.cli-card[open] summary::after { transform: rotate(-135deg); }
.cli-card h2 { font-size: 1.15rem; color: var(--blue); margin-bottom: 2px; }
.cli-body { margin-top: 14px; }
.cli-body pre {
  margin: 0 0 12px; padding: 16px 18px; overflow-x: auto; border-radius: 10px;
  background: #0f2a36; color: #e6f1f4; font-size: .85rem; line-height: 1.6;
}
.cli-body code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.cli-body .c { color: #8fb6c2; }
p code, .hint code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }

/* ---- results ------------------------------------------------------------ */

#results { margin-top: 40px; scroll-margin-top: 90px; }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.results-head h2 { font-size: 1.8rem; color: var(--blue); }
.summary { margin: 16px 0 20px; }
.results-actions { display: flex; gap: 8px; flex-wrap: wrap; }
button.dl { font: inherit; font-size: .85rem; cursor: pointer; }
.methods-box {
  margin: 12px 0 4px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); display: flex; gap: 14px; align-items: flex-start;
}
.methods-box p { margin: 0; flex: 1; font-size: .9rem; line-height: 1.55; color: var(--text); }
.summary li { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow); }
.summary b { color: var(--teal); }
.summary span { color: var(--muted); }

.plot-card { padding: 22px 24px 12px; margin-bottom: 24px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 8px; }
.card-head h3 { font-size: 1.2rem; color: var(--text-warm); }
.card-head .hint { margin: 4px 0 0; }

.dl {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  font-size: .85rem; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: #fff; color: var(--teal);
}
.dl:hover { text-decoration: none; border-color: var(--teal-bright); background: var(--teal-soft); }

.plot { width: 100%; min-height: 460px; }
.plot-short { min-height: 360px; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.tabs button {
  font: inherit; font-size: .9rem; cursor: pointer;
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; color: var(--teal); transition: background .15s, color .15s, border-color .15s;
}
.tabs button:hover { border-color: var(--teal-bright); }
.tabs button.active { background: var(--teal-bright); border-color: var(--teal-bright); color: #fff; }

/* ---- footer ------------------------------------------------------------- */

.site-footer { margin-top: 56px; background: var(--blue); color: rgba(255, 255, 255, .85); font-size: .85rem; }
.footer-inner { display: flex; gap: 32px; align-items: flex-start; flex-wrap: wrap; padding-top: 28px; padding-bottom: 28px; }
.site-footer img { width: 200px; display: block; }
.site-footer p { margin: 0 0 6px; }
.site-footer a { color: #fff; }
.footer-cite { color: rgba(255, 255, 255, .7); font-size: .8rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 10px !important; }

@media (max-width: 600px) {
  .header-inner { height: auto; flex-wrap: wrap; gap: 2px 8px; padding-top: 8px; padding-bottom: 6px; }
  .top-nav { flex-wrap: wrap; gap: 0; margin-left: -8px; }
  .nav-link { padding: 4px 8px; font-size: .85rem; }
  .site-header { position: static; }
}

@media (max-width: 820px) {
  .query-grid, .options-grid { grid-template-columns: 1fr; }
  .or { flex-direction: row; }
  .or::before, .or::after { height: 1px; width: auto; }
  .or span { padding: 0 12px; }
  .form-card { padding: 4px 18px 22px; }
  .hero { padding: 22px 0 60px; }
  .site-name { display: none; }
  .nav-link { padding: 6px 10px; }
  .brand img { height: 36px; }
}
