@charset "UTF-8";

/* ==================== 全局重置 ==================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  min-height: 100vh;
  background: #0d1117;
  color: #f0f6fc;
  font-family: 'Alimama', sans-serif;
}

/* ==================== 全站自定义滚动条（明暗主题通用） ==================== */
/* Chrome / Edge / Safari（WebKit 内核） */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(139, 148, 158, 0.35);   /* 半透明灰，明暗背景上都能看清 */
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;            /* 让圆角里不出方角 */
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 148, 158, 0.6);
  background-clip: padding-box;
}
::-webkit-scrollbar-corner {
  background: transparent;
}
/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 148, 158, 0.5) transparent;
}

/* ==================== 阿里妈妈方圆体 ==================== */
@font-face {
  font-family: 'Alimama';
  font-display: swap;
  src: url('Alimama.woff2') format('woff2');
}

.navhub-app {
  --bg-base: #0d1117;
  --bg-surface: #161b22;
  --bg-elevated: #1c2330;
  --bg-hover: #21283a;
  --brand-primary: #6366f1;
  --brand-primary-light: #818cf8;
  --brand-primary-dark: #4f46e5;
  --brand-gradient: linear-gradient(135deg, #eff163 0%, #f7a355 100%);
  --accent-blue: #3b82f6;
  --accent-purple: #a855f7;
  --accent-pink: #ec4899;
  --accent-orange: #f97316;
  --accent-green: #10b981;
  --accent-cyan: #06b6d4;
  --accent-yellow: #eab308;
  --accent-red: #ef4444;
  --text-primary: #f0f6fc;
  --text-secondary: #c9d1d9;
  --text-tertiary: #8b949e;
  --text-muted: #6e7681;
  --border-default: #30363d;
  --border-subtle: #21262d;
  --border-active: #6366f1;
  --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);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
  --sidebar-bg: rgba(22, 27, 34, 0.6);
  --glow-primary: rgba(99, 102, 241, 0.08);
  --glow-secondary: rgba(168, 85, 247, 0.06);
  --shadow-search-focus: 0 0 0 4px rgba(99, 102, 241, 0.12);
  --nav-active-bg: rgba(99, 102, 241, 0.12);
  --nav-active-count-bg: rgba(99, 102, 241, 0.2);
  --favicon-border: #30363d;
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;
}
.navhub-app.is-light {
  --bg-base: #f5f6f8;
  --bg-surface: #ffffff;
  --bg-elevated: #f0f1f4;
  --bg-hover: #e8eaef;
  --brand-primary: #6366f1;
  --brand-primary-light: #4f46e5;
  --brand-primary-dark: #4338ca;
  --text-primary: #1a1d26;
  --text-secondary: #424a5e;
  --text-tertiary: #6b7280;
  --text-muted: #9ca3af;
  --border-default: #d4d7de;
  --border-subtle: #e4e6ec;
  --border-active: #6366f1;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.08);
  --sidebar-bg: rgba(255, 255, 255, 0.72);
  --glow-primary: rgba(99, 102, 241, 0.06);
  --glow-secondary: rgba(168, 85, 247, 0.04);
  --shadow-search-focus: 0 0 0 4px rgba(99, 102, 241, 0.1);
  --nav-active-bg: rgba(99, 102, 241, 0.1);
  --nav-active-count-bg: rgba(99, 102, 241, 0.15);
  --favicon-border: #c4c7ce;
}
.navhub-app * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
.navhub-app {
  font-family: 'Alimama', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  position: relative;
  z-index: 1;
  transition:
    background-color var(--transition-normal),
    color var(--transition-normal);
}
.navhub-app:before {
  content: "";
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translate(-50%);
  width: 800px;
  height: 600px;
  background: radial-gradient(ellipse at center, var(--glow-primary) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.navhub-app:after {
  content: "";
  position: fixed;
  bottom: -300px;
  right: -200px;
  width: 700px;
  height: 700px;
  background: radial-gradient(ellipse at center, var(--glow-secondary) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-subtle);
  padding: var(--space-6) var(--space-4);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition:
    background-color var(--transition-normal),
    border-color var(--transition-normal);
}
.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
}
.logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-8);
}
.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 4px 12px #6366f14d;
}
.logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.logo-text span {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 var(--space-3);
  margin-bottom: var(--space-3);
}
.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: var(--space-6);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  position: relative;
  -webkit-user-select: none;
  user-select: none;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--nav-active-bg);
  color: var(--brand-primary-light);
}
.nav-item.active:before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--brand-primary);
  border-radius: var(--radius-full);
}
.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.nav-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  transition:
    background-color var(--transition-normal),
    color var(--transition-normal);
}
.nav-item.active .nav-count {
  background: var(--nav-active-count-bg);
  color: var(--brand-primary-light);
}
.sidebar-footer {
  margin-top: auto;
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-subtle);
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  font-size: 13px;
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
}
.sidebar-link:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}
.main {
  flex: 1;
  padding: var(--space-8) var(--space-10);
  max-width: calc(100vw - 240px);
  overflow-x: hidden;
  height: 100vh;
}
.hero {
  text-align: center;
  margin-bottom: var(--space-12);
  padding-top: var(--space-8);
}
.hero-title {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-3);
}
.hero-title span {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  font-size: 15px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-8);
}
.search-wrapper {
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}
.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  padding: 0 var(--space-5);
  height: 52px;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-md);
}
.search-box:focus-within {
  /* 渐变描边：内层背景用 padding-box 实色，外层用 border-box 品牌色渐变 */
  border-color: transparent;
  background:
    linear-gradient(var(--bg-surface), var(--bg-surface)) padding-box,
    linear-gradient(135deg, var(--brand-primary), var(--brand-primary-light)) border-box;
  /* 品牌色光晕 + 原有聚焦光圈 */
  box-shadow: var(--shadow-search-focus), 0 0 28px rgba(99, 102, 241, 0.22), var(--shadow-md);
}
.search-icon {
  width: 20px;
  height: 20px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  padding: 0 var(--space-4);
}
.search-input::placeholder {
  color: var(--text-muted);
}
.search-shortcut {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-tertiary);
  font-family: 'Alimama', monospace;
  transition:
    background-color var(--transition-normal),
    border-color var(--transition-normal);
}
.search-clear {
  cursor: pointer;
  line-height: 0;
  padding: 6px 8px;
}
.search-clear:hover {
  background: var(--bg-hover);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}
