:root {
    --bg: #f7f6f3;
    --surface: #ffffff;
    --ink: #0b1c2c;
    --muted: #5c6b7a;
    --line: #e6e3dc;
    --accent: #1a5f8f;
    --live: #1f6f6a;
    --live-soft: #eef6f5;
    --focus: #1a5f8f;
    --radius: 10px;
    --header-h: 84px;
    --wrap: 1120px;
    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono-num: ui-sans-serif, system-ui, "Segoe UI", Roboto, Arial, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.45;
    font-size: 15px;
}

a {
    color: var(--accent);
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    left: 0.75rem;
    top: 0.75rem;
    transform: translateY(-160%);
    background: var(--ink);
    color: #fff;
    padding: 0.5rem 0.75rem;
    z-index: 20;
    border-radius: 6px;
}

.skip-link:focus {
    transform: none;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
}

.header-inner {
    width: min(var(--wrap), calc(100% - 1.25rem));
    margin: 0 auto;
    padding: 0.3rem 0 0.35rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    align-self: flex-start;
    text-decoration: none;
    line-height: 0;
}

.brand img {
    display: block;
    width: 72px;
    height: auto;
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.1rem;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.site-nav::-webkit-scrollbar {
    display: none;
}

.site-nav a {
    flex: 0 0 auto;
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.78rem;
    padding: 0.38rem 0.42rem;
    border-radius: 999px;
    white-space: nowrap;
    line-height: 1.15;
}

.site-nav a[aria-current="page"] {
    color: var(--accent);
    background: rgba(26, 95, 143, 0.08);
}

.site-nav a.nav-secondary {
    color: var(--muted);
    font-weight: 500;
}

.wrap {
    width: min(var(--wrap), calc(100% - 1.5rem));
    margin: 0 auto 2rem;
}

.page-head {
    padding: 0.75rem 0 0.55rem;
}

.page-head-compact {
    padding: 0.65rem 0 0.4rem;
}

.page-head h1 {
    margin: 0;
    font-size: clamp(1.4rem, 4vw, 1.85rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-weight: 700;
    text-align: left;
}

.page-meta,
.updated {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.8rem;
    text-align: left;
}

.page-meta time,
.updated time {
    font-variant-numeric: tabular-nums;
}

.lede {
    margin: 0.45rem 0 0;
    max-width: 40rem;
    color: var(--muted);
    font-size: 0.95rem;
    text-align: left;
}

.lede-compact {
    margin-top: 0.3rem;
    font-size: 0.86rem;
}

.section-heading {
    font-size: 1rem;
    font-weight: 650;
    margin: 0 0 0.75rem;
    text-align: left;
    color: var(--muted);
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    font-size: 0.88rem;
    margin: 0.85rem 0 0.35rem;
    color: var(--muted);
}

.breadcrumb a {
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.guide-toolbar {
    margin: 0 0 0.65rem;
}

.filter-row {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.filter-field {
    position: relative;
    display: block;
    flex: 1 1 auto;
    min-width: 0;
}

.filter-icon {
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    color: var(--muted);
    pointer-events: none;
}

.filter-input {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0.55rem 0.7rem 0.55rem 2.15rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.9rem;
}

.filter-input::placeholder {
    color: #8a97a5;
}

.filter-reset,
.filter-reset-inline {
    flex: 0 0 auto;
    margin: 0;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--accent);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 650;
    cursor: pointer;
}

.filter-reset-inline {
    display: inline;
    padding: 0;
    border: 0;
    background: transparent;
    text-decoration: underline;
}

.filter-empty {
    margin: 0.45rem 0 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.tv-schedule {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
}

.channel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.65rem 0.75rem 0.7rem;
    min-width: 0;
}

.channel.is-filtered-out {
    display: none;
}

.channel-head,
.channel-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
}

.channel-page-head {
    margin: 0 0 0.35rem;
}

.channel-page-head .channel-page-number {
    margin-left: auto;
}

.channel-identity {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.channel-identity .channel-ch {
    margin-left: auto;
}

.channel-identity:hover .channel-ch {
    border-color: var(--accent);
    color: var(--accent);
}

.logo-canale {
    width: 72px;
    height: 28px;
    object-fit: contain;
    object-position: left center;
    flex: 0 0 auto;
}

.channel-label {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 650;
    text-align: right;
    min-width: 0;
}

.channel-label a {
    color: var(--ink);
    text-decoration: none;
}

.channel-label a:hover,
.back-link a:hover {
    text-decoration: underline;
}

.channel-ch,
.channel-page-number {
    display: inline-block;
    margin: 0;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.05rem 0.42rem;
    font-size: 0.74rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    background: transparent;
}

.channel-programs {
    margin-top: 0.4rem;
}

.program-slot + .program-slot {
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--line);
}

.program {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    min-width: 0;
}

.program-live {
    margin: 0;
    padding: 0.4rem 0.5rem 0.45rem 0.55rem;
    border-radius: 8px;
    border-left: 3px solid var(--live);
    background: var(--live-soft);
}

.program-feature {
    margin: 0;
    padding: 0.4rem 0.5rem 0.45rem 0.55rem;
    border-radius: 8px;
    border-left: 3px solid var(--accent);
    background: rgba(26, 95, 143, 0.06);
}

.program-secondary .title {
    font-size: 0.95rem;
    font-weight: 600;
}

.program-secondary .program-meta,
.program-secondary .program-details summary {
    font-size: 0.78rem;
}

.program-times {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.3rem;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 650;
}

.time-sep {
    color: var(--muted);
}

.live-badge,
.feature-badge,
.past-badge {
    display: inline-block;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.live-badge {
    color: var(--live);
}

.feature-badge {
    color: var(--accent);
}

.past-badge {
    color: var(--muted);
}

.program-past {
    opacity: 0.72;
}

.program-past .title {
    font-weight: 600;
}

.film-item.is-past {
    opacity: 0.78;
}

.title {
    display: block;
    margin: 0.12rem 0 0;
    font-weight: 700;
    color: var(--ink);
    font-size: 1.02rem;
    line-height: 1.28;
    overflow-wrap: anywhere;
}

.program-live .title,
.program-feature .title {
    font-size: 1.06rem;
}

.program-meta {
    margin: 0.2rem 0 0;
    font-size: 0.76rem;
    color: var(--muted);
    line-height: 1.35;
}

.programmi-tv-progress {
    background: #d9e4e2;
    height: 2px;
    margin-top: 0.35rem;
    border-radius: 99px;
    overflow: hidden;
}

.programmi-tv-progress-in {
    background: var(--live);
    height: 100%;
}

.program-details {
    margin-top: 0.2rem;
}

.program-details summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 600;
    list-style: none;
    display: inline;
}

.program-details summary::-webkit-details-marker,
.program-details summary::marker {
    display: none;
    content: "";
}

.program-details[open] .details-closed,
.program-details:not([open]) .details-open {
    display: none;
}

.program-details p {
    margin: 0.3rem 0 0;
    color: var(--ink);
    font-size: 0.88rem;
}

.channel-more,
.back-link {
    margin: 0.4rem 0 0;
    font-size: 0.84rem;
}

.channel-more a {
    color: var(--muted);
    text-decoration: none;
    border-bottom: 1px solid var(--line);
}

.channel-more a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.load-next-program {
    display: block;
    width: 100%;
    margin-top: 0.55rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    color: var(--accent);
    font: inherit;
    font-weight: 650;
    font-size: 0.9rem;
    cursor: pointer;
}

.load-next-program[hidden],
.load-next-program.is-exhausted {
    display: none !important;
}

.load-next-program:hover,
.load-next-program:focus-visible {
    border-color: var(--accent);
    background: rgba(26, 95, 143, 0.04);
}

.program-just-shown {
    animation: programReveal 0.28s ease;
}

@keyframes programReveal {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .program-just-shown {
        animation: none;
    }
}

.day-schedule {
    list-style: none;
    margin: 0;
    padding: 0;
    max-width: 44rem;
}

.channel-page {
    max-width: 42rem;
}

.channel-page-intro .channel-page-head {
    margin-bottom: 0.55rem;
}

.channel-page-intro .logo-canale {
    width: 104px;
    height: 40px;
}

.timeline-tools {
    position: sticky;
    top: var(--header-h);
    z-index: 30;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0 0 0.85rem;
    padding: 0.4rem 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
}

.timeline-jump {
    display: inline-flex;
    align-items: center;
    min-height: 2.25rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--accent);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 650;
}

.timeline-jump:hover {
    border-color: var(--accent);
}

.timeline-jump-now {
    border-color: rgba(31, 111, 106, 0.35);
    color: var(--live);
}

.timeline-jump.is-disabled {
    color: var(--muted);
    cursor: not-allowed;
    opacity: 0.65;
}

.timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 1px solid var(--line);
}

