/* Desktop TV: keep browsing, the video, and playback in distinct areas.
   The existing touch layout remains in tv-mode.css. */
.tv-player-footer { display: contents; }
.tv-desktop-title,
.tv-genres-label,
.tv-control-label,
.tv-action-label,
.tv-fullscreen-btn { display: none; }

@media (min-width: 768px) {
    .tv-stage {
        --tv-header-space: 96px;
        --tv-video-top: calc(var(--tv-header-space) + 104px);
        --tv-footer-space: 218px;
        --tv-frame-height: max(120px, calc(100dvh - var(--tv-video-top) - var(--tv-footer-space)));
        --tv-content-width: min(1440px, calc(100vw - 48px));
        --tv-accent: #ff986c;
        --tv-glow: #ffccaa;
        --tv-cyan: #c4b8d8;
        --tv-mint: #c9dbbe;
        background: #151d1b;
    }
    .tv-stage:fullscreen,
    .tv-stage:-webkit-full-screen { --tv-header-space: 24px; }
    .tv-stage .tv-ambilight {
        opacity: 0.38;
        filter: blur(72px) saturate(0.75) brightness(0.7);
    }
    .tv-stage .tv-ambient { opacity: 0.3; }
    .tv-stage > .tv-grain,
    .tv-stage .tv-scanlines,
    .tv-stage .tv-ticker { display: none; }
    .tv-stage .tv-video {
        top: calc(var(--tv-video-top) + var(--tv-frame-height) / 2);
        width: min(var(--tv-content-width), calc(var(--tv-frame-height) * var(--tv-aspect)));
        max-height: var(--tv-frame-height);
        border-radius: 14px;
        box-shadow: 0 12px 60px rgba(0, 0, 0, 0.35);
        transition: top 420ms ease, width 420ms ease, max-height 420ms ease, border-radius 420ms ease;
    }
    .tv-stage .tv-overlay-grid {
        inset: var(--tv-header-space) 0 16px;
        width: var(--tv-content-width);
        margin-inline: auto;
        display: flex;
        flex-direction: column;
        gap: 10px;
        transition: opacity 220ms ease;
    }
    body.tv-mode-active .tv-stage .tv-row-top {
        padding: 0;
        min-height: 36px;
        gap: 14px;
    }
    .tv-desktop-title {
        display: block;
        color: var(--tv-ink);
        font: 700 17px/1.3 'DM Sans', sans-serif;
        white-space: nowrap;
    }
    .tv-stage .tv-desktop-title { display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 400; color: #d3d5c8; }
    .tv-station-id { padding: 6px 8px; border: 1px solid #f47b4780; border-radius: 4px; font: 700 10px/1 'DM Sans', sans-serif; letter-spacing: 0.08em; color: #ffad83; }
    .tv-stage .tv-wordmark-block { margin-left: auto; min-width: 0; }
    .tv-stage .tv-status-row { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
    /* Location already lives in the site header; restore it in fullscreen. */
    .tv-stage .tv-status-row > .tv-area-pill:first-child { display: none; }
    .tv-stage:fullscreen .tv-status-row > .tv-area-pill:first-child,
    .tv-stage:-webkit-full-screen .tv-status-row > .tv-area-pill:first-child { display: inline-flex; }
    .tv-stage .tv-area-pill {
        min-height: 36px;
        padding: 8px 12px;
        border-color: rgba(246, 239, 226, 0.18);
        background: rgba(246, 239, 226, 0.04);
        box-shadow: none;
        font-size: 12px;
        letter-spacing: 0;
        text-transform: none;
        color: #d9d2df;
    }
    .tv-stage .tv-area-pill span { letter-spacing: 0; }
    .tv-stage .tv-area-pill.is-active {
        color: #ffccaa;
        background: rgba(255, 152, 108, 0.14);
        border-color: rgba(255, 152, 108, 0.55);
    }
    .tv-stage .tv-pos-indicator { width: auto; height: auto; margin: 0; }
    .tv-stage .tv-pos-ring { display: none; }
    .tv-stage .tv-pos-text { font-size: 12px; color: #b8afc3; text-shadow: none; }
    .tv-stage .tv-pos-sep { margin: 0 3px; }
    .tv-stage .tv-stage-close { width: 34px; height: 34px; margin: 0; border-color: #ffffff24; }
    .tv-stage .tv-row-rail { padding: 0; gap: 10px; min-height: 36px; }
    .tv-genres-label { display: block; font-size: 12px; color: #b8afc3; }
    .tv-stage .tv-channel-rail { mask-image: none; -webkit-mask-image: none; }
    .tv-stage .tv-channel-rail-track { gap: 6px; padding: 2px; }
    .tv-stage .tv-channel-tab {
        padding: 8px 13px;
        min-height: 34px;
        font-size: 12px;
        font-weight: 500;
        letter-spacing: 0;
        text-transform: none;
        border-color: transparent;
        background: rgba(246, 239, 226, 0.055);
        color: #d2cbd9;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .tv-stage .tv-channel-tab.active {
        color: #24150e;
        background: #ffbd98;
        border-color: #ffbd98;
        font-weight: 700;
        text-shadow: none;
        box-shadow: none;
        transform: none;
    }
    .tv-stage .tv-channel-tab.active::before { display: none; }
    .tv-stage .tv-rail-chev { width: 30px; height: 30px; border-color: #ffffff24; background: transparent; }
    .tv-stage .tv-row-mid { flex: 1; min-height: 0; }
    .tv-player-footer {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: 'details details' 'transport actions' 'scrub scrub';
        gap: 12px 16px;
        flex-shrink: 0;
        padding-top: 16px;
        border-top: 1px solid rgba(246, 239, 226, 0.13);
    }
    .tv-stage .tv-row-bottom {
        grid-area: details;
        align-items: center;
        padding: 0;
        gap: 24px;
    }
    .tv-stage .tv-now-playing { min-width: 0; max-width: 55%; }
    .tv-stage .tv-now-playing-label {
        font-size: 10px;
        letter-spacing: 0.14em;
        color: #b8afc3;
        text-shadow: none;
        margin-bottom: 5px;
    }
    .tv-stage .tv-now-playing-name {
        display: block;
        max-width: 100%;
        font-size: clamp(24px, 2.5vw, 38px);
        line-height: 1.15;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        text-shadow: none;
    }
    .tv-stage .tv-now-playing-meta { margin-top: 5px; gap: 8px; font-size: 12px; letter-spacing: 0; text-transform: none; }
    .tv-stage .tv-meta-city,
    .tv-stage .tv-genre { color: #b8afc3; text-shadow: none; letter-spacing: 0; text-transform: none; }
    .tv-stage .tv-genre { text-transform: capitalize; }
    .tv-stage .tv-upcoming {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 4px 18px;
        padding: 10px 14px;
        max-width: 45%;
        min-width: 0;
        border: 1px solid #ffffff24;
        border-radius: 12px;
        background: rgba(246, 239, 226, 0.035);
        text-align: left;
        text-transform: none;
        letter-spacing: 0;
    }
    .tv-stage .tv-upcoming-label { display: block !important; grid-column: 1; font-size: 11px; color: #b8afc3; }
    .tv-stage .tv-upcoming-line { grid-column: 1; font-size: 13px; line-height: 1.4; letter-spacing: 0; color: var(--tv-ink); text-shadow: none; }
    .tv-stage .tv-upcoming-line::before { display: none; }
    .tv-stage .tv-upcoming.is-clickable .tv-upcoming-cta {
        display: block !important;
        grid-column: 2;
        grid-row: 1 / 3;
        padding: 10px 14px;
        border-radius: 8px;
        background: #ffbd98;
        color: #24150e;
        font-size: 12px;
        font-weight: 700;
        white-space: nowrap;
    }
    .tv-stage .tv-upcoming.is-clickable:hover { background: #ffffff0d; border-color: #ffbd9866; transform: none; }
    .tv-stage .tv-transport { grid-area: transport; display: flex; justify-content: flex-start; gap: 8px; padding: 0; }
    .tv-stage .tv-transport-btn {
        width: auto;
        height: 40px;
        min-width: 40px;
        gap: 8px;
        padding: 0 12px;
        border: 1px solid #ffffff24;
        background: #ffffff06;
        box-shadow: none;
        color: #ded6e5;
        font: 500 12px 'DM Sans', sans-serif;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .tv-control-label,
    .tv-action-label { display: inline; }
    .tv-stage .tv-transport-play { background: #f5ede0; border-color: #f5ede0; color: #211720; width: 44px; height: 44px; padding: 0; }
    .tv-stage .tv-transport-next { border-color: #ffbd9855; color: #ffccaa; }
    .tv-stage .tv-fullscreen-btn { display: inline-flex; padding: 0; margin-left: 6px; border-color: transparent; }
    .tv-stage .tv-actions-rail { grid-area: actions; position: static; align-self: center; }
    .tv-stage .tv-rail-dock { flex-direction: row; gap: 6px; border: 0; padding: 0; background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
    .tv-stage .tv-rail-avatar { display: none; }
    .tv-stage .tv-rail-btn { flex-direction: row; gap: 6px; min-height: 40px; padding: 0 10px; border-radius: 8px; font: 500 12px 'DM Sans', sans-serif; color: #d2cbd9; }
    .tv-stage .tv-rail-icon { width: 20px; height: 20px; border-radius: 0; background: none; box-shadow: none; }
    .tv-stage .tv-rail-icon svg { width: 18px; height: 18px; filter: none; }
    .tv-stage .tv-rail-btn:hover,
    .tv-stage .tv-transport-btn:hover { background: #ffffff12; }
    .tv-stage .tv-rail-dock .tv-rail-btn .tv-rail-icon { background: none; box-shadow: none; }
    .tv-stage .tv-rail-save.is-saved { color: #ffccaa; background: #ffbd9814; }
    .tv-stage .tv-scrub { grid-area: scrub; padding: 0; gap: 12px; }
    .tv-stage .tv-scrub-time { font-size: 11px; font-weight: 400; letter-spacing: 0; color: #b8afc3; }
    .tv-stage .tv-scrub-fill { background: #ffbd98; box-shadow: none; }
    .tv-stage .tv-scrub-handle { background: #ffbd98; box-shadow: none; width: 10px; height: 10px; }
    .tv-stage button:focus-visible,
    .tv-stage a:focus-visible,
    .tv-stage .tv-scrub:focus-visible { outline: 2px solid #ffccaa; outline-offset: 3px; }
    /* Let the broadcast use the whole page once interaction stops. The
       existing idle timer restores the browsing layout on pointer/keyboard
       activity and keeps it visible while paused or using keyboard focus. */
    .tv-stage.idle { cursor: none; }
    .tv-stage.idle .tv-video {
        top: 50%;
        width: min(100vw, calc(100dvh * var(--tv-aspect)));
        max-height: 100dvh;
        border-radius: 0;
    }
    .tv-stage.idle .tv-overlay-grid { opacity: 0; }
    /* Descendants normally opt back into pointer events; disable those too
       so an invisible control cannot intercept a click on the video. */
    .tv-stage.idle .tv-overlay-grid,
    .tv-stage.idle .tv-overlay-grid *,
    body.tv-mode-active:has(.tv-stage.idle) .site-header * { pointer-events: none; }
}

@media (min-width: 768px) and (max-width: 1000px) {
    .tv-stage { --tv-content-width: calc(100vw - 32px); }
    .tv-stage .tv-desktop-title { display: none; }
    .tv-stage .tv-row-top { gap: 8px; }
    .tv-stage .tv-upcoming { gap: 4px 10px; padding: 8px 10px; }
    .tv-stage .tv-upcoming.is-clickable .tv-upcoming-cta { padding: 9px; }
    .tv-stage .tv-rail-btn { padding: 0 7px; }
    .tv-stage .tv-genres-label { display: none; }
}

@media (min-width: 768px) and (max-height: 660px) {
    .tv-stage { --tv-header-space: 84px; --tv-footer-space: 180px; }
    .tv-stage .tv-player-footer { gap: 6px 12px; padding-top: 10px; }
    .tv-stage .tv-now-playing-name { font-size: 24px; }
    .tv-stage .tv-now-playing-label { display: none; }
}

@media (min-width: 768px) and (prefers-reduced-motion: reduce) {
    .tv-stage .tv-video,
    .tv-stage .tv-overlay-grid,
    body.tv-mode-active .site-header { transition: none; }
}
