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

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #0a0a1a;
    color: #e0e0e0;
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

/* 暗色模式（默认） */
body {
    --bg-primary: #0a0a1a;
    --bg-secondary: #1a1a2e;
    --bg-card: rgba(26, 26, 46, 0.8);
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --accent: #e94560;
    --accent-hover: #ff6b81;
    --gradient-hero: linear-gradient(135deg, #0a0a1a 0%, #1a1a2e 50%, #16213e 100%);
    --gradient-card: linear-gradient(145deg, rgba(26, 26, 46, 0.9), rgba(22, 33, 62, 0.9));
    --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.3);
    --shadow-hover: 0 12px 48px rgba(233, 69, 96, 0.2);
}

/* 亮色模式 */
[data-theme="light"] {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.85);
    --text-primary: #1a1a2e;
    --text-secondary: #555;
    --accent: #e94560;
    --accent-hover: #d63850;
    --gradient-hero: linear-gradient(135deg, #f5f5f5 0%, #ffffff 50%, #f0f0f0 100%);
    --gradient-card: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(240, 240, 240, 0.95));
    --glass-bg: rgba(0, 0, 0, 0.03);
    --glass-border: rgba(0, 0, 0, 0.08);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 12px 48px rgba(233, 69, 96, 0.15);
}

/* 滚动动画基础 */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 头部导航 */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    transition: background 0.3s;
}

nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
}

nav a[aria-label="米兰体育首页"] {
    display: flex;
    align-items: center;
    text-decoration: none;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
}

nav ul li a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: color 0.3s, background 0.3s;
}

nav ul li a:hover,
nav ul li a:focus {
    color: var(--accent);
    background: var(--glass-bg);
}

#darkModeToggle,
#mobileMenuBtn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-size: 1.2rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

#darkModeToggle:hover,
#mobileMenuBtn:hover {
    background: var(--accent);
    color: #fff;
    transform: scale(1.05);
}

#mobileMenuBtn {
    display: none;
}

/* 主内容区域 */
main {
    padding-top: 80px;
}

/* 通用section样式 */
section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 1.5rem;
}

section h2 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2rem;
    position: relative;
    display: inline-block;
}

section h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--accent);
    border-radius: 2px;
}

/* Hero区域 */
#hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 3rem;
    min-height: 80vh;
    padding-top: 2rem;
    background: var(--gradient-hero);
    border-radius: 0 0 40px 40px;
    position: relative;
    overflow: hidden;
}

#hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(233, 69, 96, 0.08) 0%, transparent 50%);
    animation: heroGlow 8s ease-in-out infinite;
}

@keyframes heroGlow {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(5%, 5%); }
}

#hero > div:first-child {
    flex: 1;
    z-index: 1;
}

#hero h1 {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.2;
    background: linear-gradient(135deg, var(--accent), #ff8a5c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 500px;
}

#hero a[role="button"] {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: var(--accent);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(233, 69, 96, 0.4);
    transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
}

#hero a[role="button"]:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(233, 69, 96, 0.5);
    background: var(--accent-hover);
}

#hero > div:last-child {
    flex: 0 0 400px;
    z-index: 1;
}

#hero svg {
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 10px 30px rgba(233, 69, 96, 0.2));
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

/* 关于区域 */
#about {
    background: var(--bg-secondary);
    border-radius: 20px;
    margin: 2rem auto;
    padding: 3rem 2rem;
    box-shadow: var(--shadow);
}

#about p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 1rem;
    line-height: 1.8;
}

/* 功能区域 */
#features > div {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

#features article {
    background: var(--gradient-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

#features article:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
}

#features article h3 {
    font-size: 1.3rem;
    color: var(--accent);
    margin-bottom: 1rem;
    font-weight: 600;
}

#features article p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* 下载区域 */
#download {
    background: var(--gradient-hero);
    border-radius: 30px;
    text-align: center;
    padding: 4rem 2rem;
    margin: 2rem auto;
    position: relative;
    overflow: hidden;
}

#download::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(233, 69, 96, 0.1), transparent);
}

#download h2 {
    color: #fff;
}

#download p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

#download div {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

#download a {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.3);
}

#download a:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(233, 69, 96, 0.4);
    background: var(--accent-hover);
}

/* 知识库区域 */
#knowledge > div {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

#knowledge article {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: transform 0.3s, box-shadow 0.3s;
}

#knowledge article:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

#knowledge article h3 {
    font-size: 1.1rem;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

#knowledge article p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* FAQ区域 */
#faq details {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    margin-bottom: 1rem;
    padding: 0.75rem 1.25rem;
    transition: background 0.3s;
}

#faq details[open] {
    background: var(--bg-secondary);
}

#faq summary {
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem 0;
    font-size: 1rem;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#faq summary::after {
    content: '+';
    font-size: 1.3rem;
    color: var(--accent);
    transition: transform 0.3s;
}

#faq details[open] summary::after {
    content: '−';
    transform: rotate(180deg);
}

#faq details p {
    color: var(--text-secondary);
    padding: 0.75rem 0 0.5rem;
    font-size: 0.95rem;
    line-height: 1.7;
}

/* HowTo区域 */
#howto ol {
    list-style: none;
    counter-reset: step;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    padding: 0;
}

#howto ol li {
    counter-increment: step;
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    position: relative;
    transition: transform 0.3s;
}

#howto ol li:hover {
    transform: translateY(-4px);
}

#howto ol li::before {
    content: counter(step);
    position: absolute;
    top: -10px;
    left: -10px;
    width: 36px;
    height: 36px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

#howto ol li strong {
    display: block;
    color: var(--accent);
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
}

#howto ol li {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* 联系区域 */
#contact {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 3rem 2rem;
    margin: 2rem auto;
    box-shadow: var(--shadow);
}

#contact address p {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

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

#contact a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* 页脚 */
footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--glass-border);
    padding: 2rem 1.5rem;
    text-align: center;
}

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

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

footer a {
    color: var(--accent);
    text-decoration: none;
    margin: 0 0.5rem;
    transition: color 0.3s;
}

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

/* 响应式设计 */
@media (max-width: 1024px) {
    #hero {
        flex-direction: column;
        text-align: center;
        padding: 3rem 1.5rem;
    }

    #hero h1 {
        font-size: 2.5rem;
    }

    #hero p {
        margin: 0 auto 2rem;
    }

    #hero > div:last-child {
        flex: 0 0 300px;
    }
}

@media (max-width: 768px) {
    nav ul {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--bg-secondary);
        flex-direction: column;
        padding: 1rem;
        gap: 0.5rem;
        border-bottom: 1px solid var(--glass-border);
    }

    nav ul.active {
        display: flex;
    }

    #mobileMenuBtn {
        display: block;
    }

    section {
        padding: 2.5rem 1rem;
    }

    section h2 {
        font-size: 1.8rem;
    }

    #hero h1 {
        font-size: 2rem;
    }

    #hero p {
        font-size: 1rem;
    }

    #hero > div:last-child {
        flex: 0 0 250px;
    }

    #features > div,
    #knowledge > div {
        grid-template-columns: 1fr;
    }

    #howto ol {
        grid-template-columns: 1fr;
    }

    #download a {
        width: 100%;
        text-align: center;
    }
}

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

    #hero h1 {
        font-size: 1.8rem;
    }

    #hero > div:last-child {
        flex: 0 0 200px;
    }

    nav {
        padding: 0.5rem 1rem;
    }
}

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

/* 无障碍焦点样式 */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
}