/* ===== CSS Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6c5ce7;
    --primary-light: #a29bfe;
    --secondary: #fd79a8;
    --accent: #00cec9;
    --bg: #0f0f1a;
    --bg-card: rgba(255, 255, 255, 0.06);
    --bg-card-hover: rgba(255, 255, 255, 0.1);
    --text: #e0e0e0;
    --text-title: #ffffff;
    --text-muted: #a0a0b0;
    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --radius: 16px;
    --radius-sm: 10px;
    --blur: blur(16px);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --gradient-main: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 50%, #fd79a8 100%);
    --gradient-banner: linear-gradient(135deg, rgba(108, 92, 231, 0.9) 0%, rgba(0, 206, 201, 0.7) 100%);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    background-image:
        radial-gradient(ellipse at 10% 0%, rgba(108, 92, 231, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 90% 10%, rgba(253, 121, 168, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(0, 206, 201, 0.08) 0%, transparent 50%);
    background-attachment: fixed;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #1a1a2e;
}
::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 4px;
}

::selection {
    background: var(--primary);
    color: #fff;
}

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

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

a:hover {
    color: var(--secondary);
}

/* ===== Header & Nav ===== */
header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(15, 15, 26, 0.8);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0;
}

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

.logo h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
    white-space: nowrap;
    animation: fadeInDown 0.8s ease both;
}

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

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

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

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

nav ul li a:hover {
    color: var(--text-title);
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

/* ===== Main Layout ===== */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
}

main > section,
main > aside {
    animation: fadeInUp 0.8s ease both;
}

main > section {
    grid-column: 1;
    min-width: 0;
}

main > aside {
    grid-column: 2;
    grid-row: 1 / span 10;
}

/* ===== Section Headings ===== */
section h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-title);
    margin: 2rem 0 1.5rem;
    position: relative;
    padding-left: 1.2rem;
    letter-spacing: 0.5px;
}

section h2::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 70%;
    background: var(--gradient-main);
    border-radius: 4px;
}

section h2::after {
    content: "";
    display: block;
    width: 60px;
    height: 2px;
    background: var(--gradient-main);
    margin-top: 0.5rem;
    border-radius: 2px;
}

/* ===== Comic Grid (热门漫画) ===== */
.comic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.comic-grid article {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    transition: var(--transition);
    animation: fadeInUp 0.6s ease both;
    animation-delay: calc(var(--i, 0) * 0.05s);
    position: relative;
    overflow: hidden;
}

.comic-grid article::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-main);
    transform: scaleX(0);
    transform-origin: left;
    transition: var(--transition);
}

.comic-grid article:hover::before {
    transform: scaleX(1);
}

.comic-grid article:hover {
    transform: translateY(-8px);
    background: var(--bg-card-hover);
    border-color: rgba(108, 92, 231, 0.3);
    box-shadow: 0 12px 40px rgba(108, 92, 231, 0.2);
}

.comic-grid article img {
    width: 100%;
    aspect-ratio: 200/280;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: 0.8rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.comic-grid article h3 {
    font-size: 1.1rem;
    color: var(--text-title);
    margin-bottom: 0.4rem;
    font-weight: 600;
    transition: var(--transition);
}

.comic-grid article:hover h3 {
    color: var(--primary-light);
}

.comic-grid article p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
    line-height: 1.5;
}

.comic-grid article p:last-child {
    display: inline-block;
    background: rgba(108, 92, 231, 0.15);
    color: var(--primary-light);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.3rem;
    border: 1px solid rgba(108, 92, 231, 0.2);
}

/* ===== Recommend Grid (精品推荐) ===== */
.recommend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

