:root {
  color-scheme: light;
  --paper: #f8f7f2;
  --surface: #ffffff;
  --ink: #1b1d1f;
  --muted: #6b7280;
  --line: #e5e1d8;
  --blue: #2f6fed;
  --blue-soft: #edf4ff;
  --green: #2f6fed;
  --green-dark: #174ea6;
  --highlight: #fff3c4;
  --shadow-soft: 0 1px 2px rgba(27, 29, 31, 0.04), 0 14px 30px rgba(27, 29, 31, 0.06);
  --radius: 10px;
  font-family: Inter, "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  background:
    linear-gradient(90deg, transparent 0, transparent calc(50% - 560px), rgba(47, 111, 237, 0.14) calc(50% - 560px), rgba(47, 111, 237, 0.14) calc(50% - 559px), transparent calc(50% - 558px)),
    linear-gradient(90deg, transparent 0, transparent calc(50% + 560px), rgba(47, 111, 237, 0.1) calc(50% + 560px), rgba(47, 111, 237, 0.1) calc(50% + 561px), transparent calc(50% + 562px)),
    repeating-linear-gradient(0deg, rgba(229, 225, 216, 0.28) 0, rgba(229, 225, 216, 0.28) 1px, transparent 1px, transparent 32px),
    var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.detail-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

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

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

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

.hidden {
  display: none !important;
}

.content-page {
  width: min(100% - 32px, 760px);
}

.content-page h1 {
  max-width: 680px;
}

.content-page h2 a {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.content-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.content-links a {
  color: var(--blue);
  font-weight: 700;
}

body.static-topic-body {
  background:
    radial-gradient(circle at 15% 0%, rgba(47, 111, 237, 0.08), transparent 36rem),
    radial-gradient(circle at 92% 8%, rgba(255, 243, 196, 0.62), transparent 30rem),
    linear-gradient(180deg, #fbfcff 0%, #f7f9fc 46%, #fff 100%);
}

.static-topic-topbar {
  display: flex;
  width: min(100% - 48px, 1180px);
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 auto;
  padding: 26px 0 14px;
}

.static-topic-topbar .brand-mark {
  width: 42px;
  height: 32px;
  flex-basis: 42px;
}

.static-topic-topbar .brand-name {
  font-size: clamp(1.7rem, 3vw, 2.2rem);
}

.static-topic-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.static-topic-nav a {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #174ea6;
  background: rgba(255, 255, 255, 0.88);
  font-size: 0.9rem;
  font-weight: 800;
  box-shadow: 0 1px 2px rgba(27, 29, 31, 0.03);
}

.static-topic-nav a.primary {
  border-color: rgba(47, 111, 237, 0.75);
  color: #fff;
  background: var(--blue);
}

.topic-page {
  width: min(100% - 48px, 1180px);
  padding-top: 18px;
}

.static-topic-body .privacy-back {
  display: none;
}

.topic-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: 14px;
  align-items: center;
  overflow: hidden;
  min-height: 0;
  padding: clamp(28px, 4vw, 48px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(237, 244, 255, 0.9), rgba(255, 255, 255, 0) 58%),
    radial-gradient(circle at 92% 15%, rgba(255, 243, 196, 0.64), transparent 17rem),
    #fff;
  box-shadow: 0 18px 44px rgba(27, 29, 31, 0.06);
}

.topic-hero::before {
  content: "";
  position: absolute;
  inset: 28px auto 28px 0;
  width: 4px;
  border-radius: 999px;
  background: var(--blue);
  opacity: 0.82;
}

.topic-hero > * {
  position: relative;
  z-index: 1;
}

.topic-hero h1 {
  max-width: 940px;
  margin-bottom: 8px;
  font-size: clamp(2.45rem, 4vw, 4.45rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.topic-hero p {
  max-width: 820px;
  margin-bottom: 0;
  font-size: clamp(0.96rem, 1vw, 1.05rem);
  line-height: 1.6;
}

.topic-hero > .kicker,
.topic-hero > h1,
.topic-hero > p:not(.kicker) {
  grid-column: 1 / -1;
}

.topic-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  grid-column: 1 / -1;
  grid-row: 4;
  width: 100%;
  margin-top: 8px;
  align-self: start;
}

.topic-actions .text-button {
  min-height: 40px;
  padding: 0 15px;
  font-size: 0.9rem;
}

.topic-actions .text-button:first-child {
  width: 100%;
  justify-content: center;
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.topic-source-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  grid-column: 1 / -1;
  grid-row: 5;
  width: 100%;
  margin-top: 4px;
  padding: 10px;
  border: 1px solid rgba(229, 225, 216, 0.82);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 22px rgba(27, 29, 31, 0.045);
}

.topic-source-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.84rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.topic-source-button:hover {
  transform: translateY(-1px);
}

.topic-source-button.pubmed {
  border-color: rgba(47, 111, 237, 0.4);
  background: #edf4ff;
  color: #174ea6;
}

.topic-source-button.arxiv {
  border-color: rgba(194, 59, 59, 0.32);
  background: #fff2f2;
  color: #9f2d2d;
}

.topic-source-button.biorxiv {
  border-color: rgba(15, 143, 140, 0.36);
  background: #edfafa;
  color: #0f716f;
}

.topic-source-button.medrxiv {
  border-color: rgba(122, 92, 154, 0.34);
  background: #f6f0fb;
  color: #64447f;
}

.topic-grid,
.topic-list {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

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

.topic-grid[aria-label="PaprFeed research topics"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.topic-card,
.topic-note {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(27, 29, 31, 0.03);
}

.topic-card {
  min-height: 138px;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.topic-card:hover {
  border-color: rgba(47, 111, 237, 0.38);
  box-shadow: 0 14px 34px rgba(47, 111, 237, 0.09);
  transform: translateY(-2px);
}

.topic-card h2,
.topic-note h2 {
  margin-bottom: 8px;
  line-height: 1.1;
}

.topic-card p,
.topic-note p {
  margin-bottom: 0;
}

.topic-card a {
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.topic-card:hover a {
  color: var(--blue);
}

.topic-overview-grid {
  align-items: stretch;
}

.topic-search-examples,
.topic-faq {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(27, 29, 31, 0.03);
}

.topic-search-examples {
  display: grid;
  grid-template-columns: minmax(260px, 0.62fr) minmax(0, 1.38fr);
  gap: 18px;
  align-items: center;
}

.topic-search-examples h2,
.topic-section-heading h2,
.topic-faq-card h3 {
  margin-bottom: 8px;
}

.topic-example-list {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: flex-start;
}

.topic-example-list a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(47, 111, 237, 0.28);
  border-radius: 999px;
  color: #174ea6;
  background: var(--blue-soft);
  font-weight: 800;
}

.topic-faq-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.topic-faq-card {
  padding: 14px;
  border: 1px solid rgba(229, 225, 216, 0.9);
  border-radius: 14px;
  background: #fbfcff;
}

.topic-faq-card h3 {
  font-family: Newsreader, Georgia, serif;
  font-size: 1.22rem;
  line-height: 1.1;
}

.topic-faq-card p {
  margin-bottom: 0;
}

.topic-link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(27, 29, 31, 0.03);
}

.topic-link-list a {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(47, 111, 237, 0.3);
  border-radius: 999px;
  color: #174ea6;
  background: var(--blue-soft);
  font-weight: 800;
}

.not-found-page {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.app-shell {
  width: min(100%, 1510px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 24px 40px;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(270px, 360px) minmax(320px, 720px) minmax(220px, 300px);
  align-items: center;
  gap: 20px;
  padding: 12px 0 18px;
  background: linear-gradient(180deg, rgba(248, 247, 242, 0.96), rgba(248, 247, 242, 0.88));
  backdrop-filter: blur(14px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: block;
  width: 50px;
  height: 38px;
  flex: 0 0 50px;
  object-fit: contain;
}

.brand-name {
  overflow: visible;
  color: var(--ink);
  font-family: Newsreader, Georgia, serif;
  font-size: clamp(1.55rem, 2.5vw, 2.2rem);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.topics-nav-button {
  color: #174ea6;
}

.top-search {
  width: 100%;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 1px 2px rgba(27, 29, 31, 0.03);
}

.search-box:focus-within {
  border-color: rgba(47, 111, 237, 0.55);
  box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.09);
}

.search-label {
  flex: 0 0 auto;
  color: var(--ink);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
}

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

.search-box input::placeholder {
  color: #8b929d;
}

.workspace-shell {
  display: grid;
  grid-template-columns: minmax(210px, 260px) minmax(460px, 1fr) minmax(250px, 320px);
  gap: 24px;
  align-items: start;
  min-width: 0;
}

.left-rail,
.right-rail {
  position: sticky;
  top: 88px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
}

.rail-section,
.right-card,
.saved-panel,
.hero-panel,
.feed-status,
.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
}

.rail-section,
.right-card,
.saved-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 16px;
  overflow: hidden;
}

.saved-panel {
  max-height: calc(100vh - 112px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
}

.rail-heading {
  margin-bottom: 11px;
  color: var(--muted);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.source-tabs,
.quick-filters,
.suggested-topics,
.note-list {
  display: grid;
  gap: 8px;
}

.tab,
.filter-chip {
  position: relative;
  width: 100%;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: left;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.tab::after {
  position: absolute;
  left: 11px;
  right: auto;
  bottom: 5px;
  width: 0;
  height: 2px;
  border-radius: 999px;
  background: var(--blue);
  content: "";
  transition: width 160ms ease;
}

.tab.active,
.filter-chip.active {
  color: #174ea6;
  border-color: rgba(47, 111, 237, 0.42);
  background: var(--blue-soft);
}

.tab.active::after {
  width: 22px;
}

.tab:hover,
.filter-chip:hover,
.suggested-topic-button:hover,
.topic-directory-link:hover {
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
}

.filter-row {
  display: grid;
  gap: 11px;
}

.filter-row label {
  display: grid;
  gap: 6px;
}

.filter-row span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
}

.text-button,
.icon-button,
.load-more-button,
.suggested-topic-button,
.topic-directory-link,
.saved-remove-button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  font-weight: 700;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
}

.header-sign-in {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.saved-nav-button {
  color: var(--green-dark);
}

.rail-button {
  width: 100%;
}

.text-button.subtle {
  color: var(--muted);
  background: transparent;
}

.text-button:hover,
.icon-button:hover,
.load-more-button:hover,
.suggested-topic-button:hover,
.topic-directory-link:hover {
  border-color: rgba(47, 111, 237, 0.36);
  color: #174ea6;
  background: var(--blue-soft);
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
}

.icon-button.small {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
}

.saved-count,
.panel-saved-count {
  display: inline-grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 800;
}

.feed-column {
  min-width: 0;
}

.hero-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(22px, 4vw, 42px);
  margin-bottom: 18px;
}

.hero-panel::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 28px;
  width: 1px;
  background: rgba(47, 111, 237, 0.22);
  content: "";
}

.kicker {
  margin-bottom: 8px;
  color: var(--green-dark);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.hero-panel h1 {
  max-width: 760px;
  margin-bottom: 13px;
  padding-left: 16px;
  font-family: Newsreader, Georgia, serif;
  font-size: clamp(2.35rem, 5vw, 4.4rem);
  font-weight: 650;
  line-height: 0.96;
  letter-spacing: 0;
}

mark {
  padding: 0 0.08em;
  color: inherit;
  background: linear-gradient(180deg, transparent 50%, var(--highlight) 50%);
}

.hero-panel p:not(.kicker) {
  max-width: 680px;
  margin: 0;
  padding-left: 16px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.topic-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
  padding-left: 16px;
}

.topic-strip a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(47, 111, 237, 0.28);
  border-radius: 999px;
  background: var(--blue-soft);
  color: #174ea6;
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.topic-strip a:hover {
  border-color: rgba(47, 111, 237, 0.48);
  background: #fff;
  transform: translateY(-1px);
}

.topic-discovery-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.28fr);
  gap: 18px;
  align-items: start;
  padding: 18px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 2px rgba(27, 29, 31, 0.03);
}

.topic-discovery-copy h2 {
  margin-bottom: 8px;
  font-family: Newsreader, Georgia, serif;
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  line-height: 1.05;
}

.topic-discovery-copy p:not(.kicker) {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.topic-discovery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.topic-discovery-grid a,
.topic-discovery-all {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(47, 111, 237, 0.22);
  border-radius: 10px;
  color: #174ea6;
  background: var(--blue-soft);
  font-size: 0.9rem;
  font-weight: 800;
}

.topic-discovery-all {
  grid-column: 2;
  width: max-content;
  background: #fff;
}

.feed-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

#statusLabel {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
}

#statusDetail {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.source-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 32px;
  margin-bottom: 14px;
}

.count-pill,
.paper-badges span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 700;
}

.paper-feed {
  display: grid;
  gap: 14px;
}

.paper-card {
  position: relative;
  overflow: hidden;
  padding: 18px 20px 17px;
  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-card::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: rgba(47, 111, 237, 0.72);
  content: "";
}

.paper-card::after {
  position: absolute;
  top: 0;
  right: 18px;
  width: 18px;
  height: 42px;
  background: transparent;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
  content: "";
  opacity: 0;
  transition: opacity 160ms ease, background 160ms ease;
}

.paper-card:hover {
  border-color: rgba(47, 111, 237, 0.3);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.paper-card:hover::after,
.paper-card.is-saved::after {
  background: var(--highlight);
  opacity: 1;
}

.paper-card.is-saved::before {
  background: var(--highlight);
}

.paper-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-left: 10px;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 9px;
  border-radius: 7px;
  color: #fff;
  background: var(--green);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 600;
}

.source-pill.arxiv {
  background: #c23b3b;
}

.source-pill.pubmed {
  background: #386fa4;
}

.source-pill.biorxiv {
  background: #0f8f8c;
}

.source-pill.medrxiv {
  background: #7a5c9a;
}

.paper-date {
  margin: 0;
  color: var(--muted);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
}

.paper-card h2,
.detail-sheet h2 {
  margin: 0 0 9px;
  padding-left: 10px;
  color: var(--ink);
  font-family: Newsreader, Georgia, serif;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  font-weight: 700;
  line-height: 1.08;
}

.authors,
.journal {
  margin: 0 0 7px;
  padding-left: 10px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.journal {
  color: var(--green-dark);
  font-weight: 700;
}

.paper-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0 12px;
  padding-left: 10px;
}

.abstract {
  margin: 0 0 16px;
  padding-left: 10px;
  color: #34373b;
  font-size: 0.96rem;
  line-height: 1.7;
}

.abstract.full {
  margin-top: 16px;
}

.paper-actions {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding-left: 10px;
}

.paper-actions button,
.paper-actions a {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--green-dark);
  background: #fff;
  font-size: 0.86rem;
  font-weight: 700;
}

.paper-actions button:hover,
.paper-actions a:hover {
  border-color: rgba(47, 111, 237, 0.36);
  color: #174ea6;
  background: var(--blue-soft);
}

.detail-sheet .paper-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding-left: 0;
}

.save-button.saved,
#detailSaveButton.saved {
  color: #7c5b00;
  border-color: #ead48b;
  background: var(--highlight);
}

