@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

/* --- ОБЩИЕ СТИЛИ --- */
:root {
    --bg-deep: #050505;       
    --bg-surface: #0f111a;   
    --bg-glass: rgba(15, 17, 26, 0.7); 
    --accent-primary: #00f3ff;
    --accent-glow: rgba(0, 243, 255, 0.4);
    --accent-dim: rgba(0, 243, 255, 0.1);
    --text-primary: #e0e6ed;
    --text-secondary: #94a3b8;
    --border-glass: 1px solid rgba(255, 255, 255, 0.08);
    --border-active: 1px solid var(--accent-primary);
    --shadow-glass: 0 16px 64px 0 rgba(0, 0, 0, 0.5);
    --bg-color: #0f0f0f;
    --bg-secondary-color: #222222;
    --text-color: #f1f1f1;
    --text-secondary-color: #aaaaaa;
    --border-color: #3f3f3f;
    --header-height: 112px;
}

body {
    margin: 0;
    font-family: 'Roboto', Arial, sans-serif;
    background-color: var(--bg-deep);
    background-image: radial-gradient(circle at 50% 0%, #1a2035 0%, var(--bg-deep) 70%);
    background-attachment: fixed;
    color: var(--text-primary);
    overflow-x: hidden;
}

input, textarea, select, button {
    font-family: inherit;
}


body.no-category-filters {
    --header-height: 56px;
}

/* --- ШАПКА САЙТА (HEADER) --- */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 300;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    padding: 0 16px;
    box-sizing: border-box; 
}

.main-header > .category-orbit {
    margin-left: -16px;
    margin-right: -16px;
    width: calc(100% + 32px);
    max-width: none;
}

/* --- ВЕРХНЯЯ ЧАСТЬ ШАПКИ --- */
.header-top {
    height: 56px;
    display: flex;
    align-items: center;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}
.logo { 
    display: flex; 
    align-items: center;
    gap: 8px; 
    color: var(--text-color); 
    text-decoration: none; 
    font-size: 20px; 
    font-weight: 500; 
}
.logo-icon { 
    height: 28px; 
    filter: brightness(0) invert(1); 
}

.icon-button { 
    background: none; 
    border: none; 
    cursor: pointer; 
    padding: 8px; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}
.icon-img { 
    height: 24px; 
    filter: brightness(0) invert(1); 
}
.menu-button { 
    margin-right: 16px; 
}

/* --- БЛОК ПОИСКА --- */
.header-center {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 0;
    padding: 0 40px;
}
.search-container { 
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%; 
    max-width: 640px; 
}
.search-input-wrapper { 
    position: relative; 
    width: 100%; 
    display: flex; 
}
.search-input-wrapper input {
    width: 100%;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 40px;
    padding: 0 12px 0 16px;
    color: var(--text-color);
    font-size: 16px;
    box-sizing: border-box;
}
.search-input-wrapper input:focus { 
    border-color: #3ea6ff;
    outline: none;
 }

.clear-search-btn {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    min-width: 28px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #f1f1f1;
    font-size: 18px;
    font-weight: 200;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    align-self: center;
    flex-shrink: 0;
    z-index: 2;
    opacity: 0.85;
}
.clear-search-btn:not([hidden]) {
    display: inline-flex;
}
.clear-search-btn:hover {
    color: #fff;
    background: transparent;
    opacity: 1;
}

.search-button {
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    border: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.voice-search-button {
    background-color: rgba(255, 255, 255, 0.1);
    margin-left: 2px;
    border-radius: 50%;
    height: 40px;
    width: 40px;
    min-width: 40px;
    border: 1px solid var(--border-color);
    padding: 0;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    vertical-align: middle;
}

/* --- ПРАВАЯ ЧАСТЬ ШАПКИ --- */
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    margin-left: auto;
}
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
}

.user-avatar.guest-icon {
    filter: brightness(0) invert(1);
}

/* Placeholder when avatar image is missing or failed to load */
.avatar-placeholder,
span.user-avatar.avatar-placeholder,
span.user-avatar-large.avatar-placeholder,
span.notif-avatar.avatar-placeholder,
span.avatar-small.avatar-placeholder,
span.avatar-large.avatar-placeholder,
span.channel-avatar-small.avatar-placeholder {
    display: inline-block;
    border-radius: 50%;
    background: #bdbdbd;
    flex-shrink: 0;
    box-sizing: border-box;
}

.user-avatar.avatar-placeholder { width: 32px; height: 32px; min-width: 32px; min-height: 32px; }
.user-avatar-large.avatar-placeholder { width: 48px; height: 48px; min-width: 48px; min-height: 48px; }
.notif-avatar.avatar-placeholder { width: 40px; height: 40px; min-width: 40px; min-height: 40px; }
.avatar-small.avatar-placeholder { width: 36px; height: 36px; min-width: 36px; min-height: 36px; }
.avatar-large.avatar-placeholder { width: 130px; height: 130px; min-width: 130px; min-height: 130px; }
.channel-avatar-small.avatar-placeholder { width: 28px; height: 28px; min-width: 28px; min-height: 28px; }

/* --- ФИЛЬТРЫ КАТЕГОРИЙ В ШАПКЕ --- */
.category-filters-scroll {
    position: relative;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    height: 56px;
}
.category-filters-scroll-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-color);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, opacity 0.2s;
}
.category-filters-scroll-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.18);
}
.category-filters-scroll-btn:disabled {
    opacity: 0.35;
    cursor: default;
}
.category-filters {
    position: relative;
    flex: 1;
    min-width: 0;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
    padding: 0 2px 4px;
    mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
}
.category-filters::-webkit-scrollbar {
    height: 6px;
}
.category-filters::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.35);
    border-radius: 6px;
}
.category-filters::-webkit-scrollbar-track {
    background: transparent;
}
.filter-item {
    flex-shrink: 0;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s;
}
.filter-item:hover { background-color: rgba(255, 255, 255, 0.2); }
.filter-item.active { background-color: var(--text-color); color: var(--bg-color); }

