:root {
  color-scheme: dark;
  --bg: #03060a;
  --bg-soft: #080d14;
  --surface: #15171d;
  --surface-2: #10141b;
  --border: #2b3039;
  --text: #f5f7fb;
  --muted: #b5b8bf;
  --muted-2: #8e949d;
  --chip: #1a2739;
  --chip-text: #9fc4f4;
  --accent: #f2b84b;
  --blue: #6fb7ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 47% 0%, rgba(47, 80, 126, 0.14), transparent 28%),
    linear-gradient(90deg, #02050a 0%, #070b12 50%, #02050a 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(3, 6, 10, 0.86);
  backdrop-filter: blur(16px);
}

.header-inner,
.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid #4a5669;
  border-radius: 999px;
  color: var(--blue);
  font-size: 1.45rem;
  font-weight: 900;
}

.brand strong {
  display: block;
  font-size: 1.72rem;
  line-height: 0.95;
  letter-spacing: 0;
}

.brand small {
  display: block;
  color: var(--blue);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.36em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.site-nav a {
  color: inherit;
  text-decoration: none;
}

.site-nav .is-active {
  color: #ffffff;
}

.nav-button {
  min-height: 40px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.app-shell {
  padding: 22px 0 64px;
}

.hero {
  max-width: 680px;
  padding-top: 14px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.18em;
}

h1 {
  margin: 0;
  max-width: 580px;
  font-size: clamp(2.6rem, 5vw, 4.35rem);
  line-height: 0.98;
  font-weight: 920;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 620px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.45;
  font-weight: 650;
}

.search-panel {
  margin-bottom: 22px;
}

.research-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field span {
  color: var(--muted-2);
  font-size: 0.75rem;
  font-weight: 850;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #3a404b;
  border-radius: 6px;
  background: #17191f;
  color: var(--text);
  font: inherit;
  font-size: 0.98rem;
  font-weight: 650;
  padding: 12px 16px;
  outline: none;
}

input:focus,
select:focus {
  border-color: #83b7ff;
  box-shadow: 0 0 0 2px rgba(95, 151, 226, 0.2);
}

.primary-button,
.filter-chip,
.source-link,
.read-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #0d1118;
  color: #ffffff;
  font: inherit;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.primary-button {
  gap: 8px;
  min-height: 48px;
  padding: 12px 18px;
  background: #121924;
}

.primary-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.filter-chip {
  min-height: 40px;
  padding: 9px 14px;
  color: var(--muted);
  background: #17191f;
}

.filter-chip.is-active {
  border-color: #8bbfff;
  color: #ffffff;
  background: #182537;
}

.run-status {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--muted-2);
  font-size: 0.86rem;
  font-weight: 650;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.paper-card {
  display: flex;
  flex-direction: column;
  min-height: 390px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.01)), var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.card-visual {
  display: grid;
  place-items: center;
  min-height: 132px;
  margin-bottom: 16px;
  border-radius: 7px;
  background:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.22), transparent 22%),
    linear-gradient(135deg, var(--card-a, #4b3b88), var(--card-b, #08101a));
}

.card-code {
  color: #ffffff;
  font-size: clamp(2.1rem, 4vw, 3.1rem);
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0;
}

.tag-row,
.evidence-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-row {
  margin-bottom: 16px;
}

.source-pill,
.evidence-pill,
.oa-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  max-width: 100%;
  padding: 5px 9px;
  border-radius: 4px;
  background: var(--chip);
  color: var(--chip-text);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.paper-card h2 {
  margin: 0;
  color: #ffffff;
  font-size: 1.18rem;
  line-height: 1.25;
  font-weight: 900;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.abstract {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
  font-weight: 650;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.journal {
  margin: 10px 0 0;
  color: #7f8792;
  font-size: 0.8rem;
  line-height: 1.4;
  font-weight: 750;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
}

.source-link,
.read-button {
  min-height: 40px;
  padding: 9px 13px;
  font-size: 0.93rem;
  background: #0b1017;
}

.read-button {
  min-width: 48px;
}

.empty-state {
  margin: 28px 0 0;
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 7px;
  color: var(--muted);
  text-align: center;
}

.modal-open {
  overflow: hidden;
}

.reader-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
}

.reader-modal[hidden] {
  display: none;
}

.reader-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(10px);
}

.reader-panel {
  position: relative;
  width: min(860px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  padding: 26px;
  border: 1px solid #343b47;
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 0%, rgba(87, 128, 190, 0.16), transparent 30%),
    #14171e;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5);
}

.reader-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.reader-head .eyebrow {
  margin-bottom: 10px;
}

.reader-head h2 {
  margin: 0;
  max-width: 720px;
  color: #ffffff;
  font-size: clamp(1.5rem, 3vw, 2.35rem);
  line-height: 1.08;
  font-weight: 940;
}

.reader-original-title {
  max-width: 720px;
  margin: 10px 0 0;
  color: #8f98a6;
  font-size: 0.86rem;
  line-height: 1.45;
  font-weight: 650;
}

.reader-close {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #0b1017;
  color: #ffffff;
  font: inherit;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

.reader-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.reader-section,
.reader-grid > div {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
}

.reader-section + .reader-section,
.reader-grid + .reader-section,
.reader-section + .reader-grid {
  margin-top: 12px;
}

.reader-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.reader-panel h3 {
  margin: 0 0 9px;
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.reader-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.6;
  font-weight: 650;
}

.reader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.engine-hidden,
.citation-pill,
.authors,
.score-pill {
  display: none !important;
}

@media (max-width: 960px) {
  .header-inner,
  .app-shell {
    width: min(100% - 24px, 1120px);
  }

  .site-nav {
    gap: 14px;
    font-size: 0.84rem;
  }

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

@media (max-width: 680px) {
  .header-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 0;
  }

  .brand {
    min-width: 0;
  }

  .site-nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .hero {
    padding-top: 12px;
  }

  .research-form,
  .cards-grid {
    grid-template-columns: 1fr;
  }

  .primary-button {
    width: 100%;
  }

  .paper-card {
    min-height: 0;
  }

  .reader-modal {
    padding: 12px;
  }

  .reader-panel {
    max-height: calc(100vh - 24px);
    padding: 18px;
  }

  .reader-grid {
    grid-template-columns: 1fr;
  }

  .reader-actions .source-link,
  .reader-actions .read-button {
    width: 100%;
  }
}
