body {
    background: radial-gradient(ellipse at center, #2c1810 0%, #1a0f08 100%);
    /* Темный готический фон */
    background-attachment: fixed;
    color: var(--page-text, #d4af37);
    /* Золотистый текст по умолчанию */
    font-family: 'Lora', 'Times New Roman', serif;
    /* Готический шрифт */
    min-height: 100vh;
    position: relative;
    margin: 0;
    padding: 2px;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(212, 175, 55, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(139, 69, 19, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

#container {
    display: flex;
    /* Используем flexbox для размещения элементов */
}

#linksContainer {
    margin-left: 20px;
    /* Отступ слева для контейнера ссылок */
    flex-shrink: 0;
    /* не сжимать контейнер ссылок */
}

#buttonContainer {
    margin-top: 20px;
    /* Отступ сверху для кнопки */
}

.action-button {
    height: 45px;
    width: 100%;
    font-size: 16px;
    margin-right: 10px;
    margin-bottom: 15px;
    cursor: pointer;
    border: 2px solid rgba(212, 175, 55, 0.5);
    background: linear-gradient(145deg, rgba(139, 69, 19, 0.8) 0%, rgba(160, 82, 45, 0.8) 100%);
    color: var(--page-text, #d4af37);
    border-radius: 8px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-family: 'Lora', serif;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(212, 175, 55, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.action-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--btn-hover-glow) 30%, transparent), transparent);
    transition: left 0.5s;
}

.action-button:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.7),
        0 0 20px color-mix(in srgb, var(--btn-hover-glow) 40%, transparent),
        inset 0 1px 0 color-mix(in srgb, var(--btn-hover-glow) 30%, transparent);
    background: linear-gradient(145deg, rgba(160, 82, 45, 0.9) 0%, rgba(139, 69, 19, 0.9) 100%);
    border-color: var(--page-text, #d4af37);
}

.action-button:hover::before {
    left: 100%;
}

.action-button:active {
    transform: translateY(0);
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.5),
        inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.action-button:focus {
    outline: none;
    box-shadow:
        0 0 0 3px color-mix(in srgb, var(--btn-hover-glow) 50%, transparent),
        0 4px 15px rgba(0, 0, 0, 0.5);
}

/* Затемненный фон для форм авторизации */
.form-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-sizing: border-box;
}

/* По умолчанию скрываем overlay регистрации */
#registration-overlay {
    display: none;
}

/* Убеждаемся что overlay авторизации показан по умолчанию */
#login-overlay {
    display: flex;
}

/* Стили для форм авторизации и регистрации - готический стиль */
.form-container {
    background: linear-gradient(145deg, rgba(20, 12, 8, 0.95) 0%, rgba(40, 25, 15, 0.95) 100%);
    padding: 35px;
    border-radius: 15px;
    box-shadow: 
        0 0 30px rgba(212, 175, 55, 0.3),
        inset 0 1px 0 rgba(212, 175, 55, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(212, 175, 55, 0.4);
    position: relative;
    width: 90%;
    max-width: 420px;
    z-index: 1000;
    margin: 0;
    max-height: 80vh;
    overflow: visible;
    box-sizing: border-box;
}

/* Админские модалки - широкие и компактные без скролла */
.admin-modal-container {
    max-height: none !important; /* Контейнер растёт по содержимому */
    overflow: visible !important; /* Скролл отдаём оверлею */
    position: relative;
}

.admin-modal-wide {
    width: 100% !important;
    max-width: 1100px !important;
    padding: 8px 10px !important;
}

.admin-modal-medium {
    width: 100% !important;
    max-width: 820px !important;
    padding: 8px 10px !important;
}

/* Компактная сетка для формы старта игры в модалке */
#admin-game-overlay #playerForm > div {
    display: grid;
    grid-template-columns: auto 200px auto 60px;
    gap: 4px 8px;
    align-items: baseline;
    justify-items: start;
    justify-content: start;
}

#admin-game-overlay #playerForm input[type="text"],
#admin-game-overlay #playerForm select {
    padding: 4px 6px;
    font-size: 11px;
    line-height: 1.1;
    height: 28px;
    box-sizing: border-box;
    width: 100%;
    justify-self: stretch;
}

#admin-game-overlay #buttonContainer {
    margin-top: 10px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

#admin-game-overlay #buttonContainer button,
#admin-player-overlay #player-data-container button {
    padding: 6px 10px;
    font-size: 12px;
}

/* Компактный блок данных игрока */
#admin-player-overlay #player-data-container > div:first-child {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 4px 6px;
    align-items: center;
}

#admin-player-overlay #playerDataFields > div {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 6px;
    align-items: center;
}

#admin-player-overlay label,
#admin-game-overlay label {
    font-size: 12px;
    line-height: 1.1;
    margin: 0;
}

#admin-player-overlay h2 {
    margin-top: 0;
}

/* Компактные заголовки и кнопка закрытия */
.admin-modal-container h2 {
    font-size: 16px;
    margin-bottom: 6px;
}

.admin-close {
    position: absolute;
    top: -5px;
    right: 6px;
    border: 1px solid rgba(212, 175, 55, 0.4);
    background: linear-gradient(145deg, rgba(101, 67, 33, 0.8) 0%, rgba(139, 69, 19, 0.8) 100%);
    color: var(--page-text, #d4af37);
    border-radius: 6px;
    padding: 2px 6px;
    line-height: 1;
    cursor: pointer;
    z-index: 1000;
}

.admin-close:hover {
    border-color: var(--page-text, #d4af37);
}

/* Скролл только для растущих блоков */
#admin-game-overlay #linksContainer {
    max-height: 24vh;
    overflow: auto;
}

/* Стилизованные скроллбары в админских модалках под стиль чата */
#admin-game-overlay::-webkit-scrollbar,
#admin-player-overlay::-webkit-scrollbar,
.admin-modal-container *::-webkit-scrollbar,
#admin-game-overlay #linksContainer::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#admin-game-overlay::-webkit-scrollbar-track,
#admin-player-overlay::-webkit-scrollbar-track,
.admin-modal-container *::-webkit-scrollbar-track,
#admin-game-overlay #linksContainer::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

#admin-game-overlay::-webkit-scrollbar-thumb,
#admin-player-overlay::-webkit-scrollbar-thumb,
.admin-modal-container *::-webkit-scrollbar-thumb,
#admin-game-overlay #linksContainer::-webkit-scrollbar-thumb {
    background: linear-gradient(145deg, rgba(212, 175, 55, 0.6), rgba(139, 69, 19, 0.6));
    border-radius: 4px;
}

#admin-game-overlay::-webkit-scrollbar-thumb:hover,
#admin-player-overlay::-webkit-scrollbar-thumb:hover,
.admin-modal-container *::-webkit-scrollbar-thumb:hover,
#admin-game-overlay #linksContainer::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(145deg, rgba(212, 175, 55, 0.8), rgba(139, 69, 19, 0.8));
}

/* Оверлеям админ-модалок даём скролл, чтобы фон тянулся вместе с содержимым */
#admin-game-overlay,
#admin-player-overlay {
    align-items: flex-start;
    overflow-y: auto;
    padding: 10px 0;
}

/* Небольшой отступ сверху, чтобы модалка не прилипала к краю */
#admin-game-overlay .admin-modal-container,
#admin-player-overlay .admin-modal-container {
    margin-top: 10px;
}

.form-container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #d4af37, #8b4513, #d4af37, #8b4513);
    border-radius: 17px;
    z-index: -1;
    opacity: 0.6;
}

.form-container h2 {
    color: var(--page-text, #d4af37);
    text-align: center;
    margin-bottom: 30px;
    font-weight: 700;
    font-size: 26px;
    text-shadow: 
        0 0 10px rgba(212, 175, 55, 0.8),
        0 2px 4px rgba(0, 0, 0, 0.8);
    font-family: 'Lora', serif;
    letter-spacing: 2px;
    text-transform: uppercase;
    position: relative;
}

.form-container h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #d4af37, transparent);
}

