:root {
  --primary: #FF6B35;
  --primary-dark: #E55A2B;
  --primary-light: #FFA77D;
  --bg: #f8f9fa;
  --bg-card: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-hover: 0 8px 24px rgba(0,0,0,0.15);
  --radius: 8px;
  --spacing: 16px;
  --grid-cols: 5;
  --max-width: 90%;
  --header-height: 64px;
  --sidebar-width: 280px;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #334155;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-hover: 0 8px 24px rgba(0,0,0,0.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input { font: inherit; }

.page-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing);
}
.content-layout {
  display: flex;
  gap: calc(var(--spacing) * 2);
  margin-top: calc(var(--spacing) * 2);
}
.content-main {
  flex: 1;
  min-width: 0;
}
.content-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
}

.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
  height: var(--header-height);
}
.site-header .header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}
.site-logo {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 1px;
  white-space: nowrap;
}
.site-logo span {
  color: var(--text);
  font-weight: 400;
  font-size: 0.75rem;
  margin-left: 8px;
}
.header-nav {
  display: flex;
  gap: 24px;
}
.header-nav a {
  font-size: 0.95rem;
  color: var(--text-secondary);
  transition: color 0.2s;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.header-nav a:hover, .header-nav a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.header-search {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 16px;
  transition: border-color 0.3s;
}
.header-search:focus-within {
  border-color: var(--primary);
}
.header-search input {
  border: none;
  background: transparent;
  outline: none;
  width: 180px;
  font-size: 0.9rem;
  color: var(--text);
}
.header-search input::placeholder {
  color: var(--text-muted);
}
.header-search button {
  font-size: 1.1rem;
  padding: 2px;
}

.breadcrumb {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--spacing);
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.breadcrumb li::after {
  content: "/";
  margin: 0 6px;
  color: var(--text-muted);
}
.breadcrumb li:last-child::after { content: none; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb [aria-current="page"] {
  color: var(--primary);
  font-weight: 600;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: var(--spacing);
  padding-left: 12px;
  border-left: 4px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-title .more {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
}
.section-title .more:hover { color: var(--primary); }

.hero-banner {
  max-width: var(--max-width);
  margin: 0 auto;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  height: 360px;
  margin-bottom: calc(var(--spacing) * 2);
}
.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
  display: flex;
  align-items: flex-end;
  background-size: cover;
  background-position: center;
  background-color: var(--primary-dark);
}
.hero-slide.active { opacity: 1; }
.hero-info {
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  padding: 40px 24px 24px;
  width: 100%;
  color: #fff;
}
.hero-info h2 { font-size: 1.6rem; margin-bottom: 8px; }
.hero-info p { font-size: 0.9rem; opacity: 0.85; margin-bottom: 8px; }
.hero-info .hero-meta { font-size: 0.8rem; opacity: 0.7; }
.hero-dots {
  position: absolute;
  bottom: 16px;
  right: 24px;
  display: flex;
  gap: 8px;
  z-index: 10;
}
.hero-dots button {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  transition: background 0.3s;
}
.hero-dots button.active { background: #fff; }

.category-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: calc(var(--spacing) * 1.5);
  padding: var(--spacing) 0;
}
.category-tags .tag-btn {
  padding: 6px 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  transition: all 0.2s;
}
.category-tags .tag-btn:hover,
.category-tags .tag-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.comic-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), 1fr);
  gap: var(--spacing);
  margin-bottom: calc(var(--spacing) * 2);
}
.comic-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
}
.comic-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}
.comic-card .cover-wrap {
  position: relative;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: var(--border);
}
.comic-card .cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.comic-card:hover .cover-wrap img {
  transform: scale(1.05);
}
.comic-card .card-body {
  padding: 12px;
}
.comic-card .comic-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.comic-card .comic-title a {
  color: var(--text);
}
.comic-card .comic-title a:hover {
  color: var(--primary);
}
.comic-card .comic-author {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.comic-card .comic-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  align-items: center;
}
.comic-card .comic-rating { color: #f59e0b; font-weight: 600; }
.comic-card .comic-heat { color: var(--primary); }
.comic-card .badge-new {
  position: absolute;
  top: 8px; left: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  z-index: 5;
}
.comic-card .status-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
}
.status-ongoing {
  background: #fef3c7;
  color: #d97706;
}
.status-completed {
  background: #d1fae5;
  color: #059669;
}
[data-theme="dark"] .status-ongoing {
  background: #78350f;
  color: #fbbf24;
}
[data-theme="dark"] .status-completed {
  background: #064e3b;
  color: #34d399;
}

.rank-list { margin-bottom: calc(var(--spacing) * 2); }
.rank-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.rank-num {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-muted);
  min-width: 28px;
  text-align: center;
}
.rank-item:nth-child(-n+3) .rank-num { color: var(--primary); }
.rank-cover {
  width: 48px; height: 64px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}
.rank-info { min-width: 0; }
.rank-info .rank-title {
  font-size: 0.9rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.rank-info .rank-title:hover { color: var(--primary); }
.rank-info .rank-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: calc(var(--spacing) * 2) 0;
  flex-wrap: wrap;
}
.pagination button {
  min-width: 40px; height: 40px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all 0.2s;
}
.pagination button:hover { border-color: var(--primary); color: var(--primary); }
.pagination button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.news-list {
  margin-bottom: calc(var(--spacing) * 2);
}
.news-list article {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--spacing);
}
.news-list article:last-child { border-bottom: none; }
.news-list .news-title {
  font-size: 0.95rem;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.news-list .news-title:hover { color: var(--primary); }
.news-list .news-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: calc(var(--spacing) * 3);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.site-footer .footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing);
}
.site-footer p { margin-bottom: 6px; }
.site-footer .footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 12px;
}
.site-footer .footer-links a:hover { color: var(--primary); }

.theme-toggle {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
  transition: transform 0.3s, box-shadow 0.3s;
}
.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-hover);
}

.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 20px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}
.back-to-top:hover {
  transform: scale(1.1);
}

@media (max-width: 1200px) {
  :root { --grid-cols: 4; --sidebar-width: 250px; }
}
@media (max-width: 992px) {
  .content-layout { flex-direction: column; }
  .content-sidebar { width: 100%; }
  :root { --grid-cols: 3; }
}
@media (max-width: 768px) {
  :root { --grid-cols: 3; --max-width: 100%; --spacing: 12px; }
  .header-nav { display: none; }
  .header-search input { width: 120px; }
}
@media (max-width: 480px) {
  :root { --grid-cols: 2; --spacing: 8px; }
}
