:root {
    --bg0: #07090d;
    --bg1: #121820;
    --text: #f2f5f8;
    --muted: #9aa8b8;
    --accent: #e8b84a;
    --line: rgba(255,255,255,.08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: "Segoe UI", system-ui, sans-serif;
    background:
        radial-gradient(1200px 600px at 10% -10%, #243247 0%, transparent 55%),
        radial-gradient(900px 500px at 90% 0%, #3a2a12 0%, transparent 50%),
        linear-gradient(180deg, var(--bg1), var(--bg0));
}

.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2.5rem 1.25rem 4rem;
}

.hero-head { margin-bottom: 2rem; }
.eyebrow {
    text-transform: uppercase;
    letter-spacing: .18em;
    font-size: .75rem;
    color: var(--accent);
    margin: 0 0 .5rem;
}
.hero-head h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 700;
    letter-spacing: -.02em;
}
.sub { color: var(--muted); margin: .6rem 0 0; }

.empty {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 2.5rem;
    background: rgba(0,0,0,.25);
}
.hint { color: var(--muted); }

.slider {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(8,10,14,.55);
    overflow: hidden;
    min-height: 420px;
}

.track { position: relative; min-height: 420px; }

.slide {
    display: none;
    position: relative;
    grid-template-columns: minmax(180px, 280px) 1fr;
    gap: 1.75rem;
    padding: 1.75rem;
    padding-top: 3.25rem;
}
.slide.is-active { display: grid; }

.slide > .live-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .55rem 1rem;
    border-radius: 999px;
    background: #e11d48 !important;
    border: 2px solid #fecdd3 !important;
    color: #fff !important;
    font-size: .85rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    box-shadow: 0 8px 24px rgba(225, 29, 72, .45);
    white-space: nowrap;
}
.slide > .live-badge::before {
    content: "";
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    background: #fff;
    animation: live-pulse 1.4s infinite;
}

.poster img,
.poster-fallback {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: 12px;
    background: #1a222c;
}
.poster-fallback {
    display: grid;
    place-items: center;
    color: var(--muted);
}

.rating {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}
.rating span { font-size: 1rem; color: var(--muted); margin-left: .2rem; }
.meta h2 { margin: .4rem 0 .2rem; font-size: clamp(1.4rem, 3vw, 2rem); }
.type { color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; }
.genres {
    text-transform: none;
    letter-spacing: 0;
    color: #c9d3de;
    font-weight: 500;
}
.year {
    text-transform: none;
    letter-spacing: 0;
    color: var(--accent);
    font-weight: 600;
}
.origin {
    text-transform: none;
    letter-spacing: 0;
    color: #9ec5fe;
    font-weight: 500;
}
.overview { color: #c9d3de; line-height: 1.5; max-width: 42rem; }

.channel-logos {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin: 1.1rem 0 .35rem;
}
.channel-logo-card {
    width: 72px;
    height: 72px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.06);
    display: grid;
    place-items: center;
    padding: .45rem;
}
.channel-logo-card img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.showtimes {
    list-style: none;
    padding: 0;
    margin: 1.25rem 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
}
.showtimes li {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .4rem .85rem .4rem .45rem;
    background: rgba(255,255,255,.03);
}
.channel-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 6px;
    background: rgba(255,255,255,.08);
    flex-shrink: 0;
}
.showtimes strong { margin-right: .15rem; }
.showtimes span { color: var(--muted); font-size: .9rem; }

@keyframes live-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .55); }
    70% { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.showtimes li.is-live {
    border-color: #e11d48;
    background: rgba(225, 29, 72, .22);
}
.live-dot {
    display: inline-block;
    width: .4rem;
    height: .4rem;
    border-radius: 50%;
    background: #ff4d4d;
    margin-right: .35rem;
    vertical-align: middle;
}
.live-label {
    font-style: normal !important;
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #fda4af;
    margin-right: .45rem;
}

.nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: rgba(0,0,0,.45);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}
.nav.prev { left: .75rem; }
.nav.next { right: .75rem; }
.nav:hover { background: rgba(0,0,0,.7); }

.dots {
    display: flex;
    justify-content: center;
    gap: .45rem;
    padding: 0 1rem 1.25rem;
}
.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 0;
    background: rgba(255,255,255,.25);
    cursor: pointer;
    padding: 0;
}
.dot.is-active { background: var(--accent); }