.form-container input {
    margin-bottom: 20px;
    padding: 15px 20px;
    width: 100%;
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: linear-gradient(145deg, rgba(10, 6, 4, 0.9) 0%, rgba(25, 15, 10, 0.9) 100%);
    color: var(--page-text, #d4af37);
    box-sizing: border-box;
    font-family: 'Lora', serif;
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.5),
        0 1px 0 rgba(212, 175, 55, 0.1);
}

.form-container input:focus {
    outline: none;
    border-color: var(--page-text, #d4af37);
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(212, 175, 55, 0.4),
        0 1px 0 rgba(212, 175, 55, 0.2);
    background: linear-gradient(145deg, rgba(15, 9, 6, 0.95) 0%, rgba(30, 18, 12, 0.95) 100%);
}

.form-container input::placeholder {
    color: rgba(212, 175, 55, 0.6);
    font-weight: 400;
    font-style: italic;
}

.form-container .action-button {
    width: 100%;
    margin-right: 0;
    margin-bottom: 10px;
}

/* Убираем старые стили заголовка - теперь он в верхней панели */

/* Общий класс для скрытия элементов */
.hidden {
    display: none !important;
}

#chat-container {
    display: flex;
    flex-direction: column;
    flex: 1; /* Занимаем все оставшееся пространство */
}

/* Контейнер для панели пользователей с заголовком */
.users-section {
    width: 200px;
    display: flex;
    flex-direction: column;
    max-height: 100%; /* Ограничиваем высоту размером родителя */
}

/* Стили для панели онлайн пользователей */
#user-online {
    flex: 1; /* Занимаем все доступное пространство в users-section */
    min-height: 300px; /* Минимальная высота панели пользователей */
    max-height: calc(100% - 60px); /* Максимальная высота с учетом заголовка */
    border: 2px solid rgba(212, 175, 55, 0.4);
    background: linear-gradient(145deg, rgba(15, 9, 6, 0.9) 0%, rgba(25, 15, 10, 0.9) 100%);
    padding: 15px;
    overflow-y: auto;
    border-radius: 10px;
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.7),
        inset 0 1px 0 rgba(212, 175, 55, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.5);
    /* Убираем цвет отсюда, чтобы не переопределять стили ников */
    font-family: 'Lora', serif;
    font-size: 14px;
}

#user-online::-webkit-scrollbar {
    width: 6px;
}

#user-online::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

#user-online::-webkit-scrollbar-thumb {
    background: linear-gradient(145deg, rgba(212, 175, 55, 0.6), rgba(139, 69, 19, 0.6));
    border-radius: 3px;
}

#user-online::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(145deg, rgba(212, 175, 55, 0.8), rgba(139, 69, 19, 0.8));
}

#game-controls {
    /* Убираем принудительное скрытие; показ/скрытие теперь управляется JS и медиа-правилами */
    margin-top: 20px;
}



/* Общий контейнер для выравнивания всех элементов интерфейса */
.main-interface-container {
    max-width: 100%; /* Максимальное использование ширины экрана */
    margin: 0; /* Убираем центрирование для максимальной ширины */
    padding: 0; /* Убираем отступы */
    min-height: 100vh; /* Занимаем минимум всю высоту экрана */
    display: flex;
    flex-direction: column;
}

/* Верхняя панель с никнеймом и кнопками управления */
.system-buttons-container {
    width: 100%;
    padding: 10px 10px;
    background: linear-gradient(145deg, rgba(20, 12, 8, 0.95) 0%, rgba(40, 25, 15, 0.95) 100%);
    border: 2px solid rgba(212, 175, 55, 0.5);
    border-radius: 12px;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(212, 175, 55, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(10px);
    box-sizing: border-box;
}

.system-buttons-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto; /* Прижимаем кнопки к правому краю */
}

/* Стили для никнейма в верхней панели */
.player-name-header {
    color: var(--page-text, #d4af37);
    font-weight: 700;
    font-size: 18px;
    font-family: 'Lora', serif;
    text-shadow: 
        0 0 15px rgba(212, 175, 55, 0.8),
        0 2px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: 1px;
    margin: 0;
    flex-shrink: 0; /* Не сжимаем ник */
    min-width: fit-content; /* Минимальная ширина по содержимому */
}

/* Общие стили для всех системных кнопок - готический стиль */
.system-button {
    padding: 12px 16px;
    border: 2px solid rgba(212, 175, 55, 0.4);
    border-radius: 8px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Lora', serif;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(212, 175, 55, 0.2);
    backdrop-filter: blur(10px);
    color: var(--page-text, #d4af37);
    position: relative;
    overflow: hidden;
    min-width: 80px;
    white-space: nowrap;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    background: linear-gradient(145deg, rgba(139, 69, 19, 0.8) 0%, rgba(160, 82, 45, 0.8) 100%);
}

.system-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--btn-hover-glow) 40%, transparent), transparent);
    transition: left 0.5s;
}

.system-button:hover::before {
    left: 100%;
}

.system-button:hover {
    transform: translateY(-2px);
    background: linear-gradient(145deg, rgba(160, 82, 45, 0.9) 0%, rgba(139, 69, 19, 0.9) 100%);
    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.8),
        0 0 15px color-mix(in srgb, var(--btn-hover-glow) 60%, transparent),
        inset 0 1px 0 color-mix(in srgb, var(--btn-hover-glow) 30%, transparent);
    border-color: var(--page-text, #d4af37);
}

.system-button:active {
    transform: translateY(0);
}

.system-button:focus {
    outline: none;
    box-shadow:
        0 0 0 3px color-mix(in srgb, var(--btn-hover-glow) 40%, transparent),
        0 4px 15px rgba(0, 0, 0, 0.6);
}



/* Адаптивные стили для основного контейнера и элементов */
@media (max-width: 1024px) {
    .main-interface-container {
        max-width: 100%;
        padding: 0;
    }
    
    .system-buttons-row {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .system-button {
        font-size: 11px;
        padding: 10px 12px;
        min-width: 70px;
    }
    
    .player-name-header {
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .main-interface-container {
        padding: 0;
    }
    
    .system-buttons-container {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .system-buttons-row {
        justify-content: center;
        margin-left: 0; /* Убираем автоотступ на мобильных */
    }
}

@media (max-width: 480px) {
    .main-interface-container {
        padding: 0;
    }
    
    .system-buttons-row {
        flex-direction: column;
        align-items: center;
        gap: 8px;
        margin-left: 0; /* Убираем автоотступ на мобильных */
    }
    
    .system-button {
        font-size: 10px;
        padding: 8px 10px;
        min-width: 60px;
        width: 100%;
        max-width: 150px;
    }
    
    .player-name-header {
        font-size: 14px;
    }
    
    .chat-wrapper {
        flex-direction: column;
        gap: 20px;
    }
    
    .users-section, .chat-section {
        width: 100%;
    }
}

/* Общие стили для обычных кнопок - готический стиль */
/* Исключаем кнопки из .button-container-top, так как у них свои адаптивные стили */
button:not(.action-button):not(.system-button):not(.delete-message-btn):not(.hide-message-btn):not(.button-container-top button):not(.menu-toggle-btn):not(.quit-button) {
    border: 2px solid rgba(212, 175, 55, 0.4);
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    font-family: 'Lora', serif;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(145deg, rgba(101, 67, 33, 0.8) 0%, rgba(139, 69, 19, 0.8) 100%);
    color: var(--page-text, #d4af37);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(212, 175, 55, 0.2);
    position: relative;
    overflow: hidden;
}

button:not(.action-button):not(.system-button):not(.delete-message-btn):not(.hide-message-btn):not(.button-container-top button):not(.menu-toggle-btn):not(.quit-button)::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--btn-hover-glow) 30%, transparent), transparent);
    transition: left 0.5s;
}

