:root {
    --tv-bg: #020817;
    --tv-panel: rgba(9, 18, 40, .78);
    --tv-panel-2: rgba(15, 28, 62, .92);
    --tv-border: rgba(101, 141, 255, .24);
    --tv-text: #f8fbff;
    --tv-muted: rgba(248, 251, 255, .68);
    --tv-cyan: #07d8ff;
    --tv-blue: #2369ff;
    --tv-violet: #7a2cff;
    --tv-danger: #ff3b72;
    --tv-radius: 30px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--tv-text);
    background:
        radial-gradient(circle at 20% 10%, rgba(0, 198, 255, .16), transparent 28%),
        radial-gradient(circle at 80% 20%, rgba(122, 44, 255, .20), transparent 30%),
        linear-gradient(135deg, #020817 0%, #071024 50%, #020817 100%);
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255,255,255,.04), transparent 26%, rgba(0,0,0,.28));
    z-index: 0;
}

a { color: inherit; text-decoration: none; }
.tv-shell {
    position: relative;
    z-index: 1;
    width: min(1760px, calc(100vw - 96px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 54px 0;
}
.tv-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 38px;
}
.tv-logo { width: min(520px, 44vw); height: auto; display: block; }
.tv-actions { display: flex; gap: 16px; align-items: center; }
.tv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
    padding: 0 30px;
    border-radius: 999px;
    border: 2px solid var(--tv-border);
    background: rgba(255,255,255,.06);
    color: var(--tv-text);
    font-weight: 800;
    font-size: 1.08rem;
    outline: none;
    transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
.tv-btn:hover,
.tv-btn:focus,
.tv-btn.tv-focused {
    transform: scale(1.045);
    border-color: rgba(7,216,255,.96);
    background: rgba(7,216,255,.12);
    box-shadow: 0 0 0 5px rgba(7,216,255,.18), 0 0 44px rgba(35,105,255,.28);
}
.tv-login-wrap {
    min-height: calc(100vh - 108px);
    display: grid;
    place-items: center;
}
.tv-login-card {
    width: min(820px, 94vw);
    padding: clamp(34px, 4vw, 62px);
    border: 1px solid var(--tv-border);
    border-radius: 42px;
    background: linear-gradient(145deg, rgba(10, 21, 49, .92), rgba(5, 11, 29, .86));
    box-shadow: 0 28px 90px rgba(0,0,0,.42), inset 0 1px 0 rgba(255,255,255,.08);
    backdrop-filter: blur(18px);
}
.tv-login-logo { width: min(560px, 100%); display: block; margin: 0 auto 44px; }
.tv-field { margin-bottom: 24px; }
.tv-label {
    display: block;
    margin-bottom: 12px;
    color: var(--tv-muted);
    font-size: 1.16rem;
    font-weight: 800;
}
.tv-input {
    width: 100%;
    height: 82px;
    padding: 0 26px;
    border-radius: 24px;
    border: 2px solid rgba(255,255,255,.14);
    background: rgba(255,255,255,.08);
    color: var(--tv-text);
    font-size: 1.55rem;
    font-weight: 800;
    outline: none;
}
.tv-input:focus,
.tv-input.tv-focused {
    border-color: var(--tv-cyan);
    box-shadow: 0 0 0 5px rgba(7,216,255,.18), 0 0 50px rgba(7,216,255,.18);
    background: rgba(255,255,255,.11);
}
.tv-submit {
    width: 100%;
    height: 86px;
    border: 0;
    border-radius: 26px;
    background: linear-gradient(135deg, var(--tv-cyan), var(--tv-blue) 55%, var(--tv-violet));
    color: #fff;
    font-size: 1.55rem;
    font-weight: 950;
    letter-spacing: .01em;
    box-shadow: 0 20px 48px rgba(35,105,255,.30);
    outline: none;
}
.tv-submit:focus,
.tv-submit:hover,
.tv-submit.tv-focused {
    transform: scale(1.025);
    box-shadow: 0 0 0 6px rgba(7,216,255,.20), 0 26px 60px rgba(35,105,255,.42);
}
.tv-alert {
    margin: 0 0 28px;
    padding: 22px 26px;
    border-radius: 24px;
    border: 2px solid rgba(255,59,114,.35);
    background: rgba(255,59,114,.13);
    color: #fff;
    font-size: 1.22rem;
    font-weight: 900;
}
.tv-title-row {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 30px;
}
.tv-title { margin: 0; font-size: clamp(2.2rem, 4vw, 4.2rem); font-weight: 950; letter-spacing: -.05em; }
.tv-subtitle { margin: 10px 0 0; color: var(--tv-muted); font-size: 1.28rem; font-weight: 750; }
.tv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 26px;
}
.tv-card {
    min-height: 190px;
    border-radius: var(--tv-radius);
    border: 2px solid var(--tv-border);
    background: linear-gradient(145deg, rgba(14, 28, 64, .88), rgba(5, 12, 31, .88));
    box-shadow: 0 22px 48px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.07);
    padding: 28px;
    outline: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
}
.tv-card:hover,
.tv-card:focus,
.tv-card.tv-focused {
    transform: scale(1.045);
    border-color: rgba(7,216,255,.98);
    background: linear-gradient(145deg, rgba(20, 48, 104, .96), rgba(8, 15, 38, .94));
    box-shadow: 0 0 0 6px rgba(7,216,255,.18), 0 30px 70px rgba(0,0,0,.38), 0 0 56px rgba(35,105,255,.30);
}
.tv-card-title { margin: 0; font-size: 2rem; line-height: 1.06; font-weight: 950; letter-spacing: -.04em; }
.tv-card-meta { margin-top: 22px; color: var(--tv-muted); font-size: 1.12rem; font-weight: 850; }
.tv-channel-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tv-channel-card { min-height: 220px; align-items: center; text-align: center; justify-content: center; gap: 18px; }
.tv-logo-box {
    width: 132px;
    height: 92px;
    border-radius: 22px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    display: grid;
    place-items: center;
    padding: 14px;
}
.tv-logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.tv-channel-num { color: var(--tv-cyan); font-size: 1rem; font-weight: 950; letter-spacing: .08em; }
.tv-channel-name { margin: 0; font-size: 1.32rem; line-height: 1.12; font-weight: 950; }
.tv-empty {
    border: 2px dashed rgba(255,255,255,.18);
    border-radius: 30px;
    padding: 48px;
    color: var(--tv-muted);
    font-size: 1.5rem;
    font-weight: 850;
    text-align: center;
}
.tv-player-page .tv-shell { width: min(1840px, calc(100vw - 56px)); padding-top: 30px; }
.tv-player {
    width: 100%;
    height: calc(100vh - 190px);
    min-height: 560px;
    border-radius: 30px;
    background: #000;
    box-shadow: 0 28px 90px rgba(0,0,0,.52);
    outline: none;
}
.tv-player-title { font-size: 1.55rem; font-weight: 950; color: var(--tv-text); }
.tv-loading { color: var(--tv-muted); font-weight: 850; }
@media (max-width: 900px) {
    .tv-shell { width: min(100% - 34px, 1760px); padding: 26px 0; }
    .tv-topbar, .tv-title-row { align-items: flex-start; flex-direction: column; }
    .tv-logo { width: min(420px, 84vw); }
    .tv-grid, .tv-channel-grid { grid-template-columns: 1fr; }
    .tv-card { min-height: 156px; }
    .tv-input, .tv-submit { height: 72px; }
}
.tv-section { margin-bottom: 52px; }
.tv-section + .tv-section { padding-top: 10px; }
.tv-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 58px;
    padding: 0 24px;
    border-radius: 999px;
    border: 2px solid var(--tv-border);
    background: rgba(255,255,255,.05);
    color: var(--tv-text);
    font-size: 1.02rem;
    font-weight: 900;
    outline: none;
}
.tv-link:hover,
.tv-link:focus,
.tv-link.tv-focused {
    border-color: rgba(7,216,255,.96);
    box-shadow: 0 0 0 5px rgba(7,216,255,.18), 0 0 44px rgba(35,105,255,.22);
    transform: scale(1.04);
}
.tv-card-meta-small {
    margin-top: 0;
    font-size: .96rem;
    line-height: 1.2;
}
.tv-player-topbar { margin-bottom: 22px; }
.tv-player-heading {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}
.tv-player-logo-box {
    width: 108px;
    height: 76px;
    flex: 0 0 auto;
}
.tv-player-meta {
    margin-top: 5px;
    color: var(--tv-muted);
    font-size: 1.02rem;
    font-weight: 850;
}
.tv-btn-favorite.is-active {
    border-color: rgba(255,255,255,.40);
    background: linear-gradient(135deg, rgba(7,216,255,.22), rgba(122,44,255,.25));
}
.tv-player-frame {
    position: relative;
    border-radius: 30px;
    background: #000;
}
.tv-player-message {
    position: absolute;
    left: 50%;
    bottom: 34px;
    transform: translateX(-50%);
    padding: 16px 22px;
    border-radius: 18px;
    background: rgba(255,59,114,.90);
    color: #fff;
    font-size: 1.08rem;
    font-weight: 950;
    box-shadow: 0 20px 45px rgba(0,0,0,.42);
}
.tv-player::-webkit-media-controls-panel { background-color: rgba(0,0,0,.62); }
@media (max-width: 900px) {
    .tv-player-heading { align-items: flex-start; }
    .tv-player-page .tv-shell { width: min(100% - 24px, 1840px); }
    .tv-player { min-height: 320px; height: calc(100vh - 245px); }
}
.tv-icon-btn {
    width: 72px;
    min-width: 72px;
    padding: 0;
}
.tv-icon-btn svg {
    width: 30px;
    height: 30px;
    fill: currentColor;
}
.tv-settings-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.tv-setting-card {
    width: 100%;
    text-align: left;
    appearance: none;
}
.tv-setting-card.is-active {
    border-color: rgba(7,216,255,.96);
    background: linear-gradient(135deg, rgba(7,216,255,.20), rgba(122,44,255,.22));
    box-shadow: 0 0 0 3px rgba(7,216,255,.16), 0 24px 70px rgba(0,0,0,.35);
}
.tv-danger-card {
    border-color: rgba(255,59,114,.38);
}
.tv-danger-card:hover,
.tv-danger-card:focus,
.tv-danger-card.tv-focused {
    border-color: rgba(255,59,114,.95);
    box-shadow: 0 0 0 5px rgba(255,59,114,.20), 0 0 44px rgba(122,44,255,.25);
}
body.tv-size-large .tv-shell { width: min(100% - 72px, 1900px); }
body.tv-size-large .tv-card-title,
body.tv-size-large .tv-channel-name { font-size: clamp(1.45rem, 1.9vw, 2.05rem); }
body.tv-size-large .tv-card-meta,
body.tv-size-large .tv-card-meta-small,
body.tv-size-large .tv-player-meta { font-size: 1.18rem; }
body.tv-size-large .tv-card { min-height: 190px; }
body.tv-size-large .tv-btn,
body.tv-size-large .tv-link { min-height: 68px; font-size: 1.13rem; }
body.tv-motion-reduced *,
body.tv-motion-reduced *::before,
body.tv-motion-reduced *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    scroll-behavior: auto !important;
}
@media (max-width: 900px) {
    .tv-icon-btn { width: 66px; min-width: 66px; }
    .tv-settings-grid { grid-template-columns: 1fr; }
}
.tv-main-menu {
    flex-wrap: wrap;
    justify-content: flex-end;
}
.tv-btn.is-active,
.tv-icon-btn.is-active {
    border-color: rgba(7,216,255,.96);
    background: linear-gradient(135deg, rgba(7,216,255,.20), rgba(122,44,255,.20));
    box-shadow: 0 0 0 4px rgba(7,216,255,.14), 0 0 36px rgba(35,105,255,.22);
}
.tv-card-feature {
    background: linear-gradient(135deg, rgba(7,216,255,.18), rgba(35,105,255,.15), rgba(122,44,255,.20));
}
.tv-search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 180px;
    gap: 18px;
    margin-bottom: 34px;
}
.tv-search-input {
    height: 86px;
}
.tv-search-submit {
    height: 86px;
}
.tv-search-results {
    margin-top: 10px;
}
@media (max-width: 1100px) {
    .tv-main-menu { justify-content: flex-start; }
    .tv-actions { gap: 12px; }
    .tv-btn { min-height: 58px; padding: 0 22px; font-size: .98rem; }
}
@media (max-width: 900px) {
    .tv-search-form { grid-template-columns: 1fr; }
    .tv-search-submit { width: 100%; }
}