/* --- ОСНОВНАЯ РАЗМЕТКА СТРАНИЦЫ --- */
.page-container {
    margin-top: var(--header-height);
    display: flex;
    align-items: flex-start;
}

/* --- БОКОВОЕ МЕНЮ  --- */
.sidebar { 
    width: 240px; 
    height: calc(100vh - var(--header-height)); 
    height: calc(100dvh - var(--header-height));
    position: sticky; 
    top: var(--header-height);
    flex-shrink: 0;
    align-self: flex-start;
    background-color: var(--bg-color); 
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px; 
    box-sizing: border-box;
    transition: width 0.2s ease-in-out;
    border-radius: 0;
    margin-top: 0;
}

.sidebar-item { 
    display: flex; 
    align-items: center;
    gap: 14px; 
    padding: 0 12px;
    height: 40px; 
    border-radius: 10px; 
    color: var(--text-color); 
    text-decoration: none; 
    font-size: 14px;
    overflow: hidden;
    white-space: nowrap; 
    transition: background-color 0.2s ease-in-out; 
}

.sidebar-item:hover { 
    background-color: var(--bg-secondary-color); 
}

.sidebar-item.active { 
    background-color: var(--bg-secondary-color); 
    font-weight: 500; 
}

.sidebar-item .icon-img {
    width: 24px;
    filter: brightness(0) invert(1);
}

.sidebar-divider {
    border: none;
    height: 1px;
    background-color: var(--border-color);
    margin: 6px 0;
}

.sidebar-section {
    margin: 0;
    padding: 0;
}

.login-prompt {
    padding: 16px 12px;
}
.login-prompt p {
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 12px;
}

.login-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    background-color: var(--text-color);
    border-radius: 40px;
    padding: 6px 12px;
    color: var(--bg-color); 
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.login-button:hover { 
    background-color: #d9d9d9;
}

.login-button .icon-img { 
    filter: brightness(0); 
}

.sidebar-heading {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
    padding: 4px 12px 2px;
    margin: 6px 0 2px;
}


.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color); 
    margin-top: 10px;
    background-color: var(--bg-color);
}

.footer-links {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 12px;
}

.sidebar-footer a {
    font-size: 13px;
    font-weight: 600;
    color: #9a9a9a;
    text-decoration: none;
    line-height: 1.6;
    transition: color 0.2s;
}

.sidebar-footer a:hover,
.sidebar-footer a:focus-visible {
    color: #e8e8e8;
    text-decoration: none;
}

.copyright {
    font-size: 12px;
    color: #808080;
    margin: 0;
    padding: 0;
    line-height: 1.4;
    display: block;
}

.sidebar::-webkit-scrollbar {
    width: 8px;
  }

  .sidebar::-webkit-scrollbar-track {
    background: transparent;
  }

  .sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
  }

  .sidebar:hover::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.4);
  }

  .sidebar {
    scrollbar-width: thin;
    scrollbar-color: var(--text-secondary-color) transparent;
  }

/* --- ОСНОВНОЙ КОНТЕНТ --- */
.main-content { 
    width: 100%; 
    padding: 24px;
    box-sizing: border-box; 
    overflow-y: auto;
    height: calc(100vh - var(--header-height));
}
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

/* Home: 3 columns by default (same as category / dark layout) */
body.page-home #home-feed-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px 16px;
}

@media (max-width: 768px) {
    body.page-home #home-feed-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    body.page-home #home-feed-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Главная: единая карточка (видео и плейлист) — превью без «рамки», текст снизу */
body.page-home #home-feed-grid > .video-card {
    padding: 0;
    overflow: hidden;
}

body.page-home #home-feed-grid > .video-card .thumbnail-wrapper {
    position: relative;
    overflow: hidden;
    margin: 0;
    aspect-ratio: 16 / 9;
    background: #272727;
}

body.page-home #home-feed-grid > .video-card .thumbnail-wrapper .thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

body.page-home #home-feed-grid > .video-card .thumbnail {
    margin-bottom: 0;
    display: block;
    width: 100%;
    border-radius: 0;
}

body.page-home #home-feed-grid > .video-card .video-details-bottom {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 0;
    padding: 10px 8px 10px 10px;
    padding-right: 8px;
}

body.page-home #home-feed-grid > .video-card .video-text {
    flex: 1;
    min-width: 0;
}

body.page-home #home-feed-grid > .video-card .context-menu-container {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    flex-shrink: 0;
    align-self: center;
    margin: 0;
    z-index: 2;
}

body.page-home #home-feed-grid > .video-card .context-menu-dropdown.active:not(.is-viewport-positioned) {
    z-index: 45;
}

body.page-home #home-feed-grid > .video-card.context-menu-open {
    overflow: visible;
    position: relative;
    z-index: 120;
}

body.page-home #home-feed-grid > .video-card.context-menu-open .video-details-bottom {
    position: relative;
    z-index: 2;
}

body.page-home #home-feed-grid > .video-card .video-title-link {
    display: block;
    color: inherit;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.page-home #home-feed-grid > .video-card .video-title {
    margin: 0 0 4px;
}

.video-card { 
    cursor: pointer;
    background-color: #181818; 
    border-radius: 8px;    
    padding: 10px;         
    transition: background-color 0.2s;
 }
 .video-card:hover {
    background-color: var(--bg-secondary-color); 
}

