/* 基础样式 */
:root {
  --primary-color: #10b981;
  --primary-rgb: 16, 185, 129;
  --secondary-color: #059669;
  --secondary-rgb: 5, 150, 105;
  --accent-color: #047857;
  --gradient-primary: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --gradient-light: linear-gradient(135deg, #d1fae5 0%, #dcfce7 100%);
  --background-color: #f9fffe;
  --header-bg: rgba(249, 255, 254, 0.88);
  --card-bg-color: #ffffff;
  --background-hover: #f1f5f9;
  --text-color: #1e293b;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --border-color: #e2e8f0;
  --border-accent: rgba(var(--primary-rgb), 0.2);
  --shadow-sm: 0 1px 3px rgba(var(--primary-rgb), 0.1);
  --shadow-md: 0 4px 15px rgba(var(--primary-rgb), 0.15);
  --shadow-lg: 0 8px 25px rgba(var(--primary-rgb), 0.2);
  --radius-sm: 8px;
  --radius-md: 12px;
  --transition: all 0.2s ease;
  --match-highlight: rgba(255, 223, 77, 0.22);
  --gold-color: #ffd700;
  --gold-dark: #d4af37;
  --gold-gradient: linear-gradient(135deg, #ffd700 0%, #d4af37 100%);
  --author-color: #10b981;
  --author-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --keyword-color: #8b5cf6;
  --keyword-gradient: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

/* ── Themes ──────────────────────────────────────────────────────────────────── */

/* Purple */
[data-theme="purple"] {
  --primary-color: #667eea;
  --primary-rgb: 102, 126, 234;
  --secondary-color: #764ba2;
  --secondary-rgb: 118, 75, 162;
  --accent-color: #6d2dad;
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-light: linear-gradient(135deg, #e0e7ff 0%, #f3e8ff 100%);
  --background-color: #fafaff;
  --header-bg: rgba(250, 250, 255, 0.88);
  --border-accent: rgba(var(--primary-rgb), 0.2);
  --shadow-sm: 0 1px 3px rgba(var(--primary-rgb), 0.1);
  --shadow-md: 0 4px 15px rgba(var(--primary-rgb), 0.15);
  --shadow-lg: 0 8px 25px rgba(var(--primary-rgb), 0.2);
}

/* Ocean (blue) */
[data-theme="ocean"] {
  --primary-color: #0ea5e9;
  --primary-rgb: 14, 165, 233;
  --secondary-color: #0284c7;
  --secondary-rgb: 2, 132, 199;
  --accent-color: #0369a1;
  --gradient-primary: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  --gradient-light: linear-gradient(135deg, #e0f2fe 0%, #dbeafe 100%);
  --background-color: #f8fcff;
  --header-bg: rgba(248, 252, 255, 0.88);
  --border-accent: rgba(var(--primary-rgb), 0.2);
  --shadow-sm: 0 1px 3px rgba(var(--primary-rgb), 0.1);
  --shadow-md: 0 4px 15px rgba(var(--primary-rgb), 0.15);
  --shadow-lg: 0 8px 25px rgba(var(--primary-rgb), 0.2);
}

/* Rose (pink-red) */
[data-theme="rose"] {
  --primary-color: #f43f5e;
  --primary-rgb: 244, 63, 94;
  --secondary-color: #e11d48;
  --secondary-rgb: 225, 29, 72;
  --accent-color: #be123c;
  --gradient-primary: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
  --gradient-light: linear-gradient(135deg, #ffe4e6 0%, #fce7f3 100%);
  --background-color: #fffcfc;
  --header-bg: rgba(255, 252, 252, 0.88);
  --border-accent: rgba(var(--primary-rgb), 0.2);
  --shadow-sm: 0 1px 3px rgba(var(--primary-rgb), 0.1);
  --shadow-md: 0 4px 15px rgba(var(--primary-rgb), 0.15);
  --shadow-lg: 0 8px 25px rgba(var(--primary-rgb), 0.2);
}

/* Amber */
[data-theme="amber"] {
  --primary-color: #f59e0b;
  --primary-rgb: 245, 158, 11;
  --secondary-color: #d97706;
  --secondary-rgb: 217, 119, 6;
  --accent-color: #b45309;
  --gradient-primary: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --gradient-light: linear-gradient(135deg, #fef3c7 0%, #fef9c3 100%);
  --background-color: #fffdf8;
  --header-bg: rgba(255, 253, 248, 0.88);
  --border-accent: rgba(var(--primary-rgb), 0.2);
  --shadow-sm: 0 1px 3px rgba(var(--primary-rgb), 0.1);
  --shadow-md: 0 4px 15px rgba(var(--primary-rgb), 0.15);
  --shadow-lg: 0 8px 25px rgba(var(--primary-rgb), 0.2);
}

/* ── Dark mode (stacks on top of any light theme) ────────────────────────────── */
[data-dark="true"] {
  --background-color: #0f172a;
  --card-bg-color: #1e293b;
  --background-hover: #283548;
  --text-color: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --border-color: #334155;
  --header-bg: rgba(15, 23, 42, 0.9);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100%;
}

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

a:hover {
  text-decoration: underline;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: var(--transition);
  background-color: var(--background-hover);
}

.button:hover {
  background-color: var(--border-color);
}

.button.primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.button.primary:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: var(--transition);
  color: var(--primary-color);
}

.icon-button:hover {
  background-color: rgba(var(--primary-rgb), 0.1);
}

/* 视图控制按钮样式 */
.view-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.view-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 2px;
  color: var(--primary-color);
  font-size: 14px;
}

.view-controls .button {
  border: 1px solid var(--border-accent);
  background-color: rgba(var(--primary-rgb), 0.05);
  padding: 4px 10px;
  font-size: 13px;
}

.view-controls .button:hover {
  background-color: rgba(var(--primary-rgb), 0.1);
}

.view-controls .button.active {
  background-color: rgba(var(--primary-rgb), 0.15);
  border-color: var(--primary-color);
  color: var(--primary-color);
  font-weight: 500;
}

/* 布局容器 */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
}

/* 页头 */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 1;
  min-width: 0;
}

.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

/* Clickable date in header center */
.header-date-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
  transition: background 0.15s;
  font-size: 19px;
  font-weight: 600;
  color: var(--text-color);
  line-height: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.header-date-btn:hover {
  background: var(--background-hover);
}

.header-date-nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}
.header-date-nav-btn:hover {
  color: var(--text-color);
  background: var(--background-hover);
}

/* Floating AI Digest button */
.ai-digest-float {
  position: fixed;
  bottom: 92px;
  right: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  min-width: 50px;
  height: 50px;
  border-radius: 25px;
  background: #f59e0b;
  border: none;
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
  transition: box-shadow 0.2s, background 0.2s, min-width 0.25s ease;
  z-index: 1000;
  white-space: nowrap;
  overflow: hidden;
}
.ai-digest-float .digest-nav-label {
  display: inline-block;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  margin-left: 0;
  transition: max-width 0.25s ease, opacity 0.2s ease, margin-left 0.25s ease;
}
.ai-digest-float:hover .digest-nav-label {
  max-width: 100px;
  opacity: 1;
  margin-left: 6px;
}
.ai-digest-float:hover {
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
  min-width: 130px;
}
.ai-digest-float[data-state="generating"] {
  background: #ef4444;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
  min-width: 150px;
}
.ai-digest-float[data-state="generating"] .digest-nav-label {
  max-width: 120px;
  opacity: 1;
  margin-left: 6px;
}
.ai-digest-float[data-state="result"] {
  background: #f59e0b;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
  min-width: 140px;
}
.ai-digest-float[data-state="result"] .digest-nav-label {
  max-width: 120px;
  opacity: 1;
  margin-left: 6px;
}
@media (max-width: 768px) {
  .ai-digest-float { bottom: 80px; right: 20px; }
}

.site-logo-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none !important;
  color: var(--text-color);
  transition: var(--transition);
}

.site-logo:hover {
  text-decoration: none;
  opacity: 0.9;
}

.logo-image {
  height: 36px;
  width: auto;
}

.site-title {
  font-size: 18px;
  font-weight: 600;
}

.site-title-main {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.site-title-ai {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  cursor: default;
}

.site-title-ai.unconfigured {
  background: none;
  -webkit-text-fill-color: var(--text-secondary);
  color: var(--text-secondary);
  opacity: 0.5;
  cursor: help;
}

.visitor-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
  margin-left: 6px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Config-required modal */
.config-required-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.config-required-modal {
  position: relative;
  background: var(--card-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 28px 32px 24px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.config-required-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  line-height: 1;
}

.config-required-close:hover { color: var(--text-color); }

.config-required-modal h3 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
}

.config-required-modal p {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.config-required-modal .config-required-fields {
  background: var(--background-hover);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 12px 0;
  font-size: 13px;
  color: var(--text-color);
  line-height: 1.8;
}

.config-required-modal .config-required-actions {
  margin-top: 16px;
  display: flex;
  gap: 8px;
}

.config-required-modal .config-required-actions a {
  display: inline-block;
  padding: 7px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  background: var(--gradient-primary);
  color: white;
}

.header-content h1 {
  font-size: 20px;
  font-weight: 600;
}

.github-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 24px;
  background: var(--gradient-primary);
  color: white;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  text-decoration: none !important;
  box-shadow: var(--shadow-sm);
}

.github-button:hover {
  background: var(--gradient-primary);
  text-decoration: none !important;
  transform: translateY(-1px);
  color: white;
  box-shadow: var(--shadow-md);
}

.github-button svg {
  fill: white;
}

.github-text {
  font-weight: 500;
}

.github-stats {
  display: flex;
  gap: 6px;
}

.star-badge,
.fork-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background-color: rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
}

.star-badge svg {
  fill: white;
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.3));
}