.timeline-item {
    display: grid;
    grid-template-columns: 4.25rem minmax(0, 1fr);
    gap: 0.65rem 0.75rem;
    margin: 0;
    padding: 0.55rem 0 0.55rem 0.85rem;
    position: relative;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -0.28rem;
    top: 0.95rem;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--line);
    border: 2px solid var(--bg);
}

.timeline-item.is-now {
    margin: 0.25rem 0 0.25rem -0.15rem;
    padding: 0.7rem 0.7rem 0.75rem 1rem;
    border-radius: 10px;
    background: var(--live-soft);
    border: 1px solid #d7e8e6;
}

.timeline-item.is-now::before {
    left: 0.05rem;
    background: var(--live);
    border-color: var(--live-soft);
}

.timeline-item.is-past {
    opacity: 0.72;
}

.timeline-item.is-past .timeline-title {
    font-weight: 600;
}

.timeline-time {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    font-variant-numeric: tabular-nums;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.25;
}

.timeline-time-end {
    font-size: 0.75rem;
    font-weight: 550;
    color: var(--muted);
}

.timeline-body {
    min-width: 0;
}

.timeline-status {
    margin: 0 0 0.15rem;
}

.timeline-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.timeline-item.is-now .timeline-title {
    font-size: 1.08rem;
}

