/**
 * 手机端优先：限制壳层宽度，vw 改为容器宽度(cqw)，避免 PC 浏览器拉满屏
 */
:root {
  --app-max: 640px;
  --shell-w: min(var(--app-max), 100vw);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

body {
  min-width: 320px;
  max-width: none;
  margin: 0;
  background: #cfd4d8;
}

#app-root {
  max-width: var(--app-max);
  min-width: 320px;
  min-height: 100vh;
  margin: 0 auto;
  position: relative;
  background: #e9ecef;
  overflow-x: hidden;
  container-type: inline-size;
  container-name: app;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.08);
}

/* 主内容区：不用全屏 absolute，便于滚动 */
.index-con {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: calc(100vh - 45px);
  padding-bottom: calc(55px + var(--safe-bottom));
  overflow: visible !important;
}

.index-con-2 {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: 100vh;
  overflow: visible !important;
}

/* Banner / 卡片高度：相对壳层，不是整个显示器 */
@container app (min-width: 0) {
  .flexslider {
    width: 100% !important;
    height: 62.5cqw !important;
    max-height: 400px;
    overflow: hidden;
  }

  .flexslider .slides,
  .flexslider .slide {
    list-style: none;
    margin: 0;
    padding: 0;
    height: 100%;
  }

  .flexslider img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .acti-img {
    height: 46cqw !important;
    max-height: 295px;
  }

  .activity-box a.first {
    height: 40cqw !important;
    max-height: 256px;
  }
}

.induc {
  background: #ffffff;
}

.induc .content {
  width: 91%;
  margin: 0 auto;
  padding: 20px 0;
}

.induc .content span {
  font-size: 18px;
}

.induc .content p {
  margin-top: 10px;
  line-height: 20px;
  font-size: 14px;
  color: #666;
}

/* 作品列表：手机双列，超窄屏单列 */
.activity-inf ul li {
  width: 46%;
}

@media (max-width: 359px) {
  .activity-inf ul li {
    width: 96%;
    margin-left: 2%;
    margin-right: 2%;
  }

  .group-box li {
    width: 96%;
    min-height: 56px;
  }

  .group-box li a {
    height: auto;
    min-height: 44px;
    font-size: 17px;
  }
}

/* 侧栏：覆盖 public.css 的 left/float，从右侧滑入 */
.sub-nav {
  position: fixed !important;
  top: 0 !important;
  left: auto !important;
  float: none !important;
  width: min(85%, 300px) !important;
  height: 100% !important;
  right: calc(50% - var(--shell-w) / 2 - min(85%, 300px));
  z-index: 999;
  transition: right 0.28s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sub-nav.open {
  right: calc(50% - var(--shell-w) / 2);
}

.mask {
  position: fixed;
  inset: 0;
  z-index: 998;
}

.mask.show {
  display: block;
}

/* 固定底栏 / 菜单钮：对齐壳层 */
.footer-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: var(--shell-w);
  max-width: var(--app-max);
  height: calc(45px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  box-sizing: border-box;
  z-index: 900;
}

.sea-btn {
  position: fixed;
  top: 15px;
  left: calc(50% + var(--shell-w) / 2 - 53px);
  z-index: 901;
}

.title-top {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: var(--shell-w);
  max-width: var(--app-max);
  z-index: 999;
  box-sizing: border-box;
}

/* 详情轮播：正方形，占壳层全宽 */
.detail-swiper {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: var(--app-max);
  overflow: hidden;
  background-color: #201815;
}

.detail-swiper .swiper-slide {
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-swiper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.page-detail .index-con-2 {
  margin-top: 45px;
  padding-bottom: calc(24px + var(--safe-bottom));
}

.recommend ul li a {
  background-size: cover;
  background-position: center;
}

.modal-overlay {
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
}

/* 不支持容器查询时的降级（仍限制 PC 上 vw 过大） */
@supports not (container-type: inline-size) {
  .flexslider {
    width: 100% !important;
    height: 62.5vw !important;
    max-height: 400px;
    overflow: hidden !important;
  }

  .flexslider .slides,
  .flexslider .slide {
    height: 100%;
    margin: 0;
    padding: 0;
  }

  .flexslider img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .acti-img {
    height: 46vw !important;
    max-height: 295px;
  }

  .activity-box a.first {
    height: 40vw !important;
    max-height: 256px;
  }

  @media (min-width: 641px) {
    .flexslider {
      height: 400px !important;
    }

    .acti-img {
      height: 295px !important;
    }

    .activity-box a.first {
      height: 256px !important;
    }
  }
}
