:root {
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg:
    0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

[data-theme="dark"] {
  --primary: #6366f1;
  --primary-light: #a5b4fc;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --bg: #0f172a;
  --card-bg: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg:
    0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
}

/* Dark 主题覆盖 */
[data-theme="dark"] .btn-tooltip {
  background: var(--card-bg);
  color: var(--text);
  border-color: var(--border);
}

[data-theme="dark"] .btn-tooltip::after {
  border-top-color: var(--card-bg);
}

[data-theme="dark"] .btn-tooltip::before {
  border-top-color: var(--border);
}

[data-theme="dark"] .score-tooltip {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

[data-theme="dark"] .format-btn-tooltip {
  background: #1e293b;
}

[data-theme="dark"] .history-sidebar {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-right-color: var(--border);
}

[data-theme="dark"] .header-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] #searchModalInput {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .search-result-item:hover {
  background: rgba(99, 102, 241, 0.1);
}

[data-theme="dark"] .search-highlight {
  background: rgba(255, 213, 0, 0.25);
}

[data-theme="dark"] .sidebar-trigger-group {
  background: #1e293b;
}

[data-theme="dark"] .trigger-pill-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .history-footer {
  background: rgba(30, 41, 59, 0.5);
}

[data-theme="dark"] .history-new-btn {
  box-shadow: 0 3px 12px rgba(99, 102, 241, 0.25);
}

[data-theme="dark"] .history-item {
  background: rgba(30, 41, 59, 0.5);
}

[data-theme="dark"] .history-item:hover {
  background: rgba(30, 41, 59, 0.9);
}

[data-theme="dark"] .history-empty svg {
  color: #475569;
}

[data-theme="dark"] .history-rename-input {
  background: #0f172a;
  color: var(--text);
}

[data-theme="dark"] .score-tooltip {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

[data-theme="dark"] .format-btn-tooltip {
  background: #1e293b;
}

[data-theme="dark"] .history-item {
  background: rgba(30, 41, 59, 0.5);
}

[data-theme="dark"] .history-item:hover {
  background: rgba(30, 41, 59, 0.9);
}

[data-theme="dark"] .icon-btn:hover {
  border-color: var(--border);
}

[data-theme="dark"] textarea:focus,
[data-theme="dark"] input:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .concurrency-control input[type="number"]:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .search-dropdown-trigger {
  background: rgba(66, 133, 244, 0.1);
  color: #60a5fa;
  border-color: rgba(66, 133, 244, 0.25);
}

[data-theme="dark"] .search-dropdown-trigger:hover {
  background: rgba(66, 133, 244, 0.18);
  border-color: rgba(66, 133, 244, 0.4);
}

[data-theme="dark"] .score-inline {
  color: #22d3ee;
  background: rgba(8, 145, 178, 0.15);
}

[data-theme="dark"] .history-date-group {
  color: #64748b;
}

[data-theme="dark"] .history-empty div {
  color: #64748b;
}

[data-theme="dark"] .history-empty svg {
  color: #475569;
}

[data-theme="dark"] .history-footer {
  background: rgba(30, 41, 59, 0.5);
}

[data-theme="dark"] .history-setting {
  color: #94a3b8;
}

[data-theme="dark"] .history-local-tip {
  color: #94a3b8;
}

[data-theme="dark"] .history-item-meta {
  color: #64748b;
}

[data-theme="dark"] .source-badge.crossref {
  color: #fbbf24;
}

[data-theme="dark"] .score-inline {
  color: #22d3ee;
  background: rgba(8, 145, 178, 0.15);
}

[data-theme="dark"] .nav-menu-item:hover {
  background: rgba(99, 102, 241, 0.1);
}

[data-theme="dark"] .nav-menu-item.google:hover {
  background: rgba(66, 133, 244, 0.1);
}

[data-theme="dark"] .nav-menu-item.ieee:hover {
  background: rgba(0, 121, 193, 0.1);
}

[data-theme="dark"] .nav-menu-item.semantic:hover {
  background: rgba(245, 158, 11, 0.1);
}

[data-theme="dark"] .nav-menu-item.arxiv:hover {
  background: rgba(185, 28, 28, 0.1);
}

[data-theme="dark"] .search-dropdown-item:hover {
  background: rgba(99, 102, 241, 0.1);
}

[data-theme="dark"] .search-dropdown-item.google:hover {
  background: rgba(66, 133, 244, 0.12);
}

[data-theme="dark"] .search-dropdown-item.ieee:hover {
  background: rgba(0, 121, 193, 0.12);
}

[data-theme="dark"] .search-dropdown-item.semantic:hover {
  background: rgba(245, 158, 11, 0.12);
}

[data-theme="dark"] .search-dropdown-item.arxiv:hover {
  background: rgba(185, 28, 28, 0.1);
}

[data-theme="dark"] .search-dropdown-item.cnki:hover {
  background: rgba(198, 40, 40, 0.12);
}

[data-theme="dark"] .nav-menu-item.cnki:hover {
  background: rgba(198, 40, 40, 0.1);
}

[data-theme="dark"] .feature-pill {
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.22),
    rgba(139, 92, 246, 0.22)
  );
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .feature-pill:hover {
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.3),
    rgba(139, 92, 246, 0.3)
  );
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

