/* 关键样式，避免页面闪烁 */
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  transition: background-color 0.3s, color 0.3s;
}



/* 骨架屏样式 */
/* 骨架屏容器 */
.skeleton-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  animation: skeleton-fade-in 0.6s ease-out;
}

/* 骨架屏标题区域 */
.skeleton-header {
  text-align: center;
  padding: 1rem 1.5rem 0.5rem;
}

/* 骨架屏标题 */
.skeleton-title {
  height: 2.2rem;
  width: 160px;
  background: linear-gradient(90deg, var(--skeleton-bg) 0%, var(--skeleton-shimmer) 50%, var(--skeleton-bg) 100%);
  border-radius: 12px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  opacity: 0.8;
}

/* 骨架屏内容区域 */
.skeleton-content {
  padding: 1rem 1.5rem 2rem;
}

/* 骨架屏分类区块 */
.skeleton-section {
  margin: 2rem 0;
  animation: skeleton-section-appear 0.8s ease-out;
}

.skeleton-section:nth-child(2) { animation-delay: 0.1s; }
.skeleton-section:nth-child(3) { animation-delay: 0.2s; }
.skeleton-section:nth-child(4) { animation-delay: 0.3s; }
.skeleton-section:nth-child(5) { animation-delay: 0.4s; }
.skeleton-section:nth-child(6) { animation-delay: 0.5s; }

/* 骨架屏分类标题 */
.skeleton-category {
  height: 1.8rem;
  background: linear-gradient(90deg, var(--skeleton-bg) 0%, var(--skeleton-shimmer) 50%, var(--skeleton-bg) 100%);
  border-radius: 10px;
  margin-bottom: 1.2rem;
  position: relative;
  overflow: hidden;
  opacity: 0.9;
}

.skeleton-section:nth-child(1) .skeleton-category { width: 85px; }
.skeleton-section:nth-child(2) .skeleton-category { width: 110px; }
.skeleton-section:nth-child(3) .skeleton-category { width: 95px; }
.skeleton-section:nth-child(4) .skeleton-category { width: 125px; }
.skeleton-section:nth-child(5) .skeleton-category { width: 75px; }

/* 骨架屏网格布局 */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.72rem;
}

/* 骨架屏卡片 */
.skeleton-card {
  background: linear-gradient(135deg, var(--skeleton-bg) 0%, var(--skeleton-shimmer) 100%);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  position: relative;
  overflow: hidden;
  min-height: 75px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0.85;
  transform: translateY(10px);
  animation: skeleton-card-rise 0.6s ease-out forwards;
}

.skeleton-card:nth-child(1) { animation-delay: 0.1s; }
.skeleton-card:nth-child(2) { animation-delay: 0.2s; }
.skeleton-card:nth-child(3) { animation-delay: 0.3s; }
.skeleton-card:nth-child(4) { animation-delay: 0.4s; }
.skeleton-card:nth-child(5) { animation-delay: 0.5s; }
.skeleton-card:nth-child(6) { animation-delay: 0.6s; }

/* 骨架屏文本行 */
.skeleton-line {
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.7) 50%, rgba(255, 255, 255, 0.3) 100%);
  margin-bottom: 0.6rem;
}

.skeleton-line.title {
  height: 1rem;
  margin-bottom: 0.8rem;
}

.skeleton-line.desc {
  height: 0.75rem;
  opacity: 0.7;
}

.skeleton-card:nth-child(1) .skeleton-line.title { width: 75%; }
.skeleton-card:nth-child(2) .skeleton-line.title { width: 65%; }
.skeleton-card:nth-child(3) .skeleton-line.title { width: 80%; }
.skeleton-card:nth-child(4) .skeleton-line.title { width: 70%; }
.skeleton-card:nth-child(5) .skeleton-line.title { width: 85%; }
.skeleton-card:nth-child(6) .skeleton-line.title { width: 60%; }

