body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    font-family: 'Press Start 2P', cursive, 'Courier New', monospace;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

h1 {
    background: linear-gradient(45deg, #ff6b6b, #ffd93d, #6bcf7f);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 
        3px 3px 0 rgba(0, 0, 0, 0.3),
        6px 6px 0 rgba(0, 0, 0, 0.2);
    font-size: 2.2em;
    letter-spacing: 2px;
    margin: 20px 0;
    text-align: center;
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from {
        filter: hue-rotate(0deg);
    }
    to {
        filter: hue-rotate(30deg);
    }
}

.stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.stat {
    background: linear-gradient(145deg, #2d2b55, #3d3a6b);
    border: 3px solid #6c63ff;
    border-radius: 0;
    padding: 15px 25px;
    color: #e2e8ff;
    font-size: 0.9em;
    box-shadow: 
        4px 4px 0 #1e1b4b,
        inset 2px 2px 0 rgba(255, 255, 255, 0.1);
    min-width: 120px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.stat:hover::before {
    left: 100%;
}

.stat-value {
    background: linear-gradient(45deg, #ffd93d, #ff6b6b);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 1.3em;
    margin-top: 5px;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
}

#combo {
    background: linear-gradient(45deg, #ff6b6b, #ff8e53);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 700;
    text-shadow: 
        2px 2px 0 rgba(0, 0, 0, 0.3),
        0 0 12px rgba(255, 107, 107, 0.6);
    font-size: 1em;
    animation: comboPulse 0.6s infinite alternate;
}

@keyframes comboPulse {
    from { 
        transform: scale(1);
        filter: brightness(1);
    }
    to { 
        transform: scale(1.1);
        filter: brightness(1.3);
    }
}

.game-container {
    margin: 20px auto;
    position: relative;
    display: inline-block;
}

#gameCanvas {
    border: 8px solid #6c63ff;
    border-radius: 0;
    background: linear-gradient(135deg, #2a9d8f 0%, #1d6f65 100%);
    cursor: crosshair;
    box-shadow: 
        8px 8px 0 #1e1b4b,
        0 0 0 2px #8d6e63,
        0 0 30px rgba(108, 99, 255, 0.3);
    transition: all 0.3s ease;
}

#gameCanvas:hover {
    box-shadow: 
        12px 12px 0 #1e1b4b,
        0 0 0 2px #8d6e63,
        0 0 40px rgba(108, 99, 255, 0.5);
    transform: translate(-4px, -4px);
}

.power-meter {
    width: 300px;
    height: 24px;
    background: linear-gradient(145deg, #2d2b55, #3d3a6b);
    border: 3px solid #6c63ff;
    border-radius: 0;
    margin: 20px auto;
    overflow: hidden;
    box-shadow: 
        4px 4px 0 #1e1b4b,
        inset 2px 2px 0 rgba(255, 255, 255, 0.1);
    position: relative;
}

.power-fill {
    height: 100%;
    background: linear-gradient(90deg, 
        #6bcf7f 0%,
        #ffd93d 50%,
        #ff6b6b 100%);
    width: 30%;
    transition: width 0.1s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0;
    position: relative;
    overflow: hidden;
}

.power-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%);
    animation: powerShine 1.5s infinite;
}

@keyframes powerShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.controls {
    background: linear-gradient(145deg, #2d2b55, #3d3a6b);
    padding: 20px;
    border-radius: 0;
    margin: 25px auto;
    max-width: 550px;
    border: 4px solid #6c63ff;
    box-shadow: 
        6px 6px 0 #1e1b4b,
        inset 3px 3px 0 rgba(255, 255, 255, 0.1);
}

.power-control {
    margin-bottom: 20px;
    text-align: center;
}

.power-control label {
    color: #e2e8ff;
    font-size: 0.8em;
    margin-bottom: 10px;
    display: block;
    text-shadow: 1px 1px 0 #1e1b4b;
}

#powerSlider {
    width: 250px;
    margin: 10px 0;
    height: 12px;
    border-radius: 0;
    background: linear-gradient(90deg, 
        #6bcf7f 0%,
        #ffd93d 50%,
        #ff6b6b 100%);
    border: 2px solid #6c63ff;
    outline: none;
    box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.1);
}

#powerSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 0;
    background: linear-gradient(135deg, #6c63ff, #4a44b5);
    cursor: pointer;
    box-shadow: 
        2px 2px 0 #1e1b4b,
        0 0 0 2px #ffffff,
        0 0 10px rgba(108, 99, 255, 0.6);
    border: none;
    transition: all 0.2s ease;
}

#powerSlider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 
        3px 3px 0 #1e1b4b,
        0 0 0 2px #ffffff,
        0 0 15px rgba(108, 99, 255, 0.8);
}

button {
    background: linear-gradient(135deg, #6c63ff 0%, #4a44b5 100%);
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    border-radius: 0;
    cursor: pointer;
    margin: 8px;
    transition: all 0.3s ease;
    font-weight: 600;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7em;
    box-shadow: 
        4px 4px 0 #1e1b4b,
        0 0 0 2px #ffffff,
        0 0 15px rgba(108, 99, 255, 0.4);
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

button:hover::before {
    left: 100%;
}

button:hover {
    transform: translate(-2px, -2px);
    box-shadow: 
        6px 6px 0 #1e1b4b,
        0 0 0 2px #ffffff,
        0 0 25px rgba(108, 99, 255, 0.6);
    background: linear-gradient(135deg, #7b73ff 0%, #5a54c5 100%);
}

button:active {
    transform: translate(2px, 2px);
    box-shadow: 
        2px 2px 0 #1e1b4b,
        0 0 0 2px #ffffff,
        0 0 10px rgba(108, 99, 255, 0.4);
}

.instructions {
    margin-top: 25px;
    color: #e2e8ff;
    background: linear-gradient(145deg, #2d2b55, #3d3a6b);
    padding: 20px;
    border-radius: 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
    border: 3px solid #6c63ff;
    box-shadow: 
        4px 4px 0 #1e1b4b,
        inset 2px 2px 0 rgba(255, 255, 255, 0.1);
    font-size: 0.7em;
}

.instructions h3 {
    background: linear-gradient(45deg, #ffd93d, #6bcf7f);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
    margin-bottom: 15px;
    font-size: 1.1em;
}

.effect {
    position: absolute;
    pointer-events: none;
    font-size: 20px;
    font-weight: 700;
    animation: pixelFloatUp 1s ease-out forwards;
    text-shadow: 
        2px 2px 0 rgba(0, 0, 0, 0.5),
        0 0 8px currentColor;
    font-family: 'Press Start 2P', cursive;
    background: linear-gradient(45deg, #ff6b6b, #ffd93d, #6bcf7f);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

@keyframes pixelFloatUp {
    0% { 
        transform: translateY(0) scale(1) rotate(0deg);
        opacity: 1;
        filter: hue-rotate(0deg);
    }
    100% { 
        transform: translateY(-60px) scale(1.2) rotate(5deg);
        opacity: 0;
        filter: hue-rotate(45deg);
    }
}

.special-ball {
    animation: specialBallGlow 1.5s infinite alternate;
}

@keyframes specialBallGlow {
    0% { 
        filter: drop-shadow(0 0 4px currentColor) hue-rotate(0deg);
        transform: scale(1);
    }
    100% { 
        filter: drop-shadow(0 0 12px currentColor) hue-rotate(45deg);
        transform: scale(1.1);
    }
}

.combo-active {
    animation: comboActive 0.4s infinite alternate;
}

@keyframes comboActive {
    0% { 
        transform: scale(1);
        filter: hue-rotate(0deg) brightness(1);
    }
    100% { 
        transform: scale(1.15);
        filter: hue-rotate(30deg) brightness(1.3);
    }
}

.ball-count {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 15px 0;
}

.ball-indicator {
    width: 16px;
    height: 16px;
    border-radius: 0;
    background: radial-gradient(circle at 4px 4px, #ffd93d, #ffb347);
    box-shadow: 
        2px 2px 0 #cc8c35,
        inset -1px -1px 0 rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    border: 1px solid #ffb347;
    position: relative;
}

.ball-indicator::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
}

.ball-indicator.pocketed {
    background: #475569;
    box-shadow: 
        1px 1px 0 #334155,
        inset -1px -1px 0 #64748b;
    transform: scale(0.8) rotate(45deg);
    border-color: #64748b;
}

.level-indicator {
    margin: 15px 0;
    font-size: 1.1em;
    background: linear-gradient(45deg, #ffd93d, #ff6b6b);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 700;
    text-shadow: 
        2px 2px 0 rgba(0, 0, 0, 0.3),
        0 0 10px rgba(255, 215, 0, 0.5);
    animation: levelPulse 2s infinite alternate;
}

@keyframes levelPulse {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

/* Улучшенные пиксельные декоративные элементы */
.game-container::before {
    content: '';
    position: absolute;
    top: -12px;
    left: -12px;
    right: -12px;
    bottom: -12px;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(108, 99, 255, 0.2) 2px,
            rgba(108, 99, 255, 0.2) 4px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(255, 107, 107, 0.1) 2px,
            rgba(255, 107, 107, 0.1) 4px
        );
    z-index: -1;
    animation: pixelScan 3s linear infinite;
    border: 2px solid #6c63ff;
    box-shadow: 0 0 30px rgba(108, 99, 255, 0.3);
}

@keyframes pixelScan {
    0% { 
        background-position: 0 0, 0 0;
        filter: hue-rotate(0deg);
    }
    100% { 
        background-position: 0 8px, 8px 0;
        filter: hue-rotate(360deg);
    }
}

/* Адаптивность для пиксельного стиля */
@media (max-width: 768px) {
    body {
        padding: 10px;
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    }
    
    h1 {
        font-size: 1.8em;
        text-shadow: 
            2px 2px 0 rgba(0, 0, 0, 0.3),
            4px 4px 0 rgba(0, 0, 0, 0.2);
    }
    
    .stats {
        gap: 10px;
    }
    
    .stat {
        padding: 10px 15px;
        min-width: 100px;
        font-size: 0.7em;
    }
    
    #gameCanvas {
        border-width: 6px;
    }
    
    .power-meter {
        width: 250px;
    }
    
    .controls {
        padding: 15px;
        margin: 15px auto;
    }
    
    button {
        padding: 10px 18px;
        font-size: 0.6em;
        margin: 5px;
    }
}

/* Улучшенный фон с анимированными частицами */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(108, 99, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 107, 107, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(107, 207, 127, 0.1) 0%, transparent 50%),
        linear-gradient(rgba(26, 26, 46, 0.9) 1px, transparent 1px),
        linear-gradient(90deg, rgba(26, 26, 46, 0.9) 1px, transparent 1px);
    background-size: 
        100% 100%,
        100% 100%,
        100% 100%,
        20px 20px,
        20px 20px;
    z-index: -1;
    opacity: 0.4;
    pointer-events: none;
    animation: backgroundShift 20s ease-in-out infinite alternate;
}

@keyframes backgroundShift {
    0% {
        background-position: 
            0% 0%,
            0% 0%,
            0% 0%,
            0 0,
            0 0;
    }
    100% {
        background-position: 
            10% 10%,
            -10% -10%,
            5% -5%,
            20px 20px,
            20px 20px;
    }
}