:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --border: #dee2e6;
  --text: #212529;
  --text-muted: #6c757d;
  --primary: #0066cc;
  --primary-hover: #004fa3;
  --highlight-strong-bg: #fff3cd;
  --highlight-strong-border: #ffc107;
  --highlight-weak-bg: #f8f9fa;
  --highlight-weak-border: #ced4da;
  --cat-ga: #6610f2;
  --cat-co: #0dcaf0;
  --cat-ep: #198754;
  --cat-he: #dc3545;
  --cat-im: #fd7e14;
  --cat-sr: #e83e8c;
  --cat-other: #6c757d;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ── Header ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-size: 1.2rem;
  font-weight: 700;
  white-space: nowrap;
}

header h1 a {
  color: var(--text);
  text-decoration: none;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
}

.fetched-at { font-size: 12px; color: var(--text-muted); }

.header-center-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.header-center-link:hover { background: var(--bg); }

.header-shield { display: flex; align-items: center; }
.header-shield img { display: block; }

.header-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-links a {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
}
.header-links a:hover { color: var(--text); }

/* ── Controls ── */
select, button {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

button:hover { background: var(--bg); }

.current-date-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* ── Announcement card ── */
#announcement {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  margin-bottom: 14px;
  overflow: hidden;
}

#announcement-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  background: none;
  border: none;
  border-radius: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  text-align: left;
}

#announcement-toggle:hover { background: var(--bg); }

.announcement-chevron {
  transition: transform 0.2s;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

#announcement-toggle[aria-expanded="true"] .announcement-chevron {
  transform: rotate(90deg);
}

#announcement-body {
  padding: 0 14px 14px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  border-top: 1px solid var(--border);
}

#announcement-body p { margin: 10px 0 0; }
#announcement-body ul { margin: 10px 0 0 18px; }
#announcement-body li { margin-bottom: 3px; }
#announcement-body a { color: var(--primary); }

.announcement-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Main layout ── */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 20px;
}

/* ── Toolbar ── */
#toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

#toolbar label { font-size: 13px; color: var(--text-muted); }

#sort-select { font-size: 13px; }

/* ── Category filter ── */
#cat-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  align-items: center;
}

#cat-filter span {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: 4px;
}

.cat-toggle {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: var(--surface);
  transition: background 0.15s, color 0.15s;
}

.cat-toggle.active { color: #fff; border-color: transparent; }
.cat-toggle[data-cat="astro-ph.GA"].active { background: var(--cat-ga); }
.cat-toggle[data-cat="astro-ph.CO"].active { background: var(--cat-co); color: #000; }
.cat-toggle[data-cat="astro-ph.EP"].active { background: var(--cat-ep); }
.cat-toggle[data-cat="astro-ph.HE"].active { background: var(--cat-he); }
.cat-toggle[data-cat="astro-ph.IM"].active { background: var(--cat-im); }
.cat-toggle[data-cat="astro-ph.SR"].active { background: var(--cat-sr); }

/* ── Stats bar ── */
#stats {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* ── Paper cards ── */
#paper-list { display: flex; flex-direction: column; gap: 10px; }

.paper-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
}

.paper-card.highlighted-strong {
  border-left: 3px solid var(--highlight-strong-border);
  background: var(--highlight-strong-bg);
}

.paper-card.highlighted-weak {
  border-left: 3px solid var(--highlight-weak-border);
  background: var(--highlight-weak-bg);
}

.paper-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.arxiv-num {
  font-size: 0.8em;
  font-weight: 700;
  color: var(--primary);
  font-family: monospace;
  min-width: 2.5em;
}

.arxiv-num-cross {
  color: var(--text-muted);
}

.paper-id {
  font-size: 0.8em;
  color: var(--text-muted);
  font-family: monospace;
}

.paper-id a, .pdf-link {
  color: var(--primary);
  text-decoration: none;
}
.paper-id a:hover, .pdf-link:hover { text-decoration: underline; }

.pdf-link { font-size: 0.8em; }

.cat-badge {
  font-size: 0.73em;
  padding: 1px 6px;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
}

.cat-badge.other { background: var(--cat-other); color: #fff; }

.secondary-cats {
  font-size: 0.73em;
  color: var(--text-muted);
}

.paper-title {
  font-size: 1.13em;
  font-weight: 600;
  margin-bottom: 5px;
  line-height: 1.4;
}

.paper-title span { cursor: pointer; }
.paper-title span:hover { color: var(--primary); text-decoration: underline; }

.paper-authors {
  font-size: 0.93em;
  color: var(--text-muted);
  margin-bottom: 6px;
  line-height: 1.4;
}

.author-highlight-strong {
  color: #7b2d00;
  font-weight: 700;
  background: #ffe066;
  border-radius: 3px;
  padding: 0 4px;
  border: 1px solid #f0a500;
}

.author-highlight-weak {
  color: #5a4000;
  font-style: italic;
  background: #fff8d6;
  border-radius: 3px;
  padding: 0 4px;
  border: 1px solid #e0c060;
}

/* ── Abstract toggle ── */
.abstract-toggle {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.8em;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

.paper-abstract {
  font-size: 0.93em;
  color: var(--text);
  margin-top: 8px;
  line-height: 1.6;
  display: none;
}

.paper-abstract.open { display: block; }

/* ── Font size ── */
body[data-font="small"] { font-size: 13px; }
body[data-font="large"]  { font-size: 17px; }


.btn-font {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.btn-font.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ── Author truncation ── */
.author-expand-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: inherit;
  font-style: italic;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

/* ── Sort / source button groups ── */
.sort-group {
  display: flex;
  align-items: center;
  gap: 5px;
}

.sort-label {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.btn-group {
  display: flex;
}

.btn-group button {
  border-radius: 0;
  margin: 0;
  border-right-width: 0;
  font-size: 13px;
  padding: 4px 9px;
}

.btn-group button:first-child { border-radius: 4px 0 0 4px; }
.btn-group button:last-child  { border-radius: 0 4px 4px 0; border-right-width: 1px; }

.btn-group button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  z-index: 1;
}

/* keep the border between an active and its neighbour tidy */
.btn-group button.active + button { border-left-color: var(--primary-hover); }

#search-container {
  margin-bottom: 12px;
}

#search-input {
  width: 100%;
  max-width: 420px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
}

#search-input:focus {
  outline: none;
  border-color: var(--primary);
}

.load-more-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  font-size: 14px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--primary);
}

.load-more-btn:hover { background: var(--bg); }

/* ── Section header (cross-listings divider) ── */
.section-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding: 10px 0 4px;
  margin-top: 16px;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Empty state ── */
#empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

/* ── Footer ── */
footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 24px 20px;
}

footer a { color: var(--primary); }

/* ── Loading ── */
#loading {
  text-align: center;
  padding: 60px;
  color: var(--text-muted);
}