[data-theme="dark"] .warning-pill {
  background: linear-gradient(
    135deg,
    rgba(239, 68, 68, 0.2),
    rgba(220, 38, 38, 0.2)
  );
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}

[data-theme="dark"] .warning-pill:hover {
  background: linear-gradient(
    135deg,
    rgba(239, 68, 68, 0.3),
    rgba(220, 38, 38, 0.3)
  );
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

[data-theme="dark"] .info-pill {
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.2),
    rgba(5, 150, 105, 0.2)
  );
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

[data-theme="dark"] .info-pill:hover {
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.3),
    rgba(5, 150, 105, 0.3)
  );
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

[data-theme="dark"] .nav-btn {
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.18),
    rgba(139, 92, 246, 0.18)
  );
  border-color: rgba(99, 102, 241, 0.45);
}

[data-theme="dark"] .nav-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.28),
    rgba(139, 92, 246, 0.28)
  );
  border-color: rgba(99, 102, 241, 0.6);
}

* {
  box-sizing: border-box;
}

body {
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  margin: 0;
  padding: 0;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
}

.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
}

.header {
  position: relative;
  text-align: center;
  margin-bottom: 32px;
}

.theme-icon-sun,
.theme-icon-moon {
  width: 16px;
  height: 16px;
}

.theme-icon-moon {
  display: none;
}

[data-theme="dark"] .theme-icon-sun {
  display: none;
}

[data-theme="dark"] .theme-icon-moon {
  display: block;
}

.header-nav {
  position: absolute;
  top: 0;
  right: 0;
}

.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.1),
    rgba(139, 92, 246, 0.1)
  );
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  border-color: var(--primary);
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.15),
    rgba(139, 92, 246, 0.15)
  );
}

.nav-btn svg {
  width: 16px;
  height: 16px;
}

.nav-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 100;
}

.nav-dropdown:hover .nav-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  transition: background 0.2s ease;
  border-left: 3px solid transparent;
}

.nav-menu-item:first-child {
  border-radius: 10px 10px 0 0;
}

.nav-menu-item:last-child {
  border-radius: 0 0 10px 10px;
}

.nav-menu-item:hover {
  background: rgba(99, 102, 241, 0.05);
}

.nav-menu-item.google:hover {
  background: rgba(66, 133, 244, 0.05);
  border-left-color: #4285f4;
}

.nav-menu-item.ieee:hover {
  background: rgba(0, 121, 193, 0.05);
  border-left-color: #0079c1;
}

.nav-menu-item.semantic:hover {
  background: rgba(245, 158, 11, 0.05);
  border-left-color: #f59e0b;
}

.nav-menu-item.arxiv:hover {
  background: rgba(185, 28, 28, 0.05);
  border-left-color: #b91c1c;
}

.nav-menu-item.cnki:hover {
  background: rgba(198, 40, 40, 0.05);
  border-left-color: #c62828;
}

.nav-menu-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-menu-item img {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  object-fit: contain;
}

.feature-pill.clickable {
  cursor: pointer;
}

.feature-pill.clickable:active {
  transform: translateY(-1px);
}

