/* CSS Variables & Design Tokens */
:root {
    --bg-color: #09090b;
    --card-bg: rgba(255, 255, 255, 0.03);
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --accent-color: #ef4444;
    --accent-hover: #dc2626;
    --danger-color: #ef4444;
    --border-color: rgba(255, 255, 255, 0.08);
    
    --font-primary: 'Inter', 'Noto Sans Georgian', sans-serif;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(239, 68, 68, 0.1), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(59, 130, 246, 0.08), transparent 25%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Custom Sleek Dark-Mode Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #09090b;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    border: 2px solid #09090b;
    transition: background 0.3s;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* Header */
.header {
    background-color: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-primary);
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    cursor: pointer;
    user-select: none;
    color: var(--text-primary);
}

.logo-accent {
    color: var(--accent-color) !important;
}

.controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.api-settings {
    display: none; /* Скрыто от обычных пользователей */
    gap: 0.5rem;
    animation: fadeIn 0.3s ease;
}

.api-settings.visible {
    display: flex;
}

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

.api-input {
    background-color: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    width: 200px;
}

.api-input:focus {
    border-color: var(--accent-color);
}

.btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.btn:hover {
    background-color: var(--accent-hover);
}

.dropdown {
    background: rgba(255, 255, 255, 0.03) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.dropdown:focus, .dropdown:hover {
    border-color: rgba(239, 68, 68, 0.5) !important;
    background: rgba(255, 255, 255, 0.06) !important;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.15);
}

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

@media (max-width: 768px) {
    .main-content {
        padding: 1.25rem 1rem;
    }
}

.hero-section {
    margin-bottom: 2rem;
    text-align: center;
}

.hero-section h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #ffffff, #a1a1aa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.hero-section p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: 2rem;
}

@media (max-width: 768px) {
    .video-grid {
        gap: 1.25rem;
    }
}

/* Video Card */
.video-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.video-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0,0,0,0.5), 0 0 15px rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

.thumbnail-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background-color: #000;
    overflow: hidden;
}

.thumbnail-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.video-card:hover .thumbnail-container img {
    transform: scale(1.06);
}

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 56px;
    height: 56px;
    background-color: rgba(239, 68, 68, 0.95);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.play-icon::after {
    content: '';
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 16px solid white;
    margin-left: 5px;
}

.video-card:hover .play-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.card-content {
    padding: 1rem;
}

.video-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.video-channel {
    color: var(--text-secondary);
    font-size: 0.85rem;
}
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Video Modal Player */
.video-modal-overlay {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(9, 9, 11, 0.8) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

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

.video-modal-container {
    width: 90%;
    max-width: 960px;
    background-color: rgba(24, 24, 27, 0.75) !important;
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 20px !important;
    overflow: hidden;
    position: relative;
    box-shadow: 
        0 30px 60px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), width 0.3s ease, height 0.3s ease, border-radius 0.3s ease;
}

.video-modal-overlay.active .video-modal-container {
    transform: scale(1);
}

/* Let modal take full screen during pseudo-fullscreen to prevent clipping */
body.fullscreen-active .video-modal-overlay {
    display: block !important;
    position: fixed !important;
    top: -20px !important;
    bottom: -20px !important;
    left: -20px !important;
    right: -20px !important;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    background-color: #000 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    opacity: 1 !important;
    transition: none !important;
    z-index: 1000 !important;
}

body.fullscreen-active .video-modal-container {
    position: absolute !important;
    top: 20px !important;
    bottom: 20px !important;
    left: 20px !important;
    right: 20px !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    border: none !important;
    transform: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    overflow: hidden !important;
    transition: none !important;
}

body.fullscreen-active .video-modal-body {
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    height: auto !important;
}

body.fullscreen-active .video-modal-info,
body.fullscreen-active .mobile-drag-handle {
    display: none !important;
}

.video-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: var(--text-primary);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1010;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-radius: 50%;
}

