/* 首屏优化候选 V1（qingxu_h5_home_opt_v1）— 只叠加，不修改任何既有样式文件。
 *
 * 三件事，全部来自真机渲染实测（390x844 / DPR3）：
 *   1) 首屏图 6.15MB → 响应式 AVIF/WebP（最大 120KB），并预留画框比例，
 *      消除实测到的 454px 入口位移与 CLS 0.65；
 *   2) 「开始测试 / 输入邀请码」改成真正的 HTML 按钮（有文字、有焦点态、自己可点），
 *      不再只是压在图片上的透明热点；
 *   3) 图片到达前的空白区给出同色系底，避免 4G 下前 11 秒近乎白屏。
 * 视觉沿用原海报的度量：pill 位置来自 exact-v3.css 的百分比几何，颜色取自海报像素。
 */

/* 1) 预留画框：图片没到也占好位置，整屏不再跳动 */
#homeView.home-canvas {
  aspect-ratio: auto;
}
#homeView.home-canvas > .home-visual-wrap {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 941 / 1672;
  background:
    linear-gradient(180deg, #ffffff 0%, #f4f8ff 46%, #eef4fe 74%, #ffffff 100%);
  overflow: hidden;
}
#homeView.home-canvas > .home-visual-wrap::before {
  /* 海报边框的提前占位：图片到达前这块区域看起来就是「同一张纸」而不是空白 */
  content: "";
  position: absolute;
  inset: 2.6% 3.1%;
  border: 1px solid rgba(20, 87, 200, 0.28);
  border-radius: 3px;
  pointer-events: none;
}
#homeView .home-visual-picture {
  position: absolute;
  inset: 0;
  display: block;
}
#homeView .home-visual-wrap > .home-visual {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  z-index: 0;
}
#homeView .home-visual-wrap > .hotspot {
  z-index: 5;
}

/* 2) 真正的可点按钮 */
.home-entry {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  padding: 0;
  border-radius: 999px;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, box-shadow 0.16s ease, filter 0.16s ease;
}
.home-entry--primary {
  left: 18.2%;
  top: 65.1%;
  width: 63.8%;
  height: 7.8%;
  background: linear-gradient(180deg, #2258c2 0%, #1a4eb2 100%);
  border: 1px solid #1a4eb2;
  color: #ffffff;
  font-size: clamp(15px, 4.6vw, 19px);
  letter-spacing: 0.18em;
  text-indent: 0.18em; /* 让中文在圆角胶囊里视觉居中 */
  box-shadow: 0 8px 22px rgba(18, 60, 140, 0.20);
}
.home-entry--primary:hover {
  box-shadow: 0 10px 26px rgba(18, 60, 140, 0.26);
}
.home-entry--primary:active {
  transform: translateY(1px) scale(0.996);
}
.home-entry--ghost {
  left: 18.2%;
  top: 73.6%;
  width: 63.8%;
  height: 6.6%;
  background: #ffffff;
  border: 1px solid #8fb3ef;
  color: #1457c8;
  font-size: clamp(13px, 4vw, 16px);
  letter-spacing: 0.24em;
  text-indent: 0.24em;
}
.home-entry--ghost:active {
  background: #eef4ff;
}
.home-entry-arrow {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.92em;
  text-indent: 0;
  opacity: 0.92;
}
.home-entry:focus-visible {
  outline: 2px solid #0a43a2;
  outline-offset: 3px;
}

/* 早到的那一次点击：立刻给出反馈，而不是无声消失 */
.home-entry.is-preparing {
  filter: saturate(0.72) brightness(1.04);
}
.home-entry.is-preparing::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  border: 1px solid rgba(20, 87, 200, 0.5);
  animation: home-entry-pulse 0.9s ease-out infinite;
}
@keyframes home-entry-pulse {
  0% { opacity: 0.7; transform: scale(0.98); }
  100% { opacity: 0; transform: scale(1.04); }
}
@media (prefers-reduced-motion: reduce) {
  .home-entry,
  .home-entry.is-preparing::after {
    transition: none;
    animation: none;
  }
}

/* 3) 首屏之下的说明文字保持原样，只在窄屏上稍微收紧，避免入口被挤到折叠线以下 */
@media (max-width: 360px) {
  #homeView.home-canvas > .home-visual-wrap {
    aspect-ratio: 941 / 1600;
  }
}


/* —— 第二阶段：弹窗兼容层 ——
   showModal 不可用时，dialog 退化成一个居中的强制覆盖层。没有 ::backdrop 可用，
   所以遮罩画在 dialog 自己的 ::before 上（画在 body 上会被祖先层叠上下文压住，
   实测会把弹窗里的按钮点击整个拦掉）。 */
body.dlg-layer-lock { overflow: hidden; }
/* 抬到首屏热点之上：`#homeView.home-canvas > *` 的 z-index:1 特异性比裸标签选择器高，
   实测会让兜底层的输入框被入口按钮盖住（点不到昵称框）。 */
#homeView.home-canvas > dialog.dlg-forced-open,
dialog.dlg-forced-open {
  position: fixed;
  inset: 0;
  z-index: 90;
  /* 遮罩画在 dialog 自己的 ::before 上：
     用 body 伪元素会被祖先层叠上下文压住，实测会把按钮的点击整个拦掉。 */
  box-shadow: none;
  display: block;
  width: min(calc(100vw - 36px), 360px);
  height: max-content;
  max-height: calc(100vh - 48px);
  margin: auto;
}
dialog.dlg-forced-open::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(5, 20, 50, 0.28);
}