/* Correctif menu lecteur TV : dock discret cohérent avec l'interface TV. */
.tv-player-page .tv-player-topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 20px;
    margin-bottom: 18px;
}
.tv-player-quicknav {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 8px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 999px;
    background: rgba(3, 10, 25, .55);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 14px 34px rgba(0,0,0,.22);
    backdrop-filter: blur(16px);
}
.tv-player-nav-btn {
    width: 72px;
    height: 64px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border-radius: 999px;
    border: 1px solid transparent;
    color: var(--tv-text);
    background: transparent;
    outline: none;
    transition: transform .12s ease, background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.tv-player-nav-icon {
    display: block;
    line-height: 1;
    font-size: 1.78rem;
    font-weight: 950;
}
.tv-player-nav-label {
    display: block;
    max-width: 64px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--tv-muted);
    font-size: .68rem;
    font-weight: 850;
    letter-spacing: .01em;
}
.tv-player-nav-btn:hover,
.tv-player-nav-btn:focus,
.tv-player-nav-btn.tv-focused {
    transform: scale(1.08);
    border-color: rgba(7,216,255,.78);
    background: linear-gradient(135deg, rgba(7,216,255,.18), rgba(35,105,255,.14), rgba(122,44,255,.16));
    box-shadow: 0 0 0 4px rgba(7,216,255,.13), 0 0 34px rgba(35,105,255,.24);
}
.tv-player-nav-btn:hover .tv-player-nav-label,
.tv-player-nav-btn:focus .tv-player-nav-label,
.tv-player-nav-btn.tv-focused .tv-player-nav-label { color: #fff; }
.tv-player-frame { overflow: hidden; }
.tv-player-info-strip {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 54px 32px 28px;
    pointer-events: none;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,.62) 58%, rgba(0,0,0,.86) 100%);
}
.tv-player-info-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tv-player-info-main strong {
    max-width: 70vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: clamp(1.45rem, 2.1vw, 2.35rem);
    font-weight: 950;
    letter-spacing: -.03em;
}
.tv-player-info-main span,
.tv-player-info-help {
    color: rgba(248,251,255,.72);
    font-size: .98rem;
    font-weight: 800;
}
.tv-player-favorite-form {
    position: absolute;
    right: 24px;
    top: 24px;
    z-index: 4;
    margin: 0;
}
.tv-player-floating-fav {
    width: 70px;
    height: 70px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(3,10,25,.66);
    color: #fff;
    font-size: 2rem;
    font-weight: 950;
    outline: none;
    backdrop-filter: blur(16px);
    box-shadow: 0 18px 42px rgba(0,0,0,.32);
}
.tv-player-floating-fav.is-active { color: #ffe773; border-color: rgba(255,231,115,.56); }
.tv-player-floating-fav:hover,
.tv-player-floating-fav:focus,
.tv-player-floating-fav.tv-focused {
    transform: scale(1.08);
    border-color: rgba(7,216,255,.90);
    box-shadow: 0 0 0 5px rgba(7,216,255,.16), 0 20px 55px rgba(0,0,0,.42);
}
@media (max-width: 1100px) {
    .tv-player-page .tv-player-topbar { grid-template-columns: 1fr; }
    .tv-player-quicknav { justify-content: flex-start; overflow-x: auto; max-width: 100%; border-radius: 26px; }
    .tv-player-info-strip { align-items: flex-start; flex-direction: column; padding: 46px 22px 22px; }
    .tv-player-info-help { display: none; }
}


/* Lecteur TV plein écran avec overlay pilotable à la télécommande. */
.tv-player-shell {
    width: 100vw;
    max-width: none;
    padding: 0;
}
.tv-player-page {
    overflow: hidden;
    background: #000;
}
.tv-player-page::before { display: none; }
.tv-player-page .tv-player-frame {
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    border-radius: 0;
    overflow: hidden;
    background: #000;
}
.tv-player-page .tv-player {
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
    display: block;
}
.tv-player-overlay {
    position: absolute;
    inset: 0;
    z-index: 6;
    pointer-events: none;
    opacity: 0;
    transition: opacity .18s ease;
    background:
        linear-gradient(180deg, rgba(0,0,0,.82) 0%, rgba(0,0,0,.42) 18%, transparent 42%),
        linear-gradient(0deg, rgba(0,0,0,.86) 0%, rgba(0,0,0,.46) 23%, transparent 48%);
}
.tv-player-frame.is-overlay-visible .tv-player-overlay,
.tv-player-frame.is-drawer-open .tv-player-overlay {
    opacity: 1;
}
.tv-player-overlay-top,
.tv-player-overlay-bottom {
    position: absolute;
    left: clamp(24px, 4vw, 70px);
    right: clamp(24px, 4vw, 70px);
    display: flex;
    align-items: center;
    gap: 22px;
    pointer-events: auto;
}
.tv-player-overlay-top {
    top: clamp(20px, 3vw, 46px);
    justify-content: space-between;
}
.tv-player-overlay-bottom {
    bottom: clamp(24px, 4vw, 62px);
    align-items: flex-end;
    justify-content: space-between;
}
.tv-player-heading-overlay {
    flex: 1 1 auto;
    min-width: 0;
}
.tv-player-overlay .tv-player-quicknav {
    flex: 0 0 auto;
}
.tv-player-help {
    max-width: 48vw;
    color: rgba(248,251,255,.72);
    font-size: 1.02rem;
    font-weight: 850;
    text-align: right;
}
.tv-player-epg-progress {
    display: block;
    width: min(520px, 54vw);
    height: 6px;
    margin-top: 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.18);
    overflow: hidden;
    position: relative;
}
.tv-player-epg-progress::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--p, 0%);
    border-radius: inherit;
    background: linear-gradient(90deg, var(--tv-cyan), var(--tv-blue));
}