.fork-badge svg {
  fill: white;
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.3));
}

.star-count,
.fork-count {
  color: white;
  font-weight: 600;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

.date-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  padding: 2px;
}

.date-display {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  color: var(--text-color);
}

/* 类别导航栏 */
.category-nav {
  background-color: var(--header-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.category-nav::-webkit-scrollbar {
  display: none;
}

.category-label-container {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  max-width: 1440px;
  width: 100%;
  padding: 10px 24px 5px 24px;
  margin: 0 auto;
  position: relative;
}

.category-label-container--inner {
  padding-top: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2px;
}

.category-nav-label, .filter-nav-label {
  font-weight: 600;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-right: 8px; /* 减少右侧间距 */
  white-space: nowrap;
  min-width: 90px; /* 减少宽度从120px到90px */
  letter-spacing: 0.3px; /* 减少字母间距 */
  font-size: 14px; /* 减小字体大小 */
  text-transform: uppercase;
  opacity: 1; /* 增加不透明度 */
  position: relative;
  z-index: 1;
  padding-left: 3px; /* 减少左侧内边距 */
}

/* 删除装饰线的CSS规则 */
.category-nav-label::after, .keyword-nav-label::after {
  content: none; /* 移除装饰线 */
}

.category-scroll {
  display: flex;
  overflow-x: auto;
  gap: 10px;
  -ms-overflow-style: none;
  scrollbar-width: none;
  flex: 1;
  min-width: 0;
  justify-content: flex-start;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow-y: hidden;
}

.filter-scroll {
  display: flex;
  overflow-x: auto;
  gap: 10px;
  -ms-overflow-style: none;
  scrollbar-width: none;
  width: 100%;
  justify-content: flex-start; /* 改为左对齐 */
  flex-wrap: nowrap; /* 禁止换行 */
  white-space: nowrap; /* 确保内容不会换行 */
  /* 添加鼠标滚轮横向滚动支持 */
  overflow-y: hidden;
}

/* Text search UI — pushed to the right in the category row */
.text-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  margin-right: 8px;
}

.text-search .search-input-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--background-hover);
  border: 1px solid var(--border-accent);
  border-radius: 16px;
  padding: 4px 8px;
}

#textSearchInput {
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-color);
  width: 220px;
}

.text-search .clear-x {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: rgba(0,0,0,0.08);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.text-search .clear-x:hover {
  background-color: rgba(0,0,0,0.14);
}

.filter-scroll::-webkit-scrollbar {
  display: none;
}

/* ── Topics row ─────────────────────────────────────────────────── */
.topics-label-container {
  display: flex;
  align-items: center;
  max-width: 1440px;
  width: 100%;
  padding: 6px 24px 4px 24px;
  margin: 0 auto;
  gap: 8px;
}

.topics-nav-label {
  font-weight: 600;
  background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
  min-width: 60px;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.topics-scroll {
  display: flex;
  overflow-x: auto;
  gap: 6px;
  flex: 0 0 auto;
  max-width: 100%;
  scrollbar-width: none;
}

.topics-scroll::-webkit-scrollbar {
  display: none;
}

.topic-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding: 5px 10px;
  background-color: var(--background-hover);
  border: none;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.topic-button:hover {
  background-color: var(--border-color);
  color: var(--text-color);
}

.topic-button.active {
  background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
  color: white;
}

.topic-remove {
  font-size: 14px;
  line-height: 1;
  opacity: 0.6;
  padding-left: 2px;
}

.topic-remove:hover {
  opacity: 1;
}

.add-topic-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px dashed #0ea5e9;
  background: transparent;
  color: #0ea5e9;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.add-topic-btn:hover {
  background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
  color: white;
  border-style: solid;
}

.topic-input-container {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topic-input-container input {
  padding: 4px 10px;
  border: 1.5px solid #0ea5e9;
  border-radius: 14px;
  font-size: 13px;
  outline: none;
  width: 180px;
  background: var(--background-color);
  color: var(--text-color);
}

.topic-confirm-btn,
.topic-cancel-btn {
  border: none;
  border-radius: 12px;
  padding: 4px 10px;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.topic-confirm-btn {
  background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
  color: white;
}

.topic-cancel-btn {
  background: var(--background-hover);
  color: var(--text-secondary);
}
/* ── Topic word picker row ───────────────────────────────────────── */
.topic-word-picker-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  max-width: 1440px;
  width: 100%;
  padding: 4px 24px 6px 24px;
  margin: 0 auto;
  position: relative;
  gap: 6px;
}

.topic-word-picker-scroll {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.topic-words-sub-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.topic-words-sub-label {
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  min-width: 90px;
  padding-top: 3px;
  background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0.85;
}

.topic-words-sub-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.topic-word-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border: 1.5px solid var(--border-color);
  border-radius: 14px;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: line-through;
}

.topic-word-btn.active {
  border-color: #0ea5e9;
  color: #0ea5e9;
  background: rgba(14, 165, 233, 0.06);
  text-decoration: none;
}

.topic-word-btn:hover {
  border-color: #06b6d4;
  color: #06b6d4;
  text-decoration: none;
}

.topic-word-count {
  font-size: 11px;
  opacity: 0.7;
  font-weight: 400;
}

.topic-logic-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-bottom: 4px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-color);
}

.topic-logic-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 2px;
}

.topic-logic-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.topic-logic-btn:hover {
  border-color: #06b6d4;
  color: #06b6d4;
}

.topic-logic-btn.active {
  border-color: #0ea5e9;
  color: #0ea5e9;
  background: rgba(14, 165, 233, 0.1);
}
/* ── End Topics row ──────────────────────────────────────────────── */

/* Nav collapsible */
.nav-collapsible {
  width: 100%;
  overflow: hidden;
  max-height: 300px;
  transition: max-height 0.25s ease, opacity 0.25s ease;
  opacity: 1;
}

.nav-collapsed .nav-collapsible {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.nav-toggle-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px 5px 12px;
  border-radius: 99px;
  background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
  border: none;
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.nav-toggle-btn:hover {
  opacity: 0.85;
}

.nav-toggle-btn svg {
  transition: transform 0.25s ease;
}

.nav-collapsed .nav-toggle-btn svg {
  transform: rotate(180deg);
}

.category-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 6px 12px;
  background-color: var(--background-hover);
  border-radius: 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
  white-space: nowrap;
  margin: 0 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.keyword-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 6px 12px;
  background-color: var(--background-hover);
  border-radius: 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
  white-space: nowrap;
  cursor: pointer;
  margin: 0 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.category-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  min-width: 20px;
  height: 20px;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
  font-size: 12px;
  padding: 0 6px;
  transition: var(--transition);
}

.category-button:hover {
  background-color: var(--border-color);
  color: var(--text-color);
}

