* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Dark theme (default) */
:root,
:root[data-theme="dark"] {
    --bg-primary: #0a0e14;
    --bg-secondary: #171a21;
    --bg-tertiary: #1b2838;
    --border-color: #2a475e;
    --text-primary: #ffffff;
    --text-secondary: #c7d5e0;
    --text-tertiary: #acb2b8;
    --text-muted: #7c8b96;
    --accent-primary: #66c0f4;
    --accent-secondary: #2671a7;
}

/* Light theme */
:root[data-theme="light"] {
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8ecf1;
    --border-color: #d1d9e0;
    --text-primary: #1a1d23;
    --text-secondary: #2c3e50;
    --text-tertiary: #546e7a;
    --text-muted: #78909c;
    --accent-primary: #4a9eff;
    --accent-secondary: #3b8eea;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-secondary);
    background: var(--bg-primary);
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.logo:hover {
    opacity: 0.8;
}

.nav {
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav a {
    color: var(--text-tertiary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

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

.theme-toggle {
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.theme-toggle:hover {
    border-color: var(--accent-primary);
    transform: rotate(180deg);
}

.theme-icon {
    display: block;
    transition: transform 0.3s ease;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--border-color) 100%);
    background-image: url('backgrounds/hero-grid.svg'), linear-gradient(135deg, var(--bg-tertiary) 0%, var(--border-color) 100%);
    background-size: 200px 200px, cover;
    padding: 100px 0;
    text-align: center;
}

.hero-title {
    font-size: 48px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0 18px;
    line-height: 1.2;
}

.hero-title .word {
    display: inline-flex;
}

.hero-title .letter {
    display: inline-block;
    margin: 0 1px;
    color: var(--text-primary);
    animation: letterWave 3s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.1s);
    transform-origin: center bottom;
}

/* Different rotations */
.hero-title .letter:nth-child(odd) {
    transform: rotate(-2deg);
}
.hero-title .letter:nth-child(even) {
    transform: rotate(2deg);
}
.hero-title .letter:nth-child(3n) {
    transform: rotate(-1deg);
}

/* Different fonts */
.hero-title .letter:nth-child(4n+1) {
    font-family: Georgia, serif;
    font-style: italic;
}
.hero-title .letter:nth-child(4n+2) {
    font-family: 'Arial Black', sans-serif;
    font-weight: 900;
}
.hero-title .letter:nth-child(4n+3) {
    font-family: 'Courier New', monospace;
    font-weight: bold;
}
.hero-title .letter:nth-child(4n) {
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 300;
}

/* Different colors - cycling through a palette */
.hero-title .letter:nth-child(7n+1) { color: #66c0f4; }
.hero-title .letter:nth-child(7n+2) { color: #8ed6ff; }
.hero-title .letter:nth-child(7n+3) { color: #a8e6cf; }
.hero-title .letter:nth-child(7n+4) { color: #ffd3b6; }
.hero-title .letter:nth-child(7n+5) { color: #ffaaa5; }
.hero-title .letter:nth-child(7n+6) { color: #d4a5ff; }
.hero-title .letter:nth-child(7n) { color: #fff; }

@keyframes letterWave {
    0%, 100% {
        transform: translateY(0) rotate(-2deg) scale(1);
    }
    25% {
        transform: translateY(-8px) rotate(2deg) scale(1.05);
    }
    50% {
        transform: translateY(0) rotate(-1deg) scale(1);
    }
    75% {
        transform: translateY(-4px) rotate(1deg) scale(1.02);
    }
}

/* Light mode colors */
:root[data-theme="light"] .hero-title .letter:nth-child(7n+1) { color: #2671a7; }
:root[data-theme="light"] .hero-title .letter:nth-child(7n+2) { color: #4a9eff; }
:root[data-theme="light"] .hero-title .letter:nth-child(7n+3) { color: #2d8f6f; }
:root[data-theme="light"] .hero-title .letter:nth-child(7n+4) { color: #e67e22; }
:root[data-theme="light"] .hero-title .letter:nth-child(7n+5) { color: #e74c3c; }
:root[data-theme="light"] .hero-title .letter:nth-child(7n+6) { color: #9b59b6; }
:root[data-theme="light"] .hero-title .letter:nth-child(7n) { color: #2c3e50; }

.subtitle {
    font-size: 20px;
    color: var(--text-tertiary);
    max-width: 800px;
    margin: 0 auto 40px;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(180deg, #5cacee 0%, #4a9eff 50%, #3b8eea 100%);
    color: #ffffff;
    padding: 16px 32px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 192, 244, 0.5);
    filter: brightness(1.1);
}

.btn-icon {
    width: 20px;
    height: 20px;
}

.hero-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Features Section */
.features {
    padding: 80px 0;
    background: var(--bg-primary);
    background-image: url('backgrounds/features-circuit.svg');
    background-size: 120px 120px;
}

.features h2 {
    text-align: center;
    font-size: 36px;
    margin-bottom: 50px;
    color: var(--text-tertiary);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.feature-card {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: transform 0.3s, box-shadow 0.3s;
    text-align: left;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(102, 192, 244, 0.15);
    border-color: var(--accent-primary);
}

.feature-card h3.fancy-title {
    font-size: 19px;
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.fancy-title .l {
    display: inline-block;
    margin: 0 1px;
    animation: cardLetterFloat 3s ease-in-out infinite;
    animation-delay: calc(var(--i, 0) * 0.05s);
}

/* Assign index via nth-child for animation delay */
.fancy-title .l:nth-child(1) { --i: 0; }
.fancy-title .l:nth-child(2) { --i: 1; }
.fancy-title .l:nth-child(3) { --i: 2; }
.fancy-title .l:nth-child(4) { --i: 3; }
.fancy-title .l:nth-child(5) { --i: 4; }
.fancy-title .l:nth-child(6) { --i: 5; }
.fancy-title .l:nth-child(7) { --i: 6; }
.fancy-title .l:nth-child(8) { --i: 7; }
.fancy-title .l:nth-child(9) { --i: 8; }
.fancy-title .l:nth-child(10) { --i: 9; }
.fancy-title .l:nth-child(n+11) { --i: 10; }

/* Different rotations for card titles */
.fancy-title .l:nth-child(odd) { transform: rotate(-1.5deg); }
.fancy-title .l:nth-child(even) { transform: rotate(1.5deg); }
.fancy-title .l:nth-child(3n) { transform: rotate(-0.5deg); }

/* Different fonts for card titles */
.fancy-title .l:nth-child(5n+1) { font-family: Georgia, serif; font-style: italic; font-weight: 400; }
.fancy-title .l:nth-child(5n+2) { font-family: Arial, sans-serif; font-weight: 500; }
.fancy-title .l:nth-child(5n+3) { font-family: 'Courier New', monospace; font-weight: 400; }
.fancy-title .l:nth-child(5n+4) { font-family: -apple-system, sans-serif; font-weight: 300; }
.fancy-title .l:nth-child(5n) { font-family: 'Trebuchet MS', sans-serif; font-weight: 400; }

/* Different colors for card titles */
.fancy-title .l:nth-child(6n+1) { color: #66c0f4; }
.fancy-title .l:nth-child(6n+2) { color: #8ed6ff; }
.fancy-title .l:nth-child(6n+3) { color: #a8e6cf; }
.fancy-title .l:nth-child(6n+4) { color: #ffd3b6; }
.fancy-title .l:nth-child(6n+5) { color: #ffaaa5; }
.fancy-title .l:nth-child(6n) { color: #d4a5ff; }

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

/* Light mode colors for card titles */
:root[data-theme="light"] .fancy-title .l:nth-child(6n+1) { color: #2671a7; }
:root[data-theme="light"] .fancy-title .l:nth-child(6n+2) { color: #4a9eff; }
:root[data-theme="light"] .fancy-title .l:nth-child(6n+3) { color: #2d8f6f; }
:root[data-theme="light"] .fancy-title .l:nth-child(6n+4) { color: #e67e22; }
:root[data-theme="light"] .fancy-title .l:nth-child(6n+5) { color: #e74c3c; }
:root[data-theme="light"] .fancy-title .l:nth-child(6n) { color: #9b59b6; }

.feature-card p {
    color: var(--text-tertiary);
    font-size: 15px;
}

/* Download Section */
.download {
    padding: 80px 0;
    background: var(--bg-secondary);
    background-image: url('backgrounds/download-dots.svg');
    background-size: 80px 80px;
}

.download h2 {
    text-align: center;
    font-size: 36px;
    margin-bottom: 50px;
    color: var(--text-tertiary);
}

.download-duo {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    max-width: 900px;
    margin: 0 auto;
}

.download-box {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 35px;
    border: 1px solid var(--border-color);
}

.download-box-header h3 {
    font-size: 28px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

.download-box-header p {
    color: var(--text-tertiary);
    font-size: 15px;
    margin-bottom: 25px;
}

.platform-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.platform-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 16px;
    padding: 10px 14px;
    border-radius: 6px;
    background: var(--bg-secondary);
    transition: background 0.2s, color 0.2s;
}

.platform-link:hover {
    background: var(--accent-primary);
    color: #fff;
}

.platform-link img {
    width: 20px;
    height: 20px;
    opacity: 0.8;
}

.platform-link:hover img {
    opacity: 1;
}

.platform-link-group {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 6px;
    background: var(--bg-secondary);
}

.platform-icon {
    width: 20px;
    height: 20px;
    opacity: 0.8;
}

.platform-link-mac {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.platform-link-mac:first-of-type {
    margin-left: -8px;
}

.platform-link-mac:hover {
    background: var(--accent-primary);
    color: #fff;
}

.download-box-server {
    border-color: rgba(63, 185, 80, 0.3);
}

.download-box-server .platform-link:hover,
.download-box-server .platform-link-mac:hover {
    background: #3fb950;
}

/* Launcher Integration Section */
.launcher-integration {
    padding: 80px 0;
    background: var(--bg-primary);
    background-image: url('backgrounds/integration-grid.svg');
    background-size: 100px 100px;
}

.launcher-integration h2 {
    text-align: center;
    font-size: 36px;
    margin-bottom: 50px;
    color: var(--text-tertiary);
}

.integration-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 40px;
    max-width: 1000px;
    margin: 0 auto;
}

.integration-item {
    background: var(--bg-secondary);
    padding: 35px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.launcher-logo {
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.launcher-logo img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.launcher-logo-steam img {
    transform: scale(1.5);
}

.launcher-logo-heroic img {
    transform: scale(0.85);
}

.integration-item h3 {
    font-size: 24px;
    margin-bottom: 15px;
    color: var(--text-tertiary);
}

.integration-item p {
    color: var(--text-tertiary);
    font-size: 15px;
    line-height: 1.7;
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    padding: 40px 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.footer p {
    color: var(--text-muted);
    margin: 5px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 32px;
        gap: 0 12px;
    }

    .subtitle {
        font-size: 16px;
    }

    .header .container {
        flex-direction: column;
        gap: 20px;
    }

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

    .feature-grid,
    .download-duo,
    .integration-info {
        grid-template-columns: 1fr;
    }

    .platform-link-group {
        flex-wrap: wrap;
    }
}