.tv-player-drawer[hidden] {
    display: none !important;
}

.tv-player-drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 8;
    width: min(520px, 38vw);
    padding: 34px 24px;
    background: linear-gradient(180deg, rgba(7, 15, 36, .96), rgba(2, 8, 23, .98));
    border-left: 1px solid rgba(255,255,255,.12);
    box-shadow: -30px 0 80px rgba(0,0,0,.48);
    transform: translateX(104%);
    transition: transform .16s ease;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
}
.tv-player-drawer.is-open {
    transform: translateX(0);
}
.tv-player-drawer-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}
.tv-player-drawer-head strong {
    font-size: 2rem;
    font-weight: 950;
    letter-spacing: -.04em;
}
.tv-player-drawer-head span {
    color: var(--tv-muted);
    font-size: .98rem;
    font-weight: 850;
}
.tv-player-drawer-list {
    overflow-y: auto;
    padding: 4px 6px 22px;
    display: grid;
    gap: 12px;
    scrollbar-width: thin;
}
.tv-player-drawer-item {
    min-height: 76px;
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    border-radius: 22px;
    border: 1px solid rgba(255,255,255,.09);
    background: rgba(255,255,255,.045);
    outline: none;
}
.tv-player-drawer-item span {
    color: var(--tv-cyan);
    font-size: 1rem;
    font-weight: 950;
    text-align: center;
}
.tv-player-drawer-item strong {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 1.08rem;
    font-weight: 900;
}
.tv-player-drawer-item.is-current,
.tv-player-drawer-item:hover,
.tv-player-drawer-item:focus,
.tv-player-drawer-item.tv-focused {
    border-color: rgba(7,216,255,.82);
    background: linear-gradient(135deg, rgba(7,216,255,.18), rgba(35,105,255,.16), rgba(122,44,255,.14));
    box-shadow: 0 0 0 4px rgba(7,216,255,.12);
}
.tv-player-number-buffer {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 10;
    transform: translate(-50%, -50%);
    min-width: 150px;
    padding: 26px 34px;
    border-radius: 30px;
    border: 2px solid rgba(7,216,255,.52);
    background: rgba(2,8,23,.86);
    color: #fff;
    font-size: 4rem;
    font-weight: 950;
    text-align: center;
    box-shadow: 0 0 0 7px rgba(7,216,255,.13), 0 26px 80px rgba(0,0,0,.55);
}
.tv-player-page .tv-player-message {
    z-index: 12;
    bottom: clamp(28px, 5vw, 82px);
}
.tv-player-page .tv-player-favorite-form {
    z-index: 9;
    top: auto;
    right: clamp(24px, 4vw, 70px);
    bottom: clamp(104px, 9vw, 150px);
}
@media (max-width: 1100px) {
    .tv-player-overlay-top,
    .tv-player-overlay-bottom {
        left: 20px;
        right: 20px;
    }
    .tv-player-overlay-top {
        align-items: flex-start;
        flex-wrap: wrap;
    }
    .tv-player-overlay-bottom {
        flex-direction: column;
        align-items: flex-start;
    }
    .tv-player-help { max-width: none; text-align: left; }
    .tv-player-drawer { width: min(86vw, 480px); }
}
@media (max-width: 700px) {
    .tv-player-logo-box { display: none; }
    .tv-player-drawer { width: 100vw; }
    .tv-player-page .tv-player-favorite-form { display: none; }
}