.video-modal-close:hover {
    background: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
    transform: rotate(90deg) scale(1.1) !important;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

.video-modal-close:active {
    transform: rotate(90deg) scale(0.95);
}

/* Exit Fullscreen Button (Top-Right) */
.video-modal-exit-fullscreen {
    position: absolute;
    top: 16px;
    right: 68px; /* 12px gap from close button */
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 50%;
    color: var(--text-primary);
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 1010;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.video-modal-exit-fullscreen:hover {
    background: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
    transform: scale(1.05);
}

.video-modal-exit-fullscreen:active {
    transform: scale(0.95);
}

/* Show exit button only in native or pseudo fullscreen */
.video-ratio-wrapper.pseudo-fullscreen .video-modal-exit-fullscreen {
    display: flex;
}
.video-ratio-wrapper:fullscreen .video-modal-exit-fullscreen {
    display: flex;
}
.video-ratio-wrapper:-webkit-full-screen .video-modal-exit-fullscreen {
    display: flex;
}
.video-ratio-wrapper:-moz-full-screen .video-modal-exit-fullscreen {
    display: flex;
}
.video-ratio-wrapper:-ms-fullscreen .video-modal-exit-fullscreen {
    display: flex;
}

/* Notch Safe Area Adjustments for buttons */
.video-ratio-wrapper.pseudo-fullscreen .video-modal-close {
    top: calc(16px + env(safe-area-inset-top, 0px)) !important;
    right: calc(16px + env(safe-area-inset-right, 0px)) !important;
}
.video-ratio-wrapper:fullscreen .video-modal-close {
    top: calc(16px + env(safe-area-inset-top, 0px)) !important;
    right: calc(16px + env(safe-area-inset-right, 0px)) !important;
}
.video-ratio-wrapper:-webkit-full-screen .video-modal-close {
    top: calc(16px + env(safe-area-inset-top, 0px)) !important;
    right: calc(16px + env(safe-area-inset-right, 0px)) !important;
}
.video-ratio-wrapper:-moz-full-screen .video-modal-close {
    top: calc(16px + env(safe-area-inset-top, 0px)) !important;
    right: calc(16px + env(safe-area-inset-right, 0px)) !important;
}
.video-ratio-wrapper:-ms-fullscreen .video-modal-close {
    top: calc(16px + env(safe-area-inset-top, 0px)) !important;
    right: calc(16px + env(safe-area-inset-right, 0px)) !important;
}

.video-ratio-wrapper.pseudo-fullscreen .video-modal-exit-fullscreen {
    top: calc(16px + env(safe-area-inset-top, 0px)) !important;
    right: calc(68px + env(safe-area-inset-right, 0px)) !important;
}
.video-ratio-wrapper:fullscreen .video-modal-exit-fullscreen {
    top: calc(16px + env(safe-area-inset-top, 0px)) !important;
    right: calc(68px + env(safe-area-inset-right, 0px)) !important;
}
.video-ratio-wrapper:-webkit-full-screen .video-modal-exit-fullscreen {
    top: calc(16px + env(safe-area-inset-top, 0px)) !important;
    right: calc(68px + env(safe-area-inset-right, 0px)) !important;
}
.video-ratio-wrapper:-moz-full-screen .video-modal-exit-fullscreen {
    top: calc(16px + env(safe-area-inset-top, 0px)) !important;
    right: calc(68px + env(safe-area-inset-right, 0px)) !important;
}
.video-ratio-wrapper:-ms-fullscreen .video-modal-exit-fullscreen {
    top: calc(16px + env(safe-area-inset-top, 0px)) !important;
    right: calc(68px + env(safe-area-inset-right, 0px)) !important;
}

/* Mobile Sheet Drag Handle */
.mobile-drag-handle {
    display: none;
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1012;
    pointer-events: none;
}

.video-modal-body {
    padding: 0;
}

.video-ratio-wrapper {
    position: relative;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background-color: #000;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
}

.video-ratio-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.video-modal-info {
    padding: 1.25rem 1.75rem !important;
    background: linear-gradient(180deg, rgba(24, 24, 27, 0.4) 0%, rgba(9, 9, 11, 0.8) 100%) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.video-modal-info-left {
    flex: 1;
    min-width: 0;
}

.video-modal-title {
    font-size: 1.2rem !important;
    font-weight: 800 !important;
    line-height: 1.3 !important;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-modal-channel {
    color: var(--accent-color) !important;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

/* "На главную" button inside modal info bar */
.go-home-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    padding: 0.55rem 1.1rem;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    text-decoration: none;
}

.go-home-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.2);
}

.go-home-btn:active {
    transform: translateY(0);
}

.go-home-btn svg {
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .video-modal-info {
        padding: 1rem 1.25rem !important;
    }
    .go-home-btn span {
        display: none;
    }
    .go-home-btn {
        padding: 0.55rem 0.7rem;
        border-radius: 50%;
        width: 38px;
        height: 38px;
        justify-content: center;
    }
}

/* Prevent scrolling when modal is active */
body.modal-open {
    overflow: hidden;
}

#modal-player-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ── Player Loading Spinner ── */
.player-loading {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    background: #000;
    z-index: 5;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.player-loading.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Video End Screen ── */
.video-end-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #09090b 0%, #18181b 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    z-index: 20;
}

.video-end-screen.visible {
    opacity: 1;
    pointer-events: auto;
}

.end-screen-content {
    text-align: center;
    width: 100%;
    padding: 1.5rem;
}

.end-screen-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.end-screen-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.end-screen-replay-btn,
.end-screen-close-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    padding: 0.6rem 1.5rem;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.end-screen-replay-btn {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.end-screen-replay-btn:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: white;
}

.end-screen-close-btn {
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
}

.end-screen-close-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Autoplay Next Video Block */
.next-video-autoplay-container {
    margin: 1.5rem auto;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    display: none; /* Shown dynamically in JS */
}

.next-video-autoplay-container.visible {
    display: block;
    animation: fadeIn 0.4s ease;
}

.next-video-alert {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-weight: 500;
}

#autoplay-countdown {
    color: var(--accent-color);
    font-weight: 800;
    font-size: 1.1rem;
    display: inline-block;
    min-width: 15px;
}

.next-video-card {
    display: flex;
    gap: 1rem;
    align-items: center;
    text-align: left;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    border-radius: 8px;
}

.next-video-thumb-wrapper {
    width: 100px;
    aspect-ratio: 16/9;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
    flex-shrink: 0;
}

.next-video-thumb-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.next-video-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.2rem;
}

