* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    /* background-color: #f0f0f0; */
    background-color: #87CEEB;
    font-family: Arial, sans-serif;
    touch-action: none; /* Prevent default touch actions */
    overflow: hidden; /* Prevent scrolling */
}

.game-container {
    position: relative;
    width: 1000px;
    height: 500px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.game-title-container {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 1;
}

.game-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 24px;
    color: #333;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    margin: 0;
}

.game-library-btn {
    padding: 8px 16px;
    font-size: 14px;
    background-color: #4CAF50;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.game-library-btn:hover {
    background-color: #45a049;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    background-color: #87CEEB;
}

.game-header {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 20px;
    z-index: 1;
}

.score, .high-score {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 5px 10px;
    border-radius: 5px;
}

.achievements-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.achievements-btn:hover {
    background-color: rgba(255, 255, 255, 0.8);
}

.game-over, .start-screen, .achievements-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.game-over h2, .start-screen h1, .achievements-screen h2 {
    color: #333;
    margin-bottom: 10px;
}

.game-over p {
    font-size: 18px;
    margin-bottom: 20px;
}

.difficulty-select {
    margin: 20px 0;
}

.difficulty-select h3 {
    color: #333;
    margin-bottom: 10px;
}

.difficulty-btn {
    padding: 8px 16px;
    margin: 0 5px;
    font-size: 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.difficulty-btn:hover {
    background-color: #45a049;
}

.difficulty-btn.active {
    background-color: #2E7D32;
}

#restartButton, #closeAchievements {
    padding: 10px 20px;
    font-size: 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#restartButton:hover, #closeAchievements:hover {
    background-color: #45a049;
}

.hidden {
    display: none;
}

/* Achievement styles */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 20px 0;
    max-height: 300px;
    overflow-y: auto;
}

.achievement-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.achievement-item.locked {
    opacity: 0.5;
}

.achievement-icon {
    font-size: 24px;
    margin-right: 10px;
}

.achievement-content {
    text-align: left;
}

.achievement-title {
    font-weight: bold;
    color: #333;
}

.achievement-description {
    font-size: 12px;
    color: #666;
}

.achievement-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    animation: slideIn 0.5s ease-out;
    z-index: 1000;
}

.achievement-notification.fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Parallax background layers */
.parallax-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.clouds {
    background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIj48Y2lyY2xlIGN4PSI1MCIgY3k9IjUwIiByPSI0MCIgZmlsbD0icmdiYSgyNTUsMjU1LDI1NSwwLjUpIi8+PC9zdmc+') repeat-x;
    background-size: 100px 100px;
    animation: moveClouds 60s linear infinite;
}

.mountains {
    background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIj48cGF0aCBkPSJNMCwxMDAgTDUwLDAgTDEwMCwxMDAgWiIgZmlsbD0icmdiYSgxMDAsMTAwLDEwMCwwLjUpIi8+PC9zdmc+') repeat-x;
    background-size: 200px 200px;
    animation: moveMountains 120s linear infinite;
}

@keyframes moveClouds {
    from { background-position: 0 0; }
    to { background-position: 1000px 0; }
}

@keyframes moveMountains {
    from { background-position: 0 0; }
    to { background-position: 2000px 0; }
}

/* Mobile-specific styles */
@media (max-width: 850px) {
    .game-container {
        width: 100vw;
        height: 78vh;
        position: fixed;
        top: 10;
        border-radius: 0;
        box-shadow: none;
    }
    .game-header {
        top: 80px;
    }
    .game-title {
        font-size: 20px;
    }

    .game-library-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .score, .high-score {
        font-size: 18px;
        padding: 4px 8px;
    }

    .achievements-btn {
        font-size: 20px;
    }

    .difficulty-btn {
        padding: 6px 12px;
        font-size: 14px;
        margin: 0 3px;
    }

    #restartButton, #closeAchievements {
        padding: 8px 16px;
        font-size: 14px;
    }
}