* { margin: 0; padding: 0; box-sizing: border-box; }

body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

.page.hidden { display: none !important; }

.nav-btn { color: #4b5563; background: transparent; border: none; cursor: pointer; font-size: 0.95rem; }
.nav-btn:hover { color: #2563eb; background: #eff6ff; }
.nav-btn.active { color: #2563eb; background: #dbeafe; font-weight: 600; }

.mobile-nav-btn { color: #374151; background: transparent; border: none; cursor: pointer; font-size: 0.95rem; }
.mobile-nav-btn:hover { background: #f3f4f6; }

.category-card {
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid #e5e7eb;
  background: white;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}
.category-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 12px rgba(59,130,246,0.1);
  transform: translateY(-2px);
}
.category-card .icon { font-size: 2.5rem; margin-bottom: 8px; }
.category-card .name { font-weight: 600; color: #1f2937; margin-bottom: 4px; }
.category-card .count { font-size: 0.8rem; color: #9ca3af; }

.hot-tag {
  transition: all 0.2s ease;
  cursor: pointer;
}
.hot-tag:hover {
  border-color: #60a5fa;
  color: #2563eb;
  background: #eff6ff;
}

.sidebar-link {
  transition: all 0.15s ease;
  cursor: pointer;
  font-size: 0.9rem;
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: #4b5563;
  text-decoration: none;
}
.sidebar-link:hover { background: #f3f4f6; color: #1f2937; }
.sidebar-link.active { background: #dbeafe; color: #2563eb; font-weight: 600; }

.editor-tab {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #6b7280;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}
.editor-tab:hover { color: #374151; }
.editor-tab.active { color: #2563eb; border-bottom-color: #2563eb; background: white; }

.editor-panel { display: none !important; }
.editor-panel.active { display: block !important; height: 100%; }
.editor-container { position: relative; }
.editor-container .CodeMirror { height: 100% !important; }
.editor-container .CodeMirror-scroll { min-height: 200px; }

.code-block {
  position: relative;
  background: #1f2937;
  color: #34d399;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 12px 0;
}
.copy-btn {
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  position: absolute;
  top: 8px;
  right: 8px;
  transition: background 0.2s;
}
.copy-btn:hover { background: #1d4ed8; }

.chat-message { animation: fadeInUp 0.25s ease; }

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

.animate-fade-in { animation: fadeInUp 0.3s ease; }

#search-results { max-height: 300px; overflow-y: auto; }

/* ===== 深色模式 ===== */
body.dark { background: #111827; color: #d1d5db; }
body.dark nav { background: #1f2937; box-shadow: 0 4px 6px rgba(0,0,0,0.3); }
body.dark .nav-btn { color: #d1d5db; }
body.dark .nav-btn:hover { color: #60a5fa; background: #1e3a5f; }
body.dark .nav-btn.active { color: #60a5fa; background: #1e3a5f; }
body.dark .mobile-nav-btn { color: #d1d5db; }
body.dark .mobile-nav-btn:hover { background: #374151; }
body.dark #mobile-menu { background: #1f2937; border-color: #374151; }

body.dark .bg-white { background: #1f2937 !important; }
body.dark .bg-gray-50 { background: #111827 !important; }
body.dark .bg-gray-100 { background: #1f2937 !important; }
body.dark .bg-gray-200 { background: #374151 !important; }
body.dark .bg-gray-700 { background: #4b5563 !important; }

body.dark .text-gray-800 { color: #f9fafb !important; }
body.dark .text-gray-700 { color: #e5e7eb !important; }
body.dark .text-gray-600 { color: #d1d5db !important; }
body.dark .text-gray-500 { color: #9ca3af !important; }
body.dark .text-gray-400 { color: #9ca3af !important; }
body.dark .text-gray-300 { color: #d1d5db !important; }
body.dark .text-blue-800 { color: #93c5fd !important; }
body.dark .text-blue-100 { color: #bfdbfe !important; }
body.dark .text-blue-600 { color: #60a5fa !important; }

body.dark .border-b { border-color: #374151 !important; }
body.dark .border-t { border-color: #374151 !important; }
body.dark .sm\:border-r { border-color: #374151 !important; }

body.dark .shadow-sm { box-shadow: 0 1px 2px rgba(0,0,0,0.2) !important; }
body.dark .shadow-md { box-shadow: 0 4px 6px rgba(0,0,0,0.3) !important; }

body.dark .category-card { background: #1f2937; border-color: #374151; }
body.dark .category-card:hover { border-color: #60a5fa; box-shadow: 0 4px 12px rgba(59,130,246,0.25); }
body.dark .category-card .name { color: #f9fafb; }

body.dark .hot-tag:hover { border-color: #60a5fa; color: #60a5fa; background: #1e3a5f; }

body.dark .sidebar-link { color: #d1d5db; }
body.dark .sidebar-link:hover { background: #374151; color: #f9fafb; }
body.dark .sidebar-link.active { background: #1e3a5f; color: #60a5fa; }

body.dark .editor-tab { color: #9ca3af; }
body.dark .editor-tab:hover { color: #e5e7eb; }
body.dark .editor-tab.active { color: #60a5fa; border-bottom-color: #60a5fa; background: #1f2937; }

body.dark .code-block { background: #0d1117; }

body.dark #search-input { background: #1f2937; color: #f9fafb; border-color: #374151; }
body.dark #search-results { background: #1f2937; }
body.dark #search-results .search-result-item { border-color: #374151; }
body.dark #search-results .search-result-item:hover { background: #374151; }

body.dark #chat-window { background: #1f2937; }
body.dark #chat-window .bg-blue-600 { background: #1d4ed8 !important; }
body.dark #chat-input { background: #374151; color: #f9fafb; border-color: #4b5563; }

body.dark #theme-toggle:hover { background: #374151; }

body.dark footer { background: #0a0e14 !important; }

body.dark #docs-empty,
body.dark #docs-content { background: #1f2937; }
body.dark #docs-content .code-block { background: #0d1117; }

body.dark #pg-run { background: #3b82f6; }
body.dark #pg-run:hover { background: #2563eb; }
body.dark #pg-reset { background: #374151; color: #d1d5db; }
body.dark #pg-reset:hover { background: #4b5563; }

body.dark #chat-toggle { background: #3b82f6; }
body.dark #chat-toggle:hover { background: #2563eb; }

@media (max-width: 768px) {
  .category-card { padding: 14px; }
  .category-card .icon { font-size: 2rem; }
  .category-card .name { font-size: 0.9rem; }
  .category-card .count { font-size: 0.75rem; }
}