.next-video-channel {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.end-screen-play-next-btn {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.end-screen-play-next-btn:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: white;
}

/* Responsive end screen */
@media (max-width: 480px) {
    .end-screen-actions {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
    }
    .end-screen-replay-btn,
    .end-screen-close-btn,
    .end-screen-play-next-btn {
        width: 80%;
        justify-content: center;
    }
    .end-screen-content {
        padding: 1rem 0.75rem;
    }
    .next-video-autoplay-container {
        max-width: 90%;
    }
    .next-video-thumb-wrapper {
        width: 80px;
    }
}

/* Fullscreen Player Styles & Pseudo-Fullscreen Fallback */
.video-ratio-wrapper.pseudo-fullscreen {
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    padding-top: 0 !important;
    background-color: #000 !important;
    display: block !important;
    z-index: 9999 !important;
    container-type: size !important;
}
.video-ratio-wrapper:fullscreen {
    width: 100% !important;
    height: 100% !important;
    padding-top: 0 !important;
    background-color: #000 !important;
    display: block !important;
    container-type: size !important;
}
.video-ratio-wrapper:-webkit-full-screen {
    width: 100% !important;
    height: 100% !important;
    padding-top: 0 !important;
    background-color: #000 !important;
    display: block !important;
    container-type: size !important;
}
.video-ratio-wrapper:-moz-full-screen {
    width: 100% !important;
    height: 100% !important;
    padding-top: 0 !important;
    background-color: #000 !important;
    display: block !important;
    container-type: size !important;
}
.video-ratio-wrapper:-ms-fullscreen {
    width: 100% !important;
    height: 100% !important;
    padding-top: 0 !important;
    background-color: #000 !important;
    display: block !important;
    container-type: size !important;
}

.video-ratio-wrapper.pseudo-fullscreen #modal-player-container {
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
}
.video-ratio-wrapper:fullscreen #modal-player-container {
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
}
.video-ratio-wrapper:-webkit-full-screen #modal-player-container {
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
}
.video-ratio-wrapper:-moz-full-screen #modal-player-container {
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
}
.video-ratio-wrapper:-ms-fullscreen #modal-player-container {
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
}

/* Pseudo-Fullscreen Fallback layout merged into main class settings above */

/* Floating Next Video Teaser Card */
.video-teaser-card {
    position: absolute;
    bottom: 24px;
    left: 24px;
    width: 320px;
    background: rgba(9, 9, 11, 0.75) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    border-radius: 16px !important;
    padding: 10px 12px;
    z-index: 15;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1), transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), border-color 0.3s, box-shadow 0.3s !important;
    cursor: pointer;
}