button:not(.action-button):not(.system-button):not(.delete-message-btn):not(.hide-message-btn):not(.button-container-top button):not(.menu-toggle-btn):not(.quit-button):hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.8),
        0 0 15px color-mix(in srgb, var(--btn-hover-glow) 40%, transparent),
        inset 0 1px 0 color-mix(in srgb, var(--btn-hover-glow) 30%, transparent);
    background: linear-gradient(145deg, rgba(139, 69, 19, 0.9) 0%, rgba(101, 67, 33, 0.9) 100%);
    border-color: var(--page-text, #d4af37);
}

button:not(.action-button):not(.system-button):not(.delete-message-btn):not(.hide-message-btn):not(.button-container-top button):not(.menu-toggle-btn):not(.quit-button):hover::before {
    left: 100%;
}

button:not(.action-button):not(.system-button):not(.delete-message-btn):not(.hide-message-btn):not(.button-container-top button):not(.menu-toggle-btn):not(.quit-button):active {
    transform: translateY(0);
}

button:not(.action-button):not(.system-button):not(.delete-message-btn):not(.hide-message-btn):not(.button-container-top button):not(.menu-toggle-btn):not(.quit-button):focus {
    outline: none;
    box-shadow:
        0 0 0 3px color-mix(in srgb, var(--btn-hover-glow) 40%, transparent),
        0 4px 15px rgba(0, 0, 0, 0.6);
}

/* Готический стиль для сообщений чата */
.message-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    border: 2px solid rgba(212, 175, 55, 0.3);
    padding: 15px;
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(20, 12, 8, 0.8) 0%, rgba(30, 18, 12, 0.8) 100%);
    word-wrap: break-word;
    overflow-wrap: break-word;
    position: relative;
    box-shadow: 
        0 4px 10px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(212, 175, 55, 0.1);
}

.user-name {
    font-weight: bold;
    color: var(--page-text, #d4af37);
    font-family: 'Lora', serif;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    position: relative;
}

/* Стили для ников в онлайн-списке - используют настройку из редактора тем */
#user-online .online-user-name {
    font-weight: bold !important;
    color: var(--user-online-text, #d4af37) !important;
    font-family: 'Lora', serif !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8) !important;
}

/* Стили для офлайн ников (затенение) */
#user-online .offline-user-name {
    font-weight: bold !important;
    color: var(--user-online-text, #d4af37) !important;
    font-family: 'Lora', serif !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8) !important;
    opacity: 0.5 !important;
    filter: grayscale(0.3) !important;
}

/* Стили для заголовков "Онлайн:" и "Офлайн:" */
#user-online .online-header {
    font-weight: bold !important;
    color: var(--user-online-text, #d4af37) !important;
    font-family: 'Lora', serif !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8) !important;
}

/* Стили для модерации сообщений */
.moderation-controls {
    position: absolute;
    top: 5px;
    right: 5px;
}