.skeleton-card:nth-child(1) .skeleton-line.desc { width: 90%; }
.skeleton-card:nth-child(2) .skeleton-line.desc { width: 75%; }
.skeleton-card:nth-child(3) .skeleton-line.desc { width: 85%; }
.skeleton-card:nth-child(4) .skeleton-line.desc { width: 95%; }
.skeleton-card:nth-child(5) .skeleton-line.desc { width: 80%; }
.skeleton-card:nth-child(6) .skeleton-line.desc { width: 88%; }

.skeleton-card::after {
  content: '';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  opacity: 0.6;
}

/* 骨架屏动画效果 */
.skeleton-title,
.skeleton-category {
  animation: skeleton-wave 2.5s ease-in-out infinite;
}

.skeleton-card {
  animation: skeleton-card-rise 0.6s ease-out forwards, skeleton-wave 3s ease-in-out infinite 0.8s;
}

.skeleton-line {
  animation: skeleton-line-flow 2.8s ease-in-out infinite;
}

@keyframes skeleton-fade-in {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes skeleton-section-appear {
  0% {
    opacity: 0;
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes skeleton-card-rise {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 0.85;
    transform: translateY(0);
  }
}

@keyframes skeleton-wave {
  0%, 100% {
    background-position: -200% 0;
  }
  50% {
    background-position: 200% 0;
  }
}

@keyframes skeleton-line-flow {
  0%, 100% {
    opacity: 0.7;
    transform: scale(1);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.01);
  }
}

/* 骨架屏背景渐变优化 */
.skeleton-title,
.skeleton-category {
  background-size: 200% 100%;
}

.skeleton-card {
  background-size: 200% 100%;
}

.skeleton-line {
  background-size: 200% 100%;
}

/* 无障碍支持 - 用户偏好减少动画时禁用所有动画 */
@media (prefers-reduced-motion: reduce) {
  .skeleton-title,
  .skeleton-category,
  .skeleton-card,
  .skeleton-line,
  .skeleton-container,
  .skeleton-section {
    animation: none !important;
  }
  
  .skeleton-card {
    transform: translateY(0) !important;
    opacity: 0.85 !important;
  }
}

/* 响应式骨架屏 - 匹配真实内容布局 */
@media (max-width: 1199px) {
  .skeleton-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 0.65rem;
  }
  
  .skeleton-card {
    min-height: 70px;
  }
}

@media (max-width: 899px) {
  .skeleton-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
  }
  
  .skeleton-card {
    min-height: 68px;
  }
}

@media (max-width: 767px) {
  .skeleton-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
  }
  
  .skeleton-container {
    padding: 0 1rem;
  }
  
  .skeleton-card {
    min-height: 65px;
    padding: 0.7rem 0.8rem;
  }
  
  .skeleton-content {
    padding: 0.8rem 1rem 1.5rem;
  }
}

@media (max-width: 480px) {
  .skeleton-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.48rem;
  }
  
  .skeleton-card {
    min-height: 70px;
    padding: 0.8rem;
  }
  
  .skeleton-line.title {
    height: 0.9rem;
  }
  
  .skeleton-line.desc {
    height: 0.7rem;
  }
}

@media (max-width: 280px) {
  .skeleton-grid {
    grid-template-columns: 1fr;
    gap: 0.36rem;
  }
  
  .skeleton-card {
    min-height: 65px;
    padding: 0.6rem;
  }
  
  .skeleton-section {
    margin: 1.5rem 0;
  }
}

/* 关键内联样式，避免页面闪烁 */
.search-container {
  max-width: 600px;
  margin: 0 auto 1rem;
  position: relative;
  display: flex;
  flex-direction: column;
}

.search-box {
  display: grid;
  grid-template-columns: auto 1fr auto;
  max-width: 480px;
  margin: 0 auto 1rem;
  border-radius: 8px;
  background: #fff;
  border: 1px solid rgba(220, 220, 220, 0.5);
  height: 44px;
  align-items: center;
}