.keyword-tag:hover {
  background-color: var(--border-color);
  color: var(--text-color);
}

.category-button.active {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

/* 作者按钮样式 */
.author-button {
  background-color: rgba(var(--primary-rgb), 0.08); /* primary tint */
  color: var(--primary-color);
  border: 1px solid rgba(var(--primary-rgb), 0.25);
}

.author-button:hover {
  background-color: rgba(var(--primary-rgb), 0.12);
  border-color: rgba(var(--primary-rgb), 0.35);
}

.author-button.active {
  background: var(--gradient-primary);
  color: white;
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25);
}

/* 关键词按钮样式 */
.keyword-button {
  background-color: rgba(167, 139, 250, 0.10); /* accent tint */
  color: var(--accent-color);
  border: 1px solid rgba(167, 139, 250, 0.25);
}

.keyword-button:hover {
  background-color: rgba(167, 139, 250, 0.14);
  border-color: rgba(167, 139, 250, 0.35);
}

.keyword-button.active {
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--secondary-color) 100%);
  color: white;
  border-color: var(--accent-color);
  box-shadow: 0 2px 8px rgba(167, 139, 250, 0.25);
}

.keyword-tag.active {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.category-button.active .category-count {
  background-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

/* 标签动画效果 */
.keyword-tag.tag-appear,
.category-button.tag-appear {
  animation: tagAppear 0.3s ease;
}

.keyword-tag.tag-highlight,
.category-button.tag-highlight {
  animation: tagHighlight 1s ease;
}

@keyframes tagAppear {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes tagHighlight {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(var(--primary-rgb), 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.6);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(var(--primary-rgb), 0.4);
  }
}

/* 主要内容区域 */
main {
  flex: 1;
  padding: 0 24px 24px 24px; /* 修改上边距为0，保持左右下边距 */
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

/* 论文容器 - 网格视图 */
.paper-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 30px;
  margin-top: 24px;
  align-items: flex-start;
}

/* 论文容器 - 列表视图 */
.paper-container.list-view {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 论文卡片 - 网格视图 */
.paper-card {
  background-color: var(--card-bg-color);
  border-radius: 4px;
  box-shadow: var(--shadow-sm);
  overflow: visible;
  transition: var(--transition);
  cursor: pointer;
  height: auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  max-width: 100%;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: break-word;
}

.paper-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  background-color: var(--background-light);
}

.paper-card-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.paper-card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.5;
  overflow: visible;
}

.paper-card-authors {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.4;
  overflow: visible;
}

/* 作者列表项样式 */
.paper-card-authors .author-item {
  display: inline;
  white-space: nowrap;
}

/* 作者省略号样式 */
.paper-card-authors .author-ellipsis {
  display: inline;
  color: var(--text-tertiary);
  font-weight: 500;
  margin: 0 2px;
  user-select: none;
}

.paper-card-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.category-tag {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  background-color: var(--background-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-accent);
}

.paper-card-body {
  padding: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.paper-card-comment {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: -12px;
  margin-bottom: 12px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.paper-comment {
  font-style: italic;
  color: var(--text-secondary);
}

.paper-card-summary {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  margin-bottom: 20px;
  border-left: 3px solid var(--primary-color);
  padding-left: 12px;
  background-color: rgba(var(--primary-rgb), 0.05);
  padding: 12px;
  border-radius: 6px;
}

.paper-card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.paper-card-date {
  font-size: 12px;
  color: var(--text-tertiary);
}

.paper-card-link {
  font-size: 14px;
  color: var(--primary-color);
  font-weight: 500;
}

/* 论文卡片 - 列表视图 */
.list-view .paper-card {
  flex-direction: row;
  align-items: center;
  padding: 16px;
  gap: 20px;
}

.list-view .paper-card-header {
  padding: 0;
  border-bottom: none;
  flex: 1;
}

.list-view .paper-card-body {
  padding: 0;
  flex: 2;
}

.list-view .paper-card-footer {
  margin-top: 0;
  padding: 0;
  flex: 0 0 auto;
}

/* 论文详情模态框 */
.paper-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  z-index: 1100;
  overflow-y: auto;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.paper-modal.active {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.paper-modal-content {
  background-color: var(--card-bg-color);
  border-radius: 4px;
  box-shadow: var(--shadow-md);
  width: 95%;
  max-width: 1000px;
  margin: 60px auto;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.paper-modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.paper-modal-header h2 {
  font-size: 20px;
  font-weight: 600;
}

.paper-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.paper-modal-body h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

.paper-modal-body p {
  margin-bottom: 16px;
  line-height: 1.6;
}

.paper-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

.paper-navigation {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.paper-modal-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.paper-modal-footer .button.icon-button {
  width: 40px;
  height: 40px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
  border: none;
  background: none;
}

.paper-modal-footer .button.icon-button:not(.primary) {
  color: var(--text-primary);
}

.paper-modal-footer .button.icon-button:not(.primary):hover {
  color: var(--primary-color);
  transform: translateY(-1px);
}

/* Special styling for arXiv logo */
.paper-modal-footer #paperLink svg {
  width: 60px;
  height: 27px;
  margin: -2px -10px;
}

.paper-modal-footer .button.icon-button.primary {
  background: none;
}

.paper-modal-footer .button.icon-button.primary:hover {
  transform: translateY(-1px);
}

/* Tooltip styles */
.paper-modal-footer .button.icon-button::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 12px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  pointer-events: none;
  margin-bottom: 5px;
}

.paper-modal-footer .button.icon-button:hover::after {
  opacity: 1;
  visibility: visible;
}

.navigation-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* When paper modal is opened from a digest — hide nav and exclude UI */
.paper-modal.from-digest .paper-navigation,
.paper-modal.from-digest #digestExcludeFooterBtn { display: none !important; }

.paper-position {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* 日期选择器样式 */
.date-picker-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: none;
}

.date-picker-modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.date-picker-content {
  background-color: var(--card-bg-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 360px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalFadeIn 0.3s ease forwards;
  padding: 24px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.date-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.date-picker-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.date-picker-body {
  padding: 0;
}

.date-picker-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 16px 0;
  color: var(--primary-color);
  text-align: center;
}

.flatpickr-container {
  margin-bottom: 20px;
  width: 100%;
}

.flatpickr-container input {
  display: none;
}

/* Make flatpickr calendar take full width */
.flatpickr-calendar {
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
}

.flatpickr-months {
  width: 100% !important;
  padding: 0;
  margin-bottom: 10px;
  background-color: transparent !important;
}

.flatpickr-month {
  background-color: transparent !important;
  color: var(--text-color) !important;
}

.flatpickr-current-month {
  padding: 0 !important;
  font-size: 18px !important;
  font-weight: 600 !important;
}

.flatpickr-monthDropdown-months {
  font-weight: 600 !important;
  color: var(--text-color) !important;
}

.flatpickr-prev-month, .flatpickr-next-month {
  padding: 5px !important;
  fill: var(--primary-color) !important;
  color: var(--primary-color) !important;
}

.flatpickr-prev-month:hover, .flatpickr-next-month:hover {
  background-color: rgba(0, 0, 0, 0.05) !important;
  border-radius: 50% !important;
}

.flatpickr-weekdays {
  width: 100% !important;
  background-color: transparent !important;
  margin-bottom: 5px;
}

.flatpickr-weekday {
  height: 28px;
  line-height: 28px;
  flex: 1;
  background-color: transparent !important;
  color: var(--text-secondary) !important;
  font-weight: 500 !important;
  font-size: 14px !important;
}

.flatpickr-days {
  width: 100% !important;
  display: flex !important;
  justify-content: center !important;
  background-color: transparent !important;
}

.dayContainer {
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  display: flex !important;
  flex-wrap: wrap !important;
  /* justify-content: flex-start !important; */
  padding: 0 !important;
}

.flatpickr-day {
  margin: 2px;
  height: 36px !important;
  line-height: 36px !important;
  border-radius: 50% !important;
  /* max-width: 36px !important; */
  width: calc(100% / 7 ) !important;
  flex: 0 0 calc(100% / 7 ) !important;
  display: inline-flex !important;
  justify-content: center !important;
  align-items: center !important;
  box-sizing: border-box !important;
  font-weight: 400 !important;
  color: var(--text-color) !important;
  border: none !important;
}

.flatpickr-day.today {
  border: none !important;
  background-color: rgba(var(--primary-rgb), 0.1) !important;
  color: var(--primary-color) !important;
  font-weight: 600 !important;
}

.flatpickr-day.selected, 
.flatpickr-day.startRange, 
.flatpickr-day.endRange, 
.flatpickr-day.selected.inRange, 
.flatpickr-day.startRange.inRange, 
.flatpickr-day.endRange.inRange, 
.flatpickr-day.selected:focus, 
.flatpickr-day.startRange:focus, 
.flatpickr-day.endRange:focus, 
.flatpickr-day.selected:hover, 
.flatpickr-day.startRange:hover, 
.flatpickr-day.endRange:hover, 
.flatpickr-day.selected.prevMonthDay, 
.flatpickr-day.startRange.prevMonthDay, 
.flatpickr-day.endRange.prevMonthDay, 
.flatpickr-day.selected.nextMonthDay, 
.flatpickr-day.startRange.nextMonthDay, 
.flatpickr-day.endRange.nextMonthDay {
  background: var(--gradient-primary) !important;
  border-color: var(--primary-color) !important;
  color: white !important;
  font-weight: 600 !important;
  box-shadow: var(--shadow-sm) !important;
}

.flatpickr-day.inRange, 
.flatpickr-day.prevMonthDay.inRange, 
.flatpickr-day.nextMonthDay.inRange, 
.flatpickr-day.today.inRange, 
.flatpickr-day.prevMonthDay.today.inRange, 
.flatpickr-day.nextMonthDay.today.inRange {
  background: rgba(var(--primary-rgb), 0.15) !important;
  border-color: transparent !important;
  color: var(--text-color) !important;
  box-shadow: none !important;
}

.flatpickr-day:hover, 
.flatpickr-day.prevMonthDay:hover, 
.flatpickr-day.nextMonthDay:hover, 
.flatpickr-day:focus, 
.flatpickr-day.prevMonthDay:focus, 
.flatpickr-day.nextMonthDay:focus {
  background: rgba(0, 0, 0, 0.05) !important;
  border-color: transparent !important;
}

.flatpickr-day.flatpickr-disabled, 
.flatpickr-day.flatpickr-disabled:hover,
.flatpickr-day.prevMonthDay, 
.flatpickr-day.nextMonthDay, 
.flatpickr-day.notAllowed {
  color: rgba(57, 57, 57, 0.3) !important;
  background: transparent !important;
  cursor: not-allowed;
}

.date-mode-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 12px 0 8px;
  border-top: 1px solid var(--border-color);
  margin: 16px -24px 0 -24px;
  background-color: rgba(0, 0, 0, 0.02);
}

.date-mode-btn {
  padding: 5px 16px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-color);
  background: var(--card-bg-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.date-mode-btn:first-child { border-radius: 8px 0 0 8px; }
.date-mode-btn:last-child  { border-radius: 0 8px 8px 0; border-left: none; }
.date-mode-btn:not(:first-child):not(:last-child) { border-left: none; }
.date-mode-btn.active {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
}

.load-multi-btn {
  display: block;
  margin: 8px auto 0;
  font-size: 13px;
  padding: 6px 20px;
}

/* keep old toggle styles in case anything references them */
.date-range-selector { display: none; }

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
  margin: 0 10px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: .3s;
  border-radius: 24px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

input:checked + .toggle-slider {
  background: var(--gradient-primary);
}

input:focus + .toggle-slider {
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(var(--primary-rgb), 0.2);
}

input:checked + .toggle-slider:before {
  transform: translate(20px, -50%);
}

.toggle-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  user-select: none;
  min-width: 40px;
  text-align: center;
}

@media (max-width: 768px) {
  .header-content {
    padding: 12px 16px 0;
    flex-wrap: wrap;
  }

  /* Row 1: logo + controls */
  .header-left {
    flex: 1;
  }

  .header-controls {
    margin-left: 0;
  }

  /* Row 2: date picker spans full width */
  .header-center {
    order: 3;
    width: 100%;
    justify-content: center;
    padding: 6px 0 10px;
    border-top: 1px solid var(--border-color);
    flex: 0 0 100%;
  }
  
  .category-scroll {
    padding: 8px 0;
    justify-content: flex-start;
    flex-wrap: nowrap;
  }
  
  .filter-scroll {
    padding: 0 16px 8px;
    margin-top: -4px;
    gap: 6px;
    max-width: 100%; /* 在移动端占满宽度 */
    justify-content: flex-start; /* 在移动端左对齐 */
    flex-wrap: nowrap; /* 确保不换行 */
  }
  
  .category-button, .keyword-tag {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 14px;
    margin: 0 2px; /* 调整为水平边距 */
  }
  
  main {
    padding: 0 16px 16px 16px; /* 调整与类别/关键词区域保持一致 */
    padding-left: 10px;
  }
  
  .paper-container {
    padding: 0;
    margin-top: 16px;
  }
  
  .keyword-tag-container {
    margin: 6px 16px 0;
    padding: 8px 12px;
  }
  
  .keyword-tag-header {
    margin-bottom: 6px;
  }
  
  .keyword-tags {
    gap: 6px;
    min-height: 24px;
    padding: 4px;
  }
  
  .keyword-tags .keyword-tag {
    padding: 3px 8px;
    font-size: 12px;
    border-radius: 12px;
  }
  
  .list-view .paper-card {
    flex-direction: column;
  }
  
  .list-view .paper-card-header,
  .list-view .paper-card-body {
    width: 100%;
  }
  
  /* Paper index badge — flow inline instead of absolute to avoid clipping */
  .paper-index-badge {
    position: static;
    transform: none;
    flex-shrink: 0;
    margin-right: 6px;
  }

  .paper-modal-header h2 {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
  }

  /* Paper modal — full screen on phones */
  .paper-modal-content {
    width: 100%;
    max-width: 100%;
    margin: 0;
    max-height: 100dvh;
    border-radius: 0;
  }

  .paper-sections {
    flex-direction: column;
  }

  .paper-modal-header,
  .paper-modal-body {
    padding: 14px 16px;
  }

  /* Digest modal — bottom sheet */
  .digest-modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .digest-modal {
    max-height: 93dvh;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }

  .digest-modal-header {
    padding: 16px 16px 12px;
  }

  .digest-modal-body {
    padding: 14px 16px 20px;
  }

  /* Settings panel */
  .settings-panel-header {
    padding: 16px 16px 12px;
  }

  .settings-panel-body {
    padding: 16px 16px 24px;
  }

  /* Header controls spacing */
  .header-controls {
    gap: 10px;
  }

  /* Main content padding */
  main {
    padding: 0 12px 16px;
  }

  /* Paper grid — single column, tighter gap */
  .paper-container {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* Search input — shrink on narrow screens */
  #textSearchInput {
    width: min(220px, 42vw);
  }

  /* Category / filter bar padding */
  .category-label-container,
  .topics-label-container {
    padding-left: 12px;
    padding-right: 12px;
  }

  .filter-scroll {
    padding-left: 12px;
    padding-right: 12px;
  }

  .category-nav-label, .filter-nav-label {
    min-width: 68px;
    font-size: 12px;
  }

  /* Date picker */
  .date-picker-content {
    width: 100%;
    border-radius: 0;
    margin: 0;
  }
}

/* ── Small phones (≤ 430px) ───────────────────────────────────────────────── */
@media (max-width: 430px) {
  /* Logo — shrink and hide "AI enabled" badge to save space */
  .site-title { font-size: 14px; }
  #aiEnabledBadge { display: none; }

  /* Tighter icon row */
  .header-controls { gap: 6px; }
  .icon-button { width: 30px; height: 30px; }

  /* Date button */
  .header-date-btn { font-size: 14px; padding: 4px 10px; }
  .header-date-nav-btn { padding: 4px 6px; }

  /* Hide "CATEGORY" / "TOPICS" labels to reclaim horizontal space */
  .category-nav-label,
  .filter-nav-label,
  .topics-nav-label {
    display: none;
  }

  /* Edge padding tighter */
  main { padding: 0 8px 16px; }

  .category-label-container,
  .topics-label-container {
    padding-left: 8px;
    padding-right: 8px;
  }

  .filter-scroll {
    padding-left: 8px;
    padding-right: 8px;
  }

  /* Paper modal padding */
  .paper-modal-header,
  .paper-modal-body { padding: 12px; }

  /* Digest / settings padding */
  .digest-modal-header,
  .settings-panel-header { padding: 14px 12px 10px; }

  .digest-modal-body,
  .settings-panel-body { padding: 12px 12px 20px; }

  /* Floating digest button */
  .ai-digest-float { bottom: 16px; right: 14px; }

  /* Paper cards — tighter */
  .paper-container { gap: 10px; }

  /* Keyword drill-down container */
  .keyword-tag-container { margin: 4px 8px 0; }
}

/* 加载状态 */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  grid-column: 1 / -1;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spinner 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

/* 页脚 */
footer {
  background-color: #fff;
  border-top: 1px solid var(--border-color);
  padding: 24px;
  margin-top: auto;
}

.footer-content {
  max-width: 1440px;
  margin: 0 auto;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 14px;
}

/* 添加对论文索引号和详情部分的样式 */
/* .paper-card-index moved to digest section below */

.paper-sections {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.ai-generate-btn {
  font-size: 14px;
  padding: 8px 20px;
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(102,126,234,0.4);
  transition: opacity 0.2s, transform 0.1s;
}

.ai-generate-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.ai-generate-btn:active { transform: translateY(0); }

.ai-generate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.ai-prompt-edit-btn {
  font-size: 13px;
  padding: 6px 14px;
  opacity: 0.7;
}

.ai-generate-error {
  margin-top: 6px;
  font-size: 12px;
  color: #e74c3c;
  min-height: 16px;
}

.ai-save-status {
  font-size: 12px;
  min-height: 16px;
  margin-top: 4px;
}
.ai-save-status.saving { color: var(--text-secondary); }
.ai-save-status.saved  { color: #16a34a; }
.ai-save-status.save-error { color: #e74c3c; }

/* ── Paper card index badge (digest exclude) ─────────────────────── */
.paper-card-index {
  position: absolute;
  top: -10px;
  left: -10px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  height: 26px;
  min-width: 26px;
  border-radius: 99px;
  border: none;
  background: var(--gradient-primary);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(102,126,234,0.25);
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  transition: background 0.2s, box-shadow 0.2s;
}
/* Number always occupies exactly 26px so it's centered in the circle */
.card-idx-num {
  width: 26px;
  text-align: center;
  font-size: 12px;
  flex-shrink: 0;
  line-height: 26px;
}
.card-idx-action {
  font-size: 10px;
  font-weight: 500;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  padding-right: 0;
  transition: max-width 0.2s ease, opacity 0.15s ease, padding-right 0.2s ease;
}
.paper-card-index:hover .card-idx-action {
  max-width: 60px;
  opacity: 1;
  padding-right: 8px;
}
.paper-card-index.excluded {
  background: #9ca3af;
  box-shadow: none;
}

/* ── Digest nav button ───────────────────────────────────────────── */
.digest-nav-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 5px 8px 5px 10px;
  border-radius: 99px;
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  border: none;
  color: white;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.digest-nav-btn:hover { opacity: 0.85; }
.digest-nav-label {
  font-size: 13px;
  font-weight: 600;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-width 0.25s ease, opacity 0.2s ease, margin-left 0.25s ease;
  margin-left: 0;
}
.digest-nav-btn:hover .digest-nav-label {
  max-width: 120px;
  opacity: 1;
  margin-left: 6px;
}
/* Generating state — purple, label always visible */
.digest-nav-btn[data-state="generating"] {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}
.digest-nav-btn[data-state="generating"] .digest-nav-label {
  max-width: 120px;
  opacity: 1;
  margin-left: 6px;
}
/* Done state — green, label always visible */
.digest-nav-btn[data-state="result"] {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}
.digest-nav-btn[data-state="result"] .digest-nav-label {
  max-width: 120px;
  opacity: 1;
  margin-left: 6px;
}
/* Spinner inside nav button */
.digest-nav-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: white;
  border-radius: 50%;
  animation: spinner 0.75s linear infinite;
  flex-shrink: 0;
}

/* ── Digest modal overlay ────────────────────────────────────────── */
.digest-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.digest-modal {
  background: var(--card-bg-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* intermediate wrappers rendered by JS must propagate flex height */
#digestModalContent,
#dailyDigestModalContent {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.digest-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.digest-modal-title { font-size: 20px; font-weight: 700; margin: 0; }
.digest-modal-subtitle { font-size: 13px; color: var(--text-secondary); margin: 4px 0 0; }
.digest-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: 6px;
  flex-shrink: 0;
}
.digest-close-btn:hover { background: var(--background-hover); }

.digest-modal-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 20px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.digest-section { display: flex; flex-direction: column; gap: 10px; }
.digest-section-head { display: flex; align-items: center; justify-content: space-between; }
.digest-sec-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); }
.digest-prompt-note { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 11px; }
.digest-count { font-size: 12px; color: var(--text-secondary); }

/* ── Digest paper cards ──────────────────────────────────────────── */
.digest-papers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}
.digest-paper-card {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  background: var(--card-bg-color);
  user-select: none;
}
.digest-paper-card:hover { border-color: var(--primary-color); background: var(--background-hover); }
.digest-paper-card.deselected { opacity: 0.4; }
.digest-ref-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary-color);
  min-width: 22px;
  flex-shrink: 0;
  margin-top: 2px;
}
.digest-paper-info { flex: 1; min-width: 0; }
.digest-paper-title { font-size: 12px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.digest-paper-meta { font-size: 11px; color: var(--text-secondary); margin-top: 3px; display: block; }
.digest-check { font-size: 13px; color: var(--primary-color); flex-shrink: 0; margin-top: 2px; }
.digest-expand-btn {
  grid-column: 1 / -1;
  background: none;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  padding: 8px;
  cursor: pointer;
  transition: var(--transition);
}
.digest-expand-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }

/* ── Digest prompt ───────────────────────────────────────────────── */
.digest-prompt-fixed {
  background: var(--background-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  font-family: inherit;
  line-height: 1.6;
  white-space: pre-wrap;
  margin: 0;
}
.digest-user-prompt {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--card-bg-color);
  color: var(--text-color);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.digest-user-prompt:focus { outline: none; border-color: var(--primary-color); }

/* ── Digest actions ──────────────────────────────────────────────── */
.digest-actions { display: flex; flex-direction: column; gap: 8px; }
.digest-generate-btn {
  align-self: flex-start;
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  border: none;
  font-size: 15px;
  padding: 10px 28px;
}
.digest-error { font-size: 12px; color: #e74c3c; min-height: 16px; margin: 0; }

/* ── Digest generating state ─────────────────────────────────────── */
.digest-generating-body {
  display: flex;
  align-items: center;
  justify-content: center;
}
.digest-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 60px 0;
  text-align: center;
}
.digest-loading-label { font-size: 16px; font-weight: 600; color: var(--text-color); margin: 0; }
.digest-loading-hint { font-size: 13px; color: var(--text-secondary); margin: 0; }

/* ── Digest result title ─────────────────────────────────────────── */
.digest-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.digest-title-display {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
}
.digest-rename-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 15px;
  padding: 2px 4px;
  flex-shrink: 0;
  margin-top: 2px;
}
.digest-rename-btn:hover { color: var(--primary-color); }
.digest-title-input {
  font-size: 20px;
  font-weight: 700;
  border: none;
  border-bottom: 2px solid var(--primary-color);
  outline: none;
  background: transparent;
  color: var(--text-color);
  width: 100%;
  padding: 0;
}

/* ── Digest result footer ────────────────────────────────────────── */
.digest-result-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px 16px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
  gap: 10px;
}
.digest-result-footer-right { display: flex; gap: 8px; }
.digest-edit-btn { font-size: 13px; }
.digest-copy-btn { font-size: 13px; }

/* Article typography */
.digest-article {
  line-height: 1.8;
  font-size: 15px;
  color: var(--text-color);
}
.digest-article h1 { font-size: 22px; font-weight: 700; margin: 24px 0 8px; }
.digest-article h2 { font-size: 18px; font-weight: 700; margin: 28px 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--border-color); }
.digest-article h3 { font-size: 16px; font-weight: 600; margin: 20px 0 8px; }
.digest-article p { margin: 0 0 14px; }
.digest-article ul { margin: 0 0 14px; padding-left: 22px; }
.digest-article li { margin-bottom: 6px; }
.digest-article strong { font-weight: 700; }
.digest-article sup.cite { font-size: 10px; color: var(--primary-color); }
.digest-article sup.cite a { color: inherit; text-decoration: none; cursor: pointer; }
.digest-article sup.cite a:hover { text-decoration: underline; }
.digest-references li a { cursor: pointer; }

