* {
            box-sizing: border-box;
            user-select: none;
            -webkit-user-select: none;
        }
        body {
            margin: 0;
            padding: 0;
            background-color: #0b0f19;
            color: #ffffff;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            overflow: hidden;
            touch-action: none;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            height: 100dvh;
        }
        #main-wrapper {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 100%;
            height: 100%;
            position: relative;
        }
        #game-container {
            position: relative;
            width: 100vw;
            height: 100vh;
            height: 100dvh;
            max-width: 480px;
            max-height: 854px;
            background: radial-gradient(circle at center, #111827 0%, #030712 100%);
            overflow: hidden;
            box-shadow: 0 0 30px rgba(0, 243, 255, 0.15);
            flex-shrink: 0;
        }
        canvas {
            display: block;
            width: 100%;
            height: 100%;
            pointer-events: auto;
        }
        .ui-layer {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            padding: 16px;
        }
        .hud-top {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 16px;
            font-weight: bold;
            text-shadow: 0 2px 4px rgba(0,0,0,0.8);
            pointer-events: none;
        }
        .hud-score {
            background: rgba(17, 24, 39, 0.7);
            padding: 8px 14px;
            border-radius: 20px;
            border: 1px solid rgba(255,255,255,0.1);
            color: #38bdf8;
            font-family: monospace;
            font-size: 18px;
        }
        .icon-btn {
            background: rgba(17, 24, 39, 0.8);
            border: 1px solid rgba(255,255,255,0.2);
            color: white;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 18px;
            cursor: pointer;
            transition: all 0.2s;
            pointer-events: auto;
        }
        .icon-btn:active {
            transform: scale(0.9);
            background: rgba(0, 243, 255, 0.3);
        }
        /* Bottom-Left Skill Button */
        #skillBtn {
            position: absolute;
            bottom: calc(20px + env(safe-area-inset-bottom, 0px));
            left: 18px;
            background: linear-gradient(135deg, #f59e0b, #d97706);
            border: 2px solid #fbbf24;
            color: white;
            padding: 13px 20px;
            border-radius: 30px;
            font-size: 15px;
            font-weight: bold;
            cursor: pointer;
            box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
            display: none;
            align-items: center;
            gap: 8px;
            z-index: 100;
            pointer-events: auto;
            touch-action: manipulation;
            transition: transform 0.1s;
        }
        #skillBtn:active {
            transform: scale(0.92);
        }
        #skillBtn.disabled {
            background: #374151;
            border-color: #4b5563;
            box-shadow: none;
            opacity: 0.6;
            cursor: not-allowed;
        }
        /* Virtual Joystick */
        #joystick-base {
            position: absolute;
            bottom: calc(20px + env(safe-area-inset-bottom, 0px));
            right: 18px;
            width: 112px;
            height: 112px;
            background: rgba(15, 23, 42, 0.72);
            border: 2px solid rgba(0, 243, 255, 0.45);
            border-radius: 50%;
            pointer-events: auto;
            display: none;
            justify-content: center;
            align-items: center;
            touch-action: none;
            z-index: 100;
            box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6), inset 0 0 16px rgba(0, 243, 255, 0.12);
            backdrop-filter: blur(4px);
            user-select: none;
            -webkit-user-select: none;
        }
        #joystick-stick {
            position: absolute;
            width: 48px;
            height: 48px;
            background: rgba(0, 243, 255, 0.45);
            border: 2px solid #00f3ff;
            border-radius: 50%;
            box-shadow: 0 0 14px rgba(0, 243, 255, 0.8), inset 0 0 6px rgba(255, 255, 255, 0.6);
            pointer-events: none;
            will-change: transform;
        }

        /* Smart Keyboard D-Pad (ㅗ Arrow Cluster) */
        #dpad-container {
            position: absolute;
            bottom: calc(20px + env(safe-area-inset-bottom, 0px));
            right: 18px;
            width: 162px;
            height: 106px;
            display: none;
            grid-template-columns: repeat(3, 50px);
            grid-template-rows: repeat(2, 50px);
            gap: 6px;
            z-index: 100;
            touch-action: none;
            user-select: none;
            -webkit-user-select: none;
        }
        .dpad-btn {
            background: rgba(15, 23, 42, 0.85);
            border: 1.5px solid rgba(0, 243, 255, 0.4);
            border-radius: 10px;
            color: #00f3ff;
            font-size: 20px;
            font-weight: bold;
            display: flex;
            justify-content: center;
            align-items: center;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
            transition: background 0.06s, transform 0.06s, border-color 0.06s, box-shadow 0.06s, color 0.06s;
            cursor: pointer;
            pointer-events: auto;
            padding: 0;
            outline: none;
            backdrop-filter: blur(4px);
        }
        .dpad-btn:active, .dpad-btn.active {
            background: rgba(0, 243, 255, 0.35);
            border-color: #00f3ff;
            color: #ffffff;
            transform: scale(0.92);
            box-shadow: 0 0 16px rgba(0, 243, 255, 0.8), inset 0 0 8px rgba(0, 243, 255, 0.5);
        }
        .dpad-slot {
            pointer-events: none;
            user-select: none;
        }

        .screen {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(3, 7, 18, 0.95);
            backdrop-filter: blur(8px);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 10px 14px;
            z-index: 200;
            text-align: center;
            box-sizing: border-box;
            overflow: hidden; /* 위아래 스크롤 완전 제거 */
        }
        .hidden, .screen.hidden, .modal-overlay.hidden {
            display: none !important;
        }
        #start-screen, #gameover-screen {
            transition: background 0.35s ease, backdrop-filter 0.35s ease;
        }
        #start-screen.theme-sky, #gameover-screen.theme-sky {
            background: rgba(15, 23, 42, 0.36);
            backdrop-filter: blur(1.5px);
            -webkit-backdrop-filter: blur(1.5px);
        }
        #start-screen.theme-space, #gameover-screen.theme-space {
            background: rgba(8, 14, 30, 0.38);
            backdrop-filter: blur(1.5px);
            -webkit-backdrop-filter: blur(1.5px);
        }
        h1 {
            font-size: 20px;
            margin: 0 0 2px 0;
            background: linear-gradient(to right, #fb923c, #f43f5e, #38bdf8);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            text-transform: uppercase;
            letter-spacing: 1px;
        }
        p {
            color: #9ca3af;
            font-size: 11.5px;
            margin: 0 0 6px 0;
            line-height: 1.35;
        }
        .ship-select-container {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 6px;
            margin-bottom: 6px;
            width: 100%;
            max-width: 400px;
            padding: 2px;
            box-sizing: border-box;
            user-select: none;
            -webkit-user-select: none;
        }
        .ship-card {
            background: rgba(15, 23, 42, 0.85);
            border: 2px solid rgba(255, 255, 255, 0.12);
            border-radius: 10px;
            padding: 5px 3px 4px 3px;
            cursor: pointer;
            transition: all 0.18s ease;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: space-between;
            min-height: 86px;
            box-sizing: border-box;
            user-select: none;
        }
        .ship-card:hover {
            border-color: rgba(250, 204, 21, 0.55);
            background: rgba(30, 41, 59, 0.9);
            transform: translateY(-1px);
        }
        .ship-card img {
            pointer-events: none;
            user-select: none;
            -webkit-user-drag: none;
        }
        .ship-card.selected {
            border-color: #facc15;
            background: rgba(250, 204, 21, 0.22);
            box-shadow: 0 0 14px rgba(250, 204, 21, 0.45);
            transform: translateY(-2px);
        }
        .ship-icon {
            width: 42px;
            height: 38px;
            display: flex;
            justify-content: center;
            align-items: center;
            margin-bottom: 2px;
        }
        .ship-name {
            font-size: 11px;
            font-weight: bold;
            margin-bottom: 2px;
            white-space: nowrap;
        }
        .ship-desc {
            font-size: 8.5px;
            color: #9ca3af;
            text-align: center;
            line-height: 1.2;
        }
        .leaderboard-box {
            width: 100%;
            max-width: 340px;
            background: rgba(17, 24, 39, 0.8);
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: 10px;
            padding: 6px 10px;
            margin-bottom: 6px;
        }
        .leaderboard-title {
            font-size: 11.5px;
            font-weight: bold;
            color: #facc15;
            margin-bottom: 5px;
            letter-spacing: 0.5px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .leaderboard-tabs {
            display: flex;
            gap: 4px;
            justify-content: center;
            margin-bottom: 6px;
        }
        .lb-tab {
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.15);
            color: #94a3b8;
            padding: 3px 10px;
            font-size: 11px;
            font-weight: bold;
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        .lb-tab:hover {
            color: #f8fafc;
            border-color: rgba(255, 255, 255, 0.3);
        }
        .lb-tab.active {
            background: linear-gradient(135deg, #00f3ff, #3b82f6);
            color: #030712;
            border-color: #00f3ff;
            box-shadow: 0 0 8px rgba(0, 243, 255, 0.4);
        }
        .rank-header {
            display: flex;
            align-items: center;
            padding: 2px 4px;
            font-size: 10px;
            color: #64748b;
            font-weight: bold;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            margin-bottom: 2px;
        }
        .rank-row {
            display: flex;
            align-items: center;
            padding: 3px 4px;
            font-size: 11px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        }
        .rank-row:last-child {
            border-bottom: none;
        }
        .rank-num {
            font-weight: bold;
            width: 32px;
            text-align: left;
            flex-shrink: 0;
            font-size: 10.5px;
        }
        .rank-1 { color: #facc15; }
        .rank-2 { color: #e2e8f0; }
        .rank-3 { color: #f97316; }
        .rank-other { color: #94a3b8; }
        .rank-name {
            flex: 1;
            text-align: center;
            color: #e5e7eb;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            padding: 0 4px;
        }
        .rank-ship {
            font-size: 10.5px;
            color: #cbd5e1;
            margin-right: 6px;
            white-space: nowrap;
            flex-shrink: 0;
            text-align: center;
            min-width: 44px;
        }
        .rank-score {
            font-weight: bold;
            color: #38bdf8;
            font-family: monospace;
            font-size: 11px;
            min-width: 42px;
            text-align: right;
            flex-shrink: 0;
        }

        /* Pilot ID Badge */
        .pilot-badge-box {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            background: rgba(15, 23, 42, 0.85);
            border: 1px solid rgba(0, 243, 255, 0.3);
            border-radius: 20px;
            padding: 5px 14px;
            font-size: 12px;
            color: #94a3b8;
            margin-bottom: 6px;
            box-shadow: 0 0 10px rgba(0, 243, 255, 0.15);
        }
        .pilot-badge-id {
            color: #00f3ff;
            font-weight: bold;
            letter-spacing: 0.5px;
        }
        .btn-change-id {
            background: transparent;
            border: 1px solid rgba(255, 255, 255, 0.2);
            color: #cbd5e1;
            font-size: 10px;
            border-radius: 10px;
            padding: 1px 6px;
            cursor: pointer;
            transition: all 0.2s;
        }
        .btn-change-id:hover {
            border-color: #00f3ff;
            color: #00f3ff;
        }

        /* ID Registration Modal */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(3, 7, 18, 0.88);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 2000;
            padding: 16px;
        }
        .modal-card {
            background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95));
            border: 1px solid rgba(0, 243, 255, 0.4);
            border-radius: 16px;
            padding: 22px 20px;
            width: 100%;
            max-width: 320px;
            text-align: center;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 20px rgba(0, 243, 255, 0.25);
            animation: modalPop 0.25s ease-out;
        }
        @keyframes modalPop {
            from { transform: scale(0.9); opacity: 0; }
            to { transform: scale(1); opacity: 1; }
        }
        .modal-title {
            font-size: 16px;
            font-weight: bold;
            color: #facc15;
            margin-bottom: 6px;
            letter-spacing: 0.5px;
        }
        .modal-desc {
            font-size: 11.5px;
            color: #94a3b8;
            line-height: 1.45;
            margin-bottom: 14px;
        }
        .modal-input {
            width: 100%;
            padding: 10px 12px;
            border-radius: 10px;
            border: 1.5px solid rgba(0, 243, 255, 0.4);
            background: rgba(3, 7, 18, 0.8);
            color: #ffffff;
            font-size: 13px;
            font-weight: bold;
            text-align: center;
            outline: none;
            transition: all 0.2s;
            box-sizing: border-box;
        }
        .modal-input:focus {
            border-color: #00f3ff;
            box-shadow: 0 0 12px rgba(0, 243, 255, 0.5);
        }
        .id-check-msg {
            font-size: 11px;
            min-height: 18px;
            margin-top: 6px;
            margin-bottom: 10px;
            font-weight: bold;
        }
        .id-msg-error { color: #f43f5e; }
        .id-msg-success { color: #34d399; }
        .id-msg-info { color: #38bdf8; }
        .play-info {
            font-size: 11.5px;
            color: #60a5fa;
            margin-bottom: 6px;
            font-weight: bold;
        }
        .btn {
            background: linear-gradient(135deg, #00f3ff, #3b82f6);
            color: #030712;
            border: none;
            padding: 10px 22px;
            font-size: 14px;
            font-weight: bold;
            border-radius: 24px;
            cursor: pointer;
            box-shadow: 0 4px 15px rgba(0, 243, 255, 0.4);
            transition: transform 0.1s;
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-bottom: 6px;
            width: 80%;
            max-width: 280px;
        }
        .btn:active {
            transform: scale(0.95);
        }
        .btn-ad {
            background: linear-gradient(135deg, #10b981, #059669);
            color: white;
            box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
        }
        .btn-secondary {
            background: transparent;
            border: 1px solid rgba(255,255,255,0.2);
            color: #ffffff;
            box-shadow: none;
        }
        input.nickname-input {
            background: rgba(31, 41, 55, 0.8);
            border: 1px solid #4b5563;
            color: white;
            padding: 5px 10px;
            border-radius: 8px;
            font-size: 12px;
            width: 75%;
            max-width: 260px;
            text-align: center;
            margin-bottom: 6px;
            outline: none;
        }

        /* Share Button & Toast */
        .btn-share {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 4px;
            background: linear-gradient(135deg, rgba(236, 72, 153, 0.25), rgba(168, 85, 247, 0.35));
            border: 1px solid #f472b6;
            color: #fdf2f8;
            padding: 4px 10px;
            border-radius: 16px;
            font-size: 11.5px;
            font-weight: bold;
            cursor: pointer;
            box-shadow: 0 0 10px rgba(244, 114, 182, 0.35);
            transition: all 0.2s ease;
            white-space: nowrap;
        }
        .btn-share:hover {
            background: linear-gradient(135deg, #ec4899, #a855f7);
            color: #ffffff;
            box-shadow: 0 0 16px rgba(244, 114, 182, 0.6);
            transform: scale(1.05);
        }
        .btn-share:active {
            transform: scale(0.96);
        }

        .share-toast {
            position: fixed;
            top: 24px;
            left: 50%;
            transform: translateX(-50%) translateY(-20px);
            background: rgba(15, 23, 42, 0.96);
            border: 1px solid #38bdf8;
            color: #f8fafc;
            padding: 10px 18px;
            border-radius: 20px;
            font-size: 12.5px;
            font-weight: bold;
            box-shadow: 0 4px 20px rgba(0, 243, 255, 0.45);
            z-index: 9999;
            opacity: 0;
            pointer-events: none;
            transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
            text-align: center;
            max-width: 90%;
            line-height: 1.4;
        }
        .share-toast.show {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }

        /* 🛒 쿠팡 파트너스 다이나믹 배너 스타일 */
        #pc-coupang-sidebar {
            display: none;
        }

        .coupang-banner-card {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            background: rgba(15, 23, 42, 0.8);
            border: 1px solid rgba(255, 255, 255, 0.12);
            border-radius: 12px;
            padding: 8px 10px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            box-sizing: border-box;
            width: 320px;
            max-width: 100%;
        }

        .coupang-banner-card iframe {
            width: 300px;
            height: 250px;
            border: none;
            border-radius: 8px;
            background: #ffffff;
            display: block;
        }

        .coupang-notice {
            font-size: 10px;
            color: #94a3b8;
            text-align: center;
            margin-top: 6px;
            line-height: 1.35;
            letter-spacing: -0.2px;
            max-width: 300px;
            word-break: keep-all;
        }

        .mobile-coupang-container {
            display: flex;
            justify-content: center;
            width: 100%;
            margin-top: 10px;
            margin-bottom: 14px;
            flex-shrink: 0;
        }

        /* 🖥️ PC 화면 (860px 이상): 우측 사이드바 상시 노출 & 모바일 인게임 배너 숨김 */
        @media (min-width: 860px) {
            #main-wrapper {
                gap: 24px;
            }
            #pc-coupang-sidebar {
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: center;
                z-index: 100;
                flex-shrink: 0;
            }
            .mobile-coupang-container {
                display: none !important;
            }
        }

        /* 📱 모바일 화면 (859px 이하): 시작 및 게임오버 화면에서 자연스럽게 스크롤 가능 */
        @media (max-width: 859px) {
            .screen {
                justify-content: flex-start;
                overflow-y: auto !important;
                overflow-x: hidden;
                -webkit-overflow-scrolling: touch;
                scrollbar-width: none;
                padding-top: 14px;
                padding-bottom: 24px;
            }
            .screen::-webkit-scrollbar {
                display: none;
            }
        }