.delete-message-btn {
    background: var(--btn-bg, rgba(139, 0, 0, 0.6));
    color: var(--btn-text, #ffffff);
    border: 1px solid var(--btn-border, rgba(220, 20, 60, 0.4));
    border-radius: 3px;
    width: 18px;
    height: 18px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: none;
}

.delete-message-btn:hover {
    background: var(--btn-hover-bg, rgba(178, 34, 34, 0.9));
    border-color: var(--btn-border, rgba(220, 20, 60, 0.8));
    transform: scale(1.1);
    box-shadow: none;
}

.hide-message-btn {
    background: var(--btn-bg, rgba(139, 0, 0, 0.6));
    color: var(--btn-text, #ffffff);
    border: 1px solid var(--btn-border, rgba(220, 20, 60, 0.4));
    border-radius: 3px;
    width: 18px;
    height: 18px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: none;
}

.hide-message-btn:hover {
    background: var(--btn-hover-bg, rgba(178, 34, 34, 0.9));
    border-color: var(--btn-border, rgba(220, 20, 60, 0.8));
    transform: scale(1.1);
    box-shadow: none;
}

.deleted-label {
    color: rgba(212, 175, 55, 0.5);
    font-size: 14px;
    font-weight: normal;
}

.message-text {
    flex-grow: 1;
    margin: 0 10px;
    white-space: pre-wrap;
    color: rgba(212, 175, 55, 0.9);
    font-family: 'Lora', serif;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Изображения в системном чате: горизонтальное размещение на десктопе */
#sys-messages .message-text {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

#sys-messages .message-text img {
    display: inline-block;
    max-width: 150px;
    height: auto;
    max-height: 120px; /* ≈3 см при 96dpi */
    object-fit: contain;
    border-radius: 6px;
    margin: 6px 0;
    flex-shrink: 0;
}

.message-time {
    font-size: 0.85em;
    color: rgba(212, 175, 55, 0.6);
    white-space: nowrap;
    font-style: italic;
}

/* Готический стиль для контейнеров чата */
.chat-wrapper {
    display: flex;
    justify-content: space-between;
    flex: 1;
    gap: 0;
    margin-top: 20px;
    max-height: 70vh; /* Ограничиваем высоту 70% экрана */
    position: relative;
}

/* Кнопка переключения системного чата */
.toggle-sys-chat-btn {
    background: var(--message-bg, #251a14);
    border: 2px solid var(--chat-box-border, rgba(212, 175, 55, 0.4));
    border-radius: 8px;
    color: var(--message-text, #e6e0d6);
    cursor: pointer;
    padding: 0;
    width: 16px;
    min-width: 16px;
    max-width: 16px;
    flex: 0 0 16px;
    align-self: stretch;
    margin: 39px 1px 1px 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(212, 175, 55, 0.1);
}

.toggle-sys-chat-btn:hover {
    background: var(--message-bg, #251a14);
    border-color: var(--page-text, #d4af37);
    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.7),
        0 0 20px rgba(212, 175, 55, 0.3),
        inset 0 1px 0 rgba(212, 175, 55, 0.3);
    transform: translateX(-2px);
    filter: brightness(1.2);
}

.toggle-sys-chat-btn:active {
    transform: translateX(0);
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.5),
        inset 0 2px 4px rgba(0, 0, 0, 0.5);
    filter: brightness(0.9);
}

.toggle-sys-chat-btn svg {
    transition: transform 0.3s ease;
}

.toggle-sys-chat-btn.collapsed svg {
    transform: rotate(180deg);
}

/* Скрыть кнопку на мобильных устройствах */
@media (max-width: 768px) {
    .toggle-sys-chat-btn {
        display: none !important;
    }
}

/* Контейнеры для отдельных чатов с заголовками */
.chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-height: 100%; /* Ограничиваем высоту размером родителя */
}

.chat-title {
    color: var(--page-text, #d4af37);
    text-align: center;
    margin-bottom: 10px;
    margin-top: 10px;
    font-weight: 600;
    font-size: 16px;
    font-family: 'Lora', serif;
    text-shadow: 
        0 0 10px rgba(212, 175, 55, 0.6),
        0 2px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.chat-box {
    flex: 1; /* Занимаем все доступное пространство в секции */
    min-height: 300px; /* Минимальная высота чат-бокса */
    max-height: calc(100% - 60px); /* Максимальная высота с учетом заголовка */
    border: 2px solid rgba(212, 175, 55, 0.4);
    background: linear-gradient(145deg, rgba(15, 9, 6, 0.9) 0%, rgba(25, 15, 10, 0.9) 100%);
    padding: 15px;
    overflow-y: auto;
    border-radius: 10px;
    box-shadow: 
        0 8px 20px rgba(0, 0, 0, 0.7),
        inset 0 1px 0 rgba(212, 175, 55, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.5);
}

.chat-box::-webkit-scrollbar {
    width: 8px;
}

.chat-box::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.chat-box::-webkit-scrollbar-thumb {
    background: linear-gradient(145deg, rgba(212, 175, 55, 0.6), rgba(139, 69, 19, 0.6));
    border-radius: 4px;
}

.chat-box::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(145deg, rgba(212, 175, 55, 0.8), rgba(139, 69, 19, 0.8));
}

/* Стили для заголовков чата */
#chat-container h2 {
    color: var(--page-text, #d4af37);
    text-align: center;
    margin-bottom: 20px;
    font-weight: 700;
    font-size: 24px;
    font-family: 'Lora', serif;
    text-shadow: 
        0 0 15px rgba(212, 175, 55, 0.8),
        0 2px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Контейнер для поля ввода */
.chat-input-container {
    margin-top: 15px;
    padding: 12px;
    background: linear-gradient(145deg, rgba(20, 12, 8, 0.95) 0%, rgba(40, 25, 15, 0.95) 100%);
    border: 1px solid rgba(212, 175, 55, 0.5);
    border-radius: 12px;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(212, 175, 55, 0.2);
    backdrop-filter: blur(10px);
}

/* Готический стиль для поля ввода чата с уменьшенной обводкой */
#chat-input {
    width: 100%;
    padding: 15px 20px;
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Lora', serif;
    background: linear-gradient(145deg, rgba(10, 6, 4, 0.9) 0%, rgba(25, 15, 10, 0.9) 100%);
    color: var(--page-text, #d4af37);
    box-sizing: border-box;
    transition: all 0.3s ease;
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.5),
        0 1px 0 rgba(212, 175, 55, 0.1);
}

#chat-input:focus {
    outline: none;
    border-color: var(--page-text, #d4af37);
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(212, 175, 55, 0.4),
        0 1px 0 rgba(212, 175, 55, 0.2);
    background: linear-gradient(145deg, rgba(15, 9, 6, 0.95) 0%, rgba(30, 18, 12, 0.95) 100%);
}

#chat-input::placeholder {
    color: rgba(212, 175, 55, 0.6);
    font-style: italic;
}

/* ========== МОБИЛЬНЫЕ СТИЛИ ДЛЯ ПЕРЕКЛЮЧЕНИЯ ЧАТОВ ========== */

/* Контейнер мобильных кнопок переключения */
.mobile-chat-controls {
    display: none; /* По умолчанию скрыт */
    justify-content: center;
    gap: 5px;
    margin-bottom: 15px;
    padding: 10px;
    background: linear-gradient(145deg, rgba(20, 12, 8, 0.95) 0%, rgba(40, 25, 15, 0.95) 100%);
    border: 2px solid rgba(212, 175, 55, 0.5);
    border-radius: 10px;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(212, 175, 55, 0.2);
    backdrop-filter: blur(10px);
}

/* Стили для кнопок переключения чатов */
.mobile-chat-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 6px;
    background: linear-gradient(145deg, rgba(40, 25, 15, 0.8) 0%, rgba(60, 35, 20, 0.8) 100%);
    color: var(--page-text, rgba(212, 175, 55, 0.8));
    font-family: 'Lora', 'Times New Roman', serif;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(212, 175, 55, 0.1);
}

.mobile-chat-btn:hover {
    background: linear-gradient(145deg, rgba(60, 35, 20, 0.9) 0%, rgba(80, 45, 25, 0.9) 100%);
    border-color: color-mix(in srgb, var(--btn-hover-glow) 50%, transparent);
    color: var(--page-text, #d4af37);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 color-mix(in srgb, var(--btn-hover-glow) 20%, transparent);
}

.mobile-chat-btn.active {
    background: linear-gradient(145deg, color-mix(in srgb, var(--btn-hover-glow) 20%, transparent) 0%, color-mix(in srgb, var(--btn-hover-glow) 10%, transparent) 100%);
    border-color: var(--page-text, #d4af37);
    color: var(--page-text, #d4af37);
    box-shadow:
        0 4px 15px color-mix(in srgb, var(--btn-hover-glow) 30%, transparent),
        inset 0 1px 0 color-mix(in srgb, var(--btn-hover-glow) 30%, transparent),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3);
    text-shadow: 0 0 8px color-mix(in srgb, var(--btn-hover-glow) 50%, transparent);
}

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

@media (max-width: 768px) {
    /* Показываем мобильные кнопки переключения */
    .mobile-chat-controls {
        display: flex !important;
    }
    
    /* Скрываем заголовки чатов в мобильном режиме */
    .chat-title {
        display: none !important;
    }
    
    /* Адаптация чат-контейнера для мобильных */
    .chat-wrapper {
        flex-direction: column;
        height: calc(100vh - 200px); /* Учитываем высоту верхней панели и кнопок */
        min-height: 400px;
    }
    
    /* Адаптация секций чатов */
    .chat-section,
    .users-section {
        flex: 1;
        min-height: 0;
        margin: 0;
        max-height: 100%;
        /* Обеспечиваем корректное отображение при переключении */
        overflow: hidden;
        position: relative;
    }
    
    /* Адаптация чат-боксов */
    .chat-box,
    #user-online {
        height: 100%;
        max-height: 100%;
        flex: 1;
        min-height: 300px;
    }
    
    /* Адаптация поля ввода */
    .chat-input-container {
        margin-top: 10px;
        padding: 8px;
    }
    
    #chat-input {
        font-size: 16px; /* Предотвращает зум на iOS */
    padding: 10px;
    }
    
    /* Скрываем элементы супер-админа на мобильных в основном DOM,
       но оставляем видимыми внутри модалок */
    .main-interface-container > #game-controls,
    .main-interface-container > #player-data-container {
        display: none !important;
    }
    #admin-game-overlay #game-controls,
    #admin-player-overlay #player-data-container {
        display: block !important;
    }
    
    /* Обеспечиваем корректное отображение активных секций */
    .chat-section[style*="flex"],
    .users-section[style*="flex"] {
        display: flex !important;
        flex-direction: column !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Сохраняем горизонтальную структуру для обычного чата на мобильных */
    #chat-messages .message-container {
        flex-direction: row !important;
        align-items: flex-start !important;
        justify-content: space-between !important;
    }
    
    #chat-messages .user-name {
        flex-shrink: 0;
        max-width: 80px;
        word-break: break-word;
        font-size: 12px;
    }
    
    #chat-messages .message-text {
        margin: 0 8px;
        flex-grow: 1;
        font-size: 13px;
    }
    
    #chat-messages .message-time {
        flex-shrink: 0;
        font-size: 10px;
        text-align: right;
        min-width: 50px;
    }
    
    /* Мобильная адаптация системных сообщений - вертикальная структура */
    #sys-messages .message-container {
        flex-direction: column !important;
        align-items: stretch !important;
        text-align: center;
        padding: 12px;
    }
    
    #sys-messages .user-name {
        order: 1;
        margin-bottom: 8px;
        text-align: center;
        font-size: 14px;
        padding: 4px 8px;
        background: linear-gradient(145deg, rgba(212, 175, 55, 0.1) 0%, rgba(255, 215, 0, 0.05) 100%);
        border-radius: 4px;
        border: 1px solid rgba(212, 175, 55, 0.2);
    }
    
    #sys-messages .message-text {
        order: 2;
        margin: 0;
        margin-bottom: 8px;
        text-align: center;
        flex-grow: 0;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 8px !important;
    }
    
    #sys-messages .message-text img {
        max-width: 90% !important;
        height: auto !important;
        border-radius: 4px;
        margin: 5px 0;
        display: block !important;
    }
    
    #sys-messages .message-time {
        order: 3;
        text-align: center;
        font-size: 11px;
        padding: 4px 8px;
        background: linear-gradient(145deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.1) 100%);
        border-radius: 4px;
        margin-top: auto;
        white-space: normal;
    }
}

