/* ===== 全局重置与基础 ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: rgba(26, 26, 46, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.06);
  --text-primary: #e8e8f0;
  --text-secondary: #a8a8c0;
  --accent-1: #6c63ff;
  --accent-2: #ff6584;
  --accent-3: #00d2ff;
  --gradient-banner: linear-gradient(135deg, #6c63ff 0%, #ff6584 50%, #00d2ff 100%);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* 暗色模式默认已启用，无亮色切换 */

/* ===== 滚动条 ===== */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: var(--accent-1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-2);
}

/* ===== 头部 ===== */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0 24px;
}

nav {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

nav h1 {
  font-size: 1.6rem;
  font-weight: 800;
  background: var(--gradient-banner);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 1px;
  white-space: nowrap;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

nav ul li a {
  display: inline-block;
  padding: 8px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  position: relative;
}

nav ul li a::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 60%;
  height: 2px;
  background: var(--accent-1);
  border-radius: 2px;
  transition: transform 0.3s ease;
}

nav ul li a:hover {
  color: var(--text-primary);
  background: rgba(108, 99, 255, 0.15);
}

nav ul li a:hover::after {
  transform: translateX(-50%) scaleX(1);
}

/* ===== 主内容 ===== */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 24px 60px;
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
}

main > section {
  flex: 1 1 100%;
}

/* ===== 通用section标题 ===== */
section h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 24px;
  position: relative;
  display: inline-block;
}

section h2::after {
  content: '';
  display: block;
  width: 60%;
  height: 4px;
  background: var(--gradient-banner);
  border-radius: 4px;
  margin-top: 8px;
}

/* ===== 热门漫画 - 网格 ===== */
#hot {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

#hot h2 {
  width: 100%;
}

#hot article {
  flex: 1 1 calc(25% - 24px);
  min-width: 180px;
  max-width: 220px;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

#hot article:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 12px 40px rgba(108, 99, 255, 0.3);
}

#hot article img {
  width: 100%;
  height: auto;
  aspect-ratio: 200/280;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

#hot article:hover img {
  transform: scale(1.05);
}

#hot article h3 {
  font-size: 1.1rem;
  font-weight: 700;
  padding: 12px 12px 4px;
  color: var(--text-primary);
}

#hot article p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 0 12px 4px;
  line-height: 1.4;
}

#hot article p:last-of-type {
  padding-bottom: 12px;
}

/* ===== 精品推荐 ===== */
#recommend {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

#recommend h2 {
  width: 100%;
}

#recommend article {
  flex: 1 1 calc(33.33% - 24px);
  min-width: 240px;
  max-width: 360px;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
}

#recommend article:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(255, 101, 132, 0.25);
}

#recommend article img {
  width: 100%;
  height: auto;
  aspect-ratio: 300/420;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

#recommend article:hover img {
  transform: scale(1.03);
}

#recommend article h3 {
  font-size: 1.2rem;
  font-weight: 700;
  padding: 16px 16px 4px;
}

#recommend article p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 0 16px 4px;
  line-height: 1.5;
}

#recommend article p:last-of-type {
  padding-bottom: 16px;
}

/* ===== 漫画详细介绍 ===== */
#detail article {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

#detail h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 8px;
  color: var(--accent-3);
}

#detail h3:first-of-type {
  margin-top: 0;
}

#detail p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 12px;
}

/* ===== 角色介绍 ===== */
#characters {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

#characters h2 {
  width: 100%;
}

#characters article {
  flex: 1 1 calc(25% - 24px);
  min-width: 180px;
  max-width: 240px;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

#characters article:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 12px 40px rgba(0, 210, 255, 0.2);
}

#characters article img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 12px;
  display: block;
  border: 3px solid var(--accent-1);
  transition: transform 0.4s ease, border-color 0.4s ease;
}

#characters article:hover img {
  transform: scale(1.1);
  border-color: var(--accent-2);
}

#characters article h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

#characters article p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ===== 平台介绍 ===== */
#platform article {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

#platform h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 8px;
  color: var(--accent-2);
}

#platform h3:first-of-type {
  margin-top: 0;
}

#platform p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 12px;
}

/* ===== APP下载 ===== */
#app article {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

#app h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 12px;
}

#app p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 24px;
  line-height: 1.7;
}

#app button {
  display: inline-block;
  margin: 0 8px 8px;
  padding: 14px 32px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--gradient-banner);
  color: #fff;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(108, 99, 255, 0.3);
  letter-spacing: 1px;
}

#app button:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 30px rgba(108, 99, 255, 0.5);
}

#app button:active {
  transform: scale(0.97);
}

/* ===== 用户评论 ===== */
#reviews {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

#reviews h2 {
  width: 100%;
}

#reviews article {
  flex: 1 1 calc(33.33% - 16px);
  min-width: 220px;
  background: var(--bg-glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: var(--transition);
}

#reviews article:hover {
  background: rgba(108, 99, 255, 0.08);
  transform: translateY(-2px);
}

