@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

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

body {
    font-family: 'Orbitron', monospace;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 20%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(119, 255, 198, 0.2) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
    animation: backgroundPulse 4s ease-in-out infinite alternate;
}

@keyframes backgroundPulse {
    0% { opacity: 0.7; }
    100% { opacity: 1; }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.title {
    font-size: 3.5rem;
    font-weight: 900;
    background: linear-gradient(45deg, #00f5ff, #ff00f5, #f5ff00, #00ff5f);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease-in-out infinite, textGlow 2s ease-in-out infinite alternate;
    text-shadow: 0 0 30px rgba(0, 245, 255, 0.5);
    margin-bottom: 20px;
}

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

@keyframes textGlow {
    0% { filter: brightness(1) drop-shadow(0 0 20px rgba(0, 245, 255, 0.3)); }
    100% { filter: brightness(1.2) drop-shadow(0 0 40px rgba(0, 245, 255, 0.6)); }
}

.score-display {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 20px;
}

.score, .level {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 15px 25px;
    color: #00f5ff;
    font-weight: 700;
    box-shadow: 
        0 8px 32px rgba(0, 245, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    animation: scoreGlow 2s ease-in-out infinite alternate;
}

@keyframes scoreGlow {
    0% { box-shadow: 0 8px 32px rgba(0, 245, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
    100% { box-shadow: 0 8px 32px rgba(0, 245, 255, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
}

.game-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    margin-bottom: 40px;
}

#gameCanvas {
    border: 2px solid rgba(0, 245, 255, 0.5);
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    box-shadow: 
        0 0 50px rgba(0, 245, 255, 0.3),
        inset 0 0 20px rgba(0, 245, 255, 0.1);
    animation: canvasPulse 3s ease-in-out infinite alternate;
    max-width: 100%;
    height: auto;
}

@keyframes canvasPulse {
    0% { box-shadow: 0 0 50px rgba(0, 245, 255, 0.3), inset 0 0 20px rgba(0, 245, 255, 0.1); }
    100% { box-shadow: 0 0 70px rgba(0, 245, 255, 0.5), inset 0 0 30px rgba(0, 245, 255, 0.2); }
}

.game-ui {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 800px;
    margin-top: 20px;
    gap: 20px;
}

.energy-bar {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    padding: 8px;
    position: relative;
    overflow: hidden;
}

.energy-fill {
    height: 20px;
    background: linear-gradient(90deg, #00ff5f, #00f5ff);
    border-radius: 20px;
    width: 100%;
    transition: width 0.3s ease;
    box-shadow: 0 0 20px rgba(0, 255, 95, 0.5);
    animation: energyPulse 1.5s ease-in-out infinite alternate;
}

@keyframes energyPulse {
    0% { box-shadow: 0 0 20px rgba(0, 255, 95, 0.5); }
    100% { box-shadow: 0 0 30px rgba(0, 255, 95, 0.8); }
}

.energy-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

.controls {
    display: flex;
    gap: 15px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 12px 20px;
    color: #00f5ff;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 245, 255, 0.1);
}

.control-btn:hover {
    background: rgba(0, 245, 255, 0.2);
    box-shadow: 0 6px 30px rgba(0, 245, 255, 0.3);
    transform: translateY(-2px);
}

.control-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 15px rgba(0, 245, 255, 0.2);
}

.rules-section {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    margin-top: 20px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.rules-section h2 {
    color: #00f5ff;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 25px;
    text-align: center;
    animation: titleShimmer 2s ease-in-out infinite alternate;
}

@keyframes titleShimmer {
    0% { text-shadow: 0 0 20px rgba(0, 245, 255, 0.5); }
    100% { text-shadow: 0 0 30px rgba(0, 245, 255, 0.8); }
}

.rules-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.rule {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.rule::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00f5ff, transparent);
    animation: ruleScan 3s linear infinite;
}

@keyframes ruleScan {
    0% { left: -100%; }
    100% { left: 100%; }
}

.rule:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(0, 245, 255, 0.3);
    box-shadow: 0 10px 30px rgba(0, 245, 255, 0.1);
    transform: translateY(-5px);
}

.rule strong {
    color: #00f5ff;
    font-weight: 700;
}

@media (max-width: 768px) {
    .title {
        font-size: 2.5rem;
    }
    
    .score-display {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .game-ui {
        flex-direction: column;
        gap: 15px;
    }
    
    .controls {
        justify-content: center;
    }
    
    .rules-content {
        grid-template-columns: 1fr;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 400px;
        height: 300px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .rules-section {
        padding: 20px;
    }
}