/* References */
.digest-references { border-top: 1px solid var(--border-color); padding-top: 16px; }
.digest-references h3 { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); margin: 0 0 12px; }
.digest-references ol { padding-left: 20px; margin: 0; }
.digest-references li { font-size: 13px; margin-bottom: 8px; line-height: 1.5; }
.digest-references a { color: var(--primary-color); text-decoration: none; font-weight: 500; }
.digest-references a:hover { text-decoration: underline; }
.digest-ref-meta { font-size: 12px; color: var(--text-secondary); }

/* ── Exclude button in paper modal ──────────────────────────────── */
.paper-footer-center {
  display: flex;
  align-items: center;
  justify-content: center;
}
.digest-exclude-modal-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 8px 0;
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 99px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.digest-exclude-modal-btn:hover { border-color: #e74c3c; color: #e74c3c; }
.digest-exclude-modal-btn.excluded { border-color: var(--primary-color); color: var(--primary-color); }

.prompt-suffix-area {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-secondary, #f8f9fa);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.prompt-suffix-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.prompt-suffix-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm, 4px);
  font-size: 13px;
  resize: vertical;
  box-sizing: border-box;
  background: var(--bg-primary, #fff);
  color: var(--text-primary);
}

.ai-prompt-save-btn {
  margin-top: 8px;
  font-size: 12px;
  padding: 4px 12px;
}

.prompt-presets-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.prompt-preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary, #fff);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  max-width: 260px;
}

.prompt-preset-chip:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.prompt-preset-chip.selected {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: #fff;
}

.prompt-preset-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-preset-delete {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.prompt-preset-delete:hover { opacity: 1; }

.paper-section {
  background-color: rgba(var(--primary-rgb), 0.03);
  border-radius: var(--radius-sm);
  padding: 16px;
  border-left: 3px solid var(--primary-color);
}

.paper-section h4 {
  margin-top: 0;
  margin-bottom: 8px;
  color: var(--primary-color);
  font-size: 16px;
}

.original-abstract {
  font-style: italic;
  border-left: 3px solid var(--border-color);
  padding-left: 16px;
  color: var(--text-secondary);
}

/* 在列表视图中调整索引显示 */
.list-view .paper-card-index {
  position: relative;
  top: auto;
  left: auto;
  margin-right: 12px;
  margin-top: auto;
  margin-bottom: auto;
}

/* 设置模态框样式 */
.settings-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.settings-modal.active {
  opacity: 1;
  visibility: visible;
}

.settings-modal-content {
  background-color: var(--card-bg-color);
  border-radius: var(--radius-md);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.settings-modal.active .settings-modal-content {
  transform: translateY(0);
}

.settings-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.settings-modal-header h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.settings-modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(85vh - 140px);
}

.settings-section {
  margin-bottom: 28px;
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-color);
}

.settings-item {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-item:last-child {
  margin-bottom: 0;
}

.settings-item label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.settings-input {
  background-color: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text-color);
  transition: var(--transition);
  width: 180px;
}

.settings-input:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.2);
}

