* {
    -webkit-tap-highlight-color: transparent;
}

@font-face {
    font-family: 'PacMan1980';
    /* Проверь путь к файлу! */
    src: url('/fonts/Tiny5-Regular.ttf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Обнуляем отступы браузера */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Чтобы не было полос прокрутки */
}

#map-container { position: relative; width: 100%; height: 100vh; background-color: #1a1a1a; overflow: hidden; }

#cursor-overlay, #lens-effect-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Клик должен проходить сквозь */
    z-index: 2; /* Над картой, под UI */
}

/* Карта должна занимать всё доступное пространство */
#map {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    height: 100vh; /* 100% высоты видимой области */
    background-color: #ffffff; /*Цвет фона, пока тайлы грузятся */
    display: block;
    touch-action: none; /* Отключает браузерный зум и прокрутку поверх карты */
    -webkit-user-select: none; /* Запрещает выделение текста при долгом нажатии */
    user-select: none;
}



/* Внутренний индикатор цвета */
#current-color-display {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #ff0000; 
    
    /* 🟢 Добавляем красивую рамочку и тень для объема */
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    
    /* Центрируем крестик (ластик), если он там появится */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #333;
    font-family: 'PacMan1980', sans-serif;
    font-size: 14px;
}

/* Контейнер авторизации */
#auth-container {
    
    box-sizing: border-box;
    width: 250px;
    /* Убрали всё стекло, тени и absolute */
    background: transparent; 
    border: none;     
    color: rgba(255, 255, 255, 0.85);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    
    /* 🟢 Анимация выпадания (Accordion) */
    max-height: 0; 
    padding: 0 20px; /* Убираем вертикальные отступы в закрытом виде */
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease, opacity 0.3s ease, visibility 0.4s;
}

#auth-container.open {
    max-height: min(500px, calc(100dvh - 56px)); /* С запасом, но не выше экрана */
    padding: 20px;     /* Возвращаем отступы */
    opacity: 1;
    visibility: visible;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

#auth-container.profile-mode {
    width: min(500px, calc(100vw - 30px));
}

@media (max-width: 768px) {
    #auth-container {
        width: 100%;
        border-radius: 0; /* На мобилках без скругления, как дебаг-панель */
    }

    #auth-container.profile-mode {
        width: 100%;
    }

    #auth-container.open {
        max-height: calc(100dvh - 100px - env(safe-area-inset-top));
    }
}

@media (max-width: 900px) and (max-height: 520px) and (orientation: landscape) {
    #auth-container.open {
        max-height: calc(100dvh - 68px - env(safe-area-inset-top));
        padding: 8px 12px 12px;
        overflow: visible;
    }

    #auth-container.profile-mode {
        width: min(680px, calc(100vw - 24px));
    }

    #auth-container:not(.profile-mode) {
        width: min(420px, calc(100vw - 24px));
    }

    #google-btn-container {
        margin-bottom: 6px !important;
        gap: 0 !important;
    }

    #vkid-container {
        margin-bottom: 4px !important;
        max-height: 34px;
        overflow: hidden;
    }

    #vkid-container > * {
        max-height: 34px !important;
    }

    .auth-email-divider {
        display: none !important;
    }

    #email-auth-box input,
    #reset-password-box input {
        padding: 7px 9px !important;
        margin-bottom: 5px !important;
        font-size: 14px;
    }

    .custom-g-btn {
        min-height: 32px;
        padding: 5px 8px;
        font-size: 13px;
    }

    .g-icon {
        width: 15px;
        height: 15px;
        margin-right: 7px;
    }

    .privacy-row {
        margin: 5px 0 4px 0 !important;
        gap: 5px !important;
        font-size: 10px !important;
        line-height: 1.1;
    }

    .privacy-row input {
        width: 13px !important;
        height: 13px !important;
    }

    .auth-buttons-row {
        gap: 6px;
        margin-top: 5px;
    }

    .auth-buttons-row button,
    #forgot-fields button {
        padding: 7px 8px;
        min-height: 30px;
        font-size: 12px;
    }

    #forgot-pass-link {
        margin: 6px 0 0;
        font-size: 11px;
    }
}

#email-auth-box input,
#reset-password-box input {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    
    background: rgba(0, 0, 0, 0.4); /* Полупрозрачный темный фон */
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff; /* Белый текст ввода */
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* Цвет плейсхолдера (подсказки) */
#email-auth-box input::placeholder,
#reset-password-box input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* При клике на инпут */
#email-auth-box input:focus,
#reset-password-box input:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 5px rgba(74, 144, 226, 0.5);
}

/* 🟢 ССЫЛКИ "ЗАБЫЛИ ПАРОЛЬ" И "НАЗАД" */
#forgot-pass-link, .btn-back-to-login {
    color: rgba(255, 255, 255, 0.6) !important;
}

#forgot-pass-link:hover, .btn-back-to-login:hover {
    color: #ffffff !important;
}

/* 🟢 ПЛАШКА СО СТАТИСТИКОЙ (ПИКСЕЛИ) */
.pixel-stats {
    margin-top: 12px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9) !important;
    background: rgba(255, 255, 255, 0.1) !important; /* Полупрозрачный светлый фон */
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 8px;
    border-radius: 6px;
}



#color-container {
    position: absolute;
    bottom: 20px;         
    left: 50%;
    transform: translateX(-50%);
    
    /* 🟢 Ширина: почти во весь экран на десктопе */
    width: 90%; 
    max-width: 1200px; /* Чтобы не была слишком длинной на 4K мониторах */
    
    /* 🟢 Высота: строго не более 200px */
    max-height: 300px !important; 
    height: auto; 
    top: auto !important;
    
    background: rgba(15, 15, 15, 0.85); 
    backdrop-filter: blur(18px) saturate(170%) !important;
    -webkit-backdrop-filter: blur(18px) saturate(170%) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    
    border-radius: 20px;
    padding: 15px 25px;
    z-index: 1000;
    
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    
    animation: slideUpPalette 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden; 
}

/* Классы для скрытия */
#color-container.auth-hidden {
  display: none;
}

.color-picker-header {
  display: flex;
  justify-content: flex-start; 
  align-items: center;
  gap: 15px;
  width: 100%;                 
  margin-bottom: 10px;         
  padding: 0 5px;
  height: 35px;                
  box-sizing: border-box;      
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-icon {
  width: 20px;
  height: 20px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.header-icon:hover {
  opacity: 1;
}

.header-left span {
  font-weight: 600;
  font-size: 16px;
}

/* Сетка цветов */
color-grid {
    display: flex;
    flex-wrap: wrap;
    /* 🟢 Равномерно распределяем или центрируем */
    justify-content: center; 
    gap: 15px; 
    width: 100%;
    margin-top: 10px;
    
    overflow-y: auto; 
    padding-bottom: 10px; 
}

/* --- Красивый ползунок прокрутки для палитры --- */
.color-grid::-webkit-scrollbar {
    width: 6px; /* Тонкий скролл */
}
.color-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05); 
    border-radius: 10px;
}
.color-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2); 
    border-radius: 10px;
}
.color-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4); 
}

/* --- КРУЖОЧКИ ЦВЕТОВ --- */
.color-swatch {
    width: 32px !important;  
    height: 32px !important;
    padding: 0 !important;   
    flex-shrink: 0;          
    border-radius: 0 !important; 
    border: none !important; 
    cursor: pointer;
    position: relative;
    z-index: 1;
    
    /* Делаем основной фон прозрачным, так как цвет теперь рисуется в ::before */
    background-color: transparent !important; 
    background-image: none !important;
    
    /* Тень и анимации остаются на главном контейнере */
    filter: drop-shadow(2px 2px 0px rgba(0,0,0,0.4));
    transition: transform 0.15s steps(3);
}

/* 2. Внутренний слой краски (именно он обрезается под 8-бит) */
.color-swatch::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--bg); /* Берем цвет из JS */
    z-index: 0;
    
    clip-path: polygon(
        30% 0%, 70% 0%, 70% 10%, 80% 10%, 80% 20%, 90% 20%, 90% 30%, 100% 30%, 
        100% 70%, 90% 70%, 90% 80%, 80% 80%, 80% 90%, 70% 90%, 70% 100%, 30% 100%, 
        30% 90%, 20% 90%, 20% 80%, 10% 80%, 10% 70%, 0% 70%, 0% 30%, 10% 30%, 
        10% 20%, 20% 20%, 20% 10%, 30% 10%
    );
}

/* Эффект наведения */
.color-swatch:hover {
    transform: scale(1.2) translateY(-2px) !important;
    z-index: 10 !important;
    /* Хак для создания "пиксельной" обводки вокруг сложной фигуры */
    filter: drop-shadow(2px 0 0 white) 
            drop-shadow(-2px 0 0 white) 
            drop-shadow(0 2px 0 white) 
            drop-shadow(0 -2px 0 white) 
            drop-shadow(2px 4px 0px rgba(0,0,0,0.5)) !important;
}

/* Выбранный цвет: Такая же пиксельная белая обводка, но круг зафиксирован */
.color-swatch.active {
    transform: scale(1.15) !important;
    z-index: 5;
    filter: drop-shadow(1px 0 0 white) 
            drop-shadow(-1px 0 0 white) 
            drop-shadow(0 1px 0 white) 
            drop-shadow(0 -1px 0 white) !important;
}

/* Ластик (прозрачный) */
.color-swatch.is-transparent {
    background-color: #eee !important;
    background-image: 
        linear-gradient(45deg, #ccc 25%, transparent 25%), 
        linear-gradient(-45deg, #ccc 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #ccc 75%), 
        linear-gradient(-45deg, transparent 75%, #ccc 75%) !important;
    background-size: 8px 8px !important;
    background-position: 0 0, 0 4px, 4px 4px, 4px 0 !important;
}

/* Панель действий */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.tactile-btn {
  background-color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  transition: background-color 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tactile-btn:hover {
  background-color: #f8fafc;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.tactile-btn.active {
  background-color: #e0e8f0;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.tactile-btn img {
  width: 18px;
  height: 18px;
}

.paint-btn {
  flex-grow: 1;
  font-weight: 600;
  font-size: 14px;
}

.scroll-btn, .eraser-btn {
  width: 40px;
  height: 40px;
}

.hidden-box {
    display: none;
    flex-direction: column;
    gap: 8px;
}

/* Элементы формы */
#email-auth-box input {
    width: 100%;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
}

.auth-buttons-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.auth-buttons-row button, #forgot-fields button {
    flex: 1;
    padding: 10px;
    cursor: pointer;
    border: none;
    border-radius: 6px;
    background: #4a90e2;
    color: white;
    font-weight: bold;
}

.auth-buttons-row button:hover, #forgot-fields button:hover {
    background: #357abd;
}

#forgot-pass-link {
    font-size: 13px;
    color: #666;
    text-align: center;
    cursor: pointer;
    margin-top: 12px;
    text-decoration: underline;
}

.avatar-img {
    width: 50px;
    height: 50px;
    border-radius: 0%;
    border: 2px solid #4a90e2;
}

.pixel-stats {
    margin-top: 12px;
    font-size: 13px;
    color: #444;
    background: #f0f0f0;
    padding: 5px;
    border-radius: 4px;
}

.btn-logout {
    margin-top: 15px;
    width: 100%;
    padding: 8px;
    background: #ff4d4d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.pass-confirm{
    display: none;
}

.btn-back-to-login{
display: none; 
cursor: pointer; 
text-align: center; 
margin-top: 10px; 
text-decoration: underline; 
font-size: 13px; 
color: #666;
display: none;
}

