@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

body {
    font-family: 'Press Start 2P', monospace, cursive, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    padding: 20px;
    -webkit-text-size-adjust: 100%;
}

html {
    height: -webkit-fill-available;
    -webkit-text-size-adjust: 100%;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.game-wrapper {
    position: relative;
    width: 560px;
    height: 840px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    -webkit-overflow-scrolling: touch;
    z-index: 1;
}

.menu-fireflies-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 560px;
    height: 840px;
    pointer-events: none;
    z-index: 1;
    max-width: 100%;
    max-height: 100%;
}

#gameCanvas {
    display: block;
    background: #0f0f1e;
    cursor: none;
    max-width: 100%;
    max-height: 100%;
    z-index: 5;
}

.controls {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px 40px;
    border-radius: 10px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.controls h3 {
    margin-bottom: 10px;
    color: #ffd700;
}

.controls p {
    margin: 5px 0;
    font-size: 14px;
    opacity: 0.9;
}

.game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 50px 80px;
    border-radius: 0;
    text-align: center;
    border: 4px solid #ffd700;
    box-shadow: 8px 8px 0px rgba(0, 0, 0, 0.8),
                0 0 30px rgba(255, 215, 0, 0.5);
    min-width: 500px;
}

.game-over h2 {
    font-size: 32px;
    margin-bottom: 20px;
    color: #ffd700;
    font-family: 'Press Start 2P', cursive;
    white-space: nowrap;
}

.game-over p {
    font-size: 18px;
    margin-bottom: 30px;
    font-family: 'Press Start 2P', cursive;
    line-height: 1.6;
    white-space: nowrap;
}

.game-over #finalScore {
    color: #4ade80;
    font-weight: bold;
    font-size: 28px;
    font-family: 'Press Start 2P', cursive;
}

#restartBtn, #menuBtn {
    background: #667eea;
    color: white;
    border: 4px solid #764ba2;
    padding: 14px 35px;
    font-size: 13px;
    font-family: 'Press Start 2P', cursive;
    border-radius: 0;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.1s ease;
    font-weight: bold;
    margin: 8px;
    box-shadow: 6px 6px 0px #3d2861,
                inset -2px -2px 0px #764ba2,
                inset 2px 2px 0px #8b7ec8;
    image-rendering: pixelated;
}

#restartBtn:hover, #menuBtn:hover {
    background: #8b7ec8;
    transform: translateY(-2px);
    box-shadow: 8px 8px 0px #3d2861,
                inset -2px -2px 0px #667eea,
                inset 2px 2px 0px #a499d6,
                0 0 20px #667eea,
                0 0 35px rgba(102, 126, 234, 0.6);
}

#restartBtn:active, #menuBtn:active {
    transform: translateY(2px) translateX(2px);
    box-shadow: 4px 4px 0px #3d2861,
                inset -2px -2px 0px #764ba2,
                inset 2px 2px 0px #8b7ec8;
}

#menuBtn {
    background: #4a5568;
    border-color: #2d3748;
    box-shadow: 6px 6px 0px #1a202c,
                inset -2px -2px 0px #2d3748,
                inset 2px 2px 0px #718096;
}

#menuBtn:hover {
    background: #718096;
    box-shadow: 8px 8px 0px #1a202c,
                inset -2px -2px 0px #4a5568,
                inset 2px 2px 0px #a0aec0,
                0 0 20px #4a5568,
                0 0 35px rgba(74, 85, 104, 0.6);
}

#menuBtn:active {
    transform: translateY(2px) translateX(2px);
    box-shadow: 4px 4px 0px #1a202c,
                inset -2px -2px 0px #2d3748,
                inset 2px 2px 0px #718096;
}

.hidden {
    display: none !important;
}

.menu-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 560px;
    height: 840px;
    background-color: #0a1628;
    background-image: url('assets/menu_background.png');
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    -webkit-transform: translate3d(0,0,0);
    transform: translate3d(0,0,0);
}

.menu-content {
    text-align: center;
    padding: 10px 80px 10px;
    background: transparent;
    border-radius: 0;
    border: none;
    backdrop-filter: none;
    box-shadow: none;
    max-width: 600px;
    position: relative;
    z-index: 20;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    width: 100%;
}

