/*
 * Seir Sanduk – responsive visual system
 * Kept separate from the legacy stylesheets so original comments and rules remain intact.
 */
:root {
    color-scheme: light;
    --page: #f3f6fb;
    --surface: #ffffff;
    --surface-soft: #edf2fa;
    --ink: #17243b;
    --muted: #64748b;
    --brand: #3157a4;
    --brand-dark: #233f7c;
    --accent: #e6a23c;
    --line: #dce4f0;
    --shadow: 0 12px 32px rgba(27, 48, 86, .09);
    --radius: 16px;
}

* { box-sizing: border-box; }

html {
    min-width: 320px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    color: var(--ink);
    background: var(--page);
    font: 15px/1.6 Inter, "Segoe UI", Arial, sans-serif;
}

a, a:link, a:visited {
    color: var(--brand);
    text-decoration: none;
    transition: color .2s ease, background-color .2s ease;
}

a:hover, a:focus { color: var(--brand-dark); }

img, video, iframe, object, embed {
    max-width: 100%;
}

img { height: auto; }

.gridContainer {
    width: min(100% - 32px, 1440px);
    max-width: 1440px;
    margin: 24px auto;
    padding: 0;
    overflow: visible;
}

#header, .header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    float: none;
    width: 100%;
    min-height: 100px;
    margin: 0 0 20px;
    padding: 16px 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    background-image: none;
}

#logo {
    display: flex;
    align-items: center;
    float: none;
    width: auto;
    min-width: 0;
}

#logo img {
    display: block;
    max-width: min(256px, 100%);
    padding: 0;
}

#banner {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    float: none;
    width: auto;
    min-width: 0;
    margin: 0;
}

#banner img { max-height: 90px; object-fit: contain; }

#channels, #player, #program, #content {
    float: none;
    clear: none;
    min-width: 0;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 20px;
    overflow: visible;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

#channels {
    float: left;
    width: 23%;
    max-height: 78vh;
    overflow: auto;
    background: var(--surface);
}

#player {
    float: left;
    width: calc(52% - 28px);
    margin-left: 14px;
    margin-right: 14px;
}

#program {
    float: right;
    width: 25%;
    max-height: 78vh;
    overflow: auto;
}

#content { width: 100%; }

#channels h1, #player h1, #program h1,
#content h1, #channels h2, #player h2,
#program h2, #content h2 {
    margin: 0 0 16px;
    color: var(--ink);
    font-size: clamp(1.15rem, 2vw, 1.55rem);
    line-height: 1.3;
}

ul.nav_vodlist, ul.nav, ul.channel_list {
    margin: 0;
    padding: 0;
    list-style: none;
    border: 0;
    background: transparent;
}

ul.nav_vodlist li, ul.nav li, ul.channel_list li {
    margin: 0 0 6px;
    border: 0;
}

ul.nav_vodlist a, ul.nav a, ul.channel_list a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--ink);
    background: var(--surface-soft);
    font-size: .9rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

ul.nav_vodlist a:hover, ul.nav a:hover,
ul.channel_list a:hover {
    color: var(--brand-dark);
    border-color: #c8d6ef;
    background: #e1eafb;
}

ul.nav_vodlist img, ul.channel_list img {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    object-fit: contain;
}

.title, .tvlistnow, .vodlist, .channel_list {
    float: none;
    width: 100%;
    height: auto;
    padding: 10px;
    border-radius: 10px;
    background: var(--surface-soft);
}

#player iframe, #player video, #player object,
#player embed {
    display: block;
    width: 100%;
    max-width: 100%;
}

#footer {
    clear: both;
    float: none;
    width: 100%;
    margin: 20px 0 0;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--muted);
    background: var(--surface);
    text-align: center;
}

#footer a { margin: 0 5px; }

.facebook-comments {
    max-width: 100%;
    overflow: auto;
}

#fbox-display {
    left: 50%;
    width: min(340px, calc(100vw - 32px));
    transform: translateX(-50%);
}

input, select, textarea, button {
    max-width: 100%;
    font: inherit;
}