/* Сетка цветов внутри широкой панели */
.color-grid {
    display: flex !important;       
    flex-wrap: wrap !important;     
    justify-content: flex-start;    
    gap: 15px; 
    width: 100%;
    
    /* 🟢 Убираем внешний отступ (margin) и делаем внутренний (padding) */
    margin-top: 0 !important; 
    padding: 10px 5px 15px 5px !important; /* Даем воздух сверху, по бокам и снизу */
    
    overflow-y: auto; 
}

.color-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* Эффект при наведении */
color-dot:hover {
    transform: scale(1.15) translateY(-2px);
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 5px 10px rgba(0,0,0,0.5);
}

.color-dot.active {
    border-color: #ffffff;
    border-width: 3px;
    transform: scale(1.1);
}

/* Анимация выезда */
@keyframes slideUpPalette {
    from {
        transform: translate(-50%, 100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* --- АДАПТИВНОСТЬ ДЛЯ ТЕЛЕФОНОВ --- */
@media (max-width: 768px) {
    #color-container {
        width: 100%;       /* Во всю ширину экрана */
        bottom: 0;         /* Прижимаем вплотную к низу */
        border-radius: 20px 20px 0 0; /* Скругляем только верхние углы */
        border-bottom: none;
        
        /* Дополнительный отступ для айфонов с "челкой" внизу (safe area) */
        padding-bottom: calc(15px + env(safe-area-inset-bottom, 10px));
    }
    
    .color-grid {
        gap: 5px; 
    }

    .color-swatch {
        width: 32px !important;  /* На мобилке делаем крупнее */
        height: 32px !important;
    }
}

#map canvas {
    /* /* cursor: default !important; */
    cursor: url('/cursor.png') 0 0, crosshair !important;
}

.balance-low {
    color: #ff4444;
    font-weight: bold;
    transition: color 0.3s ease;
}

#overlay-container {
    width: 100%;
    box-sizing: border-box;
    background: transparent; /* Убрали белый фон, теперь стекло от родителя */
    border: none;
    color: rgba(255, 255, 255, 0.85);
    
    /* 🟢 Анимация выпадания (Accordion) */
    max-height: 0; 
    padding: 0 20px; /* По бокам отступы есть, сверху-снизу нет */
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease, opacity 0.3s ease, visibility 0.4s;
    
    /* Убираем старое позиционирование */
    position: static;
    box-shadow: none;
}

#overlay-container.open {
    max-height: 600px; /* С запасом для списка трафаретов */
    padding: 20px;     /* Возвращаем отступы */
    opacity: 1;
    visibility: visible;
    overflow-y: auto;  /* Добавляем скролл, если трафаретов будет много */
}
/* 
.file-input-label {
    display: block;
    background: #4285f4;
    color: white;
    padding: 10px;
    text-align: center;
    border-radius: 5px;
    cursor: pointer;
}

.control-group { margin: 10px 0; }

.btn-small {
    background: #eee;
    border: 1px solid #ccc;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}
.btn-small:hover { background: #ddd; }

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    50% { transform: translateX(3px); }
    75% { transform: translateX(-3px); }
    100% { transform: translateX(0); }
}

/* === НОВОЕ: Свечение для критического баланса === */
.low-balance {
    color: #ff4d4d !important; /* Ярко-красный */
    /* Усиленное красное свечение текста */
    text-shadow: 0 0 5px #ff4d4d, 0 0 10px #ff4d4d, 0 0 15px rgba(255, 77, 77, 0.8) !important;
    display: inline-block;
    animation: shake 0.2s ease-in-out 1;
}

/* Добавим плавный переход для цвета и тени */
#pixel-balance {
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.balance-increase {
    color: #4CAF50 !important;
    text-shadow: 0 0 12px #4CAF50 !important;
}

.balance-decrease {
    color: #f44336 !important;
    text-shadow: 0 0 12px #f44336 !important;
}
.glass-debug-panel {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    z-index: 1000;

    justify-content: center; /* Выравнивает по горизонтали */
    align-items: center;
    
    display: flex;
    flex-direction: column; /* Элементы идут сверху вниз */
    
    /* Стекло, тень и скругление теперь ТОЛЬКО ЗДЕСЬ */
    background: rgba(15, 15, 15, 0.85); 
    backdrop-filter: blur(18px) saturate(170%) !important;
    -webkit-backdrop-filter: blur(18px) saturate(170%) !important;
    
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: none; 
    border-radius: 0 0 12px 12px; 
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6);
    
    font-family: 'PacMan1980', sans-serif;
    color: rgba(255, 255, 255, 0.7); 
    font-size: 22px;
    letter-spacing: 0.5px;
    
    overflow: visible;
}

.account-ban-banner {
    position: fixed;
    top: calc(58px + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 950;
    width: min(760px, calc(100vw - 24px));
    box-sizing: border-box;
    padding: 10px 16px;
    border-radius: 10px;
    background: rgba(120, 12, 20, 0.78);
    border: 1px solid rgba(255, 95, 105, 0.38);
    box-shadow: 0 10px 26px rgba(80, 0, 0, 0.38);
    backdrop-filter: blur(16px) saturate(170%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(170%) !important;
    color: rgba(255, 245, 245, 0.96);
    text-align: center;
    font-size: 15px;
    line-height: 1.35;
    letter-spacing: 0;
    pointer-events: none;
}

@media (max-width: 768px) {
    .account-ban-banner {
        top: calc(112px + env(safe-area-inset-top));
        width: calc(100vw - 16px);
        padding: 9px 12px;
        font-size: 13px;
        border-radius: 8px;
    }
}

@media (max-width: 900px) and (max-height: 520px) and (orientation: landscape) {
    .account-ban-banner {
        top: calc(54px + env(safe-area-inset-top));
        width: min(680px, calc(100vw - 18px));
        padding: 7px 10px;
        font-size: 12px;
    }
}

.debug-header {
    display: flex;
    align-items: center;
    justify-content: space-between; /* 🟢 Расталкиваем текст влево, кнопки вправо */
    width: 100%;
    height: 48px;
    min-height: 48px;
    padding: 0 15px; /* 🟢 Убрали гигантский padding-right */
    box-sizing: border-box;
}

.glass-debug-panel.auth-open {
    border-radius: 0;
    box-shadow: none; /* Убираем тень, чтобы не падала на выезжающее меню */
    border-bottom: none !important;
}

.debug-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    flex: 1; /* 🟢 Занимает всё свободное место ДО блока с кнопками */
    height: 48px;
    min-height: 48px;
    overflow: visible;
}

.pixel-author-stack {
    display: flex;
    flex-direction: column;
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    height: 48px;
    align-self: center;
}

.debug-row {
    display: flex;
    align-items: center;
    white-space: nowrap;
    justify-content: flex-start;
    min-width: 0; 
}

.rank-icon {
    width: 24px !important;
    height: 24px !important;
    object-fit: contain;
    flex-shrink: 0; /* Запрещаем сплющивание или растягивание */
    border-radius: 50%; 
    overflow: hidden;
}

.pixel-rank-box,
.profile-rank-box {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 34px;
    max-width: 74px;
    gap: 1px;
}

.pixel-rank-name,
.profile-rank-name {
    display: block;
    max-width: 74px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    line-height: 1;
    font-size: 8px;
    color: rgba(255, 255, 255, 0.72);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

.profile-rank-name {
    font-size: 9px;
}

.debug-row:nth-child(1) {
    flex-grow: 1; /* Занимает всё свободное пространство */
    padding: 0 10px;
    overflow: hidden; /* Обрезаем, если имя слишком длинное */
}

#author-bg-wrapper {
    height: 48px !important;
    min-height: 48px !important;
    position: relative;
    z-index: 2;
}

.balance-row {
    min-height: 48px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.debug-row span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis; /* Три точки, если имя не влезло */
    white-space: nowrap;
    font-size: 20px;
}

.debug-row .pixel-rank-box {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: visible;
    font-size: inherit;
}

.debug-row .pixel-rank-name {
    font-size: 8px;
}

@media (max-width: 768px) {
    /* Твои базовые настройки панели */
    .glass-debug-panel {
        width: 100%;
        border-radius: 0;
        left: 0;
        transform: none;
        padding-right: 0; 
        
    }

    /* Настройки шапки для мобилок */
    .debug-header {
        padding: 5px 10px; /* 🟢 Просто аккуратные отступы по бокам */
        height: 90px;
        min-height: 90px; /* Высота под две строки текста */
        align-items: center;
    }

    /* Логика переноса в две строки */
    .debug-content {
        height: 90px;
        min-height: 90px;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 4px;
        padding: 0; /* 🟢 Убрали лишние отступы */
        box-sizing: border-box;
        flex: 1;
        overflow: visible;

    }

    /*  Баланс пикселей (наверх) */
    .balance-row {
        order: -1; /* Заставляем этот блок стать первым */
        font-size: 20px;
        flex: none !important;  /* Запрещаем растягиваться */
        min-height: auto !important;
        height: auto !important; /* Убираем высоту 100% если она была */
        margin: 0 !important;    /* Убиваем любые внешние отступы */
        padding: 0 !important;
        line-height: 1.2;
    }


    /* Логин пользователя (вниз) */
    .pixel-author-stack {
        order: 1;
        width: 100%;
        height: 36px;
        flex: 0 0 36px;
        align-self: stretch;
        max-width: 100%;
    }

    .debug-row:nth-child(1) {
        font-size: 18px;
        line-height: 1;
        padding: 0;
        flex: 0 0 auto;
        max-width: 100%; /* Разрешаем занимать всё доступное место до кнопок */
    }

    #author-bg-wrapper {
        height: 36px !important;
        min-height: 36px !important;
        flex: 0 0 36px !important;
        width: 100%;
        box-sizing: border-box;
        padding: 0 !important;
    }

    .pixel-rank-box {
        max-width: 58px;
        min-width: 30px;
    }

    .pixel-rank-name {
        max-width: 58px;
        font-size: 7px;
    }

    /* Скрываем вертикальную черточку-разделитель (она больше не нужна) */
    .debug-divider {
        display: none;
    }
    .panel-actions {
        display: grid; /* Включаем сетку вместо линии */
        grid-template-columns: auto auto; /* Две колонки по размеру кнопок */
        gap: 8px 12px; /* 8px между рядами (по вертикали), 12px между колонками (по горизонтали) */
        margin-left: 10px;
        align-items: center;
        justify-items: center;
    }
}

@media (max-width: 900px) and (max-height: 520px) and (orientation: landscape) {
    .glass-debug-panel {
        max-height: 100dvh;
    }

    .debug-header {
        height: 64px;
        min-height: 64px;
        padding: 4px 10px;
    }

    .debug-content {
        height: 64px;
        min-height: 64px;
        gap: 2px;
    }

    .balance-row {
        font-size: 18px;
    }

    .pixel-author-stack {
        height: 30px;
        flex-basis: 30px;
    }

    #author-bg-wrapper {
        height: 30px !important;
        min-height: 30px !important;
        flex-basis: 30px !important;
    }

    .panel-actions {
        gap: 6px 10px;
        margin-left: 8px;
    }
}

.panel-actions {
    /* 🟢 Убрали position: absolute, теперь это полноценный flex-элемент */
    display: flex;
    align-items: center;
    gap: 12px; 
    flex-shrink: 0; /* 🟢 Запрещаем кнопкам сжиматься, если текст слишком длинный */
    z-index: 10;
    margin-left: 15px; /* Отступ между балансом и первой кнопкой */
    min-height: 48px;
    align-self: center;
}

.inspector-btn {
    position: relative; 
    display: flex;
    align-items: center;
    justify-content: center;
    
    width: 25px; 
    height: 25px;
    
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    outline: none;
    cursor: pointer;
    overflow: visible; 
}

#cur-avatar {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.22);
    box-sizing: border-box;
}

