:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --brand: #0f766e;
  --brand-ink: #064e3b;
  --surface: #f8fafc;
  --border: #e5e7eb;
  --sidebar-bg: #7d0002;/*2c1810*/
  --sidebar-text: #ffffff;
  --sidebar-accent: #e25024;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Noto Sans SC', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: -300px;
  width: 300px;
  height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  z-index: 1000;
  transition: left 0.3s ease;
  overflow-y: auto;
  box-sizing: border-box;
}

.sidebar.open {
  left: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--sidebar-accent);
}

.sidebar-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  color: var(--sidebar-text);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
}

.sidebar-content {
  padding: 16px;
  width: 100%;
  box-sizing: border-box;
}

/* Categories Section */
.categories-section {
  margin-bottom: 16px;
}

/* Login Section */
.login-section {
  background: var(--sidebar-accent);
  padding: 12px;
  border-radius: 8px;
  border-top: 1px solid var(--sidebar-accent);
  padding-top: 16px;
}

.login-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.login-row:last-child {
  margin-bottom: 0;
}

.login-row label {
  min-width: 40px;
  font-size: 14px;
}

.login-row input {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 12px;
  min-width: 0;
  box-sizing: border-box;
}

.btn-register, .btn-login {
  padding: 4px 8px;
  border: 1px solid var(--sidebar-text);
  background: transparent;
  color: var(--sidebar-text);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  flex-shrink: 0;
  white-space: nowrap;
}

.btn-register:hover, .btn-login:hover {
  background: var(--sidebar-text);
  color: var(--sidebar-bg);
}

.category-item {
  margin-bottom: 8px;
}

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  cursor: pointer;
  border-bottom: 1px solid var(--sidebar-accent);
}

.category-header:hover {
  background: rgba(255, 255, 255, 0.1);
}

.expand-icon {
  transition: transform 0.3s ease;
}

.category-item.expanded .expand-icon {
  transform: rotate(180deg);
}

.subcategory-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  width: 100%;
  box-sizing: border-box;
}

.category-item.expanded .subcategory-list {
  max-height: 200px;
}

.subcategory-list li {
  padding: 4px 0 4px 16px;
}

.subcategory-list a {
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
}

.subcategory-list a:hover {
  color: #ffd700;
}

/* Main Content */
.main-content {
  transition: margin-left 0.3s ease;
}

.sidebar.open + .main-content {
  margin-left: 300px;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-center {
  text-align: center;
  flex: 1;
}

.site-title {
  margin: 0;
  font-family: 'Noto Serif SC', serif;
  font-size: 28px;
  font-weight: 700;
}

.title-red {
  color: #8b0000;
}

.title-black {
  color: var(--text);
}

.site-subtitle {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.menu-btn, .search-btn, .bookmark-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
}

.menu-btn:hover, .search-btn:hover, .bookmark-btn:hover {
  background: var(--surface);
}

/* Search functionality */
.search-container {
  position: relative;
  display: inline-block;
}

.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 1000;
  max-height: 400px;
  overflow-y: auto;
  min-width: 300px;
}

.search-dropdown input {
  width: 100%;
  padding: 12px;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  font-size: 14px;
  outline: none;
}

.search-results {
  padding: 8px 0;
}

.search-result-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s;
}

.search-result-item:hover {
  background-color: var(--surface);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-title {
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}

.search-result-category {
  font-size: 12px;
  color: var(--muted);
}

.search-history {
  border-top: 1px solid var(--border);
  padding: 8px 0;
}

.search-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--muted);
  background-color: var(--surface);
}

.clear-history-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
}

.clear-history-btn:hover {
  background-color: var(--border);
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.history-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-item:hover {
  background-color: var(--surface);
}

.history-item:last-child {
  border-bottom: none;
}

.history-text {
  color: var(--text);
  font-size: 14px;
}

.history-time {
  color: var(--muted);
  font-size: 12px;
}

.no-results {
  padding: 12px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* Bookmark functionality */
.bookmark-container {
  position: relative;
  display: inline-block;
}

.bookmark-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 1000;
  max-height: 400px;
  overflow-y: auto;
  min-width: 300px;
}

.bookmark-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--muted);
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
}

.bookmark-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bookmark-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bookmark-item:hover {
  background-color: var(--surface);
}

.bookmark-item:last-child {
  border-bottom: none;
}

.bookmark-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.bookmark-time {
  color: var(--muted);
  font-size: 12px;
}

/* Category Tabs */
.category-tabs {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.tab-link {
  padding: 8px 16px;
  text-decoration: none;
  color: var(--text);
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.tab-link:hover {
  background: var(--surface);
}

/* Main Content */
main.container { padding: 20px 16px 48px; }

/* Showcase: left text, centered image, right toggleable lists */
.showcase { margin-top: 16px; }
.showcase-grid { display: grid; grid-template-columns: 1.2fr 1.4fr 1fr; gap: 16px; align-items: stretch; }
.showcase-left h2 { margin: 0 0 12px; font-family: 'Noto Serif SC', serif; font-size: 24px; }
.showcase-left p { margin: 6px 0; color: var(--muted); }
.showcase-left, .showcase-center, .showcase-right { height: 100%; }
.showcase-left { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; }
.showcase-center { display: flex; align-items: center; justify-content: center; }
.hero-img { width: 100%; height: 100%; max-height: 100%; object-fit: contain; border-radius: 16px; border: 1px solid var(--border); box-shadow: 0 4px 24px rgba(0,0,0,0.06); }
.showcase-right { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; }
.list-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.list-btn { padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: #f8fafc; box-shadow: 0 2px 10px rgba(0,0,0,0.06); cursor: pointer; }
.list-btn.is-active { background: #fff; color: var(--brand-ink); }
.book-list { list-style: none; margin: 0; padding: 0; display: none; flex: 1 1 auto; overflow: auto; }
.book-list.is-active { display: block; }
.book-list li { padding: 8px 6px; border-bottom: 1px solid var(--border); }
.book-list li:last-child { border-bottom: none; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: 280px;
    left: -280px;
  }
  
  .sidebar.open + .main-content {
    margin-left: 280px;
  }
  
  .site-header {
    padding: 12px 16px;
  }
  
  .site-title {
    font-size: 24px;
  }
  
  .category-tabs {
    gap: 12px;
    padding: 12px 0;
  }
  
  .tab-link {
    padding: 6px 12px;
    font-size: 14px;
  }
  
  .showcase-grid { grid-template-columns: 1fr; }
  .showcase-right { padding: 8px; }
}

@media (max-width: 480px) {
  .site-title {
    font-size: 20px;
  }
  
  .category-tabs {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .tab-link {
    padding: 4px 8px;
    font-size: 12px;
  }
}