/* Guide TV : lignes horizontales adaptées télécommande. */
.tv-guide-shell {
    width: min(1880px, calc(100vw - 56px));
    padding-top: 34px;
}
.tv-guide-title-row {
    margin-bottom: 22px;
}
.tv-guide-title-row .tv-subtitle {
    display: none;
}
.tv-guide-clock {
    min-height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.13);
    background: rgba(255,255,255,.06);
    color: var(--tv-text);
    font-size: 1.1rem;
    font-weight: 950;
}
.tv-guide-board {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 44px;
}
.tv-guide-line {
    width: 100%;
    min-height: 118px;
    display: grid !important;
    grid-template-columns: 112px minmax(0, 1fr);
    align-items: stretch;
    gap: 12px;
    border-radius: 22px;
    background: rgba(255,255,255,.035);
    border: 1px solid rgba(255,255,255,.08);
    overflow: hidden;
}
.tv-guide-line:focus-within,
.tv-guide-line.has-guide-focus {
    border-color: rgba(7,216,255,.55);
    background: rgba(7,216,255,.055);
    box-shadow: 0 0 0 4px rgba(7,216,255,.10), 0 18px 54px rgba(0,0,0,.24);
}
.tv-guide-channel-card {
    width: 112px;
    min-width: 112px;
    min-height: 118px;
    padding: 10px 8px;
    border-radius: 20px;
    background: rgba(255,255,255,.075);
    color: var(--tv-text);
    display: flex !important;
    flex-direction: column !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    outline: none;
}
.tv-guide-channel-card:hover,
.tv-guide-channel-card:focus,
.tv-guide-channel-card.tv-focused {
    transform: none;
    background: linear-gradient(135deg, rgba(7,216,255,.18), rgba(122,44,255,.15));
    box-shadow: inset 0 0 0 2px rgba(7,216,255,.78), 0 0 28px rgba(7,216,255,.14);
}
.tv-guide-channel-num {
    color: rgba(248,251,255,.62);
    font-size: .76rem;
    font-weight: 950;
    letter-spacing: .04em;
    line-height: 1;
}
.tv-guide-channel-logo {
    width: 76px;
    height: 48px;
    display: grid;
    place-items: center;
    padding: 6px;
    border-radius: 14px;
    background: rgba(255,255,255,.06);
}
.tv-guide-channel-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.tv-guide-channel-logo strong {
    max-width: 92px;
    color: var(--tv-text);
    font-size: .9rem;
    font-weight: 950;
    line-height: 1.05;
    text-align: center;
}
.tv-guide-channel-name {
    display: none !important;
}
.tv-guide-program-track {
    min-width: 0;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 12px;
    overflow: hidden;
    padding: 0 12px 0 0;
}
.tv-guide-program-card {
    position: relative;
    min-width: 0;
    min-height: 118px;
    padding: 12px 12px;
    display: none;
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 12px;
    align-items: center;
    border-radius: 20px;
    background: rgba(255,255,255,.065);
    border: 1px solid rgba(255,255,255,.08);
    color: var(--tv-text);
    outline: none;
    overflow: hidden;
}
.tv-guide-program-card.is-visible {
    display: grid;
}
.tv-guide-program-card.no-image {
    grid-template-columns: minmax(0, 1fr);
}
.tv-guide-program-card:hover,
.tv-guide-program-card:focus,
.tv-guide-program-card.tv-focused {
    transform: none;
    border-color: rgba(7,216,255,.88);
    background: linear-gradient(135deg, rgba(7,216,255,.16), rgba(35,105,255,.12), rgba(122,44,255,.16));
    box-shadow: inset 0 0 0 1px rgba(7,216,255,.54), 0 0 34px rgba(35,105,255,.18);
}
.tv-guide-program-card.is-now {
    background: rgba(255,255,255,.095);
}
.tv-guide-program-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
}
.tv-guide-time {
    color: #fff;
    font-size: .94rem;
    font-weight: 950;
    letter-spacing: -.02em;
}
.tv-guide-program-card strong {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--tv-text);
    font-size: clamp(1.02rem, 1.1vw, 1.28rem);
    line-height: 1.05;
    font-weight: 950;
    letter-spacing: -.03em;
}
.tv-guide-program-card p {
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: rgba(248,251,255,.58);
    font-size: .9rem;
    line-height: 1.2;
    font-weight: 650;
}
.tv-guide-program-card small {
    color: rgba(248,251,255,.78);
    font-size: .82rem;
    font-weight: 850;
}
.tv-guide-program-image {
    align-self: center;
    width: 92px;
    height: 92px;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255,255,255,.08);
}
.tv-guide-program-image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}
.tv-guide-progress {
    position: absolute;
    left: 12px;
    bottom: 0;
    height: 5px;
    min-width: 18px;
    border-radius: 999px 999px 0 0;
    background: linear-gradient(90deg, var(--tv-cyan), var(--tv-danger));
}
@media (max-width: 1100px) {
    .tv-guide-shell { width: min(100% - 26px, 1880px); }
    .tv-guide-line { grid-template-columns: 92px minmax(0, 1fr); min-height: 104px; gap: 8px; }
    .tv-guide-channel-card { width: 92px; min-width: 92px; min-height: 104px; padding: 8px 6px; }
    .tv-guide-channel-logo { width: 66px; height: 42px; }
    .tv-guide-program-track { gap: 8px; padding-right: 8px; }
    .tv-guide-program-card { min-height: 104px; grid-template-columns: minmax(0, 1fr) 76px; gap: 8px; padding: 10px 10px; }
    .tv-guide-program-image { width: 76px; height: 76px; }
}

