﻿        body, html {
            margin: 0;
            padding: 0;
            overflow: hidden;
            background-color: #000;
            color: white;
            font-family: Arial, sans-serif;
        }

        .guide {
            position: absolute;
            top: 10px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 5;
            background: rgba(0,0,0,0.75);
            padding: 8px 14px;
            border-radius: 10px;
            max-width: 340px;
            width: max-content;
            max-width: min(340px, 90vw);
            text-align: center;
            border: 1px solid #ffcc00;
            font-size: 12px;
            pointer-events: none;
            display: none;
        }

        #coins-display {
            font-size: 18px;
            color: gold;
            position: absolute;
            top: 10px;
            left: 10px;
            z-index: 10;
            background: rgba(0,0,0,0.7);
            padding: 8px 12px;
            border-radius: 8px;
            cursor: pointer;
            user-select: none;
        }

        #coins-display:hover {
            background: rgba(40,30,0,0.9);
            border: 1px solid gold;
        }

        .reward-row {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 8px 12px;
            border-radius: 8px;
            margin: 4px 0;
            font-size: 15px;
            color: #ccc;
        }

        .reward-row.reached {
            color: #888;
            text-decoration: line-through;
            opacity: 0.5;
        }

        .reward-row.current {
            background: rgba(255,204,0,0.15);
            border: 1px solid #ffcc00;
            color: #ffcc00;
            font-weight: bold;
        }

        .reward-row.next {
            background: rgba(255,255,255,0.05);
            color: #fff;
        }

        .reward-level-badge {
            min-width: 36px;
            text-align: center;
            font-weight: bold;
            background: rgba(0,0,0,0.4);
            padding: 2px 6px;
            border-radius: 6px;
        }

        /* ── Daily Challenges ── */
        #daily-btn {
            position: absolute;
            top: 10px;
            right: 10px;
            z-index: 10;
            background: rgba(0,0,0,0.75);
            border: 1px solid #44aaff;
            color: #44aaff;
            font-size: 14px;
            font-weight: bold;
            padding: 7px 13px;
            width: 136px;
            text-align: center;
            box-sizing: border-box;
            border-radius: 8px;
            cursor: pointer;
            user-select: none;
        }
        #daily-btn:hover { background: rgba(0,40,80,0.9); }
        #daily-btn .badge {
            display: inline-block;
            background: #e94560;
            color: #fff;
            border-radius: 50%;
            font-size: 11px;
            min-width: 17px;
            height: 17px;
            line-height: 17px;
            text-align: center;
            margin-left: 5px;
            vertical-align: middle;
        }

        .challenge-row {
            display: flex; align-items: center; gap: 10px;
            padding: 9px 12px; border-radius: 8px; margin: 5px 0;
            background: rgba(255,255,255,0.04); border: 1px solid #333;
            font-size: 14px;
        }
        .challenge-row.done {
            border-color: #27ae60; background: rgba(39,174,96,0.08); color: #888;
        }
        .challenge-progress {
            flex: 1; height: 6px; background: #333; border-radius: 3px; overflow: hidden;
        }
        .challenge-progress-fill {
            height: 100%; background: #44aaff; border-radius: 3px; transition: width .3s;
        }
        .challenge-row.done .challenge-progress-fill { background: #27ae60; }

        /* ── Kill Streak banner ── */
        #streak-banner {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            pointer-events: none;
            z-index: 20;
            text-align: center;
            font-family: Arial, sans-serif;
            font-weight: bold;
            text-shadow: 0 0 16px #ff6600, 0 2px 4px #000;
            opacity: 0;
            transition: opacity 0.2s;
            white-space: nowrap;
        }

        /* ── Match History ── */
        #history-btn {
            position: absolute;
            top: 52px;
            right: 10px;
            z-index: 10;
            background: rgba(0,0,0,0.75);
            border: 1px solid #aaa;
            color: #aaa;
            font-size: 13px;
            font-weight: bold;
            padding: 5px 11px;
            width: 136px;
            text-align: center;
            box-sizing: border-box;
            border-radius: 8px;
            cursor: pointer;
            user-select: none;
        }
        #history-btn:hover { background: rgba(30,30,30,0.9); }

        #medal-road-btn {
            position: absolute;
            top: 94px;
            right: 10px;
            z-index: 10;
            background: rgba(0,0,0,0.75);
            border: 1px solid #ffcc66;
            color: #ffcc66;
            font-size: 13px;
            font-weight: bold;
            padding: 5px 11px;
            width: 136px;
            text-align: center;
            box-sizing: border-box;
            border-radius: 8px;
            cursor: pointer;
            user-select: none;
        }
        #medal-road-btn:hover { background: rgba(60,40,0,0.9); }

        /* ── Tips / Leaderboard quick buttons ── */
        #tutorial-btn {
            position: relative;
            z-index: 1;
            background: rgba(0,0,0,0.78);
            border: 1px solid #66ccff;
            color: #9fe9ff;
            font-size: 14px;
            font-weight: bold;
            padding: 7px 12px;
            border-radius: 8px;
            cursor: pointer;
            user-select: none;
            pointer-events: auto;
        }
        #tutorial-btn:hover { background: rgba(0,40,80,0.92); }

        #daily-wins-tracker {
            position: relative;
            width: min(100%, 340px);
            background: rgba(0,0,0,0.78);
            border: 1px solid #4cc9f0;
            border-radius: 10px;
            padding: 8px 10px;
            text-align: center;
            pointer-events: none;
            margin-top: 4px;
        }

        #daily-wins-label {
            color: #9fe9ff;
            font-size: 12px;
            font-weight: bold;
            margin-bottom: 6px;
        }

        #daily-wins-fx {
            position: absolute;
            left: 50%;
            top: -16px;
            transform: translateX(-50%);
            font-size: 13px;
            font-weight: bold;
            color: #ffe27a;
            text-shadow: 0 0 10px rgba(255, 180, 0, 0.55);
            opacity: 0;
            pointer-events: none;
            white-space: nowrap;
        }

        #daily-wins-fx.show {
            animation: dailyRewardPop 0.95s ease forwards;
        }

        #daily-wins-tracker.claiming {
            animation: dailyTrackerPulse 0.6s ease;
            box-shadow: 0 0 18px rgba(255, 204, 0, 0.35);
        }

        .daily-win-slot.claiming {
            animation: dailySlotClaim 0.75s ease;
            border-color: #ffe27a;
            box-shadow: 0 0 16px rgba(255, 226, 122, 0.65);
        }

        @keyframes dailyRewardPop {
            0% { opacity: 0; transform: translate(-50%, 8px) scale(0.9); }
            20% { opacity: 1; transform: translate(-50%, 0px) scale(1.04); }
            100% { opacity: 0; transform: translate(-50%, -22px) scale(1); }
        }

        @keyframes dailySlotClaim {
            0% { transform: scale(0.92); filter: brightness(1); }
            40% { transform: scale(1.08); filter: brightness(1.35); }
            100% { transform: scale(1); filter: brightness(1); }
        }

        @keyframes dailyTrackerPulse {
            0% { transform: scale(1); }
            40% { transform: scale(1.03); }
            100% { transform: scale(1); }
        }

        #daily-wins-slots {
            display: flex;
            justify-content: center;
            gap: 8px;
        }

        .daily-win-slot {
            width: 78px;
            min-height: 46px;
            border-radius: 8px;
            border: 1px solid #35566a;
            background: rgba(16, 26, 34, 0.9);
            color: #7395ac;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 2px;
            font-size: 15px;
            font-weight: bold;
            line-height: 1;
            padding: 3px 2px;
        }

        .daily-win-slot small {
            font-size: 10px;
            color: #9ab8cc;
            font-weight: bold;
        }

        .daily-win-slot.done {
            border-color: #ffcc00;
            background: rgba(255, 204, 0, 0.2);
            color: #ffdd66;
            box-shadow: 0 0 8px rgba(255, 204, 0, 0.35);
        }

        #leaderboard-btn {
            position: absolute;
            top: 90px;
            right: 10px;
            z-index: 12;
            background: rgba(0,0,0,0.78);
            border: 1px solid #ffcc66;
            color: #ffdd8a;
            font-size: 13px;
            font-weight: bold;
            padding: 6px 11px;
            width: 136px;
            text-align: center;
            box-sizing: border-box;
            border-radius: 8px;
            cursor: pointer;
            user-select: none;
        }
        #leaderboard-btn:hover { background: rgba(80,60,0,0.9); }

        .history-row {
            display: flex; align-items: center; gap: 8px;
            padding: 7px 10px; border-radius: 7px; margin: 4px 0;
            font-size: 13px; border: 1px solid #2a2a2a;
        }
        .history-row.win  { background: rgba(39,174,96,0.12); border-color: #27ae60; }
        .history-row.lose { background: rgba(220,53,69,0.10); border-color: #dc3545; }

        .history-stats-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
            margin: 10px 0 14px;
        }

        .history-stat-card {
            border: 1px solid #2b2b2b;
            border-radius: 8px;
            background: rgba(255,255,255,0.04);
            padding: 8px 10px;
            font-size: 12px;
        }

        .history-stat-card .label {
            color: #a0a0a0;
            font-size: 11px;
        }

        .history-stat-card .value {
            color: #fff;
            font-size: 15px;
            font-weight: bold;
            margin-top: 2px;
        }

        .skin-card {
            display: inline-block;
            background-color: #f4f4f4;
            border: 2px solid #ccc;
            padding: 10px;
            margin: 10px;
            text-align: center;
            border-radius: 12px;
            width: 180px;
            color: #000;
        }

            .skin-card h3,
            .skin-card p {
                color: #000;
                margin: 6px 0;
            }

        .skin-img {
            width: 100%;
            border-radius: 10px;
            height: 120px;
            object-fit: cover;
        }

        .menu {
            position: absolute;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 14px;
            z-index: 10;
            background: rgba(0,0,0,0.7);
            padding: 16px 18px;
            border-radius: 10px;
            max-width: min(96vw, 920px);
        }

        .btn {
            background-color: #444;
            color: #fff;
            border: none;
            padding: 10px 15px;
            border-radius: 8px;
            cursor: pointer;
            font-weight: bold;
            transition: all 0.3s ease;
        }

            .btn:hover {
                background-color: #666;
                transform: scale(1.05);
            }

        @keyframes battle-pulse {
            0%, 100% { transform: scale(1); box-shadow: 0 0 8px #ff6600; }
            50% { transform: scale(1.08); box-shadow: 0 0 20px #ff6600, 0 0 40px #ff440066; }
        }

        #start-btn {
            background-color: #cc4400;
            font-size: 16px;
            padding: 12px 22px;
            animation: battle-pulse 1.5s ease-in-out infinite;
        }

        #start-btn:hover {
            background-color: #ff5500;
            animation: none;
            transform: scale(1.1);
        }

            .btn:disabled {
                background-color: #777;
                cursor: not-allowed;
                transform: none;
            }

        .modal-panel {
            display: none;
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            background: rgba(0,0,0,0.95);
            color: #fff;
            padding: 20px;
            border-radius: 12px;
            z-index: 1000;
            max-width: 90vw;
            width: 800px;
            max-height: 80vh;
            overflow: auto;
            border: 2px solid #ffcc00;
            box-shadow: 0 0 30px rgba(255, 204, 0, 0.3);
        }

        @media (max-width: 600px) {
            .modal-panel {
                padding: 14px 10px;
                max-height: 85vh;
                width: 96vw !important;
                top: 48% !important;
            }
        }

            .modal-panel h2 {
                margin-top: 0;
                color: #ffcc00;
                text-align: center;
                font-size: 24px;
            }

        .modal-close {
            display: block;
            margin: 15px auto 0;
            background: #ff4444;
        }

            .modal-close:hover {
                background: #ff6666;
            }

        #gameCanvas {
            width: 100vw;
            height: 100vh;
            display: block;
        }

        @media (max-width: 900px) {
            .guide {
                top: 6px;
                max-width: min(95vw, 420px);
                font-size: 11px;
                padding: 6px 10px;
            }

            #coins-display {
                top: 8px;
                left: 8px;
                font-size: 13px;
                padding: 6px 8px;
                max-width: 48vw;
                line-height: 1.35;
            }

            #daily-btn {
                top: 8px;
                right: 8px;
                font-size: 12px;
                padding: 5px 9px;
                width: 118px;
            }

            #history-btn {
                top: 40px;
                right: 8px;
                font-size: 11px;
                padding: 4px 8px;
                width: 118px;
            }

            #medal-road-btn {
                top: 72px;
                right: 8px;
                font-size: 11px;
                padding: 4px 8px;
                width: 118px;
            }

            #tutorial-btn {
                font-size: 12px;
                padding: 6px 10px;
            }

            #daily-wins-tracker {
                width: min(100%, 300px);
                padding: 6px 8px;
            }

            #daily-wins-label {
                font-size: 11px;
                margin-bottom: 4px;
            }

            #daily-wins-fx {
                font-size: 11px;
                top: -14px;
            }

            .daily-win-slot {
                width: 64px;
                min-height: 42px;
                font-size: 13px;
                gap: 1px;
            }

            .daily-win-slot small {
                font-size: 9px;
            }

            #leaderboard-btn {
                top: 68px;
                right: 8px;
                font-size: 11px;
                padding: 4px 8px;
                width: 118px;
            }

            #account-chip {
                top: 10px !important;
                max-width: 200px;
                padding: 8px 12px;
            }

            .menu {
                bottom: 10px;
                width: min(95vw, 640px);
                max-height: 50vh;
                overflow-y: auto;
                gap: 8px;
                padding: 8px;
            }

            .menu .btn {
                padding: 9px 10px;
                font-size: 13px;
            }

            #char-showcase {
                width: min(90vw, 520px);
                min-width: 0 !important;
                padding: 10px 12px !important;
                top: 50%;
                pointer-events: none;
            }
        }

        #joystick-container {
            position: fixed;
            bottom: 30px;
            left: 30px;
            z-index: 9999;
        }

        #joystick-base {
            width: 100px;
            height: 100px;
            background: rgba(0, 0, 0, 0.3);
            border-radius: 50%;
            position: relative;
            touch-action: none;
            border: 2px solid rgba(255,255,255,0.5);
        }

        #joystick-stick {
            width: 50px;
            height: 50px;
            background: rgba(255, 255, 255, 0.8);
            border-radius: 50%;
            position: absolute;
            left: 25px;
            top: 25px;
            touch-action: none;
            transition: transform 0.1s;
        }

        #shoot-joystick-container {
            position: fixed;
            bottom: 30px;
            right: 30px;
            z-index: 9999;
        }

        #shoot-joystick-base {
            width: 100px;
            height: 100px;
            background: rgba(0, 0, 0, 0.3);
            border-radius: 50%;
            position: relative;
            touch-action: none;
            border: 2px solid rgba(255,100,100,0.5);
        }

        #shoot-joystick-stick {
            width: 50px;
            height: 50px;
            background: rgba(255, 100, 100, 0.8);
            border-radius: 50%;
            position: absolute;
            left: 25px;
            top: 25px;
            touch-action: none;
            transition: transform 0.1s;
        }

        /* Improved joystick visibility - hide by default */
        #joystick-container, #shoot-joystick-container {
            display: none !important;
        }

        /* Show joysticks only when game is active on touch devices or small screens */
        .game-active #joystick-container,
        .game-active #shoot-joystick-container {
            display: block !important;
        }

        /* Fallback for older browsers */
        @media (max-width: 1024px) {
            .game-active #joystick-container,
            .game-active #shoot-joystick-container {
                display: block !important;
            }
        }

        /* Super ability button */
        #super-btn-container {
            display: none;
            position: fixed;
            bottom: 160px;
            right: 20px;
            z-index: 100;
        }
        .game-active #super-btn-container {
            display: block;
        }
        #super-btn {
            position: relative;
            width: 64px;
            height: 64px;
            border-radius: 50%;
            background: rgba(30,30,60,0.85);
            border: 3px solid #ffcc00;
            overflow: hidden;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            user-select: none;
            -webkit-user-select: none;
        }
        #super-btn-fill {
            position: absolute;
            bottom: 0; left: 0; right: 0;
            height: 0%;
            background: rgba(255,200,0,0.45);
            transition: height 0.1s linear;
        }
        #super-btn-label {
            position: relative;
            z-index: 1;
            font-size: 11px;
            font-weight: bold;
            color: #ffcc00;
            text-align: center;
            pointer-events: none;
            line-height: 1.2;
        }
        #super-btn.ready {
            border-color: #ffcc00;
            box-shadow: 0 0 14px #ffcc00;
            animation: superPulse 0.8s infinite alternate;
        }
        @keyframes superPulse {
            from { box-shadow: 0 0 8px #ffcc00; }
            to   { box-shadow: 0 0 22px #ff8800; }
        }

        /* Gadget button (mobile) */
        #gadget-btn-container {
            display: none;
            position: fixed;
            bottom: 160px;
            right: 100px;
            z-index: 100;
        }
        .game-active #gadget-btn-container { display: block; }
        #gadget-btn {
            position: relative;
            width: 56px; height: 56px;
            border-radius: 50%;
            background: rgba(10,40,20,0.88);
            border: 3px solid #44ff88;
            overflow: hidden;
            display: flex; align-items: center; justify-content: center;
            cursor: pointer; user-select: none; -webkit-user-select: none;
        }
        #gadget-btn-fill {
            position: absolute; bottom: 0; left: 0; right: 0;
            height: 100%;
            background: rgba(50,200,90,0.35);
            transition: height 0.12s linear;
        }
        #gadget-btn-label {
            position: relative; z-index: 1;
            font-size: 11px; font-weight: bold; color: #44ff88;
            text-align: center; pointer-events: none; line-height: 1.2;
        }
        #gadget-btn.ready {
            box-shadow: 0 0 14px #44ff88;
            animation: gadgetPulse 0.8s infinite alternate;
        }
        @keyframes gadgetPulse {
            from { box-shadow: 0 0 8px #44ff88; }
            to   { box-shadow: 0 0 22px #00ee66; }
        }

        /* Use item button */
        #use-item-btn-container {
            display: none;
            position: fixed;
            bottom: 240px;
            right: 20px;
            z-index: 100;
        }
        .game-active #use-item-btn-container {
            display: block;
        }
        #use-item-btn {
            width: 56px;
            height: 56px;
            border-radius: 50%;
            background: rgba(30,30,60,0.85);
            border: 3px solid #4ae8d8;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            cursor: pointer;
            box-shadow: 0 0 10px #4ae8d844;
            user-select: none;
            -webkit-user-select: none;
        }

        #debug-status {
            position: fixed;
            right: 10px;
            top: 50px;
            background: rgba(0,0,0,0.6);
            color: #fff;
            padding: 8px 10px;
            font-family: monospace;
            font-size: 12px;
            border-radius: 6px;
            z-index: 99999;
            max-width: 300px;
            pointer-events: none;
        }

        #lootbox-popup {
            display: none;
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: linear-gradient(135deg, #FFD700, #FFAA00);
            padding: 30px;
            border-radius: 20px;
            border: 5px solid white;
            z-index: 1000;
            text-align: center;
            box-shadow: 0 0 30px rgba(255,215,0,0.7);
        }

        .game-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.8);
            z-index: 999;
            justify-content: center;
            align-items: center;
            color: white;
            font-size: 24px;
            text-align: center;
        }

        .health-pack {
            animation: pulse 2s infinite;
        }

        @keyframes pulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.1); }
            100% { transform: scale(1); }
        }
        @keyframes showcasePulse {
            0%, 100% { transform: scale(1); filter: brightness(1); }
            50% { transform: scale(1.04); filter: brightness(1.15); }
        }