.search-engine-select {
  background: transparent;
  border: none;
  padding: 0 4px;
  min-width: 60px;
  width: 60px;
  height: 44px;
  color: transparent;
  font-size: 0;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 20px 20px;
  background-image: url('ico/bing.png');
}

.search-input {
  width: 100%;
  padding: 0 16px;
  border: none;
  background: transparent;
  color: #333;
  font-size: 15px;
  outline: none;
  height: 44px;
}

header {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 1rem;
  text-align: center;
}

header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-color);
  margin: 0;
  margin-bottom: 0.5rem;
}

footer {
  text-align: center;
  padding: 2.5rem 1.5rem;
  font-size: 0.85rem;
  color: #666;
  opacity: 0.5;
}

[data-theme="dark"] .search-box {
  background: #2a2a2a;
  border-color: #333;
}

[data-theme="dark"] .search-input {
  color: #e0e0e0;
}

[data-theme="dark"] footer {
  color: #aaa;
}

/* 内容切换动画 */
.fade-out {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.fade-in {
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* CSS变量定义，完整主题系统 */
:root {
  /* 主要颜色变量 */
  --bg-color: #fff;
  --text-color: #333;
  --border-color: #e0e0e0;
  --card-bg: #fff;
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  
  /* 骨架屏颜色 */
  --skeleton-bg: #e8e8e8;
  --skeleton-shimmer: #f5f5f5;
  --skeleton-highlight: #ffffff;
  
  /* 简约风格变量 */
  --bg-start: #f5f5f5;
  --bg-end: #f0f0f0;
  --card-border: rgba(220, 220, 220, 0.5);
  --card-shadow-hover: 0 3px 6px -1px rgba(0, 0, 0, 0.1);
  --text: #333333;
  --subtext: #666666;
  --accent: #555555;
  --link: #555555;
  --link-hover: #000000;
  --btn-bg: rgba(255, 255, 255, .9);
  --btn-bg-hover: rgba(255, 255, 255, 1);
  --btn-icon: #555555;
  --btn-shadow: 0 1px 3px rgba(0, 0, 0, .05);
  --btn-shadow-hover: 0 2px 5px rgba(0, 0, 0, .08);
}

/* 深色主题 - 完整主题系统 */
[data-theme="dark"] {
  /* 主要颜色变量 */
  --bg-color: #1a1a1a;
  --text-color: #e0e0e0;
  --border-color: #333;
  --card-bg: #2a2a2a;
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  
  /* 骨架屏颜色 */
  --skeleton-bg: #333333;
  --skeleton-shimmer: #404040;
  --skeleton-highlight: #4a4a4a;
  
  /* 简约风格变量 */
  --bg-start: #222222;
  --bg-end: #1a1a1a;
  --card-border: rgba(60, 60, 60, 0.5);
  --card-shadow-hover: 0 3px 6px -1px rgba(0, 0, 0, 0.3);
  --text: #e0e0e0;
  --subtext: #aaaaaa;
  --accent: #bbbbbb;
  --link: #bbbbbb;
  --link-hover: #ffffff;
  --btn-bg: rgba(40, 40, 40, 0.9);
  --btn-bg-hover: rgba(50, 50, 50, 1);
  --btn-icon: #bbbbbb;
  --btn-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  --btn-shadow-hover: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* 基础样式重置 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(145deg, var(--bg-start) 0%, var(--bg-end) 100%);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background .3s ease, color .3s ease;
  overflow-y: scroll;
}

/* 简约滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* 深色主题滚动条 */
[data-theme="dark"] ::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* Firefox浏览器滚动条样式 */
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] html {
  scrollbar-color: rgba(255, 255, 255, 0.25) rgba(255, 255, 255, 0.05);
}

/* 头部样式 */
header {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 1rem;
  text-align: center;
}

header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 0.5rem;
}

header .subtitle {
  font-size: 1rem;
  color: var(--subtext);
  margin-top: 0.5rem;
  opacity: 0.9;
}