/* Cache playlist TV + correction icônes du menu haut. */
.tv-icon-only {
    width: 64px;
    min-width: 64px;
    padding: 0;
}
.tv-icon-only svg,
.tv-icon-text svg,
.tv-setting-icon svg,
.tv-submit svg {
    width: 30px;
    height: 30px;
    display: block;
    fill: currentColor;
    color: currentColor;
    flex: 0 0 auto;
}
.tv-icon-text { gap: 10px; }
.tv-loading-page .tv-shell {
    display: grid;
    place-items: center;
    min-height: 100vh;
}
.tv-loading-card-simple {
    width: min(520px, 92vw);
    padding: 42px 34px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 28px;
    background: rgba(6, 13, 32, .92);
    box-shadow: 0 22px 70px rgba(0,0,0,.38);
    text-align: center;
}
.tv-loading-card-simple h1 {
    margin: 0 0 18px;
    font-size: clamp(1.7rem, 4vw, 2.4rem);
    font-weight: 900;
    letter-spacing: -.04em;
}
.tv-loading-percent {
    margin-bottom: 18px;
    font-size: clamp(3.2rem, 10vw, 5.4rem);
    line-height: 1;
    font-weight: 950;
    letter-spacing: -.06em;
    color: #fff;
}
.tv-loader-bar {
    width: 100%;
    height: 12px;
    margin: 0 auto 18px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255,255,255,.14);
}
.tv-loader-bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--tv-cyan), var(--tv-blue));
    transition: width .22s ease;
}
.tv-loading-card-simple p {
    margin: 0;
    color: var(--tv-muted);
    font-size: 1rem;
    font-weight: 700;
}
.tv-loading-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 220px;
    padding: 0 28px;
    margin-top: 18px;
}
@media (max-width: 1100px) {
    .tv-icon-only { width: 58px; min-width: 58px; }
    .tv-icon-only svg { width: 27px; height: 27px; }
}