.video-card .channel-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover; 
}

.video-card:hover .video-title {
    color: #ffffff;
    transition: color 0.15s ease-in-out;
}

.video-card .video-meta {
    font-size: 14px;
    color: var(--text-secondary-color);
    margin: 4px 0 0 0;
    display: flex;
    gap: 4px;
    min-width: 0;
    align-items: center;
}

/*
 * Стили для карточки-ссылки на главной странице
 */

 .video-card > a {
    text-decoration: none; 
    color: inherit;      
}

.video-card > a:hover .thumbnail {
    transform: scale(1.05); 
    opacity: 0.9;
}

.thumbnail { width: 100%; border-radius: 12px; aspect-ratio: 16 / 9; object-fit: cover; margin-bottom: 12px;transition: transform 0.3s ease-in-out; }
.video-details { display: flex; gap: 12px; }
.video-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}
.video-title {
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 4px;
    color: var(--text-color);
    line-height: 1.35;
    display: block;
    width: 100%;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.channel-name, .video-meta { font-size: 14px; color: var(--text-secondary-color); margin: 0; }

.video-card .video-meta .views-count,
.video-card .video-meta .publish-time {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- 1. ЛОГИКА ПЕРЕКЛЮЧЕНИЯ КОНТЕНТА (ИСПРАВЛЕНИЕ) --- */

.content-page {
    display: none;
}

.content-page.active {
    display: block;
}

.content-page.active.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.content-page.active.empty-page-placeholder {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - var(--header-height) - 48px);
    text-align: center;
}

.empty-page-placeholder img {
    width: 120px;
    height: 120px;
    margin-bottom: 24px;
    opacity: 0.3;
    filter: invert(1);
}
.empty-page-placeholder h2 {
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-color);
}
.empty-page-placeholder p {
    font-size: 16px;
    color: var(--text-secondary-color);
}


/* --- 2. ЛОГИКА СВЕРНУТОГО САЙДБАРА  --- */

.sidebar-mini {
    display: none;
}
.sidebar-full {
    display: block;
}

.page-container.sidebar-collapsed .sidebar {
    grid-template-columns: auto 1fr;
    width: 72px;
    padding: 4px;
}
.page-container.sidebar-collapsed .sidebar-full {
    display: none; 
}
.page-container.sidebar-collapsed .sidebar-mini {
    display: block; 
}

.page-container.sidebar-collapsed .sidebar-item {
    flex-direction: column;
    justify-content: center;
    height: 74px;
    gap: 6px;
    padding: 0;
}
.page-container.sidebar-collapsed .sidebar-item span {
    font-size: 10px;
}

.page-container.sidebar-collapsed .sidebar-divider,
.page-container.sidebar-collapsed .login-prompt,
.page-container.sidebar-collapsed .sidebar-heading,
.page-container.sidebar-collapsed .sidebar-footer,
.page-container.sidebar-collapsed .copyright {
    display: none; 
}

#search-suggestions-container {
    --header-suggestion-row: 52px;
    display: none;
    position: absolute;
    top: 110%; 
    left: 0;
    width: 100%;
    max-width: none;
    background-color: #282828;
    border: 1px solid #3f3f3f;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    z-index: 1001;
    padding: 8px 0;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: min(calc(var(--header-suggestion-row) * 8), 50vh, 420px);
}


.suggestion-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    color: #f1f1f1;
    text-decoration: none;
    cursor: pointer;
}

.suggestion-item:hover {
    background-color: #3f3f3f;
}

.suggestion-icon {
    width: 20px;
    height: 20px;
    filter: invert(1);
    opacity: 0.7;
    flex-shrink: 0;
}

.suggestion-text {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.suggestion-thumbnail {
    width: 80px;
    height: 45px;
    border-radius: 4px;
    object-fit: cover;
    margin-left: auto;
    flex-shrink: 0;
}

.suggestion-thumbnail-channel {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.suggestion-report-link {
    display: block;
    text-align: right;
    font-size: 12px;
    color: #aaa;
    padding: 8px 16px 0;
    text-decoration: none;
}
.suggestion-report-link:hover {
    color: #fff;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.modal-overlay.visible {
    display: flex;
    opacity: 1;
}

.modal-content.improved-modal {
    background-color: #282828;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 32px;
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    text-align: center;
    transform: scale(0.95);
    transition: transform 0.2s ease-in-out;
}

.modal-overlay.visible .modal-content.improved-modal {
    transform: scale(1);
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #3e3e3e;
    border: none;
    color: #aaa;
    font-size: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s, color 0.2s;
}

.modal-close-btn:hover {
    background-color: #555;
    color: #fff;
}

.improved-modal h2 {
    font-size: 24px;
    margin-top: 0;
    margin-bottom: 8px;
}

.improved-modal p {
    color: #aaa;
    margin-bottom: 24px;
    font-size: 15px;
    line-height: 1.5;
}

/* --- Горячие клавиши (широкая плашка, как на YouTube) --- */
#hotkeys-modal .hotkeys-modal-content.improved-modal.hotkeys-modal-content {
    text-align: left;
    width: min(1120px, calc(100vw - 40px));
    max-width: none;
    max-height: min(88vh, 860px);
    min-height: 440px;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    /* Подключаем стилистику сайта */
    background-color: var(--bg-surface, #0f111a);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

#hotkeys-modal .hotkeys-modal-content .modal-close-btn {
    top: 14px;
    right: 14px;
    z-index: 6;
}

.hotkeys-modal-head {
    padding: 20px 56px 14px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.hotkeys-modal-head h2 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 700;
}

.hotkeys-modal-sub {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.55);
}

.hotkeys-list {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.hotkeys-yt {
    display: flex;
    flex: 1;
    min-height: 0;
}

.hotkeys-yt-nav {
    width: 240px;
    flex-shrink: 0;
    padding: 16px 12px;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.2); /* Чуть темнее основного фона */
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.hotkeys-tab-yt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px; /* Очень мягкие края */
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.55);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hotkeys-tab-yt:hover {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.9);
}