.empty-state {
  padding: 34px 24px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.empty-state::before {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-family: Newsreader, Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  content: "Blank research notebook";
}

.load-more-note {
  margin: 18px 0 10px;
  color: var(--muted);
  text-align: center;
}

.load-more-button {
  width: 100%;
  min-height: 46px;
  margin-top: 8px;
  color: var(--blue);
  background: #fff;
}

.app-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  margin-top: 26px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-heading.simple {
  margin-bottom: 10px;
}

.panel-heading h2,
.onboarding-group h3 {
  margin: 0;
  color: var(--ink);
  font-family: Newsreader, Georgia, serif;
  font-size: 1.12rem;
  font-weight: 700;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.panel-actions .text-button {
  min-height: 31px;
  padding: 0 9px;
  font-size: 0.78rem;
}

.sync-note,
.auth-status {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.saved-list {
  display: grid;
  gap: 9px;
}

.saved-item-shell {
  position: relative;
  display: block;
  overflow: visible;
  border-radius: 9px;
  background: transparent;
}

.saved-item {
  position: relative;
  z-index: 1;
  padding: 11px 42px 11px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  transition: transform 180ms ease;
}

.saved-item-text {
  display: grid;
  gap: 5px;
}

.saved-item a {
  color: var(--ink);
  font-family: Newsreader, Georgia, serif;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.16;
}

.saved-item span,
.note-list span {
  color: var(--muted);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  line-height: 1.35;
}

.saved-remove-button {
  position: absolute;
  z-index: 2;
  top: 9px;
  right: 9px;
  display: flex;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(229, 225, 216, 0.85);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(248, 247, 242, 0.72);
  font-size: 0.78rem;
  opacity: 0.68;
}

.saved-item-shell:hover .saved-remove-button,
.saved-item-shell:focus-within .saved-remove-button {
  opacity: 1;
}

.saved-remove-button:hover,
.saved-remove-button:focus-visible {
  border-color: #f2c6bc;
  color: #9a3a32;
  background: #fff1ec;
  opacity: 1;
}

.saved-remove-button svg {
  width: 15px;
  height: 15px;
}

.saved-remove-button span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.saved-item-shell.swipe-open .saved-item {
  transform: translateX(-88px);
}

.note-list span,
.recent-search-button {
  display: block;
  width: 100%;
  padding: 9px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  line-height: 1.35;
  text-align: left;
}

.note-list span:last-child,
.recent-search-button:last-child {
  border-bottom: 0;
}

.recent-search-button:hover,
.recent-search-button:focus-visible {
  color: #174ea6;
}

.suggested-topic-button {
  min-height: 40px;
  padding: 0 11px;
  color: var(--ink);
  text-align: left;
}

.topic-directory-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 11px;
  color: #174ea6;
  background: var(--blue-soft);
  font-weight: 800;
  text-align: left;
  text-decoration: none;
}

.detail-panel,
.onboarding-panel {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(27, 29, 31, 0.28);
  backdrop-filter: blur(6px);
}

.detail-sheet,
.onboarding-sheet {
  position: relative;
  z-index: 1;
  width: min(100%, 760px);
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(27, 29, 31, 0.18);
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.onboarding-sheet {
  width: min(100%, 650px);
}

.onboarding-sheet .panel-heading h2 {
  font-size: clamp(1.7rem, 4vw, 2.35rem);
}

.onboarding-group {
  margin-top: 18px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 10px;
}

.choice-grid.compact {
  grid-template-columns: 1fr;
}

.choice-card {
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  font-weight: 800;
}

.choice-card.active {
  border-color: rgba(47, 111, 237, 0.55);
  color: #174ea6;
  background: var(--blue-soft);
}

.privacy-page {
  width: min(100% - 32px, 760px);
  margin: 0 auto;
  padding: 48px 0;
  color: var(--ink);
}

.privacy-page h1,
.privacy-page h2 {
  font-family: Newsreader, Georgia, serif;
}

.privacy-page p {
  color: var(--muted);
  line-height: 1.7;
}

.privacy-page.topic-page {
  width: min(100% - 48px, 1180px);
}

.content-page .topic-card h2 a {
  color: var(--ink);
  text-decoration: none;
}

.content-page .topic-card:hover h2 a {
  color: var(--blue);
}

.privacy-back {
  margin-bottom: 24px;
}

@media (max-width: 1180px) {
  .top-bar {
    grid-template-columns: minmax(230px, 1fr) auto;
  }

  .top-search {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .workspace-shell {
    grid-template-columns: minmax(190px, 250px) minmax(0, 1fr);
  }

  .right-rail {
    position: static;
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .topic-grid[aria-label="PaprFeed research topics"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  body.saved-open {
    overflow: hidden;
  }

  body.saved-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 70;
    pointer-events: none;
    background: rgba(248, 247, 242, 0.92);
  }

  body {
    background:
      repeating-linear-gradient(0deg, rgba(229, 225, 216, 0.28) 0, rgba(229, 225, 216, 0.28) 1px, transparent 1px, transparent 32px),
      var(--paper);
  }

  body.static-topic-body {
    background: #f7f9fc;
  }

  .app-shell {
    padding: max(10px, env(safe-area-inset-top)) 12px max(28px, env(safe-area-inset-bottom));
  }

  .top-bar {
    position: sticky;
    top: 0;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 0 -12px;
    padding: 10px 12px 12px;
    border-bottom: 1px solid rgba(229, 225, 216, 0.78);
    background: rgba(248, 247, 242, 0.96);
  }

  .brand-lockup {
    grid-row: 1;
  }

  .top-search {
    grid-row: 2;
  }

  .top-actions {
    grid-row: 3;
    justify-content: stretch;
  }

  .top-actions .text-button {
    flex: 1;
  }

  .workspace-shell {
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
    overflow: hidden;
  }

  .feed-column {
    display: contents;
  }

  .hero-panel {
    order: 1;
  }

  .left-rail {
    order: 2;
  }

  .feed-status {
    order: 3;
  }

  .topic-discovery-panel {
    order: 3;
  }

  .source-counts {
    order: 4;
  }

  .paper-feed {
    order: 5;
  }

  .load-more-note {
    order: 6;
  }

  .load-more-button {
    order: 7;
  }

  .app-footer {
    order: 8;
  }

  .right-rail {
    order: 9;
  }

  .left-rail,
  .right-rail {
    position: static;
    gap: 10px;
  }

  .right-rail {
    grid-template-columns: 1fr;
  }

  .right-card {
    display: none;
  }

  .saved-panel {
    position: fixed;
    z-index: 80;
    top: max(82px, env(safe-area-inset-top));
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px;
    max-height: none;
    overflow-y: auto;
    background: #fff;
    box-shadow: var(--shadow-soft);
  }

  .rail-section,
  .saved-panel,
  .feed-status {
    padding: 12px;
  }

  .rail-heading {
    margin-bottom: 8px;
  }

  .source-tabs,
  .quick-filters {
    display: flex;
    gap: 8px;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .source-tabs::-webkit-scrollbar,
  .quick-filters::-webkit-scrollbar {
    display: none;
  }

  .tab,
  .filter-chip {
    width: auto;
    flex: 0 0 auto;
    text-align: center;
  }

  .filter-row {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    padding: 16px 14px;
    margin-bottom: 12px;
  }

  .hero-panel::before {
    display: none;
  }

  .hero-panel h1,
  .hero-panel p:not(.kicker),
  .topic-strip {
    padding-left: 0;
  }

  .topic-strip {
    gap: 7px;
    margin-top: 14px;
  }

  .topic-strip a {
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.82rem;
  }

  .topic-discovery-panel {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 14px;
    margin-bottom: 12px;
  }

  .topic-discovery-grid {
    grid-template-columns: 1fr;
  }

  .topic-discovery-all {
    grid-column: auto;
    width: 100%;
    justify-content: center;
  }

  .hero-panel h1 {
    margin-bottom: 8px;
    font-size: clamp(1.7rem, 9vw, 2.25rem);
    line-height: 1.02;
  }

  .hero-panel p:not(.kicker) {
    font-size: 0.92rem;
    line-height: 1.45;
  }

  .paper-card {
    padding: 15px 14px 14px;
  }

  .paper-card h2 {
    font-size: 1.24rem;
  }

  .abstract {
    font-size: 0.93rem;
    line-height: 1.58;
  }

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

  .paper-actions .cite-button {
    grid-column: auto;
  }

  .saved-item-shell {
    display: block;
    overflow: hidden;
    background: var(--highlight);
  }

  .saved-remove-button {
    position: absolute;
    z-index: 0;
    inset: 0 0 0 auto;
    width: 88px;
    min-width: 88px;
    min-height: 100%;
    align-self: stretch;
    padding: 0;
    border: 0;
    border-radius: 0;
  }

  .saved-item {
    z-index: 1;
  }

  .saved-remove-button svg {
    display: none;
  }

  .saved-remove-button span {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  .detail-panel,
  .onboarding-panel {
    align-items: start;
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .detail-sheet,
  .onboarding-sheet {
    max-height: none;
    padding: 18px;
  }

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

  .static-topic-topbar {
    width: min(100% - 24px, 1180px);
    flex-direction: column;
    align-items: flex-start;
    padding-top: 16px;
  }

  .static-topic-nav {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .static-topic-nav a {
    width: 100%;
  }

  .topic-page {
    width: min(100% - 24px, 1180px);
    padding-top: 14px;
  }

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

  .topic-grid[aria-label="PaprFeed research topics"] {
    grid-template-columns: 1fr;
  }

  .topic-hero {
    display: block;
    min-height: 0;
    padding: 24px 18px;
    border-radius: 14px;
  }

  .topic-hero::before {
    inset: 18px auto 18px 0;
  }

  .topic-hero h1 {
    font-size: clamp(2.05rem, 9vw, 2.85rem);
    line-height: 0.98;
  }

  .topic-hero p {
    font-size: 0.98rem;
    line-height: 1.58;
  }

  .topic-actions .text-button {
    width: 100%;
  }

  .topic-actions {
    margin-top: 14px;
  }

  .topic-source-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 12px;
    padding: 12px;
  }

  .topic-source-button {
    width: 100%;
    justify-content: center;
    min-height: 40px;
    padding: 6px 8px;
    font-size: 0.76rem;
    line-height: 1.15;
  }

  .topic-search-examples,
  .topic-faq {
    padding: 16px;
    border-radius: 14px;
  }

  .topic-search-examples,
  .topic-faq-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .brand-mark {
    width: 42px;
    height: 32px;
    flex-basis: 42px;
  }

  .brand-name {
    font-size: 1.55rem;
  }

  .search-box {
    min-height: 48px;
  }

  .topic-source-actions {
    grid-template-columns: 1fr;
  }

  .topic-source-button {
    min-height: 44px;
    font-size: 0.82rem;
  }

  .top-actions {
    display: flex;
    flex-wrap: wrap;
  }
  }

  .paper-actions button,
  .paper-actions a {
    min-height: 44px;
    padding: 0 9px;
  }
}