.video-teaser-card:hover {
    transform: translateY(-4px) scale(1.02) !important;
    border-color: rgba(239, 68, 68, 0.6) !important;
    box-shadow: 0 25px 45px rgba(0, 0, 0, 0.7), 0 0 20px rgba(239, 68, 68, 0.15) !important;
}

.video-teaser-card.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.teaser-close-btn {
    position: absolute;
    top: 6px;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
    z-index: 17;
}

.teaser-close-btn:hover {
    color: var(--text-primary);
}

.teaser-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.teaser-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-color);
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.teaser-card-body {
    display: flex;
    gap: 10px;
    align-items: center;
}

.teaser-thumb-wrapper {
    width: 80px;
    aspect-ratio: 16/9;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.teaser-thumb-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.teaser-video-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.teaser-video-channel {
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Adjust size inside fullscreen mode */
.video-ratio-wrapper.pseudo-fullscreen .video-teaser-card {
    bottom: calc(40px + env(safe-area-inset-bottom, 0px)) !important;
    left: calc(40px + env(safe-area-inset-left, 0px)) !important;
    width: 360px;
    padding: 12px 16px;
}
.video-ratio-wrapper:fullscreen .video-teaser-card {
    bottom: calc(40px + env(safe-area-inset-bottom, 0px)) !important;
    left: calc(40px + env(safe-area-inset-left, 0px)) !important;
    width: 360px;
    padding: 12px 16px;
}
.video-ratio-wrapper:-webkit-full-screen .video-teaser-card {
    bottom: calc(40px + env(safe-area-inset-bottom, 0px)) !important;
    left: calc(40px + env(safe-area-inset-left, 0px)) !important;
    width: 360px;
    padding: 12px 16px;
}
.video-ratio-wrapper:-moz-full-screen .video-teaser-card {
    bottom: calc(40px + env(safe-area-inset-bottom, 0px)) !important;
    left: calc(40px + env(safe-area-inset-left, 0px)) !important;
    width: 360px;
    padding: 12px 16px;
}
.video-ratio-wrapper:-ms-fullscreen .video-teaser-card {
    bottom: calc(40px + env(safe-area-inset-bottom, 0px)) !important;
    left: calc(40px + env(safe-area-inset-left, 0px)) !important;
    width: 360px;
    padding: 12px 16px;
}

/* Responsive teaser card for mobile */
@media (max-width: 480px) {
    .video-teaser-card {
        bottom: 12px;
        left: 12px;
        width: calc(100% - 24px);
        max-width: none;
        padding: 8px;
    }
}

/* Transparent Iframe Cover to block direct clicks to YouTube */
.yt-iframe-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100% !important;
    background: transparent;
    z-index: 9;
    cursor: pointer;
    pointer-events: none; /* Let user tap the iframe directly to play/unlock it */
}

.yt-iframe-cover.active {
    pointer-events: auto !important; /* Block all clicks once playback has started */
}

/* Custom Player Controls (Glass Dock & Vector Mask Icons) */
.custom-player-controls {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    width: calc(100% - 24px) !important;
    height: 52px !important;
    background: rgba(9, 9, 11, 0.75) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 18px !important;
    z-index: 15; /* Stay above pause overlay (14) */
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: 
        opacity 0.3s cubic-bezier(0.25, 1, 0.5, 1),
        transform 0.3s cubic-bezier(0.25, 1, 0.5, 1) !important;
}

.custom-player-controls.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.video-ratio-wrapper.pseudo-fullscreen .custom-player-controls {
    height: 60px !important;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important;
    left: calc(20px + env(safe-area-inset-left, 0px)) !important;
    right: calc(20px + env(safe-area-inset-right, 0px)) !important;
    width: auto !important;
    padding: 0 24px !important;
    padding-bottom: 0 !important;
}
.video-ratio-wrapper:fullscreen .custom-player-controls {
    height: 60px !important;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important;
    left: calc(20px + env(safe-area-inset-left, 0px)) !important;
    right: calc(20px + env(safe-area-inset-right, 0px)) !important;
    width: auto !important;
    padding: 0 24px !important;
    padding-bottom: 0 !important;
}
.video-ratio-wrapper:-webkit-full-screen .custom-player-controls {
    height: 60px !important;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important;
    left: calc(20px + env(safe-area-inset-left, 0px)) !important;
    right: calc(20px + env(safe-area-inset-right, 0px)) !important;
    width: auto !important;
    padding: 0 24px !important;
    padding-bottom: 0 !important;
}
.video-ratio-wrapper:-moz-full-screen .custom-player-controls {
    height: 60px !important;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important;
    left: calc(20px + env(safe-area-inset-left, 0px)) !important;
    right: calc(20px + env(safe-area-inset-right, 0px)) !important;
    width: auto !important;
    padding: 0 24px !important;
    padding-bottom: 0 !important;
}
.video-ratio-wrapper:-ms-fullscreen .custom-player-controls {
    height: 60px !important;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important;
    left: calc(20px + env(safe-area-inset-left, 0px)) !important;
    right: calc(20px + env(safe-area-inset-right, 0px)) !important;
    width: auto !important;
    padding: 0 24px !important;
    padding-bottom: 0 !important;
}

/* Mask Button Icon Style */
.custom-control-btn {
    background: transparent;
    border: none;
    width: 44px !important; /* Finger friendly touch target */
    height: 44px !important;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #ffffff !important;
    transition: transform 0.2s cubic-bezier(0.25, 0.8, 0.25, 1), color 0.2s !important;
    flex-shrink: 0;
}

@media (hover: hover) {
    .custom-control-btn:hover {
        color: var(--accent-color) !important;
        transform: scale(1.15) !important;
    }
}

.custom-control-btn:active {
    transform: scale(0.92) !important;
}

/* Play/Pause icon toggles */
.custom-control-btn .icon-play {
    display: block;
    width: 18px;
    height: 18px;
}
.custom-control-btn .icon-pause {
    display: none;
    width: 18px;
    height: 18px;
}
.custom-control-btn.pause .icon-play {
    display: none;
}
.custom-control-btn.pause .icon-pause {
    display: block;
}

/* Volume icon toggles */
.custom-control-btn .icon-volume-high {
    display: block;
    width: 18px;
    height: 18px;
}
.custom-control-btn .icon-volume-muted {
    display: none;
    width: 18px;
    height: 18px;
}
.custom-control-btn.volume-muted .icon-volume-high {
    display: none;
}
.custom-control-btn.volume-muted .icon-volume-muted {
    display: block;
}

/* Fullscreen icon toggles */
.custom-control-btn .icon-fullscreen-enter {
    display: block;
    width: 18px;
    height: 18px;
}
.custom-control-btn .icon-fullscreen-exit {
    display: none;
    width: 18px;
    height: 18px;
}
.custom-control-btn.active .icon-fullscreen-enter {
    display: none;
}
.custom-control-btn.active .icon-fullscreen-exit {
    display: block;
}

/* Time display */
.custom-time {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    user-select: none;
    flex-shrink: 0;
}

/* Hardware-Accelerated Progress Scrubbing & Halo Thumb */
.custom-progress-container {
    flex: 1;
    height: 16px; /* Touch target size expansion */
    background: transparent !important;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    z-index: 10;
}

/* Sub-Track background */
.custom-progress-container::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.16);
    border-radius: 2px;
    transition: transform 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform-origin: center;
}