.hotkeys-tab-yt.active {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-weight: 600;
    box-shadow: none; /* Убрали синюю обводку! */
}

.hotkeys-tab-yt .hotkeys-tab-label {
    flex: 1;
    min-width: 0;
}

.hotkeys-tab-count {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08); /* Светлее, чтобы не сливалась с черным фоном */
    color: rgba(255, 255, 255, 0.7);
}

.hotkeys-tab-yt.active .hotkeys-tab-count {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.hotkeys-yt-content {
    flex: 1;
    min-width: 0;
    padding: 16px 20px 22px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.hotkeys-yt-content::-webkit-scrollbar {
    width: 8px;
}

.hotkeys-yt-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
}

.hotkeys-chapter {
    margin-bottom: 22px;
}

.hotkeys-chapter:last-child {
    margin-bottom: 0;
}

.hotkeys-chapter-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.hotkeys-playback-hint {
    font-size: 12px;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.45);
    margin: -4px 0 12px;
}

.hotkeys-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 28px;
}

.hotkeys-empty {
    color: #aaa;
    font-size: 14px;
    padding: 20px 8px;
}

.hotkey-row {
    display: flex;
    align-items: center;
    gap: 10px 14px;
    padding: 9px 12px;
    border-radius: 10px;
    background-color: transparent;
    border: none;
    transition: background-color 0.15s ease;
}

/* Легкое выделение при наведении вместо постоянных рамок */
.hotkey-row:hover {
    background-color: rgba(255, 255, 255, 0.05);
}


.hotkey-keys {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 108px;
    width: 108px;
    max-width: 108px;
    gap: 4px;
    flex-wrap: nowrap;
}

.hotkey-kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    /* Делаем клавиши плоскими, полупрозрачными и легкими (эффект стекла) */
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); /* Мягенькая тень вместо жестких рамок */
    letter-spacing: 0.5px;
}

.hotkey-plus {
    color: rgba(255, 255, 255, 0.35);
    font-size: 12px;
    line-height: 1;
    padding: 0 1px;
    flex-shrink: 0;
}

.hotkey-desc {
    flex: 1 1 auto;
    min-width: 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    line-height: 1.35;
    text-align: left;
}

@media (max-width: 900px) {
    .hotkeys-yt {
        flex-direction: column;
    }

    .hotkeys-yt-nav {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding: 10px;
    }

    .hotkeys-tab-yt {
        flex: 1 1 calc(50% - 6px);
        min-width: 140px;
    }

    .hotkeys-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    #hotkeys-modal .hotkeys-modal-content.improved-modal.hotkeys-modal-content {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
        min-height: 0;
        max-height: min(72vh, 72dvh);
        border-radius: 18px;
    }

    .hotkeys-modal-head {
        padding: 16px 44px 10px 16px;
    }

    .hotkeys-modal-head h2 {
        font-size: 20px;
        line-height: 1.2;
    }

    .hotkeys-modal-sub {
        font-size: 13px;
        line-height: 1.4;
    }

    .hotkeys-yt-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 6px;
        padding: 8px 10px;
        -webkit-overflow-scrolling: touch;
    }

    .hotkeys-tab-yt {
        min-width: max-content;
        flex: 0 0 auto;
        padding: 8px 12px;
        font-size: 13px;
    }

    .hotkeys-tab-count {
        min-width: 22px;
        height: 22px;
        font-size: 11px;
    }

    .hotkeys-yt-content {
        padding: 8px 12px 14px;
    }

    .hotkeys-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .hotkey-row {
        display: flex !important;
        align-items: center !important;
        gap: 8px 10px !important;
        padding: 9px 11px !important;
        border-radius: 12px;
        background-color: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.06);
    }

    .hotkey-keys {
        flex: 0 0 92px !important;
        width: 92px !important;
        max-width: 92px !important;
        justify-content: flex-end !important;
        gap: 3px !important;
    }

    .hotkey-desc {
        flex: 1 1 auto !important;
        font-size: 13px;
        line-height: 1.32;
    }

    .hotkey-kbd {
        font-size: 11px;
        padding: 4px 7px;
        white-space: nowrap;
    }

    .hotkeys-chapter-title {
        font-size: 11px;
        letter-spacing: 0.06em;
        margin-bottom: 8px;
    }
}

body.light-theme .hotkeys-modal-sub {
    color: rgba(0, 0, 0, 0.6);
}

body.light-theme .hotkeys-chapter-title {
    color: rgba(0, 0, 0, 0.5);
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .hotkeys-playback-hint {
    color: rgba(0, 0, 0, 0.5);
}

body.light-theme .hotkeys-tab-yt {
    color: rgba(0, 0, 0, 0.7);
}

body.light-theme .hotkeys-tab-yt:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #000;
}

body.light-theme .hotkeys-tab-yt.active {
    background: rgba(0, 0, 0, 0.08); /* Просто приятная серая заливка */
    color: #000;
    box-shadow: none;
}

body.light-theme .hotkeys-tab-count {
    background: rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.6);
}

body.light-theme .hotkeys-tab-yt.active .hotkeys-tab-count {
    background: rgba(0, 0, 0, 0.15);
    color: #000;
}

body.light-theme .hotkey-row:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

body.light-theme .hotkey-desc {
    color: #333;
}

body.light-theme .hotkey-plus {
    color: rgba(0, 0, 0, 0.3);
}

