/* ===== CSS Variables ===== */
:root {
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f7f8fa;
  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border-color: #e5e7eb;
  --accent: #4f46e5;
  --accent-rgb: 79,70,229;
  --accent-light: #eef2ff;
  --accent-hover: #4338ca;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --sidebar-width: 220px;
  --header-height: 80px;
  --transition: all 0.2s ease;
}

[data-theme="dark"] {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-sidebar: #1a1d27;
  --bg-card: #1e2130;
  --bg-card-hover: #252a3a;
  --text-primary: #e8eaf0;
  --text-secondary: #9ca3b8;
  --text-muted: #6b7280;
  --border-color: #2d3148;
  --accent: #6366f1;
  --accent-rgb: 99,102,241;
  --accent-light: #1e2040;
  --accent-hover: #818cf8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 100;
  gap: 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
  font-weight: 700;
  font-size: 18px;
  color: var(--accent);
  user-select: none;
}

.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  font-weight: 900;
  flex-shrink: 0;
}

/* Search */
.search-wrap {
  flex: 1;
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}

.search-box {
  width: 100%;
  height: 40px;
  background: var(--bg-primary);
  border: 1.5px solid var(--border-color);
  border-radius: 20px;
  padding: 0 16px 0 42px;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}

.search-box::placeholder { color: var(--text-muted); }
.search-box:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb),0.15);
  background: var(--bg-secondary);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  pointer-events: none;
}

.search-shortcut {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.btn-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-secondary);
  transition: var(--transition);
  position: relative;
}
.btn-icon:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

/* ===== 收藏角标 ===== */
.fav-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--accent);
  color: white;
  border-radius: 8px;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  text-align: center;
  line-height: 14px;
  display: none;
}
.fav-badge:not(:empty) { display: block; }

.btn-primary {
  height: 34px;
  padding: 0 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }

/* ===== Layout ===== */
.layout {
  display: flex;
  padding-top: var(--header-height);
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 16px 12px;
  transition: var(--transition);
  z-index: 50;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

.sidebar-section { margin-bottom: 24px; }

.sidebar-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 8px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text-secondary);
  transition: var(--transition);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.nav-item .nav-icon {
  width: 22px; height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--border-color);
  color: var(--text-muted);
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 11px;
  flex-shrink: 0;
}

.nav-item.active .nav-badge {
  background: var(--accent);
  color: white;
}

/* ===== Main Content ===== */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 28px 28px 60px;
  min-width: 0;
}

/* Section Header */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.section-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: var(--accent-light);
}

.section-more {
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
}
.section-more:hover { text-decoration: underline; }

/* ===== Card Grid ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 36px;
}

/* Site Card */
.site-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.site-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
}

.site-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.site-card:hover::before { opacity: 0.04; }

.site-favicon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  background: var(--bg-primary);
  overflow: hidden;
}

.site-favicon img {
  width: 28px; height: 28px;
  object-fit: contain;
}

.site-info { flex: 1; min-width: 0; }

.site-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.site-desc {
  font-size: 12px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

/* Card actions */
.card-actions {
  position: absolute;
  top: 8px; right: 8px;
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  gap: 4px;
}
.site-card:hover .card-actions { opacity: 1; }

.card-btn {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}
.card-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }
.card-btn.favorited { filter: sepia(1) saturate(5) hue-rotate(10deg); }

/* ===== Featured Banner ===== */
.banner {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #ec4899 100%);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
  color: white;
}

.banner::after {
  content: '';
  position: absolute;
  right: -20px; top: -20px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}

.banner::before {
  content: '';
  position: absolute;
  right: 60px; bottom: -40px;
  width: 150px; height: 150px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}

.banner-content { position: relative; z-index: 1; }
.banner h1 { font-size: 26px; font-weight: 800; margin-bottom: 8px; }
.banner p { font-size: 14px; opacity: 0.85; margin-bottom: 20px; max-width: 400px; line-height: 1.6; }

.banner-search {
  display: flex;
  gap: 10px;
  max-width: 480px;
}

.banner-input {
  flex: 1;
  height: 44px;
  background: rgba(255,255,255,0.2);
  border: 1.5px solid rgba(255,255,255,0.35);
  border-radius: 22px;
  padding: 0 20px;
  color: white;
  font-size: 14px;
  outline: none;
  backdrop-filter: blur(4px);
  transition: var(--transition);
}
.banner-input::placeholder { color: rgba(255,255,255,0.65); }
.banner-input:focus {
  background: rgba(255,255,255,0.28);
  border-color: rgba(255,255,255,0.6);
}

.banner-btn {
  height: 44px;
  padding: 0 22px;
  background: white;
  color: #4f46e5;
  border: none;
  border-radius: 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.banner-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }

.banner-stats {
  margin-top: 20px;
  display: flex;
  gap: 28px;
}
.stat-item { text-align: center; }
.stat-num { font-size: 22px; font-weight: 800; }
.stat-label { font-size: 12px; opacity: 0.75; margin-top: 2px; }