.header h1 {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-light) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 12px 0;
}

.header p {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 700px;
  margin: 0 auto;
}

.feature-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.feature-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.1),
    rgba(139, 92, 246, 0.1)
  );
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

.feature-pill:hover {
  border-color: var(--primary);
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.15),
    rgba(139, 92, 246, 0.15)
  );
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.feature-pill-icon {
  font-size: 16px;
}

.feature-pill-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 100;
}

.feature-pill-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--border);
}

.feature-pill:hover .feature-pill-tooltip {
  opacity: 1;
}

.warning-pill {
  background: linear-gradient(
    135deg,
    rgba(239, 68, 68, 0.1),
    rgba(220, 38, 38, 0.1)
  );
  border-color: rgba(239, 68, 68, 0.3);
}

.warning-pill:hover {
  border-color: var(--danger);
  background: linear-gradient(
    135deg,
    rgba(239, 68, 68, 0.15),
    rgba(220, 38, 38, 0.15)
  );
}

.info-pill {
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.1),
    rgba(5, 150, 105, 0.1)
  );
  border-color: rgba(16, 185, 129, 0.3);
}

.info-pill:hover {
  border-color: var(--success);
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.15),
    rgba(5, 150, 105, 0.15)
  );
}

.card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  border: 1px solid var(--border);
  overflow: visible;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-section {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  align-items: stretch;
  overflow: visible;
}

.input-section > div {
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.input-section > div:first-child {
  /* 左侧：textarea 区域 */
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.input-section > div:last-child {
  /* 右侧：配置区域 */
  justify-content: space-between;
}

.right-top {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.right-bottom {
  margin-top: 16px;
}

/* 并发数控制样式 */
.concurrency-section {
  margin-top: 12px;
}

.concurrency-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.concurrency-control input[type="number"] {
  width: 70px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  text-align: center;
  background: var(--bg);
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.concurrency-control input[type="number"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.concurrency-control input[type="number"]::-webkit-inner-spin-button,
.concurrency-control input[type="number"]::-webkit-outer-spin-button {
  opacity: 1;
}

@media (max-width: 768px) {
  .input-section {
    grid-template-columns: 1fr;
  }
}

label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  overflow: visible;
}

.label-row label {
  margin-bottom: 0;
}

.btn-format-text {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #059669;
  background: rgba(5, 150, 105, 0.1);
  border: 1px solid rgba(5, 150, 105, 0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-format-text:hover {
  background: rgba(5, 150, 105, 0.15);
  border-color: rgba(5, 150, 105, 0.5);
}

.btn-format-text:active {
  transform: scale(0.98);
}

.format-btns {
  display: flex;
  gap: 8px;
  overflow: visible;
}

.format-btn-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.btn-ai-format-text {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #8b5cf6;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-ai-format-text:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.5);
}

.btn-ai-format-text:active {
  transform: scale(0.98);
}

.btn-ai-format-text:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.format-btn-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: #1e293b;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 400;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.15s ease,
    visibility 0.15s ease;
  z-index: 100;
  pointer-events: none;
  width: 320px;
  line-height: 1.4;
}

.format-btn-tooltip::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 12px;
  border: 5px solid transparent;
  border-bottom-color: #1e293b;
}

.format-btn-wrapper:hover .format-btn-tooltip {
  opacity: 1;
  visibility: visible;
}

textarea,
input[type="text"],
input[type="email"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: var(--card-bg);
  font-family: inherit;
}

textarea:focus,
input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

textarea {
  resize: vertical;
  min-height: 180px;
  flex: 1;
}

.citation-count {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
  margin-top: 4px;
  min-height: 0;
}

.citation-count:empty {
  display: none;
}

.citation-count-num {
  font-weight: 600;
  color: var(--primary);
}

.citation-count-num.ok {
  color: var(--success);
}

.citation-count-hint {
  color: var(--warning);
}

.hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-light) 100%
  );
  color: white;
  box-shadow: 0 4px 14px 0 rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(79, 70, 229, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-extract {
  background: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(6, 182, 212, 0.35);
}

.btn-extract:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(6, 182, 212, 0.45);
}

.btn-extract:active {
  transform: translateY(0);
}

.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, #34d399 100%);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.35);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(16, 185, 129, 0.45);
}

.btn-success:active {
  transform: translateY(0);
}

.btn-copy {
  background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(249, 115, 22, 0.35);
}

.btn-copy:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(249, 115, 22, 0.45);
}