.custom-progress-bar {
    height: 4px !important;
    background: var(--accent-color) !important;
    border-radius: 2px;
    position: relative;
    width: 0;
    transform-origin: left center;
    transition: transform 0.2s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.custom-progress-handle {
    position: absolute;
    right: -7px !important;
    top: 50% !important;
    transform: translateY(-50%) scale(0) !important;
    width: 14px !important;
    height: 14px !important;
    background: #ffffff !important;
    border-radius: 50%;
    box-shadow: 
        0 3px 8px rgba(0, 0, 0, 0.5),
        0 0 0 4px rgba(239, 68, 68, 0.25) !important;
    transition: 
        transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
        background-color 0.2s,
        box-shadow 0.2s !important;
    z-index: 12;
}

/* Hover / Active / Dragging Scrub states */
.custom-progress-container:hover::before,
.custom-progress-container.dragging::before {
    transform: scaleY(1.5);
}

.custom-progress-container:hover .custom-progress-bar,
.custom-progress-container.dragging .custom-progress-bar {
    transform: scaleY(1.5);
}

.custom-progress-container:hover .custom-progress-handle,
.custom-progress-container.dragging .custom-progress-handle {
    transform: translateY(-50%) scale(1) !important;
}

.custom-progress-handle:hover {
    background: #ffffff !important;
    box-shadow: 
        0 3px 10px rgba(0, 0, 0, 0.6),
        0 0 0 6px rgba(239, 68, 68, 0.45) !important;
    transform: translateY(-50%) scale(1.15) !important;
}

/* Finger-friendly scaling on coarse touch pointer devices */
@media (pointer: coarse) {
    .custom-progress-handle {
        width: 18px !important;
        height: 18px !important;
        right: -9px !important;
        transform: translateY(-50%) scale(1.3) !important; /* Always visible and larger on touch devices */
    }
    .custom-progress-container {
        height: 24px;
    }
    .custom-progress-container::before {
        height: 6px;
    }
    .custom-progress-bar {
        height: 6px !important;
    }
    .custom-player-controls {
        gap: 10px !important;
        padding: 0 10px !important;
        height: 52px !important;
    }
}

/* Custom Pause Overlay & Spring-Animation */
.video-pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(9, 9, 11, 0.93) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 14; /* Higher than player and blockers, lower than controls (15) and end screen (20) */
    cursor: pointer;
}