.recommend-grid article {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.recommend-grid article::after {
    content: "";
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, rgba(253, 121, 168, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.recommend-grid article:hover {
    transform: translateY(-6px) scale(1.01);
    background: var(--bg-card-hover);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.recommend-grid article img {
    width: 100%;
    aspect-ratio: 200/280;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.recommend-grid article h3 {
    font-size: 1.2rem;
    color: var(--text-title);
    margin-bottom: 0.5rem;
}

.recommend-grid article p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 0.3rem;
}

.recommend-grid article p:first-of-type {
    color: var(--secondary);
    font-weight: 500;
}

.recommend-grid article p:nth-of-type(2) {
    font-size: 0.85rem;
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    padding: 0.8rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
    margin: 0.5rem 0;
}

/* ===== Intro Section ===== */
#intro article {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    position: relative;
    overflow: hidden;
}

#intro article::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-main);
}

#intro h3 {
    font-size: 1.5rem;
    color: var(--text-title);
    margin-bottom: 1rem;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#intro p {
    margin-bottom: 1rem;
    color: var(--text);
    line-height: 1.9;
    font-size: 0.95rem;
}

#intro p:last-child {
    display: inline-block;
    background: rgba(0, 206, 201, 0.1);
    color: var(--accent);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    border: 1px solid rgba(0, 206, 201, 0.2);
    margin-top: 0.5rem;
}

/* ===== Character Grid ===== */
.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5rem;
}

.character-grid article {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    text-align: center;
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.character-grid article::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(108, 92, 231, 0.1) 0%, transparent 60%);
    opacity: 0;
    transition: var(--transition);
}

.character-grid article:hover::before {
    opacity: 1;
}

.character-grid article:hover {
    transform: translateY(-5px);
    border-color: rgba(253, 121, 168, 0.3);
    box-shadow: 0 8px 24px rgba(253, 121, 168, 0.15);
}

.character-grid article img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
    margin: 0 auto 1rem;
    border: 3px solid var(--gradient-main);
    padding: 3px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    transition: var(--transition);
}

.character-grid article:hover img {
    transform: scale(1.05) rotate(3deg);
    box-shadow: 0 0 20px rgba(108, 92, 231, 0.4);
}

.character-grid article h3 {
    font-size: 1.1rem;
    color: var(--text-title);
    margin-bottom: 0.4rem;
}

.character-grid article p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.character-grid article p:first-of-type {
    color: var(--secondary);
    font-weight: 500;
}

/* ===== Platform Section ===== */
#platform {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    position: relative;
    overflow: hidden;
}

#platform::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-banner);
}

#platform p {
    margin-bottom: 1.2rem;
    line-height: 1.9;
    color: var(--text);
    font-size: 0.95rem;
}

#platform p:first-of-type {
    font-size: 1.05rem;
    color: var(--text-title);
    font-weight: 500;
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
}

/* ===== App Section ===== */
#app {
    background: var(--gradient-banner);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}

#app::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    animation: rotate 20s linear infinite;
}

#app h2 {
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

#app h2::before {
    background: #fff;
}

#app h2::after {
    background: #fff;
}

#app p {
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 1;
    font-size: 0.95rem;
    line-height: 1.8;
}

#app button {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.6);
    color: #fff;
    padding: 0.8rem 2rem;
    margin: 0.5rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    position: relative;
    z-index: 1;
    letter-spacing: 1px;
}

#app button:hover {
    background: #fff;
    color: var(--primary);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

#app button:active {
    transform: translateY(-1px) scale(1.02);
}

/* ===== Reviews Section ===== */
.review-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.review-list article {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.2rem;
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    transition: var(--transition);
    position: relative;
}

.review-list article::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--gradient-main);
    border-radius: 3px 0 0 3px;
    opacity: 0.6;
}

