* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: linear-gradient(135deg, #f0fdf4 0%, #f8fafc 50%, #f1f5f9 100%);
  color: #1f2937;
  overflow: hidden;
}

.app-shell {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 240px;
  padding: 24px 18px;
  background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 52%, #bbf7d0 100%);
  color: #334155;
  flex-shrink: 0;
  overflow: hidden;
  border-right: 1px solid rgba(16, 185, 129, 0.12);
  box-shadow: 4px 0 24px rgba(16, 185, 129, 0.05),
              inset -1px 0 0 rgba(255, 255, 255, 0.5);
  position: relative;
}

.sidebar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: radial-gradient(ellipse at top, rgba(16, 185, 129, 0.08), transparent 70%);
  pointer-events: none;
}

.sidebar::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg, 
    rgba(255, 255, 255, 0.8) 0%, 
    rgba(16, 185, 129, 0.15) 50%, 
    rgba(255, 255, 255, 0.8) 100%);
  pointer-events: none;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 12px 30px rgba(16, 185, 129, 0.3), 
              0 4px 12px rgba(16, 185, 129, 0.2),
              inset 0 1px 0 rgba(255, 255, 255, 0.3);
  position: relative;
  overflow: hidden;
}

.brand-mark::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: rotate(45deg);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0%, 100% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
  50% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.brand h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

.brand p {
  margin: 0;
  font-size: 13px;
  color: rgba(23, 59, 43, 0.66);
}

.category-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-right: 4px;
}

.nav-item-icon img {
  border-radius: 4px;
}
.svg-icon-wrapper svg {
  width: 100%;
  height: 100%;
  max-width: 24px;
  max-height: 24px;
  display: block;
}
.tool-icon .svg-icon-wrapper svg {
  max-width: 32px;
  max-height: 32px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  text-align: left;
  font-size: 15px;
  font-weight: 600;
  color: #475569;
  background: transparent;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.nav-item::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: rgba(16, 185, 129, 0.08);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nav-item-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 11px;
  flex: 0 0 32px;
  font-size: 15px;
  color: var(--nav-color);
  background: var(--nav-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2),
              0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 1;
}

.nav-item-text {
  min-width: 0;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(16, 185, 129, 0.08);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
  color: #059669;
}

.nav-item:hover::before,
.nav-item.active::before {
  opacity: 1;
}

.nav-item:hover .nav-item-icon,
.nav-item.active .nav-item-icon {
  transform: scale(1.1);
  background: #10b981;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3),
              0 4px 12px rgba(16, 185, 129, 0.3);
}

.content {
  flex: 1;
  padding: 24px;
  min-width: 0;
  overflow-y: auto;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 50%, #f0fdf4 100%);
  position: relative;
}

.content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 200px;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.03), transparent);
  pointer-events: none;
}

.content-header {
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}

