/**
 * Мобильная адаптация (телефоны / планшеты).
 * Сайдбар — выезжающая панель по кнопке меню, контент на всю ширину.
 */

@media (max-width: 900px) {
    :root {
        --mobile-gutter: 16px;
    }

    .user-menu-item-desktop-only {
        display: none !important;
    }

    html {
        -webkit-text-size-adjust: 100%;
    }

    body {
        overflow-x: hidden;
    }

    /* ── Сайдбар: скрыт, открывается поверх ── */
    .page-container:not(.no-sidebar) {
        display: block;
    }

    .page-container:not(.no-sidebar) .sidebar {
        --sidebar-drawer-bg: #181818;
        --sidebar-drawer-border: rgba(255, 255, 255, 0.08);
        position: fixed;
        left: 0;
        top: var(--header-height, 56px);
        width: min(300px, 88vw);
        height: calc(100vh - var(--header-height, 56px));
        height: calc(100dvh - var(--header-height, 56px));
        z-index: 250;
        transform: translateX(-105%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
        padding: 10px 8px max(16px, env(safe-area-inset-bottom));
        background: var(--sidebar-drawer-bg) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border-right: 1px solid var(--sidebar-drawer-border);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    html.light-theme .page-container:not(.no-sidebar) .sidebar,
    body.light-theme .page-container:not(.no-sidebar) .sidebar {
        --sidebar-drawer-bg: #ffffff;
        --sidebar-drawer-border: #e8e8e8;
    }

    html.original-theme .page-container:not(.no-sidebar) .sidebar,
    body.original-theme .page-container:not(.no-sidebar) .sidebar {
        --sidebar-drawer-bg: #fff3e8;
        --sidebar-drawer-border: rgba(196, 160, 120, 0.22);
    }

    html.original-theme .page-container.sidebar-mobile-open .sidebar .sidebar-item:hover,
    body.original-theme .page-container.sidebar-mobile-open .sidebar .sidebar-item:hover {
        background: rgba(232, 188, 152, 0.28);
    }

    .page-container:not(.no-sidebar) .sidebar {
        display: flex;
        flex-direction: column;
    }

    .page-container:not(.no-sidebar) .sidebar .sidebar-full {
        flex: 1 1 auto;
        min-height: 0;
        display: block;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .page-container:not(.no-sidebar) .sidebar .sidebar-footer {
        background: var(--sidebar-drawer-bg) !important;
        margin-top: auto;
        flex-shrink: 0;
        border-top: 1px solid var(--sidebar-drawer-border);
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .page-container:not(.no-sidebar) .sidebar .sidebar-item {
        border-radius: 12px;
        min-height: 44px;
    }

    .page-container:not(.no-sidebar) .sidebar-full {
        display: block !important;
    }

    .page-container:not(.no-sidebar) .sidebar-mini {
        display: none !important;
    }

    .page-container.sidebar-mobile-open .sidebar {
        transform: translateX(0);
        border-radius: 0;
        box-shadow: 12px 0 40px rgba(0, 0, 0, 0.22);
    }

    .page-container:not(.no-sidebar) .sidebar {
        border-radius: 0;
        top: var(--header-height, 56px);
    }

    /* На мобиле «свёрнутый» десктопный режим не сужает меню */
    .page-container.sidebar-collapsed:not(.sidebar-mobile-open) .sidebar {
        width: min(288px, 88vw);
        transform: translateX(-105%);
    }

    .page-container.sidebar-collapsed:not(.sidebar-mobile-open) .sidebar-full {
        display: block !important;
    }

    .page-container.sidebar-collapsed:not(.sidebar-mobile-open) .sidebar-mini {
        display: none !important;
    }

    .page-container.sidebar-mobile-open::before {
        content: '';
        position: fixed;
        inset: 0;
        top: var(--header-height, 56px);
        background: rgba(15, 12, 10, 0.62);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        z-index: 240;
        -webkit-tap-highlight-color: transparent;
    }

    .page-container.watch-mode:not(.sidebar-collapsed)::after {
        content: none !important;
    }

    .page-container.watch-mode.sidebar-mobile-open .sidebar,
    .page-container.watch-mode.sidebar-collapsed.sidebar-mobile-open .sidebar {
        transform: translateX(0) !important;
        visibility: visible !important;
        z-index: 250 !important;
    }

    body.sidebar-mobile-lock {
        overflow: hidden;
        touch-action: none;
    }

    .page-container:not(.no-sidebar) .main-content {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: var(--mobile-gutter);
        padding-bottom: max(var(--mobile-gutter), env(safe-area-inset-bottom));
        height: auto;
        min-height: calc(100vh - var(--header-height, 56px));
        min-height: calc(100dvh - var(--header-height, 56px));
        box-sizing: border-box;
    }

    /* ── Шапка ── */
    .main-header {
        padding-left: max(8px, env(safe-area-inset-left));
        padding-right: max(8px, env(safe-area-inset-right));
    }

    .main-header > .category-orbit {
        margin-left: max(-8px, calc(-1 * env(safe-area-inset-left)));
        margin-right: max(-8px, calc(-1 * env(safe-area-inset-right)));
        width: calc(100% + 16px + env(safe-area-inset-left) + env(safe-area-inset-right));
    }

    html.original-theme .category-orbit__track,
    body.original-theme .category-orbit__track,
    html.light-theme .category-orbit__track,
    body.light-theme .category-orbit__track {
        padding-left: max(8px, env(safe-area-inset-left)) !important;
        padding-right: max(8px, env(safe-area-inset-right)) !important;
    }

    .header-top {
        height: auto;
        min-height: 56px;
        align-items: stretch;
        gap: 4px;
    }

    /* Главная: одна строка (меню | поиск+микрофон | иконки); при фокусе — полное раскрытие */
    body.page-home .header-top {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas: "left center right";
        gap: 6px 8px;
        align-items: center;
        min-height: 0;
        padding-top: 6px;
        padding-bottom: 6px;
    }

    body.page-home .header-left {
        grid-area: left;
        min-width: 0;
        gap: 4px;
    }

    body.page-home .header-center {
        grid-area: center;
        width: 100%;
        min-width: 0;
        padding: 0;
        gap: 8px;
        display: flex;
        align-items: center;
        justify-content: stretch;
    }

    body.page-home .header-right {
        grid-area: right;
        justify-content: flex-end;
        align-items: center;
        min-width: 0;
        flex-wrap: nowrap;
        gap: 4px;
        max-width: none;
    }

    body.page-home .header-right > .icon-button,
    body.page-home .header-right > .notification-wrapper,
    body.page-home .header-right > .user-menu-container,
    body.page-home .header-right > .guest-menu-container {
        flex: 0 0 auto;
    }

    body.page-home .logo-text {
        display: none;
    }

    body.page-home .search-container {
        flex: 1 1 auto;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    body.page-home .search-input-wrapper {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
    }

    body.page-home .search-input-wrapper input {
        width: 100%;
    }

    body.page-home .search-container .search-button {
        width: 48px;
        min-width: 48px;
        opacity: 1;
        pointer-events: auto;
        overflow: visible;
    }

    /* Главная: раскрытый поиск на весь хедер */
    body.page-home .header-top.search-expanded {
        position: relative;
        display: flex;
        align-items: center;
        min-height: 52px;
        padding: 6px 8px;
    }

    body.page-home .header-top.search-expanded .header-left,
    body.page-home .header-top.search-expanded .header-right {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        width: 0;
        min-width: 0;
        overflow: hidden;
        flex: 0 0 0;
        padding: 0;
        margin: 0;
        position: absolute;
    }

    body.page-home .header-top.search-expanded .header-center {
        position: absolute;
        inset: 0;
        width: 100%;
        padding: 0 8px;
        z-index: 12;
        display: flex;
        align-items: center;
        gap: 10px;
        box-sizing: border-box;
    }

    body.page-home .header-top.search-expanded .search-container.is-expanded {
        flex: 1 1 auto;
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }

    body.page-home .header-top.search-expanded .voice-search-button {
        flex-shrink: 0;
        z-index: 13;
    }

    .header-right > .upload-mini-wrap--header-bar {
        display: none !important;
    }

    .upload-mini-menu-item {
        display: flex;
        align-items: center;
        width: 100%;
        gap: 12px;
    }

    .upload-mini-mobile-anchor {
        position: absolute;
        top: 100%;
        right: 0;
        width: 0;
        height: 0;
        overflow: visible;
        pointer-events: none;
        z-index: 2;
    }

    .upload-mini-mobile-anchor .upload-mini-panel {
        pointer-events: auto;
    }

    .header-left {
        gap: 6px;
        min-width: 0;
        flex-shrink: 1;
    }

    .menu-button {
        margin-right: 0;
        flex-shrink: 0;
    }

    .logo {
        font-size: 17px;
        min-width: 0;
    }

    .logo-icon {
        height: 24px;
    }

    .header-center {
        flex: 1 1 auto;
        min-width: 0;
        padding: 0 6px;
        gap: 10px;
    }

    .header-center .voice-search-button {
        margin-left: 2px;
    }

    /* Крестик внутри строки поиска (как YouTube mobile: мелкий, без фона) */
    .search-container .clear-search-btn,
    .search-input-wrapper .clear-search-btn {
        flex: 0 0 26px;
        width: 26px;
        height: 26px;
        min-width: 26px;
        font-size: 17px;
        font-weight: 200;
        line-height: 1;
        border-radius: 0;
        background: transparent !important;
        box-shadow: none !important;
        align-self: center;
        opacity: 0.72;
    }

    .search-container .clear-search-btn:hover,
    .search-container .clear-search-btn:focus-visible,
    .search-input-wrapper .clear-search-btn:hover,
    .search-input-wrapper .clear-search-btn:focus-visible {
        background: transparent !important;
        box-shadow: none !important;
        opacity: 1;
    }

    html.light-theme .search-container .clear-search-btn,
    html.light-theme .search-input-wrapper .clear-search-btn,
    body.light-theme .search-container .clear-search-btn,
    body.light-theme .search-input-wrapper .clear-search-btn {
        color: #606060 !important;
        background: transparent !important;
        font-weight: 200;
    }

    html.light-theme .search-container .clear-search-btn:hover,
    html.light-theme .search-container .clear-search-btn:focus-visible,
    html.light-theme .search-input-wrapper .clear-search-btn:hover,
    html.light-theme .search-input-wrapper .clear-search-btn:focus-visible,
    body.light-theme .search-container .clear-search-btn:hover,
    body.light-theme .search-container .clear-search-btn:focus-visible,
    body.light-theme .search-input-wrapper .clear-search-btn:hover,
    body.light-theme .search-input-wrapper .clear-search-btn:focus-visible {
        color: #0f0f0f !important;
        background: transparent !important;
    }

    html.dark-theme .search-container .clear-search-btn,
    html.dark-theme .search-input-wrapper .clear-search-btn,
    body.dark-theme .search-container .clear-search-btn,
    body.dark-theme .search-input-wrapper .clear-search-btn {
        color: #aaa !important;
        background: transparent !important;
        font-weight: 200;
        opacity: 0.8;
    }

    html.dark-theme .search-container .clear-search-btn:hover,
    html.dark-theme .search-container .clear-search-btn:focus-visible,
    html.dark-theme .search-input-wrapper .clear-search-btn:hover,
    html.dark-theme .search-input-wrapper .clear-search-btn:focus-visible,
    body.dark-theme .search-container .clear-search-btn:hover,
    body.dark-theme .search-container .clear-search-btn:focus-visible,
    body.dark-theme .search-input-wrapper .clear-search-btn:hover,
    body.dark-theme .search-input-wrapper .clear-search-btn:focus-visible {
        color: #f1f1f1 !important;
        background: transparent !important;
        opacity: 1;
    }

    html.original-theme .search-input-wrapper .clear-search-btn,
    body.original-theme .search-input-wrapper .clear-search-btn {
        color: #6b5344;
        background: transparent !important;
        font-size: 17px;
        font-weight: 200;
    }

    html.original-theme .search-input-wrapper .clear-search-btn:hover,
    body.original-theme .search-input-wrapper .clear-search-btn:hover {
        color: #4a382c;
        background: transparent !important;
    }

    /* Lo-fi: поле ввода — одна «капсула», крестик внутри; лупа — круг снаружи */
    html.original-theme .search-container,
    body.original-theme .search-container {
        gap: 8px !important;
        align-items: center;
        overflow: visible !important;
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    html.original-theme .search-input-wrapper,
    body.original-theme .search-input-wrapper {
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
        align-items: center;
        border: 1px solid rgba(139, 115, 85, 0.28) !important;
        border-radius: 40px !important;
        background: #fffdf9 !important;
        overflow: hidden;
    }

    html.original-theme .search-input-wrapper input,
    body.original-theme .search-input-wrapper input {
        flex: 1 1 auto;
        min-width: 0;
        width: 100%;
        height: 40px;
        border: none !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        padding-right: 8px;
    }

    html.original-theme .search-input-wrapper input:focus,
    body.original-theme .search-input-wrapper input:focus {
        outline: none !important;
        box-shadow: none !important;
    }

    html.original-theme .search-container .search-button,
    body.original-theme .search-container .search-button {
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        height: 40px !important;
        aspect-ratio: 1 / 1;
        border-radius: 50% !important;
        flex: 0 0 40px !important;
        align-self: center !important;
        padding: 0 !important;
        margin: 0 !important;
        border-left: none !important;
    }

    .search-container {
        max-width: none;
    }

    .search-input-wrapper input {
        font-size: 16px;
        height: 38px;
        padding-left: 12px;
    }

    .search-button {
        width: 38px;
        height: 38px;
        min-width: 38px;
        padding: 0;
    }

    .header-center {
        align-items: center;
    }

    .search-container {
        align-items: center;
        gap: 6px;
    }

    .search-button,
    .voice-search-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: 40px;
        height: 40px;
        min-width: 40px;
        padding: 0;
        margin: 0;
        border-radius: 50%;
        box-sizing: border-box;
        align-self: center;
    }

    .search-input-wrapper input {
        height: 40px;
    }

    .voice-search-button .icon-img,
    .search-button .icon-img {
        height: 20px;
        width: 20px;
    }

    body.page-home .header-center .search-container {
        min-width: 0;
        align-items: center;
    }

    #voice-search-modal.modal-overlay.visible {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 16px;
        box-sizing: border-box;
    }

    #voice-search-modal .voice-modal-content {
        width: min(100%, calc(100vw - 32px));
        max-width: 400px;
        margin: 0 auto;
    }

    .search-container {
        position: relative;
    }

    #search-suggestions-container {
        --header-suggestion-row: 44px;
        position: fixed;
        top: calc(var(--header-height, 56px) + 6px);
        left: max(var(--mobile-gutter, 16px), env(safe-area-inset-left, 0px));
        right: max(var(--mobile-gutter, 16px), env(safe-area-inset-right, 0px));
        width: auto;
        max-width: none;
        box-sizing: border-box;
        border-radius: 12px;
    }

    #search-suggestions-container .suggestion-item {
        gap: 12px;
        padding: 8px 14px;
        min-height: 44px;
    }

    #search-suggestions-container .suggestion-thumbnail {
        width: 64px;
        height: 36px;
    }

    #search-suggestions-container .suggestion-thumbnail-channel {
        width: 32px;
        height: 32px;
        border-radius: 50%;
    }

    /* Подсказки поиска компактнее на внутренних страницах (не главная) */
    body:not(.page-home) #search-suggestions-container {
        --header-suggestion-row: 40px;
        top: calc(var(--header-height, 56px) + 4px);
        left: max(12px, env(safe-area-inset-left, 0px));
        right: max(12px, env(safe-area-inset-right, 0px));
        padding: 4px 0;
        border-radius: 10px;
        max-height: min(calc(var(--header-suggestion-row) * 7), 36vh, 300px);
    }

    body:not(.page-home) #search-suggestions-container .suggestion-item {
        gap: 10px;
        padding: 6px 12px;
        min-height: 40px;
    }

    body:not(.page-home) #search-suggestions-container .suggestion-icon {
        width: 18px;
        height: 18px;
    }

    body:not(.page-home) #search-suggestions-container .suggestion-text {
        font-size: 14px;
    }

    body:not(.page-home) #search-suggestions-container .suggestion-thumbnail {
        width: 56px;
        height: 32px;
    }

    body:not(.page-home) #search-suggestions-container .suggestion-thumbnail-channel {
        width: 28px;
        height: 28px;
    }

    .header-right {
        gap: 2px;
        flex-shrink: 0;
    }

    .header-right > .icon-button,
    .header-right > .notification-wrapper,
    .header-right > .user-menu-container {
        flex-shrink: 0;
    }

    .user-menu-container {
        display: inline-flex;
        align-items: center;
        gap: 2px;
        position: relative;
        max-width: none;
    }

    .user-menu-container .upload-mini-wrap {
        flex-shrink: 0;
    }

    .user-menu-container #upload-mini-toggle-btn {
        padding: 6px;
    }

    .user-menu-container .upload-mini-panel.is-docked {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        left: auto;
        width: min(340px, calc(100vw - 20px));
        max-width: calc(100vw - 20px);
        z-index: 1200;
    }

    .user-menu-container .upload-mini-dock-target.active {
        position: absolute;
        top: calc(100% + 6px);
        right: 0;
    }

    .header-right .icon-button {
        padding: 6px;
    }

    .header-right .icon-img {
        height: 22px;
    }

    .upload-mini-dock-target.active {
        width: 36px;
        height: 36px;
        margin: 0;
    }

    .category-orbit {
        height: 48px;
        margin: 0;
    }

    .category-orbit__track,
    .category-filters.category-orbit__track {
        height: 48px;
        gap: 2px;
        padding: 0 8px 0 max(8px, env(safe-area-inset-left));
    }

    .orbit-chip,
    .category-orbit__track .filter-item {
        padding: 4px 8px 6px;
        font-size: 12px;
        gap: 6px;
    }

    .orbit-chip__icon-wrap {
        width: 24px;
        height: 24px;
    }

    .orbit-chip__label {
        max-width: 8.5rem;
    }

    /* ── Сетки ── */
    .video-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    body.page-home #home-feed-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px 12px;
    }

    /* ── Пустые состояния ── */
    .empty-page-placeholder {
        padding: 24px 16px;
        min-height: 36vh;
        box-sizing: border-box;
    }

    .empty-page-placeholder img {
        width: 100px !important;
        height: 100px !important;
        max-width: 42vw;
        max-height: 42vw;
        object-fit: contain;
    }

    /* Выпадающие меню не вылезают за экран */
    .user-menu-dropdown,
    .notification-dropdown {
        width: min(286px, calc(100vw - 24px));
        max-width: calc(100vw - 24px);
    }

    .user-menu-dropdown {
        max-height: min(58vh, 58dvh);
        overflow: hidden;
    }

    .user-menu-main-panel,
    .user-menu-dropdown .user-submenu {
        max-height: min(58vh, 58dvh);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .notification-dropdown {
        max-height: min(58vh, 58dvh);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Загрузки — центрированная плашка, не под шапкой */
    body #upload-mini-panel.upload-mini-panel.is-docked.visible {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        bottom: auto !important;
        transform: translate(-50%, -50%) !important;
        width: min(340px, calc(100vw - 24px)) !important;
        max-width: calc(100vw - 24px) !important;
        max-height: min(58vh, 58dvh) !important;
        z-index: 2600 !important;
        margin: 0 !important;
    }

    body #upload-mini-panel .upload-mini-panel-list {
        max-height: calc(min(58vh, 58dvh) - 52px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    html.original-theme body:has(#upload-mini-panel.visible)::before,
    body.original-theme:has(#upload-mini-panel.visible)::before {
        content: '';
        position: fixed;
        inset: 0;
        z-index: 2590;
        background: rgba(74, 58, 42, 0.45);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        pointer-events: none;
    }

    /* Три модалки из меню — по центру, ~58% экрана */
    #hotkeys-modal.modal-overlay,
    #data-export-modal.modal-overlay,
    #recommendations-reset-modal.confirmation-modal-overlay {
        align-items: center !important;
        justify-content: center !important;
        padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
        box-sizing: border-box;
    }

    #hotkeys-modal .hotkeys-modal-content.improved-modal.hotkeys-modal-content {
        width: min(100%, calc(100vw - 24px)) !important;
        max-width: calc(100vw - 24px) !important;
        min-height: 0 !important;
        max-height: min(72vh, 72dvh) !important;
        margin: 0 auto;
        border-radius: 18px !important;
    }

    #hotkeys-modal .hotkeys-list,
    #hotkeys-modal .hotkeys-yt-content {
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

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

    #hotkeys-modal .hotkey-keys {
        flex: 0 0 88px !important;
        width: 88px !important;
        max-width: 88px !important;
        justify-content: flex-end !important;
        flex-wrap: nowrap !important;
        gap: 3px !important;
    }

    #hotkeys-modal .hotkey-desc {
        flex: 1 1 auto !important;
        text-align: left !important;
        line-height: 1.32 !important;
    }

    #hotkeys-modal .hotkey-kbd {
        padding: 3px 6px !important;
        font-size: 11px !important;
    }

    #hotkeys-modal .hotkey-plus {
        font-size: 11px !important;
        padding: 0 !important;
    }

    #hotkeys-modal .hotkeys-grid {
        grid-template-columns: 1fr !important;
        gap: 6px;
    }

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

    #hotkeys-modal .hotkeys-tab-yt {
        flex: 0 0 auto;
        min-width: max-content;
    }

    #data-export-modal.modal-overlay.visible {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    #data-export-modal .data-export-modal-panel {
        width: min(100%, calc(100vw - 24px)) !important;
        max-width: 760px !important;
        max-height: min(82vh, 82dvh) !important;
        margin: 0 auto;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    #data-export-modal #data-export-form {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #data-export-modal .data-export-list {
        max-height: none !important;
        grid-template-columns: 1fr !important;
        overflow: visible;
    }

    #data-export-modal .data-export-footer {
        flex-shrink: 0;
        position: relative;
        z-index: 2;
        background: inherit;
    }

    html.original-theme #data-export-modal .data-export-modal-panel,
    body.original-theme #data-export-modal .data-export-modal-panel {
        background: #fff8f0 !important;
    }

    #recommendations-reset-modal .rec-reset-modal-content,
    #recommendations-reset-modal .confirmation-modal-content {
        width: min(100%, calc(100vw - 24px)) !important;
        max-width: 420px !important;
        max-height: min(58vh, 58dvh) !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 auto;
    }

    /* Общая безопасная адаптация для страниц с карточками/табами/модалками */
    .results-page-container,
    .category-page-container,
    /* ── Страница просмотра (мобилка) ── */
    body.watch-page .watch-page-container {
        padding-left: 12px;
        padding-right: 12px;
        gap: 14px;
    }

    body.watch-page:not(.theater-mode) .video-container {
        aspect-ratio: 16 / 13.5;
        margin-bottom: 8px;
    }

    body.watch-page .video-title-watch {
        font-size: 15px;
        line-height: 1.3;
        margin-bottom: 8px;
    }

    body.watch-page .video-container .controls {
        padding: 6px 10px;
    }

    body.watch-page .video-container .controls-left,
    body.watch-page .video-container .controls-right {
        gap: 8px;
    }

    body.watch-page .video-container .controls button img {
        width: 22px;
        height: 22px;
    }

    body.watch-page .video-container .timeline-container {
        margin: 0 10px;
        height: 8px;
    }

    body.watch-page .video-container .settings-menu-container {
        bottom: 40px;
        right: 6px;
        width: min(168px, calc(100% - 12px));
        max-width: 68vw;
        max-height: min(46%, 210px);
        border-radius: 10px;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.38);
    }

    body.watch-page .video-container .settings-menu-container.submenu-open {
        max-height: min(52%, 230px);
    }

    body.watch-page .video-container .settings-menu-container .settings-menu,
    body.watch-page .video-container .settings-menu-container .submenu {
        font-size: 11px;
    }

    body.watch-page .video-container .settings-menu-container .submenu {
        max-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    body.watch-page .video-container .settings-menu-container .menu-item,
    body.watch-page .video-container .settings-menu-container .menu-option {
        gap: 5px;
        min-height: 28px !important;
        padding: 4px 8px !important;
        font-size: 11px !important;
        line-height: 1.15 !important;
        justify-content: flex-start;
    }

    body.watch-page .video-container .settings-menu-container .main-menu .menu-item {
        min-height: 30px !important;
        padding: 5px 8px !important;
        font-size: 12px !important;
    }

    body.watch-page .video-container .settings-menu-container .menu-item .label {
        font-size: 12px;
    }

    body.watch-page .video-container .settings-menu-container .main-menu .menu-item .label {
        font-size: 12px;
    }

    body.watch-page .video-container .settings-menu-container .menu-item svg.menu-item-icon,
    body.watch-page .video-container .settings-menu-container .menu-item img {
        width: 14px;
        height: 14px;
    }

    body.watch-page .video-container .settings-menu-container .menu-item .value {
        font-size: 10px;
        margin-left: 3px;
        max-width: 40%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.watch-page .video-container .settings-menu-container .submenu .menu-option {
        min-height: 26px !important;
        padding: 3px 8px !important;
        font-size: 11px !important;
    }

    body.watch-page .video-container .settings-menu-container .menu-option.active {
        font-weight: 600;
    }

    body.watch-page .video-container .settings-menu-container .menu-option-subhint {
        font-size: 10px !important;
        padding: 3px 8px 5px !important;
        line-height: 1.2 !important;
    }

    body.watch-page .video-container .settings-menu-container .submenu-header {
        min-height: 28px !important;
        padding: 4px 6px !important;
        margin-bottom: 0 !important;
        font-size: 11px !important;
        font-weight: 600;
    }

    body.watch-page .video-container .settings-menu-container .submenu-header .back-btn {
        font-size: 14px;
        padding: 0 4px;
        margin-right: 0;
    }

    body.watch-page .video-container .settings-menu-container .submenu-header span {
        font-size: 11px;
    }

    body.watch-page .video-actions-bar {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
        margin-bottom: 10px;
        overflow: visible;
    }

    body.watch-page .channel-info {
        flex: 1 1 auto;
        min-width: 0;
        max-width: 48%;
        gap: 6px;
    }

    body.watch-page .channel-avatar-watch {
        width: 32px;
        height: 32px;
        flex-shrink: 0;
    }

    body.watch-page .channel-name-watch {
        min-width: 0;
    }

    body.watch-page .channel-name-watch span:first-child {
        display: block;
        font-size: 13px;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body.watch-page .subscribers-count {
        font-size: 10px;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body.watch-page .action-buttons {
        flex: 0 1 auto;
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 4px;
        min-width: 0;
    }

    body.watch-page .subscribe-button {
        padding: 6px 10px;
        font-size: 11px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    body.watch-page .like-dislike-buttons button {
        padding: 6px 8px;
        font-size: 11px;
        gap: 3px;
    }

    body.watch-page .like-dislike-buttons button img {
        width: 16px;
        height: 16px;
    }

    body.watch-page .action-buttons .action-btn {
        padding: 6px 8px;
        font-size: 11px;
        gap: 3px;
        flex-shrink: 0;
    }

    body.watch-page .action-buttons .action-btn span {
        display: none;
    }

    body.watch-page .action-buttons .action-btn img,
    body.watch-page .more-actions-btn img {
        width: 16px;
        height: 16px;
    }

    body.watch-page .more-actions-btn {
        padding: 6px 8px;
    }

    body.watch-page .video-meta-info {
        font-size: 12px;
        padding: 8px 10px;
        line-height: 1.4;
    }

    body.watch-page .watch-rec-list {
        gap: 10px;
    }

    body.watch-page .recommendations-sidebar .recommendation-card {
        padding: 8px !important;
        gap: 8px !important;
        border-radius: 10px !important;
        margin: 0;
    }

    body.watch-page .recommendation-card .recommendation-card-link {
        gap: 8px;
    }

    body.watch-page .recommendation-card .recommendation-title {
        font-size: 13px !important;
        line-height: 1.3 !important;
        font-weight: 600;
        margin-bottom: 2px !important;
        padding-right: 22px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        white-space: normal;
    }

    body.watch-page .recommendation-channel,
    body.watch-page .recommendation-views,
    body.watch-page .recommendation-stats,
    body.watch-page .recommendation-stats span {
        font-size: 11px !important;
        line-height: 1.25 !important;
        margin-top: 0 !important;
    }

    body.watch-page .recommendation-meta {
        gap: 2px;
    }

    body.watch-page .recommendations-sidebar .thumbnail-wrapper {
        width: 126px !important;
        min-width: 126px !important;
        height: 71px !important;
        border-radius: 8px !important;
    }

    body.watch-page .recommendation-thumbnail {
        width: 100% !important;
        min-width: 0 !important;
        height: 100% !important;
        border-radius: 0 !important;
    }

    body.watch-page .recommendations-sidebar .thumbnail-duration {
        font-size: 10px;
        padding: 1px 4px;
        bottom: 4px;
        right: 4px;
    }

    body.watch-page .recommendations-sidebar .context-menu-button {
        width: 30px;
        height: 30px;
        padding: 4px;
    }

    body.watch-page .recommendations-sidebar .context-menu-button img {
        width: 16px;
        height: 16px;
    }

    body.watch-page .comments-section {
        margin-top: 14px;
    }

    body.watch-page .comments-header {
        flex-wrap: wrap;
        align-items: baseline;
        gap: 6px 10px;
        margin-bottom: 10px;
    }

    body.watch-page .comments-header-title {
        font-size: 14px;
    }

    body.watch-page .sort-controls {
        gap: 8px;
    }

    body.watch-page .sort-btn {
        font-size: 12px;
        padding: 2px 0;
    }

    body.watch-page .comment-form-container {
        gap: 8px;
        margin-bottom: 14px;
    }

    body.watch-page .comment-form-avatar {
        width: 32px;
        height: 32px;
    }

    body.watch-page #comment-text-input {
        font-size: 13px;
        padding: 6px 0;
    }

    body.watch-page .comment-action-btn {
        padding: 6px 12px;
        font-size: 12px;
        border-radius: 14px;
    }

    body.watch-page #watch-rec-infinite-loader {
        margin: 6px 0 2px;
    }

    body.watch-page #watch-rec-infinite-loader .infinite-loader-text {
        font-size: 12px;
    }

    body.watch-page #watch-rec-infinite-sentinel {
        height: 20px;
    }

    body.watch-page #theater-menu-item {
        display: none !important;
    }

    body.watch-page.theater-mode .watch-page-container {
        flex-direction: column;
    }

    body.watch-page.theater-mode .recommendations-sidebar {
        width: 100%;
        max-width: none;
    }

    .watch-page-container,
    .playlists-container,
    .watch-later-container,
    .history-page-container,
    .subscriptions-page-container,
    .liked-page-container,
    .settings-layout,
    .profile-container,
    .studio-shell,
    .live-dashboard-shell {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: hidden;
        overflow-y: visible;
        box-sizing: border-box;
    }

    body.watch-later-page .watch-later-container,
    body.subscriptions-page .subscriptions-page-container,
    body.liked-page .liked-page-container {
        overflow: visible;
    }

    .context-menu-dropdown.is-viewport-positioned,
    .context-menu-dropdown.is-viewport-positioned.opens-upward,
    .channel-item-menu.is-viewport-positioned,
    .video-item-menu.is-viewport-positioned {
        position: fixed !important;
        z-index: 10060 !important;
        min-width: 220px;
        max-width: min(300px, calc(100vw - 20px));
        box-sizing: border-box;
        bottom: auto !important;
        right: auto !important;
    }

    .context-menu-container:has(.context-menu-dropdown.active) .context-menu-button {
        pointer-events: none;
    }

    .context-menu-dropdown.is-viewport-positioned a,
    .channel-item-menu.is-viewport-positioned a,
    .video-item-menu.is-viewport-positioned a {
        white-space: normal;
        line-height: 1.35;
    }

    .video-list-thumbnail-wrapper {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        max-width: 100%;
    }

    .video-list-details,
    .channel-details {
        min-width: 0;
    }

    /* ── Результаты поиска (мобилка) ── */
    body.page-results .results-page-container {
        padding: 14px 12px 20px;
        box-sizing: border-box;
    }

    body.page-results .results-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 14px;
        padding-bottom: 10px;
    }

    body.page-results .quick-filters-container {
        width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }

    body.page-results .quick-filters-container::-webkit-scrollbar {
        display: none;
    }

    body.page-results .filter-tab {
        flex: 0 0 auto;
        padding: 7px 14px;
        font-size: 13px;
    }

    body.page-results .filter-button {
        width: 100%;
        justify-content: center;
        box-sizing: border-box;
    }

    body.page-results .results-list-container {
        gap: 12px;
    }

    body.page-results .video-list-item {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
        overflow: visible;
    }

    body.page-results .video-list-thumbnail-wrapper {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        padding-top: 0;
        position: relative;
        flex-shrink: 0;
    }

    body.page-results .video-list-thumbnail {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    body.page-results .video-list-details {
        width: 100%;
        padding-top: 0;
        padding-right: 0;
        box-sizing: border-box;
    }

    body.page-results .video-list-details-head {
        align-items: flex-start;
        gap: 6px;
    }

    body.page-results .video-list-details-head .context-menu-container {
        position: relative;
        top: auto;
        right: auto;
        margin-top: -2px;
    }

    body.page-results .video-list-title {
        font-size: 15px;
        line-height: 1.35;
        margin-bottom: 6px;
    }

    body.page-results .video-list-meta {
        font-size: 12px;
        margin-bottom: 8px;
        flex-wrap: wrap;
    }

    body.page-results .video-list-description {
        display: none;
    }

    body.page-results .video-list-details-head .context-menu-button {
        width: 34px;
        height: 34px;
        padding: 5px;
        background: rgba(255, 255, 255, 0.94);
        border: 1px solid rgba(0, 0, 0, 0.06);
    }

    html.original-theme body.page-results .video-list-details-head .context-menu-button,
    body.original-theme.page-results .video-list-details-head .context-menu-button {
        background: rgba(255, 252, 247, 0.96);
        border: 1px solid rgba(180, 150, 120, 0.18);
    }

    /* Шапка: компактный поиск (не главная, только мобильные) */
    body:not(.page-home) .voice-search-button {
        display: inline-flex !important;
        flex-shrink: 0;
    }

    body:not(.page-home) .search-container:not(.is-expanded) {
        max-width: min(120px, calc(100vw - 200px));
    }

    body:not(.page-home) .header-top.search-expanded .voice-search-button {
        display: inline-flex !important;
        flex-shrink: 0;
        z-index: 13;
    }

    body:not(.page-home) .header-top.search-expanded .header-center {
        gap: 8px;
    }

    body:not(.page-home) .header-top.search-expanded .search-container.is-expanded {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
    }

    body:not(.page-home) .search-container .search-button {
        width: 0;
        min-width: 0;
        opacity: 0;
        padding: 0;
        margin: 0;
        border-width: 0;
        overflow: hidden;
        pointer-events: none;
        transition: width 0.22s ease, min-width 0.22s ease, opacity 0.2s ease, margin 0.22s ease;
    }

    body:not(.page-home) .search-container:not(.is-expanded) {
        flex: 1 1 auto;
        min-width: 0;
        transition: max-width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    }

    body:not(.page-home) .search-container:not(.is-expanded) .search-input-wrapper input {
        padding-right: 12px;
    }

    body:not(.page-home) .search-container.is-expanded {
        flex: 1 1 100%;
        max-width: 100%;
        width: 100%;
        gap: 8px;
    }

    body:not(.page-home) .header-top.search-expanded {
        position: relative;
    }

    body:not(.page-home) .header-top.search-expanded .header-left,
    body:not(.page-home) .header-top.search-expanded .header-right {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        width: 0;
        min-width: 0;
        overflow: hidden;
        flex: 0 0 0;
        padding: 0;
        margin: 0;
    }

    body:not(.page-home) .header-top.search-expanded .header-center {
        position: absolute;
        inset: 0;
        width: 100%;
        padding: 0 8px;
        z-index: 12;
        display: flex;
        align-items: center;
        background: inherit;
    }

    body:not(.page-home) .header-top.search-expanded .search-container.is-expanded .search-button {
        width: 38px;
        min-width: 38px;
        opacity: 1;
        pointer-events: auto;
    }

    body.page-results .video-list-item:has(.context-menu-dropdown.active) {
        z-index: 20;
    }

    body.page-results .channel-list-item {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 12px 14px;
    }

    body.page-results .channel-avatar-large {
        width: 48px;
        height: 48px;
    }

    body.page-results .channel-details {
        flex: 1 1 auto;
        min-width: 0;
    }

    body.page-results .channel-list-title {
        font-size: 15px;
        margin: 0 0 4px;
        line-height: 1.25;
    }

    body.page-results .channel-meta {
        font-size: 12px;
        margin-bottom: 0;
    }

    body.page-results .channel-description {
        display: none;
    }

    body.page-results .subscribe-button {
        align-self: center;
        width: auto;
        min-width: 0;
        flex-shrink: 0;
        margin-top: 0;
        padding: 8px 14px;
        font-size: 13px;
        white-space: nowrap;
        text-align: center;
        box-sizing: border-box;
    }

    /* ── Подписки (мобилка) ── */
    body.subscriptions-page .subscriptions-page-container {
        margin: 0;
        padding: 16px 14px 20px;
        border-radius: 20px;
        box-sizing: border-box;
    }

    body.subscriptions-page .subscriptions-header {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        margin-bottom: 20px;
    }

    body.subscriptions-page .subscriptions-page-title {
        font-size: 1.35rem;
        line-height: 1.25;
    }

    body.subscriptions-page .header-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
    }

    body.subscriptions-page .view-toggle-button.styled,
    body.subscriptions-page .sort-menu-button {
        width: 100%;
        justify-content: center;
        padding: 9px 12px;
        font-size: 13px;
        border-radius: 999px;
        box-sizing: border-box;
    }

    body.subscriptions-page .sort-menu-container {
        min-width: 0;
    }

    body.subscriptions-page .sort-menu-button {
        justify-content: space-between;
    }

    body.subscriptions-page .sort-menu-button span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        min-width: 0;
    }

    body.subscriptions-page .video-feed {
        gap: 16px;
    }

    body.subscriptions-page .video-group-divider {
        display: none;
    }

    body.subscriptions-page .video-group-header {
        margin-bottom: 10px;
    }

    body.subscriptions-page .channel-avatar-small {
        width: 32px;
        height: 32px;
    }

    body.subscriptions-page .channel-name-large {
        font-size: 15px;
    }

    body.subscriptions-page .video-list {
        gap: 12px;
    }

    body.subscriptions-page .video-list-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 12px 48px 12px 12px;
        border-radius: 14px;
        position: relative;
        overflow: visible;
    }

    body.subscriptions-page .video-list-item .video-main-link {
        flex-direction: column;
        gap: 10px;
        width: 100%;
        padding-right: 0;
        box-sizing: border-box;
    }

    body.subscriptions-page .video-thumbnail-wrapper {
        width: 100%;
    }

    body.subscriptions-page .video-thumbnail {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        border-radius: 14px;
    }

    body.subscriptions-page .video-details {
        padding-top: 0;
        gap: 4px;
        min-width: 0;
    }

    body.subscriptions-page .video-title {
        font-size: 15px;
        line-height: 1.35;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        overflow: hidden;
    }

    body.subscriptions-page .video-description {
        display: none;
    }

    body.subscriptions-page .video-meta {
        font-size: 12px;
        flex-wrap: wrap;
        gap: 4px;
    }

    body.subscriptions-page .video-item-menu-container {
        position: absolute;
        right: 8px;
        bottom: 12px;
        top: auto;
        margin: 0;
        z-index: 3;
    }

    body.subscriptions-page .video-item-menu-button {
        width: 36px;
        height: 36px;
        background: rgba(255, 252, 247, 0.95);
        box-shadow: 0 1px 6px rgba(92, 74, 58, 0.1);
    }

    body.subscriptions-page .channel-list {
        gap: 10px;
    }

    body.subscriptions-page .channel-card {
        display: grid;
        grid-template-columns: 52px minmax(0, 1fr) 40px;
        align-items: center;
        gap: 10px;
        padding: 12px;
        border-radius: 14px;
        position: relative;
    }

    body.subscriptions-page .channel-main-link {
        grid-column: 1 / 3;
        display: flex;
        gap: 12px;
        min-width: 0;
    }

    body.subscriptions-page .channel-avatar {
        width: 52px;
        height: 52px;
    }

    body.subscriptions-page .channel-info {
        min-width: 0;
    }

    body.subscriptions-page .channel-name {
        font-size: 15px;
        margin-bottom: 4px;
    }

    body.subscriptions-page .subscribers-count {
        font-size: 12px;
    }

    body.subscriptions-page .channel-item-menu-container {
        grid-column: 3;
        grid-row: 1;
        position: relative;
        top: auto;
        right: auto;
        transform: none;
        margin: 0;
        justify-self: center;
        align-self: center;
        z-index: 2;
    }

    body.subscriptions-page .channel-item-menu-button {
        width: 36px;
        height: 36px;
    }

    body.subscriptions-page .video-list-item,
    body.subscriptions-page .channel-card {
        overflow: visible;
    }

    body.subscriptions-page .video-list-item:has(.video-item-menu.active),
    body.subscriptions-page .channel-card:has(.channel-item-menu.active) {
        z-index: 30;
    }

    body.subscriptions-page .empty-page-placeholder {
        min-height: 40vh;
        padding: 24px 8px;
    }

    body.subscriptions-page .empty-page-placeholder h2 {
        font-size: 1.15rem;
    }

    html.original-theme body.subscriptions-page .video-list-item,
    body.original-theme.subscriptions-page .video-list-item {
        padding: 12px;
        background: rgba(255, 252, 247, 0.92);
        border: 1px solid rgba(180, 150, 120, 0.14);
    }

    html.original-theme body.subscriptions-page .channel-card,
    body.original-theme.subscriptions-page .channel-card {
        background: rgba(255, 252, 247, 0.92);
        border: 1px solid rgba(180, 150, 120, 0.14);
    }

    /* ── Понравившиеся (мобилка) ── */
    body.liked-page .liked-page-container {
        margin: 0;
        padding: 16px 14px 20px;
        border-radius: 20px;
        box-sizing: border-box;
    }

    body.liked-page .liked-page-header {
        margin-bottom: 18px;
    }

    body.liked-page .liked-page-title {
        font-size: 1.35rem;
        line-height: 1.25;
        margin-bottom: 14px;
    }

    body.liked-page .playlist-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 8px;
    }

    body.liked-page .action-button {
        width: 100%;
        justify-content: center;
        padding: 11px 16px;
        border-radius: 999px;
        box-sizing: border-box;
    }

    body.liked-page .liked-video-list {
        gap: 12px;
    }

    body.liked-page .liked-video-item {
        display: block;
        padding: 12px 48px 12px 12px;
        border-radius: 14px;
        position: relative;
        overflow: visible;
    }

    body.liked-page .video-index {
        display: none;
    }

    body.liked-page .liked-video-item .video-main-link {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
        padding-right: 0;
        box-sizing: border-box;
    }

    body.liked-page .thumbnail-wrapper,
    body.liked-page .thumbnail-wrapper-link {
        width: 100%;
    }

    body.liked-page .thumbnail-image {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        border-radius: 14px;
    }

    body.liked-page .video-details {
        gap: 4px;
        min-width: 0;
    }

    body.liked-page .video-title {
        font-size: 15px;
        line-height: 1.35;
    }

    body.liked-page .video-title a {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        overflow: hidden;
    }

    body.liked-page .video-meta {
        font-size: 12px;
        flex-wrap: wrap;
        gap: 4px;
    }

    body.liked-page .context-menu-container {
        position: absolute;
        right: 8px;
        bottom: 12px;
        top: auto;
        margin: 0;
        z-index: 3;
    }

    body.liked-page .context-menu-button {
        width: 36px;
        height: 36px;
        position: relative;
        z-index: 3;
        background: rgba(255, 252, 247, 0.95);
    }

    body.liked-page .liked-video-item:has(.context-menu-dropdown.active) {
        z-index: 40;
    }

    html.original-theme body.liked-page .context-menu-button,
    body.original-theme.liked-page .context-menu-button {
        background: rgba(255, 252, 247, 0.95) !important;
        box-shadow: 0 1px 6px rgba(92, 74, 58, 0.12);
    }

    body.liked-page .liked-video-item {
        overflow: visible;
    }

    body.liked-page .liked-video-item:has(.context-menu-dropdown.active) {
        z-index: 30;
    }

    body.liked-page .empty-page-placeholder {
        margin-top: 24px;
        padding: 24px 8px 32px;
    }

    body.liked-page .empty-page-placeholder h2 {
        font-size: 1.15rem;
    }

    body.liked-page .empty-page-placeholder p {
        font-size: 14px;
        max-width: 280px;
        margin-left: auto;
        margin-right: auto;
    }

    html.original-theme body.liked-page .liked-video-item,
    body.original-theme.liked-page .liked-video-item {
        padding: 12px;
        background: rgba(255, 252, 247, 0.92);
        border: 1px solid rgba(180, 150, 120, 0.14);
    }

    /* ── Смотреть позже (мобилка) ── */
    body.watch-later-page .watch-later-container {
        margin: 0;
        padding: 16px 14px 20px;
        border-radius: 20px;
    }

    body.watch-later-page .wl-hero {
        margin-bottom: 16px;
        border-radius: 16px;
    }

    body.watch-later-page .wl-hero__inner {
        padding: 18px 14px 14px;
        background: linear-gradient(
            180deg,
            rgba(20, 16, 12, 0.55) 0%,
            rgba(20, 16, 12, 0.38) 55%,
            rgba(20, 16, 12, 0.2) 100%
        );
    }

    body.watch-later-page .wl-hero__eyebrow,
    body.watch-later-page .wl-hero__title,
    body.watch-later-page .wl-hero__stats,
    body.watch-later-page .wl-hero__hint {
        text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
    }

    body.watch-later-page .wl-hero__title {
        font-size: 1.2rem;
        line-height: 1.3;
    }

    body.watch-later-page .wl-hero__stats {
        font-size: 14px;
        margin-bottom: 12px;
    }

    body.watch-later-page .wl-hero__actions {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        margin-top: 4px;
        width: 100%;
    }

    body.watch-later-page .wl-hero__play.action-button {
        order: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        align-self: center;
        width: auto;
        min-width: min(280px, 100%);
        max-width: 100%;
        margin: 0 auto;
        padding: 12px 28px;
        gap: 10px;
        box-sizing: border-box;
    }

    body.watch-later-page .wl-hero__play img {
        margin: 0;
        flex-shrink: 0;
    }

    body.watch-later-page .wl-hero__play span {
        flex: 0 1 auto;
        text-align: center;
    }

    body.watch-later-page .wl-hero__thumb-link {
        order: 2;
        width: 100%;
    }

    body.watch-later-page .wl-hero__thumb-img {
        width: 100%;
        max-width: 100%;
        border-radius: 12px;
    }

    body.watch-later-page .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 16px;
    }

    body.watch-later-page .page-title {
        font-size: 1.35rem;
        line-height: 1.25;
    }

    body.watch-later-page .header-actions {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 8px;
    }

    body.watch-later-page .header-actions .action-button,
    body.watch-later-page .header-actions .sort-menu-button {
        width: 100%;
        justify-content: center;
        box-sizing: border-box;
    }

    body.watch-later-page .sort-menu-container {
        width: 100%;
    }

    body.watch-later-page .sort-menu-button {
        width: 100%;
        justify-content: space-between;
    }

    body.watch-later-page .video-list {
        gap: 10px;
    }

    body.watch-later-page .video-item {
        padding: 12px;
        border-radius: 14px;
        overflow: visible;
    }

    body.watch-later-page .video-item:has(.context-menu-dropdown.active) {
        z-index: 25;
    }

    body.watch-later-page .video-item__row {
        display: grid;
        grid-template-columns: 22px 112px minmax(0, 1fr) 38px;
        grid-template-rows: auto;
        align-items: center;
        column-gap: 10px;
    }

    body.watch-later-page .drag-handle-container {
        grid-column: 1;
        grid-row: 1;
        width: 22px;
        align-self: center;
        padding: 0;
    }

    body.watch-later-page .drag-handle-icon {
        opacity: 0.5;
        width: 20px;
        height: 20px;
    }

    body.watch-later-page .video-main-link {
        grid-column: 2 / 4;
        grid-row: 1;
        display: grid;
        grid-template-columns: 112px minmax(0, 1fr);
        gap: 10px;
        min-width: 0;
        align-items: center;
    }

    body.watch-later-page .thumbnail-wrapper {
        width: 112px;
    }

    body.watch-later-page .thumbnail-image {
        width: 112px;
        height: auto;
        aspect-ratio: 16 / 9;
        border-radius: 10px;
    }

    body.watch-later-page .video-details {
        min-width: 0;
        gap: 6px;
        padding-top: 0;
    }

    body.watch-later-page .video-title {
        font-size: 15px;
        font-weight: 600;
        line-height: 1.35;
        margin: 0;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        overflow: hidden;
        word-break: break-word;
    }

    body.watch-later-page .video-meta {
        font-size: 12px;
        line-height: 1.4;
        color: #8b7355;
        display: block;
    }

    body.watch-later-page .video-meta span {
        display: inline;
        white-space: normal;
    }

    body.watch-later-page .wl-note-btn {
        display: none !important;
    }

    body.watch-later-page .wl-context-note-link {
        display: flex;
    }

    body.watch-later-page .wl-context-note-link.has-note span::after {
        content: ' •';
        opacity: 0.65;
    }

    body.watch-later-page .context-menu-container {
        grid-column: 4;
        grid-row: 1;
        position: relative;
        right: auto;
        bottom: auto;
        margin: 0;
        align-self: center;
        justify-self: end;
    }

    body.watch-later-page .context-menu-button {
        width: 36px;
        height: 36px;
    }

    html.original-theme body.watch-later-page .video-item,
    body.original-theme.watch-later-page .video-item {
        background: rgba(255, 252, 247, 0.92);
        border: 1px solid rgba(180, 150, 120, 0.14);
    }

    html.original-theme body.watch-later-page .video-meta,
    body.original-theme.watch-later-page .video-meta {
        color: #8b7355 !important;
    }

    body.watch-later-page .wl-note-modal__panel {
        width: min(100%, calc(100vw - 24px));
        max-height: min(85dvh, 85vh);
        overflow-y: auto;
    }

    .context-menu-dropdown,
    .notification-dropdown,
    .user-menu-dropdown {
        max-width: calc(100vw - 20px);
    }

    .modal-content,
    .modal-content-small,
    .confirmation-modal-content,
    .add-to-playlist-modal-content,
    .studio-dialog,
    .premium-modal-content,
    .premiumx-modal,
    .stream-live-modal-content {
        width: calc(100vw - 20px) !important;
        max-width: 640px;
        max-height: min(92dvh, 92vh);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-sizing: border-box;
    }

    /* Поделиться / жалоба — компакт без лишней прокрутки (детали в common_modals.css) */
    .report-modal-content,
    #share-modal .sharex-content.share-modal-content {
        max-height: none !important;
        overflow: visible !important;
    }

    #search-suggestions-container {
        max-height: min(calc(var(--header-suggestion-row, 44px) * 8), 42vh, 360px);
    }

    body:not(.page-home) #search-suggestions-container {
        max-height: min(calc(var(--header-suggestion-row, 40px) * 7), 36vh, 300px);
    }

    body.help-page .search-suggestions {
        max-height: min(calc(44px * 8), 40vh, 300px);
    }

    body.help-page .help-hero {
        overflow: visible;
    }

    body.help-page .main-content {
        overflow-x: hidden;
    }

    .custom-select-dropdown {
        max-height: min(44vh, 320px);
        overflow-y: auto;
    }
}