/* Correctif robuste des icônes SVG dans le header et le lecteur. */
.tv-svg-icon {
    width: 1em;
    height: 1em;
    display: block;
    flex: 0 0 auto;
    fill: currentColor;
    color: currentColor;
    overflow: visible;
}
.tv-svg-icon path {
    fill: currentColor;
}
.tv-topbar .tv-btn.tv-icon-only {
    width: 64px;
    min-width: 64px;
    height: 64px;
    padding: 0;
    color: var(--tv-text);
}
.tv-topbar .tv-btn.tv-icon-only .tv-svg-icon {
    width: 30px;
    height: 30px;
}
.tv-player-nav-icon .tv-svg-icon {
    width: 28px;
    height: 28px;
}
.tv-player-next-program {
    display: block;
    margin-top: 8px;
    color: rgba(248,251,255,.72);
    font-size: .98rem;
    font-weight: 850;
}
.tv-search-results .tv-channel-grid {
    margin-top: 8px;
}
@media (max-width: 1100px) {
    .tv-topbar .tv-btn.tv-icon-only {
        width: 58px;
        min-width: 58px;
        height: 58px;
    }
    .tv-topbar .tv-btn.tv-icon-only .tv-svg-icon {
        width: 27px;
        height: 27px;
    }
}

/* Correctif icônes header TV : SVG inline unique, sans fallback doublon. */
.tv-topbar .tv-icon-only {
    position: relative;
    width: 64px;
    min-width: 64px;
    height: 64px;
    min-height: 64px;
    padding: 0;
    overflow: visible;
}
.tv-header-icon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    line-height: 1;
    color: currentColor;
}
.tv-header-icon-wrap .tv-svg-icon {
    width: 30px !important;
    height: 30px !important;
    display: block !important;
    color: currentColor !important;
    fill: currentColor !important;
    opacity: 1 !important;
    visibility: visible !important;
}
.tv-header-icon-wrap .tv-svg-icon path {
    fill: currentColor !important;
    color: currentColor !important;
}
.tv-header-icon-fallback {
    display: none !important;
}
@media (max-width: 1100px) {
    .tv-topbar .tv-icon-only {
        width: 58px;
        min-width: 58px;
        height: 58px;
        min-height: 58px;
    }
    .tv-header-icon-wrap {
        width: 31px;
        height: 31px;
    }
    .tv-header-icon-wrap .tv-svg-icon {
        width: 27px !important;
        height: 27px !important;
    }
}


