        :root {
            --primary: #6c5ce7;
            --primary-light: #a29bfe;
            --accent: #00cec9;
            --bg: #f8faff;
            --text: #2d3436;
            --white: #ffffff;
            --shadow: 0 10px 30px rgba(108, 92, 231, 0.1);
            --border: #e2e8f0;
            --text-secondary: #636e72;
            --card-bg: #ffffff;
        }

        html.dark-mode {
            --bg: #0f172a;
            --text: #f1f5f9;
            --white: #1e293b;
            --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            --border: #334155;
            --text-secondary: #94a3b8;
            --card-bg: #1e293b;
        }

        *,
        *::before,
        *::after {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            font-family: 'Montserrat', sans-serif;
            background: var(--bg);
            color: var(--text);
            transition: background 0.3s, color 0.3s;
            min-height: 100vh;
        }

        .navbar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px 40px;
            background: var(--white);
            box-shadow: var(--shadow);
        }

        .navbar-brand {
            font-family: 'Nunito', sans-serif;
            font-size: 1.5rem;
            color: var(--primary);
            font-weight: 800;
            text-decoration: none;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .navbar-nav {
            display: flex;
            gap: 16px;
            align-items: center;
        }

        .theme-toggle {
            background: none;
            border: none;
            font-size: 1.3rem;
            color: var(--text);
            cursor: pointer;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: 0.2s;
        }

        .theme-toggle:hover {
            color: var(--primary);
            background: var(--bg);
        }

        .back-bar {
            background: var(--white);
            padding: 12px 40px;
            border-bottom: 1px solid var(--border);
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 10px;
        }

        .btn-back {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            color: var(--text);
            text-decoration: none;
            font-weight: 600;
            font-size: 0.95rem;
            transition: 0.2s;
        }

        .btn-back:hover {
            color: var(--primary);
        }

        .subject-hero {
            padding: 40px 20px;
            background: linear-gradient(135deg, var(--primary) 0%, #4834d4 100%);
            color: white;
            border-radius: 0 0 36px 36px;
            margin-bottom: 35px;
            box-shadow: var(--shadow);
            text-align: center;
            position: relative;
        }

        .subject-icon-badge {
            width: 72px;
            height: 72px;
            border-radius: 22px;
            background: rgba(255, 255, 255, 0.2);
            backdrop-filter: blur(10px);
            margin: 0 auto 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 2.2rem;
            border: 2px solid rgba(255, 255, 255, 0.35);
        }

        .subject-hero h1 {
            font-family: 'Nunito', sans-serif;
            font-size: 2.3rem;
            margin-bottom: 8px;
            letter-spacing: -0.5px;
        }

        .subject-hero p {
            font-size: 1rem;
            opacity: 0.9;
            max-width: 650px;
            margin: 0 auto 18px;
        }

        .hero-actions {
            display: flex;
            justify-content: center;
            gap: 12px;
            flex-wrap: wrap;
        }

        .btn-hero-action {
            background: rgba(255, 255, 255, 0.18);
            backdrop-filter: blur(8px);
            border: 1px solid rgba(255, 255, 255, 0.3);
            color: white;
            padding: 8px 18px;
            border-radius: 14px;
            text-decoration: none;
            font-weight: 600;
            font-size: 0.88rem;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            transition: 0.2s;
        }

        .btn-hero-action:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: translateY(-2px);
        }

        .main-container {
            max-width: 1200px;
            margin: 0 auto 60px;
            padding: 0 20px;
        }

        /* Панель фильтров и поиска */
        .controls-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 16px;
            margin-bottom: 25px;
            flex-wrap: wrap;
        }

        .filter-pills {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }

        .filter-pill {
            background: var(--white);
            border: 1px solid var(--border);
            color: var(--text-secondary);
            padding: 8px 16px;
            border-radius: 20px;
            font-size: 0.88rem;
            font-weight: 600;
            cursor: pointer;
            transition: 0.2s;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .filter-pill:hover,
        .filter-pill.active {
            background: var(--primary);
            color: white;
            border-color: var(--primary);
        }

        .search-box {
            position: relative;
            min-width: 260px;
            flex-grow: 1;
            max-width: 400px;
        }

        .search-box input {
            width: 100%;
            padding: 10px 16px 10px 40px;
            border-radius: 14px;
            border: 1px solid var(--border);
            background: var(--white);
            color: var(--text);
            font-family: inherit;
            font-size: 0.92rem;
            outline: none;
            transition: 0.2s;
        }

        .search-box input:focus {
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
        }

        .search-box i {
            position: absolute;
            left: 14px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-secondary);
        }

        /* Секция подпапок */
        .subfolders-section {
            margin-bottom: 30px;
        }

        .section-label {
            font-family: 'Nunito', sans-serif;
            font-size: 1.25rem;
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            gap: 8px;
            color: var(--primary);
        }

        .subfolders-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
            gap: 15px;
            margin-bottom: 30px;
        }

        .subfolder-card {
            background: var(--card-bg);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 16px;
            text-decoration: none;
            color: var(--text);
            display: flex;
            align-items: center;
            gap: 12px;
            transition: 0.2s;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
        }

        .subfolder-card:hover {
            transform: translateY(-3px);
            border-color: var(--primary);
            box-shadow: var(--shadow);
        }

        .subfolder-icon {
            width: 44px;
            height: 44px;
            border-radius: 12px;
            background: rgba(108, 92, 231, 0.12);
            color: var(--primary);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.25rem;
            flex-shrink: 0;
        }

        .subfolder-title {
            font-weight: 700;
            font-size: 0.95rem;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        /* Список файлов */
        .files-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
            gap: 20px;
        }

        .file-card {
            background: var(--card-bg);
            border-radius: 20px;
            border: 1px solid var(--border);
            padding: 20px;
            box-shadow: var(--shadow);
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            transition: 0.2s;
            position: relative;
            container-type: inline-size;
        }

        .file-card:hover {
            transform: translateY(-4px);
            border-color: var(--primary);
        }

        /* Превью видеолекции (16:9 + интерактивный просмотр слайдов) */
        .lecture-thumb-wrap {
            position: relative;
            margin: -20px -20px 16px -20px;
            border-radius: 19px 19px 0 0;
            overflow: hidden;
            background: #0f172a;
            aspect-ratio: 16 / 9;
            cursor: pointer;
            border-bottom: 1px solid var(--border);
            user-select: none;
        }

        .lecture-thumb-img {
            width: 100%;
            height: 100%;
            aspect-ratio: 16 / 9;
            object-fit: cover;
            display: block;
            transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
            background: #0f172a;
        }

        .lecture-thumb-wrap:hover .lecture-thumb-img {
            transform: scale(1.03);
        }

        .lecture-thumb-overlay {
            position: absolute;
            inset: 0;
            background: linear-gradient(180deg, rgba(15, 23, 42, 0.35) 0%, rgba(15, 23, 42, 0.08) 45%, rgba(15, 23, 42, 0.72) 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background 0.25s ease;
        }

        .lecture-thumb-wrap:hover .lecture-thumb-overlay {
            background: linear-gradient(180deg, rgba(15, 23, 42, 0.45) 0%, rgba(15, 23, 42, 0.16) 45%, rgba(15, 23, 42, 0.8) 100%);
        }

        .lecture-thumb-play {
            width: 54px;
            height: 54px;
            border-radius: 50%;
            background: rgba(108, 92, 231, 0.92);
            color: #ffffff;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.2rem;
            padding-left: 3px;
            box-shadow: 0 8px 24px rgba(108, 92, 231, 0.55), 0 0 0 4px rgba(255, 255, 255, 0.18);
            transition: transform 0.22s ease, background 0.22s ease, opacity 0.22s ease;
        }

        .lecture-thumb-wrap:hover .lecture-thumb-play {
            transform: scale(1.1);
            background: #5640e3;
        }

        .lecture-thumb-wrap.is-scrubbing .lecture-thumb-play {
            opacity: 0.22;
            transform: scale(0.9);
        }

        .lecture-thumb-pill {
            position: absolute;
            padding: 4px 10px;
            border-radius: 8px;
            font-size: 0.74rem;
            font-weight: 700;
            color: #f8fafc;
            background: rgba(15, 23, 42, 0.82);
            backdrop-filter: blur(6px);
            border: 1px solid rgba(255, 255, 255, 0.14);
            display: inline-flex;
            align-items: center;
            gap: 5px;
            pointer-events: none;
            line-height: 1.2;
        }

        .lecture-thumb-pill.pill-slides {
            top: 10px;
            left: 10px;
        }

        .lecture-thumb-pill.pill-scrub-ts {
            top: 10px;
            right: 10px;
            background: rgba(108, 92, 231, 0.92);
            border-color: rgba(255, 255, 255, 0.25);
            display: none;
        }

        .lecture-thumb-wrap.is-scrubbing .lecture-thumb-pill.pill-scrub-ts {
            display: inline-flex;
        }

        .lecture-thumb-pill.pill-duration {
            bottom: 12px;
            right: 10px;
            font-family: monospace;
            font-size: 0.78rem;
        }

        .lecture-thumb-caption {
            position: absolute;
            bottom: 12px;
            left: 10px;
            right: 84px;
            font-size: 0.74rem;
            font-weight: 600;
            color: #f1f5f9;
            text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.2s ease;
        }

        .lecture-thumb-wrap.is-scrubbing .lecture-thumb-caption {
            opacity: 1;
        }

        .lecture-thumb-segments {
            position: absolute;
            left: 8px;
            right: 8px;
            bottom: 4px;
            display: flex;
            gap: 4px;
            height: 3px;
            pointer-events: none;
            opacity: 0.75;
            transition: opacity 0.2s ease;
        }

        .lecture-thumb-wrap:hover .lecture-thumb-segments {
            opacity: 1;
        }

        .lecture-thumb-seg {
            flex: 1;
            height: 100%;
            border-radius: 999px;
            background: rgba(255, 255, 255, 0.32);
            transition: background 0.15s ease;
        }

        .lecture-thumb-seg.is-active {
            background: #38bdf8;
            box-shadow: 0 0 6px rgba(56, 189, 248, 0.8);
        }

        .file-header {
            display: flex;
            gap: 14px;
            margin-bottom: 16px;
            align-items: flex-start;
        }

        .file-icon-box {
            width: 52px;
            height: 52px;
            border-radius: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.6rem;
            flex-shrink: 0;
        }

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

        .file-title {
            font-family: 'Nunito', sans-serif;
            font-weight: 800;
            font-size: 1.05rem;
            line-height: 1.35;
            margin-bottom: 6px;
            word-break: break-word;
        }

        .file-meta {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 0.8rem;
            color: var(--text-secondary);
            font-weight: 600;
        }

        .file-badge {
            padding: 3px 8px;
            border-radius: 6px;
            font-size: 0.72rem;
            font-weight: 700;
            text-transform: uppercase;
        }

        .type-video { color: #6c5ce7; background: rgba(108, 92, 231, 0.12); }
        .type-audio { color: #00cec9; background: rgba(0, 206, 201, 0.12); }
        .type-pdf { color: #ff7675; background: rgba(255, 118, 117, 0.12); }
        .type-doc { color: #0984e3; background: rgba(9, 132, 227, 0.12); }
        .type-presentation { color: #e17055; background: rgba(225, 112, 85, 0.12); }
        .type-excel { color: #00b894; background: rgba(0, 184, 148, 0.12); }
        .type-archive { color: #fdcb6e; background: rgba(253, 203, 110, 0.15); }
        .type-code { color: #a29bfe; background: rgba(162, 155, 254, 0.15); }
        .type-file { color: #636e72; background: rgba(99, 110, 114, 0.12); }

        .file-actions {
            display: flex;
            gap: 10px;
            margin-top: 14px;
            padding-top: 14px;
            border-top: 1px solid var(--border);
        }

        .btn-stream {
            flex: 1;
            background: var(--primary);
            color: white;
            border: none;
            padding: 10px 14px;
            border-radius: 12px;
            font-weight: 700;
            font-size: 0.88rem;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            transition: 0.2s;
            text-decoration: none;
        }

        .btn-stream:hover {
            background: #5640e3;
            transform: scale(1.02);
        }

        .btn-download {
            background: var(--bg);
            color: var(--text);
            border: 1px solid var(--border);
            padding: 10px 14px;
            border-radius: 12px;
            font-weight: 600;
            font-size: 0.88rem;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            transition: 0.2s;
            text-decoration: none;
        }

        .btn-download:hover {
            color: var(--primary);
            border-color: var(--primary);
        }

        .lecture-badges-row {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-top: 8px;
        }

        .badge-conspect {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 4px 10px;
            border-radius: 999px;
            font-size: 0.75rem;
            font-weight: 700;
            text-decoration: none;
            background: rgba(0, 184, 148, 0.15);
            color: #00b894;
            border: 1px solid rgba(0, 184, 148, 0.35);
            transition: 0.2s;
        }

        .badge-conspect:hover {
            background: #00b894;
            color: #ffffff;
        }

        .badge-job-status {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 4px 10px;
            border-radius: 999px;
            font-size: 0.74rem;
            font-weight: 700;
            text-decoration: none;
            background: rgba(9, 132, 227, 0.14);
            color: #0984e3;
            border: 1px solid rgba(9, 132, 227, 0.3);
        }

        .badge-job-status.status-failed,
        .badge-job-status.status-paused_budget {
            background: rgba(255, 118, 117, 0.15);
            color: #d63031;
            border-color: rgba(255, 118, 117, 0.35);
        }

        .lecture-card-footer {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 10px;
        }

        .btn-conspect-view {
            flex: 1;
            background: rgba(0, 184, 148, 0.12);
            color: #00b894;
            border: 1px solid rgba(0, 184, 148, 0.35);
            padding: 8px 12px;
            border-radius: 10px;
            font-weight: 700;
            font-size: 0.82rem;
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            transition: 0.2s;
        }

        .btn-conspect-view:hover {
            background: #00b894;
            color: #ffffff;
        }

        .btn-conspect-view.is-queued {
            background: rgba(9, 132, 227, 0.12);
            color: #0984e3;
            border-color: rgba(9, 132, 227, 0.35);
        }

        .btn-conspect-view.is-queued:hover {
            background: #0984e3;
            color: #ffffff;
        }

        .btn-conspect-make {
            flex: 1;
            background: rgba(108, 92, 231, 0.1);
            color: var(--primary);
            border: 1px dashed var(--primary);
            padding: 8px 12px;
            border-radius: 10px;
            font-weight: 700;
            font-size: 0.82rem;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            transition: 0.2s;
            font-family: inherit;
        }

        .btn-conspect-make:hover:not(:disabled) {
            background: var(--primary);
            color: #ffffff;
            border-style: solid;
        }

        .btn-conspect-make:disabled {
            opacity: 0.65;
            cursor: wait;
        }

        .btn-conspect-restart {
            flex: 0 0 auto;
            padding: 8px 11px;
        }

        .lecture-inline-progress {
            margin-top: 10px;
            padding: 10px 12px;
            border-radius: 12px;
            background: rgba(108, 92, 231, 0.06);
            border: 1px solid rgba(108, 92, 231, 0.2);
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .lecture-inline-progress-bar {
            width: 100%;
            height: 6px;
            border-radius: 999px;
            background: rgba(108, 92, 231, 0.15);
            overflow: hidden;
        }

        .lecture-inline-progress-fill {
            height: 100%;
            width: var(--job-pct, 12%);
            background: linear-gradient(90deg, var(--primary), var(--accent));
            border-radius: 999px;
            transition: width 0.4s ease;
        }

        .lecture-inline-progress-text {
            font-size: 0.76rem;
            color: var(--text-secondary);
            font-weight: 600;
            display: flex;
            justify-content: space-between;
            gap: 8px;
        }

        .flash-banner-stack {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin-bottom: 20px;
        }

        .flash-banner-item {
            background: var(--card-bg);
            border: 1px solid var(--border);
            border-left: 4px solid var(--primary);
            border-radius: 14px;
            padding: 12px 18px;
            font-size: 0.9rem;
            font-weight: 600;
            box-shadow: var(--shadow);
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
        }

        /* Toast notifications (modern-web-guidance: persistent-toast-notifications) */
        .toast-region {
            position: fixed;
            bottom: 24px;
            right: 24px;
            z-index: 99990;
            display: flex;
            flex-direction: column;
            gap: 10px;
            pointer-events: none;
        }

        .conspect-toast {
            pointer-events: auto;
            margin: 0;
            inset: auto 24px 24px auto;
            position: fixed;
            max-width: 400px;
            width: calc(100vw - 48px);
            background: var(--card-bg);
            color: var(--text);
            border: 1px solid var(--border);
            border-left: 4px solid var(--primary);
            border-radius: 16px;
            padding: 14px 16px;
            box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
            opacity: 0;
            transform: translateY(12px);
            transition: opacity 0.25s ease, transform 0.25s ease, overlay 0.25s ease, display 0.25s ease;
            transition-behavior: allow-discrete;
        }

        .conspect-toast[popover]:is(:popover-open, .\:popover-open),
        .conspect-toast.is-visible {
            display: flex;
            flex-direction: column;
            gap: 8px;
            opacity: 1;
            transform: translateY(0);
        }

        .conspect-toast + .conspect-toast {
            margin-top: 1rem;
        }

        .conspect-toast-head {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            gap: 10px;
            font-weight: 700;
            font-size: 0.88rem;
        }

        .conspect-toast-close {
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            font-size: 1rem;
            line-height: 1;
            padding: 2px 4px;
        }

        /* Модальный плеер для видео */
        .video-modal {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.85);
            backdrop-filter: blur(8px);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 99999;
            padding: 20px;
        }

        .video-modal.active {
            display: flex;
        }

        .video-modal-content {
            background: #0f172a;
            border-radius: 24px;
            width: 100%;
            max-width: 960px;
            overflow: hidden;
            box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
            border: 1px solid #334155;
            animation: modalIn 0.25s ease-out;
            display: flex;
            flex-direction: column;
        }

        @keyframes modalIn {
            from { opacity: 0; transform: scale(0.96); }
            to { opacity: 1; transform: scale(1); }
        }

        .video-modal-header {
            padding: 16px 22px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: #1e293b;
            color: white;
            border-bottom: 1px solid #334155;
        }

        .video-modal-header h3 {
            font-family: 'Nunito', sans-serif;
            font-size: 1.15rem;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            max-width: 80%;
        }

        .btn-close-video {
            background: none;
            border: none;
            color: #94a3b8;
            font-size: 1.4rem;
            cursor: pointer;
            padding: 4px;
            transition: 0.2s;
        }

        .btn-close-video:hover {
            color: #ff7675;
        }

        .video-wrapper {
            position: relative;
            width: 100%;
            background: black;
            aspect-ratio: 16 / 9;
        }

        .video-wrapper video {
            width: 100%;
            height: 100%;
            display: block;
        }

        /* Overlay загрузки и буферизации видео */
        .video-loading-overlay {
            position: absolute;
            inset: 0;
            background: radial-gradient(circle at center, rgba(15, 23, 42, 0.94) 0%, rgba(2, 6, 23, 0.98) 100%);
            z-index: 10;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
            backdrop-filter: blur(8px);
            opacity: 1;
            transition: opacity 0.35s ease, visibility 0.35s ease;
        }

        .video-loading-overlay.hidden {
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
        }

        .video-loader-card {
            background: rgba(30, 41, 59, 0.88);
            border: 1px solid rgba(255, 255, 255, 0.14);
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
            border-radius: 20px;
            padding: 24px 28px;
            max-width: 480px;
            width: 100%;
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
            gap: 12px;
            position: relative;
            overflow: hidden;
        }

        .video-loader-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 3px;
            background: linear-gradient(90deg, #6366f1, #38bdf8, #818cf8);
            background-size: 200% 100%;
            animation: shimmerLine 2s infinite linear;
        }

        @keyframes shimmerLine {
            0% { background-position: 100% 0; }
            100% { background-position: -100% 0; }
        }

        .video-loader-badge {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            background: rgba(99, 102, 241, 0.16);
            color: #818cf8;
            border: 1px solid rgba(99, 102, 241, 0.3);
            border-radius: 999px;
            padding: 5px 14px;
            font-size: 0.82rem;
            font-weight: 700;
            letter-spacing: 0.3px;
        }

        .pulse-icon {
            display: inline-block;
            animation: pulsePlay 1.5s infinite ease-in-out;
        }

        @keyframes pulsePlay {
            0%, 100% { transform: scale(1); opacity: 0.8; }
            50% { transform: scale(1.25); opacity: 1; color: #38bdf8; }
        }

        .video-loader-title {
            color: #f8fafc;
            font-size: 1.05rem;
            font-weight: 700;
            line-height: 1.35;
            max-width: 100%;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .video-loader-meta {
            color: #94a3b8;
            font-size: 0.8rem;
            margin-top: -4px;
        }

        /* Прогресс-бар загрузки */
        .video-progress-container {
            width: 100%;
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-top: 4px;
        }

        .video-progress-track {
            width: 100%;
            height: 10px;
            background: rgba(15, 23, 42, 0.75);
            border-radius: 999px;
            overflow: hidden;
            border: 1px solid rgba(255, 255, 255, 0.08);
            position: relative;
        }

        .video-progress-fill {
            height: 100%;
            width: 5%;
            background: linear-gradient(90deg, #4f46e5 0%, #38bdf8 50%, #6366f1 100%);
            background-size: 200% 100%;
            border-radius: 999px;
            transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
            animation: shimmerLine 2s infinite linear;
            box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
        }

        .video-progress-stats {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.82rem;
        }

        .progress-percent {
            font-weight: 800;
            color: #38bdf8;
            font-size: 0.95rem;
            font-family: monospace;
        }

        .progress-details {
            color: #94a3b8;
            font-size: 0.78rem;
        }

        .video-loader-hint {
            font-size: 0.76rem;
            color: #64748b;
            line-height: 1.4;
            max-width: 90%;
        }

        .video-loader-timer {
            font-size: 0.78rem;
            color: #94a3b8;
            background: rgba(15, 23, 42, 0.5);
            padding: 3px 10px;
            border-radius: 6px;
        }

        .video-loader-timer span {
            color: #f1f5f9;
            font-weight: 700;
        }

        .video-loader-actions {
            margin-top: 4px;
            display: flex;
            flex-direction: column;
            gap: 6px;
            width: 100%;
            align-items: center;
        }

        .loader-alt-label {
            font-size: 0.72rem;
            color: #64748b;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            font-weight: 600;
        }

        .loader-alt-btns {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
            justify-content: center;
        }

        .loader-alt-btn {
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.12);
            color: #cbd5e1;
            text-decoration: none;
            padding: 6px 12px;
            border-radius: 8px;
            font-size: 0.75rem;
            font-weight: 600;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            transition: 0.2s;
        }

        .loader-alt-btn:hover {
            background: rgba(255, 255, 255, 0.16);
            color: white;
            border-color: rgba(255, 255, 255, 0.25);
        }

        /* Компактный плавающий бейдж буферизации во время воспроизведения */
        .video-buffering-pill {
            position: absolute;
            top: 16px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(15, 23, 42, 0.88);
            border: 1px solid rgba(56, 189, 248, 0.4);
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
            backdrop-filter: blur(8px);
            color: #f8fafc;
            padding: 6px 16px;
            border-radius: 999px;
            font-size: 0.82rem;
            display: flex;
            align-items: center;
            gap: 10px;
            z-index: 8;
            pointer-events: none;
            animation: fadeInPill 0.2s ease-out;
        }

        .video-buffering-pill i {
            color: #38bdf8;
        }

        @keyframes fadeInPill {
            from { opacity: 0; transform: translate(-50%, -8px); }
            to { opacity: 1; transform: translate(-50%, 0); }
        }

        .btn-drive-ext {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 36px;
            height: 36px;
            border-radius: 10px;
            background: rgba(255, 255, 255, 0.06);
            color: var(--text-secondary);
            border: 1px solid var(--border);
            text-decoration: none;
            font-size: 0.95rem;
            transition: all 0.2s;
        }

        .btn-drive-ext:hover {
            background: rgba(255, 255, 255, 0.14);
            color: var(--primary);
            border-color: var(--primary);
            transform: translateY(-1px);
        }

        .video-modal-footer {
            padding: 14px 22px;
            background: #1e293b;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 14px;
            color: #94a3b8;
            font-size: 0.85rem;
        }

        .speed-control-container {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .speed-label {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 0.82rem;
            font-weight: 700;
            color: #94a3b8;
        }

        .speed-btn-group {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .speed-btn {
            background: #334155;
            border: none;
            color: white;
            padding: 5px 11px;
            border-radius: 8px;
            font-size: 0.8rem;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .speed-btn:hover,
        .speed-btn.active {
            background: var(--primary);
            box-shadow: 0 2px 8px rgba(108, 92, 231, 0.4);
            transform: translateY(-1px);
        }

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

        .video-actions {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .video-action-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 7px;
            padding: 8px 16px;
            border-radius: 10px;
            font-size: 0.82rem;
            font-weight: 600;
            text-decoration: none;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            white-space: nowrap;
        }

        .video-action-btn.drive-btn {
            background: rgba(255, 255, 255, 0.08);
            color: #e2e8f0;
            border: 1px solid rgba(255, 255, 255, 0.14);
        }

        .video-action-btn.drive-btn:hover {
            background: rgba(255, 255, 255, 0.16);
            color: #fff;
            transform: translateY(-1px);
        }

        .video-action-btn.download-btn {
            background: var(--primary);
            color: #fff;
            border: 1px solid transparent;
            box-shadow: 0 4px 12px rgba(108, 92, 231, 0.35);
        }

        .video-action-btn.download-btn:hover {
            opacity: 0.92;
            transform: translateY(-1px);
        }

        .video-action-btn:active {
            transform: scale(0.96);
        }

        /* Состояние "Пусто" */
        .empty-placeholder {
            text-align: center;
            padding: 60px 20px;
            background: var(--card-bg);
            border-radius: 28px;
            box-shadow: var(--shadow);
            border: 1px solid var(--border);
            max-width: 600px;
            margin: 40px auto;
        }

        .empty-placeholder i {
            font-size: 3.5rem;
            color: var(--primary-light);
            margin-bottom: 18px;
        }

        .empty-placeholder h3 {
            font-family: 'Nunito', sans-serif;
            font-size: 1.4rem;
            margin-bottom: 8px;
        }

        .empty-placeholder p {
            color: var(--text-secondary);
            font-size: 0.92rem;
            line-height: 1.6;
            margin-bottom: 20px;
        }

        @media (max-width: 768px) {
            .navbar { padding: 14px 20px; }
            .back-bar { padding: 10px 20px; }
            .subject-hero h1 { font-size: 1.8rem; }
            .files-grid { grid-template-columns: 1fr; }
        }

        @media (max-width: 640px) {
            .navbar { padding: 12px 16px; }
            .back-bar { padding: 8px 16px; }
            .subject-hero h1 { font-size: 1.5rem; }

            .video-modal {
                padding: 0;
                align-items: flex-end;
            }

            .video-modal-content {
                width: 100%;
                max-width: 100%;
                border-radius: 20px 20px 0 0;
                border-left: none;
                border-right: none;
                border-bottom: none;
                max-height: 94vh;
                animation: slideUpModal 0.28s cubic-bezier(0.16, 1, 0.3, 1);
            }

            @keyframes slideUpModal {
                from { transform: translateY(100%); opacity: 0.4; }
                to { transform: translateY(0); opacity: 1; }
            }

            .video-modal-header {
                padding: 12px 16px;
            }

            .video-modal-header h3 {
                max-width: calc(100% - 46px);
                font-size: 0.92rem;
                line-height: 1.3;
            }

            .btn-close-video {
                width: 36px;
                height: 36px;
                border-radius: 50%;
                background: rgba(255, 255, 255, 0.08);
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 1.15rem;
                color: #cbd5e1;
                flex-shrink: 0;
            }

            .btn-close-video:active {
                background: rgba(239, 68, 68, 0.25);
                color: #ef4444;
            }

            .video-modal-footer {
                padding: 14px 16px 20px 16px;
                flex-direction: column;
                align-items: stretch;
                gap: 12px;
                background: #0f172a;
            }

            .speed-control-container {
                width: 100%;
                justify-content: space-between;
                gap: 6px;
            }

            .speed-label {
                font-size: 0.78rem;
            }

            .speed-btn-group {
                gap: 4px;
            }

            .speed-btn {
                padding: 6px 9px;
                font-size: 0.76rem;
                min-width: 40px;
                text-align: center;
            }

            .video-actions {
                width: 100%;
                display: flex;
                gap: 8px;
            }

            .video-action-btn {
                flex: 1;
                padding: 10px 8px;
                font-size: 0.8rem;
                border-radius: 10px;
            }

            .video-loader-card {
                padding: 16px 14px;
                border-radius: 16px;
                gap: 10px;
            }

            .video-loader-title {
                font-size: 0.92rem;
            }

            .video-loader-hint {
                font-size: 0.72rem;
            }
        }

        @media (max-height: 520px) and (orientation: landscape) {
            .video-modal {
                padding: 0;
                align-items: center;
            }
            .video-modal-content {
                height: 100vh;
                max-height: 100vh;
                border-radius: 0;
                border: none;
            }
            .video-wrapper {
                flex: 1;
                height: calc(100vh - 84px);
                aspect-ratio: auto;
            }
            .video-modal-header {
                padding: 6px 14px;
            }
            .video-modal-footer {
                padding: 6px 14px;
                flex-direction: row;
                justify-content: space-between;
                align-items: center;
            }
            .video-actions {
                width: auto;
            }
        }
    
