* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-dark: #0a0a1a;
    --accent-gold: #ffd700;
    --accent-cyan: #00d4ff;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
}

html,
body {
    touch-action: manipulation;
    overscroll-behavior: none;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #000;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: fixed;
}

.game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    background: linear-gradient(180deg, #87ceeb 0%, #b8e0f0 50%, #e8f4f8 100%);
    touch-action: none;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    z-index: 100;
}

.loader {
    width: 50px;
    height: 50px;
    border: 4px solid var(--glass-border);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay p {
    color: var(--text-secondary);
    font-size: 14px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Mobile Controls */
.mobile-controls {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    padding: 0 20px;
    justify-content: space-between;
    align-items: flex-end;
    z-index: 50;
    pointer-events: none;
}

.mobile-btn {
    pointer-events: auto;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid var(--glass-border);
    border-radius: 16px;
    color: white;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    user-select: none;
    -webkit-user-select: none;
}

.mobile-btn svg {
    width: 32px;
    height: 32px;
}

.mobile-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--accent-cyan);
}

.jump-btn {
    width: 100px;
    height: 80px;
    font-size: 14px;
    background: rgba(0, 200, 100, 0.2);
    border-color: rgba(0, 200, 100, 0.4);
}

.jump-btn:active {
    background: rgba(0, 200, 100, 0.4);
    border-color: #00c864;
}

.pause-btn {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
}

/* Focus styles for accessibility */
#gameCanvas:focus {
    outline: none;
}

/* Mobile safe area padding */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-controls {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
}

/* Portrait mode warning for better experience */
@media (orientation: portrait) and (max-width: 600px) {
    .mobile-controls {
        bottom: 15px;
    }

    .jump-btn {
        width: 90px;
        height: 70px;
        font-size: 12px;
    }

    .pause-btn {
        width: 50px;
        height: 50px;
    }

    .mobile-btn svg {
        width: 24px;
        height: 24px;
    }
}

/* Landscape mobile optimization */
@media (orientation: landscape) and (max-height: 500px) {
    .mobile-controls {
        bottom: 10px;
    }

    .jump-btn {
        width: 80px;
        height: 60px;
    }

    .pause-btn {
        width: 50px;
        height: 50px;
    }
}