html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Loading screen - Dark theme (default) */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #020617; /* slate-950 - matches DartsColors.Background */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-logo {
    width: 120px;
    height: 120px;
    margin-bottom: 32px;
    animation: pulse 2s ease-in-out infinite;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(248, 250, 252, 0.1); /* slate-50 with opacity */
    border-top-color: #F8FAFC; /* slate-50 - matches OnBackground */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    margin-top: 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    color: #F8FAFC; /* slate-50 - matches OnBackground */
    font-weight: 500;
}

/* Loading screen - Light theme (system preference) */
@media (prefers-color-scheme: light) {
    #loading-screen {
        background: #E2E8F0; /* slate-200 - matches DartsColorsLight.Background */
    }

    .loading-spinner {
        border-color: rgba(15, 23, 42, 0.1); /* slate-900 with opacity */
        border-top-color: #0F172A; /* slate-900 - matches OnBackground light */
    }

    .loading-text {
        color: #0F172A; /* slate-900 - matches OnBackground light */
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

/* Canvas container - will be resized when banner is shown */
#canvas-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#canvas-container.with-banner {
    height: calc(100% - 66px) !important;
}

#canvas-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ============================================
   Landing Page Styles (index.html)
   ============================================ */

html:has(body.landing-page) {
    height: auto;
    overflow: auto;
}

body.landing-page {
    height: auto;
    overflow: auto;
    background: #020617;
    color: #F8FAFC;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
}

body.landing-page a {
    color: #60A5FA;
    text-decoration: none;
}

body.landing-page a:hover {
    text-decoration: underline;
}

/* Landing page navigation */
.landing-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(2, 6, 23, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid #1E293B;
    padding: 0 24px;
}

.landing-nav .nav-inner {
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.landing-nav .nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #F8FAFC;
    font-weight: 700;
    font-size: 1.125rem;
}

.landing-nav .nav-logo img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.landing-nav .nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.landing-nav .nav-links a {
    color: #94A3B8;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
}

.landing-nav .nav-links a:hover {
    color: #F8FAFC;
    text-decoration: none;
}

.landing-nav .nav-cta {
    background: #2563EB;
    color: #fff !important;
    padding: 6px 16px;
    border-radius: 6px;
    font-weight: 600;
}

.landing-nav .nav-cta:hover {
    background: #1D4ED8;
}

/* CTA Button (landing page) */
body.landing-page a.cta-button,
.cta-button {
    display: inline-block;
    background: linear-gradient(135deg, #F59E0B 0%, #EF4444 100%);
    color: #fff;
    padding: 16px 48px;
    border-radius: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    margin-top: 28px;
    box-shadow: 0 0 24px rgba(245, 158, 11, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    animation: cta-glow 3s ease-in-out infinite;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 32px rgba(239, 68, 68, 0.6), 0 8px 20px rgba(0, 0, 0, 0.4);
    text-decoration: none;
}

.cta-button:active {
    transform: translateY(0);
}

@keyframes cta-glow {
    0%, 100% { box-shadow: 0 0 24px rgba(245, 158, 11, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3); }
    50% { box-shadow: 0 0 36px rgba(239, 68, 68, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3); }
}

/* Landing page game cards as links */
body.landing-page a.sc-game-card {
    display: block;
    text-decoration: none;
    transition: border-color 0.2s;
}

body.landing-page a.sc-game-card:hover {
    border-color: #334155;
    text-decoration: none;
}

body.landing-page a.sc-feature {
    text-decoration: none;
}

/* Landing page footer */
.landing-footer {
    max-width: 1080px;
    margin: 0 auto;
    text-align: center;
    padding: 32px 24px;
    border-top: 1px solid #1E293B;
    font-size: 0.8125rem;
    color: #64748B;
}

.landing-footer .footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 12px;
}

.landing-footer .footer-links a {
    color: #64748B;
    font-size: 0.8125rem;
}

.landing-footer .footer-links a:hover {
    color: #94A3B8;
}

.landing-footer .footer-contact a {
    color: #64748B;
}

/* Light theme for landing page */
@media (prefers-color-scheme: light) {
    body.landing-page {
        background: #E2E8F0;
        color: #0F172A;
    }

    .landing-nav {
        background: rgba(226, 232, 240, 0.95);
        border-bottom-color: #CBD5E1;
    }

    .landing-nav .nav-logo { color: #0F172A; }
    .landing-nav .nav-links a { color: #475569; }
    .landing-nav .nav-links a:hover { color: #0F172A; }

    body.landing-page a.sc-game-card:hover { border-color: #94A3B8; }

    .landing-footer { border-top-color: #CBD5E1; }

    .landing-footer .footer-links a,
    .landing-footer .footer-contact a,
    .landing-footer {
        color: #475569;
    }

    .landing-footer .footer-links a:hover {
        color: #0F172A;
    }
}

/* Hamburger menu button */
.nav-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
}

.nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #94A3B8;
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}

.nav-hamburger.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-hamburger.open span:nth-child(2) {
    opacity: 0;
}

.nav-hamburger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
    .landing-nav .nav-hamburger {
        display: flex;
    }

    .landing-nav .nav-links {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: rgba(2, 6, 23, 0.98);
        backdrop-filter: blur(8px);
        border-bottom: 1px solid #1E293B;
        flex-direction: column;
        padding: 16px 24px;
        gap: 0;
    }

    .landing-nav .nav-links.open {
        display: flex;
    }

    .landing-nav .nav-links a {
        padding: 12px 0;
        font-size: 1rem;
        border-bottom: 1px solid #1E293B;
        width: 100%;
    }

    .landing-nav .nav-links a:last-child {
        border-bottom: none;
    }

    .landing-nav .nav-cta {
        text-align: center;
        margin-top: 8px;
        padding: 10px 16px;
    }

    .landing-nav .lang-switcher {
        padding: 12px 0;
        border-bottom: 1px solid #1E293B;
        margin-inline-start: 0;
    }
}

@media (prefers-color-scheme: light) {
    @media (max-width: 768px) {
        .landing-nav .nav-links {
            background: rgba(226, 232, 240, 0.98);
            border-bottom-color: #CBD5E1;
        }

        .landing-nav .nav-links a {
            border-bottom-color: #CBD5E1;
        }

        .landing-nav .lang-switcher {
            border-bottom-color: #CBD5E1;
        }

        .nav-hamburger span {
            background: #475569;
        }
    }
}

/* Hero */
.sc-hero {
    text-align: center;
    padding: 64px 24px 48px;
    max-width: 720px;
    margin: 0 auto;
}

.sc-hero img {
    width: 96px;
    height: 96px;
    border-radius: 20px;
    margin-bottom: 24px;
}

.sc-hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0 0 8px;
    color: #F8FAFC;
}

.sc-hero .sc-tagline {
    font-size: 1.25rem;
    font-weight: 500;
    color: #94A3B8;
    margin: 0 0 16px;
}

.sc-hero .sc-description {
    font-size: 1rem;
    color: #CBD5E1;
    margin: 0;
    max-width: 560px;
    margin-inline: auto;
}

/* Section headings */
.sc-section {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px 48px;
}

.sc-section h2 {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: #F8FAFC;
    margin: 0 0 32px;
}

/* Games grid */
.sc-games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.sc-game-card {
    background: #0F172A;
    border: 1px solid #1E293B;
    border-radius: 12px;
    padding: 20px;
}

.sc-game-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #F8FAFC;
    margin: 0 0 8px;
}

.sc-game-card p {
    font-size: 0.875rem;
    color: #94A3B8;
    margin: 0;
}

/* Features grid */
.sc-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.sc-feature {
    background: #0F172A;
    border: 1px solid #1E293B;
    border-radius: 12px;
    padding: 20px;
}

.sc-feature h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #F8FAFC;
    margin: 0 0 6px;
}

