        @import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Inter:wght@400;500;600;700&display=swap');

        :root {
            --bg-void: #060a12;
            --bg-panel: rgba(12, 18, 35, 0.95);
            --bg-card: rgba(16, 24, 45, 0.9);
            --gold: #f5c842;
            --gold-dim: #c49a2a;
            --teal: #00e5cc;
            --teal-dim: #00a896;
            --red: #ff4757;
            --red-dim: #c0392b;
            --green: #2ecc71;
            --purple: #9b59b6;
            --wall-face: #8B1A1A;
            --wall-top: #6B3838;
            --wall-inner: #4a7c2f;
            --text-hi: #f0f4ff;
            --text-lo: #5a6a8a;
            --border: rgba(255, 255, 255, 0.06);
            --shadow-deep: 0 20px 60px rgba(0, 0, 0, 0.8);
            --safe-bottom: env(safe-area-inset-bottom, 0px);
        }

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

        html,
        body {
            width: 100%;
            height: 100%;
            overflow: hidden;
        }

        body {
            background: var(--bg-void);
            min-height: 100vh;
            min-height: 100dvh;
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: 'Inter', sans-serif;
            user-select: none;
            -webkit-user-select: none;
            -webkit-tap-highlight-color: transparent;
            -webkit-touch-callout: none;
            -webkit-overscroll-behavior: none;
            overscroll-behavior: none;
            position: relative;
        }

        body::before {
            content: '';
            position: fixed;
            inset: 0;
            background-image:
                linear-gradient(rgba(0, 229, 204, 0.03) 1px, transparent 1px),
                linear-gradient(90deg, rgba(0, 229, 204, 0.03) 1px, transparent 1px);
            background-size: 40px 40px;
            animation: gridDrift 20s linear infinite;
            pointer-events: none;
            z-index: 0;
        }

        body::after {
            content: '';
            position: fixed;
            inset: 0;
            background: radial-gradient(ellipse 70% 60% at 50% 50%, transparent 30%, var(--bg-void) 100%);
            pointer-events: none;
            z-index: 0;
        }

        @keyframes gridDrift {
            0% {
                transform: translate(0, 0);
            }

            100% {
                transform: translate(40px, 40px);
            }
        }

        .orb {
            position: fixed;
            border-radius: 50%;
            pointer-events: none;
            z-index: 0;
            animation: orbFloat var(--d, 8s) ease-in-out infinite;
        }

        .orb1 {
            width: 300px;
            height: 300px;
            background: radial-gradient(circle, rgba(0, 229, 204, 0.08) 0%, transparent 70%);
            top: -50px;
            left: -80px;
            --d: 9s;
        }

        .orb2 {
            width: 400px;
            height: 400px;
            background: radial-gradient(circle, rgba(245, 200, 66, 0.06) 0%, transparent 70%);
            bottom: -100px;
            right: -100px;
            --d: 11s;
        }

        .orb3 {
            width: 200px;
            height: 200px;
            background: radial-gradient(circle, rgba(255, 71, 87, 0.06) 0%, transparent 70%);
            top: 50%;
            left: 55%;
            --d: 7s;
        }

        @keyframes orbFloat {

            0%,
            100% {
                transform: translate(0, 0) scale(1);
            }

            50% {
                transform: translate(20px, -20px) scale(1.1);
            }
        }

        #preloader {
            position: fixed;
            inset: 0;
            z-index: 200;
            background: var(--bg-void);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 24px;
            transition: opacity 0.6s ease, visibility 0.6s ease;
            opacity: 1;
            visibility: visible;
            pointer-events: all;
        }

        #preloader.hidden {
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
        }

        #preloader .preloader-bg-grid {
            position: absolute;
            inset: 0;
            background-image:
                linear-gradient(rgba(0, 229, 204, 0.05) 1px, transparent 1px),
                linear-gradient(90deg, rgba(0, 229, 204, 0.05) 1px, transparent 1px);
            background-size: 30px 30px;
            animation: gridDriftFast 8s linear infinite;
            pointer-events: none;
        }

        @keyframes gridDriftFast {
            0% {
                transform: translate(0, 0);
            }

            100% {
                transform: translate(30px, 30px);
            }
        }

        #preloader .preloader-orb {
            position: absolute;
            border-radius: 50%;
            pointer-events: none;
            animation: preOrbPulse 2.5s ease-in-out infinite;
        }

        #preloader .preloader-orb:nth-child(2) {
            width: 250px;
            height: 250px;
            background: radial-gradient(circle, rgba(0, 229, 204, 0.12) 0%, transparent 70%);
            top: 20%;
            left: 15%;
        }

        #preloader .preloader-orb:nth-child(3) {
            width: 300px;
            height: 300px;
            background: radial-gradient(circle, rgba(245, 200, 66, 0.09) 0%, transparent 70%);
            bottom: 15%;
            right: 10%;
            animation-delay: 1.2s;
        }

        @keyframes preOrbPulse {

            0%,
            100% {
                transform: scale(1);
                opacity: 0.6;
            }

            50% {
                transform: scale(1.25);
                opacity: 1;
            }
        }

        .preloader-logo-ring {
            position: relative;
            z-index: 1;
            width: 120px;
            height: 120px;
            border-radius: 50%;
            border: 2px solid rgba(0, 229, 204, 0.3);
            display: flex;
            align-items: center;
            justify-content: center;
            animation: ringRotate 3s linear infinite;
        }

        .preloader-logo-ring::before {
            content: '';
            position: absolute;
            inset: -8px;
            border-radius: 50%;
            border: 1px solid rgba(245, 200, 66, 0.2);
            animation: ringRotate 5s linear infinite reverse;
        }

        .preloader-logo-ring::after {
            content: '';
            position: absolute;
            inset: -18px;
            border-radius: 50%;
            border: 1px dashed rgba(255, 71, 87, 0.15);
            animation: ringRotate 7s linear infinite;
        }

        @keyframes ringRotate {
            0% {
                transform: rotate(0deg);
            }

            100% {
                transform: rotate(360deg);
            }
        }

        .preloader-icon {
            font-size: 48px;
            animation: iconBouncePre 1.5s ease-in-out infinite;
            z-index: 2;
            filter: drop-shadow(0 0 20px rgba(245, 200, 66, 0.7));
        }

        @keyframes iconBouncePre {

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

            40% {
                transform: translateY(-12px) scale(1.08);
            }

            60% {
                transform: translateY(-3px) scale(1.03);
            }
        }

        .preloader-title {
            font-family: 'Orbitron', monospace;
            font-size: 28px;
            font-weight: 900;
            letter-spacing: 6px;
            z-index: 1;
            background: linear-gradient(90deg, var(--teal), var(--gold), var(--teal));
            background-size: 200% 100%;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            animation: shimmerText 2.5s linear infinite;
        }

        @keyframes shimmerText {
            0% {
                background-position: 0% 50%;
            }

            100% {
                background-position: 200% 50%;
            }
        }

        .preloader-loading-bar-wrap {
            width: 200px;
            height: 3px;
            background: rgba(255, 255, 255, 0.08);
            border-radius: 99px;
            overflow: hidden;
            z-index: 1;
        }

        .preloader-loading-bar {
            height: 100%;
            background: linear-gradient(90deg, var(--teal), var(--gold));
            border-radius: 99px;
            animation: loadBar 1.8s ease-in-out forwards;
            box-shadow: 0 0 12px rgba(0, 229, 204, 0.5);
        }

        @keyframes loadBar {
            0% {
                width: 0%;
            }

            30% {
                width: 35%;
            }

            60% {
                width: 65%;
            }

            85% {
                width: 90%;
            }

            100% {
                width: 100%;
            }
        }

        .preloader-status {
            font-family: 'Orbitron', monospace;
            font-size: 10px;
            letter-spacing: 3px;
            color: var(--text-lo);
            z-index: 1;
            animation: statusBlink 0.8s step-end infinite;
        }

        @keyframes statusBlink {

            0%,
            100% {
                opacity: 1;
            }

            50% {
                opacity: 0.3;
            }
        }

        #game-wrapper {
            position: relative;
            z-index: 1;
            display: flex;
            align-items: flex-start;
            gap: 18px;
            padding: 10px;
            max-width: 100vw;
        }

        .side-panel {
            display: flex;
            flex-direction: column;
            gap: 12px;
            width: 160px;
            flex-shrink: 0;
        }

        .stat-block {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 16px;
            display: flex;
            flex-direction: column;
            gap: 6px;
            position: relative;
            overflow: hidden;
            transition: transform 0.2s, box-shadow 0.2s;
        }

        .stat-block::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 2px;
            background: var(--accent);
            box-shadow: 0 0 10px var(--accent);
        }

        .stat-block:hover {
            transform: translateX(3px);
            box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
        }

        .stat-icon-row {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .stat-icon-emoji {
            font-size: 22px;
        }

        .stat-label {
            font-size: 9px;
            text-transform: uppercase;
            letter-spacing: 2.5px;
            color: var(--text-lo);
            font-weight: 600;
        }

        .stat-value {
            font-family: 'Orbitron', monospace;
            font-size: 28px;
            font-weight: 700;
            line-height: 1;
            color: var(--accent);
            text-shadow: 0 0 20px var(--accent);
            transition: all 0.3s;
        }

        .stat-block.score {
            --accent: var(--gold);
        }

        .stat-block.level {
            --accent: var(--teal);
        }

        .stat-block.lives {
            --accent: var(--red);
        }

        #lives-val.pulse {
            animation: heartbeat 0.5s ease-out;
        }

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

            25% {
                transform: scale(1.4);
            }

            50% {
                transform: scale(0.9);
            }

            75% {
                transform: scale(1.2);
            }

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

        .level-bar-wrap {
            background: rgba(255, 255, 255, 0.06);
            border-radius: 99px;
            height: 4px;
            overflow: hidden;
            margin-top: 4px;
        }

        .level-bar {
            height: 100%;
            background: var(--teal);
            box-shadow: 0 0 8px var(--teal);
            border-radius: 99px;
            transition: width 0.5s ease;
        }

        .life-pips {
            display: flex;
            gap: 5px;
            margin-top: 4px;
        }

        .pip {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: var(--red);
            box-shadow: 0 0 8px var(--red);
            transition: all 0.3s;
        }

        .pip.empty {
            background: rgba(255, 255, 255, 0.1);
            box-shadow: none;
        }

        .legend-card {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 14px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin-top: 4px;
        }

        .legend-title {
            font-size: 9px;
            letter-spacing: 2.5px;
            text-transform: uppercase;
            color: var(--text-lo);
            font-weight: 600;
        }

        .legend-row {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 12px;
            color: #8090b0;
        }

        .legend-row span:first-child {
            font-size: 18px;
        }

        .key-chip {
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.12);
            border-radius: 6px;
            padding: 2px 7px;
            font-size: 11px;
            color: #a0b0c8;
            font-family: 'Orbitron', monospace;
            font-weight: 600;
        }

        .canvas-column {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 12px;
        }

        .game-title-bar {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .game-logo-text {
            font-family: 'Orbitron', monospace;
            font-size: 22px;
            font-weight: 900;
            letter-spacing: 4px;
            background: linear-gradient(90deg, var(--teal), var(--gold), var(--teal));
            background-size: 200% 100%;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            animation: shimmerText 3s linear infinite;
        }

        .logo-badge {
            background: var(--red);
            color: white;
            font-size: 9px;
            font-weight: 700;
            letter-spacing: 1.5px;
            padding: 3px 8px;
            border-radius: 99px;
            text-transform: uppercase;
            box-shadow: 0 0 12px var(--red);
        }

        .canvas-frame {
            position: relative;
            border-radius: 20px;
            padding: 3px;
            background: linear-gradient(135deg, var(--teal), transparent, var(--gold), transparent, var(--teal));
            background-size: 300% 300%;
            animation: borderRotate 4s linear infinite;
            box-shadow: 0 0 40px rgba(0, 229, 204, 0.15), var(--shadow-deep);
            flex-shrink: 0;
        }

        @keyframes borderRotate {
            0% {
                background-position: 0% 50%;
            }

            100% {
                background-position: 300% 50%;
            }
        }

        .canvas-inner {
            border-radius: 18px;
            overflow: hidden;
            background: #0a0e1c;
            position: relative;
            line-height: 0;
        }

        canvas {
            display: block;
            image-rendering: pixelated;
            image-rendering: crisp-edges;
            width: 100%;
            height: auto;
            aspect-ratio: 4 / 5;
            max-width: 480px;
            touch-action: manipulation;
        }

        #overlay {
            position: absolute;
            inset: 0;
            background: rgba(6, 10, 18, 0.97);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border-radius: 18px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.35s ease;
            z-index: 10;
            gap: 16px;
            padding: 20px;
        }

        #overlay.active {
            opacity: 1;
            pointer-events: all;
        }

        .overlay-ring {
            position: absolute;
            border-radius: 50%;
            border: 1px solid rgba(0, 229, 204, 0.15);
            animation: ringPulse 3s ease-in-out infinite;
            pointer-events: none;
        }

        @keyframes ringPulse {

            0%,
            100% {
                transform: scale(1);
                opacity: 0.5;
            }

            50% {
                transform: scale(1.05);
                opacity: 1;
            }
        }

        #overlay-icon {
            font-size: 52px;
            animation: iconBounce 1.5s ease-in-out infinite;
            filter: drop-shadow(0 0 20px rgba(245, 200, 66, 0.6));
            z-index: 2;
        }

        @keyframes iconBounce {

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

            50% {
                transform: translateY(-8px) scale(1.05);
            }
        }

        #overlay-title {
            font-family: 'Orbitron', monospace;
            font-size: 30px;
            font-weight: 900;
            letter-spacing: 4px;
            text-transform: uppercase;
            text-align: center;
            line-height: 1.1;
            z-index: 2;
        }

        #overlay-sub {
            font-size: 12px;
            letter-spacing: 5px;
            color: var(--text-lo);
            text-transform: uppercase;
            margin-top: -8px;
            z-index: 2;
            text-align: center;
        }

        .tip-panel {
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid rgba(255, 255, 255, 0.06);
            border-radius: 14px;
            padding: 14px 18px;
            display: flex;
            flex-direction: column;
            gap: 8px;
            z-index: 2;
            max-width: 340px;
            width: 100%;
        }

        .tip-row {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 12px;
            color: #8090b0;
        }

        .tip-row span.ic {
            font-size: 18px;
            flex-shrink: 0;
        }

        .tip-row b {
            color: var(--gold);
            font-weight: 600;
        }

        .btn {
            padding: 14px 38px;
            font-family: 'Orbitron', monospace;
            font-size: 14px;
            font-weight: 700;
            letter-spacing: 2px;
            text-transform: uppercase;
            color: var(--bg-void);
            background: linear-gradient(135deg, var(--teal) 0%, #00b8a0 100%);
            border: 2px solid rgba(255, 255, 255, 0.15);
            border-bottom: 6px solid #008c7c;
            /* 3D bottom edge */
            border-radius: 50px;
            cursor: pointer;
            position: relative;
            overflow: hidden;
            z-index: 2;
            -webkit-tap-highlight-color: transparent;
            touch-action: manipulation;
            min-height: 48px;
            min-width: 180px;
            white-space: nowrap;

            /* 3D Shadow */
            box-shadow:
                0 8px 0 #00796b,
                /* Hard bottom shadow */
                0 12px 24px rgba(0, 0, 0, .35),
                /* Soft drop shadow */
                inset 0 2px 2px rgba(255, 255, 255, .35),
                /* Top highlight */
                inset 0 -2px 3px rgba(0, 0, 0, .15);
            /* Bottom inner shade */

            transition: transform .15s ease, box-shadow .15s ease;
        }

        /* Hover */
        .btn:hover {
            transform: translateY(-2px);
            box-shadow:
                0 10px 0 #00796b,
                0 16px 30px rgba(0, 0, 0, .4),
                inset 0 2px 2px rgba(255, 255, 255, .35),
                inset 0 -2px 3px rgba(0, 0, 0, .15);
        }

        /* Pressed */
        .btn:active {
            transform: translateY(6px);
            border-bottom-width: 2px;
            box-shadow:
                0 2px 0 #00796b,
                0 4px 10px rgba(0, 0, 0, .25),
                inset 0 2px 2px rgba(255, 255, 255, .25);
        }

        .btn:active {
            transform: scale(0.96);
            box-shadow: 0 0 15px rgba(0, 229, 204, 0.3);
            transition: transform 0.08s ease;
        }

        .btn-danger {
            background: linear-gradient(135deg, var(--red) 0%, #c0392b 100%);
            box-shadow: 0 0 30px rgba(255, 71, 87, 0.4), 0 6px 20px rgba(0, 0, 0, 0.4);
            color: white;
        }

        .btn-danger:hover {
            box-shadow: 0 0 50px rgba(255, 71, 87, 0.6), 0 10px 30px rgba(0, 0, 0, 0.4);
        }

        .score-pop {
            position: fixed;
            pointer-events: none;
            z-index: 50;
            font-family: 'Orbitron', monospace;
            font-weight: 700;
            font-size: 18px;
            color: var(--gold);
            text-shadow: 0 0 15px rgba(245, 200, 66, 0.9);
            animation: floatUp 0.9s ease-out forwards;
        }

        @keyframes floatUp {
            0% {
                opacity: 1;
                transform: translateY(0) scale(0.6);
            }

            30% {
                opacity: 1;
                transform: translateY(-20px) scale(1.2);
            }

            100% {
                opacity: 0;
                transform: translateY(-60px) scale(0.9);
            }
        }

        @keyframes screenShake {

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

            20% {
                transform: translate(-4px, 2px);
            }

            40% {
                transform: translate(4px, -2px);
            }

            60% {
                transform: translate(-3px, 3px);
            }

            80% {
                transform: translate(3px, -1px);
            }
        }

        .shake {
            animation: screenShake 0.4s ease;
        }

        .combo-badge {
            position: absolute;
            top: 12px;
            right: 12px;
            background: var(--gold);
            color: var(--bg-void);
            font-family: 'Orbitron', monospace;
            font-size: 10px;
            font-weight: 900;
            padding: 4px 10px;
            border-radius: 99px;
            letter-spacing: 1px;
            display: none;
            z-index: 5;
            animation: comboPop 0.3s ease;
        }

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

            70% {
                transform: scale(1.2);
            }

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

        .canvas-inner::after {
            content: '';
            position: absolute;
            inset: 0;
            background: repeating-linear-gradient(0deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 0, 0, 0.03) 2px,
                    rgba(0, 0, 0, 0.03) 4px);
            pointer-events: none;
            z-index: 3;
            border-radius: 18px;
        }

        .dpad {
            display: none;
            grid-template-columns: repeat(3, 52px);
            grid-template-rows: repeat(3, 52px);
            gap: 5px;
            margin-top: 2px;
            touch-action: manipulation;
            -webkit-tap-highlight-color: transparent;
        }

        .dpad-btn {
            background: var(--bg-card);
            border: 2px solid rgba(255, 255, 255, 0.1);
            border-radius: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 22px;
            cursor: pointer;
            color: var(--teal);
            transition: all 0.1s ease;
            -webkit-tap-highlight-color: transparent;
            touch-action: manipulation;
            user-select: none;
            -webkit-user-select: none;
            position: relative;
            min-width: 44px;
            min-height: 44px;
        }

        .dpad-btn:active {
            background: rgba(0, 229, 204, 0.2);
            transform: scale(0.88);
            border-color: rgba(0, 229, 204, 0.5);
            box-shadow: 0 0 16px rgba(0, 229, 204, 0.3);
            transition: transform 0.06s ease, background 0.06s ease;
        }

        .dpad-center {
            background: transparent;
            border-color: transparent;
            pointer-events: none;
        }

        .dpad-spacer {
            pointer-events: none;
            background: transparent;
            border-color: transparent;
        }

        .swipe-hint {
            display: none;
            font-size: 10px;
            color: var(--text-lo);
            letter-spacing: 2px;
            text-transform: uppercase;
            text-align: center;
            margin-top: 2px;
            font-family: 'Orbitron', monospace;
        }

        @media (max-width: 768px) {
            #game-wrapper {
                gap: 10px;
                padding: 6px;
            }

            .side-panel {
                width: 120px;
                gap: 8px;
            }

            .stat-block {
                padding: 12px;
                border-radius: 12px;
            }

            .stat-value {
                font-size: 22px;
            }

            .stat-label {
                font-size: 7px;
                letter-spacing: 2px;
            }

            .stat-icon-emoji {
                font-size: 18px;
            }

            .legend-card {
                padding: 10px;
                gap: 6px;
            }

            .legend-row {
                font-size: 10px;
                gap: 5px;
            }

            .legend-row span:first-child {
                font-size: 14px;
            }

            .key-chip {
                font-size: 9px;
                padding: 2px 5px;
            }

            .game-logo-text {
                font-size: 16px;
                letter-spacing: 3px;
            }

            canvas {
                max-width: 400px;
            }

            #overlay-title {
                font-size: 22px;
                letter-spacing: 3px;
            }

            #overlay-sub {
                font-size: 10px;
                letter-spacing: 3px;
            }

            .tip-panel {
                max-width: 280px;
                padding: 10px 14px;
                gap: 6px;
            }

            .tip-row {
                font-size: 10px;
                gap: 7px;
            }

            .tip-row span.ic {
                font-size: 15px;
            }

            .btn {
                padding: 12px 28px;
                font-size: 12px;
                letter-spacing: 1.5px;
                min-height: 44px;
                min-width: 150px;
            }

            #overlay-icon {
                font-size: 40px;
            }
        }

        @media (max-width: 600px) {
            #game-wrapper {
                flex-direction: column;
                align-items: center;
                gap: 6px;
                padding: 4px;
                width: 100%;
            }

            .side-panel {
                flex-direction: row;
                width: 100%;
                max-width: 480px;
                gap: 6px;
                justify-content: center;
                flex-wrap: wrap;
            }

            .stat-block {
                flex: 1 1 auto;
                min-width: 70px;
                max-width: 120px;
                padding: 10px 8px;
                border-radius: 10px;
                gap: 3px;
                text-align: center;
            }

            .stat-block::before {
                height: 2px;
            }

            .stat-icon-row {
                justify-content: center;
                gap: 4px;
            }

            .stat-icon-emoji {
                font-size: 16px;
            }

            .stat-value {
                font-size: 20px;
                text-align: center;
            }

            .stat-label {
                font-size: 7px;
                letter-spacing: 1.5px;
                text-align: center;
            }

            .level-bar-wrap {
                height: 3px;
            }

            .life-pips {
                justify-content: center;
                gap: 4px;
            }

            .pip {
                width: 10px;
                height: 10px;
            }

            .legend-card {
                display: none;
            }

            .canvas-column {
                gap: 6px;
                width: 100%;
                max-width: 480px;
            }

            .canvas-frame {
                border-radius: 14px;
                padding: 2px;
                width: 100%;
                max-width: 480px;
            }

            .canvas-inner {
                border-radius: 12px;
            }

            .canvas-inner::after {
                border-radius: 12px;
            }

            canvas {
                max-width: 100%;
                width: 100%;
                border-radius: 12px;
            }

            #overlay {
                border-radius: 12px;
                gap: 10px;
                padding: 14px;
            }

            .game-logo-text {
                font-size: 14px;
                letter-spacing: 2px;
            }

            .logo-badge {
                font-size: 7px;
                padding: 2px 6px;
            }

            #overlay-title {
                font-size: 18px;
                letter-spacing: 2px;
            }

            #overlay-sub {
                font-size: 9px;
                letter-spacing: 2px;
            }

            #overlay-icon {
                font-size: 34px;
            }

            .tip-panel {
                max-width: 260px;
                padding: 8px 10px;
                gap: 5px;
                border-radius: 10px;
            }

            .tip-row {
                font-size: 9px;
                gap: 6px;
            }

            .tip-row span.ic {
                font-size: 14px;
            }

            .btn {
                padding: 12px 24px;
                font-size: 11px;
                letter-spacing: 1.5px;
                min-height: 44px;
                min-width: 140px;
                border-radius: 40px;
            }

            .dpad {
                display: grid;
            }

            .swipe-hint {
                display: block;
            }

            .overlay-ring {
                display: none;
            }
        }

        @media (max-width: 380px) {
            .side-panel {
                gap: 3px;
            }

            .stat-block {
                padding: 7px 4px;
                min-width: 55px;
                max-width: 90px;
                border-radius: 8px;
            }

            .stat-value {
                font-size: 16px;
            }

            .stat-icon-emoji {
                font-size: 14px;
            }

            .stat-label {
                font-size: 6px;
                letter-spacing: 1px;
            }

            .dpad {
                grid-template-columns: repeat(3, 42px);
                grid-template-rows: repeat(3, 42px);
                gap: 3px;
            }

            .dpad-btn {
                border-radius: 10px;
                font-size: 18px;
                border-width: 1.5px;
            }

            canvas {
                max-width: 100%;
            }

            #overlay-title {
                font-size: 15px;
                letter-spacing: 1.5px;
            }

            #overlay-sub {
                font-size: 8px;
                letter-spacing: 1.5px;
            }

            #overlay-icon {
                font-size: 28px;
            }

            .tip-panel {
                max-width: 220px;
                padding: 6px 8px;
            }

            .tip-row {
                font-size: 8px;
                gap: 4px;
            }

            .tip-row span.ic {
                font-size: 12px;
            }

            .btn {
                padding: 10px 18px;
                font-size: 10px;
                min-height: 40px;
                min-width: 120px;
            }

            .game-logo-text {
                font-size: 12px;
                letter-spacing: 1.5px;
            }
        }

        @media (max-height: 500px) and (orientation: landscape) {
            #game-wrapper {
                flex-direction: row;
                align-items: center;
                gap: 8px;
            }

            .side-panel {
                flex-direction: column;
                width: 90px;
                gap: 4px;
            }

            .stat-block {
                padding: 6px;
                border-radius: 8px;
                gap: 2px;
            }

            .stat-value {
                font-size: 16px;
            }

            .stat-icon-emoji {
                font-size: 13px;
            }

            .stat-label {
                font-size: 6px;
                letter-spacing: 1px;
            }

            .life-pips {
                gap: 3px;
            }

            .pip {
                width: 8px;
                height: 8px;
            }

            .level-bar-wrap {
                height: 2px;
            }

            canvas {
                max-width: 280px;
                max-height: 350px;
            }

            .dpad {
                display: grid;
                grid-template-columns: repeat(3, 36px);
                grid-template-rows: repeat(3, 36px);
                gap: 3px;
            }

            .dpad-btn {
                border-radius: 8px;
                font-size: 16px;
                border-width: 1.5px;
            }

            .legend-card {
                display: none;
            }

            .game-logo-text {
                font-size: 12px;
            }

            .swipe-hint {
                display: block;
            }

            #overlay-title {
                font-size: 14px;
            }

            #overlay-sub {
                font-size: 8px;
            }

            #overlay-icon {
                font-size: 26px;
            }

            .btn {
                padding: 8px 16px;
                font-size: 10px;
                min-height: 36px;
                min-width: 100px;
            }

            .tip-panel {
                max-width: 200px;
                padding: 6px 8px;
                gap: 4px;
            }

            .tip-row {
                font-size: 7px;
                gap: 3px;
            }

            .tip-row span.ic {
                font-size: 11px;
            }
        }