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

:root {
    --primary-color: #00f7ff;
    --secondary-color: #ff00ff;
    --accent-color: #ffff00;
    --danger-color: #ff3366;
    --success-color: #00ff88;
    --glass-bg: rgba(0, 20, 40, 0.7);
    --text-glow: 0 0 10px var(--primary-color), 0 0 20px var(--primary-color);
    --border-glow: 0 0 10px var(--primary-color), inset 0 0 10px rgba(0, 247, 255, 0.1);
}

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

/* ФИКСИРАН САЙТ - само за играта */
html, body {
    position: fixed;
    overflow: hidden;
    touch-action: none;
    width: 100%;
    height: 100%;
}

body {
    background: #F0F0F0;
    color: #fff;
    font-family: 'Rajdhani', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Back Button - Kalew Style */
.back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: #ffffff;
    color: #333;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    z-index: 100;
}

.back-btn:hover {
    transform: translateX(-5px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.game-container {
    position: relative;
    text-align: center;
    padding: 20px;
    border-radius: 15px;
    background: #0a0a0f;
    background-image: 
        radial-gradient(ellipse at 20% 80%, rgba(0, 247, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(255, 0, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(0, 40, 60, 0.5) 0%, transparent 70%);
    border: 1px solid rgba(0, 247, 255, 0.3);
    box-shadow: 
        0 0 30px rgba(0, 247, 255, 0.2),
        inset 0 0 30px rgba(0, 247, 255, 0.05);
}

/* Responsive Canvas */
canvas {
    border: 2px solid rgba(0, 247, 255, 0.4);
    border-radius: 8px;
    box-shadow: 
        0 0 20px rgba(0, 247, 255, 0.2),
        inset 0 0 20px rgba(0, 247, 255, 0.05);
    max-width: 95vw;
    max-height: 80vh;
    width: auto;
    height: auto;
}

.hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    width: 100%;
    max-width: 500px;
}

.hud-left {
    display: flex;
    gap: 15px;
}

.hud-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.score-box, .level-box {
    background: linear-gradient(135deg, rgba(0, 20, 40, 0.9), rgba(0, 40, 60, 0.7));
    border: 1px solid var(--primary-color);
    padding: 8px 15px;
    box-shadow: var(--border-glow);
    min-width: 80px;
}

.score-box .label, .level-box .label {
    display: block;
    font-size: 0.7em;
    color: var(--primary-color);
    letter-spacing: 2px;
    font-family: 'Orbitron', sans-serif;
}

.score-box .value, .level-box .value {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2em;
    font-weight: 700;
    color: #fff;
    text-shadow: var(--text-glow);
}

.high-score-mini {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8em;
    color: var(--accent-color);
    text-shadow: 0 0 5px var(--accent-color);
}

.powerup-indicators {
    display: flex;
    gap: 8px;
}

.powerup-icon {
    font-size: 1.3em;
    opacity: 0.3;
    filter: grayscale(1);
    transition: all 0.3s ease;
    text-shadow: none;
}

.powerup-icon.powerup-active {
    opacity: 1;
    filter: grayscale(0);
    text-shadow: 0 0 10px currentColor;
    animation: pulse-icon 0.5s ease infinite;
}

#p-speed.powerup-active { color: #ffff00; }
#p-slow.powerup-active { color: #00ff88; }
#p-shield.powerup-active { color: #00bcd4; }

@keyframes pulse-icon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 5, 15, 0.92);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10;
    backdrop-filter: blur(8px);
    border-radius: 15px;
}

.screen.active {
    opacity: 1;
    pointer-events: all;
}

.neon-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 3em;
    font-weight: 900;
    color: #fff;
    text-align: center;
    text-transform: uppercase;
    text-shadow:
        0 0 5px #fff,
        0 0 10px #fff,
        0 0 20px var(--primary-color),
        0 0 40px var(--primary-color),
        0 0 80px var(--primary-color);
    margin-bottom: 15px;
    line-height: 1;
    animation: flicker 3s infinite alternate;
}

.instructions {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 25px;
    font-size: 0.9em;
    line-height: 1.6;
}

.controls-info {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.5);
}

.game-over-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.5em;
    color: var(--danger-color);
    text-shadow: 0 0 20px var(--danger-color), 0 0 40px var(--danger-color);
    margin-bottom: 20px;
    animation: glitch 0.3s ease infinite;
}

.final-stats {
    background: rgba(0, 0, 0, 0.5);
    padding: 20px 40px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.final-stats p {
    font-size: 1.2em;
    margin: 10px 0;
}

.stat-value {
    font-family: 'Orbitron', sans-serif;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.4em;
}

.paused-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 3em;
    color: var(--accent-color);
    text-shadow: 0 0 20px var(--accent-color);
    margin-bottom: 15px;
}

.level-up-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    opacity: 0;
    z-index: 20;
    transition: opacity 0.3s;
}

.level-up-overlay.active {
    opacity: 1;
    animation: levelUpPop 1.5s ease forwards;
}

.level-up-text {
    font-family: 'Orbitron', sans-serif;
    font-size: 2em;
    color: var(--success-color);
    text-shadow: 0 0 20px var(--success-color);
    animation: glow-pulse 0.5s ease infinite alternate;
}

.level-number {
    font-family: 'Orbitron', sans-serif;
    font-size: 4em;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 30px var(--primary-color), 0 0 60px var(--primary-color);
}

@keyframes levelUpPop {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    20% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    80% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

@keyframes glow-pulse {
    from { text-shadow: 0 0 20px var(--success-color); }
    to { text-shadow: 0 0 40px var(--success-color), 0 0 60px var(--success-color); }
}

/* Buttons */
.neon-btn {
    background: transparent;
    color: var(--primary-color);
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2em;
    padding: 12px 30px;
    border: 2px solid var(--primary-color);
    cursor: pointer;
    text-shadow: 0 0 5px var(--primary-color);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2), inset 0 0 10px rgba(0, 255, 255, 0.1);
    transition: all 0.2s ease;
    margin-top: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
}

.neon-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.4), transparent);
    transition: 0.5s;
}

.neon-btn:hover {
    background: rgba(0, 255, 255, 0.1);
    box-shadow: 0 0 20px var(--primary-color), inset 0 0 20px var(--primary-color);
    text-shadow: 0 0 10px #fff;
