 @import url('https://fonts.googleapis.com/css2?family=Creepster&family=Russo+One&display=swap');
        
         body {
            margin: 0;
            padding: 0;
            background: linear-gradient(135deg, #0f0f0f 0%, #1a0808 100%);
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            font-family: 'Russo One', sans-serif;
            overflow: auto;
            -webkit-touch-callout: none;
            -webkit-user-select: none;
            -khtml-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
            touch-action: auto;
        }
        
        
        #gameContainer {
            position: relative;
        }
        


        /* Fullscreen styles */
        #gameContainer:fullscreen {
            width: 100vw;
            height: 100vh;
            background: #0f0f0f;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        #gameContainer:fullscreen canvas {
            border: none;
            max-width: 100%;
            max-height: 100%;
        }
        
        canvas {
            border: 3px solid #2a0a0a;
            background: #1a1a1a;
            box-shadow: 0 0 50px rgba(255, 0, 0, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.5);
            image-rendering: crisp-edges;
        }
        
        #gameUI {
            position: absolute;
            top: 10px;
            right: 10px;
            color: white;
            font-size: 10px;
            text-shadow: 1px 1px 2px rgba(0,0,0,0.8), 0 0 5px rgba(255,0,0,0.3);
            background: linear-gradient(135deg, rgba(0,0,0,0.9), rgba(50,0,0,0.8));
            padding: 4px 6px;
            border-radius: 4px;
            border: 1px solid rgba(255,0,0,0.3);
            backdrop-filter: blur(3px);
            min-width: 110px;
            z-index: 10;
            max-height: 200px;
            overflow: hidden;
        }
        
        #gameUI div {
            margin: 1px 0;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        
        #gameUI span {
            color: #00ff00;
            font-weight: bold;
            margin-left: 4px;
            text-shadow: 0 0 2px rgba(0,255,0,0.5);
            font-size: 9px;
        }
        
        #health {
            color: #ff4444 !important;
            text-shadow: 0 0 5px rgba(255,0,0,0.5) !important;
        }
        
        #score {
            color: #ffaa00 !important;
            text-shadow: 0 0 5px rgba(255,170,0,0.5) !important;
        }
        
        #wave {
            color: #ff00ff !important;
            text-shadow: 0 0 5px rgba(255,0,255,0.5) !important;
        }
        
        #gameOver {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(0,0,0,0.9);
            color: white;
            padding: 30px;
            border-radius: 10px;
            text-align: center;
            display: none;
        }
        
        #gameOver h2 {
            margin-top: 0;
            color: #ff4444;
            font-family: 'Creepster', cursive;
            font-size: 48px;
            text-shadow: 0 0 20px rgba(255,0,0,0.8);
            animation: pulse 1s ease-in-out infinite;
        }
        
        @keyframes pulse {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.05); }
        }
        
        button {
            background: linear-gradient(135deg, #8B0000, #DC143C);
            color: white;
            border: 2px solid #ff0000;
            padding: 12px 25px;
            font-size: 16px;
            border-radius: 5px;
            cursor: pointer;
            margin-top: 10px;
            font-family: 'Russo One', sans-serif;
            text-transform: uppercase;
            letter-spacing: 1px;
            transition: all 0.3s;
            box-shadow: 0 4px 15px rgba(255,0,0,0.3);
        }
        
        button:hover {
            background: linear-gradient(135deg, #DC143C, #FF0000);
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(255,0,0,0.4);
        }
        
        #pauseButton {
            position: absolute;
            top: 10px;
            left: 10px;
            padding: 8px 15px;
            font-size: 14px;
            background: linear-gradient(135deg, #8B0000, #DC143C);
            min-width: 60px;
            border: 2px solid #ff0000;
            box-shadow: 0 0 20px rgba(255,0,0,0.3);
            font-family: 'Russo One', sans-serif;
            text-transform: uppercase;
            letter-spacing: 2px;
            transition: all 0.3s;
        }
        
        #pauseButton:hover {
            background: linear-gradient(135deg, #DC143C, #FF0000);
            box-shadow: 0 0 30px rgba(255,0,0,0.5);
            transform: scale(1.05);
        }
        
        #companionButton {
            position: absolute;
            top: 50px;
            left: 10px;
            padding: 6px 12px;
            font-size: 12px;
            background: linear-gradient(135deg, #228B22, #32CD32);
            color: white;
            border: 2px solid #00ff00;
            border-radius: 8px;
            cursor: pointer;
            font-family: 'Russo One', sans-serif;
            text-transform: uppercase;
            letter-spacing: 1px;
            transition: all 0.3s;
            box-shadow: 0 0 15px rgba(0,255,0,0.3);
            min-width: 100px;
            text-align: center;
        }
        
        #companionButton:hover {
            background: linear-gradient(135deg, #32CD32, #00FF00);
            box-shadow: 0 0 25px rgba(0,255,0,0.5);
            transform: scale(1.05);
        }
        
        #companionButton:disabled {
            background: linear-gradient(135deg, #666, #888);
            border-color: #999;
            color: #ccc;
            cursor: not-allowed;
            box-shadow: none;
            transform: none;
        }

        #fullscreenButton {
            position: absolute;
            top: 90px;
            left: 10px;
            padding: 6px 12px;
            font-size: 16px;
            background: linear-gradient(135deg, #4169E1, #6495ED);
            color: white;
            border: 2px solid #0000ff;
            border-radius: 8px;
            cursor: pointer;
            font-family: 'Russo One', sans-serif;
            text-transform: uppercase;
            letter-spacing: 1px;
            transition: all 0.3s;
            box-shadow: 0 0 15px rgba(0,0,255,0.3);
            min-width: 100px;
            text-align: center;
        }
        
        #fullscreenButton:hover {
            background: linear-gradient(135deg, #6495ED, #00BFFF);
            box-shadow: 0 0 25px rgba(0,191,255,0.5);
            transform: scale(1.05);
        }
        
        #pauseOverlay {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(0,0,0,0.95);
            color: white;
            padding: 20px;
            border-radius: 15px;
            border: 3px solid #ff0000;
            text-align: left;
            display: none;
            font-family: 'Russo One', sans-serif;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
            max-width: 800px;
            max-height: 90vh;
            overflow-y: auto;
            box-shadow: 0 0 50px rgba(255,0,0,0.3);
            z-index: 9999;
        }

        .pause-title {
            font-size: 42px;
            text-align: center;
            color: #ff4444;
            margin-bottom: 20px;
            text-shadow: 0 0 20px rgba(255,0,0,0.8);
            font-family: 'Creepster', cursive;
        }

        .how-to-play h3 {
            color: #00ff00;
            text-align: center;
            font-size: 24px;
            margin: 0 0 20px 0;
            text-shadow: 0 0 10px rgba(0,255,0,0.5);
        }

        .how-to-play h4 {
            color: #ffaa00;
            font-size: 18px;
            margin: 15px 0 8px 0;
            border-bottom: 2px solid #ffaa00;
            padding-bottom: 3px;
        }

        .control-grid, .system-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
            margin-bottom: 15px;
        }

        .control-grid div, .system-grid div {
            background: rgba(255,255,255,0.1);
            padding: 8px;
            border-radius: 5px;
            border-left: 3px solid #00ff00;
        }

        .controls-section, .gameplay-section, .systems-section, .tips-section {
            margin-bottom: 20px;
            padding: 15px;
            background: rgba(255,255,255,0.05);
            border-radius: 10px;
            border: 1px solid rgba(255,255,255,0.2);
        }

        .gameplay-section p {
            margin: 0;
            line-height: 1.4;
            color: #dddddd;
        }

        .tips-section ul {
            margin: 0;
            padding-left: 20px;
            color: #dddddd;
        }

        .tips-section li {
            margin-bottom: 5px;
            line-height: 1.3;
        }

        .how-to-play strong {
            color: #ffffff;
        }

        /* High Scores Modal */
        #highScoresModal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.9);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 1000;
        }

        .modal-content {
            background: linear-gradient(135deg, #1a0808 0%, #2a1a1a 100%);
            border: 3px solid #ff4444;
            border-radius: 15px;
            padding: 30px;
            max-width: 600px;
            width: 90%;
            max-height: 80%;
            overflow-y: auto;
            text-align: center;
            box-shadow: 0 0 50px rgba(255,0,0,0.5);
        }

        .modal-content h2 {
            color: #ffaa00;
            font-family: 'Creepster', cursive;
            font-size: 36px;
            margin: 0 0 20px 0;
            text-shadow: 0 0 20px rgba(255,170,0,0.8);
        }

        #highScoresList {
            margin: 20px 0;
            text-align: left;
        }

        .high-score-entry {
            background: rgba(255,255,255,0.1);
            border: 1px solid rgba(255,255,255,0.3);
            border-radius: 8px;
            padding: 12px;
            margin-bottom: 8px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-family: 'Russo One', sans-serif;
        }

        .high-score-entry:nth-child(1) {
            border-color: #ffd700;
            background: rgba(255,215,0,0.2);
        }

        .high-score-entry:nth-child(2) {
            border-color: #c0c0c0;
            background: rgba(192,192,192,0.2);
        }

        .high-score-entry:nth-child(3) {
            border-color: #cd7f32;
            background: rgba(205,127,50,0.2);
        }

        .score-rank {
            font-size: 20px;
            font-weight: bold;
            color: #ffaa00;
            width: 40px;
        }

        .score-name {
            font-size: 16px;
            color: #ffffff;
            flex-grow: 1;
            text-align: left;
            margin-left: 15px;
        }

        .score-details {
            text-align: right;
            color: #dddddd;
        }

        .score-points {
            font-size: 18px;
            font-weight: bold;
            color: #00ff00;
        }

        .score-waves {
            font-size: 12px;
            color: #aaaaaa;
        }

        /* New High Score Styling */
        #newHighScore {
            background: rgba(0,255,0,0.2);
            border: 2px solid #00ff00;
            border-radius: 10px;
            padding: 20px;
            margin: 20px 0;
            animation: glow 1s ease-in-out infinite alternate;
        }

        #newHighScore h3 {
            color: #00ff00;
            font-family: 'Creepster', cursive;
            margin: 0 0 15px 0;
            text-shadow: 0 0 15px rgba(0,255,0,0.8);
        }

        #playerName {
            background: rgba(0,0,0,0.7);
            border: 2px solid #00ff00;
            border-radius: 5px;
            padding: 10px;
            color: white;
            font-family: 'Russo One', sans-serif;
            font-size: 16px;
            margin-right: 10px;
            text-align: center;
        }

        #playerName:focus {
            outline: none;
            box-shadow: 0 0 10px rgba(0,255,0,0.5);
        }

        @keyframes glow {
            from { box-shadow: 0 0 20px rgba(0,255,0,0.3); }
            to { box-shadow: 0 0 30px rgba(0,255,0,0.6); }
        }

        /* Pause Menu Buttons */
        .pause-buttons {
            text-align: center;
            margin-top: 30px;
            padding-top: 20px;
            border-top: 2px solid rgba(255,255,255,0.3);
        }

        .pause-buttons button {
            margin: 10px;
            padding: 15px 30px;
            font-size: 16px;
            min-width: 150px;
        }

        .quit-button {
            background: linear-gradient(135deg, #8B0000, #DC143C) !important;
            border-color: #ff0000 !important;
        }

        .quit-button:hover {
            background: linear-gradient(135deg, #DC143C, #FF4444) !important;
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(255,0,0,0.5) !important;
        }

        .home-button {
            display: inline-block;
            margin: 10px;
            padding: 15px 30px;
            font-size: 16px;
            min-width: 150px;
            background: linear-gradient(135deg, #1a5490, #2e7bc4);
            color: white;
            text-decoration: none;
            border: 2px solid #4a90e2;
            border-radius: 8px;
            font-family: 'Russo One', sans-serif;
            font-weight: bold;
            text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
            box-shadow: 0 0 15px rgba(74, 144, 226, 0.3), inset 0 0 10px rgba(255,255,255,0.1);
            transition: all 0.3s ease;
            cursor: pointer;
        }

        .home-button:hover {
            background: linear-gradient(135deg, #2e7bc4, #4a90e2);
            box-shadow: 0 0 25px rgba(74, 144, 226, 0.5), inset 0 0 15px rgba(255,255,255,0.2);
            transform: translateY(-2px);
            color: #ffffff;
        }

        /* Start Menu Styles */
        #startMenu {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, #0f0f0f 0%, #1a0808 100%);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 2000;
            font-family: 'Russo One', sans-serif;
        }

        .start-menu-content {
            text-align: center;
            color: white;
            max-width: 600px;
            padding: 40px;
            background: rgba(0,0,0,0.8);
            border: 3px solid #ff4444;
            border-radius: 20px;
            box-shadow: 0 0 50px rgba(255,0,0,0.3);
            backdrop-filter: blur(10px);
        }

        .game-title {
            font-family: 'Creepster', cursive;
            font-size: 72px;
            color: #ff4444;
            margin: 0 0 10px 0;
            text-shadow: 0 0 30px rgba(255,0,0,0.8);
            animation: titleGlow 2s ease-in-out infinite alternate;
        }

        @keyframes titleGlow {
            from { text-shadow: 0 0 30px rgba(255,0,0,0.8), 0 0 40px rgba(255,0,0,0.5); }
            to { text-shadow: 0 0 40px rgba(255,0,0,1), 0 0 60px rgba(255,0,0,0.7); }
        }

        .subtitle {
            font-size: 24px;
            color: #ffaa00;
            margin-bottom: 40px;
            text-shadow: 0 0 20px rgba(255,170,0,0.8);
            letter-spacing: 2px;
        }

        .menu-options {
            margin: 40px 0;
        }

        .start-button {
            background: linear-gradient(135deg, #228B22, #32CD32);
            border: 3px solid #00ff00;
            color: white;
            padding: 20px 40px;
            font-size: 24px;
            margin: 15px;
            min-width: 250px;
            box-shadow: 0 0 30px rgba(0,255,0,0.4);
            animation: startButtonPulse 1.5s ease-in-out infinite;
        }

        .start-button:hover {
            background: linear-gradient(135deg, #32CD32, #00FF00);
            box-shadow: 0 0 40px rgba(0,255,0,0.6);
            transform: scale(1.05);
        }

        @keyframes startButtonPulse {
            0%, 100% { box-shadow: 0 0 30px rgba(0,255,0,0.4); }
            50% { box-shadow: 0 0 40px rgba(0,255,0,0.6); }
        }

        .menu-button {
            background: linear-gradient(135deg, #4169E1, #6495ED);
            border: 2px solid #0080ff;
            color: white;
            padding: 15px 30px;
            font-size: 18px;
            margin: 10px;
            min-width: 200px;
            box-shadow: 0 0 20px rgba(0,128,255,0.3);
            touch-action: manipulation;
            -webkit-tap-highlight-color: transparent;
            min-height: 44px;
        }

        .menu-button:hover {
            background: linear-gradient(135deg, #6495ED, #00BFFF);
            box-shadow: 0 0 30px rgba(0,191,255,0.5);
            transform: translateY(-2px);
        }

        .game-description {
            margin: 30px 0;
            padding: 20px;
            background: rgba(255,255,255,0.1);
            border-radius: 10px;
            border-left: 4px solid #ffaa00;
        }

        .game-description p {
            font-size: 16px;
            line-height: 1.5;
            color: #dddddd;
            margin: 0 0 15px 0;
        }

        .difficulty-warning {
            font-size: 18px;
            color: #ff4444;
            font-weight: bold;
            text-shadow: 0 0 15px rgba(255,0,0,0.8);
            animation: warningBlink 1s ease-in-out infinite alternate;
        }

        @keyframes warningBlink {
            from { color: #ff4444; }
            to { color: #ff8888; }
        }

        .version-info {
            font-size: 14px;
            color: #888888;
            margin-top: 30px;
            border-top: 1px solid rgba(255,255,255,0.2);
            padding-top: 15px;
        }

        /* Difficulty Selection Styles */
        .difficulty-selection {
            margin: 30px 0;
        }

        .difficulty-selection h3 {
            color: #ffaa00;
            font-size: 24px;
            margin-bottom: 20px;
            text-shadow: 0 0 15px rgba(255,170,0,0.8);
        }

        .difficulty-buttons {
            display: flex;
            gap: 15px;
            justify-content: center;
            margin-bottom: 30px;
            flex-wrap: wrap;
        }

        .difficulty-button {
            flex: 1;
            min-width: 200px;
            max-width: 220px;
            padding: 18px;
            font-size: 18px;
            font-weight: bold;
            border-radius: 15px;
            border: 3px solid;
            position: relative;
            text-align: center;
            transition: all 0.3s ease;
            cursor: pointer;
        }

        .difficulty-desc {
            font-size: 14px;
            font-weight: normal;
            margin-top: 8px;
            opacity: 0.9;
        }

        .easy-mode {
            background: linear-gradient(135deg, #228B22, #32CD32);
            border-color: #00ff00;
            color: white;
            box-shadow: 0 0 25px rgba(0,255,0,0.3);
        }

        .easy-mode:hover {
            background: linear-gradient(135deg, #32CD32, #00FF32);
            box-shadow: 0 0 35px rgba(0,255,0,0.5);
            transform: translateY(-3px) scale(1.02);
        }

        .normal-mode {
            background: linear-gradient(135deg, #FF8C00, #FFA500);
            border-color: #ffaa00;
            color: white;
            box-shadow: 0 0 25px rgba(255,170,0,0.3);
        }

        .normal-mode:hover {
            background: linear-gradient(135deg, #FFA500, #FFD700);
            box-shadow: 0 0 35px rgba(255,170,0,0.5);
            transform: translateY(-3px) scale(1.02);
        }

        .hardcore-mode {
            background: linear-gradient(135deg, #8B0000, #DC143C);
            border-color: #ff0000;
            color: white;
            box-shadow: 0 0 25px rgba(255,0,0,0.3);
            animation: hardcorePulse 2s ease-in-out infinite;
        }

        .hardcore-mode:hover {
            background: linear-gradient(135deg, #DC143C, #FF0000);
            box-shadow: 0 0 35px rgba(255,0,0,0.5);
            transform: translateY(-3px) scale(1.02);
        }

        @keyframes hardcorePulse {
            0%, 100% { box-shadow: 0 0 25px rgba(255,0,0,0.3); }
            50% { box-shadow: 0 0 35px rgba(255,0,0,0.5); }
        }

        /* Mobile Controls */
        #mobileControls {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 10000;
            display: none;
        }
        
        /* Show mobile controls on mobile devices */
        @media (max-width: 768px) {
            #mobileControls {
                display: none !important; /* Start hidden, JavaScript will show when needed */
            }
            
            /* Ensure buttons are touchable on mobile */
            .difficulty-button, .menu-button {
                touch-action: manipulation !important;
                -webkit-tap-highlight-color: rgba(255,255,255,0.2) !important;
                min-height: 44px !important;
                font-size: 14px !important;
                padding: 12px 20px !important;
                cursor: pointer !important;
            }
            
            /* Make sure start menu is above everything */
            #startMenu {
                z-index: 5000 !important;
                pointer-events: auto !important;
            }
        }

        #virtualJoystick {
            position: absolute;
            bottom: 20px;
            left: 20px;
            width: 120px;
            height: 120px;
            pointer-events: all;
        }

        #joystickBase {
            width: 100%;
            height: 100%;
            background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(0,0,0,0.3) 100%);
            border: 3px solid rgba(255,255,255,0.2);
            border-radius: 50%;
            position: relative;
            box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
        }

        #joystickKnob {
            width: 50px;
            height: 50px;
            background: linear-gradient(135deg, #ff4444, #cc0000);
            border: 2px solid #ffffff;
            border-radius: 50%;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            box-shadow: 0 0 15px rgba(255,0,0,0.5);
            transition: all 0.1s ease;
        }

        #mobileActionButtons {
            position: absolute;
            bottom: 20px;
            right: 20px;
            display: grid;
            grid-template-columns: 1fr 1fr;
            grid-gap: 10px;
            pointer-events: all;
        }

        .mobile-btn {
            width: 60px;
            height: 60px;
            background: linear-gradient(135deg, rgba(0,0,0,0.8), rgba(50,0,0,0.6));
            border: 2px solid #ff4444;
            border-radius: 50%;
            color: white;
            font-size: 20px;
            font-family: 'Russo One', sans-serif;
            cursor: pointer;
            box-shadow: 0 0 15px rgba(255,0,0,0.3);
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            touch-action: none;
            user-select: none;
        }

        .mobile-btn:active {
            transform: scale(0.9);
            box-shadow: 0 0 25px rgba(255,0,0,0.6);
            background: linear-gradient(135deg, #ff4444, #cc0000);
        }

        .mobile-btn:hover {
            box-shadow: 0 0 20px rgba(255,0,0,0.5);
            border-color: #ff6666;
        }

        #mobileScrollButtons {
            position: absolute;
            top: 50%;
            right: 100px;
            transform: translateY(-50%);
            display: flex;
            flex-direction: column;
            gap: 10px;
            pointer-events: all;
            z-index: 1001;
        }

        .mobile-scroll-btn {
            width: 50px;
            height: 50px;
            background: linear-gradient(135deg, rgba(0,100,0,0.8), rgba(0,150,0,0.6));
            border: 2px solid #00ff00;
            border-radius: 50%;
            color: white;
            font-size: 18px;
            font-family: 'Russo One', sans-serif;
            cursor: pointer;
            box-shadow: 0 0 15px rgba(0,255,0,0.3);
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            touch-action: none;
            user-select: none;
        }

        .mobile-scroll-btn:active {
            transform: scale(0.9);
            box-shadow: 0 0 25px rgba(0,255,0,0.6);
            background: linear-gradient(135deg, #00ff00, #00cc00);
        }

        .mobile-scroll-btn:hover {
            box-shadow: 0 0 20px rgba(0,255,0,0.5);
            border-color: #66ff66;
        }

        /* Mobile Responsive Styles */
        @media (max-width: 768px) {
            body {
                overflow: auto !important;
                align-items: flex-start;
                padding: 10px;
                touch-action: auto !important;
                min-height: 100vh !important;
                height: auto !important;
            }

            #gameContainer {
                width: 100%;
                max-width: 100vw;
                min-height: 100vh;
                height: auto;
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: flex-start;
                overflow-y: auto;
                -webkit-overflow-scrolling: touch;
            }

            canvas {
                width: 95vw;
                height: 60vh;
                max-width: 95vw;
                max-height: 60vh;
                border: 2px solid #2a0a0a;
            }

            #gameUI {
                top: 5px;
                right: 5px;
                font-size: 8px;
                padding: 3px 5px;
                min-width: 100px;
                max-height: 150px;
            }

            #gameUI span {
                font-size: 8px;
            }

            #pauseButton, #companionButton, #fullscreenButton {
                display: none;
            }

            #mobileControls {
                display: block !important;
            }

            /* Mobile Store Scrolling */
            #store, .store, [class*="store"], [id*="store"] {
                -webkit-overflow-scrolling: touch;
                overflow-y: auto;
                max-height: 70vh;
                touch-action: pan-y;
            }

            /* Store items should be touch-friendly on mobile */
            .store-item, [class*="weapon"], [class*="item"] {
                min-height: 60px;
                padding: 15px;
                touch-action: auto;
                user-select: none;
            }

            /* Scrollbar styling for mobile store */
            #store::-webkit-scrollbar, .store::-webkit-scrollbar {
                width: 8px;
            }

            #store::-webkit-scrollbar-track, .store::-webkit-scrollbar-track {
                background: rgba(255,255,255,0.1);
                border-radius: 4px;
            }

            #store::-webkit-scrollbar-thumb, .store::-webkit-scrollbar-thumb {
                background: var(--main-color);
                border-radius: 4px;
            }

            /* Mobile Start Menu */
            .start-menu-content {
                width: 90vw;
                max-width: 400px;
                padding: 20px;
                margin: 10px;
            }

            .game-title {
                font-size: 36px !important;
            }

            .difficulty-button {
                padding: 15px 10px;
                font-size: 14px;
                margin: 5px 0;
                touch-action: manipulation;
                -webkit-tap-highlight-color: transparent;
                min-height: 44px; /* Apple's recommended minimum touch target */
            }

            .difficulty-desc {
                font-size: 10px;
            }

            /* Enable page scrolling on mobile */
            body {
                overflow-y: auto !important;
                -webkit-overflow-scrolling: touch !important;
                touch-action: auto !important;
            }
            
            /* When pause is active, manage overflow differently */
            body.pause-active {
                overflow: hidden !important;
            }

            /* Mobile Pause Menu */
            #pauseOverlay {
                position: fixed !important;
                width: 95vw !important;
                height: 95vh !important;
                max-width: none !important;
                max-height: none !important;
                top: 2.5vh !important;
                left: 2.5vw !important;
                transform: none !important;
                padding: 10px !important;
                font-size: 11px !important;
                overflow-y: auto !important;
                -webkit-overflow-scrolling: touch;
                z-index: 9999 !important;
            }

            .pause-title {
                font-size: 28px !important;
                margin-bottom: 15px !important;
            }

            .how-to-play h3 {
                font-size: 18px !important;
                margin: 0 0 15px 0 !important;
            }

            .how-to-play h4 {
                font-size: 14px !important;
                margin: 10px 0 6px 0 !important;
            }

            .controls-section, .gameplay-section, .systems-section, .tips-section {
                margin-bottom: 15px !important;
                padding: 10px !important;
            }

            .control-grid, .system-grid {
                grid-template-columns: 1fr !important;
                gap: 6px !important;
            }

            .control-grid div, .system-grid div {
                padding: 6px !important;
                font-size: 10px !important;
            }

            .gameplay-section p {
                font-size: 11px !important;
                line-height: 1.3 !important;
            }

            .tips-section ul {
                padding-left: 15px !important;
            }

            .tips-section li {
                font-size: 10px !important;
                margin-bottom: 3px !important;
                line-height: 1.2 !important;
            }

            .pause-buttons {
                margin-top: 15px !important;
                padding-top: 15px !important;
            }

            .pause-buttons button, .home-button {
                width: 100% !important;
                margin: 4px 0 !important;
                padding: 10px !important;
                font-size: 12px !important;
                min-width: auto !important;
            }

            /* Mobile Game Over */
            #gameOver {
                width: 90vw;
                max-width: 350px;
                padding: 20px;
                font-size: 14px;
            }

            #gameOver button {
                width: 100%;
                margin: 5px 0;
                padding: 12px;
                font-size: 14px;
            }

            /* Mobile High Scores */
            .modal-content {
                width: 90vw;
                max-width: 400px;
                padding: 20px;
                margin: 20px;
            }

            .modal-content button {
                width: 100%;
                margin: 5px 0;
                padding: 10px;
            }
        }

        @media (max-width: 480px) {
            #virtualJoystick {
                width: 100px;
                height: 100px;
                bottom: 15px;
                left: 15px;
            }

            #joystickKnob {
                width: 40px;
                height: 40px;
            }

            .mobile-btn {
                width: 50px;
                height: 50px;
                font-size: 16px;
            }

            #mobileActionButtons {
                bottom: 15px;
                right: 15px;
                grid-gap: 8px;
            }

            canvas {
                height: 55vh;
            }

            .game-title {
                font-size: 28px !important;
            }

            /* Extra small screens - pause menu adjustments */
            #pauseOverlay {
                width: 98vw !important;
                height: 98vh !important;
                top: 1vh !important;
                left: 1vw !important;
                padding: 8px !important;
                font-size: 10px !important;
                border-width: 2px !important;
            }

            .pause-title {
                font-size: 24px !important;
                margin-bottom: 10px !important;
            }

            .how-to-play h3 {
                font-size: 16px !important;
                margin: 0 0 10px 0 !important;
            }

            .how-to-play h4 {
                font-size: 12px !important;
                margin: 8px 0 4px 0 !important;
            }

            .controls-section, .gameplay-section, .systems-section, .tips-section {
                margin-bottom: 10px !important;
                padding: 8px !important;
            }

            .control-grid div, .system-grid div {
                padding: 4px !important;
                font-size: 9px !important;
            }

            .gameplay-section p {
                font-size: 10px !important;
            }

            .tips-section li {
                font-size: 9px !important;
                margin-bottom: 2px !important;
            }

            .pause-buttons {
                margin-top: 10px !important;
                padding-top: 10px !important;
            }

            .pause-buttons button, .home-button {
                padding: 8px !important;
                font-size: 11px !important;
                margin: 3px 0 !important;
            }
        }

        /* Extra responsive breakpoint for very small screens */
        @media (max-width: 320px) {
            #pauseOverlay {
                padding: 5px !important;
                font-size: 9px !important;
            }

            .pause-title {
                font-size: 20px !important;
            }

            .how-to-play h3 {
                font-size: 14px !important;
            }

            .how-to-play h4 {
                font-size: 11px !important;
            }

            .control-grid div, .system-grid div {
                font-size: 8px !important;
                padding: 3px !important;
            }

            .gameplay-section p, .tips-section li {
                font-size: 8px !important;
            }

            .pause-buttons button, .home-button {
                font-size: 10px !important;
                padding: 6px !important;
            }
        }








