/* ═══════════════════════════════════════════════════════════
   NUB WEB · v2 · Responsive · TV · Netflix Polish · Accordion
   ═══════════════════════════════════════════════════════════ */

/* ───── 1. Fluid typography & safe areas ───── */
html { font-size: clamp(14px, 1.05vw + 11px, 17px); }
body {
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
}
.app-header { padding-top: max(0px, env(safe-area-inset-top, 0)); }

/* ───── 2. Search bar — fix overlap with first category ───── */
.search-bar {
    position: relative !important;
    top: auto !important;
    margin: 8px 18px 14px !important;
}
.search-bar input {
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.search-bar input:focus {
    border-color: var(--primary, #E50914) !important;
    background: rgba(255,255,255,.04) !important;
    box-shadow: 0 0 0 3px rgba(229,9,20,.18);
}

/* ───── 3. D-pad / TV focus ───── */
button:focus-visible,
a:focus-visible,
input:focus-visible,
.cat-acc-head:focus-visible,
.tv-card:focus-visible,
.movie-poster:focus-visible,
.cat-row:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--primary, #E50914);
    outline-offset: 3px;
    border-radius: 12px;
    z-index: 5;
    position: relative;
}
.tab-btn:focus-visible { outline-offset: -3px; }
@media (hover: hover) {
    .tv-card:hover, .movie-poster:hover {
        transform: translateY(-3px) scale(1.03);
        box-shadow: 0 14px 28px rgba(0,0,0,.55), 0 0 0 2px var(--primary, #E50914);
        z-index: 4;
    }
    .cat-acc-head:hover { background: rgba(255,255,255,.04); }
}

/* ───── 4. Universal floating back button ───── */
.nub-back {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0) + 60px);
    left: 14px;
    width: 44px; height: 44px;
    border: none;
    background: rgba(20,20,20,.82);
    backdrop-filter: blur(14px) saturate(150%);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
    color: #fff;
    font-size: 22px;
    font-weight: 600;
    border-radius: 50%;
    cursor: pointer;
    z-index: 95;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,.45);
    transition: transform .18s ease, background .18s ease;
}
.nub-back.show { display: flex; }
.nub-back:hover, .nub-back:focus-visible {
    background: var(--primary, #E50914);
    transform: scale(1.08);
}
.nub-back:active { transform: scale(.94); }
.detail-back { display: none !important; }

/* ───── 5. View transitions ───── */
#viewHome, #viewVod, #viewSeries, #viewLive,
#viewGrid, #viewMovieDetail, #viewSerieDetail {
    animation: nub-fade .26s ease both;
}
@keyframes nub-fade {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ───── 6. ACCORDION CATEGORIES (Netflix-style) ───── */
.cat-acc {
    background: var(--surface, #1a1a1a);
    border: 1px solid var(--border, rgba(255,255,255,.08));
    border-radius: 14px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: border-color .2s ease;
}
.cat-acc.open {
    border-color: rgba(229,9,20,.4);
    background: linear-gradient(180deg, var(--surface, #1a1a1a) 0%, var(--bg-2, #0a0a0a) 100%);
}
.cat-acc-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
    transition: background .15s ease;
}
.cat-acc-head:active { background: rgba(255,255,255,.05); }
.cat-acc-head .folder-ico { font-size: 20px; flex-shrink: 0; }
.cat-acc-head .cat-name {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--text, #fff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cat-acc-head .cat-count {
    background: rgba(255,255,255,.08);
    color: var(--text-2, rgba(255,255,255,.75));
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    flex-shrink: 0;
}
.cat-acc.open .cat-acc-head .cat-count {
    background: rgba(229,9,20,.18);
    color: var(--primary, #E50914);
}
.cat-acc-head .cat-refresh {
    width: 32px; height: 32px;
    border: none;
    background: transparent;
    color: var(--text-3, rgba(255,255,255,.5));
    font-size: 16px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s ease;
    flex-shrink: 0;
}
.cat-acc-head .cat-refresh:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
    transform: rotate(180deg);
}
.cat-acc-head .cat-refresh.spinning {
    animation: nub-spin 0.9s linear infinite;
    color: var(--primary, #E50914);
}
@keyframes nub-spin { to { transform: rotate(360deg); } }

.cat-acc-head .cat-arrow {
    color: var(--text-3, rgba(255,255,255,.5));
    font-size: 18px;
    transition: transform .25s ease;
    flex-shrink: 0;
    width: 16px;
    text-align: center;
}
.cat-acc.open .cat-acc-head .cat-arrow { transform: rotate(90deg); color: var(--primary, #E50914); }

.cat-acc-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height .35s ease;
}
.cat-acc.open .cat-acc-body { max-height: 4000px; }
.cat-acc-inner { padding: 0 12px 16px; }

/* ───── 7. Accordion content scrollers (Netflix-style horizontal rows) ───── */
.acc-scroller {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 4px 12px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.acc-scroller::-webkit-scrollbar { height: 6px; }
.acc-scroller::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }
.acc-scroller > * {
    flex: 0 0 auto;
    scroll-snap-align: start;
}
.acc-poster {
    width: 110px;
    border-radius: 10px;
    overflow: hidden;
    background: #111;
    position: relative;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}
.acc-poster::after {
    content: '';
    display: block;
    padding-bottom: 150%; /* 2:3 poster */
}
.acc-poster img,
.acc-poster .ph {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.acc-poster .ph {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: linear-gradient(135deg, #1a1a1a, #0a0a0a);
    color: var(--text-3, rgba(255,255,255,.5));
}
.acc-poster .lbl {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 18px 8px 6px;
    background: linear-gradient(180deg, transparent, rgba(0,0,0,.92));
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 3px rgba(0,0,0,.6);
}

/* Live channel cards in accordion (square) */
.acc-tv {
    width: 100px;
    text-align: center;
    cursor: pointer;
}
.acc-tv .sq {
    width: 100px;
    height: 100px;
    background: var(--surface-2, #232323);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 6px;
    transition: transform .2s ease, box-shadow .2s ease;
    position: relative;
}
.acc-tv .sq img { width: 100%; height: 100%; object-fit: contain; padding: 12px; }
.acc-tv .sq .ph { font-size: 22px; font-weight: 800; color: var(--primary, #E50914); }
.acc-tv .lbl {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-2, rgba(255,255,255,.75));
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.acc-tv:hover .sq, .acc-tv:focus-visible .sq {
    transform: scale(1.06);
    box-shadow: 0 0 0 2px var(--primary, #E50914), 0 8px 20px rgba(0,0,0,.5);
}

/* "Ver todos" pill at end of scroller */
.acc-more {
    flex: 0 0 auto;
    align-self: center;
    background: rgba(255,255,255,.06);
    border: 1px dashed rgba(255,255,255,.2);
    color: var(--text-2, rgba(255,255,255,.75));
    border-radius: 12px;
    padding: 18px 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all .18s ease;
    min-width: 90px;
}
.acc-more:hover {
    background: rgba(229,9,20,.12);
    border-color: var(--primary, #E50914);
    color: var(--primary, #E50914);
}

.acc-loader, .acc-empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--text-3, rgba(255,255,255,.5));
    font-size: 13px;
}
.acc-loader .spinner { margin: 0 auto 10px; }

/* ───── 7a. Nub TV branded loader ───── */
.nub-loader-logo {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    animation: nub-glow 2.4s ease-in-out infinite;
}
@keyframes nub-glow {
    0%, 100% { opacity: .35; filter: brightness(.75); }
    50%      { opacity: 1;   filter: brightness(1.1); }
}
.full-loader .nub-loader-logo {
    width: 80px;
    height: 80px;
    border-radius: 20px;
}
.video-loader .nub-loader-logo {
    width: 56px;
    height: 56px;
    border-radius: 14px;
}
.video-loader {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.video-loader.show {
    display: flex !important;
}
.video-loader p {
    color: var(--text-2, rgba(255,255,255,.7));
    font-size: 13px;
    font-weight: 500;
    margin: 0;
    animation: nub-glow-text 2.4s ease-in-out infinite;
}
@keyframes nub-glow-text {
    0%, 100% { opacity: .4; }
    50% { opacity: 1; }
}
.inline-loader .spinner,
.spinner-big {
    display: none;
}
.inline-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.inline-loader::before {
    content: '';
    display: block;
    width: 48px;
    height: 48px;
    margin: 0 auto 10px;
    background: url(../nub-tv-icon.png) center/contain no-repeat;
    border-radius: 12px;
    animation: nub-glow 2.4s ease-in-out infinite;
}
.inline-loader p {
    animation: nub-glow-text 2.4s ease-in-out infinite;
}

/* ───── 7b. Content search bar + results ───── */
.search-bar-content {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--surface, #1a1a1a) !important;
    border: 1px solid rgba(229,9,20,.25) !important;
    border-radius: 14px !important;
    padding: 0 14px !important;
    margin-bottom: 4px !important;
}
.search-bar-content:focus-within {
    border-color: var(--primary, #E50914) !important;
    box-shadow: 0 0 0 3px rgba(229,9,20,.12);
}
.search-bar-ico {
    flex-shrink: 0;
    color: var(--primary, #E50914);
    opacity: .7;
    display: flex;
    align-items: center;
}
.search-bar-content input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    padding: 12px 10px !important;
    color: var(--text, #fff) !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    outline: none !important;
}
.search-bar-content input::placeholder {
    color: var(--text-3, rgba(255,255,255,.45)) !important;
    font-weight: 400 !important;
}
.search-clear {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255,255,255,.08);
    color: var(--text-2, rgba(255,255,255,.7));
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s ease;
}
.search-clear:hover { background: rgba(255,255,255,.15); }

/* Search results dropdown */
.search-results {
    display: none;
    background: var(--bg-2, #111);
    border: 1px solid var(--border, rgba(255,255,255,.08));
    border-radius: 14px;
    margin-bottom: 12px;
    max-height: 420px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.search-results-header {
    padding: 8px 14px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-3, rgba(255,255,255,.5));
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,.06));
}
.search-result-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background .12s ease;
    border-bottom: 1px solid rgba(255,255,255,.04);
}
.search-result-row:last-child { border-bottom: none; }
.search-result-row:hover,
.search-result-row:focus-visible {
    background: rgba(229,9,20,.08);
}
.sr-thumb {
    width: 48px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface, #1a1a1a);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sr-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.sr-ph {
    font-size: 14px;
    font-weight: 800;
    color: var(--primary, #E50914);
}
.sr-info { flex: 1; min-width: 0; }
.sr-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text, #fff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sr-meta {
    display: flex;
    gap: 8px;
    margin-top: 3px;
    font-size: 12px;
    color: var(--text-3, rgba(255,255,255,.5));
}
.sr-rating {
    color: var(--gold, #F5C518);
    font-weight: 600;
}
.sr-genre {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    font-size: 13px;
    color: var(--text-2, rgba(255,255,255,.7));
}
.search-empty {
    padding: 20px 14px;
    text-align: center;
    font-size: 13px;
    color: var(--text-3, rgba(255,255,255,.5));
}

/* ───── 7c. TMDB enriched detail ───── */
.detail-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 14px;
    align-items: center;
}
.tmdb-rating {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(245,197,24,.12);
    color: var(--gold, #F5C518);
    font-size: 14px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid rgba(245,197,24,.25);
}
.tmdb-star { font-size: 16px; }
.tmdb-pill {
    background: rgba(255,255,255,.06);
    color: var(--text-2, rgba(255,255,255,.7));
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,.08);
}
.detail-tagline {
    font-style: italic;
    color: var(--text-3, rgba(255,255,255,.5));
    font-size: 14px;
    margin-bottom: 10px;
}
.detail-plot-wrap {
    margin-bottom: 10px;
}
.detail-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text, #fff);
    margin: 18px 0 10px;
    letter-spacing: -.3px;
}
.cast-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.cast-scroll::-webkit-scrollbar { display: none; }
.cast-card {
    flex-shrink: 0;
    width: 80px;
    text-align: center;
}
.cast-photo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--surface, #1a1a1a);
    border: 2px solid rgba(255,255,255,.08);
    display: block;
    margin: 0 auto 6px;
}
.cast-ph {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 800;
    color: var(--primary, #E50914);
}
.cast-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text, #fff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cast-role {
    font-size: 10px;
    color: var(--text-3, rgba(255,255,255,.45));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ───── 7d. SVG icon styling ───── */
.cat-row .folder-ico,
.cat-row-mod .folder-ico {
    display: flex;
    align-items: center;
    justify-content: center;
}
.cat-row .folder-ico svg,
.cat-row-mod .folder-ico svg {
    width: 20px;
    height: 20px;
    color: var(--primary, #E50914);
    opacity: .85;
}
.cat-row .cat-arrow {
    display: flex !important;
    align-items: center;
    justify-content: center;
}
.cat-row .cat-arrow svg {
    width: 18px;
    height: 18px;
}
.empty-state .ico svg {
    width: 42px;
    height: 42px;
    color: var(--text-3, rgba(255,255,255,.5));
    margin-bottom: 8px;
}

/* ───── 7c. CATEGORY ROW (cat-row-mod) ───── */
.cat-row-mod {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface, #1a1a1a);
    border: 1px solid var(--border, rgba(255,255,255,.08));
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    user-select: none;
    transition: background .15s ease, border-color .15s ease, transform .12s ease;
    position: relative;
    overflow: hidden;
}
.cat-row-mod:hover { background: var(--surface-2, #232323); border-color: rgba(255,255,255,.14); }
.cat-row-mod:active { transform: scale(.985); background: var(--surface-2, #232323); }
.cat-row-mod:focus-visible { outline: 3px solid var(--primary, #E50914); outline-offset: 2px; }
.cat-row-mod .folder-ico {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary, #E50914);
    opacity: .85;
}
.cat-row-mod .folder-ico svg { width: 20px; height: 20px; }
.cat-row-mod .cat-name {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--text, #fff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cat-row-mod .cat-count {
    background: rgba(255,255,255,.08);
    color: var(--text-2, rgba(255,255,255,.75));
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    flex-shrink: 0;
}
.cat-row-mod .cat-refresh {
    width: 36px; height: 36px;
    border: none;
    background: transparent;
    color: var(--text-3, rgba(255,255,255,.5));
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .18s ease, color .18s ease, transform .25s ease;
    flex-shrink: 0;
    padding: 0;
}
.cat-row-mod .cat-refresh svg { width: 18px; height: 18px; }
.cat-row-mod .cat-refresh:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
    transform: rotate(180deg);
}
.cat-row-mod .cat-refresh.spinning {
    animation: nub-spin .9s linear infinite;
    color: var(--primary, #E50914);
}
.cat-row-mod .cat-arrow {
    color: var(--text-3, rgba(255,255,255,.5));
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cat-row-mod .cat-arrow svg { width: 18px; height: 18px; }

/* Toast inline after refresh */
.cat-refresh-flash {
    position: absolute;
    top: 50%; right: 90px;
    transform: translateY(-50%);
    background: rgba(0,0,0,.85);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 999px;
    pointer-events: none;
    animation: flashIn .25s ease, flashOut .25s ease 1.55s both;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,.1);
    white-space: nowrap;
    z-index: 2;
}
.cat-refresh-flash.ok { color: #4ade80; border-color: rgba(74,222,128,.3); }
.cat-refresh-flash.err { color: #f87171; border-color: rgba(248,113,113,.3); }
@keyframes flashIn { from { opacity: 0; transform: translateY(-50%) translateX(8px); } to { opacity: 1; transform: translateY(-50%) translateX(0); } }
@keyframes flashOut { to { opacity: 0; transform: translateY(-50%) translateX(8px); } }
@media (max-width: 480px) {
    .cat-refresh-flash { right: 78px; font-size: 10px; padding: 4px 8px; }
}

/* ───── 8. GRID VIEWS — Netflix poster cards ───── */
/* Poster grid */
.poster-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 14px 10px !important;
    padding: 0 14px 80px !important;
}
@media (min-width: 480px) {
    .poster-grid { gap: 16px 12px !important; padding: 0 18px 80px !important; }
}
@media (min-width: 700px) {
    .poster-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 18px 14px !important; }
}
@media (min-width: 1000px) {
    .poster-grid { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
}
@media (min-width: 1400px) {
    .poster-grid { grid-template-columns: repeat(7, minmax(0, 1fr)) !important; }
}
.poster-grid .movie-poster {
    width: auto !important;
    scroll-snap-align: unset;
    position: relative;
}
.poster-grid .movie-poster .poster-img {
    border-radius: 12px !important;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0,0,0,.4);
    transition: transform .22s ease, box-shadow .22s ease;
}
.poster-grid .movie-poster:hover .poster-img,
.poster-grid .movie-poster:focus-visible .poster-img {
    transform: scale(1.04);
    box-shadow: 0 8px 28px rgba(0,0,0,.6), 0 0 0 2px var(--primary, #E50914);
}
.poster-grid .movie-poster .poster-name {
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,.85);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 2px;
}
@media (min-width: 700px) {
    .poster-grid .movie-poster .poster-name { font-size: 13px; }
}

/* TV grid */
.tv-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 14px 10px !important;
    padding: 0 14px 80px !important;
}
@media (min-width: 480px) {
    .tv-grid { gap: 16px 12px !important; padding: 0 18px 80px !important; }
}
@media (min-width: 600px) {
    .tv-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
}
@media (min-width: 900px) {
    .tv-grid { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
}
@media (min-width: 1200px) {
    .tv-grid { grid-template-columns: repeat(7, minmax(0, 1fr)) !important; }
}
.tv-card .logo-square {
    border-radius: 14px !important;
    background: var(--surface, #1a1a1a) !important;
    border: 1px solid rgba(255,255,255,.08) !important;
    box-shadow: 0 4px 14px rgba(0,0,0,.3);
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
    position: relative !important;
}
.tv-card:hover .logo-square,
.tv-card:focus-visible .logo-square {
    transform: scale(1.04);
    box-shadow: 0 8px 28px rgba(0,0,0,.6), 0 0 0 2px var(--primary, #E50914);
    border-color: rgba(229,9,20,.4) !important;
}
.tv-card .logo-square .ph {
    font-size: 20px !important;
    font-weight: 800 !important;
    color: var(--primary, #E50914) !important;
}
.tv-card .tv-name {
    margin-top: 8px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: rgba(255,255,255,.85) !important;
}
@media (min-width: 700px) {
    .tv-card .tv-name { font-size: 13px !important; }
}

/* ───── Favorite heart overlay ───── */
.fav-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 30px;
    height: 30px;
    border: none;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: rgba(255,255,255,.55);
    font-size: 15px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    opacity: 0;
    transition: opacity .18s ease, background .18s ease, color .18s ease, transform .15s ease;
    padding: 0;
}
.fav-btn.active {
    color: #E50914;
    opacity: 1;
    background: rgba(0,0,0,.65);
}
.movie-poster:hover .fav-btn,
.movie-poster:focus-within .fav-btn,
.tv-card:hover .fav-btn,
.tv-card:focus-within .fav-btn {
    opacity: 1;
}
.fav-btn:hover {
    color: #E50914;
    transform: scale(1.15);
    background: rgba(0,0,0,.7);
}
.fav-btn:active {
    transform: scale(.9);
}
/* On touch devices, always show active hearts */
@media (hover: none) {
    .fav-btn { opacity: 0; }
    .fav-btn.active { opacity: 1; }
    .movie-poster:active .fav-btn,
    .tv-card:active .fav-btn { opacity: 1; }
}
@media (min-width: 700px) {
    .fav-btn { width: 34px; height: 34px; font-size: 16px; top: 8px; right: 8px; }
}

/* ───── 8b. Performance ───── */
img { image-rendering: auto; }

/* ───── 9. Skeleton shimmer ───── */
.placeholder, .acc-loader {
    --shimmer: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.06) 50%, rgba(255,255,255,0) 100%);
}
@keyframes nub-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ───── 9b. Sidebar drawer redesign ───── */
.drawer-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    background: var(--surface, #1a1a1a);
    border: 1px solid var(--border, rgba(255,255,255,.08));
    border-radius: 12px;
    color: var(--text, #fff);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 8px;
    transition: background .15s ease, border-color .15s ease;
}
.drawer-action-btn:hover {
    background: var(--surface-2, #232323);
    border-color: rgba(255,255,255,.14);
}
.drawer-action-ico {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(229,9,20,.12);
    border-radius: 10px;
    color: var(--primary, #E50914);
    flex-shrink: 0;
}
.drawer-action-refresh .drawer-action-ico {
    background: rgba(74,222,128,.1);
    color: #4ade80;
}
.drawer-logout {
    display: flex !important;
    align-items: center;
    gap: 10px;
    justify-content: center;
}
.drawer-logout svg {
    flex-shrink: 0;
}

/* ───── 9c. Sidebar Favoritos buttons ───── */
.drawer-fav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 10px;
    color: var(--text, #fff);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 4px;
    transition: background .15s ease, border-color .15s ease;
}
.drawer-fav-btn:hover {
    background: rgba(229,9,20,.06);
    border-color: rgba(229,9,20,.2);
}
.drawer-fav-ico {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.drawer-fav-ico svg {
    width: 16px;
    height: 16px;
}
.drawer-fav-label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    text-align: left;
}
.drawer-fav-label svg {
    width: 14px;
    height: 14px;
    opacity: .6;
}
.drawer-fav-count {
    background: rgba(229,9,20,.15);
    color: var(--primary, #E50914);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    min-width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* ───── 9d. Bottom tabs SVG styling ───── */
.tab-btn .tab-ico {
    font-size: unset !important;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 24px;
}
.tab-btn .tab-ico svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
    transition: transform .2s ease, color .2s ease;
}
.tab-btn.active .tab-ico svg {
    stroke-width: 2.2;
    transform: scale(1.08);
}
.tab-btn .tab-label {
    font-size: 11px !important;
    font-weight: 600 !important;
    letter-spacing: .2px;
}

/* Carousel title SVG alignment */
.carousel-title {
    display: flex !important;
    align-items: center;
    gap: 8px;
}
.carousel-title svg {
    flex-shrink: 0;
    opacity: .7;
}

/* ───── 10. Tabs polish — DESKTOP centered floating bar ───── */
@media (min-width: 1024px) {
    .bottom-tabs {
        bottom: 18px !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%);
        width: auto !important;
        max-width: min(560px, 90vw);
        height: 60px !important;
        border-radius: 18px !important;
        background: rgba(15,15,15,.92) !important;
        backdrop-filter: blur(22px) saturate(160%);
        -webkit-backdrop-filter: blur(22px) saturate(160%);
        border: 1px solid rgba(255,255,255,.08) !important;
        border-top: 1px solid rgba(255,255,255,.08) !important;
        box-shadow: 0 12px 40px rgba(0,0,0,.5);
        padding: 0 14px;
        gap: 8px;
    }
    .tab-btn {
        flex: 0 0 auto !important;
        min-width: 88px;
        padding: 8px 16px !important;
        border-radius: 12px !important;
    }
    .tab-btn.active {
        background: rgba(229,9,20,.14);
    }
}

/* ───── 11. Page title row polish ───── */
.page-title-row {
    margin: 22px 18px 12px !important;
    padding: 0 !important;
}
.page-title-row h1 {
    font-size: clamp(22px, 3vw, 32px) !important;
    font-weight: 800;
    letter-spacing: -.5px;
    background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,.7) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ───── 12. Cat list spacing ───── */
.cat-list {
    padding: 0 14px 80px !important;
}
@media (min-width: 600px) {
    .cat-list { padding: 0 24px 100px !important; }
}
@media (min-width: 1024px) {
    .cat-list {
        max-width: 1280px;
        margin: 0 auto;
        padding: 0 32px 120px !important;
    }
}

/* ───── 13. Carousels (home) ───── */
.carousel-track::-webkit-scrollbar { height: 4px; }
.carousel-track::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }

/* ───── 14. Tablet / Desktop / TV breakpoints ───── */
@media (min-width: 600px) {
    .acc-poster { width: 130px; }
    .acc-tv { width: 110px; }
    .acc-tv .sq { width: 110px; height: 110px; }
}
@media (min-width: 900px) {
    .acc-poster { width: 150px; }
    .acc-tv { width: 120px; }
    .acc-tv .sq { width: 120px; height: 120px; }
}
@media (min-width: 1280px) {
    .acc-poster { width: 165px; }
    .acc-tv { width: 130px; }
    .acc-tv .sq { width: 130px; height: 130px; }
    .nub-back { top: calc(env(safe-area-inset-top, 0) + 76px); width: 50px; height: 50px; font-size: 24px; left: 24px; }
    main, .main-content { max-width: 1700px; margin: 0 auto; }
}
@media (min-width: 1920px) {
    html { font-size: 19px; }
    .acc-poster { width: 180px; }
    .acc-tv { width: 140px; }
    .acc-tv .sq { width: 140px; height: 140px; }
}

/* Landscape phone */
@media (max-height: 480px) and (orientation: landscape) {
    .app-header { height: 44px !important; }
    .nub-back { top: 50px; width: 38px; height: 38px; font-size: 18px; }
}

/* ───── 15. Reduce motion ───── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

/* ───── 16. Scrollbars consistent dark ───── */
* { scrollbar-width: thin; scrollbar-color: #2a2a2a transparent; }

/* ───── 17. Player modal focus ───── */
.player-modal .close-btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.btn-ctrl:focus-visible { outline: 3px solid var(--primary, #E50914); outline-offset: 4px; border-radius: 50%; }

/* ───── 18. Hide bottom-tabs UNDER the back button glitch ───── */
.bottom-tabs { z-index: 90 !important; }