/* Кнопки в светлой теме */
body.light-theme .hotkey-kbd {
    background-color: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: #222;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); /* Убрали жирную рамку снизу */
}

body.light-theme .hotkeys-yt-nav {
    background: rgba(0, 0, 0, 0.02);
    border-right: 1px solid rgba(0, 0, 0, 0.08);
}

.avatar-upload-container {
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
}

.avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background-color: #3e3e3e;
    border: 3px dashed #555;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    transition: border-color 0.2s, background-color 0.2s;
}

.avatar-preview:hover {
    border-color: #3ea6ff;
    background-color: #4a4a4a;
}

.avatar-edit-icon {
    width: 40px;
    height: 40px;
    filter: invert(70%);
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.2s;
}

.avatar-preview:hover .avatar-edit-icon {
    opacity: 1;
    transform: scale(1.1);
}

.improved-modal .form-group {
    text-align: left;
    margin-bottom: 20px;
}

.improved-modal .form-group label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #ccc;
    display: block;
}

.improved-modal input[type="text"] {
    width: 100%;
    padding: 14px;
    background-color: #1e1e1e;
    border: 1px solid #555;
    border-radius: 16px;
    color: #fff;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.improved-modal input[type="text"]:focus {
    outline: none;
    border-color: #3ea6ff;
}

.modal-submit-btn {
    width: 100%;
    padding: 14px;
    background-color: #3ea6ff;
    border: none;
    border-radius: 16px;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
}

.modal-submit-btn:hover {
    background-color: #62b9ff;
}

.modal-content .error-message {
    color: #ff8a80;
    margin-bottom: 15px;
    text-align: center;
    background-color: rgba(255, 138, 128, 0.1);
    padding: 10px;
    border-radius: 6px;
    display: none;
}

/* --- СТИЛИ ДЛЯ ОТОБРАЖЕНИЯ ДЛИТЕЛЬНОСТИ ВИДЕО --- */

.thumbnail-wrapper {
    position: relative;
    display: block;
}

.thumbnail-duration {
    position: absolute;   
    bottom: 8px;       
    right: 8px;        
    background-color: rgba(0, 0, 0, 0.5); 
    color: #fff;          
    padding: 2px 6px;    
    border-radius: 4px;   
    font-size: 12px;     
    font-weight: 500;
    
}


.playlist-shelf {
    margin-bottom: 40px;
}

.shelf-title {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 16px;
}

.playlist-card {
    background-color: #181818;
    border-radius: 8px;
    padding: 10px;
}

.playlist-thumbnail-stack {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background-color: #000;
}

.playlist-thumbnail-item {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease-in-out;
}

.playlist-card:hover .playlist-thumbnail-item:nth-child(1) { transform: rotate(-3deg) scale(1.05); }
.playlist-card:hover .playlist-thumbnail-item:nth-child(2) { transform: rotate(1deg) scale(1.02); }
.playlist-card:hover .playlist-thumbnail-item:nth-child(3) { transform: rotate(4deg) scale(1.05); }

.playlist-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 8px;
    box-sizing: border-box;
    color: #fff;
    font-weight: 500;
    font-size: 14px;
}

.playlist-details {
    padding-top: 12px;
}

.playlist-title {
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 4px;
    color: var(--text-color);
}


/* ===================================================================
 *   СТИЛИЗАЦИЯ СКРОЛЛБАРОВ 
 * ===================================================================
 */

/* 
 * Стили для Chrome, Edge, Safari, Opera 
 */

*::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    border: 3px solid transparent;
    background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.6);
}
  
/* 
 * Стили для Firefox 
 */
body {
    scrollbar-width: thin; 
    scrollbar-color: rgba(255, 255, 255, 0.4) transparent; 
}

.playlist-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.playlist-card {
    background-color: transparent;
    border-radius: 12px;
    overflow: hidden; 
    border: none;
    box-shadow: none;
    transition: none;
}

.playlist-card:hover {
    transform: none;
    background-color: transparent;
    border-color: transparent;
    box-shadow: none;
}

.playlist-thumbnail-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #000;
    margin-bottom: 12px;
    border-radius: 12px; 
    overflow: hidden;  
}

.playlist-thumbnail-container > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.38s ease, filter 0.38s ease;
}

.playlist-card:hover .playlist-thumbnail-container > img {
    transform: scale(1.05);
    filter: saturate(1.08);
}

.playlist-overlay-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 8px 12px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
}

.playlist-overlay-bottom img {
    width: 20px;
    height: 20px;
    filter: invert(1);
}

.playlist-overlay-hover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
    opacity: 0;
    transition: opacity 0.24s ease;
    pointer-events: none;
}

.playlist-card:hover .playlist-overlay-hover,
.video-card.playlist-item:hover .playlist-overlay-hover,
.video-card.playlist-item .video-card-link:hover .playlist-overlay-hover {
    opacity: 1;
}

body.page-home #home-feed-grid .playlist-item .playlist-overlay-bottom {
    border-radius: 0;
}

.playlist-overlay-hover img {
    width: 24px;
    height: 24px;
    filter: invert(1);
}

.playlist-details-main {
    display: flex;
    gap: 12px;
    padding: 0 12px 12px;
    align-items: center;
}

.playlist-channel-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.playlist-text-info {
    min-width: 0;
}

.playlist-title-main {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--text-color);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-item .playlist-card-link:focus-visible .playlist-card {
    outline: 2px solid rgba(62, 166, 255, 0.45);
    outline-offset: 2px;
}