@media (max-width: 480px) {
    /* Еще более компактные стили для очень маленьких экранов */
    .mobile-chat-controls {
        padding: 8px;
        gap: 3px;
    }
    
    .mobile-chat-btn {
        padding: 6px 8px;
        font-size: 11px;
    }
    
    .chat-wrapper {
        height: calc(100vh - 180px);
        min-height: 350px;
    }
    
    .chat-box,
    #user-online {
        min-height: 250px;
    }
    
    /* Дополнительная компактность для системных сообщений на малых экранах */
    #sys-messages .message-container {
        padding: 8px !important;
    }
    
    #sys-messages .user-name {
        font-size: 12px !important;
        padding: 3px 6px !important;
        margin-bottom: 6px !important;
    }
    
    #sys-messages .message-text {
        font-size: 13px !important;
        margin-bottom: 6px !important;
    }
    
    #sys-messages .message-time {
        font-size: 10px !important;
        padding: 3px 6px !important;
    }
}

/* ========== ФИКСИРОВАННЫЕ СТИЛИ ДЛЯ СТРАНИЦЫ НАСТРОЕК ========== */
/* Контейнер настроек с фиксированными светлыми цветами, не зависящими от темы */
.settings-container {
    background: #f5f5f5 !important;
    border: 2px solid #333333 !important;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    color: #333333 !important;
}

.settings-container h2 {
    color: #333333 !important;
    text-shadow: none !important;
    margin-bottom: 25px;
    font-size: 24px;
    font-weight: 600;
}

.settings-container h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: #333333;
}

.settings-container label {
    color: #333333 !important;
    font-weight: 500;
    display: block;
    margin-bottom: 8px;
}

.settings-container input[type="text"],
.settings-container input[type="password"],
.settings-container input[type="email"],
.settings-container select,
.settings-container textarea {
    background: #ffffff !important;
    border: 1px solid #666666 !important;
    color: #333333 !important;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.settings-container input:focus,
.settings-container select:focus,
.settings-container textarea:focus {
    outline: none;
    border-color: #000000 !important;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1) !important;
    background: #ffffff !important;
}

.settings-container input::placeholder,
.settings-container textarea::placeholder {
    color: #999999 !important;
}

.settings-container button,
.settings-container .action-button {
    background: #333333 !important;
    color: #ffffff !important;
    border: 2px solid #333333 !important;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: none !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2) !important;
}

.settings-container button:hover,
.settings-container .action-button:hover {
    background: #555555 !important;
    border-color: #555555 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25) !important;
}

.settings-container button:active,
.settings-container .action-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
}

.settings-container button::before,
.settings-container .action-button::before {
    display: none !important;
}

.settings-container .form-group {
    margin-bottom: 20px;
}

.settings-container .message,
.settings-container .error-message,
.settings-container .success-message {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-weight: 500;
}

.settings-container .error-message {
    background: #fee !important;
    color: #c00 !important;
    border: 1px solid #fcc !important;
}

.settings-container .success-message {
    background: #efe !important;
    color: #060 !important;
    border: 1px solid #cfc !important;
}

/* ========== ФИКСИРОВАННЫЕ СТИЛИ ДЛЯ РЕДАКТОРА ТЕМ ========== */
/* Верхняя панель управления theme-builder с фиксированными цветами */
.theme-controls-panel {
    background: #f8f8f8 !important;
    border: 2px solid #444444 !important;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Контейнер заголовка с элементами управления темой */
.tb-header {
    background: #f8f8f8 !important;
    border: 2px solid #444444 !important;
    border-radius: 10px;
    padding: 15px 20px !important;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.tb-header h2 {
    color: #333333 !important;
    text-shadow: none !important;
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.tb-header input[type="text"] {
    background: #ffffff !important;
    border: 1px solid #666666 !important;
    color: #333333 !important;
    padding: 8px 12px !important;
    border-radius: 5px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.tb-header input[type="text"]:focus {
    outline: none;
    border-color: #000000 !important;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1) !important;
}

.tb-header input[type="text"]::placeholder {
    color: #999999 !important;
}

.tb-header button,
.tb-header .btn {
    background: #444444 !important;
    color: #ffffff !important;
    border: 2px solid #444444 !important;
    padding: 8px 16px !important;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: none !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15) !important;
}

.tb-header button:hover,
.tb-header .btn:hover {
    background: #666666 !important;
    border-color: #666666 !important;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2) !important;
}

.tb-header button:active,
.tb-header .btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) !important;
}

.tb-header button::before,
.tb-header .btn::before {
    display: none !important;
}

/* Лейблы для чекбоксов и радиокнопок в tb-header */
.tb-header label {
    color: #333333 !important;
    font-weight: 500;
}

.theme-controls-panel h2,
.theme-controls-panel h3,
.theme-controls-panel label,
.theme-controls-panel span,
.theme-controls-panel p {
    color: #333333 !important;
    text-shadow: none !important;
}

.theme-controls-panel input[type="text"],
.theme-controls-panel input[type="color"],
.theme-controls-panel input[type="number"],
.theme-controls-panel input[type="range"],
.theme-controls-panel select,
.theme-controls-panel textarea {
    background: #ffffff !important;
    border: 1px solid #666666 !important;
    color: #333333 !important;
    padding: 8px 10px;
    border-radius: 5px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.theme-controls-panel input:focus,
.theme-controls-panel select:focus,
.theme-controls-panel textarea:focus {
    outline: none;
    border-color: #000000 !important;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1) !important;
}

.theme-controls-panel input::placeholder {
    color: #999999 !important;
}

.theme-controls-panel button {
    background: #444444 !important;
    color: #ffffff !important;
    border: 2px solid #444444 !important;
    padding: 8px 16px;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: none !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15) !important;
}

.theme-controls-panel button:hover {
    background: #666666 !important;
    border-color: #666666 !important;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2) !important;
}

.theme-controls-panel button:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) !important;
}

.theme-controls-panel button::before {
    display: none !important;
}

/* Группы элементов управления */
.theme-controls-panel .control-group {
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 5px;
}

.theme-controls-panel .control-group label {
    display: inline-block;
    min-width: 120px;
    font-weight: 500;
}

/* Цветовые палитры */
.theme-controls-panel input[type="color"] {
    width: 50px;
    height: 35px;
    padding: 2px;
    cursor: pointer;
}

/* Слайдеры */
.theme-controls-panel input[type="range"] {
    width: 200px;
}

/* Текстовые поля для кода */
.theme-controls-panel textarea.code-input {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.4;
    background: #ffffff !important;
    color: #333333 !important;
}

/* Сообщения и уведомления */
.theme-controls-panel .info-message,
.theme-controls-panel .warning-message,
.theme-controls-panel .error-message,
.theme-controls-panel .success-message {
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
    font-weight: 500;
}

.theme-controls-panel .info-message {
    background: #e3f2fd !important;
    color: #1565c0 !important;
    border: 1px solid #bbdefb !important;
}

.theme-controls-panel .warning-message {
    background: #fff3e0 !important;
    color: #e65100 !important;
    border: 1px solid #ffe0b2 !important;
}

.theme-controls-panel .error-message {
    background: #ffebee !important;
    color: #c62828 !important;
    border: 1px solid #ffcdd2 !important;
}

.theme-controls-panel .success-message {
    background: #e8f5e9 !important;
    color: #2e7d32 !important;
    border: 1px solid #c8e6c9 !important;
}

/* ========== МОБИЛЬНЫЕ КНОПКИ СКРОЛЛА ========== */
.mobile-scroll-btn {
    display: none; /* Скрыто по умолчанию на десктопе */
    position: fixed !important;
    width: 45px;
    height: 45px;
    background-color: rgba(80, 80, 80, 0.15); /* Очень прозрачный фон */
    border: 1px solid rgba(150, 150, 150, 0.15);
    border-radius: 50%;
    cursor: pointer;
    z-index: 9999 !important; /* Высокий z-index чтобы быть поверх всего */
    transition: opacity 0.3s ease, transform 0.2s ease;
    padding: 0;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    opacity: 0; /* Изначально скрыты */
    pointer-events: none; /* Отключаем клики на скрытых кнопках */
}

