/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Roboto:wght@300;400;500&display=swap');

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

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-family: 'Roboto', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.2) 0%, transparent 50%);
    animation: backgroundShift 10s ease-in-out infinite;
    z-index: -1;
}

@keyframes backgroundShift {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Game Container */
.game-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-align: center;
    animation: containerFloat 6s ease-in-out infinite;
    position: relative; /* THIS IS IMPORTANT FOR POSITIONING THE BUTTON */
    background: rgba(255, 255, 255, 0.1);
}

@keyframes containerFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* Title */
h1 {
    font-family: 'Orbitron', monospace;
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 20px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease-in-out infinite;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
}

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

/* Difficulty Selection */
.difficulty-selection {
    margin-bottom: 30px;
    text-align: center;
}

.difficulty-selection h2 {
    font-family: 'Orbitron', monospace;
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #4ecdc4;
}

.difficulty-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.difficulty-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    min-width: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.difficulty-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

.difficulty-btn.easy:hover {
    background: rgba(46, 213, 115, 0.2);
    border-color: #2ed573;
}

.difficulty-btn.medium:hover {
    background: rgba(255, 193, 7, 0.2);
    border-color: #ffc107;
}

.difficulty-btn.hard:hover {
    background: rgba(255, 71, 87, 0.2);
    border-color: #ff4757;
}

.difficulty-icon {
    font-size: 2rem;
}

.difficulty-name {
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
}

.difficulty-desc {
    font-size: 0.9rem;
    opacity: 0.8;
    text-align: center;
}

/* Stats Container */
.stats-container {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 20px;
}

.score-container, .high-score-container, .difficulty-display {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 15px 20px;
    flex: 1;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}
.back-btn {
    position: static;
    margin: 0 10px 20px 10px;
    background: linear-gradient(45deg, #4ecdc4, #45b7d1);
    border: none;
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}
.score-container:hover, .high-score-container:hover, .difficulty-display:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 5px;
    font-weight: 300;
}

#score, #highScore, #currentDifficulty {
    font-family: 'Orbitron', monospace;
    font-size: 1.8rem;
    font-weight: 700;
    color: #4ecdc4;
}

#highScore {
    color: #ffd700;
}

#currentDifficulty {
    color: #ff6b6b;
}

/* Canvas */
#gameCanvas {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    margin: 20px 0;
    transition: all 0.3s ease;
}

#gameCanvas:hover {
    transform: scale(1.02);
    box-shadow: 
        0 15px 40px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Controls */
.controls {
    margin-top: 20px;
}

.restart-btn, .pause-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    border: none;
    color: white;
    font-family: 'Orbitron', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 15px 30px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(238, 90, 36, 0.4);
    margin: 0 10px 20px 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pause-btn {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    box-shadow: 0 5px 15px rgba(78, 205, 196, 0.4);
}

.restart-btn:hover, .pause-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(238, 90, 36, 0.6);
}

.pause-btn:hover {
    box-shadow: 0 8px 25px rgba(78, 205, 196, 0.6);
    background: linear-gradient(45deg, #44a08d, #4ecdc4);
}

.restart-btn:hover {
    background: linear-gradient(45deg, #ee5a24, #ff6b6b);
}

.restart-btn:active, .pause-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(238, 90, 36, 0.5);
}

.pause-btn:active {
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.5);
}

/* Mobile Controls */
.mobile-controls {
    margin: 20px 0;
    display: none; /* Hidden by default, shown on mobile */
}

.control-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 5px 0;
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    width: 60px;
    height: 60px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.control-btn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.95);
}

/* Show mobile controls on mobile devices */
@media (max-width: 768px) {
    .mobile-controls {
        display: block;
    }
    
    .control-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

/* Instructions */
.instructions {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    margin-top: 10px;
}

.instructions p {
    margin: 5px 0;
    font-size: 0.9rem;
    opacity: 0.8;
    font-weight: 300;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-container {
        margin: 20px;
        padding: 20px;
    }
    
    h1 {
        font-size: 2.5rem;
    }
    
    .stats-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .difficulty-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .difficulty-btn {
        min-width: 200px;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 350px;
        height: auto;
    }
    
    .restart-btn {
        font-size: 1rem;
        padding: 12px 25px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
    }
    
    .game-container {
        padding: 15px;
    }
    
    #gameCanvas {
        max-width: 300px;
    }
}

/* Add some floating particles effect */
.game-container::before {
    content: '';
    position: absolute;
    top: -50px;
    left: -50px;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    animation: float 8s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { 
        transform: translateY(0px) rotate(0deg);
        opacity: 0.5;
    }
    50% { 
        transform: translateY(-20px) rotate(180deg);
        opacity: 0.8;
    }
}