.sc-feature p {
    font-size: 0.875rem;
    color: #94A3B8;
    margin: 0;
}

/* How to play steps */
.sc-steps {
    max-width: 640px;
    margin: 0 auto;
    padding: 0;
    list-style: none;
    counter-reset: steps;
}

.sc-steps li {
    counter-increment: steps;
    position: relative;
    padding: 0 0 24px;
    padding-inline-start: 56px;
    font-size: 1rem;
    color: #CBD5E1;
}

.sc-steps li::before {
    content: counter(steps);
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    width: 36px;
    height: 36px;
    background: #1E293B;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: #F8FAFC;
}

.sc-steps li strong {
    color: #F8FAFC;
}

/* CTA section */
.sc-cta {
    text-align: center;
    padding: 48px 24px;
    max-width: 560px;
    margin: 0 auto;
}

.sc-cta h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #F8FAFC;
    margin: 0 0 12px;
}

.sc-cta p {
    font-size: 0.9375rem;
    color: #94A3B8;
    margin: 0;
}

/* Footer */
.sc-footer {
    text-align: center;
    padding: 24px;
    font-size: 0.8125rem;
    color: #64748B;
    border-top: 1px solid #1E293B;
}

/* Skip navigation link */
.skip-link {
    position: absolute;
    top: -40px;
    inset-inline-start: 0;
    background: #2563EB;
    color: #fff;
    padding: 8px 16px;
    z-index: 1000;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
}

.skip-link:focus {
    top: 0;
}

/* Light theme overrides for landing page */
@media (prefers-color-scheme: light) {
    .sc-hero h1 { color: #0F172A; }
    .sc-hero .sc-tagline { color: #475569; }
    .sc-hero .sc-description { color: #334155; }

    .sc-section h2 { color: #0F172A; }

    .sc-game-card,
    .sc-feature {
        background: #F8FAFC;
        border-color: #CBD5E1;
    }

    .sc-game-card h3,
    .sc-feature h3 { color: #0F172A; }

    .sc-game-card p,
    .sc-feature p { color: #475569; }

    .sc-steps li { color: #334155; }
    .sc-steps li::before {
        background: #CBD5E1;
        color: #0F172A;
    }
    .sc-steps li strong { color: #0F172A; }

    .sc-cta h2 { color: #0F172A; }
    .sc-cta p { color: #475569; }
}

/* Responsive: small screens */
@media (max-width: 480px) {
    .sc-hero { padding: 40px 16px 32px; }
    .sc-hero h1 { font-size: 2rem; }
    .sc-hero .sc-tagline { font-size: 1.1rem; }
    .sc-section { padding: 0 16px 36px; }
    .sc-section h2 { font-size: 1.4rem; }
    .sc-games-grid,
    .sc-features-grid {
        grid-template-columns: 1fr;
    }
}

/* Ad banner at bottom */
#ad-banner-frame {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 66px;
    border: none;
    display: none;
}