button, .button {
    border: 0;
    border-radius: 10px;
    padding: 10px 16px;
    color: #fff;
    background: var(--brand);
    cursor: pointer;
}

button:hover, .button:hover { background: var(--brand-dark); }

@media (max-width: 1100px) {
    #channels { width: 30%; }
    #player { width: calc(70% - 14px); margin-right: 0; }
    #program {
        clear: both;
        float: none;
        width: 100%;
        max-height: none;
        margin-top: 16px;
    }
}

@media (max-width: 700px) {
    .gridContainer {
        width: min(100% - 20px, 600px);
        margin: 10px auto;
    }

    #header {
        flex-direction: column;
        gap: 12px;
        min-height: 0;
        margin-bottom: 12px;
        padding: 16px;
    }

    #logo, #banner {
        justify-content: center;
        width: 100%;
    }

    #channels, #player, #program, #content {
        float: none;
        clear: both;
        width: 100%;
        max-height: none;
        margin: 0 0 12px;
        padding: 14px;
    }

    #channels { max-height: 55vh; }
    #player { overflow: hidden; }
    #footer { margin-top: 8px; padding: 16px 10px; }
    body { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}

/* Refined layout: balanced desktop width and predictable mobile reading order. */
.gridContainer {
    display: grid;
    grid-template-columns: minmax(210px, 0.78fr) minmax(0, 2fr) minmax(330px, 1.28fr);
    grid-template-areas:
        "header header header"
        "channels player program"
        "channels chatbox program"
        "footer footer footer";
    align-items: start;
    column-gap: 18px;
    row-gap: 18px;
    width: min(100% - 64px, 1320px);
    max-width: 1320px;
    margin: 28px auto;
}

#header { grid-area: header; }
#channels {
    grid-area: channels;
    float: none;
    width: auto;
    max-height: 78vh;
    margin: 0;
}
#player {
    grid-area: player;
    float: none;
    width: auto;
    min-width: 0;
    margin: 0;
}
#program {
    grid-area: program;
    float: none;
    width: auto;
    min-width: 0;
    max-height: 100vh;
    margin: 0;
}
#chatbox {
    grid-area: chatbox;
    min-width: 0;
    padding: 16px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
#footer { grid-area: footer; }
#program h2 {
    white-space: nowrap;
    font-size: clamp(.95rem, 1.15vw, 1.2rem);
    letter-spacing: -.025em;
}
#player #video,
#player #theVideoElement { width: 100%; }
#player iframe,
#chatbox iframe { width: 100%; max-width: 100%; }
#channels:empty,
#program:empty { display: none; }

/* Content-only pages use the full available content width. */
.gridContainer:has(#channels:empty) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "header" "player" "footer";
}
.gridContainer:has(#channels:empty) #player {
    grid-column: 1 / -1;
    width: 100%;
}

@media (max-width: 1150px) {
    .gridContainer {
        grid-template-columns: minmax(190px, .75fr) minmax(0, 2fr);
        grid-template-areas:
            "header header"
            "channels player"
            "channels chatbox"
            "program program"
            "footer footer";
        width: min(100% - 40px, 1050px);
    }
    #program { max-height: none; }
    #program h2 { white-space: normal; }
}

@media (max-width: 700px) {
    .gridContainer {
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: calc(100% - 20px);
        margin: 10px auto;
    }
    #header, #player, #channels, #chatbox, #program, #footer {
        order: initial;
        width: 100%;
        max-width: 100%;
        max-height: none;
        margin: 0;
    }
    #header { order: 0; }
    #player { order: 1; }
    #channels { order: 2; }
    #chatbox { order: 3; }
    #program { order: 4; }
    #footer { order: 5; }
    #channels { overflow: visible; }
    #program h2 { white-space: normal; }
    #chatbox { padding: 12px; }
    #chatbox script + div,
    #chatbox iframe { max-width: 100% !important; }
}

@media (min-width: 1600px) {
    .gridContainer { width: min(100% - 120px, 1320px); }
}