.game-title {
    font-size: 48px;
    margin-bottom: 30px;
    margin-top: -30px;
    color: #FFD700 !important;
    font-family: 'Press Start 2P', monospace, cursive, sans-serif;
    font-weight: bold;
    letter-spacing: 4px;
    text-shadow: 4px 4px 0px rgba(0, 0, 0, 0.5);
    line-height: 1.5;
    position: relative;
    z-index: 30;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    opacity: 1 !important;
    visibility: visible !important;
}

.game-subtitle {
    font-size: 22px;
    color: #FFFFFF;
    margin-bottom: 20px;
    font-family: 'Press Start 2P', cursive;
    letter-spacing: 3px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.screen-title {
    font-size: 42px;
    margin-bottom: 30px;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: center;
    margin-top: 25px;
    position: relative;
    z-index: 30;
    width: 100%;
}

.menu-footer {
    position: absolute;
    bottom: 20px;
    right: 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 8px;
    font-family: 'Press Start 2P', cursive;
    z-index: 100;
    pointer-events: none;
}

.menu-btn {
    background: #2563EB;
    color: white !important;
    border: 4px solid #1d4ed8;
    padding: 12px 45px;
    font-size: 13px;
    font-family: 'Press Start 2P', monospace, cursive, sans-serif;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.1s ease;
    font-weight: bold;
    min-width: 220px;
    box-shadow: 6px 6px 0px #0f1e3d, 
                inset -2px -2px 0px #1d4ed8,
                inset 2px 2px 0px #3b82f6;
    position: relative;
    overflow: hidden;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 35;
    image-rendering: pixelated;
}

.menu-btn:hover {
    background: #3B82F6;
    transform: translateY(-2px);
    box-shadow: 8px 8px 0px #0f1e3d, 
                inset -2px -2px 0px #2563EB,
                inset 2px 2px 0px #60a5fa,
                0 0 20px #2563EB,
                0 0 35px rgba(37, 99, 235, 0.6);
}

.menu-btn:active {
    transform: translateY(2px) translateX(2px);
    box-shadow: 4px 4px 0px #0f1e3d, 
                inset -2px -2px 0px #1d4ed8,
                inset 2px 2px 0px #3b82f6;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 12px 35px rgba(59, 130, 246, 0.7), 0 0 30px rgba(59, 130, 246, 0.5); }
    50% { box-shadow: 0 12px 35px rgba(59, 130, 246, 0.9), 0 0 40px rgba(59, 130, 246, 0.7); }
}

.primary-btn {
    /* Все кнопки теперь единообразные */
}

.scores-list {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    max-height: 400px;
    overflow-y: auto;
    min-width: 400px;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    margin: 8px 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border-left: 4px solid #667eea;
    transition: all 0.2s ease;
}

.score-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.score-item.top-score {
    border-left-color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
}

.score-rank {
    font-size: 20px;
    font-weight: bold;
    color: #ffd700;
    min-width: 40px;
}

.score-value {
    font-size: 22px;
    font-weight: bold;
    color: #4ade80;
}

.score-date {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
}

.no-scores {
    padding: 40px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

.about-content {
    text-align: left;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    max-width: 500px;
}

.about-content p {
    margin: 8px 0;
    line-height: 1.6;
    font-size: 12px;
}

.about-content strong {
    color: #ffd700;
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
    font-size: 14px;
}

.volume-control {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: #1e1e32;
    border: 3px solid #00ffff;
    padding: 8px 14px;
    border-radius: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.1s ease;
    box-shadow: 3px 3px 0px #0a0a14,
                inset -2px -2px 0px #141428,
                inset 2px 2px 0px #2a2a46;
    image-rendering: pixelated;
}

.volume-control:hover {
    background: #2a2a46;
    border-color: #00ffff;
    box-shadow: 4px 4px 0px #0a0a14,
                inset -2px -2px 0px #1e1e32,
                inset 2px 2px 0px #3c3c5a,
                0 0 15px #00ffff,
                0 0 25px rgba(0, 255, 255, 0.5);
    transform: translateY(-2px);
}

.volume-icon {
    font-size: 16px;
    user-select: none;
}

.volume-slider {
    width: 80px;
    height: 8px;
    border-radius: 0;
    background: #0a0a14;
    border: 2px solid #00ffff;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
    image-rendering: pixelated;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 0;
    background: #00ffff;
    border: 2px solid #ffffff;
    cursor: pointer;
    box-shadow: 2px 2px 0px #0a0a14,
                inset -1px -1px 0px #00cccc,
                inset 1px 1px 0px #66ffff;
    transition: all 0.1s ease;
    image-rendering: pixelated;
}

.volume-slider::-webkit-slider-thumb:hover {
    background: #66ffff;
    box-shadow: 3px 3px 0px #0a0a14,
                inset -1px -1px 0px #00ffff,
                inset 1px 1px 0px #99ffff;
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 0;
    background: #00ffff;
    border: 2px solid #ffffff;
    cursor: pointer;
    box-shadow: 2px 2px 0px #0a0a14;
    image-rendering: pixelated;
}

.volume-slider::-moz-range-thumb-old {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.volume-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.exit-game-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    background: #ff6b6b;
    border: 4px solid #ff5555;
    border-radius: 0;
    color: white;
    font-size: 20px;
    font-family: 'Press Start 2P', cursive;
    cursor: pointer;
    z-index: 100;
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    box-shadow: 4px 4px 0px #8b0000,
                inset -2px -2px 0px #ff5555,
                inset 2px 2px 0px #ff8080;
    image-rendering: pixelated;
}

.exit-game-btn:hover {
    background: #ff8080;
    transform: translateY(-2px);
    box-shadow: 6px 6px 0px #8b0000,
                inset -2px -2px 0px #ff6b6b,
                inset 2px 2px 0px #ffa0a0,
                0 0 15px #ff6b6b,
                0 0 25px rgba(255, 107, 107, 0.6);
}

.exit-game-btn:active {
    transform: translateY(2px) translateX(2px);
    box-shadow: 2px 2px 0px #8b0000,
                inset -2px -2px 0px #ff5555,
                inset 2px 2px 0px #ff8080;
}

.wallet-section {
    margin: 0 0 15px 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    backdrop-filter: none;
    transition: all 0.3s ease;
    box-shadow: none;
}

.wallet-section:hover {
    background: transparent;
    border: none;
    box-shadow: none;
    transform: none;
}

.wallet-btn {
    background: #3ABADB;
    color: white;
    border: 4px solid #2AA0C4;
    padding: 12px 50px;
    font-size: 14px;
    font-family: 'Press Start 2P', cursive;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.1s ease;
    font-weight: bold;
    box-shadow: 6px 6px 0px #156278, 
                inset -2px -2px 0px #2AA0C4,
                inset 2px 2px 0px #4BCAEA;
    min-width: 240px;
    position: relative;
    overflow: hidden;
    image-rendering: pixelated;
}

.wallet-btn:hover {
    background: #4BCAEA;
    transform: translateY(-2px);
    box-shadow: 8px 8px 0px #156278, 
                inset -2px -2px 0px #3ABADB,
                inset 2px 2px 0px #6DD5F5,
                0 0 20px #3ABADB,
                0 0 35px rgba(58, 186, 219, 0.6);
}

.wallet-btn:active {
    transform: translateY(2px) translateX(2px);
    box-shadow: 4px 4px 0px #156278, 
                inset -2px -2px 0px #2AA0C4,
                inset 2px 2px 0px #4BCAEA;
}

.wallet-info {
    text-align: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wallet-address {
    font-size: 16px;
    color: #00ffff;
    font-weight: bold;
    margin-bottom: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    font-family: 'Press Start 2P', cursive;
}

.wallet-balance {
    font-size: 14px;
    color: #4ade80;
    margin-bottom: 10px;
    font-weight: bold;
}

.wallet-network {
    font-size: 13px;
    color: #00ffff;
    margin-bottom: 15px;
    font-style: italic;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.disconnect-btn {
    background: #ff6b6b;
    color: white;
    border: 4px solid #ff5555;
    padding: 12px 35px;
    font-size: 15px;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.1s ease;
    font-weight: bold;
    box-shadow: 6px 6px 0px #8b0000, 
                inset -2px -2px 0px #ff5555,
                inset 2px 2px 0px #ff8080;
    image-rendering: pixelated;
}

.disconnect-btn:hover {
    background: #ff8080;
    transform: translateY(-2px);
    box-shadow: 8px 8px 0px #8b0000, 
                inset -2px -2px 0px #ff6b6b,
                inset 2px 2px 0px #ffa0a0,
                0 0 20px #ff6b6b,
                0 0 35px rgba(255, 107, 107, 0.6);
}

.disconnect-btn:active {
    transform: translateY(2px) translateX(2px);
    box-shadow: 4px 4px 0px #8b0000, 
                inset -2px -2px 0px #ff5555,
                inset 2px 2px 0px #ff8080;
}

/* Mobile Touch Controls */
.mobile-controls {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 200;
}

.mobile-controls.hidden {
    display: none;
}

.touch-area {
    position: absolute;
    top: 0;
    height: 100%;
    width: 50%;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    background: rgba(100, 150, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s ease;
}

.touch-left {
    left: 0;
}

.touch-right {
    right: 0;
}

.touch-area.active {
    background: rgba(100, 150, 255, 0.15);
}

.touch-button {
    font-size: 48px;
    color: rgba(255, 255, 255, 0.3);
    text-shadow: 0 0 10px rgba(100, 150, 255, 0.5);
    pointer-events: none;
}

.touch-area.active .touch-button {
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 0 0 20px rgba(100, 150, 255, 0.9);
}

.touch-shoot {
    display: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    html, body {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }
    
    body {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
    
    .container {
        padding: 0;
        width: 100%;
        height: 100%;
    }
    
    .game-wrapper {
        width: 100vw;
        height: 100vh;
        height: -webkit-fill-available;
        max-width: none;
        border-radius: 0;
        box-shadow: none;
        position: fixed;
        top: 0;
        left: 0;
    }
    
    .menu-screen {
        width: 100%;
        height: 100%;
        background-size: cover !important;
        background-position: center center !important;
    }
    
    .menu-fireflies-canvas {
        width: 100% !important;
        height: 100% !important;
        z-index: 1 !important;
    }
    
    #gameCanvas {
        width: 100vw !important;
        height: 100vh !important;
        height: -webkit-fill-available !important;
        max-width: 100vw;
        max-height: 100vh;
        max-height: -webkit-fill-available;
        object-fit: contain;
        display: block;
    }
    
    #menuFirefliesCanvas {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover;
    }
    
    .menu-content {
        padding: 20px;
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        z-index: 20 !important;
        position: relative;
    }
    
    .game-title {
        font-size: 32px;
        margin-bottom: 20px;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .menu-buttons {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .wallet-section {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .menu-btn {
        font-size: 12px;
        padding: 12px 24px;
        min-width: 180px;
    }
    
    .wallet-section {
        margin: 15px 0;
    }
    
    .wallet-btn {
        font-size: 12px;
        padding: 12px 24px;
    }
    
    .volume-control {
        top: 10px;
        right: 10px;
        transform: scale(0.8);
    }
    
    .menu-footer {
        font-size: 7px;
        bottom: 10px;
        right: 10px;
    }
    
    .about-content p {
        font-size: 11px;
        line-height: 1.8;
    }
    
    .screen-title {
        font-size: 28px;
    }
    
    .exit-game-btn {
        font-size: 20px;
        padding: 8px 16px;
        top: 10px;
        right: 10px;
    }
    
    .game-over {
        padding: 30px 40px;
        max-width: 90%;
        min-width: 320px;
    }
    
    .game-over h2 {
        font-size: 20px;
    }
    
    .game-over p {
        font-size: 12px;
    }
    
    #restartBtn, #menuBtn {
        font-size: 10px;
        padding: 12px 20px;
    }
}

@media (max-width: 850px) and (min-width: 769px) {
    #gameCanvas {
        width: 100%;
        height: auto;
    }
    
    .game-wrapper {
        width: 100%;
        max-width: 800px;
    }
}