/* ===== 新功能特性卡片 ===== */
.feature-strip {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.feature-card {
  flex: 1;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: var(--transition);
  cursor: default;
}

.feature-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.feature-card-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.feature-card-body { flex: 1; min-width: 0; }
.feature-card-title { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.feature-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

.feature-new-badge {
  display: inline-block;
  background: linear-gradient(90deg,#f43f5e,#ec4899);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0.02em;
}

/* ===== Quick Access ===== */
.quick-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-btn {
  height: 32px;
  padding: 0 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.tab-btn:hover, .tab-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  margin-top: 40px;
}

/* ===== Search Highlight ===== */
.site-card.hidden { display: none; }
mark {
  background: rgba(99,102,241,0.2);
  color: var(--accent);
  border-radius: 3px;
  padding: 0 2px;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--text-primary);
  color: var(--bg-secondary);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  z-index: 999;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* Category divider */
.cat-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 28px 0 24px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  display: none;
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 460px;
  animation: slideUp 0.25s ease;
  overflow: hidden;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.modal-close {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--bg-primary); color: var(--text-primary); }

.modal-body { padding: 20px; }

.submit-notice {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 5px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: var(--bg-primary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
  font-family: inherit;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb),0.12);
}
.form-group textarea { resize: vertical; min-height: 80px; }

.btn-submit {
  width: 100%;
  height: 40px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-submit:hover { background: var(--accent-hover); }

/* ===== 外链全框架页 ===== */
.go-frame-wrap {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  flex-direction: column;
  background: var(--bg-primary);
}
.go-frame-wrap.open { display: flex; }

/* 顶部导航栏 */
.go-frame-bar {
  height: 52px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  z-index: 1;
}

.go-frame-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.go-frame-logo {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 900;
  flex-shrink: 0;
}
.go-frame-sitename {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}
.go-frame-sep {
  color: var(--border-color);
  font-size: 16px;
}

/* 中间：目标网站信息 */
.go-frame-bar-mid {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.go-frame-favicon {
  width: 18px; height: 18px;
  border-radius: 4px;
  flex-shrink: 0;
  object-fit: contain;
}
.go-frame-target-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.go-frame-domain-tag {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 2px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
  flex-shrink: 0;
}

/* 右边：操作区 */
.go-frame-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

/* 小倒计时圆环 */
.go-frame-ring {
  position: relative;
  width: 32px; height: 32px;
  cursor: default;
  flex-shrink: 0;
}
.go-frame-ring svg {
  transform: rotate(-90deg);
  width: 32px; height: 32px;
}
.go-frame-ring .go-ring-bg {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 3;
}
.go-frame-ring .go-ring-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 88;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
}
.go-frame-ring-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.go-frame-btn-go {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}
.go-frame-btn-go:hover { background: var(--accent-hover); }

.go-frame-btn-close {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.go-frame-btn-close:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

/* iframe 区域 */
.go-frame-body {
  flex: 1;
  position: relative;
  overflow: hidden;
}
.go-frame-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #fff;
}

/* 无法嵌入时的后备提示 */
.go-frame-fallback {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  background: var(--bg-primary);
}
.go-frame-fallback.show { display: flex; }
.go-frame-fallback-icon { font-size: 56px; margin-bottom: 16px; }
.go-frame-fallback-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}
.go-frame-fallback-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
  max-width: 400px;
  line-height: 1.6;
}
.go-frame-fallback .go-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}
.go-frame-fallback .go-btn-primary:hover { background: var(--accent-hover); }

/* ===== 分类归档 Banner ===== */
.cat-archive-banner {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.cat-archive-icon {
  font-size: 48px;
  line-height: 1;
  flex-shrink: 0;
}

.cat-archive-info { flex: 1; min-width: 0; }

.cat-archive-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.cat-archive-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 8px;
}

.cat-archive-meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.cat-archive-meta strong {
  color: var(--accent);
  font-weight: 700;
}

.cat-archive-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  text-decoration: none;
  transition: var(--transition);
  flex-shrink: 0;
  white-space: nowrap;
}
.cat-archive-back:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

/* ===== 分页 ===== */
.onenav-pagination {
  margin: 32px 0 16px;
  display: flex;
  justify-content: center;
}

.onenav-pagination ul {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
  justify-content: center;
}

.onenav-pagination ul li a,
.onenav-pagination ul li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  background: var(--bg-card);
  white-space: nowrap;
}

.onenav-pagination ul li a:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

.onenav-pagination ul li span.current {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 700;
}