/* Small-screen overflow and readable focus states. */
html, body { overflow-x: hidden; }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
    outline: 3px solid rgba(49, 87, 164, .35);
    outline-offset: 2px;
}
#program ul { padding-left: 1.2rem; }
#program li { overflow-wrap: anywhere; }

/* Final layout correction: valid document flow, compact player controls and mobile order. */
html, body {
    width: 100%;
    min-width: 320px;
    margin: 0;
    overflow-x: clip;
}

.gridContainer {
    display: grid;
    grid-template-columns: minmax(190px, .82fr) minmax(0, 1.75fr) minmax(310px, 1.35fr);
    grid-template-areas:
        "header header header"
        "channels player program"
        "channels chatbox program"
        "footer footer footer";
    align-items: start;
    gap: 14px;
    width: min(100% - 72px, 1280px);
    max-width: 1280px;
    margin: 22px auto;
}

#header { grid-area: header; }
#channels { grid-area: channels; width: auto; min-width: 0; max-height: 78vh; height: auto; overflow: auto; }
#player { grid-area: player; width: auto; min-width: 0; min-height: 0; height: auto; margin: 0; padding: 14px; overflow: visible; }
#chatbox { grid-area: chatbox; min-width: 0; }
#program { grid-area: program; width: auto; min-width: 0; max-height: 100vh; height: auto; overflow: auto; }
#footer { grid-area: footer; }

/* Hide empty side columns on information/contact pages. */
.gridContainer:not(:has(#channels ul.nav_vodlist)) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "header" "player" "footer";
}
.gridContainer:not(:has(#channels ul.nav_vodlist)) #channels,
.gridContainer:not(:has(#channels ul.nav_vodlist)) #program,
.gridContainer:not(:has(#channels ul.nav_vodlist)) #chatbox {
    display: none;
}
.gridContainer:not(:has(#channels ul.nav_vodlist)) #player {
    width: 100%;
    grid-column: 1 / -1;
}

/* Channel title and player choices are deliberately compact. */
#player .buttonsLeft {
    float: none;
    width: 100%;
    margin: 0 0 7px;
    padding: 0;
    text-align: left;
}
#player .buttonsLeft h1 {
    margin: 0;
    font-size: clamp(1.05rem, 1.7vw, 1.35rem);
    line-height: 1.2;
}
#player .buttonsLeft h1 a {
    display: inline-block;
    color: #20365f;
    font-weight: 750;
    letter-spacing: -.025em;
    text-decoration: none;
}
#player .buttonsLeft h1 a:hover { color: #3157a4; }
#player .buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: 6px;
    margin: 0 0 10px;
    padding: 0;
    text-align: left;
}
#player .buttons a,
#player .buttons a:link,
#player .buttons a:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 29px;
    padding: 5px 11px;
    border: 1px solid #d5def0;
    border-radius: 7px;
    color: #29477f;
    background: #edf3ff;
    box-shadow: none;
    font-size: .78rem;
    font-weight: 700;
    line-height: 1.1;
    text-decoration: none;
    transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}
#player .buttons a:hover,
#player .buttons a:focus-visible {
    color: #fff;
    border-color: #3157a4;
    background: #3157a4;
    transform: translateY(-1px);
}
#player #theVideoElement,
#player #video,
#player .jwplayer,
#player video,
#player iframe {
    display: block;
    width: 100% !important;
    max-width: 100%;
}
#player #video { aspect-ratio: 16 / 9; height: auto; }
#player > br { display: none; }

#program h2 {
    margin: 0 0 12px;
    font-size: clamp(.95rem, 1.15vw, 1.12rem);
    line-height: 1.25;
    white-space: normal;
}

@media (max-width: 1120px) and (min-width: 701px) {
    .gridContainer {
        grid-template-columns: minmax(180px, .72fr) minmax(0, 1.8fr);
        grid-template-areas:
            "header header"
            "player player"
            "channels chatbox"
            "program program"
            "footer footer";
        width: min(100% - 40px, 980px);
    }
    #channels { max-height: 65vh; }
    #program { max-height: none; }
}

