/* 手机：允许双指缩放整页，布局由 JS 在 scale=1 时锁定 */
@media (hover: none) and (pointer: coarse) {
  html,
  body {
    touch-action: pan-x pan-y pinch-zoom;
  }
}

@font-face {
  font-family: 'GenWanMinF';
  src: url('../fonts/源古黑體-F.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MV Boli';
  src: url('../fonts/mvboli.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* —— 手机竖屏：全站强制横屏提示（中英对照；桌面不受影响） —— */
.shell-orientation-hint {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px))
    max(20px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
  background: #ffffff;
  color: #0a1628;
}

.shell-orientation-hint__card {
  width: min(92vw, 360px);
  padding: 28px 22px;
  border: 3px solid #2d7fde;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(45, 127, 222, 0.16);
}

.shell-orientation-hint__icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border: 3px solid #2d7fde;
  border-radius: 14px;
  background: #ffffff;
  position: relative;
  animation: shell-hint-rotate 2.2s ease-in-out infinite;
}

.shell-orientation-hint__icon::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 14px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: #2d7fde;
}

@keyframes shell-hint-rotate {
  0%,
  100% {
    transform: rotate(0deg);
  }
  45% {
    transform: rotate(90deg);
  }
  55% {
    transform: rotate(90deg);
  }
}

.shell-orientation-hint__pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  align-items: start;
  text-align: left;
}

.shell-orientation-hint__pair--title {
  margin-bottom: 14px;
}

.shell-orientation-hint__pair--body {
  padding-top: 14px;
  border-top: 1px solid rgba(45, 127, 222, 0.28);
}

.shell-orientation-hint__zh {
  margin: 0;
  font-family: 'GenWanMinF', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 18px;
  line-height: 1.4;
  font-weight: 700;
  color: #0859b6;
}

.shell-orientation-hint__pair--body .shell-orientation-hint__zh {
  font-size: 14px;
  font-weight: 400;
  color: #1a3a5c;
}

.shell-orientation-hint__en {
  margin: 0;
  font-family: 'MV Boli', cursive;
  font-size: 16px;
  line-height: 1.4;
  color: #0859b6;
}

.shell-orientation-hint__pair--body .shell-orientation-hint__en {
  font-size: 13px;
  color: #1a3a5c;
}

@media (orientation: portrait) and (max-width: 1024px) {
  html.shell--portrait-blocked,
  html,
  body.shell--portrait-blocked,
  body.archive--portrait-blocked {
    background: #ffffff;
    min-height: 100dvh;
    height: 100dvh;
  }

  .shell-orientation-hint {
    display: flex;
    width: 100%;
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    height: 100%;
    background: #ffffff;
  }

  body.shell--portrait-blocked,
  body.archive--portrait-blocked {
    overflow: hidden;
  }

  body.shell--portrait-blocked .shell-orientation-block,
  body.archive--portrait-blocked .archive-viewport {
    visibility: hidden;
    pointer-events: none;
  }
}

/* —— 手机横屏：布局视口铺满；双指缩放不改变布局 —— */
@media (orientation: landscape) and (max-width: 1024px) {
  html,
  body {
    height: var(--shell-vv-height, 100dvh);
    min-height: var(--shell-vv-height, 100dvh);
    max-height: var(--shell-vv-height, 100dvh);
    overflow: hidden;
  }

  .archive-viewport,
  .shell-orientation-block {
    height: var(--shell-vv-height, 100dvh);
    max-height: var(--shell-vv-height, 100dvh);
  }

  .home-page {
    inset: 0;
    top: 0;
    left: 0;
    right: auto;
    bottom: auto;
    width: 100%;
    height: var(--shell-vv-height, 100dvh);
    max-height: var(--shell-vv-height, 100dvh);
  }
}

html:fullscreen,
html:-webkit-full-screen,
html:-ms-fullscreen {
  width: 100%;
  height: 100%;
}

html:fullscreen body,
html:-webkit-full-screen body,
html:-ms-fullscreen body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body.shell--fullscreen .archive-viewport,
body.shell--fullscreen .shell-orientation-block,
body.shell--fullscreen .home-page {
  height: 100%;
  max-height: 100%;
}

/* —— 主屏幕独立模式：铺满窗口，不预留 Safari 地址栏偏移 —— */
@media (orientation: landscape) and (max-width: 1024px) {
  html.shell--standalone,
  html.shell--standalone body {
    height: 100%;
    min-height: 100%;
    max-height: 100%;
  }

  html.shell--standalone .archive-viewport,
  html.shell--standalone .shell-orientation-block {
    height: 100%;
    max-height: 100%;
  }

  html.shell--standalone .home-page {
    inset: 0;
    top: 0;
    left: 0;
    right: auto;
    bottom: auto;
    width: 100%;
    height: 100%;
    max-height: 100%;
  }
}