.content-header-main {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.content-header-top {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.category-tabs-row {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  min-width: 0;
}

.category-tabs-row[hidden] {
  display: none;
}

.category-tabs {
  position: relative;
  display: inline-flex;
  gap: 12px;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  padding: 5px;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(241, 245, 249, 0.9));
  border: 1px solid rgba(16, 185, 129, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 10px 28px rgba(15, 23, 42, 0.06);
  scrollbar-width: thin;
  scrollbar-color: rgba(16, 185, 129, 0.35) transparent;
}

.category-tabs-indicator {
  position: absolute;
  top: 5px;
  left: 0;
  width: 0;
  height: calc(100% - 10px);
  border-radius: 12px;
  background: linear-gradient(135deg, #10b981, #34d399);
  box-shadow: 0 12px 24px rgba(16, 185, 129, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  pointer-events: none;
  opacity: 0;
  will-change: transform, width;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.15s ease;
  z-index: 0;
}

.category-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #475569;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), 
              color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  z-index: 1;
}

.category-tab-label {
  cursor: default;
  pointer-events: none;
}

.category-tab-text,
.category-tab-count {
  display: inline-flex;
  align-items: center;
}

.category-tab-count {
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid rgba(148, 163, 184, 0.35);
  font-size: 12px;
  font-weight: 600;
  opacity: 0.92;
}

.category-tab-button:hover {
  color: #065f46;
  background: rgba(16, 185, 129, 0.08);
  transform: translateY(-1px);
}

.category-tab-button.active {
  color: #fff;
  background: transparent;
  box-shadow: none;
  transform: none;
}

.category-tab-button.active:hover {
  background: transparent;
}

.category-tab:focus-visible {
  outline: 2px solid rgba(16, 185, 129, 0.45);
  outline-offset: 2px;
}

.category-tab-stat {
  cursor: default;
  pointer-events: none;
  color: #065f46;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(52, 211, 153, 0.1));
  border: 1px solid rgba(16, 185, 129, 0.26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65), 0 10px 24px rgba(16, 185, 129, 0.08);
}

.category-tab-stat .category-tab-count {
  border-left-color: rgba(16, 185, 129, 0.28);
}

.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 100px;
  height: 48px;
  padding: 0 12px;
  border: 2px solid rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  background: linear-gradient(135deg, #ffffff, #f1f5f9);
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.9), 
              0 8px 20px rgba(15, 23, 42, 0.1),
              0 2px 8px rgba(15, 23, 42, 0.06);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.9), 
              0 12px 28px rgba(15, 23, 42, 0.14),
              0 4px 12px rgba(15, 23, 42, 0.08);
}

.theme-icon {
  position: relative;
  z-index: 2;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 18px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.theme-icon-sun {
  color: #f59e0b;
  font-weight: bold;
}

.theme-icon-moon {
  color: #64748b;
  opacity: 0.4;
  font-weight: bold;
}

.theme-toggle-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3),
              0 2px 6px rgba(245, 158, 11, 0.2),
              inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid rgba(245, 158, 11, 0.2);
}

body[data-theme="dark"] .theme-toggle {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.05), 
              0 8px 20px rgba(2, 6, 23, 0.5),
              0 2px 8px rgba(99, 102, 241, 0.2);
}

body[data-theme="dark"] .theme-toggle:hover {
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.05), 
              0 12px 28px rgba(2, 6, 23, 0.6),
              0 4px 12px rgba(99, 102, 241, 0.3);
}