.btn-copy:active {
  transform: translateY(0);
}

.btn-secondary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.35);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(16, 185, 129, 0.45);
}

.btn-secondary:active {
  transform: translateY(0);
}

.btn-clear {
  background: linear-gradient(135deg, #64748b 0%, #94a3b8 100%);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(100, 116, 139, 0.35);
}

.btn-clear:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(100, 116, 139, 0.45);
}

.btn-clear:active {
  transform: translateY(0);
}

.btn-info {
  background: linear-gradient(135deg, #0ea5e9 0%, #38bdf8 100%);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(14, 165, 233, 0.35);
}

.btn-info:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(14, 165, 233, 0.45);
}

.btn-info:active {
  transform: translateY(0);
}

.btn-github {
  background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(55, 65, 81, 0.35);
}

.btn-github:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(55, 65, 81, 0.45);
}

.btn-github:active {
  transform: translateY(0);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* 按钮 tooltip 样式 */
.btn-tooltip-wrapper {
  position: relative;
  display: inline-flex;
}

.btn-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  transform: none;
  background: white;
  color: #1e293b;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.15s ease,
    visibility 0.15s ease;
  z-index: 100;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid #e2e8f0;
  max-width: 800px;
}

.btn-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 20px;
  transform: none;
  border: 5px solid transparent;
  border-top-color: white;
}

.btn-tooltip::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 20px;
  transform: none;
  border: 6px solid transparent;
  border-top-color: #e2e8f0;
  margin-top: 1px;
  z-index: -1;
}

.btn-tooltip-wrapper:hover .btn-tooltip {
  opacity: 1;
  visibility: visible;
}

.tooltip-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.15);
  color: #4f46e5;
  font-size: 12px;
}

[data-theme="dark"] .tooltip-tag {
  background: rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
}

/* Progress Bar */
.progress-container {
  display: none;
  margin-bottom: 20px;
}

.progress-container.active {
  display: block;
}