@media (max-width: 480px) {
    .header-left .logo-text {
        display: none;
    }

    .search-input-wrapper input {
        border-radius: 20px 0 0 20px;
    }

    .search-button {
        border-radius: 0 20px 20px 0;
    }

    .results-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .quick-filters-container {
        width: 100%;
    }

    .filter-button {
        width: 100%;
        justify-content: center;
    }

    .video-list-title {
        font-size: 16px;
    }

    .video-list-meta,
    .video-list-description {
        font-size: 13px;
    }

    .modal-content,
    .modal-content-small,
    .confirmation-modal-content,
    .add-to-playlist-modal-content,
    .studio-dialog {
        width: calc(100vw - 14px) !important;
        border-radius: 14px;
    }

    .report-modal-content,
    #share-modal .sharex-content.share-modal-content {
        width: calc(100vw - 14px) !important;
        border-radius: 14px;
    }

    body.page-home .login-button-header span:not(.user-avatar) {
        display: none;
    }

    body.page-home .login-button-header {
        padding: 4px;
        min-width: 0;
    }
}

/* Панель загрузок у аватара — все мобильные страницы */
@media (max-width: 900px) {
    .upload-mini-panel.is-docked.visible {
        box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
    }

    html.original-theme .user-menu-container .upload-mini-panel.is-docked {
        background: #fffdf9 !important;
        border: 1px solid rgba(180, 150, 120, 0.28) !important;
        color: #4a3f35 !important;
    }

    html.original-theme .user-menu-container .upload-mini-panel-title {
        color: #5c4a3d !important;
    }

    html.original-theme .user-menu-container .upload-mini-clear-btn,
    html.original-theme .user-menu-container .upload-mini-undock-close,
    html.original-theme .user-menu-container .upload-mini-undock-collapse {
        background: linear-gradient(180deg, #fffefb 0%, #f8f2ea 100%) !important;
        border: 1px solid rgba(180, 150, 120, 0.3) !important;
        color: #6b5a48 !important;
    }

    html.original-theme .user-menu-container .upload-mini-item {
        background: #f8f4ef !important;
        border-color: rgba(180, 150, 120, 0.18) !important;
    }

    html.original-theme .user-menu-container .upload-mini-name {
        color: #4a3f35 !important;
    }

    html.original-theme .user-menu-container .upload-mini-meta,
    html.original-theme .user-menu-container .upload-mini-pct {
        color: #8b7355 !important;
    }

    html.original-theme .user-menu-container .upload-mini-bar {
        background: rgba(180, 150, 120, 0.2) !important;
    }

    html.original-theme .user-menu-container .upload-mini-bar span {
        background: #c4895a !important;
    }

    html.original-theme .upload-mini-menu-item.has-active::after {
        content: '';
        width: 8px;
        height: 8px;
        margin-left: auto;
        border-radius: 50%;
        background: #c4895a;
        flex-shrink: 0;
    }

    /* Тост «Смотреть позже» и др. — по центру снизу, без стрелки */
    .notification {
        left: 50% !important;
        right: auto !important;
        bottom: max(20px, env(safe-area-inset-bottom)) !important;
        transform: translateX(-50%) translateY(120%) !important;
        max-width: min(340px, calc(100vw - 32px));
        width: max-content;
        text-align: center;
        border-radius: 12px;
        padding: 12px 18px;
        z-index: 10050;
    }

    .notification::before,
    .notification::after {
        display: none !important;
        content: none !important;
    }

    .notification.visible {
        transform: translateX(-50%) translateY(0) !important;
    }
}

@media (min-width: 901px) {
    .upload-mini-menu-item,
    .upload-mini-mobile-anchor {
        display: none !important;
    }
}

/* Модалка «Создание канала» (lo-fi и остальные темы) */
@media (max-width: 900px) {
    #create-channel-modal.modal-overlay.visible {
        align-items: flex-start;
        padding: max(12px, env(safe-area-inset-top, 0px)) 10px 16px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #create-channel-modal .modal-content.improved-modal {
        width: min(100%, calc(100vw - 20px));
        max-width: 420px;
        margin: 0 auto;
        padding: 22px 16px 18px;
        max-height: none;
        box-sizing: border-box;
    }

    #create-channel-modal .improved-modal h2 {
        font-size: 1.25rem;
        padding-right: 32px;
    }

    #create-channel-modal .improved-modal > p {
        font-size: 13px;
        margin-bottom: 16px;
    }

    #create-channel-modal .avatar-preview {
        width: 96px;
        height: 96px;
    }

    #create-channel-modal .avatar-preview.has-initial-letter::after {
        font-size: 2.25rem;
    }

    #create-channel-modal .improved-modal input[type="text"] {
        font-size: 16px;
        min-height: 48px;
    }

    #create-channel-modal .modal-submit-btn {
        min-height: 48px;
        padding: 12px 16px;
        font-size: 15px;
    }

    #create-channel-modal .modal-close-btn {
        width: 36px;
        height: 36px;
    }
}

