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

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0b8;
    --accent: #7c3aed;
    --accent-glow: rgba(124, 58, 237, 0.4);
    --border: #2a2a4a;
    --shadow: 0 8px 32px rgba(0,0,0,0.3);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: #a78bfa;
    text-shadow: 0 0 8px var(--accent-glow);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

ul {
    list-style: none;
}

/* 头部导航 */
header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 30px rgba(0,0,0,0.5);
}

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

nav h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #7c3aed, #a78bfa, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
    text-shadow: 0 0 40px rgba(124, 58, 237, 0.3);
}

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

nav ul li a {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    transition: var(--transition);
    position: relative;
    font-size: 0.95rem;
}

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

nav ul li a:hover {
    color: var(--text-primary);
    background: rgba(124, 58, 237, 0.1);
}

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

/* 主内容 */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
}

@media (max-width: 1024px) {
    main {
        grid-template-columns: 1fr;
    }
}

/* 通用区块样式 */
section, aside {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 1.8rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: var(--transition);
    animation: fadeInUp 0.6s ease-out;
}

section:hover, aside:hover {
    border-color: var(--accent);
    box-shadow: 0 8px 40px rgba(124, 58, 237, 0.15);
}

h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #7c3aed, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
    position: relative;
}

h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), transparent);
    border-radius: 3px;
    margin-top: 8px;
}

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

/* 热门漫画 & 精品推荐 卡片网格 */
section article {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 1rem;
    border: 1px solid var(--border);
    transition: var(--transition);
    animation: fadeInUp 0.6s ease-out;
    animation-fill-mode: backwards;
}

section article:hover {
    transform: translateY(-6px);
    border-color: var(--accent);
    box-shadow: 0 12px 40px rgba(124, 58, 237, 0.2);
}

section article img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: 0.8rem;
    transition: var(--transition);
}

section article:hover img {
    transform: scale(1.03);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

section article p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

/* 热门漫画布局 */
section:first-of-type {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.2rem;
}

section:first-of-type > h2 {
    grid-column: 1 / -1;
    margin-bottom: 0.5rem;
}

/* 精品推荐布局 */
section:nth-of-type(2) {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.2rem;
}

section:nth-of-type(2) > h2 {
    grid-column: 1 / -1;
}

/* 详细介绍、角色介绍、平台介绍、APP下载、用户评论 */
section:nth-of-type(3),
section:nth-of-type(4),
section:nth-of-type(5),
section:nth-of-type(6),
section:nth-of-type(7) {
    display: block;
}

section:nth-of-type(3) article {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
}

section:nth-of-type(3) article:hover {
    border-color: var(--accent);
}

/* 角色介绍 */
section:nth-of-type(4) {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.2rem;
}

section:nth-of-type(4) > h2 {
    grid-column: 1 / -1;
}

section:nth-of-type(4) article {
    background: var(--bg-card);
    padding: 1.2rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    text-align: center;
    transition: var(--transition);
}

section:nth-of-type(4) article:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
}

section:nth-of-type(4) article img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1rem;
    border: 3px solid var(--accent);
    transition: var(--transition);
}

section:nth-of-type(4) article:hover img {
    transform: scale(1.05);
    box-shadow: 0 0 30px var(--accent-glow);
}

/* 平台介绍 */
section:nth-of-type(5) p {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 1rem;
}

/* APP下载按钮 */
section:nth-of-type(6) p {
    margin-bottom: 1.2rem;
    color: var(--text-secondary);
}

section:nth-of-type(6) button {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    color: #fff;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-right: 1rem;
    margin-bottom: 0.8rem;
    transition: var(--transition);
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.3);
    position: relative;
    overflow: hidden;
}

section:nth-of-type(6) button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
}

section:nth-of-type(6) button:hover::before {
    left: 100%;
}

section:nth-of-type(6) button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(124, 58, 237, 0.5);
}

section:nth-of-type(6) button:active {
    transform: scale(0.97);
}

/* 用户评论 */
section:nth-of-type(7) {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

section:nth-of-type(7) > h2 {
    grid-column: 1 / -1;
}

section:nth-of-type(7) article {
    background: var(--bg-card);
    padding: 1rem 1.2rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
}

section:nth-of-type(7) article::before {
    content: '"';
    font-size: 2rem;
    color: var(--accent);
    opacity: 0.3;
    position: absolute;
    top: 0.2rem;
    left: 0.6rem;
    font-family: serif;
}

section:nth-of-type(7) article:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
}

