:root {
    --text-base: 15px;
    --line-height: 1.65;

    /* Elegant color palette */
    --bg-primary: #0a0e1a;
    --bg-secondary: #0f1419;
    --bg-card: #1a1f2e;
    --text-color: #e4e7eb;
    --text-muted: #8892a6;
    --accent-primary: #BA365C;
    --accent-secondary: #F2B15A;
    --accent-pink: #ff006e;
    --grid-color: rgba(186, 54, 92, 0.15);
    --glow-color: rgba(242, 177, 90, 0.35);

    --header-bg: linear-gradient(135deg, #0a0e1a 0%, #1a1f2e 100%);
    --button-gradient: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
}

@media (prefers-color-scheme: light) {
    :root {
        --bg-primary: #ffffff;
        --bg-secondary: #f8f9fb;
        --bg-card: #ffffff;
        --text-color: #1a1f2e;
        --text-muted: #5a6479;
        --accent-primary: #BA365C;
        --accent-secondary: #F2B15A;
        --accent-pink: #cc0055;
        --grid-color: rgba(186, 54, 92, 0.1);
        --glow-color: rgba(242, 177, 90, 0.25);
        --header-bg: linear-gradient(135deg, #f8f9fb 0%, #e8eaed 100%);
    }
}

* {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue",
                 "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC",
                 "Microsoft YaHei", sans-serif;
    font-size: var(--text-base);
    line-height: var(--line-height);
    background: var(--bg-primary);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    position: relative;
}

/* Animated grid background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
}

/* Scanline effect */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        transparent 50%,
        rgba(186, 54, 92, 0.02) 50%
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 1;
    animation: scanline 8s linear infinite;
}

@keyframes scanline {
    0% { transform: translateY(0); }
    100% { transform: translateY(100vh); }
}

header {
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    padding: 0;
    text-align: center;
    position: relative;
    border-bottom: 1px solid var(--grid-color);
    z-index: 100;
}

header::before {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        var(--accent-primary) 50%,
        transparent
    );
    animation: pulse 3s ease-in-out infinite;
}

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

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    gap: 1rem;
    position: relative;
    z-index: 1100;
}

.nav-brand a {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
}

.nav-link:hover {
    color: var(--accent-primary);
}

.nav-link.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.header-content {
    padding: 3rem 2rem;
}

.header-content h1 {
    font-size: 2.5rem;
    margin-bottom: 0.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: glowPulse 2s ease-in-out infinite alternate;
}

@keyframes glowPulse {
    0% { filter: drop-shadow(0 0 5px var(--accent-primary)); }
    100% { filter: drop-shadow(0 0 20px var(--accent-secondary)); }
}

.header-content p {
    margin: 0.5rem 0 0;
    font-size: 1rem;
    color: var(--text-muted);
    letter-spacing: 0.03em;
    font-weight: 400;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: 10;
}

.section {
    background: var(--bg-card);
    padding: 3rem;
    margin: 3rem 0;
    border-radius: 8px;
    border: 1px solid var(--grid-color);
    position: relative;
}

.section::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, var(--glow-color) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0.5;
}

.section h2 {
    color: var(--accent-primary);
    font-size: 2rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.section h3 {
    color: var(--text-color);
    font-size: 1.3rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.section p {
    margin: 1rem 0;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-muted);
}

.section ul {
    margin: 1rem 0 1.5rem 0;
    padding: 0;
    list-style: none;
}

.section ul li {
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-muted);
    padding-left: 1.8rem;
    position: relative;
}

.section ul li::before {
    content: '▹';
    position: absolute;
    left: 0;
    color: var(--accent-secondary);
    font-size: 1.2rem;
}

footer {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 6rem 0 3rem;
    padding: 3rem 2rem;
    border-top: 1px solid var(--grid-color);
    position: relative;
    z-index: 10;
}

footer::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        var(--accent-primary) 50%,
        transparent
    );
    animation: pulse 3s ease-in-out infinite;
}

.lang-switch-container {
    position: relative;
    z-index: 1100;
}

.lang-switch {
    background: rgba(186, 54, 92, 0.1);
    color: var(--text-color);
    border: 1px solid var(--accent-primary);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    letter-spacing: 0.02em;
}

.lang-switch:hover {
    background: rgba(186, 54, 92, 0.15);
    box-shadow: 0 0 15px rgba(186, 54, 92, 0.3);
}

.lang-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    background: var(--bg-card);
    border: 1px solid var(--grid-color);
    border-radius: 4px;
    min-width: 150px;
    overflow: hidden;
    z-index: 1200;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.lang-option {
    display: block;
    width: 100%;
    padding: 0.7rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    text-align: left;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.lang-option:hover {
    background: rgba(186, 54, 92, 0.1);
    color: var(--accent-primary);
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

/* Hamburger Menu Button */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    position: relative;
    z-index: 1100;
    transition: transform 0.3s ease;
}

.menu-toggle span {
    width: 100%;
    height: 3px;
    background: var(--accent-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(11px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-20px);
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-11px) rotate(-45deg);
}

/* Mobile Overlay */
.nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-overlay.active {
    display: block;
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    header {
        z-index: 1100;
    }

    .menu-toggle {
        display: flex;
        order: -1;
        z-index: 1100;
    }

    .navbar {
        flex-direction: row;
        align-items: center;
        padding: 1rem;
        gap: 1rem;
        position: relative;
        z-index: 1100;
    }

    .nav-brand {
        margin-right: auto;
        z-index: 1100;
        position: relative;
    }

    .lang-switch-container {
        margin-left: auto;
        z-index: 1100;
        position: relative;
    }

    .header-content {
        position: relative;
        z-index: 10;
    }

    .nav-links {
        position: fixed;
        top: 0;
        left: -100%;
        height: 100vh;
        width: 280px;
        background: var(--bg-card);
        border-right: 1px solid var(--grid-color);
        box-shadow: 5px 0 20px rgba(0, 0, 0, 0.3);
        flex-direction: column;
        gap: 0;
        padding: 5rem 0 2rem 0;
        z-index: 1000;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
    }

    .nav-links.active {
        left: 0;
    }

    .nav-link {
        width: 100%;
        padding: 1rem 2rem;
        font-size: 1rem;
        border-bottom: none;
        border-left: 3px solid transparent;
        text-align: left;
        transition: all 0.3s ease;
    }

    .nav-link:hover,
    .nav-link.active {
        background: rgba(186, 54, 92, 0.1);
        border-left-color: var(--accent-primary);
    }

    .header-content {
        padding: 2.5rem 1.5rem;
    }

    .header-content h1 {
        font-size: 2rem;
    }

    .header-content p {
        font-size: 0.95rem;
    }

    main {
        padding: 0 1.5rem;
    }

    .section {
        padding: 2rem;
    }
}

@media (max-width: 600px) {
    .navbar {
        padding: 1rem;
    }

    .nav-brand a {
        font-size: 1.3rem;
    }

    .nav-links {
        width: 260px;
    }

    .nav-link {
        font-size: 0.95rem;
        padding: 1rem 1.5rem;
    }

    .header-content {
        padding: 2rem 1rem;
    }

    .header-content h1 {
        font-size: 1.8rem;
    }

    main {
        padding: 0 1rem;
    }

    .section {
        padding: 1.5rem;
    }

    .section h2 {
        font-size: 1.5rem;
    }

    .section h3 {
        font-size: 1.2rem;
    }
}

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

.header-content h1,
.header-content p {
    animation: fadeInUp 0.8s ease-out backwards;
}

.header-content p {
    animation-delay: 0.2s;
}

main {
    animation: fadeInUp 1s ease-out 0.4s backwards;
}
