/* Phone and tablet adaptations; desktop composition stays in styles.css. */
@media (max-width: 760px) {
  body { font-size:14px; padding-bottom:env(safe-area-inset-bottom); }
  main, .player-view main, .player-view main:not(:has(#title-view .episode-guide)) { width:calc(100% - 28px); }
  #site-header { padding:4px 14px; min-height:48px; }
  #site-header nav { justify-content:space-between; gap:4px; width:100%; font-size:12px; }
  #site-header nav > span { display:none; }
  #site-header nav button { min-height:44px; padding:8px 5px; white-space:nowrap; }
  :is(.title-page-view,.player-view) #site-header { width:100%; padding:8px 14px 0; margin:0; gap:5px 10px; display:grid; grid-template-columns:90px minmax(0,1fr); top:0; }
  :is(.title-page-view,.player-view) #site-header nav { grid-column:1/-1; }
  :is(.title-page-view,.player-view) #site-header .identity { gap:5px; margin:0; }
  :is(.title-page-view,.player-view) #site-header .identity img { width:24px; height:28px; }
  :is(.title-page-view,.player-view) #site-header .identity h1 { font-size:23px; letter-spacing:-1px; }
  #player-search-slot { min-width:0; width:100%; }
  #hero-search, :is(.title-page-view,.player-view) #hero-search { width:100%; height:44px; gap:6px; }
  #query, :is(.title-page-view,.player-view) #query { font-size:16px; padding:8px 10px; min-width:0; }
  .search-button, :is(.title-page-view,.player-view) .search-button { min-height:44px; font-size:12px; padding:0 12px; }
  .masthead, .has-results .masthead { padding-top:20px; }
  .category-bar { flex-wrap:nowrap; justify-content:flex-start; overflow-x:auto; gap:18px; margin-top:10px; scrollbar-width:thin; }
  .category { flex-shrink:0; min-height:44px; font-size:12px; }
  .source-settings { margin:0 auto 16px; }
  .source-settings > summary { min-height:36px; padding:8px; }
  #source-settings { display:flex; flex-wrap:wrap; gap:6px 16px; }
  #source-settings label { display:flex; align-items:center; min-height:44px; gap:6px; font-size:12px; }
  #suggestions { max-height:55dvh; overflow-y:auto; max-width:100%; }
  #player-search-slot #suggestions { position:absolute; left:14px; right:14px; width:auto; }
  .suggestion { min-height:48px; }
  .discovery-heading, .results-heading { align-items:flex-start; gap:12px; }
  .discovery-controls { width:100%; gap:8px; }
  .discovery-controls select { flex:1; min-width:0; width:calc(50% - 8px); min-height:44px; font-size:14px; }
  .time-filters button, #browse-refresh { min-width:44px; min-height:44px; font-size:12px; }
  .poster-grid { gap:20px 12px; }
  .poster-card h3 { font-size:14px; white-space:normal; line-height:1.4; }
  .poster-meta, .poster-source { font-size:11px; }
  .suggested-heading { flex-wrap:wrap; }
  .suggested-heading a { min-height:36px; display:inline-flex; align-items:center; }
  .suggested-name, .cast-member a { font-size:12px; }
  .suggested-grid, .cast-grid { scroll-padding-inline:2px; }
  .filters { gap:8px; flex-wrap:wrap; }
  .filters label { flex:1 1 140px; min-width:0; }
  .filters select { width:100%; min-height:44px; font-size:14px; }
  .result-table th { padding:4px; }
  .result-table th button { min-height:44px; font-size:12px; }
  .result-table td { padding:12px 4px; }
  .result-name { font-size:12px; line-height:1.5; }
  .result-meta { font-size:11px; line-height:1.6; }
  .result-table .col-size, .result-table .col-age, .result-table .col-source, .result-table .col-leech { display:none; }
  .mobile-size, .mobile-meta { display:inline; }
  .result-table .col-seeds { width:52px; }
  .result-table .col-actions { width:44px; }
  .row-actions { flex-direction:column; gap:0; }
  .row-actions .save-button, .row-actions .magnet { min-width:44px; min-height:44px; margin:0; }
  .row-actions .magnet { font-size:11px; padding:4px; }
  .title-page { margin-top:18px; }
  .title-breadcrumb { margin-bottom:16px; font-size:12px; }
  .title-breadcrumb a { padding:8px 0; }
  body:not(.player-view) .title-intro .film-overview { grid-template-columns:90px minmax(0,1fr); gap:0 16px; }
  body:not(.player-view) .title-intro .film-poster { width:90px; height:135px; object-fit:cover; grid-column:1; grid-row:1/5; }
  body:not(.player-view) .title-intro .film-info { display:contents; }
  body:not(.player-view) .title-intro .film-kicker { display:none; }
  body:not(.player-view) .title-intro .film-info h2 { grid-column:2; grid-row:1; font-size:25px; margin:0 0 6px; }
  body:not(.player-view) .title-intro .film-info h2 > span { font-size:20px; }
  body:not(.player-view) .title-intro .film-facts { grid-column:2; grid-row:2; margin:0; font-size:12px; line-height:1.5; }
  body:not(.player-view) .title-intro .title-rating-link { grid-column:2; grid-row:3; justify-self:start; min-height:40px; margin:0; font-size:12px; text-align:left; }
  body:not(.player-view) .title-intro .film-director { grid-column:2; grid-row:4; margin:0; font-size:12px; }
  body:not(.player-view) .title-intro .film-summary { grid-column:1/-1; font-size:14px; line-height:1.65; margin:18px 0 0; }
  body:not(.player-view) .title-intro .film-links { grid-column:1/-1; flex-wrap:wrap; align-items:center; gap:8px 18px; margin:14px 0 0; font-size:12px; }
  .film-links a, .title-play { min-height:44px; display:inline-flex; align-items:center; justify-content:center; }
  .title-play { min-width:104px; }
  .show-details > summary { min-height:44px; padding:12px 0; font-size:12px; }
  .title-section-nav { flex-wrap:nowrap; overflow-x:auto; gap:22px; margin-top:14px; }
  .title-section-nav button { min-height:48px; white-space:nowrap; flex-shrink:0; font-size:14px; }
  .season-tabs { scroll-snap-type:x proximity; }
  .season-tabs button { min-height:44px; font-size:12px; scroll-snap-align:start; }
  .episode-row, .player-view .episode-row { display:grid; grid-template-columns:76px minmax(0,1fr); gap:8px 12px; padding:12px 6px; align-items:start; }
  .episode-row img, .player-view .episode-row img, .episode-placeholder { width:76px; height:48px; grid-column:1; grid-row:1; }
  .episode-info { grid-column:2; grid-row:1/3; }
  .episode-title { font-size:14px; line-height:1.4; min-height:36px; }
  .episode-info small { font-size:11px; }
  .episode-info details { font-size:12px; }
  .episode-info summary { min-height:36px; padding:8px 0; }
  .episode-row .episode-play { display:none; }
  .episode-row .episode-rating-link { grid-column:1; grid-row:2; min-height:36px; display:flex; align-items:center; justify-content:center; font-size:12px; }
  .episode-focus h3 { font-size:23px; }
  .episode-focus p { font-size:14px; line-height:1.65; }
  .episode-focus nav button { min-height:44px; }
  .reception-heading select, .graph-selectors select, #critics-season { min-height:44px; font-size:14px; }
  .reception-score small, .episode-standing small { font-size:11px; }
  .rank-switch button { min-height:44px; font-size:12px; }
  .top-episode-list li { font-size:12px; padding:12px 0; }
  .top-episode-list small { font-size:11px; }
  .heatmap-legend { font-size:11px; }
  .heatmap-pick { font-size:12px; margin-bottom:14px; }
  .critic-comment footer a { min-height:44px; display:flex; align-items:center; font-size:12px; }
  .critic-comment-source { font-size:11px; flex-wrap:wrap; }
  dialog { width:calc(100% - 24px); max-width:560px; max-height:calc(100dvh - 24px); overflow:auto; padding:22px 18px; }
  dialog input:not([type=range]):not([type=checkbox]), dialog select, dialog textarea { font-size:16px; min-height:44px; max-width:100%; }
  dialog button { min-height:44px; }
  .dialog-close { min-width:44px; }
  .detail-grid { gap:12px; }
  body > footer { margin-top:32px; padding:20px 14px; }
}
@media (max-width:650px) {
  .player-frame .watch-tools { gap:0; justify-content:space-between; }
  .player-frame .watch-tools > button, .player-frame .track-settings > summary { width:40px; height:44px; min-width:40px; padding:9px; }
  .player-frame #player-toggle { min-width:40px; }
  .player-frame #player-time { font-size:10px; }
  .player-frame #player-mute, .player-frame #picture-in-picture { display:none; }
  .player-frame .watch-tools .player-captions { width:36px; min-width:36px; height:36px; padding:4px; margin-left:0; }
  .player-frame .player-hud { padding:28px 6px 4px; }
  .player-frame .player-timeline { padding:10px 4px; }
  .player-frame #player-seek { touch-action:pan-y; }
  .player-frame #player-close { width:44px; height:44px; }
  .player-frame .track-settings { position:static; }
  .player-frame .track-grid.player-settings-menu { right:4px; bottom:64px; width:calc(100% - 8px); max-width:none; max-height:calc(var(--settings-height, 160px) + 32px); border-radius:6px; }
  .player-frame .player-settings-menu .settings-row, .player-frame .player-settings-menu .settings-back, .player-frame .player-settings-menu .settings-close { min-height:44px; }
  .player-frame .player-settings-menu .settings-back, .player-frame .player-settings-menu .settings-close { min-width:44px; }
  .player-frame .player-settings-menu select, .player-frame .player-settings-menu input[type=number] { font-size:16px; min-height:44px; }
  .player-frame .player-settings-menu .mobile-player-action { display:flex; }
}
@media (min-width:651px) { .player-frame .player-settings-menu .mobile-player-action { display:none; } }
@media (max-width:360px) {
  :is(.title-page-view,.player-view) #site-header { grid-template-columns:74px minmax(0,1fr); gap:4px; }
  :is(.title-page-view,.player-view) #site-header .identity img { display:none; }
  .player-frame .watch-tools > button, .player-frame .track-settings > summary { min-width:34px; width:34px; padding:6px; }
  .player-frame #player-toggle { min-width:34px; }
  .graph-selectors { flex-wrap:wrap; }
}
@media (max-height:500px) and (orientation:landscape) {
  .player-view #site-header { position:static; }
  #watch-player:fullscreen { padding-left:env(safe-area-inset-left); padding-right:env(safe-area-inset-right); }
}
@media(max-width:760px) {
 :is(.title-page-view,.player-view) #site-header nav { font-size:12px; justify-content:space-between; }
 .discovery-controls { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr) 44px; }
 .discovery-controls select { width:100%; font-size:16px; }
 .discovery-controls select:first-of-type { grid-column:1; }
 .discovery-controls select:nth-of-type(2) { grid-column:2/4; }
 .discovery-controls .time-filters { grid-column:1/3; }
 .discovery-controls #browse-refresh { grid-column:3; }
 .filters select { font-size:16px; }
 .title-releases > .section-heading, .title-releases .release-heading { gap:10px; flex-wrap:wrap; }
 .title-release-filters > summary { min-height:44px; padding:12px; }
}
#mobile-filter-toggle { display:none; }
@media(max-width:760px) {
 #mobile-filter-toggle { display:block; min-height:44px; padding:8px 14px; border:1px solid var(--line); border-radius:3px; font-size:14px; margin-left:auto; }
 .results-heading:has(#mobile-filter-toggle[aria-expanded="false"]) > .filters { display:none; }
 #search-filters { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); width:100%; }
 #search-filters select { min-width:0; }
 #search-filters label:not(.sr-only) { display:flex; align-items:center; min-height:44px; font-size:12px; }
 .carousel-controls button { min-width:44px; min-height:44px; }
}
@media(max-width:760px) {
 #search-filters select { max-width:none; width:100%; }
 .playback-advanced input:not([type=checkbox]), .playback-advanced select, .advanced-card input:not([type=checkbox]), .advanced-card select { min-width:0; max-width:100%; min-height:44px; font-size:16px; }
 .advanced-card button, .advanced-card .file-button, .playback-advanced > summary { min-height:44px; padding:10px; }
 .player-source, .source-picker { flex-wrap:wrap; }
 .advanced-card form { min-width:0; }
}
@media(max-width:650px) {
 .player-frame .track-grid.player-settings-menu { bottom:4px; max-height:calc(var(--settings-height,160px) + 92px); }
 .player-frame .player-settings-menu > .settings-header { padding:0 4px 4px; }
}
@media(max-width:760px) {
 .source-filter-menu > summary { min-height:44px; padding:12px; }
 .title-releases .source-filter-menu .title-filters { max-width:calc(100vw - 40px); width:280px; }
 .title-releases .source-filter-menu select { font-size:16px; min-height:44px; }
 #title-release-results .source-results .result-name { font-size:12px; line-height:1.5; }
 #title-release-results .source-facts { font-size:11px; gap:4px 8px; }
 #title-release-results .source-results .col-actions { width:44px; }
 #title-release-results .source-results .col-seeds { width:48px; }
 #title-release-results .source-results .col-leech { display:none; }
 #title-release-results .source-results th, #title-release-results .source-results td { padding:8px 4px; }
 #title-release-results .source-results .row-actions { flex-direction:column; }
 #title-release-results .row-actions > *, #title-release-results .source-results .save-button { display:grid; width:44px; height:44px; min-width:44px; }
}
@media (min-width:761px) and (max-width:1024px) {
 #site-header nav button, .season-tabs button, .title-section-nav button, .episode-play, .title-play { min-height:44px; }
 #query { font-size:16px; }
 .episode-info summary { min-height:32px; padding:6px 0; }
 .film-summary, .episode-focus p { font-size:14px; }
}
@media (hover:none) and (pointer:coarse) {
 .poster-link:hover img, .poster-link:hover .poster-placeholder { transform:none; }
 .heatmap-cell { -webkit-tap-highlight-color:transparent; }
}
/* A readable bottom sheet instead of a tiny scrolling window on phones. */
@media (max-width:650px) and (orientation:portrait) {
 .player-frame .track-grid.player-settings-menu { position:fixed; left:12px; right:12px; bottom:12px; width:auto; max-width:none; max-height:min(520px,calc(100dvh - 100px)); border-radius:14px; z-index:1002; padding:8px; box-shadow:0 12px 60px #000b; }
}
@media (max-width:650px) and (orientation:portrait) {
 .watch-player:has(.track-settings[open]) { position:relative; z-index:1003; }
}

@media(max-width:760px) {
  .discovery-heading { display:block; }
  .discovery-heading h2 { margin-bottom:10px; font-size:20px; }
  .discovery-controls { display:grid; grid-template-columns:minmax(0,1fr) 44px; gap:4px 8px; width:100%; }
  .discovery-modes { grid-column:1; width:fit-content; max-width:100%; }
  .discovery-controls .discovery-modes button { min-height:40px; padding:7px 12px; font-size:12px; }
  .discovery-controls #browse-refresh { grid-column:2; grid-row:1; width:44px; height:44px; }
  .discovery-period { grid-column:1 / -1; width:100%; min-height:40px; justify-content:flex-start; }
  .discovery-controls .time-filters button { min-height:40px; padding:8px 12px; }
  .discovery-all-time { padding:8px 12px; }
}
@media(max-width:760px) {
  #player-search-slot #hero-search #suggestions { left:-1px; right:auto; width:calc(100% + 2px); max-width:none; }
}
@media(max-width:760px) {
  #site-header nav,:is(.title-page-view,.player-view) #site-header nav {min-width:0;max-width:100%;flex-wrap:wrap;justify-content:flex-start;gap:0 8px;}
}
@media(max-width:760px) {
 body:not(.player-view) .title-intro .film-overview {grid-template-columns:108px minmax(0,1fr);}
 body:not(.player-view) .title-intro .film-poster {width:108px;height:162px;max-height:162px;}
 body:not(.player-view) .title-intro .film-actions {grid-column:1/-1;display:flex;gap:8px 16px;margin:16px 0 0;}
 .film-actions .title-play {min-width:0;min-height:28px;height:28px;}
 .film-actions .title-play::before {content:"";position:absolute;inset:-8px -4px;}
 body:not(.player-view) .title-intro .film-actions .film-links {margin:0;gap:12px;}
}