/* —— iOS Safari：添加到主屏幕短引导（仅横屏、非主屏幕模式） —— */
.shell-ios-hint {
  position: fixed;
  top: auto;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  width: 100%;
  box-sizing: border-box;
  padding: 8px max(12px, env(safe-area-inset-right, 0px))
    max(8px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  background: #ffffff;
  pointer-events: auto;
}

.shell-ios-hint[hidden] {
  display: none;
}

.shell-ios-hint__card {
  width: min(94vw, 520px);
  margin: 0 auto;
  padding: 10px 12px 12px;
  border: 3px solid #2d7fde;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(45, 127, 222, 0.2);
}

.shell-ios-hint__title-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 0 0 8px;
  align-items: baseline;
}

.shell-ios-hint__title-pair .shell-ios-hint__zh {
  font-size: 15px;
  font-weight: 700;
}

.shell-ios-hint__title-pair .shell-ios-hint__en {
  font-size: 14px;
}

.shell-ios-hint__steps {
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
  counter-reset: ios-step;
}

.shell-ios-hint__step {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  margin: 0 0 6px;
  padding: 0;
  counter-increment: ios-step;
}

.shell-ios-hint__step:last-child {
  margin-bottom: 0;
}

.shell-ios-hint__step .shell-ios-hint__zh::before,
.shell-ios-hint__step .shell-ios-hint__en::before {
  content: counter(ios-step) '. ';
  font-weight: 700;
  color: #2d7fde;
}

.shell-ios-hint__zh {
  margin: 0;
  font-family: 'GenWanMinF', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 12px;
  line-height: 1.38;
  color: #1a3a5c;
}

.shell-ios-hint__en {
  margin: 0;
  font-family: 'MV Boli', cursive;
  font-size: 11px;
  line-height: 1.38;
  color: #1a3a5c;
}

.shell-ios-hint__zh strong,
.shell-ios-hint__en strong {
  color: #0859b6;
  font-weight: 700;
}

.shell-ios-hint__share-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
  white-space: nowrap;
}

.shell-ios-hint__share-icon {
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  object-fit: contain;
}

.shell-ios-hint__dismiss {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 12px;
  border: 2px solid #2d7fde;
  border-radius: 10px;
  background: #ffffff;
  color: #0859b6;
  font-family: 'GenWanMinF', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
}

.shell-ios-hint__dismiss:active {
  background: #e8f3ff;
}

@media (orientation: landscape) and (max-width: 1024px) {
  body.shell--ios-hint-visible {
    --shell-ios-hint-offset: 118px;
  }

  body.shell--ios-hint-visible .shell-ios-hint {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: calc(var(--shell-ios-hint-offset, 118px) + env(safe-area-inset-bottom, 0px));
  }

  body.shell--ios-hint-visible .archive-viewport,
  body.shell--ios-hint-visible .shell-orientation-block {
    padding-bottom: calc(var(--shell-viewport-pad-bottom, 12px) + var(--shell-ios-hint-offset, 0px));
    box-sizing: border-box;
  }

  body.shell--ios-hint-visible .home-page {
    height: calc(var(--shell-vv-height, 100dvh) - var(--shell-ios-hint-offset, 0px));
    max-height: calc(var(--shell-vv-height, 100dvh) - var(--shell-ios-hint-offset, 0px));
  }
}

/* —— Wix iframe 嵌入：铺满 iframe，不显示「添加到主屏幕」引导 —— */
html.shell--embed,
html.shell--embed body {
  height: 100%;
  min-height: 100%;
  max-height: 100%;
  overflow: hidden;
}

html.shell--embed body {
  background: transparent;
}

html.shell--embed body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: #c8dff5;
  background-image: url('../bg-vertical.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

html.shell--embed .shell-ios-hint {
  display: none !important;
}

html.shell--embed .archive-viewport,
html.shell--embed .shell-orientation-block,
html.shell--embed .home-page {
  width: 100%;
  height: var(--shell-vv-height, 100%);
  max-height: var(--shell-vv-height, 100%);
}

html.shell--embed .archive-viewport {
  --shell-viewport-pad-fluid: clamp(4px, 1vmin, 12px);
  --shell-viewport-pad-bottom: max(4px, env(safe-area-inset-bottom, 0px));
  position: fixed;
  inset: 0;
  width: 100%;
  height: var(--shell-vv-height, 100%);
  max-height: var(--shell-vv-height, 100%);
}

html.shell--embed body {
  display: block;
}

@media (orientation: landscape) and (max-width: 1024px) {
  html.shell--embed,
  html.shell--embed body {
    height: var(--shell-vv-height, 100%);
    min-height: var(--shell-vv-height, 100%);
    max-height: var(--shell-vv-height, 100%);
  }

  html.shell--embed .archive-viewport,
  html.shell--embed .shell-orientation-block,
  html.shell--embed .home-page {
    height: var(--shell-vv-height, 100%);
    max-height: var(--shell-vv-height, 100%);
  }
}