.settings-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
}

.tag-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 180px;
}

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

.selected-tags .category-tag {
  display: inline-flex;
  align-items: center;
  background-color: rgba(var(--primary-rgb), 0.1);
  color: var(--primary-color);
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.selected-tags .category-tag:hover {
  background-color: rgba(var(--primary-rgb), 0.2);
}

.range-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 180px;
}

.settings-range {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--gradient-light);
  border-radius: 2px;
  outline: none;
}

.settings-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gradient-primary);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.settings-range::-moz-range-thumb {
  width: 16px;
  height: 15px;
  border-radius: 50%;
  background: var(--gradient-primary);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  border: none;
}

#fontSizeValue {
  font-size: 14px;
  color: var(--text-secondary);
  min-width: 40px;
  text-align: right;
}

@media (max-width: 768px) {
  .settings-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .settings-input, 
  .tag-selector,
  .range-selector {
    width: 100%;
  }
}

.clear-button {
  background-color: var(--text-tertiary);
  color: white;
  font-size: 13px;
  padding: 4px 10px;
  margin: 4px 2px; /* 添加边距与其他按钮一致 */
}

.clear-button:hover {
  background-color: var(--text-secondary);
}

/* 类别标签和关键词标签样式 */
.category-label {
  font-weight: 600;
  color: var(--text-color);
  margin-right: 6px;
}

