body {
            margin: 0;
            overflow: hidden;
            background-color: #000;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            user-select: none;
            touch-action: none;
        }

        #instruction-modal {
            position: absolute;
            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: 100;
            pointer-events: auto;
        }

        .modal-content {
            background: #111;
            border: 2px solid #3498db;
            border-radius: 10px;
            padding: 30px;
            color: white;
            max-width: 600px;
            text-align: left;
            box-shadow: 0 0 30px rgba(52, 152, 219, 0.4);
            font-family: monospace;
            line-height: 1.5;
        }

        #ui {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 20;
            text-shadow: 2px 2px 0 #000;
        }

        #hud-top {
            position: absolute;
            top: 20px;
            width: 100%;
            display: flex;
            justify-content: center;
            gap: 20px;
            padding: 0 20px;
            box-sizing: border-box;
        }

        .score-box {
            background: rgba(0, 0, 0, 0.7);
            padding: 10px 25px;
            border-radius: 12px;
            border: 2px solid rgba(255, 255, 255, 0.3);
            color: white;
            font-size: 2rem;
            font-weight: bold;
            display: flex;
            align-items: center;
            gap: 10px;
            backdrop-filter: blur(5px);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
        }

        #combo-container {
            position: absolute;
            right: 30px;
            top: 30px;
            text-align: right;
            font-weight: 900;
            font-size: 3rem;
            text-transform: uppercase;
            font-style: italic;
        }

        #combo-text {
            color: #f368e0;
            opacity: 0;
            transform: scale(0.5);
            transition: opacity 0.2s, transform 0.1s;
            text-shadow: 0 0 20px #f368e0, 2px 2px 0 #000;
        }

        #combo-bar-bg {
            width: 150px;
            height: 10px;
            background: rgba(0, 0, 0, 0.5);
            margin-left: auto;
            border-radius: 5px;
            opacity: 0;
            border: 2px solid #333;
            overflow: hidden;
            margin-top: 5px;
        }

        #combo-fill {
            width: 100%;
            height: 100%;
            background: #f368e0;
            transform-origin: right;
        }

        #status-container {
            position: absolute;
            top: 130px;
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            justify-content: center;
            width: 100%;
        }

        .status-badge {
            padding: 5px 15px;
            border-radius: 20px;
            font-weight: bold;
            font-size: 1.2rem;
            background: rgba(0, 0, 0, 0.7);
            color: white;
            display: none;
            animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }

        @keyframes popIn {
            0% {
                transform: scale(0);
            }

            100% {
                transform: scale(1);
            }
        }

        #badge-shield {
            border: 2px solid #3498db;
            color: #3498db;
        }

        #badge-shrink {
            border: 2px solid #9b59b6;
            color: #9b59b6;
        }

        #badge-time {
            border: 2px solid #2ecc71;
            color: #2ecc71;
        }

        #badge-pet {
            border: 2px solid #ff9ff3;
            color: #ff9ff3;
        }

        #badge-clone {
            border: 2px solid #00d2d3;
            color: #00d2d3;
        }

        #badge-boss {
            border: 2px solid #e74c3c;
            color: #e74c3c;
            animation: popInAlert 0.5s infinite alternate;
        }

        @keyframes popInAlert {
            0% {
                box-shadow: 0 0 10px #e74c3c;
                transform: translateY(0);
            }

            100% {
                box-shadow: 0 0 30px #e74c3c;
                transform: translateY(5px);
            }
        }

        #start-msg {
            position: absolute;
            top: 12%;
            max-width: min(760px, calc(100vw - 32px));
            box-sizing: border-box;
            font-size: 3rem;
            color: #fff;
            font-weight: 900;
            animation: float 2s ease-in-out infinite;
            text-align: center;
            background: rgba(7, 13, 24, 0.84);
            padding: 28px 34px;
            border-radius: 12px;
            backdrop-filter: blur(10px);
            border: 2px solid rgba(241, 196, 15, 0.55);
            pointer-events: auto;
            box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
        }

        #progression-stats {
            display: inline-block;
            font-size: 1.05rem;
            color: #8ff0d2;
            margin-top: 15px;
            font-weight: bold;
            background: rgba(0, 0, 0, 0.45);
            padding: 8px 15px;
            border-radius: 8px;
            border: 1px solid rgba(29, 209, 161, 0.65);
        }

        #controls-msg {
            font-size: 1.1rem;
            margin-top: 15px;
            color: #f1c40f;
            line-height: 1.6;
        }

        .diff-btn {
            padding: 10px 20px;
            font-size: 1.2rem;
            font-weight: bold;
            border: 2px solid rgba(255, 255, 255, 0.18);
            border-radius: 8px;
            cursor: pointer;
            color: white;
            text-transform: uppercase;
            transition: transform 0.1s;
            background: rgba(255, 255, 255, 0.08);
        }

        .diff-btn:active {
            transform: scale(0.9);
        }

        .diff-btn.selected {
            color: #0b1220;
            background: #f1c40f;
            border-color: #fff4a6;
            box-shadow: 0 0 18px rgba(241, 196, 15, 0.55);
        }

        .difficulty-row,
        .menu-row {
            display: flex;
            justify-content: center;
            gap: 10px;
            flex-wrap: wrap;
            margin-top: 15px;
        }

        .menu-row {
            margin-top: 20px;
        }

        #hub-hint {
            position: absolute;
            left: 50%;
            bottom: 24px;
            transform: translateX(-50%);
            display: none;
            width: min(720px, calc(100vw - 32px));
            box-sizing: border-box;
            padding: 12px 18px;
            border-radius: 8px;
            background: rgba(5, 10, 18, 0.72);
            border: 1px solid rgba(143, 240, 210, 0.5);
            color: #dffcf4;
            font-size: 0.95rem;
            pointer-events: none;
            text-align: center;
            backdrop-filter: blur(8px);
        }

        #hub-hint strong {
            color: #f1c40f;
            margin-right: 10px;
        }

        #hub-upgrades {
            position: absolute;
            top: 94px;
            right: 18px;
            display: none;
            flex-direction: column;
            gap: 6px;
            align-items: flex-end;
            pointer-events: none;
            z-index: 25;
            max-width: min(260px, calc(100vw - 36px));
        }

        .hub-upgrade-chip {
            padding: 7px 10px;
            border-radius: 8px;
            background: rgba(5, 10, 18, 0.76);
            border: 1px solid rgba(143, 240, 210, 0.42);
            color: #dffcf4;
            font-size: 0.82rem;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.02em;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
            backdrop-filter: blur(8px);
        }

        .hub-upgrade-chip strong {
            color: #f1c40f;
            margin-left: 6px;
        }

        .gp-focus {
            outline: 4px solid #3498db !important;
            transform: scale(1.05);
            box-shadow: 0 0 15px #3498db;
        }

        @keyframes float {

            0%,
            100% {
                transform: translateY(0px);
            }

            50% {
                transform: translateY(-10px);
            }
        }

        #gameover {
            display: none;
            flex-direction: column;
            align-items: center;
            background: rgba(0, 0, 0, 0.95);
            padding: 50px;
            border-radius: 20px;
            color: white;
            pointer-events: auto;
            backdrop-filter: blur(15px);
            border: 2px solid #f368e0;
            box-shadow: 0 0 50px rgba(243, 104, 224, 0.5);
            z-index: 30;
        }

        #gameover h1 {
            font-size: 4rem;
            margin: 0 0 15px 0;
            color: #f368e0;
            text-transform: uppercase;
            text-shadow: 0 0 20px #f368e0;
        }

        .score-display {
            font-size: 1.8rem;
            margin: 8px 0;
            color: #dfe4ea;
        }

        .highlight {
            color: #1dd1a1;
            font-weight: bold;
            font-size: 2.2rem;
        }

        button.action-btn {
            margin-top: 35px;
            padding: 18px 50px;
            font-size: 1.5rem;
            font-weight: 900;
            text-transform: uppercase;
            color: white;
            border: none;
            border-radius: 50px;
            cursor: pointer;
            transition: all 0.1s;
            pointer-events: auto;
        }

        #btn-restart {
            background: linear-gradient(135deg, #f368e0, #ff9ff3);
            box-shadow: 0 6px 0 #a2469a;
        }

        #shop-modal {
            position: absolute;
            inset: 0;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 20px;
            box-sizing: border-box;
            background: rgba(0, 0, 0, 0.76);
            pointer-events: auto;
            z-index: 160;
        }

        .shop-panel {
            width: min(920px, 100%);
            max-height: min(760px, calc(100vh - 40px));
            overflow-y: auto;
            border-color: #f1c40f;
            background: rgba(8, 15, 28, 0.96);
            box-shadow: 0 0 40px rgba(241, 196, 15, 0.28);
            text-align: center;
        }

        .shop-panel h2 {
            margin-top: 0;
            color: #f1c40f;
            text-transform: uppercase;
            letter-spacing: 0;
        }

        .shop-balance {
            display: inline-flex;
            gap: 8px;
            align-items: center;
            padding: 8px 12px;
            border: 1px solid rgba(29, 209, 161, 0.5);
            border-radius: 8px;
            color: #8ff0d2;
            background: rgba(0, 0, 0, 0.35);
            font-weight: 800;
            margin-bottom: 18px;
        }

        .shop-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
            gap: 12px;
            margin: 6px 0 24px;
        }

        .shop-card {
            border: 1px solid rgba(255, 255, 255, 0.18);
            border-radius: 8px;
            padding: 14px;
            background: rgba(255, 255, 255, 0.06);
            color: #fff;
            text-align: left;
        }

        .shop-card h3 {
            margin: 0 0 8px;
            font-size: 1.05rem;
            color: #ffffff;
        }

        .shop-card p {
            margin: 0 0 12px;
            color: #b6c7d6;
            min-height: 44px;
            line-height: 1.35;
        }

        .shop-card button {
            width: 100%;
            margin-top: 8px;
            padding: 10px;
            border-radius: 8px;
            border: 1px solid rgba(241, 196, 15, 0.75);
            background: #f1c40f;
            color: #0b1220;
            font-weight: 900;
            cursor: pointer;
        }

        .shop-card button:disabled {
            cursor: not-allowed;
            color: #7f8c8d;
            border-color: rgba(255, 255, 255, 0.14);
            background: rgba(255, 255, 255, 0.08);
        }

        #btn-restart:active {
            transform: translateY(6px);
            box-shadow: 0 0px 0 #a2469a;
        }

        .game-controls {
            position: absolute;
            bottom: 30px;
            display: flex;
            gap: 20px;
            justify-content: center;
            width: 100%;
            pointer-events: none;
        }

        .hud-btn {
            pointer-events: auto;
            background: linear-gradient(135deg, rgba(30, 30, 45, 0.7), rgba(10, 10, 20, 0.9));
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-bottom: 3px solid;
            padding: 15px 25px;
            font-size: 1.1rem;
            font-weight: 800;
            border-radius: 30px;
            color: white;
            cursor: move;
            backdrop-filter: blur(8px);
            box-shadow: 0 8px 15px rgba(0, 0, 0, 0.5);
            text-transform: uppercase;
            transition: transform 0.1s, box-shadow 0.1s;
            display: none;
            touch-action: none;
        }

        .hud-btn:active {
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.8);
        }

        .difficulty-row .hud-btn,
        .menu-row .hud-btn,
        .shop-panel .hud-btn,
        #settings-modal .hud-btn,
        #instruction-modal .hud-btn {
            display: block;
            cursor: pointer;
        }

        #btn-close-shop {
            width: 100%;
            border-color: #f1c40f;
            color: #f1c40f;
            margin-top: 4px;
        }

        #btn-fire {
            border-bottom-color: #e74c3c;
            text-shadow: 0 0 10px rgba(231, 76, 60, 0.6);
        }

        #btn-dash {
            border-bottom-color: #f368e0;
            color: #f368e0;
            text-shadow: 0 0 10px rgba(243, 104, 224, 0.6);
        }

        #btn-nuke {
            border-bottom-color: #f1c40f;
            color: #f1c40f;
            text-shadow: 0 0 10px rgba(241, 196, 15, 0.6);
        }

        @media (hover: none) and (pointer: coarse) {
            .kb-hint {
                display: none;
            }
        }

        #cooldown-bar {
            position: absolute;
            bottom: 100px;
            width: 130px;
            height: 10px;
            background: rgba(0, 0, 0, 0.8);
            border: 2px solid #555;
            display: none;
            overflow: hidden;
            margin-left: -65px;
            left: 50%;
            border-radius: 5px;
        }

        #cooldown-fill {
            width: 100%;
            height: 100%;
            background: #e74c3c;
            transform-origin: left;
        }

        #dim-alert {
            position: absolute;
            top: 40%;
            left: 0;
            width: 100%;
            text-align: center;
            font-size: 5rem;
            color: #fff;
            font-weight: 900;
            text-transform: uppercase;
            text-shadow: 0 0 40px #fff;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.3s, transform 0.5s;
            transform: scale(0.5);
            letter-spacing: 5px;
            z-index: 50;
            box-sizing: border-box;
            padding: 0 10px;
        }

        #flash {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: white;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.1s;
            z-index: 10;
        }

        #speed-lines {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            opacity: 0;
            transition: opacity 2s;
            z-index: 5;
            background: radial-gradient(circle, transparent 40%, rgba(255, 255, 255, 0.15) 80%, rgba(255, 255, 255, 0.4) 100%);
            mix-blend-mode: overlay;
        }

        #warp-tunnel {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: repeating-radial-gradient(circle at center, transparent 0, transparent 20%, rgba(243, 104, 224, 0.4) 21%, transparent 22%);
            opacity: 0;
            pointer-events: none;
            z-index: 4;
            transition: opacity 0.5s;
            mix-blend-mode: screen;
        }

        @media (max-width: 768px) {
            #hud-top {
                top: 10px;
                flex-direction: row;
                gap: 5px;
                padding: 0 5px;
            }

            .score-box {
                font-size: 1.0rem;
                padding: 5px 10px;
                min-width: 50px !important;
            }

            #combo-container {
                top: 50px;
                right: 5px;
                font-size: 1.0rem;
                transform: scale(0.8);
                transform-origin: top right;
            }

            #combo-text {
                margin-bottom: 2px;
            }

            #combo-bar-bg {
                width: 80px;
            }

            #start-msg {
                font-size: 1.2rem;
                width: 95%;
                padding: 15px;
                margin: 0;
                position: relative;
                left: auto;
                top: auto;
                transform: none;
                display: flex;
                flex-direction: column;
                align-items: center;
                box-sizing: border-box;
            }

            #controls-msg {
                font-size: 0.8rem;
            }

            #progression-stats {
                font-size: 0.75rem;
                padding: 6px 8px;
            }

            .difficulty-row,
            .menu-row {
                gap: 6px;
                width: 100%;
            }

            .diff-btn {
                padding: 8px 10px;
                font-size: 0.8rem;
            }

            #hub-hint {
                bottom: 82px;
                font-size: 0.78rem;
                padding: 9px 10px;
            }

            #hub-upgrades {
                top: 58px;
                right: 8px;
                max-width: 160px;
            }

            .hub-upgrade-chip {
                font-size: 0.68rem;
                padding: 5px 7px;
            }

            #dim-alert {
                font-size: 1.8rem;
                letter-spacing: 2px;
                top: 30%;
            }

            #gameover {
                padding: 15px;
                width: 95%;
                margin: 0;
                transform: none !important;
                left: auto;
                position: relative;
                box-sizing: border-box;
            }

            #gameover h1 {
                font-size: 2.0rem;
            }

            .shop-panel {
                padding: 18px;
            }

            .shop-grid {
                grid-template-columns: 1fr;
            }

            .score-display {
                font-size: 1.1rem;
            }

            .game-controls {
                bottom: 10px;
                gap: 5px;
                justify-content: space-evenly;
            }

            .hud-btn {
                padding: 10px 5px;
                font-size: 0.8rem;
                border-width: 2px;
                width: 100%;
                white-space: nowrap;
            }

            #status-container {
                top: 55px;
            }

            .status-badge {
                font-size: 0.8rem;
                padding: 3px 8px;
            }
        }