/* 主题切换和返回顶部按钮 */
#theme-toggle,
#back-to-top {
  position: fixed;
  z-index: 100;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  border: none;
  border-radius: 50%;
  color: var(--btn-icon);
  background: var(--btn-bg);
  cursor: pointer;
  box-shadow: var(--btn-shadow);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

#theme-toggle {
  right: 1.5rem;
  top: 1.5rem;
}

#back-to-top {
  right: 1.5rem;
  bottom: 1.5rem;
  opacity: 0;
  visibility: hidden;
}

#back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

#theme-toggle:hover,
#back-to-top:hover {
  background: var(--btn-bg-hover);
  box-shadow: var(--btn-shadow-hover);
}


/* 主内容区域 */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
  min-height: 300px;
}


/* 错误状态 - 保留用于错误处理 */
.error-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 0;
}

.error-message p {
  color: var(--subtext);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.error-message button {
  background: var(--link);
  color: white;
  border: none;
  padding: 0.5rem 1.2rem;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.error-message button:hover {
  background: var(--link-hover);
}


/* 页脚 */
footer {
  text-align: center;
  padding: 2.5rem 1.5rem;
  font-size: 0.85rem;
  color: var(--subtext);
  opacity: 0.5;
}

footer a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

footer a:hover {
  color: var(--link);
  text-decoration: underline;
}


/* 搜索容器 */
.search-container {
  max-width: 600px;
  margin: 0 auto 1rem;
  position: relative;
  display: flex;
  flex-direction: column;
}

.search-box {
  display: grid;
  grid-template-columns: auto 1fr auto;
  max-width: 480px;
  margin: 0 auto 1rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--card-border);
  height: 44px;
  align-items: center;
}

/* PC端搜索框优化，更大更舒适 */
@media (min-width: 1024px) {
  .search-container {
    max-width: 750px;
  }
  
  .search-box {
    max-width: 620px;
    height: 52px;
    border-radius: 10px;
  }
  
  .search-engine-select {
    height: 52px;
    min-width: 70px;
    width: 70px;
    background-size: 22px 22px;
  }
  
  .search-input-area {
    height: 52px;
  }
  
  .search-input {
    height: 52px;
    line-height: 52px;
    font-size: 16px;
    padding: 0 20px;
    padding-right: 52px;
  }
  
  .search-button {
    height: 52px;
    width: 48px;
    min-width: 48px;
  }
  
  .search-button svg {
    width: 22px;
    height: 22px;
  }
  
  .search-clear {
    width: 26px;
    height: 26px;
    right: 10px;
  }
  
  .search-clear svg {
    width: 16px;
    height: 16px;
  }
}

[data-theme="dark"] .search-box {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
}

[data-theme="dark"] .search-box:hover {
  border-color: var(--subtext);
}

.search-box:hover {
  border-color: var(--subtext);
}

.search-box:focus-within {
  border-color: var(--text);
}


/* 搜索引擎选择器 */
.search-engine-select {
  background: transparent;
  border: none;
  border-radius: 8px 0 0 8px;
  padding: 0 4px;
  min-width: 60px;
  width: 60px;
  height: 44px;
  color: transparent;
  font-weight: 600;
  font-size: 0;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  grid-column: 1;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 20px 20px;
  text-align: center;
  padding-left: 0;
  text-indent: 0;
}

/* 移除批量图标预加载，避免不必要的请求 */
/* 搜索引擎图标 */
.search-engine-select[value="bing"] {
  background-image: url('../ico/bing.png');
}

.search-engine-select[value="baidu"] {
  background-image: url('../ico/baidu.png');
}

.search-engine-select[value="google"] {
  background-image: url('../ico/google.png');
}

.search-engine-select[value="duckduckgo"] {
  background-image: url('../ico/duckduckgo.png');
}

.search-engine-select[value="github"] {
  background-image: url('../ico/github.png');
}



.search-engine-select:after {
  content: '▼';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: #9aa0a6;
  pointer-events: none;
}

[data-theme="dark"] .search-engine-select {
  color: var(--text);
}

[data-theme="dark"] .search-engine-select:after {
  color: var(--subtext);
}

[data-theme="dark"] .search-engine-select:hover {
  background-color: rgba(148, 163, 184, 0.1);
}

[data-theme="dark"] .search-engine-select:focus {
  background-color: rgba(148, 163, 184, 0.15);
}

.search-engine-select:hover {
  background-color: rgba(60, 64, 67, 0.08);
}

.search-engine-select:focus {
  background-color: rgba(60, 64, 67, 0.12);
}

.search-engine-select option {
    background: #fff;
    color: #3c4043;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    text-align: center;
    border-radius: 8px;
    margin: 2px 4px;
    transition: all 0.2s ease;
    min-width: 120px;
  }

[data-theme="dark"] .search-engine-select option {
  background: var(--card-bg);
  color: var(--text);
}

.search-engine-select option:hover {
  background: #e3f2fd;
  color: #1976d2;
  transform: translateY(-1px);
}

[data-theme="dark"] .search-engine-select option:hover {
  background: rgba(96, 165, 250, 0.1);
  color: var(--link);
}


/* 搜索输入区域 */
.search-input-area {
  position: relative;
  display: flex;
  align-items: center;
  height: 44px;
  min-width: 0;
  box-sizing: border-box;
  grid-column: 2;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 0 16px;
  padding-right: 44px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 400;
  outline: none;
  height: 44px;
  line-height: 44px;
  box-sizing: border-box;
}

.search-input::placeholder {
  color: rgba(154, 160, 166, 0.7);
  font-weight: 400;
  font-size: 13px;
}

[data-theme="dark"] .search-input {
  color: var(--text);
}

[data-theme="dark"] .search-input::placeholder {
  color: rgba(148, 163, 184, 0.6);
}


/* 搜索清空按钮 */
.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--subtext);
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, opacity 0.2s ease, visibility 0.2s ease;
  width: 24px;
  height: 24px;
  z-index: 10;
  outline: none;
  opacity: 0;
  visibility: hidden;
}

