/**
 * 全站移动端适配（在 vod-common.css 之后加载）
 * 覆盖首页、分类、列表、详情、播放等所有模板
 */

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

body {
  overflow-x: hidden;
  padding-left: max(0px, env(safe-area-inset-left));
  padding-right: max(0px, env(safe-area-inset-right));
}

/* ---------- 公共布局 ---------- */
@media (max-width: 768px) {
  .wrap,
  .index-wrap {
    padding-left: 12px;
    padding-right: 12px;
  }

  header.top {
    flex-direction: column;
    align-items: stretch;
  }

  .logo {
    font-size: 1rem;
  }

  nav.breadcrumb {
    font-size: 11px;
    word-break: break-all;
  }

  main.hero {
    padding: 12px;
    border-radius: 12px;
  }

  main.hero h1,
  h1.page-title {
    font-size: 1.125rem;
  }

  section.box {
    padding: 10px;
  }

  .head {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .head > div:not(.cover) {
    width: 100%;
  }

  .cover {
    width: min(100%, 200px);
    height: auto;
    aspect-ratio: 2/3;
    margin: 0 auto;
  }

  .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .meta,
  .meta-row {
    font-size: 12px;
  }

  .article-body {
    font-size: 15px;
  }

  .playlist,
  .ep-crawl,
  .ep-nav {
    gap: 6px;
  }

  .ep,
  .ep-crawl a,
  .ep-nav a {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
  }

  .search {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .search input,
  .search button {
    width: 100%;
    min-height: 44px;
    font-size: 16px;
  }

  nav.top-nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

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

  nav.top-nav a {
    flex-shrink: 0;
    margin-right: 0;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    white-space: nowrap;
  }

  .site-footer .footer-nav,
  footer.site {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .site-footer .footer-nav a,
  footer.site a {
    margin-right: 0;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  .friendlinks,
  .friendlinks-sup {
    gap: 6px 10px;
  }

  .friendlinks a,
  .friendlinks-sup a {
    font-size: 11px;
    word-break: break-all;
  }
}

/* ---------- 首页顶栏 ---------- */
@media (max-width: 768px) {
  .site-header .inner {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 12px;
    gap: 10px;
  }

  .site-header .logo {
    font-size: 0.95rem;
    text-align: center;
  }

  .site-header .search {
    max-width: none;
    min-width: 0;
    width: 100%;
  }

  .vod-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line, rgba(255, 255, 255, 0.12));
    border-radius: 8px;
    background: rgba(106, 166, 255, 0.15);
    color: inherit;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
  }

  .vod-nav-toggle[hidden] {
    display: none !important;
  }

  .site-header .cat-bar:not(.is-open) {
    display: none;
  }

  .site-header .cat-bar.is-open {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0 12px 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .site-header .cat-bar.is-open::-webkit-scrollbar {
    display: none;
  }

  .cat-bar {
    flex-wrap: nowrap;
    padding: 0 12px 10px;
    -webkit-overflow-scrolling: touch;
  }

  .cat-link {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
  }

  .index-hero {
    padding: 18px 14px;
    margin-top: 12px;
  }

  .index-hero h1 {
    font-size: 1.2rem;
  }

  .hero-tags {
    justify-content: flex-start;
  }

  .sec-head {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .sec-head h2 {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .cat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .cat-card {
    padding: 10px 6px;
  }

  .cat-card .icon {
    font-size: 1.25rem;
  }

  .vod-grid {
    gap: 8px;
  }

  .vod-card .body {
    padding: 8px;
  }

  .vod-card .title {
    font-size: 12px;
  }

  .grid,
  section.grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  article.item,
  .card,
  .item {
    padding: 10px;
  }
}

/* ---------- 列表 / 频道页 ---------- */
@media (max-width: 600px) {
  .grid,
  section.grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 380px) {
  .grid,
  section.grid,
  .vod-grid {
    grid-template-columns: 1fr;
  }

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

/* ---------- 播放页 ---------- */
@media (max-width: 768px) {
  section.player-box {
    padding: 10px;
  }

  .player-media {
    border-radius: 8px;
    min-height: 200px;
  }

  .player-media iframe,
  .player-media video {
    object-fit: contain;
  }
}

/* ---------- 分类 / 站点地图 ---------- */
@media (max-width: 768px) {
  body.types-page {
    padding: 12px;
    font-size: 15px;
  }

  .types-page h1 {
    font-size: 1.125rem;
  }

  .types-page nav.top-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .types-page nav.top-links a {
    margin-right: 0;
  }
}