body[data-theme="dark"] .theme-toggle-thumb {
  transform: translateX(50px);
  background: linear-gradient(135deg, #818cf8, #6366f1);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.5),
              0 2px 6px rgba(99, 102, 241, 0.3),
              inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border-color: rgba(129, 140, 248, 0.4);
}

body[data-theme="dark"] .theme-icon-sun {
  color: #94a3b8;
  opacity: 0.3;
}

body[data-theme="dark"] .theme-icon-moon {
  color: #e0e7ff;
  opacity: 1;
  text-shadow: 0 0 8px rgba(224, 231, 255, 0.5);
}

/* 搜索区域重写 - 彻底移除嵌套感 */
.search-container {
  position: relative;
  width: min(640px, 80%);
  margin: 0 auto;
  z-index: 100;
}

.search-main {
  position: relative;
  display: block; /* 必须是 block */
  height: 52px; /* 固定整体高度 */
  background: var(--input-bg, #ffffff);
  border: 2px solid rgba(148, 163, 184, 0.15);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  transition: all 0.3s ease;
  overflow: visible;
}

.search-main:focus-within {
  border-color: #10b981;
  box-shadow: 0 16px 40px rgba(16, 185, 129, 0.15);
  background: var(--input-bg-focus, #ffffff);
}

.search-input {
  width: 100%;
  height: 100%;
  padding: 0 120px 0 16px; /* 右侧留出巨大空间，绝对不让文字和按钮挤压 */
  border: none;
  outline: none;
  background: transparent !important;
  color: var(--input-text, #334155);
  font-size: 16px;
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  line-height: 48px;
  caret-color: #10b981;
  box-sizing: border-box;
  display: block;
}

/* 移除搜索框默认清除按钮 */
.search-input::-webkit-search-decoration,
.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-results-button,
.search-input::-webkit-search-results-decoration {
  display: none;
}

.search-input::placeholder {
  color: #94a3b8;
  opacity: 0.8;
}

.search-actions {
  position: absolute; /* 关键：绝对定位，不参与 input 的宽度挤压 */
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 2;
  pointer-events: auto;
}

.search-divider {
  width: 1px;
  height: 20px;
  background: rgba(148, 163, 184, 0.2);
}

.search-clear-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.search-clear-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.search-btn {
  height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s;
  font-weight: 600;
}

.search-btn:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: scale(1.04) translateX(2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.search-icon-symbol {
  font-size: 18px;
  font-weight: bold;
}

/* 搜索历史下拉框美化 */
.search-history {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  right: 0;
  background: var(--history-bg, #ffffff);
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.16);
  z-index: 1000;
  backdrop-filter: blur(12px);
  animation: searchSlideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body[data-theme="dark"] .search-main {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(148, 163, 184, 0.1);
}

body[data-theme="dark"] .search-input {
  color: #f8fafc !important;
}

body[data-theme="dark"] .search-history {
  --history-bg: rgba(15, 23, 42, 0.98);
  border-color: rgba(99, 102, 241, 0.2);
}

.history-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.close-history-btn {
  background: rgba(148, 163, 184, 0.1);
  border: none;
  color: #64748b;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.close-history-btn:hover {
  background: rgba(148, 163, 184, 0.2);
  color: #334155;
}

body[data-theme="dark"] .close-history-btn {
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
}

body[data-theme="dark"] .close-history-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
}

.search-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  font-size: 13px;
  color: #64748b;
  font-weight: 600;
}

.clear-all-btn {
  background: transparent;
  border: none;
  color: #ef4444;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s;
}

.clear-all-btn:hover {
  background: rgba(239, 68, 68, 0.1);
}

.search-history-list {
  max-height: 300px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.2s;
}

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

.history-icon {
  color: #94a3b8;
  font-size: 14px;
}

.history-text {
  flex: 1;
  font-size: 14px;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.delete-history-item {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #94a3b8;
  font-size: 16px;
  transition: all 0.2s;
}

.delete-history-item:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

body[data-theme="dark"] .history-text {
  color: #e2e8f0;
}

/* 回到顶部进度圆环样式 */
.back-to-top {
  position: fixed;
  bottom: 40px;
  right: 100px; /* 继续向左移动 30px (原 70px) */
  width: 120px; /* 增大尺寸至 120px */
  height: 120px;
  cursor: pointer;
  z-index: 1000;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.progress-ring {
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  position: absolute;
  top: 0;
  left: 0;
}

.progress-ring__circle-bg {
  stroke: rgba(99, 102, 241, 0.1);
  transition: stroke 0.3s;
}

.progress-ring__circle {
  stroke: #6366f1;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.35s, stroke 0.3s;
}

.back-to-top-icon {
  font-size: 32px; /* 图标也变大 */
  color: #10b981;
  font-weight: bold;
  z-index: 1;
  transition: transform 0.3s;
}

.back-to-top:hover .back-to-top-icon {
  transform: translateY(-2px);
}

.back-to-top:hover .progress-ring__circle-bg {
  stroke: rgba(16, 185, 129, 0.2);
}

body[data-theme="dark"] .progress-ring__circle-bg {
  stroke: rgba(16, 185, 129, 0.15);
}

body[data-theme="dark"] .back-to-top-icon {
  color: #34d399;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
}

.card-grid:has(.empty-state) {
  display: block;
}

.card-grid.group-list {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.group-section {
  margin-bottom: 32px;
}

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

.card-grid.group-list .group-section {
  margin-bottom: 0;
}

.group-header {
  margin-bottom: 16px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.group-header::before {
  display: none;
}

.group-header::after {
  display: none;
}

.group-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* 移除旧的标题和数量样式，使用统一的胶囊样式 */
.group-title, .group-count {
  display: none;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(0.9);
  }
}

.group-desc {
  display: none;
}

.group-grid {
  margin-top: 0;
  padding: 0;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 320px;
  padding: 40px 24px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(246, 249, 255, 0.92));
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
  text-align: center;
  overflow: hidden;
  position: relative;
}

.empty-state::before {
  content: "";
  position: absolute;
  top: -80px;
  left: 50%;
  width: 220px;
  height: 220px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.16), rgba(99, 102, 241, 0));
  pointer-events: none;
}

.empty-state-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 440px;
}

.empty-icon-wrap {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 18px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.16), rgba(139, 92, 246, 0.12));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 14px 30px rgba(99, 102, 241, 0.12);
}

.empty-icon {
  font-size: 30px;
  line-height: 1;
  color: #4f46e5;
}

.empty-title {
  margin: 0 0 10px;
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  letter-spacing: 0.3px;
}

.empty-desc {
  margin: 0;
  font-size: 15px;
  line-height: 1.75;
  color: #64748b;
}

.tool-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 88px;
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
  border: 1px solid rgba(148, 163, 184, 0.14);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06),
              0 2px 8px rgba(15, 23, 42, 0.04),
              inset 0 1px 0 rgba(255, 255, 255, 0.8);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  will-change: transform;
  transform: translateZ(0);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              border-color 0.3s ease, 
              background 0.3s ease;
}

