/* Storm Eye download panel: preserve the original desktop scale; mobile uses its own layout below. */
.index .download {
  z-index: 12 !important;
  gap: 0.8rem;
  transform: translateX(-50%);
  transform-origin: center bottom;
}
.index .download > * {
  flex-shrink: 0;
}
.index .download-phone.appstore {
  margin-top: 1rem;
}

/* Narrow phones: mobile controls use their own reflow instead of the desktop panel. */
@media (max-width: 480px) {
  #offline-home .section.index,
  #offline-home .section.index.fp-section,
  #offline-home .section.index .fp-tableCell,
  #fullpage .section.index,
  #fullpage .section.index.fp-section,
  #fullpage .section.index .fp-tableCell {
    height: 100svh !important;
    min-height: 620px !important;
  }

  .index .download {
    left: 50% !important;
    bottom: clamp(2.8rem, 8vh, 5rem) !important;
    width: min(94vw, 380px) !important;
    display: grid !important;
    grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.62fr);
    grid-template-areas:
      "tap phones"
      "code pc";
    align-items: center;
    justify-items: center;
    gap: clamp(8px, 2.5vw, 14px);
    transform: translateX(-50%) !important;
  }

  .index .download > * {
    min-width: 0 !important;
  }

  .index .download-tap {
    grid-area: tap;
    width: min(100%, 120px) !important;
    height: auto !important;
    aspect-ratio: 70 / 120;
    margin: 0 !important;
  }

  .index .download > div:nth-child(2) {
    grid-area: phones;
    width: 100% !important;
    height: auto !important;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: clamp(6px, 2vw, 12px);
  }

  .index .download-phone {
    width: min(100%, 230px) !important;
    height: auto !important;
    aspect-ratio: 182 / 55;
  }

  .index .download-phone.appstore {
    margin-top: 0 !important;
  }

  .index .download-code {
    grid-area: code;
    width: min(100%, 140px) !important;
    height: auto !important;
    aspect-ratio: 5 / 6;
    margin: 0 !important;
  }

  .index .download-code > div {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
  }

  .index .download-code-show {
    width: calc(100% - 1rem) !important;
    height: calc(100% - 1rem) !important;
    margin: 0.5rem !important;
  }

  .index .download-pc {
    grid-area: pc;
    width: min(100%, 120px) !important;
    height: auto !important;
    aspect-ratio: 7 / 12;
    margin: 0 !important;
  }

  .index .download img {
    display: block;
    width: 100%;
    height: auto;
  }

  .index .download-tap > img,
  .index .download-pc img {
    height: 100%;
    object-fit: fill;
  }

  .index .download-tap.download-unavailable > span {
    left: 1px !important;
    right: 1px !important;
    bottom: 1px !important;
    height: 30px !important;
    box-sizing: border-box;
    overflow: hidden;
    font-size: clamp(12px, 3.5vw, 16px) !important;
    line-height: 1 !important;
    letter-spacing: 0.04em !important;
  }
}

/* v12: translucent controls and keep mobile filing text clear of the download panel. */
.index .download-tap > img,
.index .download-phone img,
.index .download-code > div > img,
.index .download-pc img {
  opacity: 0.78;
}
.index .download-code-show img {
  opacity: 0.92;
}
.index .download-tap.download-unavailable > span {
  background: rgba(5, 5, 7, 0.72) !important;
}

@media (max-width: 480px) {
  .index .download {
    bottom: clamp(82px, 14vh, 120px) !important;
  }

  .index .download-tap.download-unavailable > span {
    height: 30px !important;
    padding: 0 3px !important;
    white-space: nowrap;
    font-size: clamp(12px, 3.5vw, 16px) !important;
  }

  .site-records {
    right: 8px !important;
    bottom: 8px !important;
    z-index: 30 !important;
    gap: 3px !important;
  }

  .site-records a {
    white-space: nowrap !important;
    line-height: 1.15 !important;
    font-size: 9px !important;
  }
}

/* v13: mobile uses a compact two-column composition instead of a scaled desktop row. */
@media (max-width: 480px) {
  .index .download {
    width: min(calc(100vw - 48px), 340px) !important;
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.58fr) !important;
    gap: 8px 10px !important;
    bottom: clamp(76px, 9vh, 96px) !important;
  }

  .index .download-tap {
    width: clamp(76px, 24vw, 102px) !important;
  }

  .index .download-phone {
    width: min(100%, clamp(170px, 49vw, 210px)) !important;
  }

  .index .download-code {
    width: clamp(76px, 24vw, 102px) !important;
  }

  .index .download-pc {
    width: clamp(76px, 24vw, 102px) !important;
  }
}

/* v14: mobile-only horizontal download buttons with icon on the left and label on the right. */
.mobile-downloads {
  display: none;
}