@media (max-width: 700px) {
    .gridContainer {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: calc(100% - 18px);
        margin: 9px auto;
    }
    #header, #player, #channels, #chatbox, #program, #footer {
        display: block;
        order: initial;
        width: 100%;
        max-width: 100%;
        max-height: none;
        min-width: 0;
        margin: 0;
    }
    #header { order: 0; }
    #player { order: 1; padding: 11px; }
    #channels { order: 2; max-height: none; overflow: visible; }
    #chatbox { order: 3; padding: 10px; }
    #program { order: 4; overflow: visible; }
    #footer { order: 5; }
    #player .buttonsLeft h1 { font-size: 1.05rem; }
    #player .buttons { gap: 5px; margin-bottom: 8px; }
    #player .buttons a,
    #player .buttons a:link,
    #player .buttons a:visited { min-height: 28px; padding: 5px 9px; font-size: .75rem; }
    #channels ul.nav_vodlist a { min-height: 39px; }
}

@media (min-width: 1600px) {
    .gridContainer { width: min(100% - 120px, 1280px); }
}

/* Player controls, channel details and shared responsive footer refinements. */
.gridContainer {
    grid-template-columns: minmax(205px, .82fr) minmax(0, 1.9fr) minmax(320px, 1.25fr);
    grid-template-areas:
        "header header header"
        "channels player program"
        "channels description program"
        "channels chatbox program"
        "footer footer footer";
    width: min(100% - 72px, 1280px);
    max-width: 1280px;
}

#channel-description {
    grid-area: description;
    min-width: 0;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow-wrap: anywhere;
}

#channel-description h2 {
    margin: 0 0 12px;
    color: var(--ink);
    font-size: 1.15rem;
    line-height: 1.35;
}

.player-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    margin: 0 0 12px;
}

#player .buttonsLeft {
    flex: 1 1 auto;
    min-width: 0;
    float: none;
    margin: 0;
    text-align: left;
}

#player .buttonsLeft h1 {
    margin: 0;
    font-size: clamp(1rem, 1.55vw, 1.35rem);
    line-height: 1.2;
}

#player .buttonsLeft h1 a {
    color: var(--ink);
    font-weight: 750;
}

#player .buttons {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    float: none;
    width: auto;
    margin: 0;
    padding: 0;
}

#player .buttons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 11px;
    border: 1px solid #cbd7eb;
    border-radius: 9px;
    color: var(--brand-dark);
    background: #edf3ff;
    font-size: .82rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

#player .buttons a:hover,
#player .buttons a:focus-visible {
    border-color: var(--brand);
    color: #fff;
    background: var(--brand);
}

#player .buttons a.is-active {
    border-color: var(--brand-dark);
    color: #fff;
    background: var(--brand-dark);
    box-shadow: 0 2px 8px rgba(35, 63, 124, .22);
}

#footer {
    line-height: 1.9;
    overflow-wrap: anywhere;
}

#footer a {
    display: inline-block;
    padding: 2px 4px;
    border-radius: 5px;
    font-weight: 600;
}

#footer a:hover { background: var(--surface-soft); }

@media (max-width: 1150px) {
    .gridContainer {
        grid-template-columns: minmax(190px, .78fr) minmax(0, 2fr);
        grid-template-areas:
            "header header"
            "channels player"
            "channels description"
            "channels chatbox"
            "program program"
            "footer footer";
    }
}

@media (max-width: 700px) {
    .gridContainer {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: calc(100% - 16px);
        margin: 8px auto;
    }

    #header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        min-height: 0;
        padding: 8px 10px;
    }

    #logo {
        flex: 0 1 42%;
        justify-content: flex-start;
        width: auto;
    }

    #logo img {
        width: 100%;
        max-width: 170px;
        height: auto;
    }

    #banner {
        flex: 1 1 58%;
        justify-content: flex-end;
        width: auto;
        min-width: 0;
        overflow: hidden;
    }

    #banner img,
    #banner iframe,
    #banner ins {
        display: block;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 48px;
        height: auto;
        object-fit: contain;
    }

    #player { order: 1; }
    #channels { order: 2; }
    #channel-description { order: 3; }
    #chatbox { order: 4; }
    #program { order: 5; }
    #footer { order: 6; }

    .player-toolbar {
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 10px;
    }

    #player .buttonsLeft { flex: 1 1 100%; }
    #player .buttons { width: 100%; justify-content: flex-end; }
    #player .buttons a { min-height: 32px; padding: 6px 10px; }
    #channel-description { padding: 14px; }
}

