/* nuorigen compound explorer — white-ground, editorial-scientific.
   Restraint, hairlines, generous whitespace, one quiet accent. */

:root {
  --bg: #ffffff;
  --panel: #fbfcfd;
  --ink: #14171a;
  --ink-2: #434b52;
  --ink-3: #6b747c;
  --line: #e7eaee;
  --line-2: #eef1f4;
  /* nuorigen brand — deep plum, adapted from the white-on-purple logo for a
     light ground. */
  --accent: #3e1a4e;
  --accent-deep: #2a1138;
  --accent-soft: #f3edf8;
  --shadow: 0 1px 2px rgba(20, 23, 26, 0.04), 0 8px 24px rgba(20, 23, 26, 0.05);
  --shadow-hover: 0 2px 4px rgba(20, 23, 26, 0.05), 0 14px 40px rgba(20, 23, 26, 0.09);
  --radius: 14px;
  --radius-sm: 10px;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

.app {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

/* ---------- Brand wordmark ---------- */
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--accent); }
.brand-mark { width: 1.15em; height: auto; color: var(--accent); flex: none; }
.brand-text {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--accent);
}
.wordmark-lg { justify-content: center; }
.wordmark-lg .brand-text { font-size: 34px; }
.wordmark-lg .brand-mark { width: 38px; }
.hero-desc {
  font-family: var(--serif);
  font-style: italic;
  font-size: 19px;
  color: var(--ink-3);
  text-align: center;
  margin-top: 4px;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 32px;
  border-bottom: 1px solid var(--line-2);
}
.topbar .brand {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar .who { color: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; }
.topbar .signout {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-2);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.topbar .signout:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---------- Login gate ---------- */
.login-wrap {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
}
.login-card {
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 34px 30px;
  display: flex;
  flex-direction: column;
}
.login-head { text-align: center; margin-bottom: 26px; }
.login-mark { font-family: var(--serif); font-size: 30px; font-weight: 500; letter-spacing: -0.01em; }
.login-sub { color: var(--ink-3); font-style: italic; font-family: var(--serif); font-size: 16px; }
.login-label { font-size: 12px; font-weight: 600; letter-spacing: 0.03em; color: var(--ink-3); margin: 14px 0 6px; }
.login-input {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font: inherit;
  font-size: 15px;
  padding: 11px 14px;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-error { color: #b3261e; font-size: 13px; min-height: 18px; margin: 10px 0 2px; }
.login-btn {
  border: 0;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  padding: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.15s, transform 0.1s;
}
.login-btn:hover:not(:disabled) { background: var(--accent-deep); }
.login-btn:active { transform: scale(0.99); }
.login-btn:disabled { opacity: 0.6; cursor: default; }
.login-foot { color: var(--ink-3); font-size: 12px; text-align: center; margin-top: 18px; line-height: 1.5; }

/* ---------- Hero / search ---------- */
.hero { text-align: center; padding: 36px 0 30px; }
.hero h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 40px;
  letter-spacing: -0.01em;
  margin: 0;
}
.hero h1 span { color: var(--ink-3); font-style: italic; }
.tagline {
  color: var(--ink-3);
  font-size: 13.5px;
  letter-spacing: 0.02em;
  margin: 8px 0 26px;
  font-variant-numeric: tabular-nums;
}
.search {
  display: flex;
  max-width: 620px;
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.search:focus-within { border-color: #cfd6dc; box-shadow: var(--shadow-hover); }
.search input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 15px;
  padding: 15px 22px;
  color: var(--ink);
}
.search input::placeholder { color: var(--ink-3); }
.search button {
  border: 0;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 0 26px;
  margin: 5px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.search button:hover { background: var(--accent-deep); }
.search button:active { transform: scale(0.98); }

/* ---------- Featured ---------- */
.featured { margin: 14px 0 30px; }
.featured h2,
.grid-head h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 14px;
}
.featured-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.featured-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #fff, var(--accent-soft));
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.featured-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: #e3d4ee; }
.featured-cid { font-family: var(--mono); font-weight: 500; font-size: 14px; }
.featured-note { color: var(--ink-2); font-size: 13px; }
.featured-go { margin-left: auto; color: var(--accent); font-weight: 600; font-size: 13px; }

/* ---------- Grid ---------- */
.grid-head { display: flex; align-items: baseline; justify-content: space-between; margin: 6px 0 16px; }
.grid-meta { color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}
.card {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: #d9dee3; }
.card-struct {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background:
    radial-gradient(circle at 1px 1px, #eef1f4 1px, transparent 0) 0 0 / 16px 16px,
    var(--bg);
  border-bottom: 1px solid var(--line-2);
}
.card-struct svg { max-width: 100%; max-height: 100%; }
.card-body { padding: 14px 16px 16px; }
.card-name {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.35;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}
.card-meta { display: flex; align-items: baseline; gap: 10px; margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.card-meta .mw { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.card-cid { margin-top: 6px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.card.skel { pointer-events: none; }

/* ---------- Pager ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 34px; }
.pg {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.pg:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.pg-info { color: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------- Compound detail ---------- */
.back {
  display: inline-block;
  color: var(--ink-3);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 22px;
  transition: color 0.15s;
}
.back:hover { color: var(--accent); }
.cpd-head { margin-bottom: 26px; }
.cpd-cid {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.cpd-name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.18;
  letter-spacing: -0.01em;
  margin: 0;
  max-width: 26ch;
}
.cpd-grid { display: grid; grid-template-columns: 420px 1fr; gap: 28px; align-items: start; }

.structure-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow);
  position: sticky;
  top: 28px;
  overflow: hidden;
}
.structure {
  height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 1px 1px, #eef1f4 1px, transparent 0) 0 0 / 18px 18px,
    var(--bg);
  border-bottom: 1px solid var(--line-2);
}
.structure svg { max-width: 100%; max-height: 100%; }
.identifiers { margin: 0; padding: 18px 20px; display: grid; gap: 12px; }
.id-row { display: grid; grid-template-columns: 78px 1fr; gap: 12px; align-items: baseline; }
.id-row dt { color: var(--ink-3); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.id-row dd { margin: 0; min-width: 0; }
.id-row code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  word-break: break-all;
  line-height: 1.5;
}

.detail-col { display: grid; gap: 22px; }
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 22px 24px 24px;
}
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.panel-title {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 18px;
}
.panel-head .panel-title { margin: 0; }
.count-badge {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 3px 10px;
}

.props { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line-2); border-radius: var(--radius-sm); overflow: hidden; }
.prop { background: var(--bg); padding: 14px 16px; }
.prop dt { color: var(--ink-3); font-size: 11.5px; letter-spacing: 0.02em; margin-bottom: 5px; }
.prop dd { margin: 0; font-size: 16px; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.prop .unit { font-size: 11px; color: var(--ink-3); font-weight: 400; margin-left: 2px; }
.formula { letter-spacing: 0.01em; }
.formula sub { font-size: 0.72em; }

/* outcome proportion bar + chips */
.outcome-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; margin-bottom: 14px; background: var(--line-2); }
.outcome-bar span { display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.chip b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* results table */
.table-wrap { max-height: 460px; overflow: auto; border-radius: var(--radius-sm); border: 1px solid var(--line-2); }
table.results { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.results thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}
table.results td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.results tbody tr:last-child td { border-bottom: 0; }
table.results tbody tr:hover { background: var(--panel); }
.assay-name { color: var(--ink); max-width: 380px; }
.target { color: var(--ink-2); white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.outcome {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--c);
  white-space: nowrap;
}
.outcome::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); margin-right: 7px; }
.result-foot { margin-top: 12px; color: var(--ink-3); font-size: 12.5px; text-align: center; }

/* ---------- states ---------- */
.loading, .empty { color: var(--ink-3); padding: 40px 0; text-align: center; font-size: 14px; }
.loading.sm, .empty.sm { padding: 18px 0; }
.struct-missing { color: var(--ink-3); font-size: 13px; }
.struct-missing.sm { font-size: 18px; }
.struct-skeleton {
  width: 80%;
  height: 70%;
  border-radius: 12px;
  background: linear-gradient(100deg, #f2f4f6 30%, #e9edf0 50%, #f2f4f6 70%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
}
.struct-skeleton.sm { height: 60%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- footer ---------- */
.site-foot {
  max-width: 1120px;
  margin: 0 auto;
  padding: 26px 32px 40px;
  color: var(--ink-3);
  font-size: 12.5px;
  display: flex;
  gap: 10px;
  border-top: 1px solid var(--line-2);
}
.site-foot .sep { color: #c7ccd1; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .cpd-grid { grid-template-columns: 1fr; }
  .structure-card { position: static; }
  .props { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .app { padding: 28px 18px 60px; }
  .hero h1 { font-size: 32px; }
  .props { grid-template-columns: 1fr 1fr; }
}
