/**
 * 手机端专用（不影响 ≥921px 电脑布局）
 * 1) @media (max-width:920px)
 * 2) html/body.is-mobile-view 双保险
 */

@media (max-width: 920px) {
  html, body, body.wish-site {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  body.wish-site {
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important;
    background: #ffe8ec !important;
    box-sizing: border-box;
  }

  /* 手机不显示表白文字 / 标题文案 */
  .mobile-letter,
  .mobile-letter.is-show,
  #mobile-letter,
  #mobile-letter.is-show {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .site-hero-bar {
    display: none !important;
  }
  #page-loading {
    font-size: 13px !important;
  }

  #main {
    padding: 0 !important;
    overflow: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  #tree-stage {
    width: 100% !important;
    max-width: 100vw !important;
    margin: 8vh auto 6px !important;
    overflow: hidden !important;
    background: #ffe !important;
    border-radius: 0 0 18px 18px;
    box-shadow: 0 8px 24px rgba(180, 50, 70, .08);
    min-height: 360px !important;
  }

  #wrap {
    width: 1100px !important;
    height: 680px !important;
    min-height: 680px !important;
    max-width: none !important;
    margin: 0 !important;
    position: relative !important;
    overflow: hidden !important;
    transform-origin: top left !important;
    background: #ffe !important;
  }

  #canvas {
    width: 1100px !important;
    height: 680px !important;
    max-width: none !important;
    display: block !important;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  #wrap #text,
  #wrap #clock-box {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  #wish-layer {
    width: 1100px !important;
    height: 680px !important;
  }

  #tree-sparkles {
    width: 1100px !important;
    height: 680px !important;
  }

  #music-toggle {
    top: 10px !important;
    right: 10px !important;
    width: 38px !important;
    height: 38px !important;
    z-index: 80 !important;
  }

  #page-loading {
    z-index: 70 !important;
    max-width: 86vw !important;
    font-size: 13px !important;
    padding: 8px 14px !important;
    border-radius: 999px !important;
  }

  #wish-btn-group {
    display: none !important;
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    top: auto !important;
    bottom: max(12px, env(safe-area-inset-bottom, 0px)) !important;
    margin: 0 !important;
    transform: translateX(-50%) !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    z-index: 100020 !important;
    padding: 8px 10px !important;
    max-width: 94vw !important;
    width: auto !important;
    background: rgba(255, 247, 248, .96) !important;
    border: 1px solid #f0d0d6 !important;
    border-radius: 999px !important;
    box-shadow: 0 12px 32px rgba(160, 40, 60, .2) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  #wish-btn-group.wish-btns-on,
  #wish-btn-group.wish-btns-ready {
    display: flex !important;
  }
  #wish-btn-group .tree-action,
  #wish-btn-group #wish-btn,
  #wish-btn-group #wish-list-btn,
  #wish-btn-group #wish-wall-link {
    position: relative !important;
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 46px !important;
    padding: 12px 14px !important;
    border-radius: 999px !important;
    font-size: 14px !important;
    margin: 0 !important;
  }
  #wish-btn-group #wish-btn {
    background: linear-gradient(145deg, #e0455c, #c41e3a) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 6px 16px rgba(196, 30, 58, .35) !important;
  }
  #wish-btn-group #wish-list-btn {
    background: #fff !important;
    color: #b4233a !important;
    border: 1px solid #e39aaa !important;
  }

  /* 表白文案手机关闭（覆盖下方旧规则） */
  .mobile-letter,
  .mobile-letter.is-show,
  #mobile-letter,
  #mobile-letter.is-show {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #wish-dialog,
  #wish-dialog.wish-dialog-card {
    width: min(400px, 92vw) !important;
    max-height: 84vh !important;
    overflow: auto !important;
    left: 50% !important;
    top: 45% !important;
    transform: translate(-50%, -50%) !important;
    -webkit-transform: translate(-50%, -50%) !important;
  }
  #wish-detail {
    width: min(360px, 92vw) !important;
    left: 50% !important;
    top: 45% !important;
    transform: translate(-50%, -50%) !important;
  }

  #wish-wall.wish-wall-panel.is-open {
    display: flex !important;
    width: min(520px, 94vw) !important;
    max-height: min(84vh, 680px) !important;
    top: 46% !important;
  }
  .wish-wall:not(.wish-wall-panel),
  #wish-wall:not(.wish-wall-panel),
  .site-footer {
    display: none !important;
  }
}

