body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f0f0;
    font-family: 'Arial', sans-serif;
    touch-action: none;
}

.game-container {
    width: 100%;
    max-width: 400px;
    text-align: center;
    background-color: #ffffff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

.back-button {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s;
}

.back-button:hover {
    color: #2980b9;
}

h1 {
    color: #333;
    margin-bottom: 20px;
}

canvas {
    border: 2px solid #333;
    border-radius: 5px;
    max-width: 100%;
    height: auto;
}

#score {
    font-size: 24px;
    margin: 15px 0;
    color: #4CAF50;
}

#start-btn {
    font-size: 18px;
    padding: 10px 20px;
    margin: 10px 0;
    cursor: pointer;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    transition: background-color 0.3s;
}

#start-btn:hover {
    background-color: #45a049;
}

.controls {
    display: grid;
    grid-template-columns: repeat(3, 60px);
    grid-template-rows: repeat(3, 60px);
    gap: 10px;
    margin: 20px auto 0;
    justify-content: center;
    width: 200px;
}

.control-btn {
    width: 60px;
    height: 60px;
    font-size: 24px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s;
}

.control-btn:hover {
    background-color: #2980b9;
}

#up-btn { grid-column: 2; grid-row: 1; }
#left-btn { grid-column: 1; grid-row: 2; }
#right-btn { grid-column: 3; grid-row: 2; }
#down-btn { grid-column: 2; grid-row: 3; }

@media (max-width: 400px) {
    .game-container {
        padding: 10px;
    }

    .controls {
        width: 180px;
    }

    .control-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}