[data-theme="dark"] .search-clear {
  color: var(--subtext);
}

[data-theme="dark"] .search-clear:hover {
  color: var(--text);
}

[data-theme="dark"] .search-clear:active {
  color: var(--link);
}

.search-clear:hover {
  color: var(--text);
}

.search-clear:active {
  color: var(--link);
}

.search-clear.visible {
  opacity: 1;
  visibility: visible;
}

.search-clear svg {
  width: 16px;
  height: 16px;
}


/* 搜索按钮 */
.search-button {
  padding: 0;
  background: transparent;
  color: var(--subtext);
  border: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  font-weight: 400;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  width: 40px;
  min-width: 40px;
  outline: none;
  position: relative;
  z-index: 10;
  grid-column: 3;
  box-sizing: border-box;
}

.search-button:hover {
  color: var(--text);
  background: var(--btn-bg-hover);
  box-shadow: var(--btn-shadow-hover);
}

.search-button:active {
  color: var(--link);
  transform: translateY(1px);
}

[data-theme="dark"] .search-button {
  color: var(--subtext);
}

[data-theme="dark"] .search-button:hover {
  color: var(--text);
}

[data-theme="dark"] .search-button:active {
  color: var(--link);
}

.search-button svg {
  width: 20px;
  height: 20px;
}


/* 搜索结果计数 */
.search-results-count {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--subtext);
  text-align: right;
  padding: 0 0.5rem;
  display: none;
}

.search-results-count.visible {
  display: block;
}


/* 分类区块 */
section {
  margin: 1.5rem 0;
}

section h2 {
  font-size: 1.2rem;
  font-weight: 700;
  padding-bottom: 0.8rem;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--card-border);
  color: var(--text);
  display: flex;
  align-items: center;
}