.tool-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(255, 255, 255, 0) 58%);
  opacity: 0;
  transition: opacity 0.22s ease;
  pointer-events: none;
}

.tool-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: -140%;
  width: 70%;
  height: 100%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0));
  transform: skewX(-22deg);
  opacity: 0;
  transition: left 0.38s ease, opacity 0.2s ease;
  pointer-events: none;
}

.tool-card:hover {
  transform: translateY(-8px) scale(1.02);
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.14), 
              0 12px 24px rgba(99, 102, 241, 0.12),
              0 0 0 1px rgba(99, 102, 241, 0.1),
              inset 0 1px 0 rgba(255, 255, 255, 1);
  animation: cardGlowPulse 2s ease-in-out infinite;
}

.tool-card:hover::before {
  opacity: 1;
}

.tool-card:hover::after {
  left: 150%;
  opacity: 1;
}

.tool-icon {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 
              0 10px 18px rgba(15, 23, 42, 0.16),
              0 4px 8px rgba(15, 23, 42, 0.1);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              filter 0.3s ease;
  position: relative;
  overflow: hidden;
}

.tool-icon::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transform: translateX(-100%) translateY(-100%) rotate(45deg);
  transition: transform 0.6s ease;
}

.tool-card:hover .tool-icon::after {
  transform: translateX(100%) translateY(100%) rotate(45deg);
}

.tool-info {
  position: relative;
  z-index: 1;
  min-width: 0;
  padding-right: 18px;
  transition: transform 0.22s ease;
}

.tool-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.22s ease;
}

.tool-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #6b7280;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.22s ease;
}

.tool-card:hover .tool-icon {
  transform: translateY(-4px) scale(1.1) rotate(2deg);
  filter: saturate(1.3) brightness(1.15);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 
              0 18px 28px rgba(15, 23, 42, 0.24),
              0 8px 16px rgba(15, 23, 42, 0.12);
}

.tool-card:hover .tool-info {
  transform: translateX(3px);
}

.tool-card:hover .tool-title {
  color: #312e81;
}

.tool-card:hover .tool-desc {
  color: #475569;
}

.tool-arrow {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.1);
  color: #4f46e5;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  transform: translate(8px, -8px) scale(0.88);
  transition: opacity 0.22s ease, transform 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}

/* 网站标签样式 */
.tool-tags {
  position: absolute;
  bottom: 8px;
  right: 10px;
  display: flex;
  gap: 4px;
  z-index: 1;
  pointer-events: none;
  transition: transform 0.22s ease;
}

.tool-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
}

/* 关键词高亮样式 */
.highlight {
  color: #6366f1;
  background: rgba(99, 102, 241, 0.1);
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 700;
}