.keyword-label {
  font-weight: 600;
  color: var(--text-color);
  margin-right: 6px;
  white-space: nowrap;
  margin-left: 0;
  min-width: 90px; /* 减少宽度从120px到90px，与Category标签保持一致 */
}

.author-label {
  font-weight: 600;
  color: var(--text-color);
  margin-right: 6px;
  white-space: nowrap;
  margin-left: 0;
  min-width: 90px; /* 与Category和Keyword标签保持一致 */
}

.logic-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-primary);
  color: white;
  border-radius: 12px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
  margin-right: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  letter-spacing: 0.5px;
}

.filter-logic-hint {
  font-size: 11px;
  opacity: 0.85;
  font-weight: 500;
  margin-left: 4px;
  letter-spacing: 0;
  text-transform: none;
}

  padding-left: 3px; /* 减少左侧内边距 */
}


.author-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  margin-right: 8px;
  background-color: var(--tag-bg);
  color: var(--text-secondary);
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.author-tag.active {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.author-tag:hover {
  background-color: var(--tag-hover-bg);
}

.author-tag.active:hover {
  background: var(--gradient-primary-hover);
}

/* 高亮样式 */
.keyword-highlight {
  background-color: rgba(255, 215, 0, 0.15);
  border-radius: 3px;
  padding: 0 2px;
  font-weight: inherit;
  color: inherit;
  position: relative;
  display: inline-block;
  box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.3);
  transition: all 0.2s ease;
}

.keyword-highlight:hover {
  background-color: rgba(255, 215, 0, 0.25);
  box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.4);
}

.author-highlight {
  background-color: rgba(255, 215, 0, 0.12);
  border-radius: 3px;
  padding: 0 2px;
  font-weight: inherit;
  color: inherit;
  position: relative;
  display: inline-block;
  box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.25);
  transition: all 0.2s ease;
}

.author-highlight:hover {
  background-color: rgba(255, 215, 0, 0.2);
  box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.35);
}

.paper-modal-body .highlight-info .keyword-sample {
  background-color: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.3);
}

.paper-modal-body .highlight-info .author-sample {
  background-color: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.25);
}

/* 添加一个高亮动画效果 */
@keyframes highlightPulse {
  0% {
    box-shadow: 0 0 0 1px rgba(var(--primary-rgb), 0.3);
  }
  50% {
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.5);
  }
  100% {
    box-shadow: 0 0 0 1px rgba(var(--primary-rgb), 0.3);
  }
}

.paper-card:hover .keyword-highlight,
.paper-card:hover .author-highlight {
  animation: highlightPulse 1.5s ease-in-out infinite;
}

/* 在弹窗中也保持高亮的良好显示 */
.paper-modal-body .keyword-highlight,
.paper-modal-body .author-highlight {
  display: inline;
  line-height: inherit;
}

/* 当同时存在关键词和作者高亮时，在模态窗口中显示一个提示 */
.paper-modal-body .highlight-info {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  gap: 10px;
}

.paper-modal-body .highlight-info span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.paper-modal-body .highlight-info .sample {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

/* 匹配论文卡片的高亮样式 */
.paper-card.matched-paper {
  box-shadow: 0 0 0 2px var(--gold-color), var(--shadow-md);
  background-color: var(--match-highlight);
  position: relative;
  z-index: 2;
  border: 1px solid rgba(255, 215, 0, 0.45);
}

.paper-card.matched-paper:hover {
  box-shadow: 0 0 0 2px var(--gold-color), var(--shadow-lg);
  transform: translateY(-3px);
  border: 1px solid rgba(255, 215, 0, 0.5);
}

/* 移除这个 ::after 星星，只使用 .match-badge */
.paper-card.matched-paper::after {
  display: none;
}

/* 保留原始的关键帧动画，因为其他地方可能会用到 */
@keyframes goldPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(255, 215, 0, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 215, 0, 0);
  }
}