.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Summary Stats */
.summary {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.summary.active {
  display: grid;
}

@media (max-width: 600px) {
  .summary {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.stat-card.total .stat-value {
  color: var(--primary);
}
.stat-card.high .stat-value {
  color: var(--success);
}
.stat-card.medium .stat-value {
  color: var(--warning);
}
.stat-card.low .stat-value {
  color: var(--danger);
}

/* Result Items */
.result-item {
  background: var(--card-bg);
  border-radius: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
  position: relative;
}

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

.result-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
  border-radius: 12px;
  background: var(--card-bg);
}

.result-item.expanded .result-header {
  border-radius: 12px 12px 0 0;
}

.result-header:hover {
  background: var(--bg);
}

.result-index {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.result-header:hover .result-index {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.result-title {
  flex: 1;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recheck-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(16, 185, 129, 0.25);
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}

.recheck-btn:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.4);
}

.recheck-btn svg {
  flex-shrink: 0;
}

[data-theme="dark"] .recheck-btn {
  background: rgba(52, 211, 153, 0.1);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.25);
}

[data-theme="dark"] .recheck-btn:hover {
  background: rgba(52, 211, 153, 0.18);
  border-color: rgba(52, 211, 153, 0.4);
}

.result-score {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  transition: all 0.2s ease;
  cursor: help;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.result-score::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.result-score.high {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.result-score.high::before {
  background: linear-gradient(135deg, var(--success) 0%, #34d399 100%);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

.result-score.medium {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.result-score.medium::before {
  background: linear-gradient(135deg, var(--warning) 0%, #fbbf24 100%);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

.result-score.low {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.result-score.low::before {
  background: linear-gradient(135deg, var(--danger) 0%, #f87171 100%);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

.result-toggle {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.result-item.expanded .result-toggle {
  transform: rotate(180deg);
}

.result-details {
  display: none;
  padding: 0 20px 20px;
  border-top: 1px solid var(--border);
  border-radius: 0 0 12px 12px;
  background: var(--card-bg);
}

.result-item.expanded .result-details {
  display: block;
}

.detail-section {
  margin-top: 16px;
}

.detail-section h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px 0;
  color: var(--text);
}

.detail-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 16px;
  font-size: 13px;
}

.detail-label {
  color: var(--text-muted);
}

.detail-value {
  color: var(--text);
  word-break: break-word;
}

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

.detail-value a:hover {
  text-decoration: underline;
}

.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  margin-right: 8px;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
  transition: all 0.2s ease;
}

.source-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.source-badge.openalex {
  background: linear-gradient(
    135deg,
    rgba(79, 70, 229, 0.12) 0%,
    rgba(129, 140, 248, 0.12) 100%
  );
  color: var(--primary);
  border: 1px solid rgba(79, 70, 229, 0.2);
}

.source-badge.openalex::before {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-light) 100%
  );
  box-shadow: 0 0 6px rgba(79, 70, 229, 0.4);
}

.source-badge.crossref {
  background: linear-gradient(
    135deg,
    rgba(245, 158, 11, 0.12) 0%,
    rgba(251, 191, 36, 0.12) 100%
  );
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.source-badge.crossref::before {
  background: linear-gradient(135deg, var(--warning) 0%, #fbbf24 100%);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

.score-tooltip-wrapper:hover .source-badge {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 格式胶囊样式 */
.format-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.1) 0%,
    rgba(139, 92, 246, 0.1) 100%
  );
  color: var(--primary);
  border: 1px solid rgba(99, 102, 241, 0.2);
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 8px;
}

/* Tooltip 样式 */
.score-tooltip-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: help;
  padding: 4px 0;
}

.score-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  transform: translateX(0);
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: white;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
  z-index: 1000;
  box-shadow:
    0 10px 25px rgba(0, 0, 0, 0.2),
    0 4px 10px rgba(0, 0, 0, 0.1);
  min-width: 240px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.score-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 24px;
  transform: translateX(0);
  border: 8px solid transparent;
  border-top-color: #334155;
}

.score-tooltip-wrapper:hover .score-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(-4px);
}

.score-tooltip-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 8px;
}

.score-tooltip-row.score-tooltip-header {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 8px;
  margin-bottom: 4px;
}

.score-tooltip-row.score-tooltip-header .score-tooltip-value {
  background: transparent;
  font-size: 10px;
}

.score-tooltip-row.score-tooltip-total {
  border-bottom: none;
  padding-top: 10px;
  margin-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: 600;
}

.score-tooltip-row:last-child {
  border-bottom: none;
}

.score-tooltip-label {
  color: rgba(255, 255, 255, 0.65);
  font-size: 11px;
}

.score-tooltip-value {
  font-family: "SF Mono", "Monaco", "Inconsolata", monospace;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
}

.score-tooltip-value.good {
  color: #34d399;
  background: rgba(52, 211, 153, 0.15);
}

.score-tooltip-value.medium {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
}

.score-tooltip-value.bad {
  color: #f87171;
  background: rgba(248, 113, 113, 0.15);
}

.score-badges {
  display: flex;
  gap: 6px;
  align-items: center;
}

.score-inline {
  font-size: 12px;
  color: #0891b2;
  font-weight: 500;
  background: rgba(8, 145, 178, 0.1);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(8, 145, 178, 0.3);
}

.score-inline.ai {
  color: #8b5cf6;
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.3);
}

/* 折叠头部的 tooltip 特殊定位 */
.result-score-wrapper {
  padding: 0;
}

.result-score-wrapper .score-tooltip {
  left: auto;
  right: 0;
  transform: translateX(0);
}

.result-score-wrapper .score-tooltip::after {
  left: auto;
  right: 24px;
}

.result-score-wrapper:hover .result-score {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
}

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

.processing-item {
  position: relative;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.processing-item-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  transition: width 0.3s ease;
  opacity: 0.6;
}

.processing-item-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.processing-item-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6366f1;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.processing-item-text {
  font-size: 14px;
  color: var(--text);
  word-break: break-all;
}

/* Verdict bar */
.verdict-bar {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.verdict-segment {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
}

.verdict-segment.active.high {
  background: var(--success);
}
.verdict-segment.active.medium {
  background: var(--warning);
}
.verdict-segment.active.low {
  background: var(--danger);
}

/* Detail actions */
.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-small {
  padding: 9px 18px;
  font-size: 13px;
  gap: 6px;
  border-radius: 10px;
}

.export-section {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.export-section.active {
  display: flex;
}

.export-selector {
  display: flex;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
  border: 2px solid var(--success);
  box-shadow: 0 4px 12px 0 rgba(16, 185, 129, 0.15);
}

.export-option {
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  color: var(--text-muted);
  user-select: none;
  position: relative;
}

.export-option:hover {
  color: var(--text);
  background: rgba(16, 185, 129, 0.1);
}

.export-option.active {
  background: linear-gradient(135deg, var(--success) 0%, #34d399 100%);
  color: white;
  box-shadow: 0 2px 8px 0 rgba(16, 185, 129, 0.3);
}

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-light) 100%
  );
  color: white;
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 3000;
  box-shadow: 0 8px 24px 0 rgba(79, 70, 229, 0.4);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* 图标按钮 */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--bg);
  color: var(--text);
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.icon-btn:active {
  transform: translateY(0);
}

.helper-btns {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* 弹窗样式 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  transition: all 0.3s ease;
}

.modal-overlay.show .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-light) 100%
  );
  color: white;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

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

/* 抽屉样式 */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.drawer-overlay.show {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 90vw;
  height: 100vh;
  background: var(--card-bg);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 2001;
  display: flex;
  flex-direction: column;
}

.drawer-overlay.show .drawer {
  transform: translateX(0);
}

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

.drawer-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.drawer-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.score-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.score-table th,
.score-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.score-table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text);
}

