#alert-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 20000;
}

.alert-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.69);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    /* Делаем overlay flex-контейнером */
    display: flex;
    justify-content: center;
    align-items: center;
}

.alert-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.alert-box {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    max-width: 320px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.4;
    /* Убираем position и z-index — они не нужны внутри flex */
}

.alert-box.active {
    opacity: 1;
    transform: scale(1);
}

.alert-message {
    white-space: pre-line; /* сохраняет переносы \n, но не лишние пробелы */
}

.alert-button {
    margin-top: 40px;
    padding: 14px 60px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.alert-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 175, 240, 0.3);
}

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

.scroll-area {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
}

.group-list {
    flex-grow: 1;
    overflow-y: auto;
}

.news-list {
    flex: 1;
    overflow-y: auto;
}

.my-list {
    flex: 1;
    overflow-y: auto;
    border-top: 1px solid var(--border-color);
}

.games-list {
    flex: 1;
    overflow-y: auto;
}

.group-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.group-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.group-avatar {
    min-width: 52px;
    min-height: 52px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8A2BE2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    color: white;
    margin-right: 16px;
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.group-info {
    flex-grow: 1;
    min-width: 0;
}

.group-name {
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 16px;
}

.group-members {
    font-size: 14px;
    color: var(--text-secondary);
}

.group-unread-badge {
    flex-shrink: 0;
    background-color: var(--unread);
    color: white;
    font-size: 16px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px 18px;
    margin-left: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tabs {
    display: flex;
    gap: 8px;
    flex-grow: 1;
    justify-content: center;
}

.tab {
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.tab.active {
    color: var(--text-primary);
    background-color: var(--border-color);
}

.tab:hover:not(.active) {
    background-color: var(--tab-hover);
}

#popup-menu-container {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9000;
    user-select: none;
}

.popup-menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.69);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.popup-menu-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.popup-menu {
    position: absolute;
    top: 16px;
    right: 16px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    min-width: 220px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: auto;
    z-index: 9100;
    display: flex;
    flex-direction: column;
}

.popup-menu.active {
    opacity: 1;
    transform: translateY(0);
}

.popup-menu-item-inline {
    padding: 8px;
    color: var(--text-primary);
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 18px;
}

.popup-menu-item {
    display: flex;
    align-items: center;

    padding: 14px 28px;
    color: var(--text-primary);
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s ease;
    gap: 10px;
}

.popup-menu-item img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

.popup-menu-item:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

.popup-menu-item.danger {
    color: var(--danger);
}

.popup-menu-item.warning {
    color: #D29922; /* жёлто-оранжевый, как GitHub warning */
}

.popup-menu-item.success {
    color: var(--success);
}

.popup-menu-item.muted {
    color: var(--text-muted);
    font-size: 14px;
}

.popup-menu-item.disabled {
    color: var(--text-muted);
    pointer-events: none;
    opacity: 0.5;
}

.popup-menu-item.with-icon {
    display: flex;
    align-items: center;
    gap: 12px;
}

.popup-menu-item.with-icon svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.media-popup-menu {
    right: 16px;
    bottom: 72px; /* высота input-area + отступ */
    top: auto;
    left: auto;
}

.form-input-static {
    padding: 16px;
    background-color: var(--bg-input);
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 16px;
    display: flex;
    align-items: center;
}

.radio-group {
    display: flex;
    flex-direction: row;
    gap: 12px;
    margin-top: 8px;
}

.radio-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.radio-item input[type="radio"] {
    display: none; /* прячем оригинальный radio */
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    transition: all 0.2s ease;
}

.radio-item:hover .radio-custom {
    border-color: var(--primary);
}

.radio-item input[type="radio"]:checked + .radio-custom {
    border-color: var(--primary);
    background-color: var(--primary);
}

.radio-item input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: 8px;
    height: 8px;
    background-color: white;
    border-radius: 50%;
}

.radio-label-text {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
}

.image-viewer-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.image-viewer-bg.active {
    opacity: 1;
    pointer-events: auto;
}

.image-viewer-container {
    max-width: 90%;
    max-height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
    user-select: none;
}

.image-viewer-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.1s ease;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    -webkit-user-drag: none;
}

.image-viewer-img.scaled {
    cursor: grab;
}

.image-viewer-img.scaled:active {
    cursor: grabbing;
}

.image-viewer-down {
    position: fixed;
    bottom: 20px;               /* внизу */
    left: 40%;                  /* по центру по горизонтали */
    transform: translateX(-50%); /* точное центрирование */
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    transition: all 0.2s ease;
    user-select: none;
}

.image-viewer-close {
    position: fixed;
    bottom: 20px;               /* внизу */
    left: 60%;                  /* по центру по горизонтали */
    transform: translateX(-50%); /* точное центрирование */
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    transition: all 0.2s ease;
    user-select: none;
}