/* JS 类名双保险（与媒体查询同断点逻辑） */
html.is-mobile-view body,
body.is-mobile-view {
  overflow-x: hidden !important;
  max-width: 100vw !important;
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important;
  background: #ffe8ec !important;
}
html.is-mobile-view #wrap #text,
html.is-mobile-view #wrap #clock-box,
body.is-mobile-view #wrap #text,
body.is-mobile-view #wrap #clock-box {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
html.is-mobile-view #wish-btn-group,
body.is-mobile-view #wish-btn-group {
  display: none !important;
  position: fixed !important;
  left: 50% !important;
  top: auto !important;
  bottom: max(12px, env(safe-area-inset-bottom, 0px)) !important;
  margin: 0 !important;
  transform: translateX(-50%) !important;
  flex-direction: row !important;
  z-index: 100020 !important;
  border-radius: 999px !important;
}
html.is-mobile-view #wish-btn-group.wish-btns-on,
html.is-mobile-view #wish-btn-group.wish-btns-ready,
body.is-mobile-view #wish-btn-group.wish-btns-on,
body.is-mobile-view #wish-btn-group.wish-btns-ready {
  display: flex !important;
}
html.is-mobile-view #mobile-letter,
html.is-mobile-view #mobile-letter.is-show,
body.is-mobile-view #mobile-letter,
body.is-mobile-view #mobile-letter.is-show,
html.is-mobile-view .site-hero-bar,
body.is-mobile-view .site-hero-bar {
  display: none !important;
  visibility: hidden !important;
}

/* 手机吊牌略放大（相对桌面仍略小，避免叠成一团） */
html.is-mobile-view .wish-tag,
html.is-mobile-view .wish-tag.size-sm,
html.is-mobile-view .wish-tag.size-md,
html.is-mobile-view .wish-tag.size-lg,
body.is-mobile-view .wish-tag,
body.is-mobile-view .wish-tag.size-sm,
body.is-mobile-view .wish-tag.size-md,
body.is-mobile-view .wish-tag.size-lg {
  width: 66px !important;
  max-width: 66px !important;
  font-size: 11px !important;
  line-height: 1.3 !important;
  padding: 8px 5px 9px !important;
  margin-left: -33px !important;
}
html.is-mobile-view .wish-tag .wish-heart,
body.is-mobile-view .wish-tag .wish-heart {
  font-size: 12px !important;
  margin-bottom: 2px !important;
}
html.is-mobile-view .wish-tag .wish-name,
body.is-mobile-view .wish-tag .wish-name {
  font-size: 9px !important;
}

/* 发芽前不再隐藏整页——树区域始终保留；仅弱化提示条位置 */
html.is-mobile-view.seed-focus #tree-stage,
body.is-mobile-view.seed-focus #tree-stage {
  margin-top: 12vh !important;
  margin-bottom: 8px !important;
  background: #ffe !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}
html.is-mobile-view #tree-stage,
body.is-mobile-view #tree-stage {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  min-height: 320px !important;
}
html.is-mobile-view.tree-settled #tree-stage,
body.is-mobile-view.tree-settled #tree-stage {
  margin-left: auto !important;
  margin-right: auto !important;
}

/* 电脑端强制不受手机类影响（双保险） */
@media (min-width: 921px) {
  html.is-mobile-view #wrap #text,
  html.is-mobile-view #wrap #clock-box,
  body.is-mobile-view #wrap #text,
  body.is-mobile-view #wrap #clock-box {
    display: revert !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  html.is-mobile-view #wish-btn-group,
  body.is-mobile-view #wish-btn-group {
    position: absolute !important;
    left: 50% !important;
    top: 210px !important;
    bottom: auto !important;
    margin: 0 0 0 390px !important;
    transform: none !important;
    flex-direction: column !important;
    z-index: 40 !important;
    border-radius: 22px !important;
  }
  .mobile-letter,
  #mobile-letter {
    display: none !important;
  }
}