.score-table tr:last-child td {
  border-bottom: none;
}

.score-table .weight {
  color: var(--primary);
  font-weight: 600;
}

.score-table .enable-col {
  text-align: center;
  width: 60px;
}

.score-table .enable-col input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

.score-table .enable-col input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.score-table tr.field-disabled td {
  opacity: 0.4;
  text-decoration: line-through;
}

.score-table tr.field-disabled td.enable-col {
  opacity: 1;
  text-decoration: none;
}

.verdict-table {
  margin-top: 20px;
}

.verdict-table .high {
  color: var(--success);
}
.verdict-table .medium {
  color: var(--warning);
}
.verdict-table .low {
  color: var(--danger);
}

.formula-box {
  background: var(--bg);
  border-radius: 10px;
  padding: 16px;
  margin: 16px 0;
  font-family: "SF Mono", Monaco, monospace;
  font-size: 13px;
  color: var(--text);
  border: 1px solid var(--border);
}

.formula-box code {
  color: var(--primary);
  font-weight: 600;
}

/* 双列布局 */
.sources-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

@media (max-width: 768px) {
  .sources-grid {
    grid-template-columns: 1fr;
  }
}

.source-card {
  background: var(--bg);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--border);
}

.source-card h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.source-card .detail-grid {
  font-size: 12px;
}

.source-card .detail-label {
  font-size: 11px;
}

.link-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary);
  border: 1px solid rgba(79, 70, 229, 0.2);
}

.link-badge:hover {
  background: rgba(79, 70, 229, 0.15);
  transform: translateY(-1px);
  text-decoration: none;
}

.link-badge svg {
  width: 12px;
  height: 12px;
}

/* 人工校验下拉菜单 */
.search-dropdown {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.search-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(66, 133, 244, 0.1);
  color: #1a73e8;
  border: 1px solid rgba(66, 133, 244, 0.25);
  user-select: none;
}

.search-dropdown-trigger:hover {
  background: rgba(66, 133, 244, 0.18);
  border-color: rgba(66, 133, 244, 0.4);
}

.search-dropdown-trigger svg {
  flex-shrink: 0;
}

.search-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all 0.2s ease;
  z-index: 100;
  overflow: hidden;
}

.search-dropdown:hover .search-dropdown-menu,
.search-dropdown:focus-within .search-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.search-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  transition: background 0.15s ease;
  border-left: 3px solid transparent;
}

.search-dropdown-item:first-child {
  border-radius: 8px 8px 0 0;
}