.tool-card:hover .tool-tags {
  transform: translateX(-4px);
}

.tool-card:hover .tool-arrow {
  opacity: 1;
  transform: translate(0, 0) scale(1.06);
  background: rgba(99, 102, 241, 0.16);
  box-shadow: 0 10px 18px rgba(99, 102, 241, 0.18);
}

@keyframes cardGlowPulse {
  0%, 100% {
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.14), 
                0 12px 24px rgba(99, 102, 241, 0.12),
                0 0 0 1px rgba(99, 102, 241, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 1);
  }

  50% {
    box-shadow: 0 28px 56px rgba(15, 23, 42, 0.16), 
                0 14px 28px rgba(99, 102, 241, 0.18),
                0 0 32px rgba(99, 102, 241, 0.2),
                0 0 0 1px rgba(99, 102, 241, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 1);
  }
}

body[data-theme="dark"] {
  background: linear-gradient(135deg, #0a0f1a 0%, #0f1419 50%, #0b1120 100%);
  color: #e5e7eb;
  --input-bg: rgba(30, 41, 59, 0.8);
  --input-bg-focus: rgba(30, 41, 59, 0.95);
  --input-text: #f8fafc;
}

body[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg, #111827 0%, #182236 100%);
  color: #fff;
  border-right-color: rgba(16, 185, 129, 0.15);
  box-shadow: 4px 0 24px rgba(2, 6, 23, 0.4),
              inset -1px 0 0 rgba(16, 185, 129, 0.1);
}

body[data-theme="dark"] .sidebar::after {
  background: linear-gradient(180deg, 
    rgba(16, 185, 129, 0.3) 0%, 
    rgba(52, 211, 153, 0.2) 50%, 
    rgba(16, 185, 129, 0.3) 100%);
}

body[data-theme="dark"] .brand-mark {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 12px 30px rgba(16, 185, 129, 0.28);
}

body[data-theme="dark"] .brand p {
  color: rgba(255, 255, 255, 0.72);
}

body[data-theme="dark"] .nav-item {
  color: rgba(255, 255, 255, 0.88);
}

body[data-theme="dark"] .nav-item:hover,
body[data-theme="dark"] .nav-item.active {
  background: rgba(255, 255, 255, 0.12);
}

body[data-theme="dark"] .category-tabs {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.92));
  border-color: rgba(16, 185, 129, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 12px 28px rgba(2, 6, 23, 0.22);
  scrollbar-color: rgba(16, 185, 129, 0.45) transparent;
}

body[data-theme="dark"] .category-tab {
  color: #cbd5e1;
}

body[data-theme="dark"] .category-tab-button:hover {
  color: #e2e8f0;
  background: rgba(16, 185, 129, 0.14);
}

body[data-theme="dark"] .category-tab-button.active {
  color: #fff;
  background: transparent;
  box-shadow: none;
}

body[data-theme="dark"] .category-tab-count {
  border-left-color: rgba(148, 163, 184, 0.25);
}

