* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    background-size: 400% 400%;
    animation: gradient 15s ease infinite;
    display: flex;
    justify-content: center;
    padding: 20px;
    min-height: 100vh;
}

@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    max-width: 800px;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 25px;
    text-align: center;
    margin: 0 auto;
    backdrop-filter: blur(5px);
}

h1 {
    color: #333;
    margin-bottom: 20px;
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: bold;
}

.attempts {
    color: #e74c3c;
}

.game-container {
    margin: 0 auto;
    position: relative;
    max-width: 100%;
    overflow: hidden;
}

canvas {
    background-color: #2c3e50;
    background-image: radial-gradient(#3498db 1px, transparent 1px);
    background-size: 20px 20px;
    border: 2px solid #333;
    border-radius: 5px;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

.controls {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.speed-control {
    margin: 15px auto;
    width: 80%;
    text-align: center;
    background-color: rgba(52, 152, 219, 0.1);
    padding: 10px;
    border-radius: 10px;
}

.speed-control label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #2c3e50;
}

#speed-value {
    color: #e74c3c;
    font-weight: bold;
}

input[type="range"] {
    width: 80%;
    -webkit-appearance: none;
    height: 8px;
    border-radius: 5px;
    background: linear-gradient(to right, #3498db, #e74c3c);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2c3e50;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2c3e50;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

button {
    padding: 8px 16px;
    font-size: 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #45a049;
}

#pause-btn {
    background-color: #f39c12;
}

#pause-btn:hover {
    background-color: #e67e22;
}

#restart-btn {
    background-color: #e74c3c;
}

#restart-btn:hover {
    background-color: #c0392b;
}

.instructions {
    margin-top: 30px;
    text-align: left;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
}

.instructions h2 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #333;
}

.instructions p {
    margin-bottom: 8px;
    color: #555;
}

@media (max-width: 600px) {
    .container {
        padding: 10px;
    }
    
    canvas {
        width: 100%;
        height: auto;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    button {
        width: 100%;
        margin-bottom: 5px;
    }
}