/* Reference composition: cinematic home, followed by poster shelves.
   The original mobile styles stay in index.html. */
.desktop-header, .shelf-tabs, .rail-actions { display: none; }
@media (max-width: 420px) {
  .discover-mast { margin-left: -12px; margin-right: -12px; padding-left: 12px; padding-right: 12px; }
  .guest-hero { margin-left: -12px; margin-right: -12px; }
}
@media (min-width: 760px) and (max-width: 1023px) {
  .app-shell { max-width: 920px; padding-left: 24px; padding-right: 24px; }
  .discover-mast { margin-left: -24px; margin-right: -24px; padding-left: 24px; padding-right: 24px; }
  .nav-inner { max-width: 920px; }
  .category-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
  .rank-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  :root { --desktop-gutter: clamp(32px, 4.8vw, 96px); --poster-size: clamp(164px, 14vw, 224px); }
  body { background: var(--bg); }
  .app-shell { width: 100%; max-width: none; margin: 0; padding: 0 0 64px; background: var(--bg); box-shadow: none; }
  .bottom-nav { display: none; }
  .desktop-header {
    display: flex; position: fixed; inset: 0 0 auto; height: 88px; z-index: 40;
    align-items: center; gap: 32px; padding: 0 var(--desktop-gutter);
    background: linear-gradient(180deg, rgba(7,0,13,.9), rgba(7,0,13,.45) 65%, transparent);
    transition: background .2s ease;
    font-family: Poppins, sans-serif;
  }
  .desktop-header.scrolled, body:has(.view.active:not(#discover)) .desktop-header,
  body:has(#guestHeroSection[hidden]) .desktop-header { background: rgba(13,3,21,.97); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); }
  .desktop-logo { display: flex; align-items: center; gap: 10px; padding: 0; background: none; border: 0; cursor: pointer; flex-shrink: 0; font: 500 1.12rem Poppins, sans-serif; }
  .desktop-logo img { width: 38px; height: 38px; border-radius: 11px; }
  .desktop-links, .desktop-tools { display: flex; align-items: center; gap: 25px; }
  .desktop-links > button, .desktop-nav-link, .desktop-categories summary { border: 0; padding: 8px 0; background: none; color: #e3d8e9; cursor: pointer; font: 400 .86rem Poppins, sans-serif; white-space: nowrap; }
  .desktop-links > button { position: relative; }
  .desktop-links > button.active { color: #fff; }
  .desktop-links > button.active::after { content: ""; position: absolute; bottom: 0; left: 0; right: 0; height: 2px; border-radius: 2px; background: var(--brand); }
  .desktop-links button:hover, .desktop-categories summary:hover, .desktop-nav-link:hover { color: var(--brand); }
  .desktop-tools { margin-left: auto; gap: 19px; }
  .desktop-tools .icon-button { padding: 8px; width: 36px; height: 38px; min-width: 36px; background: transparent; border: 0; color: var(--text); font-size: 1.7rem; }
  .desktop-tools svg { width: 23px; height: 23px; }
  .desktop-tools .active { color: var(--brand); }
  .desktop-plans { min-height: 42px; padding: 0 23px; font-size: .82rem; }
  .desktop-categories { position: relative; }
  .desktop-categories summary { list-style: none; }
  .desktop-categories summary::-webkit-details-marker { display: none; }
  .desktop-categories summary span { padding-left: 6px; }
  #desktopGenres { position: absolute; top: 48px; left: -18px; width: 280px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 12px; background: #1c0c27; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 48px #0008; }
  #desktopGenres button { text-align: left; border: 0; background: transparent; border-radius: 8px; padding: 12px; cursor: pointer; font: 400 .82rem Poppins, sans-serif; }
  #desktopGenres button:hover { background: #ffffff09; }
  .desktop-search-panel { position: absolute; top: 78px; right: var(--desktop-gutter); width: 420px; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: #190a24; box-shadow: 0 20px 60px #0009; }
  .desktop-search-panel label { display: block; margin-bottom: 12px; font-size: .84rem; }
  .desktop-search-panel .search { background: #0b0311; padding: 0 16px; border-color: var(--line); box-shadow: none; height: 48px; }
  .desktop-header button:focus-visible, summary:focus-visible, .hero-dot:focus-visible, .hero-controls button:focus-visible, .poster:focus-visible { outline: 2px solid var(--brand); outline-offset: 5px; }
  .test-reset { right: 24px; bottom: 18px; opacity: .65; font-size: .7rem; }
  .test-reset:hover { opacity: 1; }
  .toast { bottom: 30px; }

  .discover-mast { margin: 0; padding: 0; overflow: visible; background: none; }
  .discover-mast > .topbar, .discover-mast > .search-wrap, .discover-mast > .chips { display: none; }
  .guest-hero { position: relative; margin: 0; min-width: 0; }
  .hero-track { gap: 0; border-radius: 0; }
  .hero-slide { height: min(780px, 90svh); min-height: 600px; border-radius: 0; }
  .hero-slide .media-frame { inset: 0; }
  .hero-slide .media-frame img { object-position: center 35%; }
  .hero-slide::after {
    inset: 0;
    background: linear-gradient(90deg, rgba(7,0,13,.95), rgba(7,0,13,.72) 28%, rgba(7,0,13,.14) 65%, rgba(7,0,13,.04)),
                linear-gradient(0deg, var(--bg) 0%, rgba(7,0,13,.76) 9%, transparent 45%);
  }
  .hero-copy { inset: 0 auto 0 0; width: min(59%, 790px); display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: 112px 0 75px var(--desktop-gutter); background: none; }
  .hero-kicker { text-transform: uppercase; letter-spacing: .18em; font-size: .7rem; margin: 0 0 20px; color: #fca4df; }
  .hero-copy h2 { max-width: 100%; font-size: clamp(2.7rem, 4.45vw, 5rem); line-height: 1.1; font-weight: 500; margin: 0 0 22px; letter-spacing: -.04em; text-wrap: balance; }
  .hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 13px; font-size: .98rem; color: #eadcf1; line-height: 1.5; }
  .hero-meta > span + span::before { content: "·"; margin-right: 13px; color: #b4a3bc; }
  .hero-meta .hero-language { font-size: .84rem; color: #c5b7ce; }
  .hero-synopsis { max-width: 515px; margin: 15px 0 28px; font-size: 1.12rem; line-height: 1.5; color: #e5daeb; text-wrap: pretty; }
  .hero-actions { gap: 14px; }
  .hero-actions .primary-btn { min-height: 52px; padding: 0 34px; font-size: .96rem; gap: 11px; display: flex; align-items: center; }
  .hero-actions .primary-btn > span { font-size: .8rem; }
  .hero-actions .hero-save { width: 52px; height: 52px; border-radius: 50%; background: #ffffff18; border: 1px solid #ffffff24; font-size: 2rem; line-height: 1; padding: 0; backdrop-filter: blur(10px); }
  .hero-save[aria-pressed="true"] { color: var(--brand); border-color: var(--brand); }
  .hero-dots { position: absolute; z-index: 3; bottom: 40px; left: 50%; transform: translateX(-50%); margin: 0; align-items: center; gap: 9px; }
  .hero-dot { border: 0; padding: 0; cursor: pointer; width: 8px; height: 8px; background: #ffffff50; }
  .hero-dot.active { width: 27px; background: var(--brand); }
  .hero-controls { position: absolute; z-index: 3; right: var(--desktop-gutter); bottom: 32px; display: flex; gap: 10px; }
  .hero-controls button, .rail-actions .icon-button { width: 38px; height: 38px; min-width: 38px; border: 1px solid #ffffff12; background: #ffffff0b; border-radius: 50%; cursor: pointer; font-size: 1.8rem; line-height: 1; color: var(--text); }
  .hero-controls button:hover, .rail-actions button:not(:disabled):hover { background: #f706a226; border-color: #f706a260; }
  #continueSection { padding: 24px var(--desktop-gutter) 0; }
  .continue-card { max-width: 640px; }
  #discoverSections { padding: 0 var(--desktop-gutter); }
  body:has(#guestHeroSection[hidden]) #discoverSections { padding-top: 108px; }
  .section { margin: 8px 0 34px; }
  .section-title { align-items: center; justify-content: flex-start; gap: 24px; margin-bottom: 19px; min-height: 42px; }
  .section-title h2 { font-size: 1.45rem; font-weight: 500; letter-spacing: -.025em; }
  .rail-hint { display: none; }
  .shelf-tabs { display: flex; align-items: center; gap: 12px; }
  .shelf-tabs .small-btn { min-height: 38px; min-width: 120px; padding: 0 20px; border: 1px solid transparent; border-radius: 999px; font-size: .77rem; background: #ffffff05; color: var(--muted); cursor: pointer; }
  .shelf-tabs .small-btn.active { color: var(--text); border-color: var(--brand); background: #f706a20b; }
  .rail-actions { display: flex; gap: 9px; margin-left: auto; }
  .rail-actions button:disabled { opacity: .24; cursor: default; }
  .rail { gap: 18px; padding: 3px 2px 12px; scroll-behavior: smooth; scroll-snap-type: x proximity; scrollbar-width: none; }
  .rail > .poster { flex: 0 0 var(--poster-size); width: var(--poster-size); min-width: 0; max-width: none; scroll-snap-align: start; }
  .poster { transition: transform .18s ease; }
  .poster:hover { transform: translateY(-3px); }
  .poster-art { aspect-ratio: 2 / 3; border-radius: 10px; border: 1px solid #ffffff09; }
  .poster-title { font-size: .87rem; line-height: 1.4; margin-top: 10px; }
  .poster-meta { font-size: .8rem; margin-top: 3px; }
  .fav { width: 32px; height: 32px; top: 9px; right: 9px; }
  .shelf-empty { padding: 34px 0 50px; }
  .view:not(#discover) { max-width: 1600px; margin: 0 auto; padding: 116px var(--desktop-gutter) 40px; }
  .category-grid, #favoriteGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 26px 20px; }
  #favoriteGrid > .poster { width: 100%; max-width: none; min-width: 0; }
  #recent > .topbar, #favorites > .topbar, #profile > .topbar { margin: 8px 0 28px; }
  #recent h1, #favorites h1, #profile h1 { font-size: 2rem; }
  .rank-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .rank-item { padding: 16px; grid-template-columns: 38px 80px minmax(0, 1fr); border-radius: 14px; }
}
@media (min-width: 1024px) and (max-width: 1199px) {
  .desktop-header { gap: 24px; }
  .desktop-links { gap: 20px; }
  .desktop-tools { gap: 13px; }
  .desktop-plans { padding: 0 18px; }
  .desktop-logo { font-size: 1rem; }
  .desktop-logo img { width: 32px; height: 32px; }
  .hero-copy { width: 63%; }
}
@media (prefers-reduced-motion: reduce) {
  .poster, .desktop-header { transition: none; }
  .rail { scroll-behavior: auto; }
}

@media (min-width: 1024px) {
  .series-head { padding-top: 0; margin-bottom: 26px; }
  .series-head h1 { font-size: 1.6rem; }
  #movieDetailsContent { display: grid; grid-template-columns: minmax(250px, 400px) minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 36px; row-gap: 26px; align-items: start; }
  #movieDetailsContent > .movie-details-hero { grid-column: 1; grid-row: 1; aspect-ratio: 16 / 9; height: auto; min-height: 0; margin: 0; border-radius: 18px; }
  #movieDetailsContent > .movie-details-summary { grid-column: 2; grid-row: 1; min-width: 0; }
  #movieDetailsContent .movie-details-title { margin: 0 0 10px; font-size: clamp(1.8rem, 2.3vw, 2.8rem); }
  #movieDetailsContent .movie-details-meta { margin: 0 0 20px; }
  #movieDetailsContent .movie-details-actions { margin-bottom: 26px; }
  #movieDetailsContent > .movie-details-info { grid-column: 1 / -1; grid-row: 2; margin: 0; padding: 26px; border: 1px solid var(--line); background: rgba(21, 12, 29, .65); border-radius: 16px; }
  #movieDetailsContent .movie-details-info dl { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
  #movieDetailsContent .movie-info-wide { grid-column: auto; }
  .movie-details-copy p { line-height: 1.65; }
  #seriesOverview { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); column-gap: 36px; row-gap: 18px; margin-bottom: 36px; }
  #seriesOverview > .movie-details-hero { grid-column: 1; grid-row: 1 / 4; aspect-ratio: auto; min-height: 360px; height: 100%; margin: 0; border-radius: 18px; }
  #seriesOverview > .movie-details-meta { grid-column: 2; grid-row: 1; margin: 0; }
  #seriesOverview > .movie-details-copy { grid-column: 2; grid-row: 2; }
  #seriesOverview > .movie-details-info { grid-column: 2; grid-row: 3; margin: 0; padding-top: 18px; }
  #series > .season-select { max-width: 280px; margin-bottom: 26px; }
  #seriesEpisodeHeading { font-size: 1.35rem; }
  .episode-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .episode-item { grid-template-columns: 120px minmax(0, 1fr) 22px; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(22, 13, 31, .62); }
  .episode-item:not(:disabled):hover { border-color: rgba(180, 91, 255, .5); background: rgba(47, 23, 65, .7); }
  .episode-item h3 { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.35; }
  .episode-thumb { border-radius: 8px; }
  .profile-board { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: stretch; }
  .profile-actions { align-items: stretch; }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .action-panel { max-width: 820px; }
  .modal { align-items: center; padding: 30px; }
  .modal-panel { width: min(1000px, 100%); max-height: calc(100dvh - 60px); border-radius: 22px; padding: 28px; }
  .video-modal { padding: 56px 32px 24px; }
  .video-shell { width: min(1200px, 100%, calc((100dvh - 120px) * 1.777778)); }
}