.mobile-scroll-btn:hover {
    background-color: rgba(128, 128, 128, 0.25); /* Немного видимее при наведении */
    transform: scale(1.05);
}

.mobile-scroll-btn:active {
    transform: scale(0.95);
}

.mobile-scroll-btn svg {
    color: rgba(255, 255, 255, 0.4); /* Стрелки тоже едва видны */
    width: 20px;
    height: 20px;
}

/* Кнопка вверх - в правом нижнем углу */
.mobile-scroll-btn.scroll-top {
    bottom: 115px !important; /* Поднимаем еще выше на размер кнопки */
    right: 20px !important;
    left: auto !important;
}

/* Кнопка вниз - в правом верхнем углу */
.mobile-scroll-btn.scroll-bottom {
    top: 105px !important; /* Опускаем еще ниже на размер кнопки */
    right: 20px !important;
    left: auto !important;
}

/* Показываем кнопки только на мобильных устройствах */
@media (max-width: 768px) {
    .mobile-scroll-btn {
        display: flex !important;
    }
    
    /* Дополнительная стилизация для гармоничного вида */
    .mobile-scroll-btn {
        background-color: rgba(100, 100, 100, 0.1) !important; /* Едва видимый фон */
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
    }
    
    /* Уменьшаем размер на очень маленьких экранах */
    @media (max-width: 380px) {
        .mobile-scroll-btn {
            width: 35px;
            height: 35px;
        }
        
        .mobile-scroll-btn svg {
            width: 18px;
            height: 18px;
        }
        
        .mobile-scroll-btn.scroll-top {
            bottom: 14px !important;
            right: 15px !important;
        }
        
        .mobile-scroll-btn.scroll-bottom {
            top: 25px !important;
            right: 15px !important;
        }
    }
}

/* ========== МОБИЛЬНЫЕ СТИЛИ ДЛЯ МОДАЛЬНОГО ОКНА ЛИЧНЫХ СООБЩЕНИЙ ========== */
@media (max-width: 768px) {
    /* Модальное окно личного чата */
    #private-chat-overlay .modal-content,
    #private-chat-overlay .form-container {
        width: 95% !important; /* Почти на всю ширину экрана */
        max-width: none !important;
        height: 85vh !important; /* Почти на всю высоту */
        margin: auto !important;
        padding: 15px !important;
        box-sizing: border-box !important;
    }
    
    /* Заголовок модального окна */
    #private-chat-overlay .modal-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
        padding-bottom: 10px !important;
        border-bottom: 1px solid rgba(212, 175, 55, 0.2);
        margin-bottom: 10px !important;
    }
    
    #private-chat-overlay .modal-header h2 {
        font-size: 18px !important;
        margin: 0 !important;
    }
    
    /* Кнопки в заголовке */
    #private-chat-overlay .modal-header > div {
        width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 5px !important;
    }
    
    #private-chat-overlay .modal-header button:not(.close) {
        padding: 6px 10px !important;
        font-size: 11px !important;
        flex: 1 !important;
        min-width: auto !important;
    }
    
    /* Кнопка закрытия */
    #private-chat-overlay .modal-header .close {
        position: absolute !important;
        top: 5px !important;
        right: 10px !important;
        font-size: 28px !important;
        padding: 0 !important;
        width: auto !important;
        min-width: auto !important;
        flex: none !important;
    }
    
    /* Область сообщений */
    #private-chat-messages {
        height: calc(100% - 150px) !important; /* Вычитаем высоту заголовка и поля ввода */
        margin-bottom: 10px !important;
        padding: 8px !important;
        font-size: 14px !important;
    }
    
    /* Поле ввода сообщения */
    #private-chat-overlay .chat-input-container {
        padding: 0 !important;
        margin-top: auto !important;
    }
    
    #private-chat-input {
        width: 100% !important;
        padding: 10px !important;
        font-size: 16px !important; /* Предотвращаем зум на iOS */
        border-radius: 5px !important;
        box-sizing: border-box !important;
    }
    
    /* Модальное окно списка сообщений */
    #private-messages-list-overlay .modal-content,
    #private-messages-list-overlay .form-container {
        width: 95% !important;
        max-width: none !important;
        height: 80vh !important;
        margin: auto !important;
        padding: 15px !important;
    }
    
    #private-messages-list-overlay .modal-header h2 {
        font-size: 18px !important;
    }
    
    #private-messages-list {
        max-height: calc(100% - 60px) !important;
        font-size: 14px !important;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    #private-chat-overlay .modal-content,
    #private-chat-overlay .form-container {
        width: 100% !important;
        height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        padding: 10px !important;
    }
    
    #private-chat-overlay .modal-header {
        gap: 5px !important;
    }
    
    #private-chat-overlay .modal-header button:not(.close) {
        padding: 8px !important;
        font-size: 10px !important;
    }
    
    /* Убираем текст у кнопки очистки на маленьких экранах */
    #clear-private-chat-btn span {
        display: none !important;
    }
    
    #private-chat-messages {
        height: calc(100vh - 180px) !important;
        font-size: 13px !important;
        padding: 5px !important;
    }
    
    #private-chat-input {
        padding: 10px !important;
        font-size: 16px !important;
    }
    
    #private-messages-list-overlay .modal-content,
    #private-messages-list-overlay .form-container {
        width: 100% !important;
        height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }
}

/* === АДМИНСКИЕ СТИЛИ ДЛЯ УПРАВЛЕНИЯ ИГРАМИ === */

/* Табы в админской панели */
.admin-tabs {
    display: flex;
    border-bottom: 2px solid var(--panel-border, #8b4513);
    margin-bottom: 20px;
}

.admin-tab-btn {
    background: var(--btn-bg, #4a2c17);
    color: var(--btn-text, #d4af37);
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 5px 5px 0 0;
    margin-right: 5px;
    font-size: 14px;
    font-weight: bold;
    position: relative;
    overflow: hidden;
    transition: all 0.15s ease; /* Ускорено с 0.3s до 0.15s */
}

.admin-tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.3), transparent);
    transition: left 0.4s;
}

.admin-tab-btn:hover::before {
    left: 100%;
}