.btn-icon {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Попробуй вернуть contain, если картинка стала сплюснутой */
    pointer-events: none;
    
    /* Убираем любые фильтры, если они дают странные артефакты (полоски) */
    
    filter: drop-shadow(0 0 5px #fb0606);
    
    /* Если на самой картинке есть мусор по краям, этот хак его скроет: */
    border-radius: 4px; 

}

.inspector-btn.active .btn-icon {
    filter: drop-shadow(0 0 5px #00ff3c);
}

@keyframes shake-error {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* 2. Класс, который будет запускать анимацию */
.shake-error {
    animation: shake-error 0.4s ease-in-out;
}


#pixel-balance {
    display: inline-block;
    text-align: center;
}

#pipette-btn {
    background: transparent; /* Убираем фон */
    border: none;            /* Убираем рамку */
    padding: 0;              /* Убираем внутренние отступы */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, filter 0.2s ease;
    outline: none;           /* Убираем стандартную обводку браузера при клике */
}

#overlay-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* Чтобы клики проходили сквозь холст на карту */
  z-index: 10; /* Выше карты, но ниже меню */
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.glass-modal-overlay {
    position: fixed;
    top: 20%; /* Показываем чуть выше центра, чтобы не закрывать палитру */
    left: 0; right: 0;
    pointer-events: none; /* 🟢 ПРОПУСКАЕТ ВСЕ КЛИКИ И СКРОЛЛ СКВОЗЬ СЕБЯ */
    z-index: 3000; 
    display: none; 
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease-out; /* Плавное затухание */
    opacity: 1;
}

.glass-modal-content {
    background: rgba(15, 15, 15, 0.85);
    backdrop-filter: blur(18px) saturate(170%) !important;
    -webkit-backdrop-filter: blur(18px) saturate(170%) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 15px 25px; /* Сделали чуть компактнее */
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    max-width: 280px;
    animation: popUpModal 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.glass-modal-content h3 {
    color: #fff;
    margin: 0 0 8px 0;
    font-family: sans-serif;
    font-size: 18px;
}

.glass-modal-content p {
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    font-family: sans-serif;
    font-size: 13px;
    line-height: 1.4;
}

@keyframes popUpModal {
    from { transform: scale(0.8) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

#google-btn-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    
}

/* Сама кнопка Google через ID */
#google-btn {
    width: 250px;
}

/* Делаем кнопку по размеру и стилю как обычный инпут */
.custom-g-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  
  /* Тот самый темный фон как у твоих инпутов */
  background-color: rgba(0, 0, 0, 0.4); 
  border: 1px solid rgba(255, 255, 255, 0.2); 
  color: #fff;
  border-radius: 6px; 
  
  padding: 8px; /* Отступы как у инпута */
  font-family: inherit;
  font-size: 16px;
  box-sizing: border-box;
  
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

/* Эффект при наведении */
.custom-g-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Уменьшаем огромный SVG до размера иконки */
.g-icon {
  width: 18px; 
  height: 18px;
  margin-right: 10px; /* Отступ между иконкой и текстом */
}


/*avatar container */
.avatar-container {
    position: relative;
    display: inline-block;
}
.edit-avatar-btn {
    position: absolute;

    bottom: -5px;
    right: -5px;
    background: rgba(0,0,0,0.7);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

#vkid-container [class*="VkIdSdk_oauth_link_text"], 
#vkid-container span[class*="title"] {
    display: none !important;
}

/* Если текст идет как "или", можно скрыть весь блок заголовка */
#vkid-container header {
    display: none !important;
}

/* Всплывающие окошко о событиях */
/* Контейнер-невидимка, чтобы плашки собирались в стопку */
#toast-container {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px; /* Расстояние между несколькими уведомлениями */
  pointer-events: none; /* Пропускаем клики на карту сквозь контейнер */
  align-items: center;
}

/* Сама плашка */
.glass-toast {
  background: rgba(20, 20, 20, 0.85); /* Темное стекло */
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 15px;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  text-align: center;
  max-width: 300px;
  word-wrap: break-word;
  
  /* Начальное состояние для анимации */
  opacity: 0;
  transform: translateY(-15px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Цветовые акценты (как бордер слева) */
.glass-toast.error {
  border-left: 3px solid #ff4747; /* Красный как у тебя на кнопке удаления */
}

.glass-toast.success {
  border-left: 3px solid #28a745; /* Зеленый */
}

.glass-toast.info {
  border-left: 3px solid #4285F4; /* Синий как у Гугла */
}

/* === АДМИН ПАНЕЛЬ (РАДАР) === */
.admin-sidebar {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 280px;
    max-height: calc(100vh - 40px);
    background: rgba(15, 15, 15, 0.85);
    backdrop-filter: blur(18px) saturate(170%) !important;
    -webkit-backdrop-filter: blur(18px) saturate(170%) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

.admin-header {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.admin-users-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Красивый скроллбар */
.admin-users-list::-webkit-scrollbar { width: 6px; }
.admin-users-list::-webkit-scrollbar-track { background: transparent; }
.admin-users-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 10px; }

.admin-ban-list-btn {
    width: 100%;
    margin-top: 8px;
    padding: 7px 10px;
    border: 1px solid rgba(255, 116, 116, 0.35);
    border-radius: 6px;
    background: rgba(244, 67, 54, 0.18);
    color: #ffb3b3;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
}

.admin-ban-list-btn.active {
    border-color: rgba(76, 175, 80, 0.45);
    background: rgba(76, 175, 80, 0.18);
    color: #8cff9b;
}

.admin-radar-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-radar-section + .admin-radar-section {
    margin-top: 4px;
}

.admin-radar-section-header {
    width: 100%;
    display: grid;
    grid-template-columns: 14px 1fr auto;
    align-items: center;
    gap: 6px;
    padding: 6px 7px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    text-align: left;
}

.admin-radar-section-header b {
    color: rgba(255, 255, 255, 0.72);
    font-size: 10px;
}

.admin-radar-section-caret {
    display: inline-block;
    transition: transform 0.15s ease;
}

.admin-radar-section.collapsed .admin-radar-section-caret {
    transform: rotate(-90deg);
}

.admin-radar-section-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-radar-section.collapsed .admin-radar-section-body {
    display: none;
}

.admin-empty-list {
    padding: 14px;
    color: rgba(255, 255, 255, 0.52);
    text-align: center;
    font-size: 12px;
}

.admin-user-color-banned {
    background: #f44336;
    box-shadow: 0 0 10px rgba(244, 67, 54, 0.75);
}

.admin-user-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transition: background 0.2s;
}

.admin-user-card:hover {
    background: rgba(255, 255, 255, 0.1);
}

.admin-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.admin-user-color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
}

.admin-user-details {
    display: flex;
    flex-direction: column;
}

.admin-user-name {
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.admin-user-coords {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.admin-teleport-btn {
    background: #4CAF50;
    border: none;
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: background 0.2s, transform 0.1s;
}

.admin-teleport-btn:hover { background: #45a049; }
.admin-teleport-btn:active { transform: scale(0.95); }

.admin-ban-panel {
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
}

.admin-ban-title {
    margin-bottom: 8px;
    color: #ff7474;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.admin-ban-current,
.admin-ban-status {
    color: rgba(255, 255, 255, 0.68);
    font-size: 11px;
    line-height: 1.35;
}

.admin-ban-current.active {
    color: #ffb3b3;
}

.admin-ban-reason,
.admin-ban-until {
    width: 100%;
    box-sizing: border-box;
    margin-top: 8px;
    padding: 7px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(0, 0, 0, 0.32);
    color: white;
    outline: none;
    font-size: 12px;
}

.admin-ban-reason {
    resize: vertical;
    min-height: 48px;
}

.admin-ban-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.admin-ban-permanent {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 11px;
    white-space: nowrap;
}

.admin-ban-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.admin-ban-btn {
    border: none;
    border-radius: 6px;
    padding: 8px 10px;
    color: white;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
}

.admin-ban-apply {
    background: rgba(244, 67, 54, 0.88);
}

.admin-ban-clear {
    background: rgba(76, 175, 80, 0.75);
}

.admin-ban-status {
    min-height: 14px;
    margin-top: 8px;
}

.admin-ban-status.error {
    color: #ff8a8a;
}

.admin-ban-status.success {
    color: #8cff9b;
}

.admin-user-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.admin-user-summary-avatar,
.admin-team-summary-avatar {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    object-fit: cover;
    image-rendering: pixelated;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.admin-team-summary-avatar {
    width: 22px;
    height: 22px;
    border-radius: 6px;
}

.admin-avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
    font-weight: bold;
}

.admin-user-summary-main {
    min-width: 0;
    flex: 1;
}

.admin-user-summary-name {
    color: #4CAF50;
    font-size: 14px;
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-user-summary-meta {
    color: rgba(255, 255, 255, 0.62);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-user-summary-team {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 11px;
    min-width: 0;
}

.admin-user-summary-team span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-user-summary-team.muted {
    color: rgba(255, 255, 255, 0.42);
}

.admin-user-finance-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 10px;
}

.admin-user-finance-row span {
    padding: 6px 7px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.2);
    color: rgba(255, 255, 255, 0.62);
    font-size: 10px;
    text-align: center;
}

.admin-user-finance-row b {
    display: block;
    color: #11c5c5;
    font-size: 12px;
}

.admin-finance-panel,
.admin-purchases-panel {
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
}

.admin-finance-title {
    margin-bottom: 8px;
    color: #11c5c5;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.admin-finance-current {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}

.admin-finance-current span {
    padding: 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.65);
    font-size: 10px;
    text-align: center;
}

.admin-finance-current b {
    display: block;
    color: #11c5c5;
    font-size: 12px;
}

.admin-finance-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.admin-finance-grid input,
.admin-finance-note {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(0, 0, 0, 0.32);
    color: white;
    outline: none;
    font-size: 11px;
}

.admin-finance-note {
    margin-top: 8px;
    resize: vertical;
    min-height: 44px;
}

.admin-finance-btn {
    width: 100%;
    margin-top: 8px;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    background: rgba(17, 197, 197, 0.78);
    color: white;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
}

.admin-finance-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.admin-purchases-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
}

.admin-purchase-item {
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.045);
}

.admin-purchase-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-purchase-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    color: white;
    font-size: 10px;
    font-weight: bold;
    flex-shrink: 0;
}

.admin-purchase-badge.pix {
    background: rgba(17, 197, 197, 0.28);
    border: 1px solid rgba(17, 197, 197, 0.5);
}

.admin-purchase-badge.fiat {
    background: rgba(76, 175, 80, 0.28);
    border: 1px solid rgba(76, 175, 80, 0.5);
}

.admin-purchase-title {
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    font-weight: bold;
}

.admin-purchase-date {
    color: rgba(255, 255, 255, 0.45);
    font-size: 10px;
}

.admin-purchase-details {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 7px;
}

.admin-purchase-details span {
    padding: 3px 5px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.24);
    color: rgba(255, 255, 255, 0.68);
    font-size: 10px;
}

/* Контейнер фильтров в инспекторе */
.inspector-filters-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.filter-group label {
    display: block;
    font-size: 11px;
    color: #4CAF50;
    margin-bottom: 5px;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.input-row {
    display: flex;
    gap: 5px;
}

.inspector-filters-grid input {
    flex: 1;
    background: rgba(15, 15, 15, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    padding: 6px 8px !important;
    font-size: 10px !important;
    border-radius: 4px;
    min-width: 0; /* Чтобы инпуты не распирали флекс */
}

/* Специфический фикс для иконок календаря в Chrome */
.inspector-filters-grid input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.5;
    cursor: pointer;
}

.fetch-btn {
    width: 100%;
    padding: 10px;
    background: #4CAF50;
    border: none;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    transition: background 0.2s, transform 0.1s;
    margin-top: 5px;
}

.fetch-btn:hover { background: #45a049; }
.fetch-btn:active { transform: scale(0.98); }

/* =========================================
   МОДАЛЬНОЕ ОКНО РЕДАКТОРА АВАТАРОВ
========================================= */

#avatar-editor-modal {
    display: none; /* JS переключит в flex при открытии */
    position: fixed !important;
    z-index: 6000 !important;
    background: rgba(0, 0, 0, 0.7) !important;

    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;

    width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;

    align-items: center !important;
    justify-content: center !important;

    padding:
        max(10px, env(safe-area-inset-top))
        max(10px, env(safe-area-inset-right))
        max(10px, env(safe-area-inset-bottom))
        max(10px, env(safe-area-inset-left)) !important;

    box-sizing: border-box !important;
    overflow: hidden !important;
}

/* Глобальная палитра ВСЕГДА выше редактора */
#color-container {
    z-index: 2600 !important; 
}

/* Само стеклянное окно */
#avatar-modal-content {
    background: rgba(25, 25, 25, 0.9);
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px;

    padding: 20px !important;
    width: min(95vw, 680px) !important;
    max-width: 680px !important;

    max-height: calc(
        100dvh - max(20px, env(safe-area-inset-top)) - max(20px, env(safe-area-inset-bottom))
    ) !important;

    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;

    box-sizing: border-box !important;
    color: white;
    text-align: center;
}