.timeline-item .programmi-tv-progress {
    margin-top: 0.4rem;
}

.timeline-item .program-meta {
    margin-top: 0.25rem;
}


@media (min-width: 640px) {
    .timeline-item {
        grid-template-columns: 5rem minmax(0, 1fr);
        gap: 0.75rem 1rem;
        padding-left: 1rem;
    }

    .timeline-title {
        font-size: 1.05rem;
    }
}

.film-schedule {
    max-width: none;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
}

.film-item {
    list-style: none;
    margin: 0;
}

.film-note {
    margin: 0 0 0.65rem;
    font-size: 0.84rem;
    color: var(--muted);
}

@media (min-width: 640px) {
    .film-schedule {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }
}

@media (min-width: 960px) {
    .film-schedule {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.faq {
    margin: 2rem 0 0;
    max-width: 40rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
}

.faq h2 {
    text-align: left;
    font-size: 1.15rem;
    margin: 0 0 0.5rem;
}

.faq dt {
    font-weight: 650;
    margin-top: 0.9rem;
}

.faq dd {
    margin: 0.2rem 0 0;
    color: var(--muted);
}

.empty {
    color: var(--muted);
}

.site-footer {
    border-top: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    padding: 1.25rem 0 1.75rem;
}

.footer-inner {
    width: min(var(--wrap), calc(100% - 1.5rem));
    margin: 0 auto;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.9rem;
    margin: 0 0 0.85rem;
}

.footer-nav a {
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.footer-nav a:hover {
    text-decoration: underline;
}

.site-footer p {
    margin: 0.2rem 0;
    font-size: 0.88rem;
}

.site-footer a {
    color: var(--accent);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (min-width: 375px) {
    .site-nav a {
        font-size: 0.8rem;
        padding: 0.38rem 0.46rem;
    }
}

@media (min-width: 640px) {
    :root {
        --header-h: 64px;
    }

    .header-inner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 0.35rem 0;
        min-height: var(--header-h);
    }

    .brand img {
        width: 112px;
    }

    .site-nav {
        width: auto;
        flex: 1 1 auto;
        justify-content: flex-end;
        overflow: visible;
    }

    .site-nav a {
        font-size: 0.9rem;
        padding: 0.42rem 0.55rem;
    }

    .tv-schedule {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }
}

@media (min-width: 960px) {
    :root {
        --header-h: 68px;
    }

    .header-inner {
        gap: 1.25rem;
    }

    .brand img {
        width: 128px;
    }

    .site-nav a {
        font-size: 0.92rem;
        padding: 0.45rem 0.65rem;
    }

    .tv-schedule {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .title {
        font-size: 1.05rem;
    }
}