/* 为匹配论文添加列表视图的特殊样式 */
.list-view .paper-card.matched-paper {
  border-left: 4px solid var(--gold-color);
}

/* 优化移动端显示效果 */
@media (max-width: 768px) {
  .paper-card.matched-paper::after {
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background-size: 12px 12px;
  }
}

/* 匹配论文在详情页中的样式 */
.matched-paper-details {
  position: relative;
  border-left: 4px solid var(--gold-color);
  padding-left: 16px;
  background-color: var(--match-highlight);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: inset 0 0 0 1px rgba(255, 215, 0, 0.3);
}

.match-indicator {
  position: absolute;
  top: -10px;
  right: 10px;
  background: var(--gold-gradient);
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px 4px 28px;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(212, 175, 55, 0.4);
  z-index: 1;
  letter-spacing: 0.5px;
  animation: fadeIn 0.5s ease-out;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2L15.09 8.26L22 9.27L17 14.14L18.18 21.02L12 17.77L5.82 21.02L7 14.14L2 9.27L8.91 8.26L12 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 8px center;
  background-size: 14px 14px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
  .matched-paper-details {
    padding: 15px;
  }
  
  .match-indicator {
    font-size: 11px;
    padding: 3px 10px;
    top: -8px;
    right: 8px;
  }
}

/* 匹配标记样式 */
.match-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 24px;
  height: 24px;
  background: var(--gold-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(212, 175, 55, 0.5);
  z-index: 5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='white' stroke='white' stroke-width='1' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2L15.09 8.26L22 9.27L17 14.14L18.18 21.02L12 17.77L5.82 21.02L7 14.14L2 9.27L8.91 8.26L12 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
  animation: goldPulse 2s infinite;
  cursor: help;
}

@keyframes starShine {
  0% { 
    transform: scale(1) rotate(0deg); 
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.5);
  }
  50% { 
    transform: scale(1.1) rotate(5deg); 
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.7);
  }
  100% { 
    transform: scale(1) rotate(0deg); 
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.5);
  }
}

.list-view .match-badge {
  position: absolute;
  top: -6px; 
  right: -6px;
  transform: none;
}

@media (max-width: 768px) {
  .match-badge {
    width: 20px;
    height: 20px;
    background-size: 12px 12px;
    top: -4px;
    right: -4px;
  }
}

/* 匹配信息样式 */
.match-info {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  margin: 16px 0;
  padding: 15px;
  background-color: rgba(255, 215, 0, 0.05);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 215, 0, 0.2);
  position: relative;
}

.match-star-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: var(--gold-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.4);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='white' stroke='white' stroke-width='1' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2L15.09 8.26L22 9.27L17 14.14L18.18 21.02L12 17.77L5.82 21.02L7 14.14L2 9.27L8.91 8.26L12 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px 20px;
  animation: starTwinkle 4s infinite;
}

@keyframes starTwinkle {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.9;
    box-shadow: 0 2px 12px rgba(255, 215, 0, 0.7);
  }
}

.match-details {
  flex-grow: 1;
}

.match-details h4 {
  margin: 0 0 8px 0;
  color: var(--gold-dark);
  font-size: 16px;
  font-weight: 600;
}

.match-details p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

@media (max-width: 768px) {
  .match-info {
    padding: 12px;
    gap: 12px;
  }
  
  .match-star-icon {
    width: 30px;
    height: 30px;
    background-size: 16px 16px;
  }
  
  .match-details h4 {
    font-size: 15px;
  }
  
  .match-details p {
    font-size: 13px;
  }
}

/* 在移动端优化高亮样式 */
@media (max-width: 768px) {
  .keyword-highlight, .author-highlight {
    padding: 0 1px;
    border-radius: 2px;
  }
}

/* Paper index badge for modal titles */
.paper-index-badge {
  font-weight: 600;
  color: white;
  background: var(--gradient-primary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: 0 2px 4px rgba(var(--primary-rgb), 0.2);
  position: absolute;
  top: -12px;
  left: -12px;
  z-index: 5;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}
.paper-index-badge.excluded {
  background: #9ca3af;
  box-shadow: none;
}
.paper-index-badge:hover {
  opacity: 0.85;
}

/* Random paper indicator */
.random-paper-indicator {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--accent-color);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  z-index: 10001;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: fadeInOut 3s ease-in-out;
  box-shadow: var(--shadow-md);
}

.random-paper-indicator::before {
  content: "🎲";
  font-size: 14px;
}

@keyframes fadeInOut {
  0% { 
    opacity: 0; 
    transform: translateY(-10px) scale(0.9);
  }
  20% { 
    opacity: 1; 
    transform: translateY(0) scale(1);
  }
  80% { 
    opacity: 1; 
    transform: translateY(0) scale(1);
  }
  100% { 
    opacity: 0; 
    transform: translateY(-10px) scale(0.9);
  }
}

@media (max-width: 768px) {
  .random-paper-indicator {
    top: 10px;
    right: 10px;
    padding: 6px 12px;
    font-size: 11px;
  }

}

.pdf-preview-section {
  margin-top: 2rem;
  border-top: 1px solid #eee;
  padding-top: 1rem;
}

.pdf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.pdf-expand-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.pdf-expand-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.pdf-expand-btn svg {
  fill: #666;
  transition: fill 0.2s;
}

.pdf-expand-btn:hover svg {
  fill: #333;
}

.pdf-container {
  transition: all 0.3s ease;
}

.pdf-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999; /* 确保在模态框之上，但在展开的PDF之下 */
}

.pdf-container.expanded {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90vw;
  height: 90vh;
  z-index: 1000;
  background: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pdf-container.expanded iframe {
  height: 100% !important;
}

.pdf-container {
  background: #f5f5f5;
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pdf-container iframe {
  border-radius: 4px;
  background: white;
  display: block;
  margin: 0 auto;
}

/* 回到顶部按钮样式 */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: white;
  border: none;
  border-radius: 12px;
  color: var(--primary-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  z-index: 999;
}

.back-to-top:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(var(--primary-rgb), 0.2);
  background: var(--gradient-light);
}

.back-to-top:active {
  transform: translateY(0);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top svg {
  transition: transform 0.2s ease;
}

.back-to-top:hover svg {
  transform: translateY(-1px);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .back-to-top {
    /* digest float is at bottom:80px h:50px → top at 130px; put back-to-top above it */
    bottom: 140px;
    right: 20px;
    width: 45px;
    height: 45px;
    border-radius: 10px;
  }

  .back-to-top svg {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 430px) {
  .back-to-top {
    /* digest float is at bottom:16px h:50px → top at 66px; put back-to-top above */
    bottom: 76px;
    right: 14px;
  }
}

/* GitHub Link Styles */
.github-link {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  background-color: #f6f8fa;
  color: #24292f;
  border: 1px solid rgba(27, 31, 36, 0.15);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  margin-left: 10px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.github-link:hover {
  background-color: #f3f4f6;
  text-decoration: none;
  border-color: rgba(27, 31, 36, 0.15);
}

.github-link.hot-repo {
  /* background-color: #fff8c5;  Removed yellow background */
  border-color: rgba(27, 31, 36, 0.15);
  color: #24292f;
}

.github-link.outdated-repo {
  /* opacity: 0.7; Removed opacity */
}

.github-stars {
  margin-left: 4px;
  color: #57606a;
}

.hot-icon {
  margin-left: 4px;
}

.warning-icon {
  margin-left: 4px;
}

.paper-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── Saved Digests panel (overlay in index.html) ────────────────── */
/* ── Settings side panel ─────────────────────────────────────────── */
.settings-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 9999;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
}
.settings-panel {
  background: var(--card-bg-color);
  width: min(480px, 100vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
}
.settings-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.settings-panel-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px;
}
.settings-panel-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}
.settings-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.digests-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9999;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
}
.digests-panel {
  background: var(--card-bg-color);
  width: min(380px, 100vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
}
.digests-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.digests-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Compact digest card in panel */
.digest-compact-card {
  border-radius: 0;
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border-color);
}
.digest-compact-card:last-child { border-bottom: none; }
.digest-compact-card:hover { background: var(--background-hover); }
.digest-compact-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}
.digest-compact-title {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 3px;
  line-height: 1.35;
  color: var(--text-color);
}
.digest-compact-preview {
  font-size: 11px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Digest view modal — sits above the digests panel */
#digestViewModal {
  z-index: 10001;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
#digestViewModal .digest-modal {
  max-width: min(1200px, 96vw);
  max-height: 95vh;
}