.admin-tab-btn:hover {
    background: var(--btn-hover-bg, #5a3c27);
    transform: translateY(-1px);
}

.admin-tab-btn.active {
    background: var(--panel-bg, #2a1a10);
    color: var(--page-text, #d4af37);
    border-bottom: 2px solid var(--page-text, #d4af37);
}

/* Контент табов */
.admin-tab-content {
    display: none;
}

.admin-tab-content.active {
    display: block;
}

/* Управление играми */
.games-management {
    max-height: 400px;
    overflow-y: auto;
}

.games-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--panel-border, #8b4513);
}

.games-header h3 {
    margin: 0;
    color: var(--page-text, #d4af37);
    font-size: 16px;
}

.games-controls {
    display: flex;
    gap: 10px;
}

.games-controls button {
    background: var(--btn-bg, #4a2c17);
    color: var(--btn-text, #d4af37);
    border: 1px solid var(--btn-border, #8b4513);
    padding: 5px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s ease;
}

.games-controls button:hover {
    background: var(--btn-hover-bg, #5a3c27);
}

/* Список игр */
.games-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-item {
    background: #ffffff !important;
    color: #000000 !important;
    border: 1px solid var(--panel-border, #8b4513);
    border-radius: 5px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    transition: border-color 0.3s ease;
}

.game-item * {
    color: #000000 !important;
}

.game-item.active {
    border-left: 4px solid #4caf50;
}

.game-item.completed {
    border-left: 4px solid #757575;
    opacity: 0.8;
}

.game-item:hover {
    border-color: var(--page-text, #d4af37);
}

.game-info {
    flex: 1;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.game-id {
    font-family: monospace;
    font-size: 12px;
    color: var(--btn-text, #d4af37);
    background: rgba(139, 69, 19, 0.3);
    padding: 2px 6px;
    border-radius: 3px;
}

.game-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: bold;
    text-transform: uppercase;
}

.game-status.active {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
    border: 1px solid #4caf50;
}

.game-status.completed {
    background: rgba(117, 117, 117, 0.2);
    color: #757575;
    border: 1px solid #757575;
}

.game-players {
    font-size: 13px;
    color: var(--page-text, #d4af37);
    margin-bottom: 5px;
    font-weight: bold;
}

.game-time {
    font-size: 11px;
    color: var(--btn-text, #b8860b);
    line-height: 1.4;
}

.game-time div {
    margin-bottom: 2px;
}

.game-controls {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.game-stop-btn,
.game-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: #ff4444;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    transition: all 0.15s ease; /* Ускорено с 0.3s */
    font-weight: bold;
}

.game-delete-btn {
    top: 8px;
    right: 8px;
    color: #ff6b6b;
}

.game-stop-btn {
    top: 8px;
    right: 35px;
    color: #ff8c00;
}

.game-stop-btn:hover,
.game-delete-btn:hover {
    background: rgba(255, 68, 68, 0.2);
    transform: scale(1.1); /* Добавлен эффект увеличения */
}

/* Футер админской модалки */
.admin-modal-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--panel-border, #8b4513);
    text-align: center;
}

.admin-modal-footer button {
    background: var(--btn-bg, #4a2c17);
    color: var(--btn-text, #d4af37);
    border: 1px solid var(--btn-border, #8b4513);
    padding: 8px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    position: relative;
    overflow: hidden;
    transition: all 0.15s ease; /* Ускорено с 0.3s */
}

.admin-modal-footer button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.3), transparent);
    transition: left 0.4s;
}

.admin-modal-footer button:hover::before {
    left: 100%;
}

.admin-modal-footer button:hover {
    background: var(--btn-hover-bg, #5a3c27);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Сообщения состояния */
.loading-message,
.error-message,
.empty-message {
    text-align: center;
    padding: 30px;
    color: var(--page-text, #d4af37);
    font-style: italic;
}

.error-message {
    color: #ff6b6b;
}

/* Адаптивность для новых элементов */
@media (max-width: 768px) {
    .admin-tabs {
        flex-direction: column;
    }

    .admin-tab-btn {
        margin: 0 0 5px 0;
        border-radius: 5px;
        width: 100%;
    }

    .games-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .games-controls {
        width: 100%;
        justify-content: flex-end;
    }

    .game-item {
        padding: 10px;
    }

    .game-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .game-stop-btn {
        right: 8px;
        top: 35px;
    }

    .game-delete-btn {
        top: 8px;
        right: 8px;
    }
}

/* ========== СТИЛИ ДЛЯ СИСТЕМЫ КОМНАТ ========== */

.rooms-wrapper {
    display: flex;
    height: 100%;
    gap: 20px;
}

.rooms-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}


.rooms-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: var(--chat-box-bg, linear-gradient(145deg, rgba(27, 20, 16, 0.95) 0%, rgba(40, 30, 24, 0.95) 100%));
    border: 2px solid var(--chat-box-border, rgba(212, 175, 55, 0.5));
    border-radius: 12px;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 var(--chat-box-border, rgba(212, 175, 55, 0.2));
    backdrop-filter: blur(10px);
}

.room-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--message-bg, linear-gradient(145deg, rgba(20, 12, 8, 0.8) 0%, rgba(35, 22, 15, 0.8) 100%));
    border: 1px solid var(--panel-border, rgba(212, 175, 55, 0.3));
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 var(--panel-border, rgba(212, 175, 55, 0.1));
}

.room-item:hover {
    background: var(--panel-border, rgba(212, 175, 55, 0.15));
    border-color: var(--chat-box-border, rgba(212, 175, 55, 0.6));
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 var(--chat-box-border, rgba(212, 175, 55, 0.2));
    transform: translateY(-2px);
}

.room-item.full {
    opacity: 0.6;
    cursor: not-allowed;
}

.room-item.full:hover {
    transform: none;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 var(--panel-border, rgba(212, 175, 55, 0.1));
}

.room-item.current-room {
    background: var(--panel-border, rgba(212, 175, 55, 0.2)) !important;
    border-color: var(--chat-box-border, rgba(212, 175, 55, 0.8));
    box-shadow:
        0 2px 10px rgba(212, 175, 55, 0.3),
        inset 0 1px 0 rgba(212, 175, 55, 0.4);
}

.room-item.current-room.full {
    opacity: 1 !important;
    cursor: pointer !important;
}

.room-name {
    color: var(--message-text, rgba(230, 224, 214, 0.9));
    font-weight: bold;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.room-name::after {
    content: '';
    font-size: 14px;
}

.room-name.password::after {
    content: '🔒';
}

.room-users {
    color: var(--message-text, rgba(230, 224, 214, 0.9));
    font-size: 14px;
    font-weight: bold;
    background: var(--panel-border, rgba(212, 175, 55, 0.15));
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--panel-border, rgba(212, 175, 55, 0.4));
}

.room-users.full {
    background: rgba(220, 20, 60, 0.2);
    border-color: rgba(220, 20, 60, 0.5);
    color: rgba(220, 20, 60, 0.9);
}

/* Адаптивные стили для мобильных устройств */
@media (max-width: 768px) {
    .rooms-wrapper {
        flex-direction: column;
        gap: 10px;
    }

    .room-item {
        padding: 10px 12px;
        font-size: 14px;
    }

    .room-name {
        font-size: 14px;
    }

    .room-users {
        font-size: 12px;
        padding: 3px 6px;
    }
}

/* ==================== СТИЛИ МОДАЛЬНОГО ОКНА ПАРАМЕТРОВ ИГРЫ ==================== */

.game-params-modal {
    background: var(--game-panel-bg, rgba(20, 12, 8, 0.95));
    border: 2px solid var(--game-panel-border, rgba(212, 175, 55, 0.5));
    border-radius: 15px;
    padding: 25px;
    color: var(--page-text, #d4af37);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
}

.game-mode-section {
    margin-bottom: 20px;
}

.game-mode-section h3 {
    margin: 0 0 15px 0;
    text-align: center;
    color: var(--page-text, #d4af37);
    font-size: 18px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.game-mode-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--btn-bg, #2a1a0f) 0%, var(--btn-hover-bg, #3d2815) 100%);
    border: 2px solid var(--btn-border, #d4af37);
    border-radius: 10px;
    color: var(--btn-text, #d4af37);
    font-family: inherit;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.15s ease; /* Ускорено с 0.3s */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.game-mode-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(244, 208, 63, 0.3), transparent);
    transition: left 0.4s;
}

.game-mode-btn:hover::before {
    left: 100%;
}

.game-mode-btn:hover {
    background: linear-gradient(135deg, var(--btn-hover-bg, #3d2815) 0%, var(--btn-bg, #2a1a0f) 100%);
    border-color: var(--btn-hover-border, #f4d03f);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.game-mode-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.btn-icon {
    font-size: 20px;
}

.btn-text {
    font-weight: 500;
}

.section-divider {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--btn-border, #d4af37) 50%, transparent 100%);
    margin: 25px 0;
    opacity: 0.6;
}

/* Состояния матчмейкинга */
.matchmaking-state {
    display: none;
}

.matchmaking-state.active {
    display: block;
}

/* Стили для поиска игры */
.search-info {
    text-align: center;
    margin-bottom: 20px;
}

.search-timer {
    font-size: 24px;
    font-weight: bold;
    color: #000000;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
}

.search-status {
    font-size: 14px;
    color: #000000;
    opacity: 0.8;
}

/* Стили для найденной игры */
.match-found-info {
    text-align: center;
    margin-bottom: 20px;
}

.match-found-info h4 {
    margin: 0 0 15px 0;
    color: var(--success-color, #2ecc71);
    font-size: 20px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
}

.opponent-info {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--btn-border, #d4af37);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.opponent-info span {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
}

.opponent-info span:last-child {
    margin-bottom: 0;
}

.ready-question {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #000000;
}

.ready-timer {
    font-size: 16px;
    color: #000000;
    margin-bottom: 20px;
}

.ready-buttons {
    display: flex;
    gap: 10px;
}

.accept-btn {
    flex: 1;
    padding: 12px;
    background: linear-gradient(135deg, var(--success-color, #2ecc71) 0%, var(--success-hover, #27ae60) 100%);
    border: 2px solid var(--success-color, #2ecc71);
    border-radius: 8px;
    color: white;
    font-family: inherit;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.accept-btn:hover {
    background: linear-gradient(135deg, var(--success-hover, #27ae60) 0%, var(--success-color, #2ecc71) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.decline-btn, .cancel-btn {
    flex: 1;
    padding: 12px;
    background: linear-gradient(135deg, var(--danger-color, #e74c3c) 0%, var(--danger-hover, #c0392b) 100%);
    border: 2px solid var(--danger-color, #e74c3c);
    border-radius: 8px;
    color: white;
    font-family: inherit;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    width: 100%;
}

.decline-btn:hover, .cancel-btn:hover {
    background: linear-gradient(135deg, var(--danger-hover, #c0392b) 0%, var(--danger-color, #e74c3c) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.decline-btn:active, .cancel-btn:active, .accept-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* Стили для ожидания соперника */
.waiting-info {
    text-align: center;
    margin-bottom: 20px;
}

.waiting-message {
    font-size: 16px;
    color: var(--page-text, #d4af37);
    margin-bottom: 10px;
}

.waiting-timer {
    font-size: 14px;
    color: var(--warning-color, #f39c12);
    margin-bottom: 20px;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .game-params-modal {
        width: 95vw !important;
        padding: 20px;
        margin: 0 auto;
        max-height: 90vh;
        overflow-y: auto;
    }

    .game-mode-btn {
        padding: 12px;
        font-size: 14px;
    }

    .btn-icon {
        font-size: 18px;
    }

    .search-timer {
        font-size: 20px;
    }

    .ready-buttons {
        flex-direction: column;
    }

    .accept-btn, .decline-btn {
        flex: none;
        width: 100%;
        margin-bottom: 10px;
    }

    .decline-btn:last-child {
        margin-bottom: 0;
    }
}

/* Индикатор активного поиска */
.matchmaking-indicator {
    animation: pulse 1.5s infinite;
    margin-left: 5px;
    display: inline-block;
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

/* Контекстное меню для игроков */
.player-context-menu {
    position: fixed;
    background: var(--modal-background, #1a1a1a);
    border: 2px solid var(--accent-color, #d4af37);
    border-radius: 8px;
    padding: 8px 0;
    min-width: 180px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
    z-index: 10000;
    font-family: 'Lora', serif;
    backdrop-filter: blur(10px);
    display: none;
}

.player-context-menu-item {
    padding: 12px 16px;
    color: var(--page-text, #d4af37);
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    transition: background-color 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-context-menu-item:last-child {
    border-bottom: none;
}

.player-context-menu-item:hover {
    background: var(--accent-color, #d4af37);
    color: var(--modal-background, #1a1a1a);
}

.player-context-menu-item .menu-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* Стили для модальных окон вызовов */
.invite-opponent-info, .invite-message {
    text-align: center;
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 8px;
    border: 1px solid var(--accent-color, #d4af37);
}

.opponent-details, .inviter-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.opponent-name, .inviter-name {
    font-size: 20px;
    font-weight: bold;
    color: var(--accent-color, #d4af37);
}

.opponent-rating, .inviter-rating {
    font-size: 16px;
    color: var(--page-text, #d4af37);
    opacity: 0.8;
}

.invite-actions, .invite-response-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.invite-actions button, .invite-response-actions button {
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 6px;
    border: 2px solid;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Lora', serif;
    min-width: 140px;
}

#inviteMessage {
    margin-bottom: 15px;
    font-size: 18px;
    color: var(--page-text, #d4af37);
}

/* Дополнительные стили для модального окна приглашений */
#gameInviteModal, #gameInviteReceiveModal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.8) !important;
    z-index: 10001 !important;
    display: none !important;
    justify-content: center !important;
    align-items: center !important;
    backdrop-filter: blur(5px);
}

#gameInviteModal.show, #gameInviteReceiveModal.show {
    display: flex !important;
}

/* Исправления для содержимого модального окна */
#gameInviteModal .modal-content, #gameInviteReceiveModal .modal-content {
    position: relative !important;
    margin: 0 !important;
    max-width: 500px !important;
    width: 90% !important;
    max-height: 80vh !important;
}
/* Альтернативный режим отображения - Трибуна */
#tribune-container {
    display: none;
    flex-direction: column;
    flex: 1;
    width: 100%;
    height: 100%;
    position: relative;
}

#tribune-container .chat-input-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    border-radius: 0;
    z-index: 1000;
}

#tribune-scene {
    position: relative;
    width: 100%;
    height: calc(100vh - 140px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

#tribune-scene-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 4 / 3;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    border: 2px solid rgba(212, 175, 55, 0.4);
    border-radius: 10px;
}

#tribune-scene-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 6, 4, 0.3);
    pointer-events: none;
    z-index: 1;
    border-radius: 10px;
}

.tribune-user {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
    z-index: 10;
}

.tribune-avatar {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    border: 2px solid rgba(212, 175, 55, 0.6);
    background: linear-gradient(145deg, rgba(20, 12, 8, 0.9) 0%, rgba(40, 25, 15, 0.9) 100%);
    padding: 5px;
    box-sizing: border-box;
    object-fit: cover;
    object-position: center;
    filter: drop-shadow(0 2px 4px rgba(212, 175, 55, 0.5));
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    display: block;
}

.tribune-username {
    color: #d4af37;
    font-size: 15px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
    background: rgba(20, 12, 8, 0.95);
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid rgba(212, 175, 55, 0.4);
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    line-height: 1.2;
}

.tribune-message {
    position: absolute;
    background: linear-gradient(145deg, rgba(20, 12, 8, 0.95) 0%, rgba(40, 25, 15, 0.95) 100%);
    border: 2px solid rgba(212, 175, 55, 0.5);
    border-radius: 8px;
    padding: 8px 12px;
    color: #e6e0d6;
    font-size: 13px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    max-width: 300px;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
    z-index: 10;
}

.tribune-message::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

.tribune-message.from-left::before {
    left: -10px;
    top: 10px;
    border-width: 10px 10px 10px 0;
    border-color: transparent rgba(212, 175, 55, 0.5) transparent transparent;
}

.tribune-message.from-right::before {
    right: -10px;
    top: 10px;
    border-width: 10px 0 10px 10px;
    border-color: transparent transparent transparent rgba(212, 175, 55, 0.5);
}

.tribune-message .message-author {
    color: #d4af37;
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 11px;
}

.tribune-message .message-text {
    color: #e6e0d6;
    line-height: 1.4;
}

.tribune-message .message-time {
    color: #b08c3b;
    font-size: 10px;
    margin-top: 4px;
    text-align: right;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    #tribune-scene {
        height: calc(100vh - 250px);
    }

    .tribune-message {
        max-width: 200px;
        font-size: 12px;
        padding: 6px 10px;
    }

    .tribune-username {
        font-size: 11px;
    }
}