/* Макет: разделение на колонки */
.avatar-main-layout {
    display: flex;
    gap: 20px;
    align-items: center; /* Центрируем холст и инструменты по вертикали */
    justify-content: center;
}

/* 🟢 ЛЕВАЯ ЧАСТЬ: Контейнер холста (жесткая фиксация размера) */
.avatar-canvas-wrapper {
    flex: 0 0 auto; 
    width: 300px; /* Базовый стабильный размер для ПК */
    max-width: 100%;
}

/* Сам холст */
#avatar-canvas {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1; /* Жестко держим квадрат */
    display: block;
    margin: 0 auto;
    background: #ffffff;
    image-rendering: pixelated; 
    border-radius: 4px; /* Легкое скругление углов холста */
    touch-action: none; /* Отключаем жесты браузера (зум/скролл) при рисовании */
    /* Убраны max-height: 45vh и flex-shrink, которые ломали размер! */
}

/* 🟢 ПРАВАЯ ЧАСТЬ: Палитра и кнопки */
.avatar-controls-wrapper {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    max-width: 320px;
}

.avatar-tools-row button, 
.avatar-controls-wrapper > div:last-child button {
    transition: filter 0.2s;
}
.avatar-tools-row button:active, 
.avatar-controls-wrapper > div:last-child button:active {
    filter: brightness(0.8);
}


/* =========================================
   АДАПТИВНОСТЬ: МОБИЛЬНЫЕ ТЕЛЕФОНЫ (Вертикально)
========================================= */
@media (max-width: 768px) {
    .avatar-main-layout {
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;

        /* Палитру спускаем ниже относительно канваса */
        gap: 18px !important;

        overflow: hidden !important;
    }

    .avatar-canvas-wrapper {
        flex: 0 0 auto !important;
        width: min(58vw, 210px) !important;
        max-width: 210px !important;

        /* Канвас тоже центрируем */
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    #avatar-canvas {
        width: 100% !important;
        height: auto !important;
        max-height: 210px !important;
        touch-action: none !important;
        display: block !important;
        margin: 0 auto !important;
    }

    .avatar-controls-wrapper {
        flex: 1 1 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        min-height: 0 !important;

        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;

        /* Важно: не обрезаем выбранный цвет/свечение */
        overflow: visible !important;
    }

    #avatar-color-picker-container {
    width: 100% !important;

    /* iPhone 12: оставляем место под кнопки снизу */
    flex: 0 0 min(300px, 34dvh) !important;
    height: min(300px, 34dvh) !important;
    min-height: min(300px, 34dvh) !important;
    max-height: min(300px, 34dvh) !important;

    margin-top: 8px !important;
    padding: 10px 6px 4px !important;

    box-sizing: border-box !important;

    overflow: hidden !important;
    overscroll-behavior: none !important;
    touch-action: manipulation !important;
}

    #avatar-color-picker-container .color-grid,
    #avatar-color-picker-container color-grid {
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;

        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        align-content: flex-start !important;
        align-items: center !important;

        gap: 8px !important;

        padding: 10px 8px 8px !important;
        margin: 0 auto !important;

        box-sizing: border-box !important;

        overflow: hidden !important;
    }

    .avatar-tools-row {
    width: 100% !important;
    flex: 0 0 auto !important;

    justify-content: center !important;
    align-items: center !important;

    gap: 8px !important;
    margin-top: 8px !important;
    padding-bottom: 4px !important;

    flex-wrap: wrap !important;
    overflow: visible !important;
}

    #avatar-modal-content button {
        padding: 7px 9px !important;
        font-size: 12px !important;
        flex-shrink: 0 !important;
    }
    #avatar-modal-content {
        overflow: hidden !important;
    }

    .avatar-controls-wrapper {
        overflow: hidden !important;
    }
}

@media (max-width: 430px) and (max-height: 850px) {
    #avatar-color-picker-container {
        flex-basis: 260px !important;
        height: 260px !important;
        min-height: 260px !important;
        max-height: 260px !important;
        padding-top: 4px !important;
        box-sizing: border-box !important;


        overflow: hidden !important;
    }

    #avatar-color-picker-container .color-grid,
    #avatar-color-picker-container color-grid {
        height: 100% !important;
        max-height: 100% !important;

        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;

        gap: 7px !important;
        padding: 8px 6px 12px !important;
        box-sizing: border-box !important;
    }

    .avatar-canvas-wrapper {
        width: min(54vw, 190px) !important;
        max-width: 190px !important;
    }

    #avatar-canvas {
        max-height: 190px !important;
    }
    #avatar-modal-content {
        overflow: hidden !important;
    }

    .avatar-controls-wrapper {
        overflow: hidden !important;
    }
}

/* =========================================
   АДАПТИВНОСТЬ: ПОВЕРНУТЫЙ ТЕЛЕФОН (Landscape)
========================================= */
@media (orientation: landscape) and (max-height: 500px) {

    #avatar-color-picker-container .color-grid,
    #avatar-color-picker-container color-grid {
        column-gap: 5px !important;
        
        row-gap: 4px !important;
        padding-left: 4px !important;
        padding-right: 4px !important;
    }


    #avatar-modal-content {
        max-width: 580px !important;
        max-height: calc(
            100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 12px
        ) !important;
        padding: 8px !important;
    }

    .avatar-main-layout {
        flex-direction: row !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }

    .avatar-canvas-wrapper {
        width: min(36dvh, 210px) !important;
        max-width: 210px !important;
    }

    #avatar-canvas {
        max-height: 210px !important;
    }

    #avatar-modal-content button {
        padding: 6px 8px !important;
        font-size: 11px !important;
    }

    #avatar-color-picker-container {
        max-height: 160px !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }
    #avatar-color-picker-container .color-grid,
    #avatar-color-picker-container color-grid {
    column-gap: 6px !important;
    row-gap: 5px !important;

    padding-top: 6px !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
    padding-bottom: 4px !important;

    box-sizing: border-box !important;
}
}


/* =========================================
   КНОПКА АВАТАРА (Интерфейс пользователя)
========================================= */
.avatar-hover-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
    width: 40px; 
    height: 40px;
    border-radius: 6px; /* Небольшое скругление аватарки в меню */
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.22);
    box-sizing: border-box;
    overflow: hidden; 
}

.avatar-hover-wrapper #user-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    object-position: center; 
    margin: 0 !important; 
    padding: 0 !important; 
    border: none !important;
    display: block;
    image-rendering: pixelated; 
}

.avatar-edit-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* Заменил на темное затемнение (на нем белая иконка читается лучше) */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0; 
    transition: opacity 0.2s ease-in-out; 
}

.avatar-hover-wrapper:hover .avatar-edit-overlay {
    opacity: 1;
}

.avatar-edit-overlay img {
    width: 24px; 
    height: 24px;
    opacity: 0.9;
    filter: invert(1); /* Делает черную иконку белой (если она изначально черная) */
}

/* ========================================== */
/* 🗺️ БАЗОВЫЕ НАСТРОЙКИ КОНТЕЙНЕРА КАРТЫ      */
/* ========================================== */

/* Критично для мобильных: предотвращает растягивание и появление скролла */
#map {
    width: 100vw;
    height: 100dvh;
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden; 
}

/* ========================================== */
/* 🟢 КАСТОМИЗАЦИЯ КНОПОК МАСШТАБА И ГЕОЛОКАЦИИ */
/* ========================================== */

/* Убираем стандартные иконки-спрайты MapLibre и ставим свои */
.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon {
    background-image: url('/icons/zoom-in.png') !important;
    background-size: 20px 20px !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon {
    background-image: url('/icons/zoom-out.png') !important;
    background-size: 20px 20px !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon {
    background-image: url('/icons/location.png') !important;
    background-size: 20px 20px !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

/* Общий стиль контейнера кнопок (десктоп и база) */
.maplibregl-ctrl-group {
    background-color: rgba(30, 30, 30, 0.8) !important; /* Темный полупрозрачный фон */
    border-radius: 8px !important; /* Скругление */
    border: 1px solid #444 !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3) !important;
    overflow: hidden; /* Чтобы рамки кнопок не вылезали за скругленные углы */
}

/* Настройка самих кнопок и разделителей */
.maplibregl-ctrl-group button {
    border-bottom: 1px solid #444 !important;
    background-color: transparent !important;
}
.maplibregl-ctrl-group button:last-child {
    border-bottom: none !important;
}

/* ========================================== */
/* 📱 ОПТИМИЗАЦИЯ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ     */
/* ========================================== */

/* 1. Защита от вылета за "челку" (Notch) и системные жесты iOS/Android */
.maplibregl-ctrl-top-right {
    top: env(safe-area-inset-top, 10px) !important;
    right: env(safe-area-inset-right, 10px) !important;
}
.maplibregl-ctrl-bottom-right {
    bottom: env(safe-area-inset-bottom, 20px) !important;
    right: env(safe-area-inset-right, 10px) !important;
}
.maplibregl-ctrl-top-left {
    top: env(safe-area-inset-top, 10px) !important;
    left: env(safe-area-inset-left, 10px) !important;
}
.maplibregl-ctrl-bottom-left {
    bottom: env(safe-area-inset-bottom, 20px) !important;
    left: env(safe-area-inset-left, 10px) !important;
}

/* 2. Адаптив для экранов телефонов */
@media screen and (max-width: 768px) {
    /* Уменьшаем внешние отступы блока кнопок, прижимаем ближе к краю */
    .maplibregl-ctrl-group {
        margin: 10px !important;
        border-radius: 8px !important;
    }

    /* Делаем кнопки чуть больше стандарта для удобного нажатия пальцем (Touch Target) */
    .maplibregl-ctrl-group button {
        width: 40px !important;
        height: 40px !important;
    }

    /* Немного уменьшаем ваши кастомные иконки, чтобы они аккуратно смотрелись в больших кнопках */
    .maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon,
    .maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon,
    .maplibregl-ctrl-geolocate .maplibregl-ctrl-icon {
        background-size: 18px 18px !important;
    }

    .maplibregl-ctrl-top-right {
        top: max(15px, env(safe-area-inset-top)) !important;
        right: max(5px, env(safe-area-inset-right)) !important;
    }
    
    .maplibregl-ctrl-bottom-right {
        /* 40px — это надежный запас для панели навигации Android */
        bottom: max(30px, env(safe-area-inset-bottom)) !important;
        right: max(5px, env(safe-area-inset-right)) !important;
    }

    .maplibregl-ctrl-bottom-left {
        bottom: max(40px, env(safe-area-inset-bottom)) !important;
        left: max(15px, env(safe-area-inset-left)) !important;
    }
}

/* ======================================= */
/* 🛒 МАГАЗИН (DARK GLASSMORPHISM) */
/* ======================================= */

/* ======================================= */
/* 💻 АДАПТАЦИЯ ДЛЯ ДЕСКТОПА (ПК и Планшеты) */
/* ======================================= */
@media (min-width: 768px) {
  /* Обертка выстраивает контент сверху с отступом */
  #store-modal-overlay {
    align-items: flex-start; 
    padding-top: 70px; /* Отступ под твою дебаг-панель */
  }

  /* Панель сжимается, получает скругления и тени */
  .store-glass-panel {
    width: 90%;
    max-width: 800px;
    height: calc(100vh - 100px); 
    max-height: 800px;
    
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }

  .store-grid {
    padding-bottom: 60px;
  }

  .store-scroll-indicator {
    bottom: 15px;
  }
}

#store-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Можно добавить полупрозрачный фон, чтобы затемнять карту вокруг магазина на десктопе */
  background: rgba(0, 0, 0, 0.3); 
}

.store-glass-panel {
  position: relative; 
  width: 100%;
  height: 100%;
  
  background: rgba(15, 15, 20, 0.85);
  backdrop-filter: blur(20px)!important;
  -webkit-backdrop-filter: blur(20px)!important;
  
  display: flex;
  flex-direction: column;
  color: #fff;
  overflow: hidden;
  border: none;
  border-radius: 0; 
  box-sizing: border-box;
}

.store-grid::-webkit-scrollbar,
.store-tabs::-webkit-scrollbar {
  display: none; /* Прячет в Chrome/Safari/Edge */
}

.store-grid, .store-tabs {
  -ms-overflow-style: none;  /* Прячет в IE и Edge */
  scrollbar-width: none;     /* Прячет в Firefox */
}

.store-glass-panel, .store-glass-panel * {
  box-sizing: border-box;
}

/* Шапка */
.store-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  
  /* Верхний отступ = базовый (20px) + безопасная зона устройства */
  padding: calc(20px + env(safe-area-inset-top)) 30px 20px;
  padding-left: calc(30px + env(safe-area-inset-left));
  padding-right: calc(30px + env(safe-area-inset-right));
  
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
}

