:root {
            --tier-splus-color: #e74c3c; --tier-s-color: #ff7675; --tier-a-color: #fab1a0; --tier-b-color: #ffeaa7;
            --tier-c-color: #55efc4; --tier-d-color: #74b9ff; --tier-f-color: #a29bfe;
        }
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            background-color: #231e3f;
            background-image: radial-gradient(
                ellipse at 50% 40%, 
                rgba(115, 99, 218, 0.25) 0%, 
                #231e3f 60%
            );

            font-family: 'Lilita One', cursive;
            min-height: 100vh;
            color: #fff;
            display: flex;
            flex-direction: column;
        }

        .container { max-width: 95%; margin: 0 auto; padding: 10px; flex-grow: 1; }
        .hidden { display: none !important; }

        /* --- Header & Navigation --- */
        .top-nav-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 25px; background: rgba(0,0,0,0.25); border-radius: 20px; margin-bottom: 30px; border: 1px solid rgba(255, 255, 255, 0.1); width: 98vw; height: 5vw; min-height: 50px; position: relative; left: 50%; transform: translateX(-50%); z-index: 1001; }
        .nav-center-title { text-align: center; position: absolute; left: 50%; transform: translateX(-50%); }
        .header h1 { font-size: 2.2rem; margin-bottom: 0; color: #fff; text-align: center; }
        .author-credit { font-size: 1rem; color: rgba(255, 255, 255, 0.9); font-weight: normal; display: block; text-align: center; margin: -2px auto 0; width: fit-content; }
        .nav-links-right { position: relative; }

        /* --- Burger Menu & Overlay --- */
        .burger-menu {
            display: flex;
            flex-direction: column;
            justify-content: space-around;
            width: 2.2rem;
            height: 2.2rem;
            background: transparent;
            border: none;
            cursor: pointer;
            padding: 0;
            z-index: 2010;
            position: relative;
        }
        .burger-menu span {
            width: 2.2rem;
            height: 0.25rem;
            background: #fff;
            border-radius: 10px;
            transition: all 0.3s linear;
            position: relative;
            transform-origin: 1px;
        }
        .burger-menu.active span:nth-child(1) { transform: rotate(45deg); }
        .burger-menu.active span:nth-child(2) { opacity: 0; transform: translateX(20px); }
        .burger-menu.active span:nth-child(3) { transform: rotate(-45deg); }

        .menu-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(10, 10, 10, 0.95);
            backdrop-filter: blur(8px);
            z-index: 2000;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.4s ease-in-out;
        }
        .menu-overlay.open { opacity: 1; pointer-events: auto; }
        .menu-overlay a {
            color: #fff;
            text-decoration: none;
            font-size: 2.5rem;
            margin: 15px 0;
            transition: color 0.3s ease, transform 0.3s ease;
        }
        
        .menu-overlay a:hover, .menu-overlay a.active { color: #f1c40f; transform: scale(1.05); }
        
        .menu-close {
            position: absolute;
            top: 30px;
            right: 50px;
            font-size: 3rem;
            color: #fff;
            cursor: pointer;
            transition: color 0.3s ease, transform 0.3s ease;
            z-index: 2010;
        }

        .menu-close:hover {
            color: #f1c40f;
            transform: scale(1.1);
        }
        
        /* --- Setup & Main Layout --- */
        .setup-panel { background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(10px); border-radius: 20px; padding: 30px; margin-bottom: 30px; border: 1px solid rgba(255, 255, 255, 0.2); position: relative; z-index: 20; }
        .form-group label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 1.1rem; }
        .loading-indicator { text-align: center; font-size: 1.2rem; padding: 20px; }
        .main-content { display: flex; gap: 30px; position: relative; z-index: 10; }
        .map-display-container { flex: 0 0 25%; background: rgba(0,0,0,0.2); border-radius: 15px; padding: 15px; border: 1px solid rgba(255, 255, 255, 0.1); }
        .map-display-container h3 { text-align: center; margin-bottom: 15px; font-size: 1.2rem; }
        #mapImage { width: 100%; border-radius: 10px; }
        .tierlist-display-container { flex-grow: 1; }
        
        /* --- Tier List Styles --- */
        .tier-list-container { display: flex; flex-direction: column; gap: 8px; }
        .tier-row { display: flex; align-items: stretch; background: rgba(0,0,0,0.2); border-radius: 15px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.1); min-height: 80px; }
        .tier-label { flex-shrink: 0; width: 80px; display: flex; align-items: center; justify-content: center; font-size: 2.5rem; font-weight: bold; color: #fff; text-shadow: 2px 2px 5px rgba(0,0,0,0.5); }
        .brawlers-in-tier { display: flex; flex-wrap: wrap; gap: 5px; padding: 10px; flex-grow: 1; align-content: center; }
        .brawler-card { width: 46px; height: 46px; transition: transform 0.2s ease-in-out; cursor: pointer; position: relative; }
        .brawler-card:hover { transform: scale(1.15); }
        .brawler-card img { width: 100%; height: 100%; border-radius: 8px; object-fit: cover; }
        .brawler-score { display: none; position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.8); color: #fff; padding: 2px 6px; border-radius: 5px; font-size: 0.75rem; white-space: nowrap; z-index: 2; }
        .container.debug-mode .brawler-card .brawler-score { display: block; }
        .tier-splus { background-color: var(--tier-splus-color); } .tier-s { background-color: var(--tier-s-color); } .tier-a { background-color: var(--tier-a-color); }
        .tier-b { background-color: var(--tier-b-color); } .tier-c { background-color: var(--tier-c-color); }
        .tier-d { background-color: var(--tier-d-color); } .tier-f { background-color: var(--tier-f-color); }

        /* --- Custom Select --- */
        .custom-select-container { position: relative; width: 100%; font-family: 'Lilita One', cursive; }
        .custom-select-trigger { width: 100%; padding: 12px 16px; border: none; border-radius: 25px; background: rgba(255, 255, 255, 0.9); color: #333; font-size: 1rem; transition: all 0.3s ease; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
        .custom-select-trigger .trigger-content { display: flex; align-items: center; gap: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .custom-select-trigger .trigger-content img { width: 24px; height: 24px; }
        .custom-options-wrapper { display: none; position: absolute; top: 105%; left: 0; right: 0; z-index: 1010; background: #2c2c2c; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 15px; max-height: 400px; overflow-y: auto; backdrop-filter: blur(5px); }
        .custom-select-container.open .custom-options-wrapper { display: block; }
        .custom-optgroup-label { padding: 10px 15px; font-size: 1rem; text-transform: uppercase; color: #f1c40f; font-weight: bold; cursor: pointer; transition: background-color 0.2s ease; display: flex; align-items: center; gap: 8px; }
        .custom-optgroup-label:hover { background-color: rgba(241, 196, 15, 0.2); }
        .custom-optgroup-label img { width: 24px; height: 24px; }
        .custom-option { padding: 10px 20px; cursor: pointer; display: flex; align-items: center; gap: 12px; transition: background-color 0.2s ease; }
        .custom-option:hover, .custom-option.selected { background-color: rgba(255, 255, 255, 0.1); }
        .custom-option img { width: 28px; height: 28px; flex-shrink: 0; }
        .custom-option .map-name { color: #fff; font-size: 1rem; }
        
        /* --- Language Selector --- */
        #languageSelector {
            cursor: pointer;
        }
        .language-option {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 10px 15px;
            transition: background-color 0.2s ease;
            color: #fff;
        }
        .language-option:hover {
            background-color: rgba(255, 255, 255, 0.1);
        }
        .lang-flag {
            width: 24px;
            height: auto;
            border-radius: 4px;
            vertical-align: middle;
        }
        #selectedLanguage {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 12px;
            background-color: rgba(0,0,0,0.3);
            border-radius: 15px;
            border: 1px solid rgba(255,255,255,0.1);
        }
        #languageDropdown {
            display: none;
            position: absolute;
            top: 110%;
            right: 0;
            background: #2c2c2c;
            border-radius: 10px;
            overflow: hidden;
            z-index: 1001;
            border: 1px solid rgba(255,255,255,0.2);
        }
        #languageSelector.open #languageDropdown {
            display: block;
        }

        /* --- Brawler Modal Styles --- */
        .modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; z-index: 2000; opacity: 0; transition: opacity 0.3s ease; pointer-events: none; }
        .modal-overlay:not(.hidden) { opacity: 1; pointer-events: auto; }
        .modal-content { background: #2c2c2c; padding: 30px; border-radius: 20px; max-width: 700px; width: 90%; border: 1px solid rgba(255, 255, 255, 0.2); position: relative; }
        .modal-close { position: absolute; top: 10px; right: 20px; font-size: 2.5rem; color: #fff; cursor: pointer; transition: transform 0.2s; }
        .modal-close:hover { transform: scale(1.2); }
        #modalHeader { display: flex; align-items: center; gap: 20px; margin-bottom: 25px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 20px; }
        #modalBrawlerIcon { width: 80px; height: 80px; border-radius: 15px; }
        #modalBrawlerName { font-size: 2.5rem; color: #f1c40f; }
        #modalTierGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; }
        .modal-tier-item { background: rgba(0,0,0,0.2); padding: 15px; border-radius: 10px; text-align: center; }
        .modal-tier-item img { width: 32px; height: 32px; margin-bottom: 8px; }
        .modal-gamemode-name { font-size: 1rem; margin-bottom: 5px; }
        .modal-tier-label { font-size: 1.8rem; font-weight: bold; }

        /* --- Footer & Media Queries --- */
        footer { text-align: center; padding: 20px; margin-top: 40px; color: rgba(255, 255, 255, 0.5); font-size: 0.9rem; border-top: 1px solid rgba(255, 255, 255, 0.1); }
        #footer-update { margin-top: 8px; font-size: 0.8rem; }
        .switch { position: relative; display: inline-block; width: 50px; height: 28px; }
        .switch input { opacity: 0; width: 0; height: 0; }
        .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #555; transition: .4s; }
        .slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: white; transition: .4s; }
        input:checked + .slider { background-color: #3498db; }
        input:checked + .slider:before { transform: translateX(22px); }
        .slider.round { border-radius: 28px; }
        .slider.round:before { border-radius: 50%; }
        
        /* --- Export Button --- */
        .tierlist-header {
            display: flex;
            justify-content: flex-end;
            align-items: center;
            margin-bottom: 15px;
        }
        .export-button {
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            color: #fff;
            padding: 10px 18px;
            border-radius: 25px;
            cursor: pointer;
            font-family: 'Lilita One', cursive;
            font-size: 0.9rem;
            transition: background-color 0.3s ease;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .export-button:hover {
            background: rgba(255, 255, 255, 0.2);
        }

        @media (max-width: 1024px) { 
            .main-content { flex-direction: column; } 
            .map-display-container { flex: 0 0 auto; } 
        }
        @media (max-width: 768px) { 
            .top-nav-bar { 
                flex-direction: row; 
                justify-content: space-between; 
                align-items: center; 
                gap: 15px; 
                height: auto; 
                padding: 15px; 
            } 
            .nav-center-title { 
                position: absolute; 
                left: 50%; 
                transform: translateX(-50%); 
            } 
            .nav-links-right { order: 3; } 
            .burger-menu { order: 1; } 
            .nav-center-title { order: 2; } 
        }
        @media (max-width: 480px) { 
            .nav-center-title h1 { font-size: 1.5rem; } 
            .author-credit { font-size: 0.8rem; } 
        }