@media (max-width: 380px) {
    #logo { flex-basis: 39%; }
    #banner { flex-basis: 61%; }
    #logo img { max-width: 135px; }
    #banner img, #banner iframe, #banner ins { max-height: 40px; }
    #player .buttons { gap: 4px; }
    #player .buttons a { padding: 6px 8px; font-size: .76rem; }
}


/* Latest layout pass: compact header, desktop chat below player, balanced columns. */
@media (min-width: 1121px) {
    .gridContainer {
        grid-template-columns: minmax(205px, .82fr) minmax(0, 1.9fr) minmax(320px, 1.25fr);
        grid-template-areas:
            "header header header"
            "channels player program"
            "channels chatbox program"
            "channels description program"
            "footer footer footer";
        align-items: stretch;
        column-gap: 14px;
        row-gap: 10px;
        width: min(100% - 64px, 1280px);
        margin: 12px auto;
    }

    #header {
        min-height: 76px;
        margin-bottom: 0;
        padding: 8px 16px;
    }

    #logo img { max-height: 58px; width: auto; }
    #banner img { max-height: 60px; }
    #channels, #program {
        height: 100%;
        max-height: none;
        overflow: auto;
    }
    #player { padding: 11px 13px; }
    #player .player-toolbar { margin-bottom: 5px; }
    #player .buttons { margin-bottom: 5px; }
    #chatbox { padding: 10px 12px; }
    #channel-description { padding: 12px 14px; }
}

@media (max-width: 1120px) and (min-width: 701px) {
    .gridContainer {
        grid-template-areas:
            "header header"
            "channels player"
            "channels chatbox"
            "channels description"
            "program program"
            "footer footer";
        align-items: stretch;
        row-gap: 10px;
        margin-top: 12px;
    }
    #header { min-height: 76px; margin-bottom: 0; padding: 8px 14px; }
    #logo img { max-height: 58px; width: auto; }
    #banner img { max-height: 60px; }
    #channels, #program { max-height: none; height: 100%; }
    #player { padding: 11px; }
}

@media (max-width: 700px) {
    #header {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
        min-height: 0;
        margin: 0;
        padding: 5px 7px;
    }
    #logo {
        flex: 0 1 40%;
        width: 40%;
        min-width: 0;
        justify-content: flex-start;
    }
    #logo img {
        display: block;
        width: 100%;
        max-width: 150px;
        max-height: 42px;
        object-fit: contain;
    }
    #banner {
        flex: 1 1 60%;
        width: 60%;
        min-width: 0;
        justify-content: flex-end;
        overflow: hidden;
    }
    #banner img, #banner iframe, #banner ins {
        display: block;
        width: auto !important;
        max-width: 100% !important;
        max-height: 38px;
        height: auto;
        object-fit: contain;
    }
    .gridContainer { gap: 8px; margin-top: 7px; }
    #header, #player, #channels, #channel-description, #chatbox, #program, #footer {
        order: initial;
    }
    #header { order: 0; }
    #player { order: 1; }
    #channels { order: 2; }
    #channel-description { order: 3; }
    #chatbox { order: 4; }
    #program { order: 5; }
    #footer { order: 6; }
}

@media (max-width: 380px) {
    #logo { flex-basis: 37%; width: 37%; }
    #banner { flex-basis: 63%; width: 63%; }
    #logo img { max-height: 34px; }
    #banner img, #banner iframe, #banner ins { max-height: 32px; }
}