.search-dropdown-item:last-child {
  border-radius: 0 0 8px 8px;
}

.search-dropdown-item:hover {
  background: rgba(99, 102, 241, 0.05);
  text-decoration: none;
}

.search-dropdown-item.google:hover {
  background: rgba(66, 133, 244, 0.08);
  border-left-color: #4285f4;
}

.search-dropdown-item.arxiv:hover {
  background: rgba(185, 28, 28, 0.06);
  border-left-color: #b91c1c;
}

.search-dropdown-item.ieee:hover {
  background: rgba(0, 121, 193, 0.06);
  border-left-color: #0079c1;
}

.search-dropdown-item.semantic:hover {
  background: rgba(245, 158, 11, 0.06);
  border-left-color: #f59e0b;
}

.search-dropdown-item.cnki:hover {
  background: rgba(198, 40, 40, 0.06);
  border-left-color: #c62828;
}

.search-dropdown-item img {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  object-fit: contain;
}

/* 格式示例样式 */
.format-example {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.format-example:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.format-example h4 {
  margin: 0 0 10px 0;
  font-size: 14px;
  color: var(--text);
}

.example-box {
  background: var(--bg);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  overflow-x: auto;
}

.example-box:last-child {
  margin-bottom: 0;
}

.example-box code {
  font-family: "SF Mono", Monaco, Consolas, "Courier New", monospace;
  font-size: 12px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
}

/* AI 配置相关样式 */
.ai-config-section {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 10px;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.05) 0%,
    rgba(167, 139, 250, 0.05) 100%
  );
}

.ai-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

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

.ai-config-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 5px;
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-config-btn:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.5);
}

.ai-option {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-option input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #8b5cf6;
  cursor: pointer;
}

.ai-option input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.ai-option label {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}

.ai-option input[type="checkbox"]:disabled + label {
  cursor: not-allowed;
  opacity: 0.6;
}

.ai-option-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.ai-badge {
  background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.ai-score-badge {
  background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
  color: white;
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 600;
  margin-left: 4px;
  vertical-align: middle;
}

/* 配置区域底部的状态框（与齿轮按钮对齐） */
.ai-config-footer .ai-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  margin: 0;
}

.ai-config-footer .ai-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
}

.ai-config-footer .ai-status.configured .ai-status-dot {
  background: #22c55e;
}

.ai-config-footer .ai-status.not-configured .ai-status-dot {
  background: #f59e0b;
}

.ai-config-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-config-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-config-form label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin: 0;
}

.ai-config-form input,
.ai-config-form select {
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: var(--card-bg);
}

.ai-config-form input:focus,
.ai-config-form select:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.password-wrapper input {
  flex: 1;
  padding-right: 44px;
}
.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.password-toggle:hover {
  color: var(--text);
  background: rgba(139, 92, 246, 0.08);
}
.password-toggle:focus-visible {
  outline: 2px solid #8b5cf6;
  outline-offset: 2px;
}

.ai-config-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ai-config-form .form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.ai-config-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.ai-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.ai-status.configured {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.ai-status.not-configured {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.ai-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.ai-status.configured .ai-status-dot {
  background: var(--success);
}

.ai-status.not-configured .ai-status-dot {
  background: var(--warning);
}

/* ---------- 历史记录侧边栏 ---------- */
.history-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.06);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.history-sidebar.collapsed {
  transform: translateX(-100%);
}

/* 头部 */
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  flex-shrink: 0;
}

.history-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.header-icon-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.header-icon-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.header-icon-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

/* 搜索弹窗 */
#searchModalInput:focus {
  border-color: var(--primary);
}

.search-modal-results {
  padding: 8px 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.search-result-item {
  display: block;
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  transition: background 0.15s ease;
}

.search-result-item:hover {
  background: rgba(79, 70, 229, 0.06);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.search-result-snippet {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search-result-meta {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.7;
  margin-top: 4px;
}

.search-highlight {
  background: rgba(255, 213, 0, 0.4);
  color: var(--text);
  border-radius: 2px;
  padding: 0 1px;
}

.search-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 14px;
}

/* 新建按钮 */
.history-new-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0 16px 12px;
  padding: 11px 14px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border: none;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: all 0.25s ease;
  flex-shrink: 0;
  box-shadow: 0 3px 12px rgba(79, 70, 229, 0.3);
}

.history-new-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(79, 70, 229, 0.4);
}