.onenav-pagination ul li span.dots {
  border-color: transparent;
  background: transparent;
  color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  .sidebar { transform: translateX(-220px); }
  .sidebar.open { transform: translateX(0); width: 220px; }
  .main { margin-left: 0; padding: 16px; }
  .banner { padding: 22px 20px; }
  .banner h1 { font-size: 20px; }
  .banner-search { flex-direction: column; }
  .banner-stats { gap: 16px; }
  .logo span { display: none; }
  .search-shortcut { display: none; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .feature-card { min-width: 160px; }
}

/* ===================================================
   Single Post 详情页 (single.php)
   =================================================== */

/* 布局复用 .layout，sp-main 限制最大宽度 */
.sp-layout { display: flex; padding-top: var(--header-height); min-height: 100vh; }
.sp-main { margin-left: var(--sidebar-width); flex: 1; padding: 28px 28px 60px; min-width: 0; max-width: 900px; }

/* 面包屑 */
.sp-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.sp-breadcrumb a { color: var(--accent); text-decoration: none; }
.sp-breadcrumb a:hover { text-decoration: underline; }
.sp-bc-sep { opacity: .5; }
.sp-bc-current { color: var(--text-secondary); font-weight: 500; }

/* 详情主卡片 */
.sp-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 32px;
}

/* 封面图 */
.sp-cover-wrap {
  width: 100%;
  max-height: 360px;
  overflow: hidden;
  background: var(--bg-secondary);
}
.sp-cover {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}
.sp-cover-wrap:hover .sp-cover { transform: scale(1.02); }

/* 无封面占位 */
.sp-cover-placeholder {
  width: 100%;
  height: 160px;
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 60%, #ec4899 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.sp-cover-placeholder-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: .8;
}
.sp-cover-placeholder-icon { font-size: 44px; color: #fff; }
.sp-cover-placeholder-name {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  max-width: 80%;
  text-align: center;
}

/* 信息区 */
.sp-info { padding: 28px 32px 32px; }

/* 顶部 meta 行 */
.sp-meta-row {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 20px;
}

/* favicon / 封面缩略图 */
.sp-favicon-wrap {
  width: 64px; height: 64px;
  border-radius: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sp-favicon-img {
  width: 40px; height: 40px;
  object-fit: contain;
}
.sp-favicon-img.sp-favicon-cover {
  width: 100%; height: 100%;
  object-fit: cover;
}
.sp-favicon-fallback {
  font-size: 28px;
  line-height: 1;
}

/* 标题块 */
.sp-title-block { flex: 1; min-width: 0; }
.sp-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 8px;
}
.sp-domain-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
}
.sp-domain-dot {
  width: 7px; height: 7px;
  background: #22c55e;
  border-radius: 50%;
  flex-shrink: 0;
}
.sp-domain { color: var(--text-muted); }
.sp-cat-tag {
  padding: 3px 10px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
}
.sp-cat-tag:hover { background: var(--accent); color: #fff; }

/* 简介 */
.sp-desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent);
}

/* 正文富文本 */
.sp-content {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 24px;
}
.sp-content h2, .sp-content h3 { color: var(--text-primary); margin: 20px 0 10px; }
.sp-content p { margin-bottom: 12px; }
.sp-content ul, .sp-content ol { padding-left: 1.6em; margin-bottom: 12px; }
.sp-content img { max-width: 100%; border-radius: var(--radius-sm); }
.sp-content a { color: var(--accent); }

/* 操作按钮区 */
.sp-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.sp-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(var(--accent-rgb),.35);
}
.sp-btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(var(--accent-rgb),.45);
  color: #fff;
}
.sp-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 18px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.sp-btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}
.sp-btn-secondary.sp-faved {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}
.sp-btn-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 11px 16px;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-decoration: none;
  transition: var(--transition);
  margin-left: auto;
}
.sp-btn-back:hover { color: var(--text-primary); border-color: var(--text-muted); }

/* 安全提示 */
.sp-safety {
  font-size: 12px;
  color: var(--text-muted);
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

/* 相关推荐 */
.sp-related { margin-bottom: 32px; }

/* Responsive — single */
@media (max-width: 768px) {
  .sp-main { margin-left: 0; padding: 16px; }
  .sp-info { padding: 18px 16px 20px; }
  .sp-title { font-size: 19px; }
  .sp-actions { gap: 8px; }
  .sp-btn-back { margin-left: 0; }
  .sp-cover-wrap { max-height: 200px; }
}

/* ===================================================
   WordPress Adminbar 适配
   登录状态下 WP 会在顶部插入 #wpadminbar（32px 高 / 移动端 46px），
   需要将 layout 的 padding-top 调整为 header 高 + adminbar 高，
   让主要内容区下移，同时确保 header 和 sidebar 都相应下移
   =================================================== */
body.admin-bar {
  --header-height: 80px;
}

.admin-bar .header {
  top: 32px;
  z-index: 99;
}

.admin-bar .sidebar {
  top: calc(32px + var(--header-height));
}

.admin-bar .layout {
  padding-top: calc(32px + var(--header-height));
}

.admin-bar .sp-layout {
  padding-top: calc(32px + var(--header-height));
}

/* 移动端 #wpadminbar 高度为 46px */
@media screen and (max-width: 782px) {
  .admin-bar .header {
    top: 46px;
  }

  .admin-bar .sidebar {
    top: calc(46px + var(--header-height));
  }

  .admin-bar .layout {
    padding-top: calc(46px + var(--header-height));
  }

  .admin-bar .sp-layout {
    padding-top: calc(46px + var(--header-height));
  }
}