@media (max-width: 480px) {
  .index .download {
    display: none !important;
  }

  .index .mobile-downloads {
    position: absolute;
    left: 50%;
    bottom: clamp(80px, 10vh, 100px);
    z-index: 14;
    display: flex !important;
    width: min(88vw, 320px);
    flex-direction: column;
    gap: 8px;
    transform: translateX(-50%);
  }

  .mobile-download-item {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 54px;
    box-sizing: border-box;
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, 0.66);
    border-radius: 4px;
    color: #fff;
    background: rgba(5, 8, 15, 0.58);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
    text-decoration: none;
    appearance: none;
    font-family: "Microsoft YaHei", "SourceHanSansCN-Regular", sans-serif;
    cursor: pointer;
  }

  .mobile-download-item:hover,
  .mobile-download-item:focus-visible {
    background: rgba(20, 27, 46, 0.72);
    outline: none;
  }

  .mobile-download-icon {
    display: flex;
    flex: 0 0 36px;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-right: 12px;
  }

  .mobile-download-icon img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 100%;
    filter: brightness(0) invert(1);
  }

  .mobile-tap-icon {
    width: 34px;
    height: 34px;
    margin-right: 14px;
    border-radius: 8px;
    color: #fff;
    background: #08c8d4;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.04em;
  }

  .mobile-download-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    line-height: 1.15;
  }

  .mobile-download-copy strong {
    overflow: hidden;
    max-width: 100%;
    color: #fff;
    font-size: clamp(15px, 4.2vw, 18px);
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .mobile-download-copy small {
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.86);
    font-size: 11px;
    line-height: 1;
  }

  .mobile-download-unavailable {
    cursor: default;
  }

  .mobile-download-unavailable .mobile-download-copy strong {
    color: rgba(255, 255, 255, 0.92);
  }

  .mobile-qr-icon {
    overflow: hidden;
    box-sizing: border-box;
    padding: 3px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.92);
  }

  .mobile-qr-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: none;
  }

  .mobile-download-qr-popover {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    z-index: 20;
    display: none;
    width: min(62vw, 220px);
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 6px;
    background: rgba(5, 8, 15, 0.86);
    transform: translateX(-50%);
  }

  .mobile-download-qr-popover img {
    display: block;
    width: 100%;
    height: auto;
  }

  .mobile-download-qr.is-open .mobile-download-qr-popover {
    display: block;
  }
}

/* v15: unify mobile platform icons and center the complete control group. */
@media (max-width: 480px) {
  .index .mobile-downloads {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: clamp(16px, 5vh, 32px);
    width: auto;
    transform: none;
  }

  .mobile-download-item {
    justify-content: center;
  }

  .mobile-download-icon,
  .mobile-tap-icon {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    margin-right: 12px;
  }

  .mobile-download-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
  }
}

/* v16: replace the unavailable QR bitmap placeholder with a matching lightweight glyph and keep H5 filings visible. */
@media (max-width: 480px) {
  .mobile-qr-glyph {
    display: block;
    width: 26px;
    height: 26px;
    border: 3px solid #fff;
    box-sizing: border-box;
    background:
      linear-gradient(#fff, #fff) 4px 4px / 5px 5px no-repeat,
      linear-gradient(#fff, #fff) 14px 4px / 5px 5px no-repeat,
      linear-gradient(#fff, #fff) 4px 14px / 5px 5px no-repeat,
      linear-gradient(#fff, #fff) 14px 14px / 5px 5px no-repeat;
  }

  .site-records {
    right: 12px !important;
    bottom: 6px !important;
    left: 12px !important;
    justify-content: center;
    gap: 10px !important;
  }

  .site-records a {
    font-size: 9px !important;
  }

  .index .mobile-downloads {
    bottom: clamp(30px, 5vh, 42px);
  }
}

/* v17: compact centered mobile controls; keep the filing pair clear of the age-rating area. */
@media (max-width: 480px) {
  .index .mobile-downloads {
    left: 50%;
    right: auto;
    width: min(220px, calc(100vw - 32px));
    bottom: clamp(48px, 7vh, 64px);
    transform: translateX(-50%);
  }

  .mobile-download-item {
    padding-left: 10px;
    padding-right: 10px;
  }

  .mobile-download-icon,
  .mobile-tap-icon {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
    margin-right: 10px;
  }

  .mobile-download-copy {
    flex: 0 1 auto;
    text-align: left;
  }

  .site-records {
    right: 12px !important;
    bottom: 8px !important;
    left: auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    justify-content: center !important;
    gap: 1px !important;
    line-height: 1.1 !important;
  }

  .site-records a {
    font-size: 9px !important;
    line-height: 1.1 !important;
  }
}

@media (max-width: 480px) and (max-height: 600px) {
  .index .mobile-downloads {
    bottom: 42px;
    gap: 5px;
  }

  .mobile-download-item {
    min-height: 48px;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .mobile-download-icon,
  .mobile-tap-icon {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
  }

  .mobile-download-icon img {
    width: 24px;
    height: 24px;
  }
}


/* v18: keep the H5 brand mark centered above the mobile download controls. */
@media (max-width: 480px) {
  .index .logo {
    position: absolute !important;
    top: clamp(180px, 26vh, 260px) !important;
    left: 50% !important;
    right: auto !important;
    margin: 0 !important;
    transform: translateX(-50%) !important;
    transform-origin: center center;
    z-index: 13 !important;
  }
}


/* v19: enlarge the centered mobile brand mark only; desktop keeps its original dimensions. */
@media (max-width: 480px) {
  .index .logo {
    width: 67.8rem !important;
    height: 24rem !important;
  }
}

/* v21: enlarge the H5 brand mark and center it in the open space above the download buttons. */
@media (max-width: 480px) {
  .index {
    --mobile-download-bottom: clamp(48px, 7vh, 64px);
    --mobile-download-stack-height: 302px;
  }

  .index .mobile-downloads {
    bottom: var(--mobile-download-bottom) !important;
  }

  .index .logo {
    top: calc((100svh - var(--mobile-download-stack-height) - var(--mobile-download-bottom)) / 2) !important;
    width: min(280px, calc(100vw - 40px)) !important;
    height: auto !important;
    aspect-ratio: 550 / 420;
    transform: translate(-50%, -50%) !important;
  }

  .index .logo img {
    display: block;
    width: 100% !important;
    height: auto !important;
    object-fit: contain;
  }
}

@media (max-width: 480px) and (max-height: 600px) {
  .index {
    --mobile-download-bottom: 42px;
    --mobile-download-stack-height: 260px;
  }
}