.store-header h2 {
  margin: 0;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.store-balance-badge {
  /* background: rgba(52, 152, 219, 0.2); */
  /* border: 1px solid rgba(52, 152, 219, 0.5); */
  padding: 6px 2px;
  /* border-radius: 20px; */
  font-weight: bold;
  color: #3498db;
  display: flex;
  align-items: center;
  gap: 5px;
  /* box-shadow: 0 0 15px rgba(52, 152, 219, 0.3); */
}

.store-close-btn {
  background: none;
  border: none;
  color: #aaa;
  font-size: 32px;
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
}

.store-close-btn:hover { color: #fff; }

/* Вкладки */
.store-tabs {
  display: flex;
  padding: 0 calc(30px + env(safe-area-inset-right)) 0 calc(30px + env(safe-area-inset-left));
  gap: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  overflow-x: auto;
  scrollbar-width: none;
}

.store-tab {
  background: none;
  border: none;
  color: #888;
  padding: 15px 0;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.store-tab:hover { color: #ccc; }

.store-tab.active { color: #fff; }

.store-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 3px;
  background: #3498db;
  border-radius: 3px 3px 0 0;
  box-shadow: 0 -2px 10px rgba(52, 152, 219, 0.5);
}

/* Сетка товаров */
.store-grid {
  flex: 1;
  padding: 30px;
  padding-left: calc(30px + env(safe-area-inset-left));
  padding-right: calc(30px + env(safe-area-inset-right));
  /* Нижний отступ увеличен, чтобы контент не перекрывался стрелкой и системной полоской */
  padding-bottom: calc(100px + env(safe-area-inset-bottom));
  
  width: 100%;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* 🟢 АНИМАЦИЯ СТРЕЛКИ */
.store-scroll-indicator {
  position: absolute;
  bottom: calc(20px + env(safe-area-inset-bottom));  
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: 32px;
  height: 32px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  pointer-events: none; /* Чтобы стрелка не перехватывала клики */
  transition: opacity 0.3s ease;
  animation: bounceArrow 2s infinite ease-in-out;
}

@keyframes bounceArrow {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

.store-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 25px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform 0.2s, background 0.2s;
}

.store-card:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-5px);
  border-color: rgba(52, 152, 219, 0.3);
}

.store-card-icon {
  font-size: 48px;
  margin-bottom: 15px;
  filter: drop-shadow(0 0 10px rgba(52, 152, 219, 0.5));
}

.store-card h3 {
  margin: 0 0 10px 0;
  font-size: 25px;
  font-weight: 600;
}

.store-card-desc {
  font-size: 20px;
  color: #aaa;
  margin: 0 0 20px 0;
  flex-grow: 1;
}

/* Контролы количества */
.store-qty-controls {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 30px;
  padding: 4px;
  margin-bottom: 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.qty-btn {
  background: none;
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.qty-btn:hover { background: rgba(255, 255, 255, 0.1); }

.qty-input {
  width: 40px;
  background: none;
  border: none;
  color: #fff;
  text-align: center;
  font-size: 16px;
  font-weight: bold;
  pointer-events: none;
}

/* Кнопка купить */
.store-buy-btn {
  width: 100%;
  background: rgba(52, 152, 219, 0.2);
  border: 1px solid rgba(52, 152, 219, 0.4);
  color: #fff;
  padding: 12px;
  border-radius: 30px;
  font-size: 25px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.store-buy-btn:hover {
  background: rgba(52, 152, 219, 0.4);
  box-shadow: 0 0 15px rgba(52, 152, 219, 0.4);
}


/* ======================================= */
/* 🛒 ПЛАВАЮЩАЯ КНОПКА МАГАЗИНА */
/* ======================================= */

.glass-floating-btn {
    position: fixed;
    /* env(...) гарантирует, что кнопка не уедет под статус-бар или "челку" айфона */
    /* top: max(20px, env(safe-area-inset-top));  */
    right: max(20px, env(safe-area-inset-right));
    
    width: 48px;
    height: 48px;
    z-index: 900; /* Поверх карты и других элементов */
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Темное матовое стекло (как у основной панели) */
    background: rgba(15, 15, 15, 0.85); 
    backdrop-filter: blur(18px) saturate(170%) !important;
    -webkit-backdrop-filter: blur(18px) saturate(170%) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    
    /* Базовая тень */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    
    cursor: pointer;
    outline: none;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.glass-floating-btn:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.3);
}

.glass-floating-btn:active {
    transform: scale(0.95);
}

.glass-floating-btn .btn-icon {
    width: 25px;
    height: 25px;
    pointer-events: none;
    /* Легкое базовое свечение самой иконки */
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.3));
}

/* 🟣 КЛАСС АНИМАЦИИ (Включается через JS раз в 10 минут) */
.glass-floating-btn.pulse-purple {
    /* Запускаем пульсацию: длится 2 секунды, повторяется 2 раза (итого 4 секунды) */
    animation: neonPurplePulse 2s ease-in-out 2; 
}

@keyframes neonPurplePulse {
    0%, 100% {
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
        border-color: rgba(255, 255, 255, 0.1);
    }
    50% {
        /* Фиолетовое неоновое свечение наружу и немного внутрь */
        box-shadow: 
            0 0 15px rgba(176, 38, 255, 0.8), 
            0 0 30px rgba(176, 38, 255, 0.5),
            inset 0 0 10px rgba(176, 38, 255, 0.3);
        border-color: rgba(176, 38, 255, 0.9);
    }
}

/* Адаптив для маленьких экранов */
@media (max-width: 768px) {
    .glass-floating-btn {
        width: 42px;
        height: 42px;
        /* 🟢 Опускаем ниже: дебаг-панель занимает ~90px, поэтому делаем отступ 115px */
        top: max(115px, calc(105px + env(safe-area-inset-top)));
        right: max(10px, env(safe-area-inset-right));
    }
    .glass-floating-btn .btn-icon {
        width: 20px;
        height: 20px;
    }
}

/* =========================================
   РЕДАКТИРОВАНИЕ НИКА В ПРОФИЛЕ
========================================= */
.username-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
    margin-bottom: 5px;
}

.username-wrapper:hover {
    background: rgba(255, 255, 255, 0.1);
}

.username-wrapper #edit-nick-icon {
    font-size: 14px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.username-wrapper:hover #edit-nick-icon {
    opacity: 1;
}

/* Стили самого инпута, когда текст превращается в поле */
.nick-edit-input {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #4CAF50;
    border-radius: 4px;
    color: white;
    padding: 4px 8px;
    font-family: inherit;
    font-size: 16px;
    font-weight: bold;
    outline: none;
    text-align: center;
    width: 150px;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

/* =========================================
   ОТКЛЮЧЕННЫЕ КНОПКИ (PRIVACY POLICY)
========================================= */
.auth-buttons-row button:disabled {
    background: #555 !important;
    color: #999 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

.disabled-social-btn {
    pointer-events: none !important;
    opacity: 0.4 !important;
    filter: grayscale(100%) !important;
    transition: opacity 0.3s, filter 0.3s;
}
/* ======================================= */
/* 📜 ТЕКСТОВЫЕ МОДАЛЬНЫЕ ОКНА (Правила, Политика) */
/* ======================================= */

/* Анимация выезда сверху вниз */
@keyframes slideDownFromTop {
    0% {
        transform: translateY(-150px) scale(0.95);
        opacity: 0;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.text-modal-content {
    max-width: 800px !important; 
    width: 95% !important;
    /* Учитываем динамический вьюпорт телефонов и безопасные зоны */
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 40px) !important;
    overflow-y: auto !important;
    padding: max(25px, env(safe-area-inset-top)) 25px max(25px, env(safe-area-inset-bottom)) 25px !important;
    text-align: left !important;
    position: relative;
    box-sizing: border-box;
    animation: slideDownFromTop 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Скрываем системный скроллбар для красоты */
.text-modal-content::-webkit-scrollbar { width: 6px; }
.text-modal-content::-webkit-scrollbar-track { background: transparent; }
.text-modal-content::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 10px; }

.text-modal-content h1 { text-align: center; margin-top: 0; font-size: 24px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 15px; color: #fff; }
.text-modal-content h2 { margin-top: 25px; color: #4a90e2; font-size: 18px; margin-bottom: 10px; }
.text-modal-content p, .text-modal-content li { font-size: 14px; color: rgba(255, 255, 255, 0.85); line-height: 1.5; }

.rule-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
}
.rule-card ul { padding-left: 20px; margin: 0; }
.rule-card h3 { margin: 0 0 10px 0; color: #fff; font-size: 16px; }

/* Значки */
.rule-badge {
    padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: bold;
    margin-left: 10px; text-transform: uppercase; white-space: nowrap; vertical-align: middle;
}
.rule-badge.ban { background: rgba(244, 67, 54, 0.2); color: #f44336; border: 1px solid rgba(244, 67, 54, 0.5); }
.rule-badge.timeout { background: rgba(255, 152, 0, 0.2); color: #ff9800; border: 1px solid rgba(255, 152, 0, 0.5); }
.rule-badge.allowed { background: rgba(76, 175, 80, 0.2); color: #4CAF50; border: 1px solid rgba(76, 175, 80, 0.5); }
.rule-badge.system { background: rgba(52, 152, 219, 0.2); color: #3498db; border: 1px solid rgba(52, 152, 219, 0.5); }

/* Крестик закрытия */
.text-modal-close-btn {
    position: absolute; top: 15px; right: 15px; width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%; color: white; text-decoration: none; font-size: 20px;
    cursor: pointer; transition: all 0.2s; z-index: 10;
}
.text-modal-close-btn:hover { background: rgba(255,255,255,0.2); transform: scale(1.1); }

/* Шапка поддержки и переключатель языков */
.text-modal-header {
    text-align: center; margin-bottom: 20px; font-size: 14px;
    color: rgba(255,255,255,0.6); background: rgba(255, 255, 255, 0.03);
    padding: 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.05);
}
.text-modal-header a { color: #4CAF50; text-decoration: none; font-weight: bold; }

.text-modal-lang {
    display: flex; justify-content: center; align-items: center; gap: 15px;
    margin-bottom: 20px; background: rgba(255, 255, 255, 0.05);
    padding: 10px 15px; border-radius: 8px;
}
.text-modal-lang button { background: none; border: none; color: #4CAF50; cursor: pointer; font-size: 15px; font-family: inherit; transition: 0.2s; }
.text-modal-lang button:hover { color: #fff; }
.text-modal-lang button.active { font-weight: bold; text-decoration: underline; color: #fff; }

/* ======================================= */
/* 📜 КНОПКА ВЫЗОВА ПРАВИЛ (Буква i) */
/* ======================================= */
.rules-floating-btn {
    position: fixed;
    top: 0; 
    left: max(20px, env(safe-area-inset-left));
    width: 40px;
    height: 40px;
    z-index: 20; /* Выше карты и оверлеев */
    
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    
    /* 🟢 Единый стиль Dark Glassmorphism как у дебаг-панели */
    background: rgba(15, 15, 15, 0.78) !important; 
    backdrop-filter: blur(12px) saturate(160%) !important;
    -webkit-backdrop-filter: blur(12px) saturate(160%) !important;
    
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-top: none !important; 
    border-radius: 0 0 12px 12px !important; /* Как у дебаг панели (12px) */
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6) !important; /* Тень как у дебаг панели */
    
    transition: all 0.2s ease;
}

/* Эффект вытягивания при наведении */
.rules-floating-btn:hover {
    height: 54px; 
    background: rgba(30, 30, 30, 0.95) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

.rules-floating-btn span {
    font-family: 'PacMan1980', sans-serif;
    font-weight: bold;
    font-size: 20px;
    color: white;
}

/* 🟢 АДАПТИВ ДЛЯ МОБИЛЬНЫХ (Левый нижний угол) */
@media (max-width: 768px) {
    .rules-floating-btn {
        top: auto !important;
        /* Поднимаем выше кнопок навигации, если они пересекаются */
        bottom: max(38px, env(safe-area-inset-bottom)) !important;
        left: max(10px, env(safe-area-inset-left)) !important;
        height: 40px !important;
        width: 40px !important;
        
        /* На мобилке кнопка плавающая, поэтому возвращаем рамку сверху и круговое скругление */
        border: 1px solid rgba(255, 255, 255, 0.1) !important; 
        border-radius: 8px !important; 
    }
    
    .rules-floating-btn:hover {
        height: 42px !important;
        transform: scale(1.05);
    }
}

/* 🟢 КРАСНАЯ ПУЛЬСИРУЮЩАЯ ТОЧКА (ИНДИКАТОР ОБНОВЛЕНИЙ) */
.rules-floating-btn.has-updates::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px; /* Чуть меньше для аккуратности */
    height: 8px;
    background-color: #ff3333;
    border: 1px solid rgba(0,0,0,0.6); /* Темная пиксельная рамочка как на палитре */
    border-radius: 0; /* Жесткие углы (квадрат) */
    z-index: 10;
    animation: pulse-red-square 1.5s infinite;
}

@keyframes pulse-red-square {
    0% { transform: scale(0.85); box-shadow: 0 0 0 0 rgba(255, 51, 51, 0.7); }
    70% { transform: scale(1.2); box-shadow: 0 0 0 4px rgba(255, 51, 51, 0); }
    100% { transform: scale(0.85); box-shadow: 0 0 0 0 rgba(255, 51, 51, 0); }
}

/* 🟢 СТИЛИ ДЛЯ ВКЛАДОК (ПРАВИЛА / ОБНОВЛЕНИЯ) */
.modal-tab-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #aaa;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s;
    font-family: inherit;
}

.modal-tab-btn.active {
    background: rgba(76, 175, 80, 0.2);
    border-color: #4CAF50;
    color: #fff;
}

.modal-tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* ======================================= */
/* ⏳ ПИКСЕЛЬНЫЙ ЛОАДЕР (96x96) */
/* ======================================= */
.pixel-loader-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
}

.pixel-loader-overlay.active {
    opacity: 1;
    visibility: visible;
}

.pixel-loader {
    width: 96px;
    height: 96px;
    position: relative;
    /* steps(8) делает вращение "дерганым", как в старых играх */
    animation: pixel-spin 0.8s steps(8) infinite;
}

.pixel-loader::after {
    content: '';
    position: absolute;
    /* Центрируем базовый блок 12x12 пикселей */
    top: 42px; left: 42px; 
    width: 12px; height: 12px;
    
    /* Рисуем кольцо из пикселей в цветах логотипа Pixmap */
    box-shadow:
        0 -36px 0 #4CAF50,     /* Верх (Зеленый) */
        25px -25px 0 #2196F3,  /* Верх-право (Синий) */
        36px 0 0 #9C27B0,      /* Право (Фиолетовый) */
        25px 25px 0 #E91E63,   /* Низ-право (Розовый) */
        0 36px 0 #FF9800,      /* Низ (Оранжевый) */
        -25px 25px 0 #FFEB3B,  /* Низ-лево (Желтый) */
        -36px 0 0 #00BCD4,     /* Лево (Голубой) */
        -25px -25px 0 #8BC34A; /* Верх-лево (Салатовый) */
}

@keyframes pixel-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 🟢 РЕШЕНИЕ: Выносим кнопки навигации поверх всех слоев */
.maplibregl-control-container {
    position: fixed !important; 
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 20 !important; /* Изменили 3000 на 20 (Трафарет = 10, Палитра = 1000) */
    pointer-events: none !important; 
}

.maplibregl-control-container .maplibregl-ctrl {
    pointer-events: auto !important;      
}

@media (max-width: 768px) {
    .maplibregl-ctrl-bottom-left {
        bottom: 80px !important; 
    }
}

/* 🌈 Анимация движения фона */
@keyframes text-shimmer {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

/* Класс для переливающегося текста */
.shimmer-text {
    /* Красивый градиент (можете поменять цвета на свои) */
    background: linear-gradient(90deg, #ff4a4a, #ff9800, #4caf50, #00bcd4, #b026ff, #ff4a4a);
    background-size: 200% auto;
    
    /* Делаем сам текст прозрачным, чтобы было видно фон под ним */
    color: transparent !important;
    -webkit-background-clip: text;
    background-clip: text;
    
    /* Запускаем бесконечную анимацию */
    animation: text-shimmer 3s linear infinite;
    
    /* Делаем шрифт чуть жирнее, чтобы цвета смотрелись сочнее */
    font-weight: bold;
}

/* 📱 Принудительная сетка для мобильных кнопок (должна быть внизу файла) */
@media (max-width: 768px) {
    .panel-actions {
        display: grid !important; /* !important железно заставит браузер включить сетку */
        grid-template-columns: auto auto !important;
        gap: 18px 18px;
        margin-left: 10px;
        align-items: center;
        justify-items: center;
    }

    .inspector-btn {
        width: 30px !important;
        height: 30px !important;
    }
}

@media (max-width: 900px) and (max-height: 520px) and (orientation: landscape) {
    .panel-actions {
        gap: 6px 10px !important;
        margin-left: 8px !important;
    }

    .inspector-btn {
        width: 26px !important;
        height: 26px !important;
    }
}

#author-bg-wrapper {
    background-image: none !important;
}

.pixel-team-row {
    width: 100%;
    align-items: center;
    gap: 8px;
    height: 36px;
    min-height: 36px;
    padding: 0 30px;
    background: transparent;
    border: 0;
    box-shadow: none;
    color: #08c3c5;
    font-family: 'PacMan1980', sans-serif;
    font-size: 16px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.pixel-team-avatar,
.pixel-team-placeholder {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    flex-shrink: 0;
}

.pixel-team-avatar {
    object-fit: cover;
    image-rendering: pixelated;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.22);
    box-sizing: border-box;
}

.pixel-team-placeholder {
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    font-size: 13px;
}

#cur-team-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1;
}

@media (max-width: 768px) {
    .pixel-team-row {
        height: 36px;
        min-height: 36px;
        padding: 0 8px;
        font-size: 16px;
        gap: 8px;
    }

    .pixel-team-avatar,
    .pixel-team-placeholder {
        width: 32px;
        height: 32px;
        border-radius: 7px;
    }
}

@media (max-width: 900px) and (pointer: coarse) {
    .pixel-team-row {
        height: 36px;
        min-height: 36px;
        padding: 0 8px;
        font-size: 16px;
        gap: 8px;
    }

    .pixel-team-avatar,
    .pixel-team-placeholder {
        width: 32px;
        height: 32px;
        border-radius: 7px;
    }
}

/* 🟢 Сворачивание окон (Window Shade effect) */
.window-collapsed > :not(.admin-header) {
    display: none !important;
}

/* Прячем все громоздкие элементы ВНУТРИ самой шапки (фильтры, поля, лишние кнопки) */
.window-collapsed .admin-header > div:not(#inspector-user-title),
.window-collapsed .admin-header > button:not(#close-inspector):not(.minimize-btn) {
    display: none !important;
}

/* Убираем лишние отступы, чтобы свернутая плашка была тонкой */
.window-collapsed {
    padding-bottom: 0 !important;
    min-height: unset !important;
    height: auto !important;
}

.window-collapsed .admin-header {
    padding-bottom: 12px !important; /* Убираем лишнее пространство снизу шапки */
}

.window-collapsed #inspector-user-title {
    margin-bottom: 0 !important; /* Убираем отступ под именем юзера в инспекторе */
}

/* 🛒 Принудительный шрифт для всего магазина */
#store-modal-overlay,
#store-modal-overlay button,
#store-modal-overlay input,
#store-modal-overlay span,
#store-modal-overlay h3,
#store-modal-overlay p {
    font-family: 'PacMan1980', sans-serif !important;
}

/* 🟢 Убираем стандартные стрелочки браузера у поля ввода, чтобы цифра встала ровно по центру */
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Фикс для браузера Firefox */
.qty-input[type="number"] {
  -moz-appearance: textfield;
}
/* Кнопка пополнения PIX */
.add-pix-btn {
    background: #4CAF50;
    color: white;
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-weight: bold;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.4);
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
    font-family: inherit;
    padding-bottom: 2px; /* Выравнивание плюсика по центру */

    padding-bottom: 2px; /* Поднимаем чуть выше */
    padding-left: 7px;   /* Толкаем чуть правее */

    animation: pulse-plus 2s infinite ease-in-out;
}



.add-pix-btn:hover {
    /* 🟢 При наведении выключаем анимацию и фиксируем увеличенный размер */
    animation: none; 
    transform: scale(1.25);
    background: #45a049;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.8);
}

#store-user-balance {
    font-size: 24px !important; 
    font-weight: bold;
    margin-left: 5px;
}

.store-balance-badge .shimmer-text {
    font-size: 24px !important;
}

/* Опционально: делаем чуть крупнее надпись PIX рядом */
.store-balance-badge .shimmer-text {
    font-size: 24px;
}
/* Фикс кликов по замочку на мобильных устройствах */
#draw-lock-btn span {
    pointer-events: none;
}

@keyframes pulse-plus {
    0% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(76, 175, 80, 0.4);
    }
    50% {
        transform: scale(1.2); /* Увеличиваем на 20% */
        box-shadow: 0 0 10px rgba(76, 175, 80, 0.9); /* Усиливаем свечение */
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(76, 175, 80, 0.4);
    }
}

/* Экран спящего режима */
#afk-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4); /* Легкое затемнение */
  backdrop-filter: blur(8px); /* Красивое размытие фона */
  -webkit-backdrop-filter: blur(8px); /* Для поддержки Safari */
  z-index: 99999; /* Поверх всего интерфейса */
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#afk-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Плашка с текстом посередине экрана */
#afk-overlay .afk-msg {
  background: rgba(20, 20, 20, 0.85);
  color: #ffffff;
  padding: 20px 40px;
  border-radius: 12px;
  text-align: center;
  font-family: sans-serif;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  pointer-events: none; /* Чтобы клик проходил насквозь к обработчикам */
}

#afk-overlay .afk-msg b {
  font-size: 24px;
  display: block;
  margin-bottom: 8px;
}

#afk-overlay .afk-msg small {
  font-size: 16px;
  opacity: 0.8;
}

.ws-security-overlay.glass-modal-overlay {
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  z-index: 100000;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ws-security-content.glass-modal-content {
  width: min(92vw, 430px);
  max-width: 430px;
  padding: 22px;
  border-radius: 12px;
  background: rgba(15, 15, 15, 0.88);
}

.ws-security-content h3 {
  font-size: 22px;
  margin-bottom: 10px;
}

.ws-security-content p {
  font-size: 14px;
  margin-bottom: 18px;
}

.ws-security-slider {
  position: relative;
  width: 100%;
  height: 54px;
  margin: 14px 0 12px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  touch-action: none;
}

.ws-security-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: rgba(8, 195, 197, 0.22);
  pointer-events: none;
}

.ws-security-target {
  position: absolute;
  top: 6px;
  bottom: 6px;
  width: 48px;
  transform: translateX(-50%);
  border-radius: 7px;
  background: rgba(8, 195, 197, 0.3);
  border: 1px solid rgba(8, 195, 197, 0.75);
  box-shadow: 0 0 16px rgba(8, 195, 197, 0.25);
  pointer-events: none;
}

.ws-security-handle {
  position: absolute;
  top: 6px;
  left: 0;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 7px;
  background: rgba(30, 30, 30, 0.96);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  cursor: grab;
  touch-action: none;
}

.ws-security-handle::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 10px;
  width: 16px;
  height: 20px;
  border-left: 3px solid #08c3c5;
  border-right: 3px solid #08c3c5;
}

.ws-security-handle:active {
  cursor: grabbing;
}

.ws-security-hint,
.ws-security-status {
  min-height: 18px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  line-height: 1.35;
}

.ws-security-status {
  margin-top: 8px;
  color: #ffcc66;
}

.ws-security-status.success {
  color: #5ee071;
}

/* Кнопка переключения режима цифр */
#numbers-mode-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s;
}
#numbers-mode-btn.active {
  transform: scale(1.1);
  filter: drop-shadow(0 0 5px rgba(255,255,255,0.5));
}