.video-pause-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.pause-play-btn {
    width: 72px;
    height: 72px;
    background: rgba(239, 68, 68, 0.95) !important;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.4) !important;
    transform: scale(0.8) !important;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.3s, box-shadow 0.3s !important;
}

.pause-play-btn::after {
    content: '';
    width: 0;
    height: 0;
    border-top: 14px solid transparent;
    border-bottom: 14px solid transparent;
    border-left: 22px solid white;
    margin-left: 6px;
}

.video-pause-overlay.visible .pause-play-btn {
    transform: scale(1) !important;
}

.video-pause-overlay:hover .pause-play-btn {
    transform: scale(1.1) !important;
    background: var(--accent-hover) !important;
    box-shadow: 0 0 40px rgba(239, 68, 68, 0.6) !important;
}

/* ─────────────────────────────────────────────
   Mobile / iOS Safari Compatibility Overrides
   ───────────────────────────────────────────── */

/* Lock document scrolling during active pseudo-fullscreen on mobile */
html.fullscreen-active,
body.fullscreen-active {
    overflow: hidden !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    width: 100dvw !important;
    height: 100% !important;
    height: 100dvh !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Prevent double-tap zoom on interactive elements on iOS Safari */
.custom-control-btn,
.video-modal-close,
.video-modal-exit-fullscreen,
.teaser-close-btn,
.end-screen-replay-btn,
.end-screen-close-btn,
.end-screen-play-next-btn {
    touch-action: manipulation;
}

.yt-iframe-cover,
.custom-progress-container,
.video-pause-overlay {
    touch-action: none;
}

/* Hide volume buttons on mobile / touch pointers (not programmatically settable on iOS Safari) */
@media (max-width: 576px), (pointer: coarse) {
    #custom-volume-btn {
        display: none !important;
    }
}

/* Bottom-sheet transition and details scaling for video modal on smaller screens */
@media (max-width: 768px) {
    .video-modal-overlay {
        align-items: flex-end; /* Ergonomic bottom-sheet style */
    }
    
    .video-modal-container {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 16px 16px 0 0 !important;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1) !important;
    }
    
    .video-modal-overlay.active .video-modal-container {
        transform: translateY(0);
    }
    
    .video-modal-info {
        padding: 1rem 1.25rem !important;
    }
    
    .video-modal-title {
        font-size: 1.1rem !important;
    }
    
    .video-modal-channel {
        font-size: 0.85rem !important;
    }
}

/* Ensure fullscreen overrides ALWAYS take precedence over mobile media query layout styles */
body.fullscreen-active .video-modal-overlay {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    background-color: #000 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    opacity: 1 !important;
    transition: none !important;
}

body.fullscreen-active .video-modal-container {
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    border: none !important;
    transform: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    overflow: hidden !important;
    transition: none !important;
}

body.fullscreen-active .video-modal-body {
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    height: auto !important;
}

body.fullscreen-active .video-modal-info,
body.fullscreen-active .mobile-drag-handle {
    display: none !important;
}

/* Fullscreen overflow lock to contain zoom-to-fill iframe */
.video-ratio-wrapper.pseudo-fullscreen {
    overflow: hidden !important;
}
.video-ratio-wrapper:fullscreen {
    overflow: hidden !important;
}
.video-ratio-wrapper:-webkit-full-screen {
    overflow: hidden !important;
}

