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

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

body {
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: #0f0f1a;
    color: #e0e0e0;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* 暗色模式变量 */
:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: rgba(26, 26, 46, 0.85);
    --bg-glass: rgba(255, 255, 255, 0.05);
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0b0;
    --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent-color: #7c5cbf;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.5);
    --hover-scale: 1.03;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--accent-gradient);
    border-radius: 4px;
    transition: background 0.3s;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2, #667eea);
}

/* 通用动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* 滚动触发动画（使用Intersection Observer需配合JS，此处用CSS fallback） */
section {
    animation: fadeInUp 0.8s ease-out both;
}

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; }
section:nth-child(8) { animation-delay: 0.7s; }

/* ===== 头部导航 ===== */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(15, 15, 26, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    transition: background 0.3s ease;
}

header:hover {
    background: rgba(15, 15, 26, 0.95);
}

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

nav h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
    text-shadow: none;
    transition: transform 0.3s ease;
}

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

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

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

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

nav ul li a:hover {
    color: #fff;
    background: var(--bg-glass);
    transform: translateY(-2px);
}

nav ul li a:hover::before {
    width: 80%;
}

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

/* 通用section样式 */
section {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 24px;
    padding: 2rem;
    margin-bottom: 2.5rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

section:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}

/* 渐变Banner标题 */
h2 {
    font-size: 2rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
    position: relative;
    display: inline-block;
}

h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: var(--accent-gradient);
    border-radius: 4px;
    margin-top: 0.5rem;
    transition: width 0.4s ease;
}

section:hover h2::after {
    width: 100px;
}

h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.8rem;
}

/* ===== 热门漫画 & 精品推荐 卡片网格 ===== */
#hot, #recommend {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

#hot h2, #recommend h2 {
    grid-column: 1 / -1;
}

/* 漫画卡片 */
article {
    background: var(--bg-glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 20px;
    padding: 1.2rem;
    border: 1px solid var(--border-color);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

article::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(118, 75, 162, 0.1) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

article:hover::before {
    opacity: 1;
}

article:hover {
    transform: scale(var(--hover-scale)) translateY(-6px);
    box-shadow: 0 16px 48px rgba(118, 75, 162, 0.3);
    border-color: rgba(118, 75, 162, 0.4);
}

article img {
    width: 100%;
    height: auto;
    aspect-ratio: 200 / 280;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 0.8rem;
    transition: transform 0.4s ease, filter 0.4s ease;
    filter: brightness(0.9);
}

article:hover img {
    transform: scale(1.05);
    filter: brightness(1.05);
}

article h3 {
    font-size: 1.15rem;
    margin-bottom: 0.3rem;
    color: #fff;
    transition: color 0.3s ease;
}

article:hover h3 {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

article p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
    line-height: 1.4;
}

article p:last-of-type {
    margin-bottom: 0;
}

/* ===== 漫画详细介绍 ===== */
#detail article {
    background: transparent;
    border: none;
    padding: 0;
    backdrop-filter: none;
    cursor: default;
}

#detail article:hover {
    transform: none;
    box-shadow: none;
}

#detail h3 {
    margin-top: 1.5rem;
    font-size: 1.3rem;
    color: #c4b5fd;
    border-left: 4px solid #7c5cbf;
    padding-left: 1rem;
}

#detail p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 0.8rem;
    text-indent: 2em;
}

#detail .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* ===== 角色介绍 ===== */
#characters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

#characters h2 {
    grid-column: 1 / -1;
}

#characters article {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.5rem 1rem;
}

#characters article img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
    border: 3px solid transparent;
    background: var(--accent-gradient);
    padding: 3px;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

#characters article:hover img {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 0 30px rgba(118, 75, 162, 0.5);
}

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

#characters article p {
    font-size: 0.9rem;
}

/* ===== 平台介绍 ===== */
#platform article {
    background: transparent;
    border: none;
    padding: 0;
    cursor: default;
}

#platform article:hover {
    transform: none;
    box-shadow: none;
}

#platform p {
    text-indent: 2em;
    line-height: 1.9;
    color: var(--text-secondary);
}

/* ===== APP下载 ===== */
#app article {
    background: transparent;
    border: none;
    padding: 0;
    cursor: default;
}

#app article:hover {
    transform: none;
    box-shadow: none;
}