.playlist-meta-main {
    font-size: 14px;
    color: var(--text-secondary-color);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

 .header-right {
    position: relative; 
}

.user-menu-trigger-btn {
    background: none;
    border: none;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.user-menu-trigger-btn:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

.user-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px); 
    right: 0;
    width: 286px;
    max-height: min(78vh, 720px);
    background-color: #282828;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    z-index: 1150;
    overflow: hidden;
    transform: scale(var(--overlay-ui-scale, 1));
    transform-origin: top right;
}

.user-menu-dropdown.active {
    display: block;
}

.user-menu-main-panel, .user-submenu {
    transition: transform 0.2s ease-in-out;
    max-height: min(78vh, 720px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.user-menu-main-panel::-webkit-scrollbar,
.user-submenu::-webkit-scrollbar {
    width: 8px;
}

.user-menu-main-panel::-webkit-scrollbar-thumb,
.user-submenu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
}

.user-menu-main-panel::-webkit-scrollbar-track,
.user-submenu::-webkit-scrollbar-track {
    background: transparent;
}

.user-menu-dropdown.show-theme-submenu .user-menu-main-panel,
.user-menu-dropdown.show-language-submenu .user-menu-main-panel {
    transform: translateX(-100%);
}

.user-menu-dropdown [data-submenu="theme"],
.user-menu-dropdown [data-submenu="language"] {
    pointer-events: none;
}

.user-menu-dropdown.show-theme-submenu [data-submenu="theme"],
.user-menu-dropdown.show-language-submenu [data-submenu="language"] {
    transform: translateX(0);
    pointer-events: auto;
}

.user-menu-dropdown.show-theme-submenu [data-submenu="theme"],
.user-menu-dropdown.show-language-submenu [data-submenu="language"] {
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.user-menu-dropdown.show-theme-submenu [data-submenu="theme"]::-webkit-scrollbar,
.user-menu-dropdown.show-language-submenu [data-submenu="language"]::-webkit-scrollbar {
    display: none;
}


.user-menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 14px 12px;
}

.user-avatar-large {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.user-info-text { min-width: 0; }
.user-name {
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-handle {
    font-size: 13px;
    color: var(--text-secondary-color);
}

.user-menu-channel-link {
    display: block;
    padding: 0 14px 10px;
    color: #3ea6ff;
    font-size: 13px;
    text-decoration: none;
}


.user-menu-divider {
    border: none;
    height: 1px;
    background-color: var(--border-color);
    margin: 6px 0;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.12s ease;
}
.user-menu-item:hover {
    background-color: var(--bg-secondary-color);
}

.user-menu-icon {
    width: 20px;
    height: 20px;
    filter: invert(1);
    opacity: 0.9;
}

.arrow-right {
    margin-left: auto;
    font-size: 16px;
    color: var(--text-secondary-color);
}

.user-menu-item-form {
    margin: 0;
    padding: 0;
}
.user-menu-item.as-button {
    background: none;
    border: none;
    width: 100%;
    font-family: inherit;
    text-align: left;
}
/* .as-button идёт после :hover и с той же специфичностью перебивает background — задаём hover отдельно */
.user-menu-item.as-button:hover,
.user-menu-item.as-button:focus-visible {
    background-color: var(--bg-secondary-color);
}

.user-submenu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #282828;
    transform: translateX(100%);
}

.user-submenu-header {
    display: flex;
    align-items: center;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
}
.user-submenu-back-btn {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.user-submenu-back-btn img {
    width: 20px;
    height: 20px;
    filter: invert(1);
}
.user-submenu-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
}
.user-submenu .user-menu-item .checkmark {
    width: 12px;
    height: 12px;
    filter: invert(1);
    visibility: hidden; 
}
.user-submenu .user-menu-item.active .checkmark {
    visibility: visible; 
}
.user-submenu .user-menu-item span {
    flex-grow: 1;
}
.user-menu-item .user-menu-icon[src="/images/logout.png"] {
    width: 21px;
    height: 21px;
}

.login-button-header {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 6px;
    border: 1px solid var(--border-color);
    border-radius: 40px;
    color: #3ea6ff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}
.login-button-header:hover {
    background-color: rgba(62, 166, 255, 0.1);
}
.login-button-header .guest-icon {
    width: 24px;
    height: 24px;
    filter: none;
}

/* Base light tokens — extended in theme-light.css */
body.light-theme {
    --bg-color: #ffffff;
    --bg-secondary-color: #f2f2f2;
    --text-color: #030303;
    --text-secondary-color: #606060;
    --border-color: #e5e5e5;
}

body.light-theme .icon-img,
body.light-theme .user-menu-icon,
body.light-theme .user-submenu-back-btn img,
body.light-theme .user-submenu .user-menu-item .checkmark {
    filter: none;
}
body.light-theme .logo-icon,
body.light-theme .guest-icon {
    filter: none;
}
body.light-theme .user-menu-dropdown,
body.light-theme .user-submenu {
    background-color: #ffffff;
    border-color: #ccc;
}
body.light-theme .user-menu-item:hover {
    background-color: #f2f2f2;
}
body.light-theme .user-menu-item.as-button:hover,
body.light-theme .user-menu-item.as-button:focus-visible {
    background-color: #f2f2f2;
}

/* ===================================================================
 *  ДОПОЛНЕНИЕ: Стили для формы выхода в меню
 * ===================================================================
 */

 .user-menu-item-form {
    display: block;
    margin: 0;
    padding: 0;
}

.user-menu-item-form:hover {
    background-color: var(--bg-secondary-color);
}

body.light-theme .user-menu-item-form:hover {
    background-color: #f2f2f2;
}

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

.guest-menu-container {
    position: relative;
}

.login-button-header .guest-icon {
    width: 24px;
    height: 24px;
    filter: invert(1); 
}

body.light-theme .login-button-header .guest-icon {
    filter: none;
}

.guest-menu-trigger {
    margin-right: -8px;
}
/* ===================================================================
 *  БЛОК 7: СТИЛИ ДЛЯ КОЛОКОЛЬЧИКА И УВЕДОМЛЕНИЙ
 * ===================================================================
 */
.notification-container,
.notification-wrapper {
    position: relative;
    margin-right: 1px;
}

#notification-btn {
    position: relative;
    width: 40px;
    height: 40px;
    padding: 8px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
#notification-btn:hover { background-color: rgba(255, 255, 255, 0.1); }

/* --- БЕЙДЖ --- */
.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: #cc0000;
    color: #ffffff;
    font-size: 10px;
    font-family: Arial, sans-serif;
    font-weight: 700;
    height: 18px;
    min-width: 18px; 
    padding: 0 4px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    border: 2px solid #0f0f0f; 
    pointer-events: none;
}

.notification-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    width: 360px;
    max-height: min(520px, calc(100vh - 72px));
    background-color: #282828;
    border-radius: 12px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1100;
    flex-direction: column;
    overflow: hidden;
}
.notification-dropdown.active { display: flex; }

.notification-header {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #212121;
}
.notification-header h3 { margin: 0; font-size: 16px; color: #fff; font-weight: 500; }

.notif-actions { display: flex; gap: 8px; }

.notif-action-btn {
    background: none; border: none; cursor: pointer; padding: 6px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.notif-action-btn:hover { background-color: rgba(255, 255, 255, 0.1); }
.notif-action-btn img { width: 20px; height: 20px; filter: invert(0.8); }
.notif-action-btn:hover img { filter: invert(1); }

.notification-list {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}
.notification-list::-webkit-scrollbar {
    width: 8px;
}
.notification-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}
.notification-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.notification-item-container {
    display: flex; gap: 14px; padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: relative; cursor: pointer; transition: background 0.2s;
}
.notification-item-container:hover { background-color: rgba(255, 255, 255, 0.05); }

.notification-item-container.unread { background-color: rgba(62, 166, 255, 0.08); }
.notification-item-container.unread::after {
    content: ''; width: 6px; height: 6px; background-color: #3ea6ff;
    border-radius: 50%; position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
}

.notif-avatar-link { flex-shrink: 0; z-index: 2; border-radius: 50%; }
.notif-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }

.notif-content { flex: 1; font-size: 14px; line-height: 1.4; color: #f1f1f1; padding-right: 15px; }

.notif-user-link { color: #fff; font-weight: 600; text-decoration: none; position: relative; z-index: 2; }
.notif-user-link:hover { text-decoration: none; color: #7ecbff; }

.notif-comment-preview {
    color: #aaa; font-size: 13px; margin-top: 4px;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; text-overflow: ellipsis;
}
.notif-time { display: block; font-size: 12px; color: #777; margin-top: 4px; }
.notification-empty { padding: 40px 0; text-align: center; color: #aaa; }

/* --- Toast фоновой загрузки видео --- */
.video-upload-toast {
    position: fixed;
    right: 16px;
    bottom: 18px;
    width: min(360px, calc(100vw - 24px));
    background: rgba(20, 20, 20, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    padding: 12px;
    z-index: 1600;
    transform: translateY(16px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}
.video-upload-toast.visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}
.video-upload-toast-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}
.video-upload-toast-file {
    font-size: 12px;
    color: #bdbdbd;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.video-upload-toast-progress-wrap {
    width: 100%;
    height: 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    overflow: hidden;
}
.video-upload-toast-progress {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #2f7df8, #6fa8ff);
    transition: width .2s ease;
}
.video-upload-toast-meta {
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
}
.video-upload-toast-actions {
    margin-top: 9px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.video-upload-toast-actions button {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: #f1f1f1;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
}
.video-upload-toast.is-done .video-upload-toast-progress {
    background: linear-gradient(90deg, #2fb45a, #57d683);
}
.video-upload-toast.is-error .video-upload-toast-progress {
    background: linear-gradient(90deg, #d83a3a, #ff6b6b);
}
/* Light-theme upload toast: see theme-modals-light.css */

/* --- Upload queue toast v2 --- */
.video-upload-toast {
    width: min(390px, calc(100vw - 24px));
}
.video-upload-toast-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: move;
}
.video-upload-toast-head-actions button {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: inherit;
    border-radius: 7px;
    width: 28px;
    height: 24px;
    line-height: 1;
    cursor: pointer;
}
.video-upload-toast-list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: min(56vh, 420px);
    overflow: auto;
}
.video-upload-toast.is-collapsed .video-upload-toast-list {
    display: none;
}
.upload-row {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 9px;
    background: rgba(255, 255, 255, 0.02);
}
.upload-row-name {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.upload-row-bar {
    margin-top: 6px;
    width: 100%;
    height: 7px;
    background: rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    overflow: hidden;
}
.upload-row-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #2f7df8, #6fa8ff);
}
.upload-row.is-final .upload-row-bar span {
    background: linear-gradient(90deg, #36b763, #6fdf95);
}
.upload-row-meta {
    margin-top: 6px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
}
.upload-row-actions {
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.upload-row-actions button,
.upload-row-actions .upload-row-open {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: #f1f1f1;
    border-radius: 8px;
    padding: 5px 9px;
    font-size: 12px;
    cursor: pointer;
    text-decoration: none;
}
.video-upload-toast.is-dragging {
    user-select: none;
}

.upload-cancel-confirm {
    position: fixed;
    inset: 0;
    z-index: 1800;
    display: none;
}
.upload-cancel-confirm.visible {
    display: block;
}
.upload-cancel-confirm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}
.upload-cancel-confirm-card {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(92vw, 360px);
    background: #1f1f1f;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    padding: 14px;
}
.upload-cancel-confirm-card h3 {
    margin: 0 0 7px;
    font-size: 18px;
}
.upload-cancel-confirm-card p {
    margin: 0 0 12px;
    color: #c6c6c6;
}
.upload-cancel-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.upload-cancel-confirm-actions button {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    border-radius: 8px;
    padding: 7px 10px;
    cursor: pointer;
}
#upload-cancel-confirm-btn {
    background: rgba(216, 58, 58, 0.2);
    border-color: rgba(255, 107, 107, 0.5);
}
body.light-theme .upload-cancel-confirm-card {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.12);
    color: #111;
}
body.light-theme .upload-cancel-confirm-card p {
    color: #565656;
}
body.light-theme .upload-cancel-confirm-actions button {
    border-color: rgba(0, 0, 0, 0.2);
    background: rgba(0, 0, 0, 0.05);
    color: #111;
}

/* Блок аватара + мини-панель загрузок */
.user-menu-container {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: relative;
    flex-shrink: 0;
}

/* --- mini панель загрузки (якорь — .upload-mini-wrap у аватара) --- */
.upload-mini-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    overflow: visible;
    flex-shrink: 0;
}
.upload-mini-wrap .upload-mini-toggle-icon {
    filter: brightness(0) invert(1);
    opacity: 0.95;
}
.upload-mini-panel {
    display: none;
    width: min(360px, calc(100vw - 24px));
    background: #2a2b2f;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
    padding: 10px;
    z-index: 1100;
    margin: 0;
    transition: box-shadow .2s ease;
}
/* Как .notification-dropdown — под кнопкой в шапке, без затемнения страницы */
.upload-mini-panel.is-docked {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    left: auto;
}
.upload-mini-panel.visible {
    display: block;
}
.upload-mini-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    cursor: grab;
}
.upload-mini-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.upload-mini-undock-close {
    display: none;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
    color: #f1f1f1;
    border-radius: 8px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.upload-mini-undock-collapse {
    display: none;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
    color: #f1f1f1;
    border-radius: 8px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}
.upload-mini-panel.is-undocked .upload-mini-undock-collapse {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.upload-mini-panel.is-undocked .upload-mini-undock-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.upload-mini-panel.is-undocked {
    position: fixed;
    z-index: 2500;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
}
.upload-mini-panel.is-undocked.is-collapsed .upload-mini-panel-list,
.upload-mini-panel.is-undocked.is-collapsed .upload-mini-clear-btn,
.upload-mini-panel.is-undocked.is-collapsed .upload-mini-undock-close {
    display: none;
}
.upload-mini-panel.is-undocked.is-collapsed {
    width: 240px;
}
.upload-mini-panel-title {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 0;
}
.upload-mini-empty {
    font-size: 12px;
    color: #a9a9a9;
    padding: 8px;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
}
.upload-mini-clear-btn {
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
    color: #f1f1f1;
    border-radius: 8px;
    font-size: 12px;
    padding: 4px 8px;
    cursor: pointer;
}
.upload-mini-panel-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow: auto;
}
.upload-mini-item {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
}
.upload-mini-name {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.upload-mini-bar {
    margin-top: 6px;
    height: 6px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.12);
}
.upload-mini-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #2f7df8, #6fa8ff);
}
.upload-mini-meta {
    margin-top: 6px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
}
.upload-mini-pct {
    font-weight: 700;
    color: #9cc0ff;
}
#upload-mini-toggle-btn {
    position: relative;
    color: inherit;
    background: transparent;
}
#upload-mini-toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}
#upload-mini-toggle-btn:focus {
    outline: none;
}
#upload-mini-toggle-btn:focus-visible {
    outline: 2px solid rgba(120, 170, 255, 0.55);
    outline-offset: 2px;
}
#upload-mini-toggle-btn.has-active::after {
    content: '';
    position: absolute;
    right: 7px;
    top: 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #e53935;
}
.upload-mini-toggle-hidden {
    opacity: 0;
    pointer-events: none;
}
.upload-mini-dock-target {
    display: none !important;
}
/* «Вырезанное» место в шапке, пока панель откреплена — клик возвращает к доку */
.upload-mini-dock-target.active {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0 2px;
    border-radius: 12px;
    border: 1px dashed rgba(255, 255, 255, 0.28);
    background:
        linear-gradient(180deg, rgba(48, 48, 52, 0.55) 0%, rgba(18, 18, 22, 0.85) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.07),
        inset 0 -4px 12px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    vertical-align: middle;
    opacity: 0.95;
}
.upload-mini-dock-target.active:hover {
    border-color: rgba(120, 170, 255, 0.45);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -4px 12px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(80, 130, 255, 0.25);
}
.upload-mini-dock-target.active .upload-mini-toggle-icon {
    filter: brightness(0) invert(1);
    opacity: 0.92;
}

/* старый плавающий toast временно скрыт */
#video-upload-toast {
    display: none !important;
}

/* Light upload mini panel: theme-modals-light.css */
body.light-theme .upload-mini-dock-target.active {
    border-color: rgba(0, 0, 0, 0.22);
    background: linear-gradient(180deg, rgba(240, 240, 244, 0.9), rgba(210, 210, 218, 0.95));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.85),
        inset 0 -3px 10px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(0, 0, 0, 0.08);
}
body.light-theme .upload-mini-wrap .upload-mini-toggle-icon {
    filter: brightness(0) invert(0.25);
    opacity: 0.9;
}
body.light-theme .upload-mini-dock-target.active .upload-mini-toggle-icon {
    filter: brightness(0) invert(0.25);
    opacity: 0.95;
}