/* Стили для цифр внутри квадратиков палитры */
.color-swatch {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Выносим цифры поверх фонового слоя */
.color-swatch .swatch-number {
    position: relative;
    z-index: 2;
    display: none; /* скрываем по умолчанию */
    
    /* 🟢 Настройки шрифта и обводки */
    font-family: 'PacMan1980', sans-serif; /* Пиксельный шрифт */
    font-size: 14px;
    color: white; /* Основной цвет цифры */
    
    /* Черная обводка в 1 пиксель во все стороны + легкая тень вниз */
    text-shadow: 
        -1px -1px 0 #000,  
         1px -1px 0 #000,
        -1px  1px 0 #000,
         1px  1px 0 #000,
         0px  2px 0 rgba(0,0,0,0.6);
}
/* Показываем цифры только когда активен спец. класс на сетке */
.color-grid.show-numbers .color-swatch .swatch-number {
  display: block;
}

/* 3. Красный квадратик (теперь он физически не может быть обрезан маской) */
.color-swatch.premium-swatch::after {
    content: '';
    position: absolute;
    /* 🟢 Отрицательные значения выносят его ЗА пределы кружка */
    top: -2px;   
    right: -2px; 
    width: 6px; 
    height: 6px;
    background-color: #ff3333;
    border: 1px solid rgba(0,0,0,0.6); /* Легкая пиксельная рамочка для читаемости */
    z-index: 10;
    pointer-events: none;
}

/* =========================================
   МОДАЛЬНОЕ ОКНО РАЗБЛОКИРОВКИ ЦВЕТА
========================================= */
.unlock-modal-content {
    position: relative;
    max-width: 360px !important;
    padding: 20px 20px 30px 20px !important;
    text-align: left !important;
}

/* Кнопка закрытия (крестик) в правом верхнем углу */
.top-right-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    padding: 0;
    line-height: 1;
}

