/* 电脑 / 平板 / 手机：统一收口，放在最后加载 */

html,
body,
.app-shell {
  overflow-x: clip;
  max-width: 100%;
}

img,
video,
.poster-frame,
.hero-visual,
.movie-card,
.category-tile {
  max-width: 100%;
}

.header-search input,
.filter-panel input,
.filter-panel select {
  min-width: 0;
}

/* —— 电脑宽屏：单行顶栏、双栏首屏、按列数排卡片 —— */
@media (min-width: 1101px) {
  .container {
    width: min(1180px, calc(100% - 48px));
  }

  .header-inner {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 20px;
    min-height: 68px;
    padding: 6px 0;
  }

  .header-brand {
    flex: 0 0 auto;
    margin-right: 0;
  }

  .nav-toggle {
    display: none !important;
  }

  .header-nav {
    display: flex !important;
    flex: 1 1 auto;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 4px 18px;
    width: auto;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .header-search {
    flex: 0 0 260px;
    max-width: 260px;
    min-width: 200px;
  }

  .hero-slide.active {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    align-items: center;
    gap: 36px;
  }

  .hero-visual {
    order: 0;
  }

  .hero-visual img {
    aspect-ratio: 16 / 10;
    max-height: 380px;
    width: 100%;
    object-fit: cover;
  }

  .hero-bar,
  .hero-studio__intro {
    align-items: flex-end;
  }

  .skin-fr .hero-bar {
    align-items: center;
  }

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

  .detail-hero {
    grid-template-columns: 220px minmax(0, 1fr);
  }
}

/* —— 小平板：三列卡片，首屏改上下叠 —— */
@media (max-width: 1100px) {
  .container {
    width: min(1180px, calc(100% - 28px));
  }

  .movie-grid,
  .cq-card-grid,
  .pick-grid,
  .related-grid,
  body[data-cols="5"] .movie-grid,
  body[data-cols="6"] .movie-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }

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

  .hero-slide.active {
    display: flex !important;
    flex-direction: column;
    gap: 16px;
  }

  .hero-visual {
    order: -1;
  }

  .hero-visual img {
    width: 100%;
    max-height: 360px;
    aspect-ratio: 16 / 10;
    object-fit: cover;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .filter-panel {
    grid-template-columns: 1fr 1fr;
  }

  .detail-hero {
    grid-template-columns: 180px minmax(0, 1fr);
  }
}

/* —— 顶栏：平板仍单行，不弹出汉堡 —— */
@media (min-width: 821px) and (max-width: 1100px) {
  .header-inner {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px;
    min-height: 60px;
  }

  .nav-toggle {
    display: none !important;
  }

  .header-nav {
    display: flex !important;
    flex: 1 1 auto;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 2px 12px;
    width: auto;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .header-nav a {
    font-size: 0.82rem;
    min-height: 40px;
  }

  .header-search {
    flex: 0 0 200px;
    max-width: 200px;
  }

  .header-brand__sub {
    display: none;
  }
}

/* —— 手机：顶栏网格 + 汉堡菜单 + 两列卡片 —— */
@media (max-width: 820px) {
  .container {
    width: min(1180px, calc(100% - 20px));
  }

  .header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    grid-template-areas:
      "brand toggle"
      "search search"
      "nav nav";
    align-items: center;
    gap: 8px 10px;
    min-height: 56px;
    padding: 8px 0;
  }

  .header-brand {
    grid-area: brand;
    margin-right: 0;
    min-width: 0;
  }

  .header-brand__sub {
    display: none;
  }

  .header-brand__title {
    font-size: 0.98rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70vw;
  }

  .header-search {
    grid-area: search;
    max-width: none;
    min-width: 0;
    flex: none;
    width: 100%;
    height: 40px;
  }

  .nav-toggle {
    grid-area: toggle;
    display: grid;
    place-items: center;
  }

  .header-nav {
    grid-area: nav;
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 8px;
    border-radius: 12px;
    background: var(--card);
    border: 1px solid var(--line);
  }

  .header-nav.open {
    display: flex;
  }

  .header-nav a,
  body.body-m18-rose .header-nav a {
    border-radius: 10px;
    border-bottom: 0;
    background: transparent;
    padding: 10px 12px;
    justify-content: flex-start;
    min-height: 44px;
  }

  .header-nav a:hover,
  .header-nav a.active,
  body.body-m18-rose .header-nav a:hover,
  body.body-m18-rose .header-nav a.active {
    background: var(--blue-soft);
    color: var(--gold);
  }

  body.body-m18-rose .header-nav a {
    background: transparent;
  }

  .hero-bar,
  .hero-studio__intro,
  .skin-fr .hero-bar {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding: 16px 0 8px;
  }

  .hero-bar .hero-lead,
  .skin-fr .hero-lead {
    margin-left: 0;
    margin-right: 0;
  }

  .hero-bar .hero-actions,
  .skin-fr .hero-actions,
  .hero-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .hero-actions .primary-btn,
  .hero-actions .ghost-btn {
    min-height: 44px;
  }

  .skin-nt,
  .skin-cn {
    display: block;
  }

  .skin-nt .hero-carousel,
  .skin-cn .hero-carousel {
    order: 0;
    padding-top: 0;
  }

  .wh-search form {
    flex-direction: row;
    max-width: none;
  }

  body.body-m72-ember .header-search {
    display: none;
  }

  body.body-m72-ember .header-inner {
    grid-template-areas:
      "brand toggle"
      "nav nav";
  }

  .movie-grid,
  .cq-card-grid,
  .related-grid,
  .pick-grid,
  body[data-cols="5"] .movie-grid,
  body[data-cols="6"] .movie-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .cat-grid,
  .category-grid,
  .category-grid.large,
  .note-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .skin-fr-cats .category-tile {
    border-radius: 12px;
    min-height: 72px;
  }

  .skin-fr-cats .category-tile span {
    display: none;
  }

  .card-rs .movie-card-body h3 {
    font-size: 0.82rem;
  }

  .detail-hero {
    grid-template-columns: 1fr;
  }

  .detail-poster {
    max-width: 200px;
    margin: 0 auto;
  }

  .filter-panel {
    grid-template-columns: 1fr;
  }

  .filter-row {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .filter-chip {
    flex: 0 0 auto;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .player-section,
  .content-card,
  .page-panel {
    padding: 14px;
  }

  .section-block {
    padding: 24px 0 4px;
  }

  .hero-control button {
    width: 40px;
    height: 40px;
  }

  .section-head {
    align-items: flex-start;
  }
}

@media (max-width: 540px) {
  .header-inner {
    grid-template-columns: minmax(0, 1fr) 40px;
    gap: 6px 8px;
  }

  .header-brand__logo {
    width: 34px;
    height: 34px;
  }

  .hero-bar h1,
  .page-hero h1,
  .detail-info h1 {
    font-size: 1.28rem;
  }

  .hero-visual img {
    max-height: 240px;
  }

  .cat-grid,
  .category-grid,
  .note-grid {
    grid-template-columns: 1fr;
  }

  .movie-grid.related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .wh-search {
    padding: 10px 0;
  }

  .wh-search form {
    gap: 6px;
  }

  .bbaseo-fly {
    transform: scale(0.84);
    transform-origin: left bottom;
  }
}

@media (max-width: 768px) {
  .player-box {
    border-radius: 0;
    margin: 0 -10px;
  }
}

/* —— 跨端收口 / 跳过链接 / 超窄屏 —— */
.skip-link {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 200;
  padding: 8px 12px;
  border-radius: 8px;
  background: #111;
  color: #fff;
  transform: translateY(-140%);
}
.skip-link:focus {
  transform: none;
}

.player-box video,
.video-el {
  width: 100%;
  height: auto;
  object-fit: contain;
  background: #000;
}

a,
button,
.nav-toggle,
.header-search button,
.primary-btn,
.ghost-btn {
  touch-action: manipulation;
}

@media (max-width: 820px) {
  input,
  select,
  textarea {
    font-size: 16px;
  }
}

@media (max-width: 360px) {
  .movie-grid {
    grid-template-columns: 1fr;
  }

  .header-brand__sub {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bbaseo-fly,
  .bbaseo-fly i {
    animation: none !important;
  }
}
