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

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

body {
    font-family: 'Segoe UI', 'PingFang SC', Roboto, 'Helvetica Neue', sans-serif;
    background: #0f0f1a;
    color: #e0e0e0;
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #1a1a2e;
}
::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    border-radius: 10px;
}

/* 暗色模式支持（默认即暗色，但保留切换变量） */
:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0b0;
    --accent: #ff6b6b;
    --accent2: #feca57;
    --gradient-banner: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* 头部导航 */
header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(15, 15, 26, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    transition: background 0.3s;
}

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

nav h1 a {
    font-size: 1.8rem;
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    font-weight: 800;
    letter-spacing: 1px;
    transition: transform 0.3s;
    display: inline-block;
}

nav h1 a:hover {
    transform: scale(1.05);
}

nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    flex-wrap: wrap;
}

nav ul li a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: 30px;
    transition: all 0.3s ease;
    position: relative;
}

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

nav ul li a:hover {
    color: #fff;
    background: rgba(255, 107, 107, 0.15);
}

nav ul li a:hover::after {
    width: 60%;
}

/* 主内容区 */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* 通用section样式 */
section {
    margin-bottom: 4rem;
    scroll-margin-top: 80px;
}

section h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
    position: relative;
    padding-bottom: 0.5rem;
}

section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), transparent);
    border-radius: 10px;
}

/* 渐变Banner效果（用于热门漫画等区域） */
#hot, #recommend, #detail, #characters, #platform, #app, #reviews {
    background: var(--gradient-banner);
    padding: 2rem 2rem;
    border-radius: 24px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

#hot::before, #recommend::before, #detail::before, #characters::before, #platform::before, #app::before, #reviews::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(255,107,107,0.05), transparent 60%);
    pointer-events: none;
}

/* 圆角卡片 - 文章卡片通用 */
article {
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.4s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}

article:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(255,107,107,0.2);
    border-color: rgba(255,107,107,0.3);
}

article img {
    border-radius: 16px;
    width: 100%;
    height: auto;
    object-fit: cover;
    transition: transform 0.5s ease, box-shadow 0.3s;
}

article:hover img {
    transform: scale(1.02);
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}

article h3 {
    font-size: 1.4rem;
    margin: 0.8rem 0 0.4rem;
    color: #fff;
    font-weight: 600;
}

article p {
    color: var(--text-secondary);
    margin: 0.3rem 0;
    font-size: 0.95rem;
}

/* 热门漫画网格布局 */
#hot {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
}

#hot h2 {
    width: 100%;
    text-align: center;
}

#hot article {
    flex: 1 1 180px;
    max-width: 220px;
    min-width: 160px;
    text-align: center;
}

#hot article img {
    width: 100%;
    height: 260px;
    object-fit: cover;
}

/* 精品推荐网格 */
#recommend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
}

#recommend h2 {
    width: 100%;
    text-align: center;
}

#recommend article {
    flex: 1 1 200px;
    max-width: 240px;
    min-width: 170px;
    text-align: center;
}

#recommend article img {
    height: 280px;
    object-fit: cover;
}

/* 漫画详细介绍区域 */
#detail article {
    max-width: 900px;
    margin: 0 auto;
}

#detail h3 {
    color: var(--accent);
    margin-top: 1.5rem;
    border-left: 4px solid var(--accent);
    padding-left: 0.8rem;
}

#detail p {
    margin: 0.6rem 0;
}

/* 角色介绍网格 */
#characters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
}

#characters h2 {
    width: 100%;
    text-align: center;
}

#characters article {
    flex: 1 1 160px;
    max-width: 200px;
    min-width: 140px;
    text-align: center;
    padding: 1.2rem 1rem;
}

#characters article img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
    margin-bottom: 0.8rem;
}

#characters article h3 {
    font-size: 1.1rem;
}

/* 平台介绍 */
#platform article {
    max-width: 900px;
    margin: 0 auto;
}

#platform h3 {
    color: var(--accent2);
    margin-top: 1.5rem;
    border-bottom: 2px solid rgba(254,202,87,0.3);
    padding-bottom: 0.3rem;
}

/* APP下载 */
#app article {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

#app a {
    display: inline-block;
    margin: 0.8rem 0.5rem;
    padding: 0.8rem 2rem;
    background: linear-gradient(135deg, var(--accent), #e55d5d);
    color: #fff;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255,107,107,0.4);
}

#app a:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(255,107,107,0.6);
}

/* 用户评论 */
#reviews {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

#reviews h2 {
    width: 100%;
    text-align: center;
}

#reviews article {
    flex: 1 1 280px;
    max-width: 350px;
    min-width: 250px;
    padding: 1rem 1.2rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
}

#reviews article p:first-child {
    font-weight: 600;
    color: var(--accent2);
}

/* 侧边栏（排行榜） */
aside {
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    margin-top: 3rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 2rem;
}

aside h2 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: var(--accent);
    border-left: 4px solid var(--accent);
    padding-left: 0.8rem;
}

aside ul {
    list-style: none;
    width: 100%;
    max-width: 300px;
}

