.tv-detail-page .tv-episodes {
    box-sizing: border-box;
    width: min(1100px, calc(100% - 32px));
    height: 500px;
    display: flex;
    flex-direction: column;
    margin: 44px auto 60px;
    padding: 22px;
    background: #101010;
    border: 1px solid #292929;
    border-radius: 4px;
    color: #eee;
}


/* Scrollable episode list */
#tv-season-panels {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px;
    scrollbar-width: thin;
    scrollbar-color: #555 #101010;
}


.tv-episodes-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid #333;
}
.tv-episodes-heading h2 {
    margin: 0;
    font-size: 16px;
    letter-spacing: 1px;
    color: #eee;
}
.tv-episodes-type {
    font-size: 10px;
    color: #920000;
    font-weight: 700;
    letter-spacing: 2px;
}
.tv-season-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 18px 0 4px;
}
.tv-season-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.tv-season-select {
    max-width: 70%;
    min-width: 150px;
    padding: 9px 36px 9px 12px;
    color: #eee;
    background-color: #202020;
    border: 1px solid #404040;
    border-radius: 4px;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}
.tv-season-select:focus-visible,
.tv-episodes-show-more:focus-visible {
    outline: 2px solid #b52b2b;
    outline-offset: 2px;
}
.tv-season-count {
    font-size: 12px;
    color: #aaa;
    white-space: nowrap;
}
.tv-season-panel[hidden],
.tv-episode-card[hidden],
.tv-episodes-show-more[hidden] {
    display: none !important;
}
.tv-episode-card {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 12px 18px;
    padding: 20px 0;
    border-bottom: 1px solid #292929;
}
.tv-episode-card:last-child {
    border-bottom: none;
}
.tv-episode-image-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #202020;
    border-radius: 4px;
}
.tv-episode-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.tv-episode-details { min-width: 0; }
.tv-episode-title {
    margin: 0 0 8px;
    font-size: 15px;
    line-height: 1.4;
    color: #eee;
    font-weight: 650;
    overflow-wrap: anywhere;
}
.tv-episode-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-bottom: 8px;
    font-size: 12px;
    color: #a7a7a7;
}
.tv-episode-rating {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #a7a7a7;
}
.tv-episode-star { color: #e0ab28; font-size: 14px; }
.tv-episode-description {
    grid-column: 1 / -1;
    margin: 0;
    color: #a7a7a7;
    font-size: 13px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}
.tv-season-empty {
    margin: 20px 0 0;
    color: #a7a7a7;
    font-size: 13px;
}
.tv-episodes-show-more {
    display: block;
    margin: 18px auto 0;
    padding: 10px 16px;
    background: #202020;
    color: #eee;
    border: 1px solid #444;
    border-radius: 3px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.tv-episodes-show-more:hover { background: #920000; }
@media (max-width: 600px) {
    .tv-detail-page .tv-episodes {
        margin-top: 30px;
        margin-bottom: 34px;
        padding: 14px;
    }
    .tv-episodes-heading h2 { font-size: 14px; }
    .tv-season-toolbar { margin-top: 14px; }
    .tv-episode-card {
        grid-template-columns: 112px minmax(0, 1fr);
        gap: 10px 12px;
        padding: 16px 0;
    }
    .tv-episode-title { font-size: 13px; }
    .tv-episode-meta { font-size: 11px; gap: 3px 8px; }
    .tv-episode-description { font-size: 12px; }
    .tv-season-select { font-size: 13px; }
}


/* Desktop: Description beside episode image */
@media (min-width: 601px) {
    .tv-episode-card {
        row-gap: 8px;
    }

    .tv-episode-image-wrap {
        grid-column: 1;
        grid-row: 1 / span 2;
        align-self: start;
    }

    .tv-episode-details {
        grid-column: 2;
        grid-row: 1;
    }

    .tv-episode-description {
        grid-column: 2;
        grid-row: 2;
    }
}


/* Custom Season Dropdown */
.tv-custom-season-dropdown {
    position: relative;
    width: 160px;
    max-width: 100%;
    z-index: 20;
}

.tv-custom-season-dropdown .tv-season-select {
    display: none !important;
}

.tv-custom-season-trigger {
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #202020;
    color: #fff;
    border: 1px solid #920000;
    border-radius: 5px;
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.tv-custom-season-trigger:hover,
.tv-custom-season-trigger[aria-expanded="true"] {
    background: #282828;
    border-color: #b50000;
}

.tv-custom-season-trigger::after {
    content: "";
    width: 7px;
    height: 7px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(45deg);
    transition: transform 0.2s;
}

.tv-custom-season-trigger[aria-expanded="true"]::after {
    transform: rotate(225deg);
}

.tv-custom-season-menu {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    max-height: 240px;
    overflow-y: auto;
    background: #181818;
    border: 1px solid #920000;
    border-radius: 5px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    padding: 4px;
    z-index: 50;
}

.tv-custom-season-menu[hidden] {
    display: none !important;
}

.tv-custom-season-option {
    display: block;
    width: 100%;
    padding: 11px 12px;
    background: transparent;
    border: none;
    border-radius: 3px;
    color: #ddd;
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.tv-custom-season-option:hover,
.tv-custom-season-option:focus-visible {
    background: #920000;
    color: #fff;
    outline: none;
}

.tv-custom-season-option[aria-checked="true"] {
    background: #410000;
    color: #fff;
}

.tv-custom-season-option[aria-checked="true"]:hover {
    background: #920000;
}

.tv-custom-season-trigger:focus-visible {
    outline: 2px solid #b50000;
    outline-offset: 2px;
}

.tv-detail-page .movie-credit-row {
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr);
    column-gap: 6px;
    align-items: start;
}
.tv-detail-page #movie-page-desc-text.movie-credit-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-left: 0;
    min-width: 0;
}
.tv-detail-page .movie-credit-list a {
    display: block;
}
.tv-detail-page .tv-trailer-preview {
    position: relative;
    width: 240px;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 8px;
    background: #141414;
    margin-bottom: 20px;
}
.tv-detail-page .tv-trailer-preview iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}
.tv-detail-page .movie-trailer-popup-trigger {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    border: 0;
    background: transparent;
    cursor: pointer;
}
@media (max-width: 768px) {
    .tv-detail-page .tv-trailer-preview,
    .tv-detail-page .franchise-section {
        width: 100vw;
        max-width: 100vw;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
        box-sizing: border-box;
    }
    .tv-detail-page .tv-trailer-preview {
        border-radius: 0;
        margin-bottom: 20px;
    }
    .tv-detail-page .franchise-section {
        padding-left: 16px;
        padding-right: 16px;
    }
    .tv-detail-page .movie-trailer-popup-trigger {
        display: none;
    }
}


/* Compact episode layout */
.tv-detail-page .tv-episode-card {
    display: grid;
    grid-template-columns: 24px 130px minmax(0, 1fr) 120px;
    column-gap: 16px;
    row-gap: 6px;
    align-items: start;
}

.tv-detail-page .tv-episode-number {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
    text-align: center;
    color: #bbb;
    font-size: 21px;
}

.tv-detail-page .tv-episode-image-wrap {
    grid-column: 2;
    grid-row: 1 / span 2;
}

.tv-detail-page .tv-episode-details {
    grid-column: 3;
    grid-row: 1;
}

.tv-detail-page .tv-episode-title {
    margin-bottom: 5px;
    font-size: 16px;
}

.tv-detail-page .tv-episode-rating {
    font-size: 11px;
}

/* Description below title, beside image */
.tv-detail-page .tv-episode-description {
    grid-column: 3;
    grid-row: 2;
    margin: 0;
    font-size: 15px;
}

/* Fixed right-side date and runtime */
.tv-detail-page .tv-episode-aside {
    grid-column: 4;
    grid-row: 1 / span 2;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    text-align: right;
}

.tv-detail-page .tv-episode-aired {
    color: #888;
    font-size: 10px;
    white-space: nowrap;
}

.tv-detail-page .tv-episode-runtime {
    color: #eee;
    font-size: 17px;
    font-weight: 600;
    white-space: nowrap;
}

/* Mobile: keep description underneath */
@media (max-width: 600px) {
    .tv-detail-page .tv-episode-card {
        grid-template-columns: 20px 100px minmax(0, 1fr);
        column-gap: 10px;
        row-gap: 8px;
    }

    .tv-detail-page .tv-episode-number {
        grid-column: 1;
        grid-row: 1 / span 2;
        align-self: start;
        padding-top: 25px;
        font-size: 16px;
    }

    .tv-detail-page .tv-episode-image-wrap {
        grid-column: 2;
        grid-row: 1 / span 2;
    }

    .tv-detail-page .tv-episode-description {
        grid-column: 1 / -1;
        grid-row: 3;
        font-size: 12px;
    }
}