#app ul {
    list-style: none;
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

#app ul li a {
    display: inline-block;
    padding: 0.8rem 2rem;
    background: var(--accent-gradient);
    color: #fff;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.3);
}

#app ul li a:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 30px rgba(118, 75, 162, 0.5);
}

/* ===== 用户评论 ===== */
#reviews article {
    background: transparent;
    border: none;
    padding: 0;
    cursor: default;
}

#reviews article:hover {
    transform: none;
    box-shadow: none;
}

#reviews ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.8rem;
}

#reviews ul li {
    background: var(--bg-glass);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 16px;
    padding: 1rem 1.2rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

#reviews ul li:hover {
    background: rgba(118, 75, 162, 0.1);
    border-color: rgba(118, 75, 162, 0.3);
    transform: translateX(4px);
}

#reviews ul li p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ===== 侧边栏 ===== */
aside {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

aside section {
    padding: 1.5rem;
    margin-bottom: 0;
}

aside h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #c4b5fd;
}

aside ol, aside ul {
    list-style: none;
    padding-left: 0;
}

aside ol li, aside ul li {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.95rem;
    transition: color 0.3s ease, padding-left 0.3s ease;
}

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

aside ol li:last-child, aside ul li:last-child {
    border-bottom: none;
}

aside ol {
    counter-reset: rank;
}

aside ol li::before {
    counter-increment: rank;
    content: counter(rank) ". ";
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-right: 0.3rem;
}

/* ===== 页脚 ===== */
footer {
    background: var(--bg-secondary);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-color);
    padding: 2rem;
    text-align: center;
    margin-top: 3rem;
}

footer h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

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

footer ul li a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease, transform 0.3s ease;
    display: inline-block;
}

footer ul li a:hover {
    color: #c4b5fd;
    transform: translateY(-2px);
}

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

/* ===== 响应式设计 ===== */

/* 平板 */
@media (max-width: 1024px) {
    nav {
        padding: 0.6rem 1.5rem;
    }

    nav h1 {
        font-size: 1.5rem;
    }

    nav ul li a {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    main {
        padding: 5rem 1.5rem 1.5rem;
    }

    section {
        padding: 1.5rem;
    }

    h2 {
        font-size: 1.7rem;
    }

    #hot, #recommend {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 1rem;
    }

    #characters {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

/* 手机 */
@media (max-width: 768px) {
    nav {
        flex-direction: column;
        align-items: center;
        padding: 0.5rem 1rem;
        gap: 0.5rem;
    }

    nav ul {
        justify-content: center;
        gap: 0.3rem;
    }

    nav ul li a {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }

    main {
        padding: 5rem 1rem 1rem;
    }

    section {
        padding: 1rem;
        border-radius: 16px;
    }

    h2 {
        font-size: 1.4rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    #hot, #recommend {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.8rem;
    }

    article {
        padding: 0.8rem;
    }

    article img {
        border-radius: 8px;
    }

    #characters {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 0.8rem;
    }

    #characters article img {
        width: 80px;
        height: 80px;
    }

    #reviews ul {
        grid-template-columns: 1fr;
    }

    aside {
        grid-template-columns: 1fr;
    }

    footer ul {
        gap: 1rem;
    }

    #app ul {
        flex-direction: column;
        align-items: center;
    }

    #app ul li a {
        width: 100%;
        text-align: center;
    }
}

/* 小屏手机 */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    nav h1 {
        font-size: 1.3rem;
    }

    #hot, #recommend {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }

    #characters {
        grid-template-columns: repeat(2, 1fr);
    }

    #characters article {
        padding: 0.8rem;
    }

    #characters article img {
        width: 60px;
        height: 60px;
    }

    section {
        padding: 0.8rem;
    }
}

/* ===== 暗色模式强制（已为暗色，无需额外切换） ===== */
/* 为亮色模式预留，但本设计以暗色为主 */

/* ===== 毛玻璃特效增强 ===== */
.glass-effect {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== 性能优化：减少重排 ===== */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
}

/* 选中高亮 */
::selection {
    background: rgba(118, 75, 162, 0.4);
    color: #fff;
}

/* 打印样式 */
@media print {
    header {
        position: static;
        background: #fff;
    }
    body {
        background: #fff;
        color: #000;
    }
    section {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}