.image-viewer-close:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.9);
}

/* Видео-вьювер: фон */
.video-viewer-bg {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-dark-opacity);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) calc(80px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
    box-sizing: border-box;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.video-viewer-bg.active {
    opacity: 1;
    pointer-events: all;
}

/* Контейнер видео */
.video-viewer-video-container {
    position: relative;
    /*width: 90%;*/
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Само видео */
.video-viewer-video {
    max-width: 90%;
    max-height: 100%;
    height: auto;
    width: auto;
    object-fit: contain;
    border-radius: 8px;
    outline: none;
    background: var(--bg-dark);
}

/* Панель управления — ТОЛСТАЯ и тач-дружелюбная */
.video-viewer-controls {
    margin-top: 20px;
    width: 100%;
    max-width: 600px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 16px;
    height: 48px;
    min-height: 48px;
    background: var(--bg-input);
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.video-viewer-play-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    background: transparent;
    border: none;
    border-radius: 50%;
    padding: 0;
    opacity: 0.9;
    transition: opacity 0.2s, background 0.2s;
}

.video-viewer-play-btn:hover,
.video-viewer-play-btn:focus {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.video-viewer-play-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Таймлайн — высокий, с увеличенной зоной клика */
.video-viewer-timeline {
    flex: 1;
    height: 48px; /* зона клика — вся высота панели */
    position: relative;
    cursor: pointer;
}

/* Визуальный бар — внутри, тонкий, но красивый */
.video-viewer-timeline-bar {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    transform: translateY(-50%);
}

.video-viewer-timeline-fill {
    position: absolute;
    top: 50%;
    left: 0;
    height: 6px;
    background: var(--primary);
    border-radius: 3px;
    width: 0%;
    transform: translateY(-50%);
    transition: width 0.08s linear;
}

.video-viewer-duration {
    min-width: 52px;
    text-align: right;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: 'SF Mono', 'Consolas', monospace;
    letter-spacing: -0.5px;
}

/* Кнопка закрытия — внизу по центру (как просил) */
.video-viewer-close-btn {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    color: white;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    transition: all 0.2s ease;
    user-select: none;
    touch-action: manipulation;
}

.video-viewer-close-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.9);
}

.search-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    -webkit-appearance: none;
    text-align: center;
    padding: 20px 10px;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    text-align: center;
}

.empty-text {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-subtext {
    font-size: 14px;
    opacity: 0.7;
}

.message-type-sticker {
    background: none;
}

.join-group-button {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 48px);
    max-width: 400px;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 16px;
    box-shadow: 0 6px 16px rgba(0, 175, 240, 0.35);
    cursor: pointer;
    transition: all 0.25s ease;
    z-index: 100;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.join-group-button:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 175, 240, 0.45);
}

.join-group-button:active {
    transform: translateX(-50%) translateY(0);
    box-shadow: 0 4px 12px rgba(0, 175, 240, 0.3);
}

.join-group-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: translateX(-50%);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Стили для универсального динамического popup */
.dynamic-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.dynamic-popup-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.dynamic-popup {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.dynamic-popup.active {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.dynamic-popup-title {
    font-size: 20px;
    font-weight: 700;
    padding: 12px 24px;
    color: var(--text-primary);
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.dynamic-popup-description {
    padding: 12px 24px;
    color: var(--text-secondary);
    text-align: center;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
}

.dynamic-popup-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.dynamic-popup-buttons {
    display: flex;
    gap: 12px;
    padding: 16px 24px 24px;
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
}

.dynamic-popup-button {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.dynamic-popup-button.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.dynamic-popup-button.warning {
    background: linear-gradient(135deg, var(--danger), var(--danger-dark));
    color: white;
}

.dynamic-popup-button.cancel {
    background-color: var(--bg-input);
    color: var(--text-primary);
}

.dynamic-popup-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

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

/* Стили для списка пользователей */
.invite-users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.invite-user-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
}

.invite-user-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.user-checkbox {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    margin-right: 12px;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.user-checkbox:checked + .checkbox-custom {
    background-color: var(--primary);
    border-color: var(--primary);
}

.user-checkbox:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8A2BE2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    margin-right: 12px;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 16px;
}

.user-status {
    font-size: 12px;
    color: var(--text-secondary);
}

.loading-text, .error-text, .empty-text {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 16px;
}

.error-text {
    color: var(--danger);
}

.add-game-logo {
    max-width: 256px;
    max-height: 256px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.filler, .filler:hover {
    flex: 1;
    background: transparent;
    border-radius: 0;
    margin: 0;
    padding: 0;
    cursor: default;
    box-shadow: none;
}

