        /* ── Reset ───────────────────────────────────────────────────────────────── */
        *,
        *::before,
        *::after {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        :root {
            --bg: #080c14;
            --surface: #0f1520;
            --card: #141d2e;
            --border: #1e2d47;
            --green: #22c55e;
            --red: #ef4444;
            --gray: #64748b;
            --text: #e2e8f0;
            --muted: #64748b;
            --accent: #6366f1;
            --accent2: #818cf8;
        }

        html,
        body {
            height: 100%;
            background: radial-gradient(circle at top right, #1e293b, #080c14);
            color: var(--text);
            font-family: 'Inter', system-ui, sans-serif;
            overflow-x: hidden;
            position: relative;
        }

        body::before {
            content: "";
            position: fixed;
            inset: 0;
            background: 
                radial-gradient(circle at 20% 30%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
                radial-gradient(circle at 80% 70%, rgba(34, 197, 94, 0.1) 0%, transparent 40%);
            z-index: -1;
            pointer-events: none;
            animation: bgPulse 10s ease-in-out infinite alternate;
        }

        @keyframes bgPulse {
            0% { opacity: 0.5; transform: scale(1); }
            100% { opacity: 1; transform: scale(1.1); }
        }

        /* ── Screens ─────────────────────────────────────────────────────────────── */
        .screen {
            position: fixed;
            inset: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            transition: opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1), transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
            background: transparent;
            /* Asegura que cada pantalla sea transparente para ver el fondo global */
        }

        .hidden {
            display: none !important;
            opacity: 0;
            pointer-events: none;
            transform: scale(.97);
        }

        .screen.slide-left {
            transform: translateX(-60px);
        }

        .screen.slide-right {
            transform: translateX(60px);
        }

        /* ── Particles (decorative background dots) ─────────────────────────────── */
        #particles {
            position: fixed;
            inset: 0;
            overflow: hidden;
            pointer-events: none;
            z-index: 0;
        }

        .particle {
            position: absolute;
            border-radius: 50%;
            animation: float linear infinite;
            opacity: 0;
        }

        @keyframes float {
            0% {
                transform: translateY(100vh) scale(0);
                opacity: 0;
            }

            10% {
                opacity: .6;
            }

            90% {
                opacity: .4;
            }

            100% {
                transform: translateY(-20px) scale(1.2);
                opacity: 0;
            }
        }

        /* ── Main Menu ───────────────────────────────────────────────────────────── */
        #menu {
            z-index: 10;
            gap: 2.5rem;
            background: rgba(8, 12, 20, 0.4); /* Make background transparent to see particles and sim */
            backdrop-filter: blur(2px);
        }

        .logo-big {
            text-align: center;
        }

        .logo-big .icon {
            font-size: 4rem;
            display: block;
            margin-bottom: .5rem;
            filter: drop-shadow(0 0 20px rgba(99, 102, 241, .7));
        }

        .logo-big h1 {
            font-size: 3.6rem;
            font-weight: 900;
            letter-spacing: -.04em;
            background: linear-gradient(135deg, #a5b4fc, #6366f1, #818cf8);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            text-shadow: none;
        }

        .logo-big p {
            color: var(--muted);
            margin-top: .4rem;
            font-size: 1rem;
            letter-spacing: .04em;
            text-transform: uppercase;
        }

        .menu-cards {
            display: flex;
            gap: 1.25rem;
            flex-wrap: wrap;
            justify-content: center;
            width: 100%;
            max-width: 800px;
        }

        .menu-card {
            width: 220px;
            padding: 2rem 1.5rem;
            border-radius: 1.25rem;
            background: var(--card);
            border: 1px solid var(--border);
            cursor: pointer;
            text-align: center;
            transition: transform .2s, box-shadow .2s, border-color .2s;
            position: relative;
            overflow: hidden;
        }

        .menu-card::before {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(135deg, rgba(99, 102, 241, .08), transparent);
            opacity: 0;
            transition: opacity .2s;
        }

        .menu-card:hover {
            transform: translateY(-6px);
            border-color: var(--accent);
            box-shadow: 0 12px 40px rgba(99, 102, 241, .25);
        }

        .menu-card:hover::before {
            opacity: 1;
        }

        .menu-card:active {
            transform: translateY(-2px);
        }

        .menu-card .card-icon {
            font-size: 2.5rem;
            margin-bottom: 1rem;
            display: block;
        }

        .menu-card h2 {
            font-size: 1.1rem;
            font-weight: 700;
            margin-bottom: .4rem;
        }

        .menu-card p {
            font-size: .8rem;
            color: var(--muted);
            line-height: 1.5;
        }

        /* ── Config Screen ───────────────────────────────────────────────────────── */
        #config {
            z-index: 10;
            gap: 2rem;
            padding: 2rem;
        }

        .config-panel {
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 1.5rem;
            padding: 2.5rem;
            width: 100%;
            max-width: 520px;
            box-shadow: 0 0 60px rgba(99, 102, 241, .1);
        }

        .config-panel h2 {
            font-size: 1.5rem;
            font-weight: 800;
            margin-bottom: .25rem;
        }

        .config-panel .sub {
            color: var(--muted);
            font-size: .85rem;
            margin-bottom: 2rem;
        }

        .param-group {
            display: flex;
            flex-direction: column;
            gap: 1.25rem;
            margin-bottom: 2rem;
        }

        .param {
            display: flex;
            flex-direction: column;
            gap: .5rem;
        }

        .param-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .param-label {
            font-size: .9rem;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: .5rem;
        }

        .param-dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            flex-shrink: 0;
        }

        .param-dot.green {
            background: var(--green);
            box-shadow: 0 0 6px var(--green);
        }

        .param-dot.red {
            background: var(--red);
            box-shadow: 0 0 6px var(--red);
        }

        .param-dot.gray {
            background: var(--gray);
            border-radius: 2px;
        }

        .param-value {
            font-size: 1.1rem;
            font-weight: 700;
            min-width: 2.5rem;
            text-align: right;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: .4rem;
            padding: .1rem .5rem;
        }

        .param-value.green {
            color: var(--green);
        }

        .param-value.red {
            color: var(--red);
        }

        .param-value.gray {
            color: var(--gray);
        }

        input[type=range] {
            width: 100%;
            height: 5px;
            border-radius: 999px;
            outline: none;
            border: none;
            cursor: pointer;
            -webkit-appearance: none;
            appearance: none;
            background: var(--border);
        }

        input[type=range].green::-webkit-slider-thumb {
            background: var(--green);
            box-shadow: 0 0 8px var(--green);
        }

        input[type=range].red::-webkit-slider-thumb {
            background: var(--red);
            box-shadow: 0 0 8px var(--red);
        }

        input[type=range].gray::-webkit-slider-thumb {
            background: var(--gray);
        }

        input[type=range]::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            cursor: pointer;
            transition: transform .1s;
        }

        input[type=range]::-webkit-slider-thumb:hover {
            transform: scale(1.25);
        }

        input[type=range].green {
            background: linear-gradient(to right, var(--green) var(--pct, 50%), var(--border) var(--pct, 50%));
        }

        input[type=range].red {
            background: linear-gradient(to right, var(--red) var(--pct, 50%), var(--border) var(--pct, 50%));
        }

        input[type=range].gray {
            background: linear-gradient(to right, var(--gray) var(--pct, 50%), var(--border) var(--pct, 50%));
        }

        .config-actions {
            display: flex;
            gap: .75rem;
        }

        /* ── Game Screen ─────────────────────────────────────────────────────────── */
        #game {
            z-index: 10;
            gap: 1rem;
            justify-content: flex-start;
            padding: 1.5rem 1rem 2rem;
            overflow-y: auto;
        }

        .game-header {
            display: flex;
            align-items: center;
            gap: 1rem;
            width: 100%;
            max-width: 1020px;
        }

        .btn-back {
            background: var(--card);
            border: 1px solid var(--border);
            color: var(--text);
            border-radius: .6rem;
            padding: .45rem .9rem;
            font-family: inherit;
            font-size: .85rem;
            font-weight: 600;
            cursor: pointer;
            transition: background .15s, border-color .15s;
            flex-shrink: 0;
        }

        .btn-back:hover {
            background: var(--border);
            border-color: var(--accent);
        }

        .stats-bar {
            display: flex;
            gap: 1.25rem;
            flex-wrap: wrap;
            align-items: center;
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 1rem;
            padding: .6rem 1.2rem;
            flex: 1;
        }

        .stat {
            display: flex;
            align-items: center;
            gap: .45rem;
            font-size: .85rem;
        }

        .stat-dot {
            width: 9px;
            height: 9px;
            border-radius: 50%;
        }

        .stat-dot.green {
            background: var(--green);
            box-shadow: 0 0 5px var(--green);
        }

        .stat-dot.red {
            background: var(--red);
            box-shadow: 0 0 5px var(--red);
        }

        .stat-dot.gray {
            background: var(--gray);
            border-radius: 2px;
        }

        .stat-label {
            color: var(--muted);
        }

        .stat-value {
            font-weight: 700;
        }

        .stat-value.green {
            color: var(--green);
        }

        .stat-value.red {
            color: var(--red);
        }

        .game-controls {
            display: flex;
            gap: .6rem;
            flex-shrink: 0;
        }

        .canvas-wrapper {
            border-radius: .75rem;
            overflow: hidden;
            border: 1.5px solid var(--border);
            box-shadow: 0 0 50px rgba(99, 102, 241, .1);
            flex-shrink: 0;
        }

        canvas {
            display: block;
        }

        /* ── Info Screen (Mini-juego) ────────────────────────────────────────────── */
        #info {
            z-index: 10;
            gap: 0;
            padding: 0;
            justify-content: flex-start;
        }

        .info-header {
            display: flex;
            align-items: center;
            gap: 1rem;
            width: 100%;
            padding: .8rem 1rem;
            background: var(--surface);
            border-bottom: 1px solid var(--border);
            flex-shrink: 0;
        }

        .info-header h2 {
            font-size: 1.1rem;
            font-weight: 800;
            flex: 1;
        }

        .info-hud {
            display: flex;
            gap: 1rem;
            align-items: center;
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: .75rem;
            padding: .35rem .9rem;
            font-size: .8rem;
        }

        .hud-item {
            display: flex;
            align-items: center;
            gap: .4rem;
        }

        .hud-label {
            color: var(--muted);
        }

        .hud-val {
            font-weight: 700;
        }

        .hud-val.green {
            color: var(--green);
        }

        .hud-val.red {
            color: var(--red);
        }

        .hud-val.yellow {
            color: #facc15;
        }

        .health-bar-wrap {
            width: 90px;
            height: 10px;
            background: var(--border);
            border-radius: 999px;
            overflow: hidden;
        }

        .health-bar-inner {
            height: 100%;
            border-radius: 999px;
            transition: width .2s;
        }

        .health-bar-inner.green {
            background: var(--green);
            box-shadow: 0 0 6px var(--green);
        }

        .health-bar-inner.red {
            background: var(--red);
            box-shadow: 0 0 6px var(--red);
        }

        .health-bar-inner.blue {
            background: #3b82f6;
            box-shadow: 0 0 6px #3b82f6;
        }

        #arc-levelup-overlay {
            position: absolute;
            inset: 0;
            background: rgba(8, 12, 20, 0.85);
            z-index: 20;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            transition: opacity .2s;
            backdrop-filter: blur(4px);
        }

        #arc-levelup-overlay.hidden {
            opacity: 0;
            pointer-events: none;
        }

        .powerup-cards {
            display: flex;
            gap: 1.25rem;
            margin-top: 1.5rem;
            flex-wrap: wrap;
            justify-content: center;
            max-width: 640px;
        }

        .powerup-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 1rem;
            padding: 1.5rem 1rem;
            width: 170px;
            text-align: center;
            cursor: pointer;
            transition: transform .2s, border-color .2s, box-shadow .2s;
        }

        .powerup-card:hover {
            transform: translateY(-8px);
            border-color: var(--accent);
            box-shadow: 0 12px 30px rgba(99, 102, 241, .3);
        }

        .powerup-card .icon {
            font-size: 2.5rem;
            margin-bottom: .75rem;
            display: block;
        }

        .powerup-card h3 {
            font-size: 1.05rem;
            font-weight: 700;
            margin-bottom: .4rem;
            color: var(--text);
        }

        .powerup-card p {
            font-size: .8rem;
            color: var(--muted);
            line-height: 1.4;
        }

        #arcadeCanvas {
            display: block;
            cursor: crosshair;
            flex: 1;
            width: 100%;
        }

        .controls-hint {
            font-size: .72rem;
            color: var(--muted);
            text-align: center;
            padding: .4rem;
            background: var(--surface);
            border-top: 1px solid var(--border);
            flex-shrink: 0;
        }

        /* ── Shop Screen ────────────────────────────────────────────────────────── */
        .shop-container {
            width: 100%;
            max-width: 900px;
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 2rem;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            box-shadow: 0 0 80px rgba(99, 102, 241, .15);
        }

        .shop-header {
            padding: 1.5rem 2rem;
            background: var(--surface);
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            gap: 1.5rem;
        }

        .shop-title h2 {
            font-size: 1.4rem;
            font-weight: 800;
        }

        .shop-title p {
            color: var(--muted);
            font-size: .85rem;
        }

        .money-display {
            margin-left: auto;
            background: rgba(250, 204, 21, 0.1);
            border: 1px solid rgba(250, 204, 21, 0.3);
            padding: .5rem 1.25rem;
            border-radius: 999px;
            display: flex;
            align-items: center;
            gap: .6rem;
            font-weight: 700;
            color: #facc15;
            font-size: 1.1rem;
        }

        .shop-content {
            display: flex;
            gap: 2rem;
            padding: 2rem;
            flex: 1;
            overflow: hidden;
        }

        .shop-sidebar {
            width: 320px;
            display: flex;
            flex-direction: column;
            gap: 1.5rem;
        }

        .preview-panel {
            width: 100%;
            display: flex;
            flex-direction: column;
            gap: 1.5rem;
        }

        .chests-section {
            padding: 0 2rem 1.5rem;
        }

        .chests-section h3 {
            font-size: 0.85rem;
            color: var(--muted);
            margin-bottom: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .chests-section h3::after {
            content: '';
            flex: 1;
            height: 1px;
            background: linear-gradient(to right, var(--border), transparent);
        }

        .chests-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 1rem;
        }

        .chest-slot {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 1.25rem;
            padding: 0.75rem 1rem;
            display: flex;
            align-items: center;
            gap: 1rem;
            min-height: 80px;
            position: relative;
            transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
            cursor: default;
        }

        .chest-slot:not(.empty):hover {
            border-color: var(--accent);
            box-shadow: 0 8px 20px rgba(99, 102, 2 indigo, 0.15);
            transform: translateY(-3px);
        }

        .chest-slot.empty {
            border-style: dashed;
            justify-content: center;
            color: var(--muted);
            font-size: 0.75rem;
            opacity: 0.6;
        }

        .chest-icon {
            font-size: 2.2rem;
            width: 55px;
            height: 55px;
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 1rem;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            transition: transform 0.3s;
        }

        .chest-slot:not(.empty):hover .chest-icon {
            transform: scale(1.1) rotate(5deg);
        }

        .chest-info {
            display: flex;
            flex-direction: column;
            gap: 2px;
            text-align: left;
            flex: 1;
        }

        .chest-name {
            font-size: 0.85rem;
            font-weight: 800;
            color: var(--text);
        }

        .chest-timer {
            font-size: 0.75rem;
            color: var(--accent2);
            font-family: 'JetBrains Mono', monospace;
            font-weight: 600;
        }

        .btn-chest {
            padding: 0.5rem 1rem;
            font-size: 0.75rem;
            border-radius: 0.75rem;
            border: none;
            background: var(--accent);
            color: white;
            cursor: pointer;
            font-weight: 800;
            transition: all 0.2s;
            box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
        }

        .btn-chest:hover:not(:disabled) {
            transform: scale(1.05);
            filter: brightness(1.1);
        }

        .btn-chest:disabled {
            background: var(--border);
            color: var(--muted);
            cursor: not-allowed;
            box-shadow: none;
        }

        /* ── Reward Overlay ──────────────────────────────────────────────────────── */
        #reward-overlay {
            z-index: 100;
            background: rgba(8, 12, 20, 0.95);
            backdrop-filter: blur(10px);
        }

        .reward-content {
            background: var(--card);
            border: 2px solid var(--accent);
            border-radius: 2.5rem;
            padding: 3rem;
            width: 100%;
            max-width: 450px;
            text-align: center;
            position: relative;
            overflow: hidden;
            box-shadow: 0 0 100px rgba(99, 102, 241, 0.4);
            animation: reward-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }

        @keyframes reward-pop {
            from {
                transform: scale(0.8);
                opacity: 0;
            }

            to {
                transform: scale(1);
                opacity: 1;
            }
        }

        .reward-glow {
            position: absolute;
            inset: 0;
            background: radial-gradient(circle at center, rgba(99, 102, 241, 0.2), transparent 70%);
            pointer-events: none;
        }

        .reward-chest-anim {
            font-size: 5rem;
            margin-bottom: 1.5rem;
            animation: chest-bounce 2s infinite ease-in-out;
            display: inline-block;
        }

        @keyframes chest-bounce {

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

            50% {
                transform: translateY(-15px) rotate(5deg);
            }
        }

        .reward-content h2 {
            font-size: 2rem;
            font-weight: 900;
            margin-bottom: 1.5rem;
            background: linear-gradient(135deg, #fff, var(--accent2));
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .reward-list {
            display: flex;
            flex-direction: column;
            gap: 0.8rem;
            margin-bottom: 2rem;
        }

        .reward-item {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 1rem;
            padding: 0.8rem 1.2rem;
            font-weight: 700;
            font-size: 1.1rem;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.75rem;
            animation: item-slide 0.4s both;
        }

        @keyframes item-slide {
            from {
                opacity: 0;
                transform: translateX(-20px);
            }

            to {
                opacity: 1;
                transform: translateX(0);
            }
        }

        .reward-item:nth-child(2) {
            animation-delay: 0.1s;
        }

        .reward-item:nth-child(3) {
            animation-delay: 0.2s;
        }

        .reward-item:nth-child(4) {
            animation-delay: 0.3s;
        }

        .chest-opening {
            animation: chest-shake 0.5s infinite;
        }

        @keyframes chest-shake {
            0% {
                transform: translate(0) rotate(0);
            }

            25% {
                transform: translate(2px, -2px) rotate(2deg);
            }

            50% {
                transform: translate(-2px, 2px) rotate(-2deg);
            }

            75% {
                transform: translate(2px, 2px) rotate(2deg);
            }

            100% {
                transform: translate(0) rotate(0);
            }
        }

        .shop-main-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 1.5rem;
            overflow: hidden;
        }

        .tabs-header {
            display: flex;
            gap: 1rem;
            border-bottom: 1px solid var(--border);
            padding-bottom: 0.5rem;
        }

        .tab-btn {
            background: none;
            border: none;
            color: var(--muted);
            font-weight: 700;
            cursor: pointer;
            padding: 0.5rem 1rem;
            border-radius: 0.5rem;
            transition: all 0.2s;
        }

        .tab-btn:hover {
            color: var(--text);
            background: var(--surface);
        }

        .tab-btn.active {
            color: var(--accent2);
            background: rgba(99, 102, 241, 0.1);
        }

        .tab-content {
            display: none;
            flex: 1;
            overflow-y: auto;
            padding-right: 0.5rem;
        }

        .tab-content.active {
            display: block;
        }

        /* Customize Scrollbar for shop */
        .tab-content::-webkit-scrollbar {
            width: 6px;
        }

        .tab-content::-webkit-scrollbar-track {
            background: var(--bg);
        }

        .tab-content::-webkit-scrollbar-thumb {
            background: var(--border);
            border-radius: 3px;
        }

        .upgrades-grid,
        .skins-grid,
        .powers-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
            gap: 1rem;
        }

        .skin-card,
        .power-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 1.25rem;
            padding: 1.25rem;
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
            transition: all 0.2s;
            cursor: pointer;
            position: relative;
        }

        .skin-card:hover,
        .power-card:hover {
            border-color: var(--accent);
            transform: translateY(-2px);
        }

        .skin-card.selected,
        .power-card.selected {
            border-color: var(--green);
            background: rgba(34, 197, 94, 0.05);
        }

        .skin-preview {
            width: 100%;
            height: 100px;
            background: var(--bg);
            border-radius: 0.75rem;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .skin-dot {
            width: 40px;
            height: 40px;
            border-radius: 50%;
        }

        .check-badge {
            position: absolute;
            top: 0.5rem;
            right: 0.5rem;
            background: var(--green);
            color: white;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.7rem;
        }

        .preview-box {
            aspect-ratio: 1;
            background: var(--bg);
            border: 2px solid var(--border);
            border-radius: 1.25rem;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            overflow: hidden;
        }

        #charPreview {
            width: 100%;
            height: 100%;
        }

        .hero-stats {
            background: var(--surface);
            border-radius: 1rem;
            padding: 1rem;
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: .75rem;
            font-size: .85rem;
            border: 1px solid var(--border);
        }

        .hero-stat {
            display: flex;
            flex-direction: column;
        }

        .hero-stat span {
            color: var(--muted);
            font-size: .75rem;
        }

        .hero-stat strong {
            color: var(--accent2);
        }

        .up-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 1.25rem;
            padding: 1.25rem;
            display: flex;
            flex-direction: column;
            gap: .75rem;
            transition: border-color .2s, transform .2s;
        }

        .up-card:hover {
            border-color: var(--accent);
            transform: translateY(-2px);
        }

        .up-header {
            display: flex;
            align-items: center;
            gap: .75rem;
        }

        .up-icon {
            font-size: 1.5rem;
            width: 40px;
            height: 40px;
            background: var(--border);
            border-radius: .75rem;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .up-title h3 {
            font-size: .95rem;
            font-weight: 700;
        }

        .up-title p {
            font-size: .75rem;
            color: var(--muted);
        }

        .up-level {
            display: flex;
            gap: 4px;
        }

        .lvl-dot {
            width: 8px;
            height: 8px;
            background: var(--border);
            border-radius: 50%;
        }

        .lvl-dot.active {
            background: var(--accent);
            box-shadow: 0 0 5px var(--accent);
        }

        .up-buy {
            margin-top: auto;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .btn-buy {
            background: var(--accent);
            color: white;
            border: none;
            padding: .4rem .8rem;
            border-radius: .5rem;
            font-size: .8rem;
            font-weight: 700;
            cursor: pointer;
            transition: opacity .2s, transform .1s;
        }

        .btn-buy:disabled {
            background: var(--border);
            color: var(--muted);
            cursor: not-allowed;
        }

        .btn-buy:not(:disabled):hover {
            opacity: .9;
            transform: scale(1.05);
        }

        .price {
            font-weight: 700;
            color: #facc15;
            font-size: .9rem;
        }

        .shop-footer {
            padding: 1.5rem 2rem;
            background: var(--surface);
            border-top: 1px solid var(--border);
            display: flex;
            justify-content: center;
        }

        .btn-large {
            width: 100%;
            max-width: 400px;
            padding: 1rem;
            font-size: 1.1rem;
            text-transform: uppercase;
            letter-spacing: .05em;
        }

        @media (max-width: 768px) {
            .shop-content {
                flex-direction: column;
                align-items: center;
            }

            .preview-panel {
                width: 100%;
                max-width: 300px;
            }

            .upgrades-grid {
                grid-template-columns: 1fr;
                width: 100%;
            }
        }

        /* ── Shared Buttons ──────────────────────────────────────────────────────── */
        .btn {
            display: inline-flex;
            align-items: center;
            gap: .4rem;
            padding: .65rem 1.4rem;
            border-radius: .65rem;
            font-family: inherit;
            font-size: .9rem;
            font-weight: 700;
            cursor: pointer;
            border: none;
            transition: transform .1s, box-shadow .2s, background .15s, opacity .15s;
        }

        .btn:active {
            transform: scale(.96);
        }

        .btn-primary {
            background: linear-gradient(135deg, #6366f1, #818cf8);
            color: #fff;
            box-shadow: 0 4px 20px rgba(99, 102, 241, .4);
        }

        .btn-primary:hover {
            box-shadow: 0 6px 28px rgba(99, 102, 241, .6);
        }

        .btn-secondary {
            background: var(--surface);
            color: var(--text);
            border: 1px solid var(--border);
        }

        .btn-secondary:hover {
            background: var(--border);
        }

        .btn-danger {
            background: rgba(239, 68, 68, .15);
            color: var(--red);
            border: 1px solid rgba(239, 68, 68, .3);
        }

        .btn-danger:hover {
            background: rgba(239, 68, 68, .25);
        }

        /* ── Leaderboard Screen ────────────────────────────────────────────────── */
        #leaderboard {
            position: fixed;
            inset: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 100;
            padding: 2rem;
            background: var(--bg);
        }

        .leaderboard-container {
            width: 100%;
            max-width: 800px;
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 2rem;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            box-shadow: 0 0 80px rgba(99, 102, 241, 0.15);
            animation: fadeInScale 0.4s ease-out;
            margin: auto;
        }

        @keyframes fadeInScale {
            from {
                opacity: 0;
                transform: scale(0.95);
            }

            to {
                opacity: 1;
                transform: scale(1);
            }
        }

        .leaderboard-header {
            padding: 1.5rem 2rem;
            background: var(--surface);
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            gap: 1.5rem;
        }

        .leaderboard-title h2 {
            font-size: 1.6rem;
            font-weight: 900;
            background: linear-gradient(135deg, #fbbf24, #f59e0b);
            background-clip: text;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            margin: 0;
        }

        .leaderboard-content {
            padding: 1.5rem 2rem;
            max-height: 400px;
            overflow-y: auto;
        }

        .leaderboard-table {
            width: 100%;
            border-collapse: separate;
            border-spacing: 0 0.5rem;
        }

        .leaderboard-table th {
            text-align: left;
            padding: 1rem;
            color: var(--muted);
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 0.1em;
        }

        .leaderboard-table tr {
            background: var(--surface);
            transition: transform 0.2s;
        }

        .leaderboard-table td {
            padding: 1rem;
            border-top: 1px solid var(--border);
            border-bottom: 1px solid var(--border);
        }

        .leaderboard-table td:first-child {
            border-left: 1px solid var(--border);
            border-top-left-radius: 0.75rem;
            border-bottom-left-radius: 0.75rem;
            font-weight: 800;
            width: 70px;
        }

        .leaderboard-table td:last-child {
            border-right: 1px solid var(--border);
            border-top-right-radius: 0.75rem;
            border-bottom-right-radius: 0.75rem;
            text-align: right;
            color: #facc15;
            font-weight: 700;
        }

        /* Top 3 styles */
        .leaderboard-table tr:nth-child(1) td:first-child {
            color: #fbbf24;
            font-size: 1.25rem;
        }

        .leaderboard-table tr:nth-child(2) td:first-child {
            color: #94a3b8;
            font-size: 1.15rem;
        }

        .leaderboard-table tr:nth-child(3) td:first-child {
            color: #b45309;
            font-size: 1.05rem;
        }

        .leaderboard-table tr:hover {
            transform: scale(1.01);
            background: var(--border);
        }

        .user-best-section {
            padding: 1.5rem 2rem;
            background: var(--surface);
            border-top: 1px solid var(--border);
            text-align: center;
        }

        .user-best-section p {
            font-size: 0.8rem;
            color: var(--muted);
            margin-bottom: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }

        .user-best-card {
            background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
            border: 2px solid var(--accent);
            border-radius: 1.25rem;
            padding: 1.2rem 2rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
            animation: pulseGlow 2s infinite alternate;
        }

        @keyframes pulseGlow {
            from {
                box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
            }

            to {
                box-shadow: 0 0 30px rgba(99, 102, 241, 0.5);
            }
        }

        .user-best-card .user-info {
            display: flex;
            align-items: center;
            gap: 1rem;
            font-weight: 700;
            font-size: 1.1rem;
        }

        .user-best-card .user-score {
            font-size: 1.6rem;
            font-weight: 900;
            color: #facc15;
        }

        /* ── Arcade Overlays ───────────────────────────────────────────────────── */
        #arc-pause-overlay, #arc-death-overlay {
            position: absolute;
            inset: 0;
            z-index: 50;
            display: flex;
            align-items: center;
            justify-content: center;
            backdrop-filter: blur(8px);
            background: rgba(8, 12, 20, 0.75);
            animation: fadeIn 0.3s ease-out;
        }

        .overlay-content {
            background: var(--card);
            border: 2px solid var(--border);
            border-radius: 2rem;
            padding: 3rem;
            text-align: center;
            max-width: 500px;
            width: 90%;
            box-shadow: 0 20px 50px rgba(0,0,0,0.5);
        }

        .overlay-content h2 {
            font-size: 2.2rem;
            font-weight: 900;
            margin-bottom: 2rem;
            color: var(--text);
        }

        .overlay-actions {
            display: flex;
            gap: 1rem;
            justify-content: center;
        }

        .overlay-actions.vertical {
            flex-direction: column;
        }

        .pause-powers {
            margin-bottom: 2rem;
            background: var(--surface);
            padding: 1.5rem;
            border-radius: 1.25rem;
            border: 1px solid var(--border);
        }

        .pause-powers h3 {
            font-size: 0.9rem;
            color: var(--muted);
            text-transform: uppercase;
            margin-bottom: 1rem;
            letter-spacing: 0.1em;
        }

        .pause-power-list {
            display: flex;
            flex-wrap: wrap;
            gap: 0.75rem;
            justify-content: center;
        }

        .pause-power-item {
            background: var(--card);
            border: 1px solid var(--border);
            padding: 0.5rem 1rem;
            border-radius: 999px;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-size: 0.9rem;
        }

        .death-icon {
            font-size: 4rem;
            margin-bottom: 1rem;
            filter: drop-shadow(0 0 15px var(--red));
        }

        .overlay-content.death h2 {
            color: var(--red);
            margin-bottom: 0.5rem;
        }

        #death-stats {
            font-size: 1.2rem;
            color: var(--muted);
            margin-bottom: 1rem;
        }

        .death-highscore {
            background: rgba(250, 204, 21, 0.15);
            color: #facc15;
            padding: 0.5rem 1.5rem;
            border-radius: 999px;
            font-weight: 800;
            margin-bottom: 2.5rem;
            display: inline-block;
            border: 1px solid #facc15;
            animation: pulse 1.5s infinite;
        }

        @keyframes pulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.05); }
            100% { transform: scale(1); }
        }

        .btn-large {
            padding: 1rem 2rem;
            font-size: 1.1rem;
            font-weight: 800;
        }

        /* ── Transitions & Menu Sim Canvas ────────────────────────────────────────── */
        #menu-sim-canvas {
            position: fixed;
            inset: 0;
            width: 100%;
            height: 100%;
            z-index: 1; /* Detrás del menú (z-index: 10) pero delante de particles (0) */
            opacity: 0.25; 
            pointer-events: none;
        }

        #transition-overlay {
            position: fixed;
            inset: 0;
            z-index: 1000;
            background: rgba(8, 12, 20, 0.9);
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            pointer-events: all;
        }

        .transition-character {
            position: absolute;
            top: 50%;
            left: -150px; /* starts offscreen left */
            transform: translate(-50%, -50%);
            width: 80px;
            height: 80px;
            background: var(--green);
            border-radius: 50%;
            box-shadow: 0 0 20px var(--green);
            /* Apariencia de jugador de arco */
        }
        .transition-character::after {
            content: '';
            position: absolute;
            right: -20px;
            top: 50%;
            transform: translateY(-50%);
            width: 40px;
            height: 15px;
            background: #cbd5e1;
            border-radius: 4px;
        }

        .transition-projectile {
            position: absolute;
            left: calc(40% + 60px); /* 40% + 40px (half char) + 20px (weapon) */
            top: 50%;
            transform: translateY(-50%);
            width: 0;
            height: 40px;
            background: linear-gradient(90deg, transparent, #fbbf24, #fff);
            box-shadow: 0 0 40px #fbbf24;
            border-radius: 20px;
            opacity: 0;
            pointer-events: none;
            z-index: 1001;
        }

        .transition-flash {
            position: absolute;
            inset: 0;
            background: #fff;
            opacity: 0;
            pointer-events: none;
            z-index: 1002;
        }

        /* Animaciones disparadas por JS al padre #transition-overlay */
        #transition-overlay.animating {
            display: block; /* Asegura que ignora .hidden si se la quitan pero igual lo configuramos en JS */
        }

        #transition-overlay.animating .transition-character {
            animation: slideInCharLeft 1s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }

        #transition-overlay.animating .transition-projectile {
            animation: shootLaser 0.6s 0.4s forwards cubic-bezier(0.25, 1, 0.5, 1);
        }

        #transition-overlay.animating .transition-flash {
            animation: ultimateFlash 0.5s 0.5s forwards ease-in-out;
        }

        @keyframes slideInCharLeft {
            0% { left: -150px; }
            30% { left: 40%; }
            80% { left: 40%; }
            100% { left: -150px; }
        }

        @keyframes shootLaser {

            0% { opacity: 1; width: 0; transform: translateY(-50%) translateX(0); }
            50% { opacity: 1; width: 100vw; transform: translateY(-50%) translateX(0); }
            100% { opacity: 0; width: 100vw; transform: translateY(-50%) translateX(100vw); }
        }

        @keyframes ultimateFlash {
            0% { opacity: 0; }
            50% { opacity: 1; }
            100% { opacity: 0; }
        }