/* Latest layout correction: compact channel toolbar and player-attached chat. */
.gridContainer {
    grid-template-columns: minmax(205px, .82fr) minmax(0, 1.9fr) minmax(320px, 1.25fr);
    grid-template-areas:
        "header header header"
        "channels player program"
        "channels description program"
        "footer footer footer";
    align-items: stretch;
}

#player {
    display: flex;
    flex-direction: column;
    gap: 0;
}

#player .player-toolbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

#player .buttonsLeft {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

#player .buttonsLeft h1 {
    margin: 0;
    font-size: clamp(.88rem, 1.25vw, 1.25rem);
    line-height: 1.15;
    white-space: nowrap;
}

#player .buttonsLeft h1 a {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    padding: 7px 10px;
    border: 1px solid #cbd7eb;
    border-radius: 9px;
    color: var(--brand-dark);
    background: #edf3ff;
    font-weight: 700;
    text-decoration: none;
}

#player .buttons {
    flex: 0 0 auto;
    width: auto;
    flex-wrap: nowrap;
    gap: 5px;
}

#player .buttons a { padding: 6px 9px; }

#player #chatbox {
    order: 20;
    width: 100%;
    min-width: 0;
    margin: 10px 0 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}

#player #chatbox script + div,
#player #chatbox iframe {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
}

#channels ul.nav_vodlist li.is-current-channel > a {
    color: #fff;
    border-color: #24478f;
    background: linear-gradient(110deg, #24478f, #4776c5);
    box-shadow: 0 3px 10px rgba(35, 63, 124, .24);
    font-weight: 750;
}

#channels ul.nav_vodlist li.is-current-channel > a img {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .22));
}

#channel-description { align-self: stretch; }
#channels, #program { height: 100%; }

@media (max-width: 700px) {
    #header {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
        width: 100%;
        overflow: hidden;
    }

    #logo {
        flex: 0 1 38% !important;
        width: 38% !important;
        min-width: 0;
    }

    #logo a { display: block; width: 100%; min-width: 0; }
    #logo img {
        display: block;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 42px;
        object-fit: contain;
        object-position: left center;
    }

    #banner {
        flex: 1 1 62% !important;
        width: 62% !important;
        min-width: 0;
        overflow: hidden;
    }

    #banner > * { max-width: 100% !important; }
    #banner img, #banner iframe, #banner ins {
        display: block;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 42px;
        height: auto !important;
        object-fit: contain;
        object-position: right center;
    }

    #player .player-toolbar {
        flex-wrap: nowrap;
        gap: 5px;
    }

    #player .buttonsLeft { flex: 1 1 0; }
    #player .buttonsLeft h1 { font-size: clamp(.68rem, 3.2vw, .95rem); }
    #player .buttonsLeft h1 a { padding: 6px 7px; }
    #player .buttons { flex: 0 0 auto; gap: 3px; }
    #player .buttons a { min-height: 29px; padding: 5px 6px; font-size: .68rem; }

    /* Chat remains directly below the video inside the player card. */
    #player #chatbox { margin-top: 8px; }
    #channel-description { order: 4; }
}

@media (max-width: 380px) {
    #logo { flex-basis: 34% !important; width: 34% !important; }
    #banner { flex-basis: 66% !important; width: 66% !important; }
    #player .buttonsLeft h1 { font-size: .66rem; }
    #player .buttons a { padding-left: 5px; padding-right: 5px; font-size: .64rem; }
}


/* Latest refinement: keep the player, chat and channel details together. */
@media (min-width: 701px) {
    .gridContainer {
        grid-template-columns: minmax(190px, .82fr) minmax(0, 1.8fr) minmax(300px, 1.25fr);
        grid-template-areas:
            "header header header"
            "channels player program"
            "footer footer footer";
        align-items: stretch;
        column-gap: 14px;
        row-gap: 10px;
    }

    #channels,
    #program {
        height: 100%;
        min-height: 100%;
        max-height: none;
        align-self: stretch;
        box-sizing: border-box;
    }

    #player {
        display: flex;
        flex-direction: column;
        align-self: stretch;
        min-height: 100%;
        gap: 0;
        padding: 10px 12px;
    }

    #player > hr {
        margin: 2px 0 5px;
    }

    #player .player-toolbar {
        margin: 0 0 4px;
        padding: 0;
    }

    #player #chatbox {
        margin: 3px 0 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    #player #channel-description {
        margin: 6px 0 0;
        padding: 10px 12px;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background: var(--surface);
        box-shadow: var(--shadow);
    }
}