body[data-theme="dark"] .category-tabs-indicator {
  background: linear-gradient(135deg, #10b981, #34d399);
  box-shadow: 0 14px 28px rgba(16, 185, 129, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

body[data-theme="dark"] .category-tab-stat {
  color: #d1fae5;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(52, 211, 153, 0.18));
  border-color: rgba(16, 185, 129, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 12px 28px rgba(2, 6, 23, 0.22);
}

body[data-theme="dark"] .category-tab-stat .category-tab-count {
  border-left-color: rgba(16, 185, 129, 0.22);
}

body[data-theme="dark"] .content {
  background: linear-gradient(135deg, #0f1419 0%, #0b1120 50%, #111827 100%);
}

body[data-theme="dark"] .content::before {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.05), transparent);
}

body[data-theme="dark"] .content-header p,
body[data-theme="dark"] .group-desc,
body[data-theme="dark"] .tool-desc,
body[data-theme="dark"] .empty-desc {
  color: #94a3b8;
}

body[data-theme="dark"] .content-header h2,
body[data-theme="dark"] .group-title,
body[data-theme="dark"] .tool-title,
body[data-theme="dark"] .empty-title {
  color: #f8fafc;
}

body[data-theme="dark"] .search-box,
body[data-theme="dark"] .group-header,
body[data-theme="dark"] .tool-card,
body[data-theme="dark"] .empty-state {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(17, 24, 39, 0.98));
  border-color: rgba(148, 163, 184, 0.16);
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.28);
}

body[data-theme="dark"] .search-box::before {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
}

body[data-theme="dark"] .search-box::after {
  background: radial-gradient(circle, rgba(129, 140, 248, 0.16), rgba(129, 140, 248, 0));
}

body[data-theme="dark"] .group-section {
  background: transparent;
  border: 0;
  box-shadow: none;
}

body[data-theme="dark"] .group-header {
  background: transparent;
  border: 0;
  box-shadow: none;
}

body[data-theme="dark"] .group-header::before {
  display: none;
}

body[data-theme="dark"] .group-header::after {
  display: none;
}

body[data-theme="dark"] .search-box:focus-within {
  border-color: rgba(129, 140, 248, 0.32);
  box-shadow: 0 20px 42px rgba(2, 6, 23, 0.34), 0 0 0 3px rgba(129, 140, 248, 0.08);
}

body[data-theme="dark"] .search-icon,
body[data-theme="dark"] .group-count,
body[data-theme="dark"] .search-clear {
  background: rgba(99, 102, 241, 0.18);
  color: #c7d2fe;
}

body[data-theme="dark"] .search-icon {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.24), rgba(52, 211, 153, 0.14));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 12px 22px rgba(2, 6, 23, 0.24);
}

body[data-theme="dark"] .search-clear {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.22), rgba(52, 211, 153, 0.14));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body[data-theme="dark"] .group-badge {
  display: none;
}

body[data-theme="dark"] .group-title {
  border-color: rgba(16, 185, 129, 0.25);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(52, 211, 153, 0.12));
  color: #d1fae5;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15),
              inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .group-title::before {
  background: linear-gradient(180deg, #34d399, #10b981);
}

body[data-theme="dark"] .group-count {
  color: #6ee7b7;
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.2), rgba(16, 185, 129, 0.15));
  border-color: rgba(52, 211, 153, 0.3);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2),
              inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .group-count::before {
  color: #d1fae5;
}

body[data-theme="dark"] .empty-state::before {
  background: radial-gradient(circle, rgba(16, 185, 129, 0.18), rgba(16, 185, 129, 0));
}

body[data-theme="dark"] .empty-icon-wrap {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.24), rgba(52, 211, 153, 0.14));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 16px 34px rgba(2, 6, 23, 0.28);
}

body[data-theme="dark"] .empty-icon {
  color: #d1fae5;
}

body[data-theme="dark"] .nav-item:hover .nav-item-icon,
body[data-theme="dark"] .nav-item.active .nav-item-icon {
  background: color-mix(in srgb, var(--nav-color, #818cf8) 24%, rgba(255, 255, 255, 0.08));
  color: #fff;
}

body[data-theme="dark"] .search-input {
  color: #f8fafc;
  caret-color: #34d399;
}

body[data-theme="dark"] .search-input::placeholder {
  color: #64748b;
}

@supports not (caret-color: #34d399) {
  body[data-theme="dark"] .search-input {
    color: transparent;
    text-shadow: 0 0 0 #f8fafc;
  }
  
  body[data-theme="dark"] .search-input::selection {
    background: rgba(52, 211, 153, 0.3);
    color: #f8fafc;
    text-shadow: none;
  }
}

body[data-theme="dark"] .search-clear:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.28), rgba(129, 140, 248, 0.18));
  box-shadow: 0 10px 20px rgba(2, 6, 23, 0.28);
}

body[data-theme="dark"] .tool-card {
  border-color: rgba(148, 163, 184, 0.12);
}

