/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
}

/* Game container */
.game-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 100%;
    margin: 1rem;
}

/* Header styles */
.game-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.game-header h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-container {
    display: flex;
    justify-content: space-around;
    gap: 2rem;
    margin-bottom: 1rem;
}

.score, .high-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 10px;
    color: white;
    min-width: 120px;
}

.score-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

#current-score, #high-score {
    font-size: 1.5rem;
    font-weight: bold;
}

/* Game controls */
.game-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.difficulty-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.difficulty-selector label {
    font-weight: 600;
    color: #555;
}

#difficulty {
    padding: 0.5rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

#difficulty:focus {
    outline: none;
    border-color: #667eea;
}

/* Button styles */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(240, 147, 251, 0.3);
}

/* Game board container */
.game-board-container {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

#gameCanvas {
    border: 3px solid #333;
    border-radius: 10px;
    background: #f8f9fa;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    height: auto;
}

/* Overlay styles */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    backdrop-filter: blur(5px);
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    max-width: 300px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.overlay-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #333;
}

.overlay-content p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: #666;
}

.overlay-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Instructions styles */
.instructions {
    text-align: left;
    margin-bottom: 1.5rem;
}

.instructions p {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    padding: 0.25rem 0;
    color: #666;
}

.instructions li:before {
    content: "• ";
    color: #667eea;
    font-weight: bold;
}

/* Mobile controls */
.mobile-controls {
    display: none;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.control-row {
    display: flex;
    gap: 0.5rem;
}

.control-btn {
    width: 50px;
    height: 50px;
    border: 2px solid #667eea;
    background: white;
    border-radius: 10px;
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.1);
}

.control-btn:active {
    transform: scale(0.95);
}

/* Responsive design */
@media (max-width: 768px) {
    .game-container {
        padding: 1rem;
        margin: 0.5rem;
    }

    .game-header h1 {
        font-size: 2rem;
    }

    .score-container {
        flex-direction: column;
        gap: 1rem;
    }

    .game-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .difficulty-selector {
        justify-content: center;
    }

    #gameCanvas {
        width: 100%;
        max-width: 350px;
        height: auto;
    }

    .mobile-controls {
        display: flex;
    }

    .overlay-content {
        padding: 1.5rem;
        margin: 1rem;
    }
}

@media (max-width: 480px) {
    .game-header h1 {
        font-size: 1.5rem;
    }

    .score, .high-score {
        min-width: 100px;
        padding: 0.5rem;
    }

    #current-score, #high-score {
        font-size: 1.2rem;
    }

    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }

    .control-btn {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
}

/* Animation for score updates */
@keyframes scoreUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.score-update {
    animation: scoreUpdate 0.3s ease-in-out;
}

/* Smooth transitions for game state changes */
.game-board-container {
    transition: all 0.3s ease;
}

/* Focus styles for accessibility */
.btn:focus,
.control-btn:focus,
#difficulty:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}
