* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f0f0;
    font-family: Arial, sans-serif;
}

.game-container {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.game-header {
    text-align: center;
    margin-bottom: 20px;
}

.game-header h1 {
    margin: 0;
    color: #333;
    font-size: 2.5em;
}

.game-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 10px;
    padding: 10px;
    background-color: #f8f8f8;
    border-radius: 5px;
}

.game-library {
text-align: right;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 1.2em;
}

.stat span:first-child {
    color: #666;
    font-size: 0.8em;
}

.stat span:last-child {
    color: #333;
    font-weight: bold;
}

#gameCanvas {
    border: 2px solid #333;
    border-radius: 5px;
    background-color: #fff;
}

.game-over {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    z-index: 100;
}

.game-over h2 {
    margin: 0 0 20px 0;
    color: #333;
}

.game-over p {
    margin: 0 0 20px 0;
    font-size: 1.2em;
    color: #666;
}

#startButton {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1.1em;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#startButton:hover {
    background-color: #45a049;
}

/* Touch controls */
.touch-controls {
    display: none;
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
}

.touch-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 24px;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.left-button, .right-button {
    margin-right: 10px;
}

.jump-button {
    margin-left: auto;
}

.game-library {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 101;
}
.game-library a {
    max-width: 40px;
    font-size: 8px;
    background-color: #d47203;
    border-radius: 5px;
    padding: 5px;
    text-decoration: none;
    color: #fff;
}

/* Responsive design */
@media (max-width: 850px) {
    .game-container {
        padding: 0;
        position: fixed;
        top: 0px;
        width: 100vw;
        height: 92vh;
        display: flex;
        flex-direction: column;
    }

    .game-header {
        padding: 10px;
        background-color: rgba(255, 255, 255, 0.9);
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        z-index: 10;
    }

    .game-header h1 {
        font-size: 1.8em;
    }

    .game-stats {
        flex-wrap: wrap;
        gap: 10px;
        background-color: rgba(248, 248, 248, 0.9);
    }

    .stat {
        flex: 1 1 calc(50% - 10px);
    }
    
    #gameCanvas {
        width: 100vw !important;
        height: 62vh !important;
        border: none;
        border-radius: 0;
        position: fixed;
        top: 105px;
        left: 0;
        z-index: 1;
    }
}

@media (max-width: 600px) {
    .game-header h1 {
        font-size: 1.5em;
    }

    .game-stats {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: space-between;
        padding: 8px;
        background-color: rgba(248, 248, 248, 0.9);
    }

    .stat {
        flex: 0 0 auto;
        margin: 0 5px;
        font-size: 1em;
    }
    
    .stat span:first-child {
        font-size: 0.7em;
    }
    
    .touch-controls {
        display: flex;
        bottom: 40px;
        padding: 0 20px;
        z-index: 100;
    }
    
    .touch-button {
        width: 70px;
        height: 70px;
        font-size: 24px;
        background-color: rgba(76, 175, 80, 0.8);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        transition: transform 0.1s, background-color 0.2s;
    }

    .touch-button:active {
        transform: scale(0.95);
        background-color: rgba(76, 175, 80, 1);
    }

    .left-button, .right-button {
        margin-right: 15px;
    }

    .jump-button {
        margin-left: auto;
    }
}

/* Prevent scrolling on touch devices */
html, body {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    touch-action: none;
}
