/* ===== from main.css lines 5416-5770 ===== */
    /* ---------- Responsive ---------- */
    @media (max-width: 980px) {
      .layout { flex-direction: column; gap: 20px; }
      .results-panel { width: 100%; max-width: 100%; flex-basis: auto; }
      .results-panel.hidden { width: 0; }
      .wireframe-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      /* .tmdb-row* : grid responsive via variables CSS (auto-fill) */
      .episode-grid { gap: 16px; padding-bottom: 12px; }
      .episodes-shell .episode-card { flex-basis: 260px; width: 260px; }
      .hero { padding-top: calc(env(safe-area-inset-top, 0px) + 24px); padding-bottom: 24px; }
      .hero-top { margin-bottom: 32px; }
    }

    @media (max-width: 720px) {
      .shell { width: min(100% - 20px, 1240px); margin-top: 24px; }
      .panel { padding: 18px 28px; border-radius: 14px; }
      .results-panel.panel { padding: 0; }
      .search-button { min-width: 44px; min-height: 44px; }
      .detail-hero-content { --detail-hero-pad-inline-start: 30px; --detail-hero-pad-inline-end: 30px; padding-top: 18px; padding-bottom: 60px; }
      .detail-overview.expanded { max-height: clamp(8.5rem, 28vh, 15rem); }
      .episode-grid { gap: 14px; }
      .episodes-shell .episode-card { flex-basis: 240px; width: 240px; }
    }

    @media (max-width: 560px) {
      .wireframe-row { grid-template-columns: 1fr; }
      /* .tmdb-row* : grid responsive via variables CSS (auto-fill) */
      .episode-grid { gap: 12px; }
      .episodes-shell .episode-card { flex-basis: 220px; width: 220px; }
      /* .results : grid responsive via variables CSS (auto-fill) -- plus d'override mobile necessaire */
    }

    /* ========================================================
       Responsive refinements (additive, ne touche pas le desktop >=1280px)
       ======================================================== */

    /* ----- <=1240px : raccord hero/featured ----- */
    @media (max-width: 1240px) {
      .featured-meta {
        padding-left: 24px;
        padding-right: 24px;
      }
    }

    /* ----- <=1100px : search-form du header commence a retrecir ----- */
    @media (max-width: 1100px) {
      body.home-mode.has-home-sections .search-form,
      body:not(.home-mode):not(.watchlist-mode) .search-form {
        max-width: 396px;
      }
    }

    /* ----- <=900px : search-form collapse en pill dans le header (home-mode + explorer) -----
       Layout grille a 4 colonnes (back | logo | search | actions). La barre
       collapse a 44px en col 3 ; en focus elle passe en ligne 2 pleine largeur
       sans deplacer les autres elements. */
    @media (max-width: 900px) {
      body.home-mode.has-home-sections .hero-top,
      body:not(.home-mode) .hero-top {
        display: grid;
        grid-template-columns: auto auto 1fr auto;
        grid-template-rows: auto auto;
        align-items: center;
        column-gap: 0;
        row-gap: 0;
      }
      body.home-mode.has-home-sections .brand-back,
      body:not(.home-mode) .brand-back {
        grid-column: 1;
        grid-row: 1;
        margin-right: 10px;
      }
      body.home-mode.has-home-sections .brand-logo,
      body:not(.home-mode) .brand-logo { grid-column: 2; grid-row: 1; }
      body.home-mode.has-home-sections .hero-actions,
      body:not(.home-mode) .hero-actions {
        grid-column: 4;
        grid-row: 1;
        margin-left: 10px;
      }
      body.home-mode.has-home-sections .search-form,
      body:not(.home-mode) .search-form {
        grid-column: 3;
        grid-row: 1;
        justify-self: end;
        justify-content: center;
        flex: 0 0 auto;
        max-width: none;
        min-width: 0;
        width: 53px;
        padding: 3px;
        gap: 0;
        overflow: hidden;
        margin: 0;
        transition: width 280ms cubic-bezier(0.4, 0, 0.2, 1),
                    padding 280ms cubic-bezier(0.4, 0, 0.2, 1),
                    background 0.2s ease;
      }
      body.home-mode.has-home-sections .search-form:focus-within,
      body:not(.home-mode) .search-form:focus-within {
        justify-content: flex-start;
      }
      body.home-mode.has-home-sections .search-form:focus-within,
      body:not(.home-mode) .search-form:focus-within {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: stretch;
        width: 100%;
        padding: 5px 7px 5px 20px;
        margin-top: 10px;
      }
      body.home-mode.has-home-sections .search-form .search-input,
      body:not(.home-mode) .search-form .search-input {
        padding: 8px 0;
        flex: 0 0 0;
        width: 0;
        min-width: 0;
        opacity: 0;
        transition: opacity 180ms ease, flex-basis 280ms cubic-bezier(0.4, 0, 0.2, 1);
      }
      body.home-mode.has-home-sections .search-form:focus-within .search-input,
      body:not(.home-mode) .search-form:focus-within .search-input {
        flex: 1 1 auto;
        width: auto;
        opacity: 1;
      }
      body.home-mode.has-home-sections .search-form .search-button,
      body:not(.home-mode) .search-form .search-button {
        min-width: 44px;
        min-height: 44px;
        flex: 0 0 44px;
      }
      /* Onboarding : pas de boutons actions à droite → garder la search étendue */
      body.interest-onboarding .hero-top {
        display: flex;
        flex-wrap: nowrap;
        gap: 10px;
      }
      body.interest-onboarding .search-form {
        grid-column: auto;
        grid-row: auto;
        justify-self: stretch;
        width: auto;
        flex: 1 1 auto;
        max-width: none;
        padding: 5px 7px 5px 20px;
        gap: 8px;
        margin: 0;
      }
      body.interest-onboarding .search-form .search-input {
        opacity: 1;
        padding: 8px 0;
        /* Override the collapse rule (line ~115) so the input takes full
           remaining width in interest-onboarding mode — the search button
           naturally sits to its right thanks to flex order. */
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
      }
      body.interest-onboarding .search-form .search-button {
        /* Anchor the magnifier button to the right edge of the bar. */
        margin-left: auto;
        flex: 0 0 auto;
      }
    }

    /* ----- <=1024px : tablette ----- */
    @media (max-width: 1024px) {
      html, body { overflow-x: hidden; }
      .shell { margin: 28px auto 48px; }
      .hero { padding-top: calc(env(safe-area-inset-top, 0px) + 28px); padding-bottom: 24px; }
      .hero-top { gap: 10px; flex-wrap: wrap; }
      .featured-hero { height: 60vh; min-height: 28rem; max-height: none; }
      body.home-mode.has-featured-hero {
        --featured-home-overlap: clamp(112px, 16vh, 168px);
      }
      /* Tablette ≤1024 : chevauchement visible, harmonisé avec le desktop. */
      body.home-mode.has-featured-hero #continueWatching:not([hidden]),
      body.home-mode.has-featured-hero #continueWatching[hidden] + #watchlistAll + #watchlistFolders + #homeRecommendations.visible,
      body.home-mode.has-featured-hero #continueWatching[hidden] + #watchlistAll + #watchlistFolders + #homeRecommendations:not(.visible) + #watchlistHistory + #explorerHeader {
        margin-top: calc(max(28rem, 60vh) - var(--featured-home-overlap));
      }
      body.watchlist-mode.has-featured-hero #continueWatching:not([hidden]),
      body.watchlist-mode.has-featured-hero #continueWatching[hidden] + #watchlistAll:not([hidden]),
      body.watchlist-mode.has-featured-hero #continueWatching[hidden] + #watchlistAll[hidden] + #watchlistFolders:not([hidden]) {
        margin-top: calc(max(28rem, 60vh) - 8px);
      }
      .featured-meta { padding: 0 20px 56px 36px; gap: 12px; }
      .featured-meta > * { max-width: 100%; }
      .featured-overview-wrap { max-width: 560px; }
      .featured-overview { max-width: 560px; }
      .featured-logo { max-width: 18rem; }
      .featured-nav { width: 50px; height: 50px; font-size: 2.09rem; }
      #featuredPrev { left: 12px; }
      #featuredNext { right: 12px; }
      .featured-controls { bottom: 20px; }
      .detail-hero-content { --detail-hero-pad-inline-start: 22px; --detail-hero-pad-inline-end: 22px; padding-top: 22px; padding-bottom: 60px; }
      .player-media { --player-vspace: 140px; }
      .player-idle-overlay { max-width: 70%; }
      .card-menu-popover { max-width: calc(100vw - 24px); }
    }

    /* ----- <=768px : mobile large / pliure tablette -> mobile ----- */
    @media (max-width: 768px) {
      .hero { padding-top: calc(env(safe-area-inset-top, 0px) + 24px); padding-bottom: 20px; }
      /* Logo sizing on mobile is handled by the @media (max-width: 900px)
         rule above (fixed 44×44 round). Keep this breakpoint only for the
         hero padding. */
      .hero-actions { gap: 6px; }
      .watchlist-toggle-label { display: none; }
      .watchlist-toggle {
        padding: 0;
        width: 53px;
        min-width: 53px;
        height: 53px;
        min-height: 53px;
        justify-content: center;
        gap: 0;
        aspect-ratio: 1 / 1;
      }
      .featured-hero { height: min(85vh, 44rem); min-height: 32rem; }
      body.home-mode.has-featured-hero {
        --featured-home-overlap: clamp(124px, 18vh, 168px);
      }
      /* Mobile : chevauchement visible, limité pour garder les sections lisibles. */
      body.home-mode.has-featured-hero #continueWatching:not([hidden]),
      body.home-mode.has-featured-hero #continueWatching[hidden] + #watchlistAll + #watchlistFolders + #homeRecommendations.visible,
      body.home-mode.has-featured-hero #continueWatching[hidden] + #watchlistAll + #watchlistFolders + #homeRecommendations:not(.visible) + #watchlistHistory + #explorerHeader {
        margin-top: calc(max(32rem, min(85vh, 44rem)) - var(--featured-home-overlap));
      }
      body.watchlist-mode.has-featured-hero #continueWatching:not([hidden]),
      body.watchlist-mode.has-featured-hero #continueWatching[hidden] + #watchlistAll:not([hidden]),
      body.watchlist-mode.has-featured-hero #continueWatching[hidden] + #watchlistAll[hidden] + #watchlistFolders:not([hidden]) {
        margin-top: calc(max(32rem, min(85vh, 44rem)) - 8px);
      }
      .featured-meta { padding: 0 16px 36px 30px; gap: 12px; }
      .featured-meta > * { max-width: 100%; }
      .featured-overview-wrap { width: 100%; max-width: none; }
      .featured-overview { max-width: none; font-size: var(--fs-md); }
      .featured-slide.is-overview-expanded .featured-overview {
        max-height: clamp(8.5rem, 28vh, 16rem);
      }
      .featured-badges { font-size: var(--fs-sm); gap: 8px; }
      .featured-badge { padding: 6px 14px; }
      .featured-logo { max-width: 18rem; max-height: 22vh; object-position: left center; }
      .featured-actions { gap: 12px; }
      .featured-btn { padding: 13px 26px; font-size: var(--fs-lg); }
      .featured-dots { gap: 12px; }
      .featured-dot { width: 12px; height: 12px; }
      .featured-progress-group { width: auto; max-width: 100%; }
      .featured-nav {
        width: 44px;
        height: 44px;
        font-size: 1.76rem;
        padding-bottom: 2px;
      }
      #featuredPrev { left: 8px; }
      #featuredNext { right: 8px; }
      .featured-controls { bottom: 8px; }
      body.watchlist-mode .featured-hero .featured-logo { object-position: center center; }
      .poster { max-width: 220px; margin-left: auto; margin-right: auto; }
      #detail #playerShell {
        display: none !important;
      }
      #detail .detail-watchlist-bar {
        gap: 10px;
        margin-bottom: 18px;
      }
      #detail .detail-mobile-play-btn {
        display: inline-flex;
      }
      #detail .detail-watchlist-btn {
        padding: 0 16px;
        border: 1.5px solid var(--header-control-border);
        background: rgba(255, 255, 255, 0.12);
        -webkit-backdrop-filter: blur(14px) saturate(1.6) brightness(0.78);
        backdrop-filter: blur(14px) saturate(1.6) brightness(0.78);
        color: #fff;
        font-weight: 600;
        transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
      }
      #detail .detail-watchlist-btn:hover,
      #detail .detail-watchlist-btn:focus-visible {
        background: rgba(255, 255, 255, 0.24);
        border-color: var(--header-control-border-hover);
        color: #fff;
        transform: none;
        outline: none;
      }
      #detail .detail-watchlist-btn.active {
        border-color: rgba(var(--accent-rgb), 0.75);
        background: rgba(var(--accent-rgb), 0.22);
        color: #fff;
      }
      #detail .detail-watchlist-btn.active:hover,
      #detail .detail-watchlist-btn.active:focus-visible {
        background: rgba(var(--accent-rgb), 0.32);
        border-color: rgba(var(--accent-hover-rgb), 0.9);
      }
      .episode-grid { scroll-padding-inline: 16px; }
      .season-select { width: 100%; }
      .results-sort .season-select { width: auto; }
      .rating-badge, .unavailable-badge { font-size: var(--fs-2xs); }
      .settings-panel {
        width: min(320px, calc(100vw - 24px));
        max-height: min(360px, calc(100dvh - 120px));
        padding: 18px 20px;
        gap: 10px;
      }
      .mark-watched-modal .content { width: calc(100vw - 32px); max-width: 420px; }
      .input-modal-content { width: calc(100vw - 32px); max-width: 420px; }
      .player-idle-overlay {
        max-width: 100%;
        padding: 16px;
        box-sizing: border-box;
        overflow: hidden;
        background: linear-gradient(0deg, rgba(0,0,0,0.85), rgba(0,0,0,0.2));
      }
      .player-idle-overlay .player-idle-meta {
        max-width: 92%;
        gap: 8px;
      }
      .player-idle-overlay .featured-overview {
        -webkit-line-clamp: 2;
        line-clamp: 2;
      }
      .player-idle-overlay .featured-logo {
        max-width: 10rem;
        max-height: 12vh;
      }
      .player-media { --player-vspace: 0px; }
      .home-section-title { font-size: 1.1rem; margin-bottom: 14px; }
      .home-section-header { margin-bottom: 14px; }
      .home-section, .watchlist-section, .continue-watching { margin-bottom: 24px; }
      .home-row,
      .continue-watching-row { padding: 10px 8px 14px; }
      .home-tabs {
        padding: 0 16px 14px;
        margin-bottom: 14px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
      }
      .home-tabs::-webkit-scrollbar { display: none; }
      .section-grid-view { padding: 0 16px 64px; }
      .section-grid-view-topbar { margin: 0 -16px; padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px; }
      .section-grid-view-head { margin: 0 -16px 16px; padding: 14px 16px 12px; }
    }

    /* ----- <=560px : mobile standard ----- */
    @media (max-width: 560px) {
      /* Padding horizontal sur la page show ; hero reste full-bleed via margin négative */
      #detail { padding-left: 8px; padding-right: 8px; }
      #detail > .detail-hero { margin-left: -8px; margin-right: -8px; }
      .hero { padding-top: calc(env(safe-area-inset-top, 0px) + 20px); padding-bottom: 18px; }
      .hero-top { margin-bottom: 20px; }
      .results-controls { gap: 10px; }
      .results-filters { gap: 6px; width: 100%; }
      .results-sort { width: 100%; justify-content: flex-start; }
      .results-sort .season-select { flex: 0 1 auto; }
      .filter-chip { font-size: var(--fs-xs); padding: 5px 10px; }
      .home-section-title { font-size: var(--fs-md); margin-bottom: 12px; }
      .home-section-header { margin-bottom: 12px; gap: 8px; }
      .home-section, .watchlist-section, .continue-watching { margin-bottom: 20px; }
      .home-row,
      .continue-watching-row { gap: 12px; padding: 8px 8px 12px; }
      .home-tabs { margin-bottom: 12px; padding: 0 14px 12px; }
      .home-row .show-card,
      .continue-watching-row .show-card { --card-w: 155px; }
      .detail-hero-content { --detail-hero-pad-inline-start: 24px; --detail-hero-pad-inline-end: 24px; padding-top: 16px; padding-bottom: 56px; }
      .detail-overview.expanded { max-height: clamp(7rem, 24vh, 12rem); }
      .episode-title { font-size: var(--fs-sm); }
      .episode-overview {
        -webkit-line-clamp: 2;
        line-clamp: 2;
      }
      .featured-btn { padding: 13px 22px; font-size: var(--fs-md); }
      .featured-actions { gap: 10px; }
      .featured-logo { max-width: 14rem; max-height: 18vh; }
      .featured-meta { padding: 0 14px 28px 26px; gap: 10px; }
      .featured-overview-wrap { max-width: none; }
      .featured-overview { font-size: var(--fs-base); -webkit-line-clamp: 2; line-clamp: 2; }
      .featured-slide.is-overview-expanded .featured-overview {
        max-height: clamp(7rem, 24vh, 13rem);
      }
      .featured-title { line-height: 1.1; }
      .featured-episode { font-size: var(--fs-xs); }
      .featured-controls { bottom: 4px; }
      .featured-dot { width: 6px; height: 6px; }
      .featured-hero { height: min(82vh, 40rem); min-height: 28rem; }
      body.home-mode.has-featured-hero {
        --featured-home-overlap: clamp(116px, 18vh, 156px);
      }
      /* Mobile : chevauchement visible pour réduire l'espace sous le hero. */
      body.home-mode.has-featured-hero #continueWatching:not([hidden]),
      body.home-mode.has-featured-hero #continueWatching[hidden] + #watchlistAll + #watchlistFolders + #homeRecommendations.visible,
      body.home-mode.has-featured-hero #continueWatching[hidden] + #watchlistAll + #watchlistFolders + #homeRecommendations:not(.visible) + #watchlistHistory + #explorerHeader {
        margin-top: calc(max(28rem, min(82vh, 40rem)) - var(--featured-home-overlap));
      }
      body.watchlist-mode.has-featured-hero #continueWatching:not([hidden]),
      body.watchlist-mode.has-featured-hero #continueWatching[hidden] + #watchlistAll:not([hidden]),
      body.watchlist-mode.has-featured-hero #continueWatching[hidden] + #watchlistAll[hidden] + #watchlistFolders:not([hidden]) {
        margin-top: calc(max(28rem, min(82vh, 40rem)) - 4px);
      }
      .home-tab-chip { padding: 8px 16px; font-size: var(--fs-xl); }
      .settings-panel {
        width: min(300px, calc(100vw - 20px));
        max-height: min(320px, calc(100dvh - 110px));
        padding: 16px 18px;
        gap: 10px;
      }
      .settings-panel input { padding: 10px 14px; }
    }

    /* ----- <=380px : petit mobile (iPhone SE / mini) ----- */
    @media (max-width: 380px) {
      #detail { padding-left: 6px; padding-right: 6px; }
      #detail > .detail-hero { margin-left: -6px; margin-right: -6px; }
      .shell { width: calc(100% - 12px); }
      .hero { padding-top: calc(env(safe-area-inset-top, 0px) + 16px); padding-bottom: 14px; }
      .icon-button { min-width: 48px; min-height: 48px; width: 48px; height: 48px; }
      .watchlist-toggle { min-width: 48px; min-height: 48px; }
      .search-form { min-height: 48px; }
      body.home-mode.has-home-sections .search-form,
      body:not(.home-mode) .search-form { width: 48px; }
      .home-row .show-card,
      .continue-watching-row .show-card { --card-w: 144px; }
      .episodes-shell .episode-card { flex-basis: 200px; width: 200px; }
      .featured-actions .featured-btn { flex: 1 1 auto; justify-content: center; }
      .detail-hero-content { --detail-hero-pad-inline-start: 20px; --detail-hero-pad-inline-end: 20px; padding-top: 14px; padding-bottom: 48px; }
      .detail-overview.expanded { max-height: clamp(6.5rem, 22vh, 10rem); }
      .settings-panel { padding: 14px 16px; gap: 10px; border-radius: 14px; max-height: min(300px, calc(100dvh - 100px)); }
      .settings-panel input {
        min-height: var(--control-pill-height);
        padding: 0 12px;
        font-size: var(--fs-sm);
      }
      .settings-key-field > input { padding-right: 44px; }
      .settings-save,
      .settings-clear,
      .settings-secondary {
        min-height: var(--control-pill-height);
        padding: 0 16px;
        font-size: var(--fs-sm);
      }
    }

    /* ----- Mobile landscape ----- */
    @media (orientation: landscape) and (max-height: 500px) {
      .featured-hero { height: 100vh; min-height: 0; max-height: none; }
      body.home-mode.has-featured-hero {
        --featured-home-overlap: 76px;
      }
      /* Mobile landscape : léger rapprochement sans masquer les contrôles du hero. */
      body.home-mode.has-featured-hero #continueWatching:not([hidden]),
      body.home-mode.has-featured-hero #continueWatching[hidden] + #watchlistAll + #watchlistFolders + #homeRecommendations.visible,
      body.home-mode.has-featured-hero #continueWatching[hidden] + #watchlistAll + #watchlistFolders + #homeRecommendations:not(.visible) + #watchlistHistory + #explorerHeader {
        margin-top: calc(100vh - var(--featured-home-overlap));
      }
      body.watchlist-mode.has-featured-hero #continueWatching:not([hidden]),
      body.watchlist-mode.has-featured-hero #continueWatching[hidden] + #watchlistAll:not([hidden]),
      body.watchlist-mode.has-featured-hero #continueWatching[hidden] + #watchlistAll[hidden] + #watchlistFolders:not([hidden]) {
        margin-top: 100vh;
      }
      .player-media { --player-vspace: 0px; }
      .hero { padding-top: 12px; padding-bottom: 12px; }
      .hero-top { margin-bottom: 16px; }
      .featured-meta { padding-bottom: 24px; }
      .featured-slide.is-overview-expanded .featured-overview {
        max-height: 34vh;
      }
    }

    /* Search results live under the fixed mobile header.
       Keep this after the broad .hero mobile overrides above: they are
       intentionally page-wide, while the search page needs the header reserve
       to include the collapsed or expanded mobile search bar. */
    @media (max-width: 900px) {
      body:has(#resultsPanel:not(.hidden)) .shell {
        margin-top: 0;
      }

      body:has(#resultsPanel:not(.hidden)) .hero {
        padding-top: var(--floating-header-reserve-compact);
      }

      body:has(#resultsPanel:not(.hidden)):has(.search-form:focus-within) .hero {
        padding-top: var(--floating-header-reserve-expanded);
      }

      body:has(#resultsPanel:not(.hidden)) #status:not(:empty) {
        margin-top: 6px;
      }
    }

    @media (max-width: 380px) {
      :root {
        --floating-header-row-h: 48px;
      }
    }