body[data-theme="dark"] .tool-card::before {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(15, 23, 42, 0) 58%);
}

body[data-theme="dark"] .tool-card::after {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(16, 185, 129, 0.18), rgba(255, 255, 255, 0));
}

body[data-theme="dark"] .tool-card:hover {
  border-color: rgba(16, 185, 129, 0.24);
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.98) 0%, rgba(30, 41, 59, 0.98) 100%);
  box-shadow: 0 22px 42px rgba(2, 6, 23, 0.4), 0 0 0 1px rgba(16, 185, 129, 0.12);
}

body[data-theme="dark"] .tool-card:hover .tool-title {
  color: #d1fae5;
}

body[data-theme="dark"] .tool-arrow {
  background: rgba(16, 185, 129, 0.18);
  color: #d1fae5;
}

body[data-theme="dark"] .tool-card:hover .tool-desc {
  color: #cbd5e1;
}

@media (max-width: 1600px) {
  .card-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1366px) {
  .card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  body {
    height: auto;
    overflow: auto;
  }

  .app-shell {
    flex-direction: column;
    height: auto;
  }

  .sidebar {
    width: 100%;
    overflow: visible;
  }

  .category-nav {
    flex-direction: row;
    flex-wrap: wrap;
    overflow: visible;
    padding-right: 0;
  }

  .nav-item {
    width: auto;
  }

  .category-tabs {
    gap: 10px;
  }

  .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .content {
    overflow: visible;
  }

  .search-box {
    width: 100%;
  }

  .content-header-top {
    align-items: stretch;
  }
}

@media (max-width: 768px) {
  .content {
    padding: 18px;
  }

  .content-header-top {
    flex-direction: column;
  }

  .theme-toggle {
    align-self: flex-end;
  }

  .category-tabs {
    padding: 5px;
    border-radius: 12px;
  }

  .category-tab {
    min-height: 38px;
    padding: 0 14px;
    font-size: 13px;
  }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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


/* 加载遮罩层 */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* 桌面端有侧边栏时偏移 */
@media (min-width: 1101px) {
  body:not(.nav-page) .loading-overlay {
    left: 240px;
  }
}

.loading-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

body[data-theme="dark"] .loading-overlay {
  background: rgba(11, 17, 32, 0.9);
}

/* 加载状态样式 */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(16, 185, 129, 0.1);
  border-top-color: #10b981;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-state p {
  margin: 0;
  font-size: 15px;
  color: #64748b;
}

body[data-theme="dark"] .loading-spinner {
  border-color: rgba(16, 185, 129, 0.2);
  border-top-color: #34d399;
}

body[data-theme="dark"] .loading-state p {
  color: #94a3b8;
}

/* 骨架屏 */
.loading-skeleton {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-item {
  height: 60px;
  border-radius: 14px;
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0.1) 0%,
    rgba(148, 163, 184, 0.2) 50%,
    rgba(148, 163, 184, 0.1) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

body[data-theme="dark"] .skeleton-item {
  background: linear-gradient(
    90deg,
    rgba(51, 65, 85, 0.3) 0%,
    rgba(71, 85, 105, 0.4) 50%,
    rgba(51, 65, 85, 0.3) 100%
  );
  background-size: 200% 100%;
}

/* 占位卡片 */
.tool-card.placeholder {
    border: 2px dashed rgba(0, 0, 0, 0.15);
    background: rgba(0, 0, 0, 0.02);
    cursor: default;
    pointer-events: none;
}

body[data-theme="dark"] .tool-card.placeholder {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.02);
}

.tool-card.placeholder .tool-icon {
    background: transparent;
    border: 2px dashed rgba(0, 0, 0, 0.15);
    color: rgba(0, 0, 0, 0.2);
}

body[data-theme="dark"] .tool-card.placeholder .tool-icon {
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.2);
}

.tool-card.placeholder .tool-info {
    opacity: 0.4;
}

.tool-card.placeholder .tool-title {
    color: var(--text-primary);
}

.tool-card.placeholder .tool-desc {
    color: var(--text-secondary);
}