.unlock-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-right: 25px; /* Отступ от крестика */
}

.unlock-title-left h2 {
    margin: 0 0 5px 0 !important;
    font-size: 20px !important;
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
}

.unlock-title-left p {
    margin: 0 !important;
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 13px !important;
}

/* Плашка баланса (в стиле синего бейджа со скриншота) */
.unlock-balance-pill {
    background: rgba(88, 101, 242, 0.2);
    border: 1px solid rgba(88, 101, 242, 0.5);
    border-radius: 20px;
    padding: 4px 6px 4px 10px;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.unlock-balance-pill:hover {
    background: rgba(88, 101, 242, 0.4);
}

.unlock-balance-pill .plus-btn {
    background: #5865F2;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
}

/* Внутренний темный блок */
.unlock-center-box {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 16px;
    padding: 25px 20px;
    text-align: center;
}

.unlock-color-swatch {
    width: 130px;
    height: 130px;
    border-radius: 24px;
    margin: 0 auto 15px auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.unlock-color-hex {
    font-size: 26px;
    font-weight: bold;
    margin: 0 0 20px 0;
    color: white;
}

/* Кнопка покупки */
.unlock-btn-buy {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: white;
    padding: 14px;
    border-radius: 25px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 10px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.unlock-btn-buy:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Кнопка "Close" внизу */
.unlock-btn-close {
    width: 100%;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 10px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.unlock-btn-close:hover {
    color: white;
}

.game-font {
    font-family: 'PacMan1980', sans-serif !important;
}

.unlock-modal-content, 
.unlock-modal-content button, 
.unlock-modal-content h2, 
.unlock-modal-content h3 {
    font-family: 'PacMan1980', sans-serif !important;
}


/* кнопка лидера и рейтинг */
#user-profile {
    position: relative;
    padding-right: 0;
    width: 100%;
    box-sizing: border-box;
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    text-align: left;
}

#user-profile .profile-avatar-break {
    display: none;
}

#user-profile .avatar-hover-wrapper {
    width: 132px;
    height: 132px;
    justify-self: start;
    align-self: start;
    border-radius: 8px;
}

#user-profile .avatar-edit-overlay img {
    width: 36px;
    height: 36px;
}

.profile-info-stack {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.profile-info-stack .username-wrapper {
    justify-content: flex-start;
    align-self: flex-start;
    max-width: 100%;
    margin-bottom: 0;
}

.profile-info-stack .profile-rank-box {
    margin-right: 2px;
}

.profile-info-stack #user-email {
    display: block;
    color: rgba(255, 255, 255, 0.62);
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.profile-info-stack .pixel-stats {
    margin-top: 0;
}

.profile-info-stack .btn-logout {
    margin-top: 0;
}

.profile-icon-bar {
    position: absolute;
    right: 34px;
    top: 76px;
    z-index: 1200;

    display: none;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.profile-small-icon-btn {
    position: relative !important;

    width: 25px !important;
    height: 25px !important;
    min-width: 25px !important;
    min-height: 25px !important;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0 !important;
    margin: 0 !important;

    background: transparent;
    border: none;
    cursor: pointer;
}

.profile-small-icon-btn .leaderboard-icon {
    font-size: 20px;
    line-height: 1;
    pointer-events: none;
}



.leaderboard-icon {
    font-size: 20px;
    line-height: 1;
    filter: drop-shadow(0 0 5px #ffd966);
    pointer-events: none;
}

@media (max-width: 768px) {
    #user-profile {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 8px;
        text-align: center;
    }

    #user-profile .avatar-hover-wrapper {
        width: 40px;
        height: 40px;
        justify-self: center;
        border-radius: 6px;
    }

    #user-profile .avatar-edit-overlay img {
        width: 24px;
        height: 24px;
    }

    .profile-info-stack {
        width: 100%;
        align-items: stretch;
    }

    .profile-info-stack .username-wrapper {
        justify-content: center;
        align-self: center;
    }

    .profile-rank-box {
        max-width: 58px;
    }

    .profile-rank-name {
        max-width: 58px;
        font-size: 7px;
    }

    .profile-info-stack #user-email {
        text-align: center;
    }

    .profile-icon-bar {
        right: 18px;
        top: 112px;
    }


}

@media (max-width: 900px) and (max-height: 520px) and (orientation: landscape) {
    #user-profile {
        grid-template-columns: 56px minmax(0, 1fr);
        justify-items: stretch;
        align-items: start;
        gap: 8px;
        text-align: left;
    }

    #user-profile .avatar-hover-wrapper {
        width: 56px;
        height: 56px;
        justify-self: start;
        border-radius: 6px;
    }

    #user-profile .avatar-edit-overlay img {
        width: 22px;
        height: 22px;
    }

    .profile-info-stack {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas:
            "name invite"
            "email team"
            "pixels logout";
        column-gap: 8px;
        row-gap: 4px;
        align-items: center;
        width: 100%;
    }

    .profile-info-stack .username-wrapper {
        grid-area: name;
        justify-content: flex-start;
        align-self: flex-start;
        min-width: 0;
        padding: 2px 4px;
    }

    .profile-rank-box {
        max-width: 54px;
        min-width: 30px;
    }

    .profile-rank-name {
        max-width: 54px;
        font-size: 7px;
    }

    .profile-info-stack #user-email {
        grid-area: email;
        text-align: left;
        font-size: 10px;
        line-height: 1.1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .profile-info-stack .pixel-stats {
        grid-area: pixels;
        padding: 5px 6px;
        font-size: 11px;
        line-height: 1.1;
        min-width: 0;
        margin: 0 !important;
    }

    .profile-info-stack .btn-logout {
        grid-area: logout;
        padding: 6px;
        font-size: 11px;
        min-height: 30px;
        margin: 0 !important;
    }

    .user-invite-box {
        grid-area: invite;
        margin: 0 !important;
        min-width: 0;
    }

    .team-profile-box {
        grid-area: team;
        margin: 0 !important;
        min-width: 0;
    }

    .team-profile-btn {
        min-height: 34px;
        height: 34px;
        padding: 5px 8px;
        gap: 8px;
        border-radius: 8px;
        min-width: 0;
    }

    .team-profile-avatar,
    .team-profile-avatar-placeholder,
    .user-invite-icon {
        width: 26px;
        height: 26px;
        flex-basis: 26px;
        border-radius: 6px;
        font-size: 14px;
    }

    .team-profile-text {
        gap: 1px;
    }

    .team-profile-text strong {
        font-size: 11px;
    }

    .team-profile-text small,
    .team-profile-label {
        display: none;
    }

    .profile-leaderboard-icon-btn {
        right: 10px;
        top: 74px;
    }
}


