:root {
  color-scheme: light;
  --bg: #f6f7f2;
  --surface: #ffffff;
  --surface-muted: #eef2ea;
  --surface-warm: #f7f1e6;
  --ink: #1e241d;
  --muted: #667064;
  --line: #dce3d7;
  --root: #2f6f3e;
  --phenotyping: #315f8f;
  --priority: #9b5a1a;
  --accent: #2f6f3e;
  --accent-soft: #e2eee1;
  --shadow: 0 18px 50px rgba(28, 36, 26, 0.08);
  --radius: 8px;
}

:root.dark {
  color-scheme: dark;
  --bg: #131711;
  --surface: #1e241c;
  --surface-muted: #283025;
  --surface-warm: #302a20;
  --ink: #f1f4ee;
  --muted: #abb6a5;
  --line: #354031;
  --root: #86c987;
  --phenotyping: #8db7e8;
  --priority: #e0b16d;
  --accent: #86c987;
  --accent-soft: #243923;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  line-height: 1.55;
}

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

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 72px;
  padding: 14px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg), transparent 10%);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: fit-content;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  line-height: 1.05;
  letter-spacing: 0;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(360px, 42vw);
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

main {
  width: min(1240px, calc(100% - 36px));
  margin: 0 auto;
  padding: 30px 0 44px;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(96px, 1fr));
  gap: 8px;
  min-width: min(100%, 390px);
}

.stat {
  display: grid;
  gap: 2px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat span {
  color: var(--muted);
  font-size: 12px;
}

.stat strong {
  font-size: 20px;
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(34px, 4.5vw, 56px);
  line-height: 1;
  letter-spacing: 0;
}

.summary {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
}

.view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.tab {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}

.tab.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.journal-watch {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.journal-watch h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.2;
}

.journal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.journal-chip {
  display: grid;
  gap: 2px;
  min-height: 66px;
  max-width: 260px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--ink);
  text-align: left;
}

.journal-chip strong {
  font-size: 13px;
  line-height: 1.15;
}

.journal-chip span,
.journal-chip small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.literature-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.paper-list {
  display: grid;
  gap: 10px;
}

.batch-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 0 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.batch-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.batch-heading strong {
  color: var(--accent);
  font-size: 13px;
}

.paper-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 12px;
  align-items: center;
  min-height: 142px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.paper-row:hover,
.paper-row.active {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent), var(--line) 28%);
  box-shadow: var(--shadow);
}

.paper-row.is-hidden {
  display: none;
}

.paper-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.tag.root {
  background: color-mix(in srgb, var(--root), transparent 84%);
  color: var(--root);
}

.tag.phenotyping {
  background: color-mix(in srgb, var(--phenotyping), transparent 84%);
  color: var(--phenotyping);
}

.tag.priority {
  background: color-mix(in srgb, var(--priority), transparent 84%);
  color: var(--priority);
}

time {
  color: var(--muted);
  font-size: 13px;
}

.paper-row h2 {
  margin-bottom: 8px;
  font-size: 19px;
  line-height: 1.28;
  letter-spacing: 0;
}

.paper-row p {
  margin-bottom: 0;
  color: var(--muted);
}

.paper-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.paper-metrics span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.open-paper {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--ink);
}

.paper-detail {
  position: sticky;
  top: 92px;
  min-height: calc(100vh - 128px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  max-height: calc(100vh - 110px);
  overflow: auto;
}

.list-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 260px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.list-empty strong {
  color: var(--ink);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 460px;
  text-align: center;
  color: var(--muted);
}

.empty-state svg {
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  color: var(--accent);
}

.empty-state h2 {
  margin-bottom: 8px;
  color: var(--ink);
}

.detail-header {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.detail-header h2 {
  margin: 12px 0;
  font-size: 25px;
  line-height: 1.22;
  letter-spacing: 0;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  color: var(--muted);
  font-size: 13px;
}

.quality-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 2px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-warm);
}

.quality-panel h3 {
  margin-bottom: 0;
  font-size: 15px;
}

.doi-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  color: var(--accent);
  font-weight: 700;
}

.paper-figure {
  overflow: hidden;
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.paper-figure img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: #ffffff;
}

.paper-figure figcaption {
  padding: 9px 12px;
  color: var(--muted);
  font-size: 12px;
}

.paper-figure.placeholder {
  display: grid;
  gap: 0;
}

.paper-figure.placeholder div {
  display: grid;
  place-items: center;
  min-height: 190px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.paper-figure.placeholder svg {
  width: 34px;
  height: 34px;
  margin-bottom: 10px;
  color: var(--accent);
}

.detail-section {
  display: grid;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.detail-section h3 {
  margin-bottom: 0;
  font-size: 15px;
  letter-spacing: 0;
}

.detail-section p {
  margin-bottom: 0;
  color: var(--muted);
}

.detail-section:last-child {
  border-bottom: 0;
}

.keyword-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.keyword-list span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.site-footer {
  display: flex;
  justify-content: center;
  margin-top: 10px;
  padding: 22px 12px 32px;
  border-top: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.site-footer a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer a:hover {
  color: var(--accent);
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

@media (max-width: 980px) {
  .site-header,
  .toolbar {
    align-items: start;
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
    margin-left: 0;
  }

  .search-box {
    flex: 1;
    width: auto;
  }

  .literature-layout {
    grid-template-columns: 1fr;
  }

  .filter-bar,
  .journal-watch {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .paper-detail {
    position: static;
    min-height: 0;
  }
}

@media (max-width: 640px) {
  main {
    width: min(100% - 24px, 1240px);
    padding-top: 22px;
  }

  .site-header {
    padding: 12px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .journal-chip {
    max-width: none;
    width: 100%;
  }

  .paper-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .open-paper {
    width: 100%;
  }
}