#reviews article p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

#reviews article p strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ===== 侧边栏 ===== */
aside {
  flex: 1 1 280px;
  max-width: 320px;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  align-self: flex-start;
  position: sticky;
  top: 100px;
}

aside h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 16px;
  margin-top: 24px;
  color: var(--accent-1);
}

aside h2:first-child {
  margin-top: 0;
}

aside h2::after {
  display: none;
}

aside ol {
  list-style: decimal;
  padding-left: 24px;
  margin-bottom: 16px;
}

aside ol li {
  font-size: 0.9rem;
  color: var(--text-secondary);
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: var(--transition);
}

aside ol li:hover {
  color: var(--text-primary);
  padding-left: 4px;
}

aside p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* ===== 底部 ===== */
footer {
  background: var(--bg-secondary);
  padding: 40px 24px 24px;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 40px;
}

footer h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--accent-3);
}

footer ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 24px;
  margin-bottom: 24px;
}

footer ul li a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: var(--transition);
  position: relative;
}

footer ul li a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent-1);
  transition: width 0.3s ease;
}

footer ul li a:hover {
  color: var(--text-primary);
}

footer ul li a:hover::after {
  width: 100%;
}

footer p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
  #hot article {
    flex: 1 1 calc(33.33% - 24px);
  }
  #recommend article {
    flex: 1 1 calc(50% - 24px);
  }
  #characters article {
    flex: 1 1 calc(33.33% - 24px);
  }
  aside {
    flex: 1 1 100%;
    max-width: 100%;
    position: static;
    margin-top: 24px;
  }
  main {
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  header {
    padding: 0 12px;
  }
  nav {
    flex-direction: column;
    gap: 8px;
    padding: 12px 0;
  }
  nav ul {
    justify-content: center;
    gap: 4px;
  }
  nav ul li a {
    padding: 6px 10px;
    font-size: 0.8rem;
  }
  nav h1 {
    font-size: 1.3rem;
  }
  main {
    padding: 16px 12px 40px;
    gap: 24px;
  }
  section h2 {
    font-size: 1.5rem;
  }
  #hot article {
    flex: 1 1 calc(50% - 16px);
    min-width: 140px;
    max-width: 100%;
  }
  #hot article h3 {
    font-size: 0.95rem;
  }
  #hot article p {
    font-size: 0.75rem;
  }
  #recommend article {
    flex: 1 1 100%;
    max-width: 100%;
  }
  #recommend article img {
    aspect-ratio: 16/9;
  }
  #characters article {
    flex: 1 1 calc(50% - 16px);
    min-width: 140px;
    max-width: 100%;
  }
  #characters article img {
    width: 100px;
    height: 100px;
  }
  #detail article,
  #platform article,
  #app article {
    padding: 20px;
  }
  #reviews article {
    flex: 1 1 100%;
  }
  #app button {
    width: 100%;
    margin: 6px 0;
  }
  footer ul {
    gap: 8px 16px;
  }
}

@media (max-width: 480px) {
  nav h1 {
    font-size: 1.1rem;
  }
  nav ul li a {
    font-size: 0.75rem;
    padding: 4px 8px;
  }
  #hot article {
    flex: 1 1 calc(50% - 8px);
    min-width: 120px;
  }
  #characters article {
    flex: 1 1 calc(50% - 8px);
    min-width: 120px;
  }
  #characters article img {
    width: 80px;
    height: 80px;
  }
  #detail h3,
  #platform h3 {
    font-size: 1.1rem;
  }
  #app h3 {
    font-size: 1.2rem;
  }
}

/* ===== 滚动动画 ===== */
@media (prefers-reduced-motion: no-preference) {
  section {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
  }
  section:nth-child(2) { animation-delay: 0.1s; }
  section:nth-child(3) { animation-delay: 0.2s; }
  section:nth-child(4) { animation-delay: 0.3s; }
  section:nth-child(5) { animation-delay: 0.4s; }
  section:nth-child(6) { animation-delay: 0.5s; }
  section:nth-child(7) { animation-delay: 0.6s; }
  aside {
    opacity: 0;
    transform: translateX(20px);
    animation: fadeInRight 0.6s ease 0.7s forwards;
  }
}

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

@keyframes fadeInRight {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===== 毛玻璃装饰 ===== */
#hot::before,
#recommend::before {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(108, 99, 255, 0.15), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  filter: blur(60px);
}

#hot::before {
  top: -80px;
  left: -80px;
}

#recommend::before {
  bottom: -80px;
  right: -80px;
}

/* 为section添加相对定位以支持伪元素 */
section {
  position: relative;
}

/* ===== 渐变Banner效果用于h1和重要标题 ===== */
.gradient-text {
  background: var(--gradient-banner);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== 图片懒加载淡入 ===== */
img {
  opacity: 0;
  transition: opacity 0.5s ease;
}
img[src] {
  opacity: 1;
}

/* ===== 确保所有卡片都有hover动画 ===== */
article {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}