/* 链接网格 */
ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.72rem;
  padding: 0;
  margin: 0;
  width: 100%;
}

li {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.15s ease-out, background-color 0.15s ease-out;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  will-change: transform;
}

li:hover {
  box-shadow: var(--card-shadow-hover);
  border-color: var(--link);
  transform: translateY(-2px);
}


/* 卡片按下的轻微反馈，保持统一简洁风格 */
li:active {
  transform: translateY(1px);
}

li a {
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.2s ease;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

li a:hover {
  color: var(--link-hover);
}

/* Favicon样式 */
.favicon-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.favicon {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  transition: opacity 0.2s ease;
  object-fit: contain;
}

.favicon-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--subtext);
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.favicon-container .favicon:not([src=""]) + .favicon-placeholder {
  opacity: 0;
}

.link-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 小屏幕下的favicon适配 */
@media (max-width: 480px) {
  .favicon-container {
    width: 16px;
    height: 16px;
  }
  
  .favicon {
    width: 14px;
    height: 14px;
  }
  
  .favicon-placeholder {
    width: 16px;
    height: 16px;
    font-size: 12px;
  }
  
  li a {
    gap: 0.4rem;
  }
}

li .url {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--subtext);
  word-break: break-all;
  line-height: 1.4;
  position: relative;
  z-index: 2;
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* 复制按钮（卡片右上角，悬停/聚焦时显现） */
li .copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  background: var(--btn-bg);
  color: var(--btn-icon);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s ease, visibility .15s ease, background .2s ease, box-shadow .2s ease;
  box-shadow: var(--btn-shadow);
}

li:hover .copy-btn,
li:focus-within .copy-btn {
  opacity: 1;
  visibility: visible;
}

li .copy-btn:hover {
  background: var(--btn-bg-hover);
  box-shadow: var(--btn-shadow-hover);
}

/* Toast 提示 */
#toast {
  position: fixed;
  left: 50%;
  bottom: 2rem;
  transform: translateX(-50%);
  background: var(--btn-bg);
  color: var(--text);
  border: 1px solid var(--card-border);
  box-shadow: var(--btn-shadow);
  padding: .6rem .9rem;
  border-radius: 8px;
  font-size: .9rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
  z-index: 999;
}

#toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-4px);
}


/* 响应式设计 */
/* PC端：1200px以上 - 6列 */
@media (max-width: 1199px) {
  ul {
    grid-template-columns: repeat(5, 1fr);
    gap: 0.65rem;
  }
}

/* 平板横向：768px-899px - 4列 */
@media (max-width: 899px) {
  ul {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
  }
}

/* 平板竖向：481px-767px - 3列 */
@media (max-width: 767px) {
  ul {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
  }
}

/* 手机端：480px以下 - 2列 */
@media (max-width: 480px) {
  ul {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.48rem;
  }
}

/* 超窄屏：280px以下 - 1列 */
@media (max-width: 280px) {
  ul {
    grid-template-columns: 1fr;
    gap: 0.36rem;
  }
}

@media (max-width: 768px) {
  .search-container {
    max-width: 100%;
    margin-bottom: 1.5rem;
  }
  
  .search-box {
    max-width: calc(100% - 32px);
    margin: 0 16px 1.5rem;
    height: 44px;
    grid-template-columns: auto 1fr auto;
  }
  
  .search-engine-select {
    min-width: 54px;
    width: 54px;
    padding: 0 4px;
    font-size: 0;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: 18px 18px;
    background-position: center center;
    text-align: center;
    padding-left: 0;
    text-indent: 0;
    color: transparent;
  }
  
  .search-input-area {
    height: 44px;
  }
  
  .search-input {
    font-size: 13px;
    padding: 0 12px;
    padding-right: 36px;
    height: 44px;
    line-height: 44px;
  }
  
  .search-input::placeholder {
    font-size: 13px;
  }
  
  .search-button {
    padding: 0;
    height: 44px;
    width: 44px;
    min-width: 44px;
  }
  
  .search-button svg {
    width: 18px;
    height: 18px;
  }
  
  .search-clear {
    right: 8px;
    z-index: 10;
    width: 20px;
    height: 20px;
    display: flex;
  }
  
  .search-clear svg {
    width: 14px;
    height: 14px;
  }
  
  header h1 {
    font-size: 1.6rem;
  }
  
  header .subtitle {
    font-size: 0.9rem;
  }
  

  
  li {
    padding: 1rem;
  }
  
  #theme-toggle {
    width: 44px;
    height: 44px;
    right: 1.2rem;
    top: 1.2rem;
  }
}