.cast-line {
    color: #c9d3de;
    font-size: .95rem;
    margin: .75rem 0 0;
    max-width: 42rem;
    line-height: 1.45;
}
.cast-line strong { color: var(--text); }

.schedule-section {
    margin-top: 3rem;
}
.schedule-section h2 {
    margin: 0 0 .35rem;
    font-size: 1.6rem;
}
.schedule-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .85rem 1rem;
    margin: 1.1rem 0 0;
    align-items: end;
}
.schedule-filters label {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    margin: 0;
}
.schedule-filters label span {
    color: var(--muted);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.schedule-filters input[type="search"] {
    width: 100%;
    padding: .65rem .8rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(8,10,14,.65);
    color: var(--text);
    font: inherit;
}
.schedule-filters input[type="search"]::placeholder {
    color: rgba(154,168,184,.7);
}
.schedule-filters input[type="search"]:focus {
    outline: 1px solid rgba(232,184,74,.55);
    border-color: rgba(232,184,74,.45);
}
.schedule-filters .filter-count {
    grid-column: 1 / -1;
    margin: 0;
    font-size: .9rem;
}
.schedule-empty-filter {
    margin: 0;
    padding: 1.25rem 1rem;
    text-align: center;
}
@media (max-width: 720px) {
    .schedule-filters {
        grid-template-columns: 1fr;
    }
}
.schedule-wrap {
    margin-top: 1.25rem;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(8,10,14,.45);
}
.schedule-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}
.schedule-table th,
.schedule-table td {
    text-align: left;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.schedule-table th {
    color: var(--muted);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    background: rgba(0,0,0,.25);
    position: sticky;
    top: 0;
}
.schedule-table tbody tr {
    cursor: pointer;
    transition: background .15s ease;
}
.schedule-table tbody tr.no-tmdb {
    cursor: default;
}
.schedule-table tbody tr:hover {
    background: rgba(255,255,255,.04);
}
.schedule-table tbody tr.no-tmdb:hover {
    background: transparent;
}
.schedule-table tbody tr.is-live {
    background: rgba(225, 29, 72, .08);
}
.col-channel {
    min-width: 160px;
    white-space: nowrap;
}
.col-channel .table-logo {
    display: inline-block;
    vertical-align: middle;
    margin-right: .65rem;
}
.col-channel span {
    vertical-align: middle;
}
.table-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 8px;
    background: rgba(255,255,255,.06);
}
.col-time {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.col-time.is-live-time {
    background: rgba(225, 29, 72, .28);
    color: #fecdd3;
    font-weight: 700;
    border-radius: 8px;
}

.modal[hidden] { display: none !important; }
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 1rem;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.72);
}
.modal-dialog {
    position: relative;
    z-index: 1;
    width: min(960px, 100%);
    max-height: min(90vh, 900px);
    overflow: auto;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: #121820;
    box-shadow: 0 24px 80px rgba(0,0,0,.55);
}
.modal-close {
    position: absolute;
    top: .6rem;
    right: .8rem;
    z-index: 2;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(0,0,0,.45);
    color: #fff;
    font-size: 1.6rem;
    cursor: pointer;
}
.modal-body {
    display: grid;
    grid-template-columns: minmax(160px, 240px) 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
}
.modal-poster img {
    width: 100%;
    border-radius: 12px;
    aspect-ratio: 2/3;
    object-fit: cover;
    background: #1a222c;
}
.modal-top {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}
.modal-showtimes {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin: 1rem 0;
}
.modal-showtimes .chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem .75rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.03);
    font-size: .9rem;
}
.modal-showtimes .chip.is-live {
    border-color: #e11d48;
    background: rgba(225, 29, 72, .18);
}
.modal-showtimes .chip img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    border-radius: 4px;
}
.modal-cast h3 {
    margin: 1rem 0 .75rem;
    font-size: 1rem;
}
.cast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: .75rem;
}
.cast-card {
    text-align: center;
}
.cast-card img,
.cast-card .cast-fallback {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: 10px;
    background: #1a222c;
    margin-bottom: .4rem;
}
.cast-fallback {
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: .75rem;
}
.cast-card strong {
    display: block;
    font-size: .82rem;
}
.cast-card span {
    display: block;
    color: var(--muted);
    font-size: .72rem;
}

.slide[data-open-program] { cursor: pointer; }

@media (max-width: 720px) {
    .slide { grid-template-columns: 1fr; }
    .poster { max-width: 220px; }
    .modal-body { grid-template-columns: 1fr; }
    .modal-poster { max-width: 200px; }
}