.quick-tags {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-5);
  flex-wrap: wrap;
}
.quick-tag {
  padding: 6px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 13px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
  -webkit-user-select: none;
  user-select: none;
}
.quick-tag:hover {
  background: var(--bg-hover);
  border-color: var(--border-default);
  color: var(--text-secondary);
}
/* 搜索卡片定位高亮（回车定位到站内匹配时闪烁提示） */
.site-card.locate-flash {
  box-shadow: 0 0 0 3px var(--brand-primary), var(--shadow-md);
  transition: box-shadow var(--transition-normal);
}

.category-section {
  margin-bottom: var(--space-12);
  animation: fadeInUp-b220e11b var(--transition-slow) ease-out;
}
.category-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.category-icon-wrapper {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.category-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.category-desc {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 2px;
}
.category-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--border-default), transparent);
}
.sites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-4);
}
.site-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  animation: fadeInUp-b220e11b var(--transition-slow) ease-out backwards;
}
.site-card:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--card-accent, var(--brand-primary));
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.site-card:hover {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.site-card:hover:before {
  opacity: 1;
}
.site-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.site-favicon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  font-weight: 700;
  color: #fff;
}
.site-favicon.has-border {
  border: 1px solid var(--favicon-border);
}
.site-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-url {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-desc {
  font-size: 13px;
  color: var(--text-tertiary);
  line-height: 1.5;
  min-height: 3em;       /* 强制至少两行高度，统一卡片排版 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.site-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  align-self: flex-start;
}
.footer {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--text-muted);
  font-size: 13px;
}
.footer a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
.footer a:hover {
  color: var(--brand-primary-light);
}
.footer-divider {
  width: 48px;
  height: 2px;
  background: var(--brand-gradient);
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-4);
}
.mobile-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--sidebar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  z-index: 100;
  display: flex;
  transition:
    background-color var(--transition-normal),
    border-color var(--transition-normal);
}
.mobile-topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.hamburger {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  background: none;
  border: none;
}
.hamburger:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.hamburger svg {
  width: 22px;
  height: 22px;
}
.mobile-topbar .logo {
  margin-bottom: 0;
  padding: 0;
}
.mobile-topbar .logo-icon {
  width: 28px;
  height: 28px;
  font-size: 14px;
  border-radius: var(--radius-sm);
}
.mobile-topbar .logo-text {
  font-size: 16px;
}
.mobile-topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.mobile-icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  background: none;
  border: none;
}
.mobile-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.mobile-icon-btn svg {
  width: 20px;
  height: 20px;
}
.mobile-icon-btn .icon-sun {
  display: none;
}
.mobile-icon-btn .icon-moon,
.is-light .mobile-icon-btn .icon-sun {
  display: block;
}
.is-light .mobile-icon-btn .icon-moon {
  display: none;
}
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: #00000080;
  z-index: 99;
  opacity: 1;
  transition: opacity var(--transition-normal);
}
.theme-toggle {
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px;
  position: relative;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: border-color var(--transition-fast);
}
.theme-toggle:hover {
  border-color: var(--border-default);
}
.theme-toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  background: var(--brand-gradient);
  border-radius: var(--radius-full);
  transition: transform var(--transition-normal);
  box-shadow: 0 2px 8px #6366f159;
}
.is-dark .theme-toggle-knob {
  transform: translate(100%);
}
.theme-toggle-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  z-index: 1;
  transition: color var(--transition-fast);
  position: relative;
}
.is-light .theme-toggle-option--light,
.is-dark .theme-toggle-option--dark {
  color: #fff;
}
.theme-toggle-option svg {
  width: 14px;
  height: 14px;
}
@media (max-width: 1024px) {
  .sites-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
  .main {
    padding: var(--space-8) var(--space-6);
  }
}
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    transform: translate(-100%);
    z-index: 101;
    box-shadow: var(--shadow-lg);
    transition:
      transform var(--transition-normal),
      background-color var(--transition-normal);
  }
  .sidebar.open {
    transform: translate(0);
  }
  .main {
    max-width: 100%;
    padding: 72px var(--space-4) var(--space-6);
  }
  .hero {
    padding-top: var(--space-2);
    margin-bottom: var(--space-8);
  }
  .hero-title {
    font-size: 26px;
  }
  .hero-subtitle {
    font-size: 14px;
    margin-bottom: var(--space-6);
  }
  .search-wrapper {
    max-width: 100%;
  }
  .search-box {
    height: 48px;
  }
  .search-input {
    font-size: 14px;
  }
  .search-shortcut {
    display: none;
  }
  .quick-tags {
    gap: var(--space-2);
    margin-top: var(--space-4);
  }
  .quick-tag {
    font-size: 12px;
    padding: 5px 12px;
  }
  .sites-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }
  .site-card {
    padding: var(--space-3);
    gap: var(--space-2);
  }
  .site-favicon {
    width: 32px;
    height: 32px;
    font-size: 15px;
    border-radius: var(--radius-sm);
  }
  .site-name {
    font-size: 13px;
  }
  .site-url {
    font-size: 11px;
  }
  .site-desc {
    font-size: 12px;
    -webkit-line-clamp: 2;
  }
  .site-tag {
    font-size: 10px;
    padding: 2px 8px;
  }
  .category-header {
    margin-bottom: var(--space-4);
  }
  .category-icon-wrapper {
    width: 32px;
    height: 32px;
    font-size: 16px;
    border-radius: var(--radius-sm);
  }
  .category-title {
    font-size: 17px;
  }
  .category-desc {
    font-size: 12px;
  }
  .category-section {
    margin-bottom: var(--space-8);
  }
  .footer {
    padding: var(--space-8) var(--space-4);
  }
}
@media (max-width: 380px) {
  .sites-grid {
    grid-template-columns: 1fr;
  }
  .hero-title {
    font-size: 22px;
  }
  .quick-tags {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-2);
  }
  .quick-tag {
    flex-shrink: 0;
  }
}
@keyframes fadeInUp-b220e11b {
  0% {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== 移动端顶栏（从 index.html 迁移） ==================== */
.topbar {
  display: none; align-items: center; justify-content: space-between;
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  height: 64px; padding: 0 16px;
  background: var(--sidebar-bg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}
.topbar .menu-btn { background: none; border: none; color: var(--text-primary); font-size: 24px; cursor: pointer; padding: 10px; margin-right: 4px; line-height: 1; }
.topbar .brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; color: var(--text-primary); text-align: left; flex: 1; }
.topbar .brand-logo { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; background: var(--brand-gradient); color: #fff; font-size: 14px; font-weight: 700; flex-shrink: 0; }
.topbar .brand span { color: var(--brand-primary); }
.topbar .topbar-actions { display: flex; align-items: center; gap: 4px; }
.topbar .topbar-actions button { background: none; border: none; cursor: pointer; padding: 8px; color: var(--text-primary); display: flex; align-items: center; border-radius: 8px; }
.topbar .topbar-actions button:hover { background: var(--bg-hover); }

/* 侧边栏遮罩 */
.sidebar-overlay { display: none; position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,0.5); }
.sidebar-overlay.on { display: block; }

/* 搜索引擎选择器（搜索框内左侧下拉） */
.search-engines {
  position: relative;
  flex-shrink: 0;
}
.engine-select {
  display: flex; align-items: center; justify-content: center; gap: 2px;
  height: 32px;
  padding: 0 6px;
  border: none; background: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  opacity: 0.85;
}
.engine-select:hover {
  opacity: 1;
  background: var(--bg-hover);
}
.engine-select.open {
  opacity: 1;
  background: var(--bg-elevated);
}
.engine-select img {
  width: 20px; height: 20px;
  border-radius: 4px;
  object-fit: contain;
}
.engine-select-arrow {
  width: 12px; height: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}
.engine-select.open .engine-select-arrow {
  transform: rotate(180deg);
}
/* 引擎下拉菜单：列出所有可选搜索引擎 */
.engine-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 168px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 200;
}
.engine-option {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none; background: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  text-align: left;
  transition: background var(--transition-fast);
}
.engine-option:hover {
  background: var(--bg-hover);
}
.engine-option.active {
  background: var(--bg-elevated);
  box-shadow: 0 0 0 2px var(--brand-primary);
}
.engine-option img {
  width: 18px; height: 18px;
  border-radius: 4px;
  object-fit: contain;
}
/* 搜索引擎和搜索图标之间的分隔线 */
.search-divider {
  width: 1px; height: 24px;
  background: var(--border-default);
  margin: 0 6px;
  flex-shrink: 0;
}

/* 搜索建议下拉框 */
.search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  list-style: none;
  padding: 6px;
  z-index: 100;
  max-height: 360px;
  overflow-y: auto;
}
.search-suggestion-item {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  transition: background var(--transition-fast);
}
.search-suggestion-item:hover,
.search-suggestion-item.active {
  background: var(--bg-hover);
}
.search-suggestion-icon {
  width: 16px; height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.search-suggestion-text {
  flex: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-suggestion-group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  -webkit-user-select: none;
  user-select: none;
}
.search-suggestion-group::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}
/* 占位提示项（"正在获取搜索联想…" / "未找到相关结果"）：不参与键盘导航与点击提交 */
.search-suggestion-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
}
/* "正在获取搜索联想…"加载态：呼吸动画提示加载中（"未找到相关结果"静态提示不加此类） */
.search-suggestion-hint.is-loading {
  animation: hint-pulse 1.2s ease-in-out infinite;
}
@keyframes hint-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
.search-suggestion-badge {
  flex-shrink: 0;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.12);
  color: var(--brand-primary-light);
}
/* 站内建议项的网站图标 */
.search-suggestion-ico {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
}
.search-suggestion-letter {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.search-history-del {
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.search-history-del:hover {
  color: var(--brand-primary);
  background: var(--bg-hover);
}

/* ==================== 响应式 ==================== */
@media (max-width: 959px) {
  .topbar { display: flex; }
  .navhub-app { flex-direction: column; padding-top: 64px; z-index: auto; }
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 50;
    width: 280px; height: 100vh; overflow-y: auto;
    transform: translateX(-100%); transition: transform 0.3s;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 30px rgba(0,0,0,0.6); }
  .main { max-width: 100%; padding: 16px; }
  .sidebar-overlay.on { z-index: 49; }
}

/* ==================== 拖拽滚动（drag-scroll.js） ==================== */
/* 拖拽过程中：全局切换为抓手光标，并禁止选中文字，避免拖出蓝色选区 */
body.is-dragging,
body.is-dragging * {
  cursor: grabbing !important;
  user-select: none;
  -webkit-user-select: none;
}