/* Zoom-to-Fill (Cover) math for wide and narrow landscape screens (iPhone, iPad, foldables) */
@media (orientation: landscape) {
    .video-ratio-wrapper.pseudo-fullscreen iframe {
        top: 42% !important;
        left: 50% !important;
        width: max(120vw, 213.33vh) !important;
        width: max(120dvw, 213.33dvh) !important;
        width: max(120cqw, 213.33cqh) !important;
        height: max(120vh, 67.5vw) !important;
        height: max(120dvh, 67.5dvw) !important;
        height: max(120cqh, 67.5cqw) !important;
        transform: translate(-50%, -42%) translateZ(0) !important;
        -webkit-transform: translate(-50%, -42%) translateZ(0) !important;
    }
}
@media (orientation: landscape) {
    .video-ratio-wrapper:fullscreen iframe {
        top: 42% !important;
        left: 50% !important;
        width: max(120vw, 213.33vh) !important;
        width: max(120dvw, 213.33dvh) !important;
        width: max(120cqw, 213.33cqh) !important;
        height: max(120vh, 67.5vw) !important;
        height: max(120dvh, 67.5dvw) !important;
        height: max(120cqh, 67.5cqw) !important;
        transform: translate(-50%, -42%) translateZ(0) !important;
        -webkit-transform: translate(-50%, -42%) translateZ(0) !important;
    }
}
@media (orientation: landscape) {
    .video-ratio-wrapper:-webkit-full-screen iframe {
        top: 42% !important;
        left: 50% !important;
        width: max(120vw, 213.33vh) !important;
        width: max(120dvw, 213.33dvh) !important;
        width: max(120cqw, 213.33cqh) !important;
        height: max(120vh, 67.5vw) !important;
        height: max(120dvh, 67.5dvw) !important;
        height: max(120cqh, 67.5cqw) !important;
        transform: translate(-50%, -42%) translateZ(0) !important;
        -webkit-transform: translate(-50%, -42%) translateZ(0) !important;
    }
}

/* Ergonomic compact controls for short landscape devices (height <= 500px) */
@media (orientation: landscape) and (max-height: 500px) {
    .video-ratio-wrapper.pseudo-fullscreen .custom-player-controls {
        height: 46px !important;
        bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
        left: calc(12px + env(safe-area-inset-left, 0px)) !important;
        right: calc(12px + env(safe-area-inset-right, 0px)) !important;
        padding: 0 16px !important;
    }
    .video-ratio-wrapper:fullscreen .custom-player-controls {
        height: 46px !important;
        bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
        left: calc(12px + env(safe-area-inset-left, 0px)) !important;
        right: calc(12px + env(safe-area-inset-right, 0px)) !important;
        padding: 0 16px !important;
    }
    .video-ratio-wrapper:-webkit-full-screen .custom-player-controls {
        height: 46px !important;
        bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
        left: calc(12px + env(safe-area-inset-left, 0px)) !important;
        right: calc(12px + env(safe-area-inset-right, 0px)) !important;
        padding: 0 16px !important;
    }
    
    .video-ratio-wrapper.pseudo-fullscreen .video-modal-close {
        width: 34px !important;
        height: 34px !important;
        font-size: 16px !important;
        top: calc(8px + env(safe-area-inset-top, 0px)) !important;
        right: calc(8px + env(safe-area-inset-right, 0px)) !important;
    }
    .video-ratio-wrapper:fullscreen .video-modal-close {
        width: 34px !important;
        height: 34px !important;
        font-size: 16px !important;
        top: calc(8px + env(safe-area-inset-top, 0px)) !important;
        right: calc(8px + env(safe-area-inset-right, 0px)) !important;
    }
    .video-ratio-wrapper:-webkit-full-screen .video-modal-close {
        width: 34px !important;
        height: 34px !important;
        font-size: 16px !important;
        top: calc(8px + env(safe-area-inset-top, 0px)) !important;
        right: calc(8px + env(safe-area-inset-right, 0px)) !important;
    }
    
    .video-ratio-wrapper.pseudo-fullscreen .video-modal-exit-fullscreen {
        width: 34px !important;
        height: 34px !important;
        top: calc(8px + env(safe-area-inset-top, 0px)) !important;
        right: calc(50px + env(safe-area-inset-right, 0px)) !important;
    }
    .video-ratio-wrapper:fullscreen .video-modal-exit-fullscreen {
        width: 34px !important;
        height: 34px !important;
        top: calc(8px + env(safe-area-inset-top, 0px)) !important;
        right: calc(50px + env(safe-area-inset-right, 0px)) !important;
    }
    .video-ratio-wrapper:-webkit-full-screen .video-modal-exit-fullscreen {
        width: 34px !important;
        height: 34px !important;
        top: calc(8px + env(safe-area-inset-top, 0px)) !important;
        right: calc(50px + env(safe-area-inset-right, 0px)) !important;
    }
}