/* Renfort application TV / APK : lecteur prioritaire, moins de DOM visible, safe-area écran. */
.tv-player-page,
.tv-player-page .tv-shell,
.tv-player-page .tv-player-frame {
    overscroll-behavior: none;
    touch-action: manipulation;
}
.tv-player-page .tv-player {
    object-fit: contain;
    background: #000;
}
.tv-player-frame:not(.is-overlay-visible):not(.is-drawer-open) {
    cursor: none;
}
.tv-player-drawer-loading {
    padding: 26px 18px;
    border-radius: 22px;
    border: 1px solid rgba(255,255,255,.10);
    background: rgba(255,255,255,.045);
    color: rgba(248,251,255,.72);
    font-weight: 850;
}
@media (min-width: 1200px) {
    .tv-player-overlay-top,
    .tv-player-overlay-bottom {
        left: max(54px, env(safe-area-inset-left));
        right: max(54px, env(safe-area-inset-right));
    }
    .tv-player-overlay-top { top: max(34px, env(safe-area-inset-top)); }
    .tv-player-overlay-bottom { bottom: max(46px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
    .tv-player-overlay,
    .tv-player-drawer {
        transition: none !important;
    }
}

/* PWA + Smart TV : safe area, splash et affichage encapsulé APK/WebView. */
:root {
    --tv-safe-top: env(safe-area-inset-top, 0px);
    --tv-safe-right: env(safe-area-inset-right, 0px);
    --tv-safe-bottom: env(safe-area-inset-bottom, 0px);
    --tv-safe-left: env(safe-area-inset-left, 0px);
}
html {
    min-height: 100%;
    background: #020817;
}
body {
    min-height: 100dvh;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
}
.tv-shell {
    padding-top: max(54px, calc(44px + var(--tv-safe-top)));
    padding-bottom: max(54px, calc(44px + var(--tv-safe-bottom)));
    padding-left: var(--tv-safe-left);
    padding-right: var(--tv-safe-right);
}
.tv-player-page .tv-shell {
    width: 100vw;
    max-width: 100vw;
    min-height: 100dvh;
    padding: 0;
    margin: 0;
}
.tv-player-page .tv-topbar {
    position: fixed;
    z-index: 30;
    top: max(18px, var(--tv-safe-top));
    left: max(24px, var(--tv-safe-left));
    right: max(24px, var(--tv-safe-right));
    margin: 0;
    pointer-events: auto;
}
.tv-player-page .tv-player-frame {
    width: 100vw;
    height: 100dvh;
    min-height: 100dvh;
    border-radius: 0;
}
.tv-player-page .tv-player {
    width: 100vw;
    height: 100dvh;
    min-height: 100dvh;
    border-radius: 0;
    box-shadow: none;
}
.tv-standalone body,
.tv-standalone .tv-player-page,
.tv-standalone .tv-player-page .tv-shell {
    overscroll-behavior: none;
}
.tv-splash-page {
    overflow: hidden;
}
.tv-splash-shell {
    width: 100vw;
    min-height: 100dvh;
    padding: max(52px, var(--tv-safe-top)) max(52px, var(--tv-safe-right)) max(52px, var(--tv-safe-bottom)) max(52px, var(--tv-safe-left));
    display: grid;
    place-items: center;
}
.tv-splash-card {
    width: min(1120px, 88vw);
    min-height: min(560px, 72vh);
    border-radius: 52px;
    border: 1px solid rgba(101, 141, 255, .24);
    background:
        radial-gradient(circle at 25% 18%, rgba(7,216,255,.16), transparent 34%),
        radial-gradient(circle at 76% 22%, rgba(122,44,255,.22), transparent 34%),
        rgba(9, 18, 40, .72);
    box-shadow: 0 36px 110px rgba(0,0,0,.48), inset 0 1px 0 rgba(255,255,255,.08);
    display: grid;
    place-items: center;
    text-align: center;
    padding: clamp(38px, 6vw, 78px);
}
.tv-splash-logo {
    width: min(760px, 78vw);
    height: auto;
    display: block;
    margin: 0 auto 38px;
}
.tv-splash-loader {
    width: min(420px, 60vw);
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255,255,255,.12);
    margin: 0 auto 24px;
}
.tv-splash-loader span {
    display: block;
    width: 44%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--tv-cyan), var(--tv-blue), var(--tv-violet));
    animation: tvSplashLoader 1.15s ease-in-out infinite alternate;
}
.tv-splash-text {
    margin: 0;
    color: rgba(248,251,255,.72);
    font-size: clamp(1.1rem, 1.8vw, 1.55rem);
    font-weight: 850;
}
@keyframes tvSplashLoader {
    from { transform: translateX(-38%); }
    to { transform: translateX(138%); }
}
@media (max-width: 1100px) {
    .tv-shell {
        width: min(100vw, calc(100vw - 38px));
        padding-top: max(30px, calc(24px + var(--tv-safe-top)));
        padding-bottom: max(30px, calc(24px + var(--tv-safe-bottom)));
    }
    .tv-splash-card {
        border-radius: 38px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .tv-splash-loader span {
        animation: none !important;
        width: 100%;
    }
}

.tv-player-drawer-item {
    grid-template-columns: 58px 58px minmax(0, 1fr);
}
.tv-player-drawer-num {
    color: var(--tv-cyan);
    font-size: 1rem;
    font-weight: 950;
    text-align: center;
}
.tv-player-drawer-logo {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    object-fit: contain;
    background: rgba(255,255,255,.08);
    padding: 6px;
}
.tv-player-drawer-logo-text {
    display: inline-grid;
    place-items: center;
    color: var(--tv-cyan);
    font-weight: 950;
}
.tv-player-drawer-item small {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--tv-muted);
    font-size: .84rem;
    font-weight: 750;
    margin-top: 4px;
}
.tv-player-drawer-item strong,
.tv-player-drawer-item small {
    grid-column: 3;
}
.tv-player-drawer-item > strong {
    align-self: end;
}
.tv-player-drawer-item > small {
    align-self: start;
}
