* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.game-container {
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 25px;
    max-width: 800px;
    width: 100%;
}

.game-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

.back-link a {
    color: #77aaff;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.back-link a:hover {
    color: #5588dd;
}

.game-header h1 {
    color: #333;
    margin: 0;
    font-size: 2rem;
}

.score-info {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.score-container, .mass-container {
    font-size: 1.2rem;
    font-weight: bold;
    color: #555;
}

#gameCanvas {
    background-color: #222;
    border-radius: 10px;
    display: block;
    margin: 0 auto;
    width: 100%;
    max-width: 600px;
    height: 400px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.game-controls {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 30px;
    flex-wrap: wrap;
}

.controls-info {
    flex: 1;
    min-width: 250px;
}

.controls-info h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.controls-info p {
    margin-bottom: 15px;
    color: #666;
}

.control-keys {
    display: grid;
    gap: 8px;
}

.key-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.key {
    background: linear-gradient(135deg, #77aaff, #5588dd);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: bold;
    min-width: 40px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.key-row span {
    color: #555;
    font-size: 0.9rem;
}

.game-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

button {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    padding: 12px 25px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

#restartButton {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

#restartButton:hover {
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 2rem;
}

.modal-content p {
    margin-bottom: 25px;
    color: #666;
    font-size: 1.1rem;
}

#finalScore {
    color: #77aaff;
    font-weight: bold;
    font-size: 1.3rem;
}

#playAgainButton {
    margin-top: 10px;
    background: linear-gradient(135deg, #77aaff, #5588dd);
    box-shadow: 0 4px 15px rgba(119, 170, 255, 0.3);
}

#playAgainButton:hover {
    box-shadow: 0 6px 20px rgba(119, 170, 255, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .game-header h1 {
        font-size: 1.8rem;
    }
    
    .score-info {
        justify-content: center;
    }
    
    #gameCanvas {
        height: 300px;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .controls-info {
        min-width: auto;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 15px;
    }
    
    .game-header h1 {
        font-size: 1.5rem;
    }
    
    .score-container, .mass-container {
        font-size: 1rem;
    }
    
    #gameCanvas {
        height: 250px;
    }
    
    .control-keys {
        font-size: 0.9rem;
    }
    
    .key {
        padding: 6px 10px;
        font-size: 0.9rem;
    }
}