.history-new-btn:active {
  transform: translateY(0) scale(0.98);
}

.history-new-btn svg {
  stroke-width: 2.5;
}

/* 列表区域 */
.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px;
}

/* 空状态 */
.history-empty {
  padding: 48px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.history-empty svg {
  color: #cbd5e1;
  opacity: 0.7;
}

.history-empty div {
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
}

/* 日期分组 */
.history-date-group {
  padding: 10px 8px 6px;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* 历史条目 */
.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 4px;
  cursor: pointer;
  border-radius: 10px;
  border-left: 3px solid transparent;
  background: rgba(255, 255, 255, 0.5);
  transition: all 0.2s ease;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transform: translateX(2px);
}

.history-item.active {
  background: rgba(79, 70, 229, 0.08);
  border-left-color: var(--primary);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.1);
}

.history-item.pinned {
  background: rgba(251, 191, 36, 0.06);
  border-left-color: #f59e0b;
}

.history-item.pinned:hover {
  background: rgba(251, 191, 36, 0.1);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.12);
}

.history-item-content {
  flex: 1;
  min-width: 0;
}

.history-item-title-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.history-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}

.history-item-title:hover {
  color: var(--primary);
}

.history-item-meta {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 3px;
}

/* 更多操作下拉菜单 */
.history-dropdown {
  position: relative;
  flex-shrink: 0;
}

.history-dropdown-trigger {
  width: 26px;
  height: 26px;
  border: none;
  background: none;
  border-radius: 6px;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  padding: 0;
  opacity: 0;
}

.history-item:hover .history-dropdown-trigger {
  opacity: 1;
}

.history-dropdown:hover .history-dropdown-trigger,
.history-dropdown:focus-within .history-dropdown-trigger {
  opacity: 1;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

.history-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 130px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all 0.2s ease;
  z-index: 100;
  overflow: hidden;
  padding: 4px;
}

.history-dropdown:hover .history-dropdown-menu,
.history-dropdown:focus-within .history-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.history-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.history-dropdown-item:hover {
  background: rgba(99, 102, 241, 0.06);
}

.history-dropdown-item.active {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
}

.history-dropdown-item.danger {
  color: var(--danger);
}

.history-dropdown-item.danger:hover {
  background: rgba(239, 68, 68, 0.08);
}

.history-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}

/* 重命名输入框 */
.history-rename-input {
  width: 100%;
  padding: 3px 8px;
  border: 1.5px solid var(--primary);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: white;
  color: var(--text);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* 底部 */
.history-footer {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255, 255, 255, 0.5);
}

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

.history-setting {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.history-setting input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
  cursor: pointer;
}

.history-clear {
  font-size: 12px;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
  border: none;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 20px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.history-clear:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.history-clear:active {
  transform: translateY(0);
}

.history-local-tip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #475569;
  font-weight: 500;
  padding: 7px 12px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.08) 0%, rgba(99, 102, 241, 0.05) 100%);
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: 8px;
}

.history-local-tip svg {
  flex-shrink: 0;
  color: #0ea5e9;
}

/* 侧边栏收起时的胶囊触发组 */
.sidebar-trigger-group {
  position: fixed;
  top: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  z-index: 99;
}

.trigger-pill-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s ease;
  padding: 0;
  flex-shrink: 0;
}

.trigger-pill-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

.trigger-pill-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  flex-shrink: 0;
}

/* 主内容区 */
.main-content {
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 24px 16px;
  max-width: 1200px;
  margin: 0 auto;
}

/* 侧边栏展开时：主内容在右侧剩余空间中居中 */
/* margin-left = sidebar宽300px + (剩余空间 - 内容宽1200px)/2 */
.main-content.with-sidebar {
  margin-left: calc(300px + max(0px, (100vw - 1500px) / 2));
}

/* 移动端适配 */
@media (max-width: 768px) {
  .history-sidebar {
    width: 300px;
  }

  .main-content.with-sidebar {
    margin-left: 0;
  }
}