aside ul li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: var(--text-secondary);
    transition: color 0.3s, padding-left 0.3s;
}

aside ul li:hover {
    color: #fff;
    padding-left: 8px;
}

/* 页脚 */
footer {
    background: rgba(15,15,26,0.9);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--glass-border);
    padding: 2rem 1.5rem;
    text-align: center;
    margin-top: 3rem;
}

footer h2 {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

footer ul {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

footer ul li a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s;
}

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

footer p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0.3rem 0;
}

/* 滚动动画（基础，配合Intersection Observer需JS，但这里提供纯CSS淡入效果） */
article, section > h2, aside ul {
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 为不同卡片设置延迟，形成交错效果 */
#hot article:nth-child(2) { animation-delay: 0.1s; }
#hot article:nth-child(3) { animation-delay: 0.2s; }
#hot article:nth-child(4) { animation-delay: 0.3s; }
#hot article:nth-child(5) { animation-delay: 0.4s; }
#hot article:nth-child(6) { animation-delay: 0.5s; }
#hot article:nth-child(7) { animation-delay: 0.6s; }
#hot article:nth-child(8) { animation-delay: 0.7s; }
#hot article:nth-child(9) { animation-delay: 0.8s; }
#hot article:nth-child(10) { animation-delay: 0.9s; }
#hot article:nth-child(11) { animation-delay: 1.0s; }
#hot article:nth-child(12) { animation-delay: 1.1s; }
#hot article:nth-child(13) { animation-delay: 1.2s; }
#hot article:nth-child(14) { animation-delay: 1.3s; }
#hot article:nth-child(15) { animation-delay: 1.4s; }
#hot article:nth-child(16) { animation-delay: 1.5s; }

#recommend article:nth-child(2) { animation-delay: 0.1s; }
#recommend article:nth-child(3) { animation-delay: 0.2s; }
#recommend article:nth-child(4) { animation-delay: 0.3s; }
#recommend article:nth-child(5) { animation-delay: 0.4s; }
#recommend article:nth-child(6) { animation-delay: 0.5s; }
#recommend article:nth-child(7) { animation-delay: 0.6s; }
#recommend article:nth-child(8) { animation-delay: 0.7s; }

/* 响应式布局 */
@media (max-width: 1024px) {
    nav {
        padding: 0.6rem 1.2rem;
    }
    nav h1 a {
        font-size: 1.5rem;
    }
    nav ul {
        gap: 0.8rem;
    }
    nav ul li a {
        font-size: 0.9rem;
        padding: 0.3rem 0.6rem;
    }
    main {
        padding: 1.5rem 1rem;
    }
    section h2 {
        font-size: 1.6rem;
    }
}

@media (max-width: 768px) {
    nav {
        flex-direction: column;
        align-items: center;
        padding: 0.6rem 1rem;
    }
    nav h1 {
        margin-bottom: 0.5rem;
    }
    nav ul {
        justify-content: center;
        gap: 0.5rem;
    }
    nav ul li a {
        font-size: 0.8rem;
        padding: 0.2rem 0.5rem;
    }
    #hot article, #recommend article {
        flex: 1 1 140px;
        max-width: 180px;
        min-width: 120px;
    }
    #hot article img {
        height: 200px;
    }
    #recommend article img {
        height: 220px;
    }
    #characters article {
        flex: 1 1 120px;
        max-width: 160px;
        min-width: 100px;
    }
    #characters article img {
        width: 80px;
        height: 80px;
    }
    aside {
        flex-direction: column;
        align-items: center;
    }
    aside ul {
        max-width: 100%;
    }
    #reviews article {
        flex: 1 1 100%;
        max-width: 100%;
    }
    footer ul {
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    nav h1 a {
        font-size: 1.3rem;
    }
    section {
        margin-bottom: 2.5rem;
    }
    section h2 {
        font-size: 1.4rem;
    }
    #hot article, #recommend article {
        flex: 1 1 120px;
        max-width: 160px;
        min-width: 100px;
    }
    #hot article img {
        height: 170px;
    }
    #recommend article img {
        height: 190px;
    }
    #characters article {
        flex: 1 1 100px;
        max-width: 140px;
    }
    #characters article img {
        width: 70px;
        height: 70px;
    }
    #app a {
        display: block;
        margin: 0.5rem auto;
        max-width: 200px;
    }
    footer ul {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* 毛玻璃效果增强（已应用于卡片和导航） */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
}

/* 额外hover动画 - 链接下划线 */
a {
    transition: color 0.3s;
}

/* 图片懒加载占位效果 */
img[loading="lazy"] {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
}

/* 暗色模式微调（默认已暗，但保留变量） */
@media (prefers-color-scheme: light) {
    /* 若用户系统为浅色，强制暗色（因为网站设计为暗色主题） */
    body {
        background: #0f0f1a;
        color: #e0e0e0;
    }
    /* 可选择性覆盖 */
}

/* 自定义动画：卡片发光边框 */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255,107,107,0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(255,107,107,0.6);
    }
}

article:focus-within {
    animation: glow 2s infinite;
}