:root {
            --primary: #7ddf8b;
            --secondary: #8b5cf6;
            --accent: #f5b84b;
            --danger: #fb7185;
            --dark: #102019;
            --panel: rgba(12, 24, 18, 0.82);
            --text: #f8fafc;
        }

        body {
            margin: 0;
            overflow: hidden;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: #102019;
            color: var(--text);
            user-select: none;
        }

        canvas {
            position: fixed;
            inset: 0;
            display: block;
            z-index: 0;
        }

        /* UI Layers */
        #ui-layer {
            position: absolute;
            top: 20px;
            left: 20px;
            max-width: min(320px, calc(100vw - 40px));
            background: var(--panel);
            backdrop-filter: blur(14px);
            padding: 14px 18px;
            border-radius: 10px;
            border: 1px solid rgba(125, 223, 139, 0.28);
            pointer-events: none;
            z-index: 10;
            box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
            display: none;
        }

        #ui-layer h1 {
            margin: 0 0 10px 0;
            font-size: 1.2rem;
            color: var(--primary);
            text-transform: uppercase;
            letter-spacing: 0;
        }

        #ui-layer p {
            margin: 5px 0;
            font-size: 1rem;
            font-weight: 500;
            line-height: 1.35;
        }

        .highlight {
            color: var(--primary);
            font-weight: bold;
            text-shadow: 0 0 10px var(--primary);
        }

        .danger {
            color: #f87171;
            font-weight: bold;
        }

        /* Screens */
        .screen {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background:
                linear-gradient(180deg, rgba(15, 50, 33, 0.94), rgba(9, 18, 28, 0.98)),
                repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 56px);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 50;
            transition: opacity 0.3s;
        }

        h1.title {
            font-size: clamp(2.4rem, 7vw, 4rem);
            margin-bottom: 10px;
            background: linear-gradient(to right, #b7f7c0, #f5b84b 52%, #a78bfa);
            -webkit-background-clip: text;
            color: transparent;
            text-shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
            text-align: center;
            letter-spacing: 0;
        }

        button.btn-main {
            padding: 14px 28px;
            min-width: min(320px, calc(100vw - 48px));
            font-size: 1rem;
            cursor: pointer;
            background: linear-gradient(135deg, var(--primary), #34d399);
            color: var(--dark);
            border: none;
            border-radius: 12px;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0;
            box-shadow: 0 12px 26px rgba(52, 211, 153, 0.28);
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            margin: 10px;
        }

        button.btn-main:hover {
            transform: translateY(-3px) scale(1.05);
            box-shadow: 0 18px 30px rgba(52, 211, 153, 0.36);
        }

        button.btn-main:active {
            transform: translateY(1px);
        }

        .gp-focus {
            outline: 4px solid var(--primary) !important;
            transform: scale(1.05);
            box-shadow: 0 0 15px var(--primary);
        }

        button.btn-secondary {
            background: rgba(255, 255, 255, 0.08);
            color: white;
            box-shadow: none;
            border: 1px solid rgba(255, 255, 255, 0.18);
        }

        /* Modals */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            z-index: 100;
            justify-content: center;
            align-items: center;
            backdrop-filter: blur(5px);
        }

        .modal-content {
            background: rgba(15, 23, 42, 0.94);
            padding: 32px;
            border-radius: 12px;
            width: 90%;
            max-width: 500px;
            border: 1px solid rgba(125, 223, 139, 0.22);
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
        }

        .modal h2 {
            margin-top: 0;
            color: var(--primary);
        }

        .setting-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .bind-btn {
            padding: 8px 15px;
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.3);
            color: white;
            border-radius: 8px;
            cursor: pointer;
            min-width: 80px;
        }

        /* Effects */
        #flash {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 99;
            transition: opacity 0.1s;
            opacity: 0;
            background: white;
        }

        #dim-alert {
            position: fixed;
            top: 30%;
            left: 50%;
            transform: translate(-50%, -50%) scale(0.5);
            opacity: 0;
            color: #fff;
            font-size: 3rem;
            font-weight: bold;
            text-align: center;
            pointer-events: none;
            z-index: 100;
            transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
            white-space: nowrap;
        }

        .progression {
            margin-top: 20px;
            font-size: 1.1rem;
            color: #94a3b8;
        }

        .progression span {
            color: var(--primary);
            font-weight: bold;
        }

        /* Charge Bar */
        #charge-bar-container {
            width: 150px;
            height: 12px;
            background: rgba(0, 0, 0, 0.42);
            border: 1px solid rgba(255, 255, 255, 0.22);
            border-radius: 8px;
            margin-top: 15px;
            overflow: hidden;
        }

        #charge-bar {
            width: 0%;
            height: 100%;
            background: #4ade80;
            transition: width 0.05s linear;
        }

        /* Boss HP Bar */
        #boss-hp-container {
            position: fixed;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            width: 400px;
            height: 20px;
            background: rgba(0, 0, 0, 0.72);
            border: 1px solid rgba(255, 255, 255, 0.65);
            border-radius: 8px;
            display: none;
            z-index: 20;
        }

        #boss-hp-bar {
            width: 100%;
            height: 100%;
            background: linear-gradient(to right, #ef4444, #f97316);
            transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            border-radius: 6px;
        }

        #boss-name {
            position: absolute;
            top: -25px;
            left: 0;
            width: 100%;
            text-align: center;
            color: #fff;
            font-weight: bold;
            margin: 0;
            text-shadow: 0 0 5px #000;
            letter-spacing: 2px;
        }

        /* Powerup UI */
        #powerup-ui {
            display: none;
            margin-top: 10px;
            padding: 5px 10px;
            border-radius: 8px;
            font-weight: bold;
            font-size: 0.9rem;
        }

        #mutator-ui {
            display: none;
            margin-top: 10px;
            padding: 7px 10px;
            border-radius: 8px;
            border: 1px solid rgba(245, 184, 75, 0.45);
            background: rgba(245, 184, 75, 0.1);
            color: #facc15;
            font-size: 0.82rem;
            font-weight: 700;
            line-height: 1.3;
        }

        #hub-preview {
            position: fixed;
            right: 22px;
            bottom: 22px;
            width: min(330px, calc(100vw - 44px));
            padding: 16px 18px;
            border-radius: 10px;
            border: 1px solid rgba(125, 223, 139, 0.3);
            background: rgba(10, 18, 14, 0.82);
            color: #f8fafc;
            box-shadow: 0 18px 46px rgba(0, 0, 0, 0.38);
            backdrop-filter: blur(14px);
            z-index: 18;
            display: none;
            pointer-events: none;
        }

        #hub-preview strong {
            display: block;
            color: #86efac;
            font-size: 1.05rem;
            margin-bottom: 6px;
        }

        #hub-preview span {
            display: block;
            color: #cbd5e1;
            font-size: 0.9rem;
            line-height: 1.35;
        }

        /* Mobile Controls */
        #mobile-controls {
            display: none;
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 50%;
            pointer-events: none;
            z-index: 40;
        }

        .touch-btn {
            position: absolute;
            background: rgba(12, 24, 18, 0.58);
            border: 1px solid rgba(255, 255, 255, 0.28);
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            color: white;
            font-weight: bold;
            pointer-events: auto;
            user-select: none;
            backdrop-filter: blur(4px);
            font-size: 0.9rem;
            box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
        }

        #btn-shoot {
            bottom: 30px;
            right: 30px;
            width: 80px;
            height: 80px;
        }

        #btn-shoot:active {
            background: rgba(74, 222, 128, 0.4);
            border-color: #4ade80;
        }

        #btn-dash {
            bottom: 130px;
            right: 60px;
            width: 60px;
            height: 60px;
        }

        #btn-dash:active {
            background: rgba(99, 102, 241, 0.4);
            border-color: #6366f1;
        }

        #joystick-zone {
            position: absolute;
            bottom: 30px;
            left: 30px;
            width: 150px;
            height: 150px;
            background: rgba(12, 24, 18, 0.42);
            border-radius: 50%;
            pointer-events: auto;
            border: 1px dashed rgba(255, 255, 255, 0.25);
            box-shadow: inset 0 0 24px rgba(125, 223, 139, 0.08), 0 16px 36px rgba(0, 0, 0, 0.28);
        }

        #joystick-knob {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 60px;
            height: 60px;
            background: rgba(125, 223, 139, 0.72);
            border-radius: 50%;
            pointer-events: none;
        }

        /* Settings Bindings */
        .btn-bind {
            background: rgba(51, 65, 85, 0.9);
            border: 1px solid rgba(125, 223, 139, 0.22);
            color: #fff;
            padding: 5px 10px;
            border-radius: 8px;
            cursor: pointer;
            min-width: 80px;
            text-align: center;
            font-weight: bold;
        }

        .btn-bind:hover {
            background: #475569;
        }

        .btn-bind.listening {
            background: #eab308;
            color: #000;
            animation: blink 1s infinite;
        }

        @keyframes blink {
            50% {
                opacity: 0.5;
            }
        }

        #hud-edit-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            z-index: 60;
            pointer-events: none;
            justify-content: center;
            align-items: flex-start;
            padding-top: 20px;
        }

        .hud-editable {
            border: 2px dashed #eab308 !important;
            background: rgba(234, 179, 8, 0.2) !important;
            cursor: move;
        }

        @media (max-width: 720px) {
            #ui-layer {
                top: 10px;
                left: 10px;
                max-width: calc(100vw - 20px);
                padding: 10px 12px;
            }

            #ui-layer h1 {
                font-size: 1rem;
            }

            #ui-layer p {
                font-size: 0.88rem;
            }

            #charge-bar-container {
                width: 120px;
            }

            #boss-hp-container {
                top: 14px;
                width: min(360px, calc(100vw - 32px));
            }

            #hub-preview {
                left: 10px;
                right: auto;
                bottom: 10px;
                width: calc(100vw - 20px);
                padding: 12px;
            }

            #dim-alert {
                font-size: clamp(1.8rem, 10vw, 3rem);
                white-space: normal;
                width: calc(100vw - 28px);
            }
        }