/* Digest view modal layout */
#digestViewContent {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.digest-view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 28px 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  gap: 12px;
}
.digest-view-header-left { flex: 1; min-width: 0; }
.digest-view-meta { font-size: 12px; color: var(--text-secondary); margin: 0 0 6px; }
.digest-view-title { font-size: 20px; font-weight: 700; margin: 0; line-height: 1.3; }
.digest-view-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 28px 28px;
}
.digest-view-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px 16px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
  gap: 8px;
}
.digest-view-nav {
  display: flex;
  gap: 6px;
}
.digest-view-nav-btn { font-size: 13px; padding: 5px 12px; }
.digest-view-nav-btn:disabled { opacity: 0.35; cursor: default; }

/* ── Subscribe / manage sub modals ───────────────────────────────── */
.manage-sub-modal {
  max-width: min(540px, 95vw);
  height: min(640px, 88vh);
  display: flex;
  flex-direction: column;
}
.subscribe-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.subscribe-modal-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}
.manage-sub-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.subscribe-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-color);
}
.sub-no-topics {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  margin: 0;
}
.sub-schedule-note {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  padding: 10px 12px;
  background: var(--background-secondary);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary-color);
  line-height: 1.5;
}
/* Subscribed topic chips */
.manage-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.manage-sub-chip {
  display: flex;
  align-items: center;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  overflow: hidden;
}
.manage-chip-topic {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 10px;
  font-size: 13px;
  color: var(--text-color);
  transition: background 0.15s;
}
.manage-chip-topic:hover { background: var(--background-hover); }
.manage-chip-topic.active { background: var(--primary-color); color: #fff; }
.manage-chip-remove {
  background: none;
  border: none;
  border-left: 1px solid var(--border-color);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}
.manage-chip-remove:hover { color: #e74c3c; background: #fef2f2; }
.manage-word-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--background-secondary);
  border-radius: var(--radius-sm);
  margin-top: 4px;
}
.manage-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.manage-topic-input {
  flex: 1;
  padding: 7px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--card-bg-color);
  color: var(--text-color);
  font-size: 13px;
  outline: none;
}
.manage-topic-input:focus { border-color: var(--primary-color); }
/* Manage topic cards */
.manage-topic-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.manage-topic-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.15s;
}
.manage-topic-card.active { border-color: var(--primary-color); }
.manage-topic-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}
.manage-topic-card-name {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-color);
  padding: 0;
  white-space: nowrap;
  flex-shrink: 0;
}
.manage-topic-card-name:hover { color: var(--primary-color); }
.manage-topic-card-words {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.topic-card-word {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--background-secondary);
  color: var(--text-secondary);
  white-space: nowrap;
}
.topic-card-word-more {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
  background: none;
  color: var(--text-secondary);
}
.manage-no-words {
  font-size: 11px;
  color: var(--text-secondary);
  font-style: italic;
}
/* Sub-words under add-topic input */
.manage-new-words {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--background-secondary);
  border-radius: var(--radius-sm);
  margin-top: 4px;
}
/* Add-words mode banner */
.manage-add-mode-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-color);
  padding: 6px 10px;
  background: #ede9fe;
  border-radius: var(--radius-sm);
  border-left: 3px solid #6366f1;
}
.manage-add-mode-banner strong { color: #4f46e5; }
.manage-cancel-mode-btn {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 2px 6px;
  border-radius: 4px;
}
.manage-cancel-mode-btn:hover { background: var(--background-hover); color: var(--text-color); }
/* + button on topic cards */
.manage-chip-add-words {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.manage-chip-add-words:hover { color: #6366f1; border-color: #6366f1; }
.manage-chip-add-words.active { background: #6366f1; border-color: #6366f1; color: #fff; }
/* Highlight the target card in add-words mode */
.manage-topic-card.add-words-target { border-color: #6366f1; }

/* Pending badge */
.manage-pending-badge {
  font-size: 11px;
  font-weight: 500;
  color: #b45309;
  background: #fef3c7;
  padding: 2px 7px;
  border-radius: 8px;
  margin-left: 6px;
}
/* Inline topic badge in daily digest date line */
.daily-topic-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  background: #ede9fe;
  color: #6d28d9;
  margin-left: 8px;
  vertical-align: middle;
}
/* Daily digest save button */
.daily-save-btn {
  font-size: 12px;
  padding: 5px 12px;
}
/* Daily digest references */
.daily-digest-refs {
  margin-top: 24px;
}

/* ── Daily digest modal ───────────────────────────────────────────── */
.daily-digest-modal {
  max-width: min(900px, 96vw);
  max-height: 93vh;
  display: flex;
  flex-direction: column;
}
.daily-digest-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px 12px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.daily-digest-title-area { flex: 1; min-width: 0; }
.daily-digest-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-color);
  line-height: 1.3;
  margin-bottom: 8px;
}
.daily-digest-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.daily-tab {
  padding: 3px 12px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.daily-tab:hover { background: var(--background-hover); color: var(--text-color); }
.daily-tab.active { background: #6366f1; border-color: #6366f1; color: #fff; font-weight: 600; }
.daily-digest-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 28px 24px;
}
.daily-digest-words {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  padding: 5px 10px;
  background: var(--background-secondary);
  border-radius: var(--radius-sm);
  display: inline-block;
}
.daily-digest-footer {
  display: flex;
  align-items: center;
  padding: 11px 24px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
  gap: 8px;
}
.daily-digest-count {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.daily-manage-btn {
  font-size: 12px;
  padding: 5px 12px;
}
.daily-digest-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 200px;
  color: var(--text-secondary);
}
.digest-spinner-ring {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spinner 0.8s linear infinite;
}

/* ── Digests page ────────────────────────────────────────────────── */
.digests-page {
  padding: 32px 20px 60px;
}
.digests-container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.digests-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.digests-page-title {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 4px;
}
.digests-page-sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}
.digests-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.digests-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 80px 0;
  color: var(--text-secondary);
  text-align: center;
}
.digests-empty svg { opacity: 0.35; }
.digests-empty-title { font-size: 18px; font-weight: 600; margin: 0; color: var(--text-color); }
.digests-empty-sub { font-size: 14px; margin: 0; }

.digest-entry {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0 0 32px;
  background: var(--card-bg-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.digest-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  background: var(--background-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 2;
}
.digest-entry-title,
.digest-entry-title-input,
.digest-article,
.digest-references {
  padding-left: 24px;
  padding-right: 24px;
}
.digest-entry-title { padding-top: 20px; }
.digest-entry-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.digest-entry-time {
  font-size: 13px;
  color: var(--text-secondary);
}
.digest-entry-badge {
  font-size: 11px;
  font-weight: 600;
  background: var(--background-secondary);
  color: var(--text-secondary);
  border-radius: 99px;
  padding: 2px 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.digest-entry-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.digest-entry-copy-btn { font-size: 12px; padding: 4px 12px; }
.digest-entry-delete-btn {
  font-size: 12px;
  padding: 4px 12px;
  color: #e74c3c;
  border-color: #fecaca;
}
.digest-entry-delete-btn:hover { background: #fef2f2; }

.digest-entry-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 20px;
  line-height: 1.3;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.digest-title-edit-hint {
  font-size: 14px;
  color: var(--text-secondary);
  opacity: 0;
  transition: opacity 0.15s;
  font-weight: 400;
}
.digest-entry-title:hover .digest-title-edit-hint { opacity: 1; }
.digest-entry-title-input {
  font-size: 22px;
  font-weight: 700;
  border: none;
  border-bottom: 2px solid var(--primary-color);
  outline: none;
  background: transparent;
  color: var(--text-color);
  width: 100%;
  padding: 0 0 2px;
  margin-bottom: 20px;
  display: block;
}

.footer-left {
  display: flex;
  align-items: center;
}