section:nth-of-type(7) article p:first-of-type {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

section:nth-of-type(7) article p:nth-of-type(2) {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

section:nth-of-type(7) article p:last-of-type {
    color: var(--text-secondary);
    font-style: italic;
}

/* 侧边栏 */
aside {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    position: sticky;
    top: 100px;
    height: fit-content;
}

aside h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

aside h2::after {
    width: 40px;
}

aside ul {
    margin-bottom: 1.5rem;
}

aside ul li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: var(--transition);
    cursor: default;
}

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

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

/* 页脚 */
footer {
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 100%);
    border-top: 1px solid var(--border);
    padding: 2.5rem 2rem 1.5rem;
    margin-top: 2rem;
}

footer > div {
    max-width: 1400px;
    margin: 0 auto;
}

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

footer h2::after {
    width: 30px;
}

footer ul {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    margin-bottom: 1.5rem;
}

footer ul li a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    border: 1px solid transparent;
    transition: var(--transition);
}

footer ul li a:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(124, 58, 237, 0.05);
}

footer p {
    color: #6b7280;
    font-size: 0.85rem;
    text-align: center;
    margin-top: 0.5rem;
}

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

section article:nth-child(2) { animation-delay: 0.1s; }
section article:nth-child(3) { animation-delay: 0.2s; }
section article:nth-child(4) { animation-delay: 0.3s; }
section article:nth-child(5) { animation-delay: 0.4s; }
section article:nth-child(6) { animation-delay: 0.5s; }
section article:nth-child(7) { animation-delay: 0.6s; }
section article:nth-child(8) { animation-delay: 0.7s; }
section article:nth-child(9) { animation-delay: 0.8s; }
section article:nth-child(10) { animation-delay: 0.9s; }
section article:nth-child(11) { animation-delay: 1.0s; }
section article:nth-child(12) { animation-delay: 1.1s; }
section article:nth-child(13) { animation-delay: 1.2s; }
section article:nth-child(14) { animation-delay: 1.3s; }
section article:nth-child(15) { animation-delay: 1.4s; }
section article:nth-child(16) { animation-delay: 1.5s; }
section article:nth-child(17) { animation-delay: 1.6s; }
section article:nth-child(18) { animation-delay: 1.7s; }

/* 响应式 */
@media (max-width: 768px) {
    header {
        padding: 0 1rem;
    }

    nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }

    nav h1 {
        font-size: 1.5rem;
    }

    nav ul {
        gap: 0.5rem;
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 0.3rem;
    }

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

    main {
        padding: 1rem 0.8rem;
        gap: 1.2rem;
    }

    section, aside {
        padding: 1rem;
        margin-bottom: 1.2rem;
    }

    section:first-of-type {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.8rem;
    }

    section:nth-of-type(2) {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 0.8rem;
    }

    section:nth-of-type(4) {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.8rem;
    }

    section:nth-of-type(7) {
        grid-template-columns: 1fr;
    }

    section article img {
        height: 200px;
    }

    section:nth-of-type(4) article img {
        width: 80px;
        height: 80px;
    }

    h2 {
        font-size: 1.3rem;
    }

    section:nth-of-type(6) button {
        width: 100%;
        margin-right: 0;
    }

    aside {
        position: static;
    }

    footer {
        padding: 1.5rem 1rem;
    }

    footer ul {
        gap: 0.8rem;
    }
}

@media (max-width: 480px) {
    section:first-of-type {
        grid-template-columns: repeat(2, 1fr);
    }

    section:nth-of-type(2) {
        grid-template-columns: repeat(2, 1fr);
    }

    section:nth-of-type(4) {
        grid-template-columns: repeat(2, 1fr);
    }

    section article img {
        height: 160px;
    }

    nav h1 {
        font-size: 1.3rem;
    }
}

/* 暗色模式原生支持 (已默认暗色) */
@media (prefers-color-scheme: light) {
    :root {
        --bg-primary: #f8f9fa;
        --bg-secondary: #ffffff;
        --bg-card: #f1f3f5;
        --text-primary: #1a1a2e;
        --text-secondary: #4a4a6a;
        --border: #dee2e6;
        --shadow: 0 8px 32px rgba(0,0,0,0.08);
        --accent: #6d28d9;
        --accent-glow: rgba(109, 40, 217, 0.2);
    }

    header {
        background: linear-gradient(135deg, #ffffff 0%, #f0f0ff 50%, #e8e0ff 100%);
        border-bottom: 1px solid var(--border);
    }

    nav h1 {
        background: linear-gradient(135deg, #6d28d9, #8b5cf6, #3b82f6);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    section, aside {
        background: var(--bg-secondary);
    }

    section article {
        background: var(--bg-card);
    }

    footer {
        background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    }

    footer p {
        color: #6b7280;
    }

    aside ul li {
        border-bottom: 1px solid rgba(0,0,0,0.05);
    }

    section:nth-of-type(6) button {
        background: linear-gradient(135deg, #6d28d9, #8b5cf6);
    }
}