/* The banner and logo share one unbreakable row on narrow phones. */
@media (max-width: 700px) {
    #header {
        display: flex !important;
        flex-flow: row nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 4px !important;
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        overflow: hidden;
    }

    #logo {
        display: flex;
        flex: 0 1 36% !important;
        width: 36% !important;
        min-width: 0 !important;
        max-width: 36%;
        align-items: center;
        overflow: hidden;
    }

    #logo a {
        display: block;
        width: 100%;
        min-width: 0;
    }

    #logo img {
        display: block;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: 36px;
        object-fit: contain;
        object-position: left center;
    }

    #banner {
        display: flex;
        flex: 1 1 64% !important;
        width: 64% !important;
        min-width: 0 !important;
        max-width: 64%;
        align-items: center;
        justify-content: flex-end;
        overflow: hidden;
    }

    #banner > *,
    #banner a {
        display: block;
        min-width: 0;
        max-width: 100% !important;
    }

    #banner img,
    #banner iframe,
    #banner ins {
        display: block;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: 36px;
        object-fit: contain;
        object-position: right center;
    }

    /* Chat and channel information remain attached to the player card. */
    #player #chatbox {
        margin: 3px 0 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    #player #channel-description {
        margin: 6px 0 0;
        padding: 10px 12px;
    }

    #channels,
    #program {
        height: auto;
        min-height: 0;
    }
}

@media (max-width: 380px) {
    #header { gap: 3px !important; padding: 4px 5px !important; }
    #logo { flex-basis: 34% !important; width: 34% !important; max-width: 34%; }
    #banner { flex-basis: 66% !important; width: 66% !important; max-width: 66%; }
    #logo img, #banner img, #banner iframe, #banner ins { max-height: 30px; }
}

/* Keep content pages visually consistent with the homepage. */
.gridContainer:not(:has(#channels ul.nav_vodlist)) #player {
    box-sizing: border-box;
    min-height: 0;
    padding: clamp(18px, 3vw, 32px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.gridContainer:not(:has(#channels ul.nav_vodlist)) #player h1,
.gridContainer:not(:has(#channels ul.nav_vodlist)) #player h2 {
    color: var(--ink);
    line-height: 1.3;
}

.gridContainer:not(:has(#channels ul.nav_vodlist)) #footer {
    width: 100%;
    box-sizing: border-box;
}

/* Final spacing and shared content-page layout corrections. */
#program {
    padding-top: 12px;
}

#program .program-ad {
    margin: 0 0 8px;
    padding: 0;
    text-align: center;
}

#program .program-ad > * {
    max-width: 100%;
}

#program h2 {
    margin-top: 0;
    padding-top: 0;
}

/* Information pages share the same full-width card and footer as the homepage. */
.gridContainer:has(> #content) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
        "header"
        "content"
        "footer";
    align-items: start;
    gap: 14px;
    width: min(100% - 64px, 1280px);
    max-width: 1280px;
}

.gridContainer > #content {
    grid-area: content;
    float: none;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: clamp(20px, 3vw, 36px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    line-height: 1.7;
}

.gridContainer > #content h1,
.gridContainer > #content h2,
.gridContainer > #content h3 {
    color: var(--ink);
    line-height: 1.3;
}

.gridContainer > #footer {
    grid-area: footer;
    width: 100%;
    margin: 0;
}

@media (max-width: 700px) {
    .gridContainer:has(> #content) {
        display: flex;
        flex-direction: column;
        width: calc(100% - 16px);
        gap: 10px;
        margin: 8px auto;
    }

    .gridContainer > #content {
        width: 100%;
        padding: 16px;
    }
}