.leaderboard-modal-overlay {
  position: fixed;
  left: 0;
  right: 0;
  top: 50px;
  bottom: 0;

  display: none;
  align-items: flex-start;
  justify-content: center;

  padding-top: 0;
  box-sizing: border-box;

  background: transparent;
  pointer-events: auto;
  z-index: 5000;
}

.leaderboard-glass-panel {
  width: min(420px, calc(100vw - 28px));
  max-height: min(620px, calc(100vh - 40px));
  background: rgba(15, 15, 15, 0.88);
  backdrop-filter: blur(18px) saturate(170%) !important;
  -webkit-backdrop-filter: blur(18px) saturate(170%) !important;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.65);
  color: rgba(255, 255, 255, 0.9);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: popUpModal 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  font-family: 'PacMan1980', sans-serif;
}

.leaderboard-header {
  height: 54px;
  min-height: 54px;
  padding: 0 14px 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.leaderboard-header h3 {
  margin: 0;
  color: #fff;
  font-size: 18px;
  letter-spacing: 0.5px;
}

.leaderboard-close-btn {
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: #ff6666;
  font-size: 30px;
  line-height: 30px;
  cursor: pointer;
}

.leaderboard-me {
  padding: 12px 14px;
  background: rgba(255, 193, 7, 0.08);
  border-bottom: 1px solid rgba(255, 193, 7, 0.16);
}

.leaderboard-me-title {
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  margin-bottom: 6px;
}

.leaderboard-list {
  padding: 10px;
  overflow-y: auto;
}

.leaderboard-list::-webkit-scrollbar {
  width: 6px;
}

.leaderboard-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.leaderboard-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 10px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 10px;
  margin-bottom: 7px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-sizing: border-box;
}

.leaderboard-my-row {
  background: rgba(255, 193, 7, 0.14);
  border-color: rgba(255, 193, 7, 0.35);
}

.leaderboard-rank {
  color: #ffd966;
  font-size: 15px;
  text-align: center;
}

.leaderboard-name {
  color: #ffffff;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-pixels {
  color: #8cff9a;
  font-size: 13px;
  white-space: nowrap;
}

.leaderboard-loading {
  padding: 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.55);
  font-size: 14px;
}

@media (max-width: 768px) {
  .leaderboard-glass-panel {
    width: calc(100vw - 18px);
    max-height: calc(100vh - 24px);
    border-radius: 18px;
  }

  .leaderboard-header h3 {
    font-size: 16px;
  }

  .leaderboard-row {
    grid-template-columns: 44px 1fr auto;
    padding: 8px;
  }

  .leaderboard-name {
    font-size: 13px;
  }

  .leaderboard-pixels {
    font-size: 12px;
  }
}

.leaderboard-table-header {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 8px;
  align-items: center;

  padding: 10px 20px 6px 20px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;

  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.leaderboard-table-header div:first-child {
  text-align: center;
}

.leaderboard-table-header div:last-child {
  text-align: right;
}

@media (max-width: 768px) {
  .leaderboard-table-header {
    grid-template-columns: 44px 1fr auto;
    padding: 9px 18px 6px 18px;
    font-size: 10px;
  }
}

/* 🏆 Рейтинг строго под верхней панелью */
#leaderboard-modal.leaderboard-modal-overlay {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  top: 50px !important;
  bottom: 0 !important;

  display: none;
  align-items: flex-start !important;
  justify-content: center !important;

  padding-top: 0 !important;
  box-sizing: border-box !important;

  background: transparent !important;
  pointer-events: auto !important;
  z-index: 5000 !important;
}

/* Мобилка: debug-header = 90px + padding 5px сверху/снизу */
@media (max-width: 768px) {
  #leaderboard-modal.leaderboard-modal-overlay {
    top: 100px !important;
  }

  .leaderboard-glass-panel {
    max-height: calc(100dvh - 100px) !important;
  }
}

/* === HARD FIX GLASS LIKE LOCAL === */
:root {
  --glass-effect: blur(18px) saturate(170%) !important;
}

.glass-debug-panel,
.glass-modal-content,
.store-glass-panel,
.admin-sidebar,
#color-container {
  background: rgba(15, 15, 15, 0.88) !important;
  backdrop-filter: blur(18px) saturate(170%) !important;
  -webkit-backdrop-filter: blur(18px) saturate(170%) !important;
}


/* === TEAMS / ALLIANCES: STAGE 1 === */

.team-profile-box {
  width: 100%;
  margin-top: 12px;
  margin-bottom: 10px;
}

.user-invite-box {
  width: 100%;
  margin-top: 12px;
}

.team-profile-btn {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: inherit;
  transition: background 0.2s, transform 0.1s, border-color 0.2s;
}

.team-profile-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
}

.team-profile-btn:active {
  transform: scale(0.98);
}

.team-profile-btn:disabled {
  opacity: 0.62;
  cursor: wait;
}

.team-profile-btn-owned {
  justify-content: flex-start;
  text-align: left;
}

.user-invite-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 34px;
  border-radius: 8px;
  background: rgba(76, 175, 80, 0.16);
  border: 1px solid rgba(76, 175, 80, 0.35);
  font-size: 18px;
}

.team-profile-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
  image-rendering: pixelated;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.22);
  box-sizing: border-box;
}

.team-profile-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(52, 152, 219, 0.18);
  border: 1px solid rgba(52, 152, 219, 0.35);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.22);
  box-sizing: border-box;
}

.team-profile-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.team-profile-text strong {
  color: #fff;
  font-size: 13px;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-profile-text small,
.team-profile-label {
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
  line-height: 1.1;
}

.create-team-content,
.team-modal-content {
  width: min(440px, calc(100vw - 28px)) !important;
  max-width: 440px !important;
  box-sizing: border-box !important;
  background: rgba(15, 15, 15, 0.85) !important;
  backdrop-filter: blur(18px) saturate(170%) !important;
  -webkit-backdrop-filter: blur(18px) saturate(170%) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #fff;
  text-align: left !important;
  font-family: 'PacMan1980', sans-serif !important;
}

.team-modal-overlay.glass-modal-overlay {
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  pointer-events: auto;
}

.team-modal-overlay .glass-modal-content,
.team-modal-overlay input,
.team-modal-overlay button,
.team-modal-overlay .team-modal-hint,
.team-modal-overlay .team-modal-note {
  font-family: 'PacMan1980', sans-serif !important;
}

.create-team-content h3 {
  margin-bottom: 14px;
  text-align: center;
}

.team-input {
  box-sizing: border-box;
  width: 100%;
  margin-bottom: 10px;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.35);
  color: #fff;
  outline: none;
}

.team-input::placeholder {
  color: rgba(255,255,255,0.45);
}

.team-input:focus {
  border-color: rgba(76, 175, 80, 0.75);
  box-shadow: 0 0 10px rgba(76, 175, 80, 0.22);
}

.team-modal-hint {
  margin: 4px 0 14px;
  color: rgba(255,255,255,0.55);
  font-size: 11px;
  line-height: 1.35;
}

.team-modal-actions {
  display: flex;
  gap: 10px;
}

.team-primary-btn,
.team-secondary-btn {
  flex: 1;
  padding: 11px 12px;
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.team-primary-btn {
  background: rgba(76, 175, 80, 0.85);
}

.team-primary-btn:hover {
  background: rgba(76, 175, 80, 1);
}

.team-primary-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.team-secondary-btn {
  background: rgba(255, 255, 255, 0.12);
}

.team-secondary-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.team-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.team-modal-header h3 {
  margin: 0;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-modal-close {
  color: #f66;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  font-size: 30px;
  line-height: 28px;
}

.team-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.team-tab-btn {
  min-width: 0;
  padding: 8px 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
}

.team-tab-btn.active {
  background: rgba(76, 175, 80, 0.78);
  color: #fff;
}

.team-tab-btn:hover {
  color: #fff;
}

.team-modal-body {
  max-height: min(560px, calc(100vh - 190px));
  overflow-y: auto;
  padding-right: 2px;
}

.team-modal-main {
  display: flex;
  gap: 14px;
  align-items: center;
}

.team-modal-avatar {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  object-fit: cover;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.team-modal-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(52, 152, 219, 0.18);
  border: 1px solid rgba(52, 152, 219, 0.35);
  font-size: 34px;
}

.team-modal-stats {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  font-size: 13px;
}

.team-modal-stats span {
  color: rgba(255,255,255,0.55);
}

.team-modal-stats b {
  color: #fff;
}

.team-modal-note {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.65);
  font-size: 12px;
  line-height: 1.4;
}

.team-avatar-edit-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}

.team-avatar-edit-wrap .team-modal-avatar {
  width: 72px;
  height: 72px;
}

.team-avatar-edit-btn {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.72);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  z-index: 2;
}

.team-avatar-edit-btn:hover {
  background: rgba(52, 152, 219, 0.9);
}

.team-danger-btn {
  width: 100%;
  margin-top: 14px;
  padding: 11px 12px;
  border: 1px solid rgba(255, 80, 80, 0.35);
  border-radius: 10px;
  background: rgba(180, 30, 30, 0.45);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
}

.team-danger-btn:hover {
  background: rgba(220, 45, 45, 0.75);
  border-color: rgba(255, 100, 100, 0.65);
}

.team-danger-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.team-section-title {
  margin: 12px 0 8px;
  color: rgba(255,255,255,0.78);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.team-invite-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.team-rename-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin: 10px 0;
}

.team-rename-row .team-input {
  flex: 1 1 50%;
  min-width: 0;
  margin-bottom: 0;
}

.team-rename-row .team-secondary-btn {
  flex: 1 1 50%;
  min-width: 0;
  white-space: normal;
}

@media (max-width: 420px) {
  .team-rename-row {
    flex-direction: column;
  }
}

.team-copy-input {
  margin-bottom: 0;
  font-size: 12px;
}

.team-full-btn {
  width: 100%;
  margin-top: 8px;
}

.team-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.team-list-empty {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.58);
  font-size: 12px;
}

.team-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.88);
  font-size: 12px;
}

.team-list-item span:first-child {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-list-item b {
  flex-shrink: 0;
  color: rgba(255,255,255,0.64);
  font-size: 11px;
}

.team-overlay-add-box {
  padding: 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.07);
}

.team-overlay-add-box .team-modal-hint {
  margin: 8px 0 0;
}

.team-overlay-item {
  padding-right: 6px;
}

.team-overlay-name {
  flex: 1;
}

.team-overlay-size {
  flex: 0 0 auto !important;
  color: rgba(255,255,255,0.5);
  font-size: 11px;
}

.team-icon-btn {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 7px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.team-icon-btn img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  pointer-events: none;
}

.team-icon-btn:hover {
  background: rgba(76, 175, 80, 0.72);
}

.team-overlay-delete:hover {
  background: rgba(220, 45, 45, 0.78);
}

.team-member-kick:hover {
  background: rgba(220, 45, 45, 0.78);
}

.app-confirm-overlay.glass-modal-overlay {
  inset: 0;
  top: 0;
  pointer-events: auto;
  z-index: 6500;
}

.app-confirm-content {
  width: min(340px, calc(100vw - 28px));
  max-width: 340px !important;
  box-sizing: border-box;
  font-family: 'PacMan1980', sans-serif !important;
}

.app-confirm-content h3 {
  font-family: 'PacMan1980', sans-serif !important;
  margin-bottom: 10px;
}

.app-confirm-content p {
  font-family: 'PacMan1980', sans-serif !important;
  white-space: pre-line;
}

.app-confirm-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.app-confirm-actions button {
  font-family: 'PacMan1980', sans-serif !important;
}

.app-confirm-actions .danger {
  background: rgba(180, 30, 30, 0.72);
}

.app-confirm-actions .danger:hover {
  background: rgba(220, 45, 45, 0.86);
}