/* ────────────────────────────────────────────────────────
   Automatic Landscape Fullscreen Adaptivity on Mobile/Tablets
   ──────────────────────────────────────────────────────── */
@media (max-width: 920px) and (orientation: landscape) {
    /* Prevent background scrolling */
    body.modal-open {
        overflow: hidden !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        height: 100dvh !important;
    }
    
    /* Overlay visible viewport lock */
    .video-modal-overlay.active {
        display: block !important;
        position: fixed !important;
        top: -20px !important;
        bottom: -20px !important;
        left: -20px !important;
        right: -20px !important;
        width: auto !important;
        height: auto !important;
        padding: 0 !important;
        background-color: #000 !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        opacity: 1 !important;
        transition: none !important;
        z-index: 1000 !important;
    }
    
    /* Container visible viewport lock */
    .video-modal-overlay.active .video-modal-container {
        position: absolute !important;
        top: 20px !important;
        bottom: 20px !important;
        left: 20px !important;
        right: 20px !important;
        width: auto !important;
        height: auto !important;
        max-width: none !important;
        max-height: none !important;
        border-radius: 0 !important;
        border: none !important;
        transform: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        overflow: hidden !important;
        transition: none !important;
    }
    
    /* Body visible viewport lock */
    .video-modal-overlay.active .video-modal-body {
        position: absolute !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: auto !important;
        height: auto !important;
    }
    
    /* Wrapper visible viewport lock & Container Query context */
    .video-modal-overlay.active .video-ratio-wrapper {
        position: absolute !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: auto !important;
        height: auto !important;
        max-width: none !important;
        max-height: none !important;
        padding-top: 0 !important;
        background-color: #000 !important;
        display: block !important;
        z-index: 9999 !important;
        container-type: size !important;
        overflow: hidden !important;
    }
    
    /* Hide layout items */
    .video-modal-overlay.active .video-modal-info,
    .video-modal-overlay.active .mobile-drag-handle {
        display: none !important;
    }
    
    /* Zoom-to-Fill scaling math relative to Visible Wrapper using Container Queries */
    .video-modal-overlay.active .video-ratio-wrapper iframe {
        position: absolute !important;
        top: 42% !important;
        left: 50% !important;
        width: max(120vw, 213.33vh) !important;
        width: max(120dvw, 213.33dvh) !important;
        width: max(120cqw, 213.33cqh) !important;
        height: max(120vh, 67.5vw) !important;
        height: max(120dvh, 67.5dvw) !important;
        height: max(120cqh, 67.5cqw) !important;
        transform: translate(-50%, -42%) translateZ(0) !important;
        -webkit-transform: translate(-50%, -42%) translateZ(0) !important;
    }
    
    /* Compact custom player controls bottom-aligned to visible area */
    .video-modal-overlay.active .custom-player-controls {
        height: 46px !important;
        bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
        left: calc(12px + env(safe-area-inset-left, 0px)) !important;
        right: calc(12px + env(safe-area-inset-right, 0px)) !important;
        padding: 0 16px !important;
    }
    
    /* Compact close button positioned relative to visible area */
    .video-modal-overlay.active .video-modal-close {
        width: 34px !important;
        height: 34px !important;
        font-size: 16px !important;
        top: calc(8px + env(safe-area-inset-top, 0px)) !important;
        right: calc(8px + env(safe-area-inset-right, 0px)) !important;
    }
    
    /* Compact exit fullscreen button positioned relative to visible area */
    .video-modal-overlay.active .video-modal-exit-fullscreen {
        width: 34px !important;
        height: 34px !important;
        top: calc(8px + env(safe-area-inset-top, 0px)) !important;
        right: calc(50px + env(safe-area-inset-right, 0px)) !important;
    }
}
