/* 全局重置与变量 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --bg: #f4f6f9;
    --text: #1a1a2e;
    --primary: #f5a623;
    --secondary: #0b0e1a;
    --card-bg: #fff;
    --header-bg: rgba(11, 14, 26, 0.95);
    --footer-bg: #0b0e1a;
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.25);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --radius: 16px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
body.dark-mode {
    --bg: #121212;
    --text: #e0e0e0;
    --card-bg: #1e1e1e;
    --header-bg: rgba(18, 18, 18, 0.95);
    --footer-bg: #0a0a0a;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: background var(--transition), color var(--transition);
    scroll-behavior: smooth;
}

/* 头部导航 */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: box-shadow var(--transition);
}
header.scrolled {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}
nav {
    display: flex;
    align-items: center;
    width: 100%;
}
nav a[aria-label="沙巴体育首页"] {
    margin-right: auto;
}
nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}
nav ul li a {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.25rem 0;
    position: relative;
    transition: color var(--transition);
}
nav ul li a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width var(--transition);
}
nav ul li a:hover::after,
nav ul li a.active::after {
    width: 100%;
}
nav ul li a.active {
    color: var(--primary);
}
#darkModeToggle, #mobileMenuBtn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: 1rem;
    transition: transform 0.2s;
}
#darkModeToggle:hover, #mobileMenuBtn:hover {
    transform: scale(1.1);
}
#mobileMenuBtn {
    display: none;
}
@media (max-width: 768px) {
    nav ul {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 60px;
        left: 0;
        width: 100%;
        background: var(--header-bg);
        backdrop-filter: blur(12px);
        padding: 1rem;
        gap: 0.75rem;
    }
    nav ul.open {
        display: flex;
    }
    #mobileMenuBtn {
        display: block;
    }
}

/* 主体 */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
}
section {
    margin: 4rem 0;
    opacity: 0;
    transform: translateY(30px);
    animation: fadeUp 0.8s ease forwards;
}
@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
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; }

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--secondary);
    line-height: 1.2;
}
h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
    position: relative;
}
h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), transparent);
}
h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
p {
    margin-bottom: 1rem;
}

/* Hero 区域 - 渐变Banner */
#hero {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
    background: linear-gradient(135deg, #0b0e1a 0%, #1a1a3e 50%, #2a2a5e 100%);
    padding: 3rem 2rem;
    border-radius: var(--radius);
    color: #fff;
    box-shadow: var(--shadow);
    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(245, 166, 35, 0.15) 0%, transparent 60%);
    pointer-events: none;
}
#hero > div:first-child {
    flex: 1;
    min-width: 280px;
    position: relative;
    z-index: 1;
}
#hero > div:last-child {
    flex: 0 0 400px;
    position: relative;
    z-index: 1;
}
@media (max-width: 768px) {
    #hero > div:last-child {
        display: none;
    }
    #hero {
        padding: 2rem 1rem;
    }
}
#hero h1 {
    color: #fff;
    font-size: 2.8rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
#hero p {
    font-size: 1.1rem;
    opacity: 0.9;
}
a[role="button"] {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), #e69500);
    color: var(--secondary);
    padding: 0.75rem 2.5rem;
    border-radius: 40px;
    font-weight: bold;
    text-decoration: none;
    margin-top: 1rem;
    transition: transform var(--transition), box-shadow var(--transition);
    box-shadow: 0 4px 15px rgba(245, 166, 35, 0.4);
}
a[role="button"]:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(245, 166, 35, 0.5);
}

/* 产品与服务 - 圆角卡片 + 毛玻璃 */
#products > div, #resources > div {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}
article {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
    backdrop-filter: blur(4px);
    border: 1px solid transparent;
}
article:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    border-color: var(--primary);
}
.dark-mode article:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}
article h3 {
    color: var(--primary);
}

/* 平台优势 */
#features ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}
#features li {
    background: var(--card-bg);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border-left: 4px solid var(--primary);
    transition: transform var(--transition), background var(--transition);
    box-shadow: var(--shadow);
}
#features li:hover {
    transform: translateX(6px);
    background: linear-gradient(135deg, var(--card-bg), rgba(245, 166, 35, 0.08));
}
#features li strong {
    color: var(--primary);
}

/* FAQ 手风琴 */
details {
    background: var(--card-bg);
    margin-bottom: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: background var(--transition), box-shadow var(--transition);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}
details:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
details summary {
    font-weight: 600;
    padding: 0.25rem 0;
    outline: none;
}
details[open] {
    background: linear-gradient(135deg, var(--card-bg), rgba(245, 166, 35, 0.05));
    border: 1px solid rgba(245, 166, 35, 0.2);
}
details p {
    padding: 0.5rem 0 0;
    color: var(--text);
    opacity: 0.85;
}

/* 投注步骤 */
#howto ol {
    list-style-position: inside;
    counter-reset: step;
}
#howto ol li {
    counter-increment: step;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: var(--shadow);
    transition: transform var(--transition);
}
#howto ol li:hover {
    transform: translateX(4px);
}
#howto ol li::marker {
    color: var(--primary);
    font-weight: bold;
}

/* 联系我们 */
address {
    font-style: normal;
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}
address p {
    margin-bottom: 0.5rem;
}

/* 页脚 */
footer {
    background: var(--footer-bg);
    color: #ccc;
    padding: 2.5rem 2rem;
    text-align: center;
    margin-top: 4rem;
    backdrop-filter: blur(4px);
}
footer a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}
footer a:hover {
    color: #ffc107;
    text-decoration: underline;
}
footer nav {
    display: inline-flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

/* 返回顶部 */
#backToTop {
    display: none;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: linear-gradient(135deg, var(--primary), #e69500);
    color: var(--secondary);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(245, 166, 35, 0.4);
    z-index: 200;
    transition: transform var(--transition), box-shadow var(--transition);
}
#backToTop:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 8px 30px rgba(245, 166, 35, 0.5);
}

/* 暗色模式适配 */
.dark-mode h1, .dark-mode h2, .dark-mode h3 {
    color: #f0f0f0;
}
.dark-mode #hero {
    background: linear-gradient(135deg, #0a0a1a 0%, #151530 50%, #202040 100%);
}
.dark-mode #hero h1 {
    color: #fff;
}
.dark-mode article, .dark-mode details, .dark-mode address, .dark-mode #features li, .dark-mode #howto ol li {
    background: #1e1e1e;
}
.dark-mode a[role="button"] {
    color: #0b0e1a;
}
.dark-mode #backToTop {
    color: #0b0e1a;
}

/* 响应式 */
@media (max-width: 768px) {
    main {
        padding: 1rem;
    }
    h1 {
        font-size: 1.8rem;
    }
    h2 {
        font-size: 1.5rem;
    }
    #hero h1 {
        font-size: 2rem;
    }
    #products > div, #resources > div {
        grid-template-columns: 1fr;
    }
    #features ul {
        grid-template-columns: 1fr;
    }
    footer {
        padding: 1.5rem 1rem;
    }
    #backToTop {
        bottom: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}
@media (max-width: 480px) {
    header {
        padding: 0.5rem 1rem;
    }
    #hero {
        padding: 1.5rem 1rem;
    }
    a[role="button"] {
        padding: 0.6rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* 辅助功能 */
a:focus-visible, button:focus-visible, details:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* SVG 自适应 */
svg {
    max-width: 100%;
    height: auto;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #e69500;
}