:root {
    --jungle-dark: #0d1f0d;
    --jungle-green: #1a3a1a;
    --jungle-light: #2d5a2d;
    --jungle-accent: #4a8f4a;
    --gold: #ffd700;
    --gold-dark: #b8860b;
    --danger: #dc3545;
    --wood: #8b4513;
    --wood-dark: #5d3a1a;
}

[data-theme="dark"] {
    --jungle-dark: #050a05;
    --jungle-green: #0d1f0d;
    --jungle-light: #1a3a1a;
}

[data-theme="light"] {
    --jungle-dark: #e8f5e8;
    --jungle-green: #c8e6c8;
    --jungle-light: #a8d6a8;
    --jungle-accent: #4a8f4a;
}

body {
    background: linear-gradient(180deg, var(--jungle-dark) 0%, var(--jungle-green) 50%, var(--jungle-light) 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

.game-wrapper {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.game-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    background: linear-gradient(180deg,
            #1a0a2e 0%,
            #16213e 20%,
            #1a3a1a 60%,
            #0d1f0d 100%);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow:
        0 0 0 4px var(--wood-dark),
        0 0 0 8px var(--wood),
        0 10px 40px rgba(0, 0, 0, 0.5),
        inset 0 0 100px rgba(0, 0, 0, 0.3);
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    z-index: 10;
    pointer-events: none;
}

.stat-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--gold-dark);
    border-radius: 0.5rem;
    font-family: 'Courier New', monospace;
    color: #fff;
    backdrop-filter: blur(4px);
}

.stat-icon {
    font-size: 1.2rem;
}

.stat-label {
    font-size: 0.65rem;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: bold;
    color: #fff;
    min-width: 3ch;
    text-align: right;
}

.overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
            rgba(13, 31, 13, 0.95) 0%,
            rgba(26, 58, 26, 0.95) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    color: #fff;
    padding: 2rem;
}

.overlay-content h1 {
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 800;
    margin-bottom: 0.5rem;
    text-shadow:
        0 0 10px var(--gold),
        0 0 20px var(--gold-dark),
        0 4px 8px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.05em;
}

.tagline {
    font-size: 1rem;
    color: var(--gold);
    margin-bottom: 2rem;
    font-style: italic;
}

.controls-info {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.control-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.control-item .key {
    background: var(--jungle-light);
    border: 2px solid var(--gold-dark);
    padding: 0.4rem 0.8rem;
    border-radius: 0.3rem;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #fff;
    font-size: 0.9rem;
    min-width: 60px;
    box-shadow: 0 3px 0 var(--jungle-dark);
}

.control-item span:last-child {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

.game-btn {
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: var(--jungle-dark);
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.2rem;
    font-weight: 800;
    border-radius: 0.5rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    box-shadow:
        0 4px 0 #8b6914,
        0 6px 20px rgba(0, 0, 0, 0.4);
    transition: all 0.1s ease;
}

.game-btn:hover {
    transform: translateY(-2px);
    box-shadow:
        0 6px 0 #8b6914,
        0 10px 30px rgba(0, 0, 0, 0.5);
}

.game-btn:active {
    transform: translateY(2px);
    box-shadow:
        0 2px 0 #8b6914,
        0 4px 10px rgba(0, 0, 0, 0.4);
}

.mobile-hint {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 1.5rem;
}

.final-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 2rem 0;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0.5rem;
    border: 1px solid var(--gold-dark);
}

.final-stat {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
}

.final-stat span:first-child {
    color: rgba(255, 255, 255, 0.7);
}

.final-stat span:last-child {
    color: var(--gold);
    font-weight: bold;
}

.mobile-controls {
    display: none;
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    justify-content: space-between;
    z-index: 50;
    pointer-events: none;
}

.control-left,
.control-right {
    display: flex;
    gap: 0.5rem;
    pointer-events: auto;
}

.mobile-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 215, 0, 0.3);
    border: 3px solid var(--gold);
    color: #fff;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.1s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.mobile-btn:active {
    background: rgba(255, 215, 0, 0.6);
    transform: scale(0.95);
}

.jump-btn {
    width: 80px;
    height: 80px;
    font-size: 2rem;
}

@media (max-width: 768px) {
    .game-wrapper {
        max-width: 100%;
    }

    .game-container {
        border-radius: 0;
        aspect-ratio: auto;
        height: calc(100vh - 200px);
        min-height: 400px;
    }

    .ui-layer {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .stat-box {
        padding: 0.3rem 0.6rem;
        gap: 0.3rem;
    }

    .stat-icon {
        font-size: 1rem;
    }

    .stat-label {
        display: none;
    }

    .stat-value {
        font-size: 0.9rem;
    }

    .mobile-controls {
        display: flex;
    }

    .overlay-content {
        padding: 1rem;
    }

    .controls-info {
        display: none;
    }
}

@media (hover: none) and (pointer: coarse) {
    .mobile-controls {
        display: flex;
    }
}

@keyframes pulse-gold {

    0%,
    100% {
        box-shadow: 0 0 5px var(--gold), 0 0 10px var(--gold-dark);
    }

    50% {
        box-shadow: 0 0 15px var(--gold), 0 0 25px var(--gold-dark);
    }
}

.score-box {
    animation: pulse-gold 2s ease-in-out infinite;
}