/* Страница «Вы» */
@media (max-width: 900px) {
    body.you-page .you-page-wrapper {
        padding: 16px 12px;
        gap: 16px;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    body.you-page .you-page-header-section {
        padding: 16px 12px;
        overflow: visible;
    }

    body.you-page .profile-header-block {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 14px;
        margin-bottom: 18px;
    }

    body.you-page .avatar-large {
        width: 96px;
        height: 96px;
    }

    body.you-page .user-details {
        width: 100%;
    }

    body.you-page .user-details h1 {
        font-size: 24px;
    }

    body.you-page .profile-actions {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        width: 100%;
    }

    body.you-page .profile-button {
        flex: none;
        width: 100%;
        min-width: 0;
        max-width: none;
        justify-content: center;
        padding: 10px 14px;
        font-size: 13px;
        box-sizing: border-box;
    }

    body.you-page .profile-button span {
        line-height: 1.25;
        text-align: center;
    }

    body.you-page .profile-button.js-data-export-open span,
    body.you-page #stream-open-live-modal-btn span {
        white-space: nowrap;
    }

    body.you-page .account-switcher-container {
        width: 100%;
        display: flex;
        justify-content: center;
        position: relative;
    }

    body.you-page .account-switcher-container .profile-button {
        width: auto;
        max-width: 100%;
        min-width: min(260px, 100%);
        margin: 0 auto;
    }

    body.you-page .account-switcher-dropdown {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: min(300px, calc(100vw - 28px));
        max-width: 300px;
    }

    body.you-page .account-switcher-dropdown.active {
        transform: translateX(-50%);
    }

    body.you-page .account-panel-header,
    body.you-page .account-list-item,
    body.you-page .account-actions {
        padding-left: 12px;
        padding-right: 12px;
    }

    body.you-page .account-panel-header {
        padding-top: 12px;
        padding-bottom: 12px;
        gap: 12px;
    }

    body.you-page .account-list {
        max-height: min(42vh, 240px);
        overflow-y: auto;
    }

    /* Подготовка к эфиру */
    .stream-live-modal-overlay {
        padding: 10px;
        align-items: center;
        box-sizing: border-box;
    }

    .stream-live-modal {
        width: 100%;
        max-width: min(100%, 520px);
        max-height: min(92dvh, 92vh);
        overflow-x: hidden;
        overflow-y: auto;
        padding: 16px 14px 18px;
        box-sizing: border-box;
        -webkit-overflow-scrolling: touch;
    }

    .stream-live-modal h3 {
        font-size: 18px;
        padding-right: 28px;
    }

    .stream-live-inline {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .stream-live-inline input {
        width: 100%;
        font-size: 11px;
    }

    .stream-copy-btn {
        width: 100%;
        min-height: 42px;
        padding: 10px 14px;
        box-sizing: border-box;
        flex-shrink: 0;
    }

    .stream-live-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-top: 8px;
    }

    .stream-live-actions .profile-button {
        width: 100%;
        justify-content: center;
        box-sizing: border-box;
    }

    /* Вкладки: сетка 3×3, все пункты видны без горизонтальной прокрутки */
    body.you-page .tab-navigation {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        overflow: visible;
        white-space: normal;
        margin-bottom: 0;
        padding-bottom: 0;
        scrollbar-width: auto;
    }

    body.you-page .tab-navigation::-webkit-scrollbar {
        display: none;
    }

    body.you-page .tab-link {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        width: auto;
        min-width: 0;
        min-height: 56px;
        padding: 8px 4px;
        font-size: 11px;
        line-height: 1.2;
        gap: 5px;
        flex-shrink: 1;
        white-space: normal;
        box-sizing: border-box;
    }

    body.you-page .tab-link span {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: normal;
        word-break: break-word;
        hyphens: auto;
    }

    body.you-page .tab-link img {
        width: 22px;
        height: 22px;
        flex-shrink: 0;
    }

    /* 7-я вкладка («Ваши видео») — по центру нижнего ряда */
    body.you-page .tab-navigation .tab-link:last-child {
        grid-column: 1 / -1;
        max-width: calc(33.333% - 4px);
        justify-self: center;
    }

    body.you-page .tab-content-area .empty-page-placeholder img {
        width: 96px !important;
        height: 96px !important;
    }

    /* ── Канал / profile (мобилка) ── */
    body.page-profile .profile-page-container {
        padding: 0 12px 20px;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    body.page-profile .main-content {
        overflow-x: hidden;
    }

    body.page-profile .profile-header-section {
        padding: 12px;
        margin-top: 12px;
        margin-bottom: 16px;
        overflow: hidden;
        box-sizing: border-box;
    }

    body.page-profile .channel-banner {
        height: clamp(100px, 28vw, 140px);
        border-radius: 10px;
        background-size: cover;
    }

    body.page-profile .profile-header {
        flex-direction: column;
        align-items: stretch;
        margin-top: -32px;
        margin-bottom: 14px;
        padding: 0;
        gap: 12px;
    }

    body.page-profile .profile-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 10px;
        width: 100%;
        min-width: 0;
    }

    body.page-profile .profile-avatar {
        width: 88px;
        height: 88px;
        border-width: 3px;
    }

    body.page-profile .profile-text {
        width: 100%;
        min-width: 0;
        padding-bottom: 0;
    }

    body.page-profile .profile-text h1 {
        font-size: 22px;
        word-break: break-word;
    }

    body.page-profile .profile-meta {
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px 10px;
        font-size: 12px;
        line-height: 1.35;
    }

    body.page-profile .profile-description {
        flex-direction: column;
        align-items: center;
        max-width: 100%;
        margin-top: 6px;
    }

    body.page-profile .profile-description-text {
        white-space: normal;
        text-align: center;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    body.page-profile .profile-actions {
        width: 100%;
        justify-content: center;
        padding-bottom: 0;
        flex-wrap: wrap;
        gap: 8px;
    }

    body.page-profile .profile-actions .profile-button {
        flex: 1 1 auto;
        min-width: min(140px, 100%);
    }

    body.page-profile .tabs-and-actions-container {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding-top: 14px;
    }

    body.page-profile .profile-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        overflow: visible;
        width: 100%;
    }

    body.page-profile .profile-tabs a {
        text-align: center;
        padding: 9px 8px;
        font-size: 13px;
        line-height: 1.2;
        white-space: normal;
        box-sizing: border-box;
    }

    body.page-profile .profile-tabs a:nth-child(5) {
        grid-column: 1 / -1;
        max-width: 50%;
        justify-self: center;
    }

    body.page-profile .tab-actions {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }

    body.page-profile .tab-actions .profile-button {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
    }

    body.page-profile .home-overview-cards {
        grid-template-columns: 1fr;
    }

    body.page-profile .video-grid,
    body.page-profile .playlist-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    body.page-profile .shelf-title {
        font-size: 18px;
    }

    body.page-profile .tab-content {
        min-width: 0;
    }

    body.page-profile .about-tab-content {
        margin-top: 12px;
    }

    body.page-profile .about-main-info {
        padding: 14px 12px;
        gap: 14px;
        border-radius: 14px;
    }

    body.page-profile .about-tab-content h3 {
        font-size: 15px;
        margin-bottom: 10px;
    }

    body.page-profile .about-text {
        font-size: 14px;
        line-height: 1.45;
    }

    /* Модалка «Мини-статистика канала» */
    body.page-profile #detailed-stats-modal .detailed-stats-content {
        width: min(100%, 360px);
        max-width: calc(100vw - 24px);
        padding: 14px 12px 16px;
        box-sizing: border-box;
    }

    body.page-profile #detailed-stats-modal .detailed-stats-content h2 {
        font-size: 17px;
        margin: 0 0 12px;
    }

    body.page-profile .detailed-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    body.page-profile .detailed-stat-item {
        padding: 10px 8px;
        border-radius: 10px;
    }

    body.page-profile .detailed-stat-label {
        font-size: 11px;
        margin: 0 0 4px;
        line-height: 1.25;
    }

    body.page-profile .detailed-stat-value {
        font-size: 20px;
        line-height: 1.15;
    }

    body.page-profile .detailed-stat-hint {
        font-size: 10px;
        margin: 4px 0 0;
        line-height: 1.25;
    }

    body.page-profile .detailed-stats-join-date {
        font-size: 12px;
        margin: 10px 0 0;
    }

    body.page-profile #detailed-stats-modal .modal-footer {
        margin-top: 12px;
        padding-top: 0;
    }

    body.page-profile .home-overview-card {
        padding: 10px 12px;
    }

    body.page-profile .home-overview-value {
        font-size: 17px;
    }

    body.page-profile .home-overview-label {
        font-size: 11px;
        margin-bottom: 4px;
    }

    /* ── Редактирование профиля (мобилка) ── */
    body.page-edit-profile .back-to-site-link {
        display: flex !important;
        position: fixed;
        top: max(10px, env(safe-area-inset-top, 0px));
        left: max(12px, env(safe-area-inset-left, 0px));
        z-index: 320;
        width: 42px;
        height: 42px;
        margin: 0;
        padding: 0;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        border: 1px solid rgba(160, 120, 80, 0.22);
        box-sizing: border-box;
        text-decoration: none;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        box-shadow: 0 2px 10px rgba(92, 68, 48, 0.12);
    }

    html.original-theme body.page-edit-profile .back-to-site-link,
    body.original-theme.page-edit-profile .back-to-site-link {
        background: rgba(255, 250, 245, 0.94) !important;
        color: #5c4536 !important;
    }

    html.light-theme body.page-edit-profile .back-to-site-link,
    body.light-theme.page-edit-profile .back-to-site-link {
        background: rgba(255, 255, 255, 0.94) !important;
        border-color: #e0e0e0 !important;
    }

    body.page-edit-profile .back-to-site-link img {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    body.page-edit-profile .back-to-site-link span {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    body.page-edit-profile .main-content-full-width {
        padding-top: max(52px, calc(env(safe-area-inset-top, 0px) + 42px));
    }

    body.page-edit-profile .profile-edit-container {
        padding: 10px 12px 18px;
        margin: 0 auto 12px;
    }

    body.page-edit-profile .profile-edit-container h1 {
        font-size: 20px;
        margin: 0 0 14px;
    }

    body.page-edit-profile .form-section {
        padding: 14px 12px;
        margin-bottom: 12px;
        border-radius: 14px;
    }

    body.page-edit-profile .form-section h2 {
        font-size: 15px;
        margin: 0 0 12px;
    }

    body.page-edit-profile .form-group {
        margin-bottom: 12px;
    }

    body.page-edit-profile .input-description,
    body.page-edit-profile .links-fill-help {
        font-size: 12px;
        line-height: 1.35;
        margin: 0 0 8px;
    }

    body.page-edit-profile .links-quick-title {
        font-size: 12px;
        margin-bottom: 6px;
    }

    body.page-edit-profile .form-group label {
        font-size: 13px;
        margin-bottom: 4px;
    }

    body.page-edit-profile .form-group input[type="text"],
    body.page-edit-profile .form-group textarea,
    body.page-edit-profile .form-group input[type="email"],
    body.page-edit-profile .recommendation-section-block input[type="text"] {
        padding: 10px 12px;
        font-size: 14px;
        border-radius: 10px;
    }

    body.page-edit-profile .form-group textarea {
        min-height: 88px;
    }

    body.page-edit-profile .char-counter,
    body.page-edit-profile .section-limit-counter,
    body.page-edit-profile .channels-limit-counter {
        font-size: 11px;
        margin-top: 4px;
    }

    body.page-edit-profile .section-limit-counter,
    body.page-edit-profile .channels-limit-counter {
        margin: 0 0 6px;
    }

    body.page-edit-profile .image-upload-section {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    body.page-edit-profile .image-preview-area {
        width: 100%;
        align-self: stretch;
    }

    body.page-edit-profile .banner-preview .image-preview {
        width: 100%;
        max-width: none;
        min-height: 100px;
        aspect-ratio: 16 / 9;
        height: auto;
        background-size: cover !important;
        background-position: center center !important;
        background-repeat: no-repeat !important;
        border-radius: 10px;
        overflow: hidden;
        box-sizing: border-box;
    }

    body.page-edit-profile .banner-preview .image-preview .banner-placeholder-icon,
    body.page-edit-profile .banner-preview .image-preview .preview-placeholder-icon {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        z-index: 1;
        pointer-events: none;
    }

    body.page-edit-profile .avatar-preview.image-preview-area {
        width: fit-content;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
        align-self: center;
    }

    body.page-edit-profile .avatar-preview .image-preview {
        width: 92px;
        height: 92px;
        min-width: 92px;
        min-height: 92px;
        max-width: 92px;
        max-height: 92px;
        padding-bottom: 0;
        aspect-ratio: 1 / 1;
        border-radius: 50%;
        overflow: hidden;
        background-size: cover !important;
        background-position: center center !important;
        flex-shrink: 0;
    }

    body.page-edit-profile .avatar-preview .avatar-placeholder {
        border-radius: 50%;
    }

    body.page-edit-profile .upload-info {
        width: 100%;
        align-items: stretch;
    }

    body.page-edit-profile .upload-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 8px;
    }

    body.page-edit-profile .upload-button,
    body.page-edit-profile .preview-toggle-button {
        width: 100%;
        justify-content: center;
        margin-top: 0;
        box-sizing: border-box;
    }

    body.page-edit-profile .live-preview-container.visible {
        max-height: none;
        overflow: visible;
        padding-top: 14px;
        margin-top: 14px;
    }

    body.page-edit-profile .live-preview-wrapper {
        border-radius: 16px;
        overflow: hidden;
        border: 1px solid rgba(160, 120, 80, 0.18);
        background: #fffaf5;
        box-shadow:
            0 4px 6px rgba(92, 68, 48, 0.04),
            0 12px 28px rgba(92, 68, 48, 0.1);
    }

    body.page-edit-profile .channel-banner-preview {
        height: clamp(100px, 32vw, 148px);
        min-height: 100px;
        background-size: cover !important;
        background-position: center center !important;
        border-radius: 0;
    }

    body.page-edit-profile .profile-header-preview {
        margin-top: -38px;
        padding: 0 14px 16px;
        align-items: stretch;
        background: linear-gradient(180deg, transparent 0%, #fffaf5 28px);
    }

    body.page-edit-profile .profile-info-preview {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 8px;
        width: 100%;
        min-width: 0;
    }

    body.page-edit-profile .profile-avatar-preview {
        width: 76px;
        height: 76px;
        min-width: 76px;
        min-height: 76px;
        aspect-ratio: 1 / 1;
        border-radius: 50%;
        border-width: 4px;
        border-color: #fffaf5;
        background-size: cover !important;
        background-position: center center !important;
        box-shadow: 0 4px 14px rgba(92, 68, 48, 0.18);
        flex-shrink: 0;
    }

    body.page-edit-profile .profile-text-preview {
        width: 100%;
        min-width: 0;
    }

    body.page-edit-profile .profile-text-preview h1 {
        font-size: 18px;
        line-height: 1.2;
        word-break: break-word;
    }

    body.page-edit-profile .profile-meta-preview {
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px 8px;
        font-size: 11px;
        line-height: 1.35;
        padding-bottom: 0;
        max-width: 100%;
    }

    body.page-edit-profile .profile-meta-preview span {
        white-space: normal;
    }

    body.page-edit-profile .upload-info h3 {
        font-size: 14px;
    }

    body.page-edit-profile .image-upload-description {
        font-size: 12px;
        margin-bottom: 10px;
    }

    body.page-edit-profile .upload-button,
    body.page-edit-profile .preview-toggle-button {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
        text-align: center;
        box-sizing: border-box;
        padding: 8px 14px;
        font-size: 13px;
    }

    body.page-edit-profile .upload-actions {
        align-items: stretch;
    }

    body.page-edit-profile .upload-info {
        align-items: center;
        text-align: center;
    }

    body.page-edit-profile .upload-info h3 {
        width: 100%;
    }

    body.page-edit-profile .channel-url-container {
        padding: 10px 10px 10px 12px;
        gap: 6px;
        align-items: center;
    }

    body.page-edit-profile .channel-url-text {
        font-size: 13px;
        min-width: 0;
    }

    body.page-edit-profile .copy-url-button {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 6px;
        margin: 0;
        flex-shrink: 0;
        border-radius: 8px;
    }

    body.page-edit-profile .copy-url-button:hover,
    body.page-edit-profile .copy-url-button:focus-visible {
        background: rgba(92, 68, 48, 0.08) !important;
        transform: none;
    }

    body.page-edit-profile .copy-url-button img {
        width: 18px;
        height: 18px;
        opacity: 0.72;
        filter: none !important;
    }

    body.page-edit-profile .links-platform-picker {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        margin-bottom: 10px;
    }

    body.page-edit-profile .link-platform-chip {
        width: 100%;
        min-width: 0;
        padding: 6px 4px;
        font-size: 10px;
        gap: 4px;
        justify-content: center;
        box-sizing: border-box;
    }

    body.page-edit-profile .link-platform-chip span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        min-width: 0;
    }

    body.page-edit-profile .link-platform-chip img {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }

    body.page-edit-profile .link-row {
        flex-wrap: wrap;
        gap: 6px;
        margin-bottom: 10px;
        align-items: flex-start;
    }

    body.page-edit-profile .link-drag-handle img {
        width: 20px;
    }

    body.page-edit-profile .link-inputs {
        flex: 1 1 100%;
        min-width: 0;
        flex-direction: column;
        gap: 8px;
    }

    body.page-edit-profile .link-row .form-group-material.has-icon {
        margin-bottom: 8px;
    }

    body.page-edit-profile .form-group-material.has-icon .link-url-hint {
        position: static;
        left: auto;
        right: auto;
        bottom: auto;
        margin-top: 4px;
        font-size: 10px;
        line-height: 1.25;
        opacity: 1;
        pointer-events: auto;
    }

    body.page-edit-profile .delete-link-btn {
        width: 36px;
        height: 36px;
        padding: 6px;
    }

    body.page-edit-profile .add-link-button,
    body.page-edit-profile .add-section-button {
        width: 100%;
        justify-content: center;
        padding: 9px 14px;
        font-size: 13px;
        margin-top: 8px;
        box-sizing: border-box;
    }

    body.page-edit-profile .recommendation-section-block {
        padding: 12px 10px;
        margin-bottom: 12px;
    }

    body.page-edit-profile .recommendation-section-header {
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 10px;
    }

    body.page-edit-profile .form-actions-static {
        gap: 8px;
        margin-top: 4px;
    }

    body.page-edit-profile .submit-button,
    body.page-edit-profile .cancel-button {
        padding: 11px 16px;
        font-size: 14px;
    }

    /* ── Плейлисты (мобилка) ── */
    body.playlists-page .playlists-page-container {
        margin: 0;
        padding: 16px 14px 20px;
        border-radius: 20px;
        box-sizing: border-box;
    }

    body.playlists-page .playlists-page-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 12px;
    }

    body.playlists-page .playlists-page-title {
        font-size: 1.35rem;
        line-height: 1.25;
        margin: 0;
    }

    body.playlists-page .playlists-header-actions--desktop {
        display: none !important;
    }

    body.playlists-page .playlists-mobile-toolbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        width: 100%;
        grid-column: 1 / -1;
    }

    body.playlists-page .playlists-mobile-toolbar .nonempty-toggle-btn {
        flex: 1 1 auto;
        min-width: 0;
        padding: 8px 12px;
        font-size: 13px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body.playlists-page .playlists-header-actions--mobile {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
    }

    body.playlists-page .playlists-header-actions--mobile .create-playlist-button,
    body.playlists-page .playlists-header-actions--mobile .delete-playlist-main-button {
        width: 44px;
        height: 44px;
        min-width: 44px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
        box-sizing: border-box;
    }

    body.playlists-page .playlists-header-actions--mobile .create-playlist-button img,
    body.playlists-page .playlists-header-actions--mobile .delete-playlist-main-button img {
        width: 22px;
        height: 22px;
        margin: 0;
    }

    body.playlists-page .nonempty-toggle-btn--desktop {
        display: none !important;
    }

    body.playlists-page .playlists-controls-wrapper {
        margin-bottom: 16px;
    }

    body.playlists-page .playlists-controls-wrapper > #playlists-filters-form {
        max-width: none;
    }

    body.playlists-page .playlists-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    body.playlists-page .controls-right {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
    }

    body.playlists-page .playlists-sort-menu {
        min-width: 0;
        position: relative;
        overflow: visible;
    }

    body.playlists-page .sort-menu-button {
        width: 100%;
        justify-content: space-between;
        box-sizing: border-box;
        min-width: 0;
    }

    body.playlists-page .sort-menu-button span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        min-width: 0;
        flex: 1 1 auto;
    }

    body.playlists-page .sort-menu-dropdown {
        left: 0;
        right: auto;
        min-width: min(100%, 260px);
        max-width: min(280px, calc(100vw - 28px));
        box-sizing: border-box;
    }

    body.playlists-page .playlists-sort-menu[data-field="sort"] .sort-menu-dropdown {
        left: auto;
        right: 0;
    }

    body.playlists-page .shelves-layout-toggle,
    body.playlists-page .view-toggle {
        grid-column: 1 / -1;
        width: 100%;
        display: flex;
    }

    body.playlists-page .shelves-layout-toggle .view-toggle-btn,
    body.playlists-page .view-toggle .view-toggle-btn {
        flex: 1 1 0;
        text-align: center;
        padding: 10px 8px;
        font-size: 13px;
    }

    body.playlists-page .playlists-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    body.playlists-page .playlists-grid.is-shelves {
        display: block;
    }

    body.playlists-page .playlists-grid.is-shelves-one .playlist-shelf-row,
    body.playlists-page .playlists-grid.is-shelves-two .playlist-shelf-row {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 0;
    }

    body.playlists-page .playlists-grid.is-shelves-two .playlist-shelf-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    body.playlists-page .playlists-grid.is-shelves .playlist-card {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 8px;
    }

    body.playlists-page .playlists-grid.is-shelves-one .playlist-card {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 10px 12px;
    }

    body.playlists-page .playlists-grid.is-shelves-one .playlist-thumbnail-container {
        width: 120px !important;
        min-width: 120px;
        max-width: 120px;
        aspect-ratio: 16 / 9;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    body.playlists-page .playlists-grid.is-shelves-two .playlist-thumbnail-container {
        width: 100% !important;
        min-width: 0;
        max-width: none;
        aspect-ratio: 16 / 9;
        margin-bottom: 0;
    }

    body.playlists-page .playlists-grid.is-shelves .playlist-info {
        margin-top: 0;
        min-width: 0;
        flex: 1 1 auto;
    }

    body.playlists-page .playlists-grid.is-shelves .playlist-info h3 {
        font-size: 14px;
        margin-bottom: 4px;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    body.playlists-page .playlists-grid.is-shelves .view-playlist-text {
        margin-top: 4px;
        font-size: 12px;
    }

    body.playlists-page .playlist-card {
        padding: 12px;
    }

    body.playlists-page .playlist-thumbnail-container {
        border-radius: 12px;
    }

    body.playlists-page .playlist-info {
        margin-top: 10px;
    }

    body.playlists-page .playlist-info h3 {
        font-size: 1rem;
    }

    body.playlists-page .modal-content {
        padding: 20px 16px;
    }

    body.playlists-page .modal-footer {
        flex-direction: column-reverse;
        gap: 10px;
    }

    body.playlists-page .modal-button {
        width: 100%;
        box-sizing: border-box;
    }

    /* ── Просмотр плейлиста (мобилка) ── */
    body.playlist-view-page .playlist-view-container {
        margin: 0;
        padding: 16px 14px 20px;
        gap: 16px;
        box-sizing: border-box;
    }

    body.playlist-view-page .playlist-info-sidebar {
        width: 100%;
        position: static;
        border-radius: 16px;
    }

    body.playlist-view-page .playlist-info-details {
        padding: 16px;
    }

    body.playlist-view-page .playlist-title {
        font-size: 1.25rem;
        line-height: 1.3;
        margin-bottom: 10px;
    }

    body.playlist-view-page .playlist-edit-actions {
        margin-bottom: 10px;
    }

    body.playlist-view-page .playlist-edit-actions .action-button,
    body.playlist-view-page .playlist-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 8px;
    }

    body.playlist-view-page .playlist-edit-actions .action-button,
    body.playlist-view-page .playlist-actions .action-button {
        width: 100%;
        justify-content: center;
        align-items: center;
        padding: 11px 18px;
        border-radius: 999px;
        box-sizing: border-box;
        gap: 10px;
    }

    body.playlist-view-page .playlist-edit-actions .action-button img,
    body.playlist-view-page .playlist-actions .action-button img {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
        margin: 0;
    }

    body.playlist-view-page .playlist-edit-actions .action-button span,
    body.playlist-view-page .playlist-actions .action-button span {
        flex: 0 1 auto;
        text-align: center;
        line-height: 1.3;
    }

    body.playlist-view-page .playlist-video-item {
        display: block;
        padding: 12px 48px 12px 12px;
        border-radius: 14px;
        position: relative;
        overflow: visible;
    }

    body.playlist-view-page .video-index {
        display: none;
    }

    body.playlist-view-page .video-main-link {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
        padding-right: 0;
        box-sizing: border-box;
    }

    body.playlist-view-page .thumbnail-wrapper-link,
    body.playlist-view-page .thumbnail-wrapper {
        width: 100%;
        height: auto;
    }

    body.playlist-view-page .thumbnail-image {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        border-radius: 12px;
    }

    body.playlist-view-page .video-details {
        padding-top: 0;
        min-width: 0;
    }

    body.playlist-view-page .video-title {
        font-size: 15px;
        -webkit-line-clamp: 3;
        line-clamp: 3;
    }

    body.playlist-view-page .context-menu-container {
        position: absolute;
        top: auto;
        right: 8px;
        bottom: 12px;
        left: auto;
        margin: 0;
        z-index: 2;
    }

    body.playlist-view-page .context-menu-button {
        opacity: 1;
        width: 36px;
        height: 36px;
        background: rgba(255, 255, 255, 0.92);
        border: 1px solid rgba(0, 0, 0, 0.08);
    }

    html.original-theme body.playlist-view-page .context-menu-button,
    body.original-theme.playlist-view-page .context-menu-button {
        background: rgba(255, 252, 247, 0.95);
        border: 1px solid rgba(180, 150, 120, 0.2);
    }

    body.playlist-view-page .playlist-video-item:has(.context-menu-dropdown.active) {
        z-index: 30;
    }

    body.playlist-view-page .empty-page-placeholder {
        padding: 24px 14px;
    }

    /* Модалка описания плейлиста */
    body.playlist-view-page #edit-playlist-description-modal .modal-content-small {
        max-width: min(420px, calc(100vw - 24px));
        padding: 20px 16px 16px;
    }

    body.playlist-view-page #edit-playlist-description-modal .modal-footer-small {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 10px;
        margin-top: 16px;
    }

    body.playlist-view-page #edit-playlist-description-modal .modal-button-small {
        width: 100%;
        padding: 12px 20px;
        text-align: center;
        box-sizing: border-box;
        border-radius: 999px;
    }

    body.playlist-view-page #edit-playlist-description-modal .playlist-description-textarea {
        min-height: 120px;
        font-size: 16px;
        border-radius: 12px;
    }

    /* ── Категория (мобилка) ── */
    body.page-category .category-page-container {
        margin: 0;
        padding: 16px 14px 20px;
        box-sizing: border-box;
    }

    body.page-category .yt-category-header {
        padding: 20px 14px;
        min-height: 0;
        margin-bottom: 14px;
        border-radius: 16px;
    }

    body.page-category .yt-category-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 10px;
    }

    body.page-category .yt-category-title {
        font-size: 1.35rem;
        line-height: 1.2;
    }

    body.page-category .yt-category-description {
        display: none;
    }

    body.page-category .video-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    body.page-category .video-card {
        overflow: visible;
        width: 100%;
        box-sizing: border-box;
    }

    body.page-category .thumbnail-wrapper {
        border-radius: 14px;
    }

    body.page-category .video-info-container {
        padding: 4px 2px 0;
    }

    body.page-category .video-title {
        font-size: 13px;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    body.page-category .video-title a {
        white-space: normal;
    }

    body.page-category .channel-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    body.page-category .channel-avatar-small {
        width: 28px;
        height: 28px;
    }

    body.page-category .channel-name-link,
    body.page-category .video-meta {
        font-size: 11px;
        transform: none;
    }

    body.page-category .video-info-container {
        position: relative;
        flex-direction: column;
        gap: 6px;
        padding-right: 0;
    }

    body.page-category .video-text-content {
        padding-right: 36px;
    }

    body.page-category .video-title {
        margin-bottom: 4px;
    }

    body.page-category .channel-details {
        flex-direction: row;
        align-items: center;
        gap: 6px;
    }

    body.page-category .context-menu-container {
        position: absolute;
        top: 0;
        right: 0;
        margin: 0;
    }

    body.page-category .context-menu-button {
        background: rgba(255, 255, 255, 0.94);
        border: 1px solid rgba(0, 0, 0, 0.06);
    }

    html.original-theme body.page-category .context-menu-button,
    body.original-theme.page-category .context-menu-button {
        background: rgba(255, 252, 247, 0.96);
        border: 1px solid rgba(180, 150, 120, 0.18);
    }

    body.page-category .context-menu-button {
        width: 32px;
        height: 32px;
        padding: 4px;
    }

    body.page-category .video-card:has(.context-menu-dropdown.active) {
        z-index: 25;
    }

    /* ── История просмотра (мобилка) ── */
    body.history-page .history-page-container {
        margin: 0;
        padding: 16px 14px 20px;
        border-radius: 20px;
        box-sizing: border-box;
    }

    body.history-page .history-page-title {
        font-size: 1.35rem;
        line-height: 1.25;
        margin: 0;
    }

    body.history-page .history-toolbar-line {
        display: grid;
        grid-template-columns: minmax(0, min(124px, 34vw)) auto;
        align-items: center;
        column-gap: 10px;
        row-gap: 0;
    }

    body.history-page .history-filter-slot {
        flex: none;
        min-width: 0;
        max-width: min(124px, 34vw);
        width: 100%;
        margin-left: 0;
        order: unset;
    }

    body.history-page .history-sort-menu .sort-menu-button {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        justify-content: space-between;
        gap: 6px;
        padding: 7px 10px;
        font-size: 12px;
    }

    body.history-page .history-sort-menu .sort-menu-button span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.history-page .history-header-actions {
        flex: none;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        width: auto;
        gap: 8px;
        order: unset;
        flex-shrink: 0;
    }

    body.history-page .history-action-pill {
        width: 44px;
        height: 44px;
        min-width: 44px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
        box-sizing: border-box;
    }

    body.history-page .history-action-pill .history-action-label {
        display: none;
    }

    body.history-page .history-action-pill img {
        width: 22px;
        height: 22px;
        margin: 0;
    }

    body.history-page .history-sort-menu .sort-menu-dropdown {
        left: 0;
        right: 0;
        min-width: 100%;
        max-width: calc(100vw - 28px);
    }

    body.history-page .history-date-header {
        font-size: 14px;
        margin: 16px 0 10px;
        padding-bottom: 8px;
    }

    body.history-page .history-video-list {
        gap: 12px;
        margin-bottom: 20px;
    }

    body.history-page .history-video-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 0;
        position: relative;
    }

    body.history-page .history-thumbnail-wrapper {
        width: 100%;
        position: relative;
    }

    body.history-page .history-thumbnail {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        border-radius: 12px;
    }

    body.history-page .history-video-details {
        padding-right: 40px;
        gap: 6px;
    }

    body.history-page .history-video-title {
        font-size: 15px;
        line-height: 1.35;
        margin: 0 0 6px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    body.history-page .history-channel-info {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px;
        padding: 6px 10px;
        margin-bottom: 4px;
        border-radius: 8px;
        background: rgba(0, 0, 0, 0.04);
    }

    html.original-theme body.history-page .history-channel-info,
    body.original-theme.history-page .history-channel-info {
        background: rgba(255, 252, 247, 0.85);
        border: 1px solid rgba(180, 150, 120, 0.14);
    }

    body.history-page .history-video-meta {
        font-size: 12px;
        line-height: 1.4;
        margin: 0;
    }

    body.history-page .history-video-description {
        display: none;
    }

    body.history-page .context-menu-container {
        position: absolute;
        top: auto;
        right: 8px;
        bottom: 8px;
        margin: 0;
    }

    body.history-page .context-menu-button {
        opacity: 1;
        width: 36px;
        height: 36px;
        background: rgba(255, 255, 255, 0.92);
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: 50%;
    }

    html.original-theme body.history-page .context-menu-button,
    body.original-theme.history-page .context-menu-button {
        background: rgba(255, 252, 247, 0.95);
        border: 1px solid rgba(180, 150, 120, 0.2);
    }

    body.history-page .history-video-item:has(.context-menu-dropdown.active) {
        z-index: 30;
    }

    body.history-page #clear-history-modal .modal-footer-small,
    body.history-page #toggle-history-modal .modal-footer-small {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 10px;
    }

    body.history-page #clear-history-modal .modal-button-small,
    body.history-page #toggle-history-modal .modal-button-small {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
        border-radius: 999px;
        padding: 12px 16px;
    }

    /* ── Загрузка видео (мобилка) ── */
    body.upload-page .back-to-site-link {
        position: fixed;
        top: max(10px, env(safe-area-inset-top, 0px));
        left: max(12px, env(safe-area-inset-left, 0px));
        z-index: 320;
        width: 42px;
        height: 42px;
        margin: 0;
        padding: 0;
        gap: 0;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        box-sizing: border-box;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        box-shadow: 0 2px 10px rgba(92, 68, 48, 0.12);
    }

    html.original-theme body.upload-page .back-to-site-link,
    body.original-theme.upload-page .back-to-site-link {
        background: rgba(255, 250, 245, 0.94) !important;
        border: 1px solid rgba(160, 120, 80, 0.22) !important;
    }

    body.upload-page .back-to-site-link img {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    body.upload-page .back-to-site-link span {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    body.upload-page .upload-container {
        min-height: 100vh;
        min-height: 100dvh;
        align-items: flex-start;
        justify-content: flex-start;
        padding: max(52px, calc(env(safe-area-inset-top, 0px) + 42px)) 12px 24px;
        padding-left: max(12px, env(safe-area-inset-left, 0px));
        padding-right: max(12px, env(safe-area-inset-right, 0px));
        box-sizing: border-box;
    }

    body.upload-page .upload-form-wrapper {
        padding: 18px 14px 20px;
        border-radius: 16px;
        max-width: 100%;
    }

    body.upload-page .upload-form-wrapper h2 {
        font-size: 20px;
        margin-bottom: 18px;
        text-align: center;
        line-height: 1.25;
    }

    body.upload-page .form-group {
        margin-bottom: 16px;
    }

    body.upload-page .form-group > label,
    body.upload-page .form-group-label {
        font-size: 13px;
        margin-bottom: 6px;
    }

    body.upload-page .upload-hint {
        font-size: 12px;
        line-height: 1.4;
        margin: 0 0 8px;
    }

    body.upload-page .form-group input[type="text"],
    body.upload-page .form-group textarea,
    body.upload-page .custom-select-button {
        padding: 10px 12px;
        font-size: 14px;
        border-radius: 10px;
    }

    body.upload-page .form-group textarea {
        min-height: 100px;
    }

    body.upload-page .field-meta {
        margin-top: 4px;
    }

    body.upload-page .file-input-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    body.upload-page .file-input-label {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 10px 14px;
        box-sizing: border-box;
    }

    body.upload-page .file-name-display {
        width: 100%;
        text-align: center;
        font-size: 12px;
        padding: 0 4px;
    }

    body.upload-page .edit-button {
        margin-left: 0;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        gap: 6px;
        padding: 10px 12px;
        box-sizing: border-box;
    }

    body.upload-page .file-input-wrapper .edit-button + .edit-button {
        margin-top: 0;
    }

    body.upload-page .submit-button-wrapper {
        margin-top: 20px;
        padding-top: 18px;
        display: flex;
        justify-content: center;
    }

    body.upload-page #upload-submit-btn,
    body.upload-page .submit-button-wrapper button {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 14px 16px;
        font-size: 15px;
        border-radius: 999px;
        box-sizing: border-box;
    }

    body.upload-page .radio-group label,
    body.upload-page .checkbox-group label {
        font-size: 14px;
        align-items: flex-start;
    }

    body.upload-page .playlist-input-container {
        margin-left: 0;
    }

    /* Модалки загрузки на телефоне */
    body.upload-page .modal-overlay {
        padding: max(8px, env(safe-area-inset-top, 0px)) 8px 12px;
        align-items: flex-start;
    }

    body.upload-page .modal-content {
        width: 100%;
        max-width: 100%;
        max-height: min(96dvh, calc(100dvh - env(safe-area-inset-top, 0px) - 12px));
        border-radius: 16px;
    }

    body.upload-page .modal-editor-fixed-head h3,
    body.upload-page .adv-editor-topbar h3,
    body.upload-page #crop-image-modal .studio-crop-editor-head h3 {
        text-align: center;
        font-size: 16px;
        padding-left: 12px;
        padding-right: 12px;
    }

    body.upload-page #crop-image-modal .studio-crop-editor-tabs,
    body.upload-page .crop-editor-tabs {
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
        padding: 0 10px 10px;
    }

    body.upload-page .editor-toolbar.editor-toolbar-inline {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
        padding: 10px 12px;
    }

    body.upload-page .toolbar-label {
        width: 100%;
        text-align: center;
        margin-bottom: 2px;
    }

    body.upload-page .modal-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 12px;
    }

    body.upload-page .modal-btn-primary,
    body.upload-page .modal-btn-secondary {
        width: 100%;
        justify-content: center;
        text-align: center;
        padding: 12px 14px;
        box-sizing: border-box;
    }

    body.upload-page .thumb-style-control {
        gap: 6px;
    }

    body.upload-page .ue-control-top {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 4px 8px;
    }

    body.upload-page .upload-thumb-presets-row {
        justify-content: center;
    }

    body.upload-page .vep-head {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: space-between;
    }

    body.upload-page .vep-presets {
        justify-content: center;
    }

    body.upload-page .vep-tabs {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }

    body.upload-page .vep-toggles label {
        font-size: 13px;
        line-height: 1.35;
        align-items: flex-start;
    }

    body.upload-page .timeline-hint,
    body.upload-page .editor-status {
        text-align: center;
        padding-left: 8px;
        padding-right: 8px;
    }

    body.upload-page .frame-thumb-toolbar {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    body.upload-page .frame-thumb-note {
        text-align: center;
        flex: 1 1 100%;
    }

    body.upload-page .adv-editor-body {
        gap: 12px;
    }

    body.upload-page .modal-editor-scroll {
        padding: 10px 12px;
    }
}