.review-list article:hover {
    background: var(--bg-card-hover);
    transform: translateX(5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.review-list article p {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
}

.review-list article p:first-child {
    font-weight: 600;
    color: var(--primary-light);
}

.review-list article p:nth-child(2) {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.review-list article p:last-child {
    color: var(--text);
    line-height: 1.6;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border);
}

/* ===== Aside (Sidebar) ===== */
aside {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    position: sticky;
    top: 80px;
    height: fit-content;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

aside h2 {
    font-size: 1.3rem;
    color: var(--text-title);
    margin: 1.5rem 0 1rem;
    padding-left: 0.8rem;
    position: relative;
}

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

aside h2::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 70%;
    background: var(--gradient-main);
    border-radius: 4px;
}

aside ul {
    list-style: none;
    margin-bottom: 1.5rem;
}

aside ul li {
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 0.9rem;
    color: var(--text);
    border-left: 2px solid transparent;
}

aside ul li:hover {
    background: rgba(108, 92, 231, 0.1);
    border-left-color: var(--primary);
    transform: translateX(4px);
    color: var(--text-title);
}

aside p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding: 0.3rem 0.8rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
}

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

footer p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

footer p:first-child {
    margin-bottom: 1rem;
}

footer a {
    color: var(--primary-light);
    margin: 0 0.5rem;
    font-weight: 500;
}

footer a:hover {
    color: var(--secondary);
    text-decoration: underline;
}

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

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ===== Scroll Reveal ===== */
section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
    main {
        grid-template-columns: 1fr;
        padding: 1.5rem;
    }

    main > aside {
        grid-column: 1;
        position: static;
        max-height: none;
        margin-top: 2rem;
    }

    nav {
        padding: 0 1.5rem;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    nav {
        flex-direction: column;
        align-items: center;
        padding: 1rem;
        gap: 0.8rem;
    }

    nav ul {
        justify-content: center;
        gap: 0.5rem;
        width: 100%;
    }

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

    main {
        padding: 1rem;
        gap: 1.5rem;
    }

    .comic-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
    }

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

    .character-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 1rem;
    }

    .review-list {
        grid-template-columns: 1fr;
    }

    section h2 {
        font-size: 1.5rem;
    }

    #app {
        padding: 2rem 1rem;
    }

    #app button {
        padding: 0.7rem 1.5rem;
        font-size: 0.9rem;
        display: block;
        width: 80%;
        margin: 0.5rem auto;
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    footer {
        padding: 1.5rem 1rem;
    }
}

@media (max-width: 480px) {
    .comic-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }

    .comic-grid article {
        padding: 0.8rem;
    }

    .comic-grid article p {
        font-size: 0.75rem;
    }

    .recommend-grid {
        grid-template-columns: 1fr;
    }

    nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }

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

/* ===== Dark Mode (Default) ===== */
@media (prefers-color-scheme: light) {
    :root {
        --bg: #0f0f1a;
        --bg-card: rgba(255, 255, 255, 0.06);
        --bg-card-hover: rgba(255, 255, 255, 0.1);
        --text: #e0e0e0;
        --text-title: #ffffff;
        --text-muted: #a0a0b0;
        --border: rgba(255, 255, 255, 0.08);
    }

    body {
        background-color: var(--bg);
    }
}

/* ===== Hover Effects & Enhancements ===== */
@media (hover: hover) {
    .comic-grid article:hover img {
        transform: scale(1.03);
        box-shadow: 0 8px 24px rgba(108, 92, 231, 0.4);
    }

    .recommend-grid article:hover img {
        transform: scale(1.02);
    }
}

/* ===== Accessibility ===== */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ===== Utility ===== */
.text-gradient {
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Loading Animation ===== */
.comic-grid article:nth-child(1) { --i: 1; }
.comic-grid article:nth-child(2) { --i: 2; }
.comic-grid article:nth-child(3) { --i: 3; }
.comic-grid article:nth-child(4) { --i: 4; }
.comic-grid article:nth-child(5) { --i: 5; }
.comic-grid article:nth-child(6) { --i: 6; }
.comic-grid article:nth-child(7) { --i: 7; }
.comic-grid article:nth-child(8) { --i: 8; }
.comic-grid article:nth-child(9) { --i: 9; }
.comic-grid article:nth-child(10) { --i: 10; }
.comic-grid article:nth-child(11) { --i: 11; }
.comic-grid article:nth-child(12) { --i: 12; }

/* ===== Print Styles ===== */
@media print {
    header, footer, aside, #app {
        display: none;
    }

    body {
        background: #fff;
        color: #000;
    }

    main {
        display: block;
    }

    section {
        opacity: 1;
        transform: none;
    }
}