@media (max-width: 576px) {
  header {
    padding: 2rem 1rem 1rem;
  }
  
  main {
    padding: 0 1rem 1.5rem;
  }
}

@media (max-width: 480px) {
  .search-container {
    margin: 0 1rem 1.5rem 1rem;
    padding: 0;
    max-width: none;
  }
  
  .search-box {
    max-width: calc(100% - 16px);
    margin: 0 8px 1rem;
    height: 40px;
    grid-template-columns: auto 1fr auto;
  }
  
  .search-engine-select {
    min-width: 48px;
    width: 48px;
    padding: 0 3px;
    font-size: 0;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: 16px 16px;
    background-position: center center;
    text-align: center;
    padding-left: 0;
    text-indent: 0;
    color: transparent;
  }
  
  .search-input-area {
    height: 40px;
  }
  
  .search-input {
    font-size: 12px;
    padding: 0 10px;
    padding-right: 32px;
    height: 40px;
    line-height: 40px;
  }
  
  .search-input::placeholder {
    font-size: 12px;
  }
  
  .search-button {
    padding: 0;
    height: 40px;
    width: 40px;
    min-width: 40px;
  }
  
  .search-button svg {
    width: 16px;
    height: 16px;
  }
  
  .search-clear {
    right: 6px;
    z-index: 10;
    width: 18px;
    height: 18px;
  }
  
  .search-clear svg {
    width: 12px;
    height: 12px;
  }
}

/* 超窄屏适配：280px以下 */
@media (max-width: 280px) {
  .search-container {
    margin: 0 0.5rem 1rem 0.5rem;
  }
  
  .search-box {
    max-width: calc(100% - 8px);
    margin: 0 4px 1rem;
    height: 36px;
    grid-template-columns: auto 1fr auto;
  }
  
  .search-engine-select {
    min-width: 42px;
    width: 42px;
    padding: 0 2px;
    font-size: 0;
    height: 36px;
    background-size: 14px 14px;
    background-position: center center;
    text-align: center;
    padding-left: 0;
    text-indent: 0;
    color: transparent;
  }
  
  .search-input-area {
    height: 36px;
  }
  
  .search-input {
    font-size: 11px;
    padding: 0 8px;
    padding-right: 28px;
    height: 36px;
    line-height: 36px;
  }
  
  .search-input::placeholder {
    font-size: 11px;
  }
  
  .search-button {
    height: 36px;
    width: 36px;
    min-width: 36px;
  }
  
  .search-button svg {
    width: 14px;
    height: 14px;
  }
  
  .search-clear {
    right: 4px;
    width: 16px;
    height: 16px;
  }
  
  .search-clear svg {
    width: 10px;
    height: 10px;
  }
  
  li {
    padding: 0.5rem 0.6rem;
    font-size: 0.85rem;
  }
  
  li a {
    font-size: 0.8rem;
  }
  
  li .url {
    font-size: 0.7rem;
  }
}

@media (max-width: 360px) {
  ul {
    gap: 0.5rem;
  }
  
  li {
    padding: 0.6rem 0.7rem;
    font-size: 0.9rem;
  }
  
  .card-title {
    font-size: 0.85rem;
  }
  
  .url {
    font-size: 0.75rem;
  }
}