
        :root {
            --bg: #0a0f1c;
            --accent: #00d4ff;
            --text: #ffffff;
            --muted: #9ca3af;
            --header-height: 60px;
            --safe-top: env(safe-area-inset-top, 0px);
            --safe-right: env(safe-area-inset-right, 0px);
            --safe-bottom: env(safe-area-inset-bottom, 0px);
            --safe-left: env(safe-area-inset-left, 0px);
            --header-total-height: calc(var(--header-height) + var(--safe-top));
            --sidebar-width: 390px;

            --plyr-color-main: #00d4ff;
            --plyr-video-background: #000000;
            --plyr-menu-background: rgba(15, 20, 35, 0.95);
            --plyr-menu-color: #ffffff;
        }

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

        html {
            -webkit-text-size-adjust: 100%;
            text-size-adjust: 100%;
            background: var(--bg);
        }

        button,
        a,
        input,
        .channel-card {
            -webkit-tap-highlight-color: transparent;
        }

        button,
        a,
        .channel-card {
            touch-action: manipulation;
        }

        :where(button, a, input, textarea, [tabindex]):focus-visible {
            outline: 3px solid var(--accent);
            outline-offset: 3px;
        }

        html, body {
            height: 100%;
            background: var(--bg);
            color: var(--text);
            font-family: 'Inter', sans-serif;
            overflow: hidden;
        }

        body { display: flex; flex-direction: column; }

        /* Header */
        header {
            height: var(--header-total-height);
            background:
                linear-gradient(115deg, rgba(10, 15, 30, .98), rgba(12, 26, 45, .94));
            backdrop-filter: blur(30px);
            -webkit-backdrop-filter: blur(30px);
            border-bottom: 1px solid rgba(255, 255, 255, 0.08);
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: var(--safe-top) max(18px, var(--safe-right)) 0 max(18px, var(--safe-left));
            z-index: 1000;
        }
        .logo {
            display: flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 900; text-decoration: none; color: #fff;
        }
        .logo img {
            width: 38px;
            height: 38px;
            border-radius: 12px;
            object-fit: contain;
            box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 8px 24px rgba(0,212,255,.18);
        }
        .logo-live {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            margin-left: 2px;
            padding: 4px 7px;
            border: 1px solid rgba(255, 75, 88, .28);
            border-radius: 999px;
            background: rgba(255, 51, 68, .1);
            color: #ff8c96;
            font-size: 9px;
            font-weight: 900;
            letter-spacing: .08em;
        }
        .logo-live::before {
            content: '';
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: #ff4050;
            box-shadow: 0 0 9px rgba(255,64,80,.85);
        }

        .header-actions {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 8px;
            min-width: 0;
            margin-left: auto;
        }

        .view-mode-btn {
            min-height: 40px;
            padding: 7px 12px;
            border: 1px solid rgba(255,255,255,.1);
            border-radius: 12px;
            background: rgba(255,255,255,.07);
            color: #fff;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 7px;
            font: inherit;
            font-size: 12px;
            font-weight: 800;
            cursor: pointer;
            white-space: nowrap;
            transition: transform .2s ease, background .2s ease, border-color .2s ease;
        }
        .view-mode-btn:hover {
            transform: translateY(-1px);
            border-color: rgba(0,212,255,.48);
            background: rgba(0,212,255,.14);
        }
        .view-mode-btn:focus-visible {
            outline: 2px solid var(--accent);
            outline-offset: 2px;
        }
        .view-mode-icon { font-size: 17px; line-height: 1; }

        #toggleListBtn {
            width: 44px; height: 44px; border: none; border-radius: 12px;
            background: rgba(255, 255, 255, 0.09); color: #fff; font-size: 22px;
            cursor: pointer; transition: all 0.3s ease; display: flex; align-items: center; justify-content: center;
        }
        #toggleListBtn:hover { background: rgba(0, 212, 255, 0.25); transform: scale(1.05); }

        /* Contenido Principal (Escritorio) */
        .main-content {
            flex: 1;
            display: flex;
            overflow: hidden;
            min-height: 0;
            position: relative;
        }

        .player-section {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: #000;
        }

        .player-wrapper {
            flex: 1;
            position: relative;
            background: #000;
            min-height: 0;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .player-skeleton {
            position: absolute;
            inset: 0;
            overflow: hidden;
            background:
                radial-gradient(circle at 50% 45%, rgba(0,212,255,.08), transparent 34%),
                #03060b;
        }
        .player-skeleton::before,
        .catalog-skeleton__thumb,
        .catalog-skeleton__line {
            background: linear-gradient(
                100deg,
                rgba(255,255,255,.035) 20%,
                rgba(255,255,255,.09) 38%,
                rgba(255,255,255,.035) 56%
            );
            background-size: 220% 100%;
            animation: tvabierta-shimmer 1.4s ease-in-out infinite;
        }
        .player-skeleton::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 62px;
            height: 62px;
            border-radius: 50%;
            transform: translate(-50%, -50%);
        }
        .catalog-skeleton {
            padding: 6px 12px 14px;
            pointer-events: none;
        }
        .catalog-skeleton__row {
            min-height: 70px;
            display: grid;
            grid-template-columns: 24px 100px 1fr 44px;
            align-items: center;
            gap: 12px;
            padding: 7px 0;
            border-bottom: 1px solid rgba(255,255,255,.035);
        }
        .catalog-skeleton__thumb { width: 100px; height: 56px; border-radius: 8px; }
        .catalog-skeleton__copy { display: grid; gap: 9px; }
        .catalog-skeleton__line { height: 10px; border-radius: 999px; }
        .catalog-skeleton__line:first-child { width: min(170px, 82%); }
        .catalog-skeleton__line:last-child { width: min(90px, 48%); opacity: .65; }
        @keyframes tvabierta-shimmer {
            to { background-position: -120% 0; }
        }

        .plyr { width: 100%; height: 100%; max-height: 100%; }
        .plyr__video-wrapper { height: 100%; }
        video { object-fit: contain; width: 100%; height: 100%; }

        /* Barra de Acciones */
        .actions-bar {
            background: rgba(15, 20, 35, 0.92);
            backdrop-filter: blur(30px);
            padding: 12px 18px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 16px;
            border-top: 1px solid rgba(255, 255, 255, 0.06);
        }
        .now-playing { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
        .now-playing h3 { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .now-playing small { color: var(--muted); display: block; }

        .channel-logo {
            width: 48px; height: 48px; border-radius: 12px; overflow: hidden;
            border: 1.5px solid rgba(0, 212, 255, 0.35); flex-shrink: 0; background: #000;
        }
        .channel-logo img { width: 100%; height: 100%; object-fit: contain; }

        .actions-group { display: flex; gap: 8px; }
        .action-btn {
            background: rgba(255, 255, 255, 0.06);
            border: 1px solid rgba(255, 255, 255, 0.04);
            color: #fff;
            padding: 8px 14px;
            border-radius: 10px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 13px;
            font-weight: 600;
            font-family: inherit;
            transition: all 0.2s ease;
        }
        .action-btn:hover { background: rgba(255, 255, 255, 0.15); }
        .action-btn:hover {
            border-color: rgba(0, 212, 255, .25);
            box-shadow: 0 7px 20px rgba(0,0,0,.16);
            transform: translateY(-1px);
        }
        .action-btn span { font-size: 16px; }
        .action-btn[hidden] { display: none !important; }
        .action-btn svg {
            display: block;
            width: 19px;
            height: 19px;
            fill: currentColor;
        }
        .airplay-action svg {
            display: block;
            width: 19px;
            height: 19px;
            fill: currentColor;
        }
        .airplay-action.is-active {
            border-color: rgba(0, 212, 255, .9);
            background: var(--accent);
            color: #001018;
        }
        .airplay-action:disabled {
            opacity: .45;
            cursor: default;
        }
        .pip-action.is-active {
            border-color: rgba(0, 212, 255, .8);
            background: rgba(0, 212, 255, .16);
            color: #6eeaff;
            box-shadow: inset 0 0 0 1px rgba(0,212,255,.06);
        }
        .pip-action:disabled {
            opacity: .42;
            cursor: default;
            transform: none;
        }
        .favorite-current-action.is-favorite {
            border-color: rgba(255, 202, 69, .55);
            background: rgba(255, 202, 69, .13);
            color: #ffd86f;
            box-shadow: inset 0 0 0 1px rgba(255,202,69,.05);
        }
        .favorite-current-action svg {
            fill: transparent;
            stroke: currentColor;
            stroke-width: 1.7;
            stroke-linejoin: round;
        }
        .favorite-current-action.is-favorite svg { fill: currentColor; }

        /* Sidebar (Escritorio) */
        .sidebar {
            width: var(--sidebar-width);
            background: rgba(12, 17, 32, 0.88);
            backdrop-filter: blur(32px);
            border-left: 1px solid rgba(255, 255, 255, 0.07);
            display: flex;
            flex-direction: column;
            overflow: hidden;
            transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
        }

        body.sidebar-hidden .sidebar {
            width: 0; min-width: 0; opacity: 0; pointer-events: none;
        }

        .top-panel { padding: 14px 16px; background: rgba(12, 17, 32, 0.95); border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
        #channelTitle { font-size: 17px; font-weight: 800; margin-bottom: 10px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .search-box { position: relative; }
        #searchInput { width: 100%; padding: 12px 48px 12px 16px; border: 1px solid rgba(255,255,255,0.05); border-radius: 14px; background: rgba(255, 255, 255, 0.06); color: #fff; font-size: 16px; outline: none; -webkit-appearance: none; appearance: none; }
        #searchInput:focus { border-color: var(--accent); background: rgba(255, 255, 255, 0.1); }
        #searchInput::-webkit-search-cancel-button { display: none; }
        .search-clear {
            position: absolute;
            top: 50%;
            right: 5px;
            transform: translateY(-50%);
            width: 38px;
            height: 38px;
            min-width: 38px;
            min-height: 38px;
            border: 0;
            border-radius: 10px;
            background: transparent;
            color: #d1d5db;
            font-size: 20px;
            cursor: pointer;
        }
        .search-clear:hover { background: rgba(255,255,255,.09); color: #fff; }
        .search-clear[hidden] { display: none !important; }
        .catalog-summary {
            min-height: 17px;
            margin-top: 7px;
            color: var(--muted);
            font-size: 11px;
            line-height: 1.35;
        }

        /* Categorías */
        .categories { display: flex; gap: 7px; overflow-x: auto; padding: 10px 16px; background: rgba(12, 17, 32, 0.9); border-bottom: 1px solid rgba(255, 255, 255, 0.06); scrollbar-width: none; }
        .categories::-webkit-scrollbar { display: none; }
        .category-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: none; border-radius: 999px; background: rgba(255, 255, 255, 0.09); color: #fff; font-size: 13.5px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: all 0.3s; }
        .category-btn.active { background: var(--accent); color: #000; }
        .category-btn[data-category="Favoritos"]::before {
            content: '★';
            color: #ffd45c;
            font-size: 12px;
            line-height: 1;
        }
        .category-btn[data-category="Favoritos"].active::before { color: #4c3500; }
        .category-count {
            min-width: 20px;
            padding: 1px 6px;
            border-radius: 999px;
            background: rgba(255,255,255,.12);
            font-size: 10px;
            line-height: 17px;
            text-align: center;
        }
        .category-btn.active .category-count { background: rgba(0,0,0,.16); }

        /* Lista de Canales */
        #channels { flex: 1; overflow-y: auto; padding: 8px 0; }
        .channel-card { display: flex; align-items: center; gap: 12px; margin: 6px 12px; padding: 10px 12px; border-radius: 14px; background: rgba(25, 33, 55, 0.5); cursor: pointer; transition: all 0.25s ease; border: 1px solid transparent; content-visibility: auto; contain-intrinsic-size: 76px; }
        .channel-card:hover {
            background: linear-gradient(135deg, rgba(35,48,75,.92), rgba(24,38,63,.88));
            border-color: rgba(0,212,255,.16);
            transform: translateY(-1px);
            box-shadow: 0 8px 22px rgba(0,0,0,.16);
        }
        .channel-card.active {
            background: linear-gradient(135deg, #31ddff, #00a9df 70%, #008fc6);
            border-color: #62e5ff;
            box-shadow: 0 8px 26px rgba(0, 183, 235, .22);
        }
        .channel-card:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
        .channel-card.active .channel-name, .channel-card.active .channel-number { color: #000; }
        .channel-card.active .channel-category { color: #111c30; }

        .channel-select {
            flex: 1 1 auto;
            min-width: 0;
            min-height: 56px;
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 0;
            border: 0;
            background: transparent;
            color: inherit;
            font: inherit;
            text-align: left;
            cursor: pointer;
        }
        .channel-select:focus-visible {
            outline: 2px solid rgba(255,255,255,.9);
            outline-offset: 3px;
            border-radius: 9px;
        }
        .favorite-toggle {
            flex: 0 0 44px;
            width: 44px;
            height: 44px;
            display: grid;
            place-items: center;
            border: 1px solid rgba(255,255,255,.08);
            border-radius: 12px;
            background: rgba(255,255,255,.045);
            color: #8290a6;
            cursor: pointer;
            transition: color .2s ease, background .2s ease, border-color .2s ease, transform .2s ease;
        }
        .favorite-toggle svg {
            width: 20px;
            height: 20px;
            fill: transparent;
            stroke: currentColor;
            stroke-width: 1.8;
            stroke-linejoin: round;
            transition: fill .2s ease, transform .22s cubic-bezier(.2,.8,.2,1);
        }
        .favorite-toggle:hover {
            color: #ffd45c;
            border-color: rgba(255,202,69,.32);
            background: rgba(255,202,69,.09);
            transform: translateY(-1px);
        }
        .favorite-toggle.is-favorite {
            color: #ffd45c;
            border-color: rgba(255,202,69,.38);
            background: rgba(255,202,69,.12);
        }
        .favorite-toggle.is-favorite svg {
            fill: currentColor;
            transform: scale(1.08);
        }
        .favorite-toggle:focus-visible {
            outline: 2px solid #ffd45c;
            outline-offset: 2px;
        }
        .channel-card.active .favorite-toggle {
            color: rgba(0,35,47,.58);
            border-color: rgba(0,35,47,.18);
            background: rgba(0,20,30,.08);
        }
        .channel-card.active .favorite-toggle.is-favorite {
            color: #503600;
            border-color: rgba(80,54,0,.28);
            background: rgba(255,231,143,.4);
        }

        /* Foco de alta precisión para controles remotos y teclado. */
        .channel-select,
        .favorite-toggle,
        .category-btn,
        .action-btn,
        .view-mode-btn,
        #toggleListBtn,
        #searchInput {
            scroll-margin: 18px;
        }
        body.remote-navigation-active button:focus,
        body.remote-navigation-active input:focus,
        body.remote-navigation-active .plyr__control:focus {
            outline: 3px solid #fff !important;
            outline-offset: 3px !important;
            box-shadow:
                0 0 0 6px rgba(0, 212, 255, .88),
                0 10px 34px rgba(0, 0, 0, .48) !important;
            transform: translateY(-1px) scale(1.025);
            position: relative;
            z-index: 30;
        }
        body.remote-navigation-active .channel-card:focus-within {
            border-color: rgba(255,255,255,.9);
            box-shadow:
                0 0 0 3px rgba(0,212,255,.78),
                0 14px 34px rgba(0,0,0,.4);
            transform: translateY(-1px) scale(.992);
            z-index: 2;
        }
        body.remote-navigation-active .channel-card.active:focus-within {
            border-color: #fff;
            box-shadow:
                0 0 0 3px rgba(0, 64, 85, .8),
                0 14px 34px rgba(0,0,0,.42);
        }

        @media (prefers-reduced-motion: reduce) {
            .player-skeleton::before,
            .catalog-skeleton__thumb,
            .catalog-skeleton__line {
                animation: none !important;
            }
            body.remote-navigation-active button:focus,
            body.remote-navigation-active input:focus,
            body.remote-navigation-active .plyr__control:focus,
            body.remote-navigation-active .channel-card:focus-within {
                transition: none !important;
                transform: none !important;
            }
        }

        @media (prefers-contrast: more) {
            :root { --muted: #d5d9e0; }

            .action-btn,
            .view-mode-btn,
            .category-btn,
            .channel-card,
            .stream-status__metrics {
                border-color: rgba(255, 255, 255, .42);
            }
        }

        @media (forced-colors: active) {
            .stream-status__dot,
            .logo-live::before {
                border: 1px solid ButtonText;
            }

            .stream-status__dot.active,
            .stream-status__dot.waiting,
            .stream-status__dot.error {
                forced-color-adjust: none;
            }
        }

        .channel-number { width: 24px; font-weight: 800; color: var(--accent); text-align: center; font-size: 14px; }
        .thumb { width: 100px; height: 56px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: #000; border: 1px solid rgba(255,255,255,0.05); }
        .thumb img { width: 100%; height: 100%; object-fit: contain; }

        .channel-info { min-width: 0; flex: 1; }
        .channel-name { display: block; font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
        .channel-category { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

        /* Buscador mejorado */
        .search-highlight {
            background: rgba(0, 212, 255, 0.28);
            color: #ffffff;
            border-radius: 4px;
            padding: 0 2px;
            box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.18);
        }
        .channel-card.active .search-highlight {
            background: rgba(0, 0, 0, 0.18);
            color: #000;
            box-shadow: none;
        }
        .search-empty {
            padding: 42px 20px;
            text-align: center;
            color: var(--muted);
            line-height: 1.55;
        }
        .search-empty strong { color: #fff; }
        .search-meta {
            margin-top: 7px;
            font-size: 11px;
            color: var(--muted);
        }

        /* ==========================================
           NUEVA ARQUITECTURA PARA COMPORTAMIENTO MÓVIL
           ========================================== */
        @media (max-width: 1024px) {
            #toggleListBtn { display: none !important; } /* Ocultamos botón de colapsar, ya no se necesita */

            .main-content {
                flex-direction: column;
            }

            /* Sección del reproductor fija arriba */
            .player-section {
                flex: none;
                width: 100%;
                /* Ajuste automático basado en aspecto de TV estándar (16:9 aprox) */
                height: 30vh;
                min-height: 210px;
                box-shadow: 0 4px 20px rgba(0,0,0,0.5);
                z-index: 5;
            }

            .player-wrapper { height: 100%; }

            /* Barra de acciones compacta debajo del reproductor */
            .actions-bar {
                padding: 8px 12px;
                gap: 8px;
            }
            .now-playing { gap: 8px; }
            .now-playing h3 { font-size: 14px; }
            .now-playing small { font-size: 11px; }
            .channel-logo { width: 36px; height: 36px; border-radius: 8px; }
            .actions-group div { display: none; } /* Solo iconos en móvil */
            .action-btn { padding: 8px 10px; border-radius: 8px; }

            /* La lista toma TODO el espacio inferior de forma nativa */
            .sidebar {
                flex: 1;
                width: 100% !important;
                height: auto;
                opacity: 1 !important;
                transform: none !important;
                border-left: none;
                background: var(--bg);
            }

            body.sidebar-hidden .sidebar { opacity: 1; pointer-events: auto; } /* Desactivamos el trigger de colapso en móvil */

            /* Paneles de control más ajustados */
            .top-panel { padding: 10px 12px; }
            #channelTitle { font-size: 15px; margin-bottom: 6px; }
            #searchInput { padding: 10px 44px 10px 14px; font-size: 16px; border-radius: 10px; }

            .categories { padding: 8px 12px; gap: 5px; }
            .category-btn { padding: 6px 11px; font-size: 12px; }

            /* Tarjetas de canales ultra-optimizadas en espacio */
            #channels { padding: 4px 0; }
            .channel-card {
                margin: 4px 8px;
                padding: 6px 8px;
                border-radius: 10px;
                gap: 8px;
                contain-intrinsic-size: 58px;
            }
            .catalog-skeleton { padding-inline: 8px; }
            .catalog-skeleton__row {
                min-height: 58px;
                grid-template-columns: 18px 75px 1fr 42px;
                gap: 8px;
            }
            .catalog-skeleton__thumb { width: 75px; height: 44px; border-radius: 6px; }
            .channel-select { min-height: 44px; gap: 8px; }
            .favorite-toggle { flex-basis: 42px; width: 42px; height: 42px; border-radius: 10px; }
            .channel-number { width: 18px; font-size: 12px; }
            .thumb { width: 75px; height: 44px; border-radius: 6px; }
            .channel-name { font-size: 14px; }
            .channel-category { font-size: 11px; }
        }

        /* Estado P2P: añadido sin cambiar la estructura visual existente */
        .stream-status {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 6px;
            margin-top: 4px;
            min-height: 16px;
            font-size: 11px;
            color: var(--muted);
        }
        .stream-status__dot {
            width: 8px;
            height: 8px;
            border-radius: 999px;
            flex: 0 0 auto;
            background: #9ca3af;
        }
        .stream-status__dot.waiting { background: #ffb300; }
        .stream-status__dot.active {
            background: #16c784;
            box-shadow: 0 0 9px rgba(22, 199, 132, .8);
        }
        .stream-status__dot.error { background: #ff5252; }
        .stream-status__metrics {
            display: inline-flex;
            align-items: center;
            min-height: 20px;
            padding: 2px 7px;
            border: 1px solid rgba(255, 255, 255, .09);
            border-radius: 999px;
            background: rgba(255, 255, 255, .045);
            color: rgba(255, 255, 255, .78);
            font-variant-numeric: tabular-nums;
            white-space: nowrap;
            opacity: .96;
        }


        /* ==========================================================
           CONTENIDO ORIGINAL DEL HOME
           Se muestra debajo del reproductor y la lista.
        ========================================================== */

        html,
        body {
            height: auto;
            min-height: 100%;
            overflow-x: hidden;
            overflow-y: auto;
        }

        body {
            display: block;
        }

        header {
            position: sticky;
            top: 0;
        }

        .main-content {
            height: calc(100dvh - var(--header-total-height));
            min-height: 620px;
        }

        .home-extras {
            width: 100%;
            max-width: 1200px;
            margin: 0 auto;
            padding: 22px 15px 30px;
            background: var(--bg);
        }

        .home-content-wrapper {
            display: grid;
            grid-template-columns: 3fr 1fr;
            gap: 20px;
            align-items: start;
        }

        .home-content,
        .home-categories,
        .home-widget {
            background: rgba(17, 24, 39, 0.72);
            border: 1px solid rgba(255, 255, 255, 0.07);
            border-radius: 14px;
        }

        .home-content {
            padding: 18px;
        }

        .home-banners-row {
            display: flex;
            align-items: center;
            justify-content: center;
            flex-wrap: wrap;
            gap: 15px;
        }

        .home-banner-link {
            display: flex;
            align-items: center;
            justify-content: center;
            text-decoration: none;
            transition: transform .25s ease;
        }

        .home-banner-link:hover {
            transform: scale(1.04);
        }

        .home-banner-link img {
            width: 100%;
            max-width: 280px;
            height: auto;
            object-fit: contain;
        }

        .home-categories {
            padding: 18px;
            text-align: center;
        }

        .home-categories h3,
        .home-widget h3 {
            margin-bottom: 12px;
            font-size: 17px;
        }

        .home-categories-list {
            list-style: none;
            padding: 0;
            margin: 0;
        }

        .home-categories-list li {
            margin: 9px 0;
        }

        .home-categories-list a {
            color: #60a5fa;
            text-decoration: none;
            font-weight: 600;
        }

        .home-categories-list a:hover {
            text-decoration: underline;
        }

        .home-widgets-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
            gap: 15px;
            margin-top: 20px;
        }

        .home-widget {
            padding: 18px;
            text-align: center;
            transition: transform .25s ease, background .25s ease;
        }

        .home-widget:hover {
            transform: translateY(-3px);
            background: rgba(25, 33, 55, 0.82);
        }

        .home-widget a {
            display: block;
        }

        .home-widget img {
            width: auto;
            max-width: 80%;
            max-height: 150px;
            margin: 0 auto;
            object-fit: contain;
        }

        @media (max-width: 1024px) {
            .main-content {
                height: calc(100dvh - var(--header-total-height));
                min-height: 620px;
            }
        }

        @media (max-width: 900px) {
            .home-content-wrapper {
                grid-template-columns: 1fr;
            }

            .home-banner-link img {
                max-width: 190px;
            }

            .home-extras {
                padding-top: 16px;
            }
        }


        /* ===========================
           INSTALACIÓN PWA
        =========================== */
        .install-app-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 7px;
            min-height: 40px;
            padding: 8px 13px;
            margin: 0;
            border: 1px solid rgba(0, 212, 255, .45);
            border-radius: 12px;
            background: rgba(0, 212, 255, .12);
            color: #fff;
            font: inherit;
            font-size: 13px;
            font-weight: 800;
            cursor: pointer;
            transition: .2s ease;
        }
        .install-app-btn:hover {
            background: rgba(0, 212, 255, .23);
            transform: translateY(-1px);
        }
        .install-app-btn[hidden] { display: none !important; }

        .pwa-modal[hidden] { display: none !important; }
        .pwa-modal {
            position: fixed;
            inset: 0;
            z-index: 100000;
            display: grid;
            place-items: center;
            padding: 18px;
            background: rgba(0, 0, 0, .72);
            backdrop-filter: blur(8px);
        }
        .pwa-modal__card {
            width: min(430px, 100%);
            border: 1px solid rgba(255, 255, 255, .13);
            border-radius: 20px;
            background: #101827;
            color: #fff;
            box-shadow: 0 24px 80px rgba(0, 0, 0, .55);
            padding: 22px;
        }
        .pwa-modal__head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 16px;
            margin-bottom: 12px;
        }
        .pwa-modal__head h2 { font-size: 20px; }
        .pwa-modal__close {
            width: 38px;
            height: 38px;
            border: 0;
            border-radius: 10px;
            background: rgba(255,255,255,.09);
            color: #fff;
            font-size: 22px;
            cursor: pointer;
        }
        .pwa-modal p, .pwa-modal li {
            color: #d1d5db;
            line-height: 1.55;
        }
        .pwa-modal ol { padding-left: 22px; margin-top: 12px; }
        .pwa-modal__tip {
            margin-top: 14px;
            padding: 12px;
            border-radius: 12px;
            background: rgba(0, 212, 255, .09);
            border: 1px solid rgba(0, 212, 255, .18);
        }

        @media (max-width: 640px) {
            .install-app-btn {
                padding: 8px 10px;
                font-size: 0;
                margin: 0;
            }
            .install-app-btn::before {
                content: "⬇";
                font-size: 19px;
            }
        }


        /* ==========================================================
           REPRODUCTOR COMPLETO: Plyr + HLS.js + P2P
        ========================================================== */
        .player-wrapper {
            isolation: isolate;
        }

        .player-wrapper .plyr {
            --plyr-control-icon-size: 19px;
            --plyr-control-spacing: 10px;
            --plyr-control-radius: 10px;
            --plyr-range-thumb-height: 14px;
            --plyr-range-track-height: 5px;
            --plyr-font-size-small: 13px;
        }

        .player-wrapper .plyr,
        .player-wrapper .plyr__video-wrapper,
        .player-wrapper video {
            width: 100%;
            height: 100%;
        }

        .player-wrapper .plyr__video-wrapper {
            background: #000;
        }

        /* Pantalla completa real: únicamente video y controles del reproductor. */
        .player-wrapper .plyr:fullscreen,
        .player-wrapper .plyr:-webkit-full-screen,
        .player-wrapper .plyr.plyr--fullscreen-active,
        .player-wrapper .plyr.plyr--fullscreen-fallback {
            position: fixed !important;
            inset: 0 !important;
            z-index: 2147483647 !important;
            width: 100vw !important;
            height: 100dvh !important;
            min-width: 100vw !important;
            min-height: 100dvh !important;
            max-width: none !important;
            max-height: none !important;
            margin: 0 !important;
            background: #000 !important;
        }

        .player-wrapper .plyr:fullscreen .plyr__video-wrapper,
        .player-wrapper .plyr:fullscreen video,
        .player-wrapper .plyr:-webkit-full-screen .plyr__video-wrapper,
        .player-wrapper .plyr:-webkit-full-screen video,
        .player-wrapper .plyr.plyr--fullscreen-active .plyr__video-wrapper,
        .player-wrapper .plyr.plyr--fullscreen-active video,
        .player-wrapper .plyr.plyr--fullscreen-fallback .plyr__video-wrapper,
        .player-wrapper .plyr.plyr--fullscreen-fallback video {
            width: 100% !important;
            height: 100% !important;
            max-width: none !important;
            max-height: none !important;
            object-fit: contain !important;
            background: #000 !important;
        }

        body.player-fullscreen-active header,
        body.player-fullscreen-active .actions-bar,
        body.player-fullscreen-active .sidebar,
        body.player-fullscreen-active .home-extras {
            display: none !important;
        }

        body.player-fullscreen-active,
        body.player-fullscreen-active .main-content,
        body.player-fullscreen-active .player-section,
        body.player-fullscreen-active .player-wrapper {
            width: 100vw !important;
            height: 100dvh !important;
            min-width: 100vw !important;
            min-height: 100dvh !important;
            max-width: none !important;
            max-height: none !important;
            margin: 0 !important;
            padding: 0 !important;
            overflow: hidden !important;
            background: #000 !important;
        }

        .player-wrapper .plyr__controls {
            padding-bottom: max(10px, env(safe-area-inset-bottom));
            background:
                linear-gradient(
                    transparent,
                    rgba(0, 0, 0, 0.28) 24%,
                    rgba(0, 0, 0, 0.88)
                );
        }

        .player-wrapper .plyr__control,
        .action-btn,
        .categories-scroll-btn,
        .pwa-modal__close {
            min-width: 44px;
            min-height: 44px;
        }

        .player-wrapper .plyr__menu__container {
            max-height: min(70vh, 430px);
            overflow-y: auto;
        }

        .player-wrapper .plyr__control--overlaid {
            width: 64px;
            height: 64px;
            padding: 19px;
            background: rgba(0, 212, 255, 0.92);
            box-shadow: 0 10px 35px rgba(0, 0, 0, 0.42);
        }

        .player-wrapper .plyr__control--overlaid:hover {
            background: #00d4ff;
        }

        @media (max-width: 1024px) {
            .player-section {
                height: clamp(270px, 44dvh, 430px);
                min-height: 270px;
            }

            .player-wrapper {
                flex: 1 1 auto;
                min-height: 0;
            }

            .actions-bar {
                flex: 0 0 auto;
                min-height: 54px;
                padding-left: max(10px, env(safe-area-inset-left));
                padding-right: max(10px, env(safe-area-inset-right));
            }

            .player-wrapper .plyr {
                --plyr-control-spacing: 8px;
                --plyr-control-icon-size: 18px;
            }
        }

        @media (max-width: 640px) {
            header {
                height: var(--header-total-height);
                padding-left: max(10px, env(safe-area-inset-left));
                padding-right: max(8px, env(safe-area-inset-right));
            }

            :root {
                --header-height: 54px;
            }

            .logo {
                gap: 7px;
                font-size: 17px;
            }

            .logo img {
                width: 34px;
                height: 34px;
            }

            .player-section {
                height: clamp(260px, 46dvh, 370px);
                min-height: 260px;
            }

            .actions-bar {
                min-height: 50px;
                padding-top: 6px;
                padding-bottom: 6px;
            }

            .channel-logo {
                width: 34px;
                height: 34px;
            }

            .stream-status {
                gap: 4px;
                font-size: 9.5px;
            }

            .stream-status__metrics {
                display: inline-flex;
                flex-basis: 100%;
                width: max-content;
                max-width: 100%;
                margin-top: 1px;
                padding: 2px 6px;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            .player-wrapper .plyr {
                --plyr-control-spacing: 6px;
                --plyr-control-icon-size: 17px;
                --plyr-font-size-small: 12px;
            }

            .player-wrapper .plyr__controls {
                padding-left: 7px;
                padding-right: 7px;
            }

            .player-wrapper .plyr__control--overlaid {
                width: 56px;
                height: 56px;
                padding: 17px;
            }
        }

        @media (max-width: 390px) {
            .player-wrapper .plyr__volume {
                min-width: auto;
                width: auto;
            }

            .player-wrapper .plyr__volume input[type="range"] {
                display: none;
            }
        }

        @media (orientation: landscape) and (max-height: 520px) and (max-width: 1024px) {
            header {
                position: relative;
            }

            .main-content {
                height: auto;
                min-height: calc(100dvh - var(--header-total-height));
                overflow-x: hidden;
                overflow-y: auto;
                overscroll-behavior-y: contain;
                -webkit-overflow-scrolling: touch;
            }

            .player-section {
                height: calc(100dvh - var(--header-total-height));
                min-height: 320px;
            }

            .sidebar {
                min-height: 100dvh;
            }
        }

        /* iPad horizontal y ventanas amplias de iPadOS: video + catálogo. */
        @media (orientation: landscape) and (min-width: 768px) and (min-height: 600px) and (max-width: 1180px) {
            .main-content {
                flex-direction: row;
                width: 100%;
                height: calc(100dvh - var(--header-total-height));
                min-height: 0;
            }

            .player-section {
                flex: 1 1 auto;
                width: auto;
                height: 100%;
                min-width: 0;
                min-height: 0;
            }

            .player-wrapper {
                flex: 1 1 auto;
                width: 100%;
                height: auto;
                min-height: 0;
            }

            .sidebar,
            body.sidebar-hidden .sidebar {
                flex: 0 0 clamp(320px, 36vw, 420px);
                width: clamp(320px, 36vw, 420px) !important;
                height: 100%;
                min-width: 320px;
                min-height: 0;
                opacity: 1;
                pointer-events: auto;
                border-left: 1px solid rgba(255, 255, 255, .08);
            }

            .actions-bar {
                min-height: 60px;
                padding: 8px 12px;
            }

            .thumb {
                width: 82px;
                height: 46px;
            }
        }

        @media (hover: none) and (pointer: coarse) {
            .action-btn:hover,
            .channel-card:hover,
            .category-btn:hover,
            .home-banner-link:hover,
            .home-widget:hover,
            #toggleListBtn:hover {
                transform: none;
            }
        }

        /* Selector manual PC/Móvil. Sin elección, gobierna la adaptación automática. */
        html[data-view-mode="desktop"] .main-content {
            flex-direction: row !important;
            width: 100% !important;
            max-width: none !important;
            height: calc(100dvh - var(--header-total-height)) !important;
            min-height: 620px !important;
            margin: 0 !important;
        }
        html[data-view-mode="desktop"] .player-section {
            flex: 1 1 auto !important;
            width: auto !important;
            height: 100% !important;
            min-width: 0 !important;
            min-height: 0 !important;
        }
        html[data-view-mode="desktop"] .sidebar {
            flex: 0 0 var(--sidebar-width) !important;
            width: var(--sidebar-width) !important;
            min-width: var(--sidebar-width) !important;
            height: 100% !important;
            opacity: 1 !important;
            pointer-events: auto !important;
            border-left: 1px solid rgba(255,255,255,.08) !important;
        }
        html[data-view-mode="desktop"] body.sidebar-hidden .sidebar {
            flex-basis: 0 !important;
            width: 0 !important;
            min-width: 0 !important;
            opacity: 0 !important;
            pointer-events: none !important;
        }
        html[data-view-mode="desktop"] #toggleListBtn { display: flex !important; }
        html[data-view-mode="desktop"] .actions-group div { display: block !important; }
        html[data-view-mode="desktop"] .actions-bar { padding: 12px 18px !important; }
        html[data-view-mode="desktop"] .channel-logo { width: 48px; height: 48px; }
        html[data-view-mode="desktop"] .thumb { width: 100px; height: 56px; }

        html[data-view-mode="mobile"] body {
            background:
                radial-gradient(circle at 50% 12%, rgba(0,212,255,.08), transparent 30rem),
                var(--bg);
        }
        html[data-view-mode="mobile"] .main-content {
            flex-direction: column !important;
            width: min(100%, 760px) !important;
            height: calc(100dvh - var(--header-total-height)) !important;
            min-height: 620px !important;
            margin: 0 auto !important;
            border-inline: 1px solid rgba(255,255,255,.06);
            box-shadow: 0 22px 70px rgba(0,0,0,.35);
        }
        html[data-view-mode="mobile"] .player-section {
            flex: none !important;
            width: 100% !important;
            height: clamp(270px, 44dvh, 430px) !important;
            min-height: 270px !important;
        }
        html[data-view-mode="mobile"] .sidebar,
        html[data-view-mode="mobile"] body.sidebar-hidden .sidebar {
            flex: 1 1 auto !important;
            width: 100% !important;
            min-width: 0 !important;
            height: auto !important;
            min-height: 0 !important;
            opacity: 1 !important;
            pointer-events: auto !important;
            border-left: 0 !important;
        }
        html[data-view-mode="mobile"] #toggleListBtn { display: none !important; }
        html[data-view-mode="mobile"] .actions-group div { display: none !important; }
        html[data-view-mode="mobile"] .actions-bar { padding: 8px 12px !important; }
        html[data-view-mode="mobile"] .channel-logo { width: 36px; height: 36px; }
        html[data-view-mode="mobile"] .now-playing { gap: 8px; }
        html[data-view-mode="mobile"] .now-playing h3 { font-size: 14px; }
        html[data-view-mode="mobile"] .now-playing small { font-size: 11px; }
        html[data-view-mode="mobile"] .top-panel { padding: 10px 12px; }
        html[data-view-mode="mobile"] #channelTitle { font-size: 15px; margin-bottom: 6px; }
        html[data-view-mode="mobile"] #searchInput {
            padding: 10px 44px 10px 14px;
            border-radius: 10px;
        }
        html[data-view-mode="mobile"] .categories { padding: 8px 12px; gap: 5px; }
        html[data-view-mode="mobile"] .category-btn { padding: 6px 11px; font-size: 12px; }
        html[data-view-mode="mobile"] #channels { padding: 4px 0; }
        html[data-view-mode="mobile"] .channel-card {
            margin: 4px 8px;
            padding: 6px 8px;
            border-radius: 10px;
            gap: 8px;
            contain-intrinsic-size: 58px;
        }
        html[data-view-mode="mobile"] .catalog-skeleton { padding-inline: 8px; }
        html[data-view-mode="mobile"] .catalog-skeleton__row {
            min-height: 58px;
            grid-template-columns: 18px 75px 1fr 42px;
            gap: 8px;
        }
        html[data-view-mode="mobile"] .catalog-skeleton__thumb {
            width: 75px;
            height: 44px;
            border-radius: 6px;
        }
        html[data-view-mode="mobile"] .channel-select { min-height: 44px; gap: 8px; }
        html[data-view-mode="mobile"] .favorite-toggle {
            flex-basis: 42px;
            width: 42px;
            height: 42px;
            border-radius: 10px;
        }
        html[data-view-mode="mobile"] .channel-number { width: 18px; font-size: 12px; }
        html[data-view-mode="mobile"] .thumb { width: 75px; height: 44px; border-radius: 6px; }
        html[data-view-mode="mobile"] .channel-name { font-size: 14px; }
        html[data-view-mode="mobile"] .channel-category { font-size: 11px; }
        html[data-view-mode="mobile"] .home-extras { max-width: 760px; }
        html[data-view-mode="mobile"] .home-content-wrapper { grid-template-columns: 1fr; }
        html[data-view-mode="mobile"] .actions-group { gap: 4px; }
        html[data-view-mode="mobile"] #embedBtn { display: none; }

        html.view-mode-changing .main-content {
            opacity: .86;
            transform: scale(.997);
            transition: opacity .24s ease, transform .24s ease;
        }

        /* Pantalla completa y embed siempre dominan sobre el modo visual manual. */
        html[data-view-mode] body.player-fullscreen-active .main-content,
        html[data-view-mode] body.player-fullscreen-active .player-section,
        html[data-view-mode] body.player-fullscreen-active .player-wrapper,
        html[data-view-mode] body.embed-mode .main-content,
        html[data-view-mode] body.embed-mode .player-section,
        html[data-view-mode] body.embed-mode .player-wrapper {
            width: 100vw !important;
            height: 100dvh !important;
            min-width: 100vw !important;
            min-height: 100dvh !important;
            max-width: none !important;
            max-height: none !important;
            margin: 0 !important;
            padding: 0 !important;
            border: 0 !important;
            box-shadow: none !important;
        }
        html[data-view-mode] body.player-fullscreen-active .main-content,
        html[data-view-mode] body.embed-mode .main-content {
            display: block !important;
            transform: none !important;
            opacity: 1 !important;
        }

        @media (max-width: 720px) {
            .header-actions { gap: 5px; }
            .view-mode-btn { min-width: 44px; padding: 7px 9px; }
            .view-mode-label { display: none; }
            .logo-live { display: none; }
            .actions-group { gap: 4px; }
            #embedBtn { display: none; }
        }

        @media (max-width: 390px) {
            .logo > span:not(.logo-live) { display: none; }
            .header-actions { flex: 1; }
        }

        @media (max-width: 480px) {
            #randomBtn { display: none; }
        }


        /* ==========================================================
           NAVEGACIÓN VISIBLE DE CATEGORÍAS Y CANALES
        ========================================================== */
        .categories-nav {
            display: grid;
            grid-template-columns: 38px minmax(0, 1fr) 38px;
            align-items: center;
            gap: 6px;
            padding: 7px 10px;
            background: rgba(12, 17, 32, 0.94);
            border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        }

        .categories-nav .categories {
            min-width: 0;
            padding: 3px 2px 8px;
            border-bottom: 0;
            background: transparent;
            scroll-behavior: smooth;
            scrollbar-width: thin;
            scrollbar-color: var(--accent) rgba(255,255,255,.08);
        }

        .categories-nav .categories::-webkit-scrollbar {
            display: block;
            height: 6px;
        }

        .categories-nav .categories::-webkit-scrollbar-track {
            background: rgba(255, 255, 255, .07);
            border-radius: 999px;
        }

        .categories-nav .categories::-webkit-scrollbar-thumb {
            background: linear-gradient(90deg, var(--accent), #008fcc);
            border-radius: 999px;
        }

        .categories-scroll-btn {
            width: 36px;
            height: 36px;
            border: 1px solid rgba(0, 212, 255, .28);
            border-radius: 11px;
            background: rgba(0, 212, 255, .1);
            color: #fff;
            font-size: 27px;
            line-height: 1;
            cursor: pointer;
            display: grid;
            place-items: center;
            transition: background .2s ease, transform .2s ease, opacity .2s ease;
        }

        .categories-scroll-btn:hover:not(:disabled) {
            background: rgba(0, 212, 255, .24);
            transform: scale(1.04);
        }

        .categories-scroll-btn:disabled {
            opacity: .28;
            cursor: default;
        }

        .channels-scroll-hint {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            padding: 5px 14px;
            color: #8f9bad;
            background: rgba(12, 17, 32, .76);
            border-bottom: 1px solid rgba(255, 255, 255, .04);
            font-size: 10px;
            font-weight: 600;
            letter-spacing: .02em;
        }

        #channels {
            scrollbar-width: thin;
            scrollbar-color: var(--accent) rgba(255,255,255,.06);
            scroll-behavior: smooth;
            overscroll-behavior: contain;
        }

        #channels::-webkit-scrollbar {
            width: 10px;
        }

        #channels::-webkit-scrollbar-track {
            background: rgba(255, 255, 255, .05);
            border-radius: 999px;
        }

        #channels::-webkit-scrollbar-thumb {
            background: linear-gradient(180deg, var(--accent), #007aa8);
            border: 2px solid rgba(12, 17, 32, .9);
            border-radius: 999px;
        }

        #channels::-webkit-scrollbar-thumb:hover {
            background: linear-gradient(180deg, #37e0ff, #00a7df);
        }

        @media (max-width: 640px) {
            .categories-nav {
                grid-template-columns: 34px minmax(0, 1fr) 34px;
                gap: 4px;
                padding: 5px 7px;
            }

            .categories-scroll-btn {
                width: 32px;
                height: 32px;
                border-radius: 9px;
                font-size: 24px;
            }

            .categories-nav .categories {
                padding-bottom: 7px;
            }

            .categories-nav .categories::-webkit-scrollbar {
                height: 5px;
            }

            .channels-scroll-hint {
                padding: 4px 10px;
                font-size: 9px;
            }

            #channels::-webkit-scrollbar {
                width: 7px;
            }
        }


        /* ==========================================================
           INSERTAR REPRODUCTOR Y MODO EMBED P2P
        ========================================================== */
        .embed-modal {
            position: fixed;
            inset: 0;
            z-index: 10050;
            display: grid;
            place-items: center;
            padding: 18px;
            background: rgba(0, 0, 0, .78);
            backdrop-filter: blur(12px);
        }

        .embed-modal[hidden] {
            display: none;
        }

        .embed-modal__dialog {
            position: relative;
            width: min(720px, 100%);
            max-height: 92dvh;
            overflow-y: auto;
            padding: 24px;
            border: 1px solid rgba(0, 212, 255, .22);
            border-radius: 18px;
            color: #fff;
            background: #101728;
            box-shadow: 0 24px 80px rgba(0, 0, 0, .55);
        }

        .embed-modal__dialog h2 {
            margin: 0 42px 8px 0;
            font-size: 22px;
        }

        .embed-modal__description,
        .embed-modal__note {
            color: #aab5c6;
            line-height: 1.5;
        }

        .embed-modal__note {
            margin: 14px 0 0;
            font-size: 12px;
        }

        .embed-modal__close {
            position: absolute;
            top: 14px;
            right: 14px;
            width: 36px;
            height: 36px;
            border: 0;
            border-radius: 50%;
            color: #fff;
            background: rgba(255,255,255,.1);
            font-size: 24px;
            cursor: pointer;
        }

        .embed-modal__preview {
            aspect-ratio: 16 / 9;
            margin: 18px 0;
            overflow: hidden;
            border-radius: 12px;
            background: #000;
        }

        .embed-modal__preview iframe {
            display: block;
            width: 100%;
            height: 100%;
            border: 0;
        }

        .embed-modal__label {
            display: block;
            margin-bottom: 7px;
            font-size: 13px;
            font-weight: 700;
        }

        .embed-modal__code {
            width: 100%;
            min-height: 132px;
            padding: 12px;
            resize: vertical;
            border: 1px solid rgba(255,255,255,.12);
            border-radius: 10px;
            color: #dffaff;
            background: #080d18;
            font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
        }

        .embed-modal__sizes,
        .embed-modal__actions {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 12px;
        }

        .embed-size-btn,
        .embed-copy-btn,
        .embed-secondary-btn {
            border: 1px solid rgba(0, 212, 255, .22);
            border-radius: 10px;
            padding: 9px 14px;
            color: #fff;
            background: rgba(255,255,255,.06);
            cursor: pointer;
        }

        .embed-size-btn.active,
        .embed-copy-btn {
            color: #001018;
            background: var(--accent);
            font-weight: 800;
        }

        .embed-modal__status {
            min-height: 20px;
            margin: 10px 0 0;
            color: #74f6b0;
            font-size: 13px;
        }

        body.embed-mode {
            overflow: hidden;
            background: #000;
        }

        body.embed-mode header,
        body.embed-mode .sidebar,
        body.embed-mode .actions-bar {
            display: none !important;
        }

        body.embed-mode .main-content,
        body.embed-mode .player-section,
        body.embed-mode .player-wrapper {
            width: 100%;
            height: 100dvh;
            min-height: 100dvh;
            max-height: none;
        }

        body.embed-mode .main-content {
            display: block;
        }

        body.embed-mode .player-section {
            position: fixed;
            inset: 0;
        }

        body.embed-mode .player-wrapper .plyr,
        body.embed-mode .player-wrapper video,
        body.embed-mode .player-wrapper .plyr__video-wrapper {
            width: 100%;
            height: 100%;
        }

        body.embed-mode::after {
            content: "TVAbierta.net · P2P";
            position: fixed;
            z-index: 20;
            top: 10px;
            left: 10px;
            padding: 5px 9px;
            border-radius: 8px;
            color: rgba(255,255,255,.86);
            background: rgba(0,0,0,.5);
            font-size: 10px;
            font-weight: 700;
            pointer-events: none;
        }

        @media (max-width: 640px) {
            .embed-modal {
                padding: 8px;
            }

            .embed-modal__dialog {
                padding: 18px;
                border-radius: 14px;
            }

            .embed-modal__actions > button {
                flex: 1;
            }
        }


        /* ==========================================================
           ACCESOS RÁPIDOS COMPACTOS
           Reemplaza visualmente los banners grandes por botones pequeños.
        ========================================================== */
        .home-extras.compact-links {
            width: 100%;
            max-width: none;
            margin: 0;
            padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
            background: #080d18;
            border-top: 1px solid rgba(255, 255, 255, .06);
        }

        .quick-links {
            width: min(100%, 1180px);
            margin: 0 auto;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-wrap: wrap;
            gap: 6px;
        }

        .quick-link {
            min-height: 34px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            padding: 5px 9px;
            border: 1px solid rgba(255, 255, 255, .08);
            border-radius: 9px;
            background: rgba(255, 255, 255, .045);
            color: #cbd5e1;
            text-decoration: none;
            font-size: 11px;
            font-weight: 650;
            line-height: 1;
            white-space: nowrap;
            transition:
                background .18s ease,
                border-color .18s ease,
                color .18s ease,
                transform .18s ease;
        }

        .quick-link:hover,
        .quick-link:focus-visible {
            background: rgba(0, 212, 255, .11);
            border-color: rgba(0, 212, 255, .32);
            color: #fff;
            transform: translateY(-1px);
            outline: none;
        }

        .quick-link__icon {
            width: 18px;
            height: 18px;
            display: inline-grid;
            place-items: center;
            flex: 0 0 18px;
            border-radius: 5px;
            background: rgba(0, 212, 255, .10);
            color: var(--accent);
            font-size: 11px;
            font-weight: 900;
            line-height: 1;
        }

        .quick-link__text {
            overflow: hidden;
            text-overflow: ellipsis;
        }

        @media (max-width: 640px) {
            .home-extras.compact-links {
                padding: 6px 7px calc(6px + env(safe-area-inset-bottom));
            }

            .quick-links {
                justify-content: flex-start;
                flex-wrap: nowrap;
                overflow-x: auto;
                overscroll-behavior-x: contain;
                scrollbar-width: none;
                -webkit-overflow-scrolling: touch;
            }

            .quick-links::-webkit-scrollbar {
                display: none;
            }

            .quick-link {
                min-height: 32px;
                padding: 5px 8px;
                font-size: 10px;
                flex: 0 0 auto;
            }

            .quick-link__icon {
                width: 17px;
                height: 17px;
                flex-basis: 17px;
                font-size: 10px;
            }
        }

        @media (max-width: 390px) {
            .quick-link {
                gap: 5px;
                padding-inline: 7px;
            }
        }

