/* 999 朵粉色玫瑰 · 慢慢绽放 ── 页面外壳样式（画面本身全部由 Canvas 绘制） */

:root {
  color-scheme: light;
  --ink: #4a2340;
  --pink: #ff8fb3;
  --pink-deep: #e8577f;
}

/* 自托管花体字：OFL 许可的 Great Vibes（latin 子集），保证所有设备上字型一致 */
@font-face {
  font-family: "Rose Script";
  src: url("../assets/fonts/great-vibes-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #9fd2f2;
  overscroll-behavior: none;
}

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

#scene {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
}

/* 暗角放在 DOM 层，交给合成器处理，省掉每帧一次全屏渐变填充 */
.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 50% 52%,
    rgba(18, 32, 52, 0) 40%,
    rgba(18, 32, 52, 0.1) 74%,
    rgba(18, 32, 52, 0.22) 100%
  );
}

/* ---------- 底部文案与重播 ---------- */

.ui {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
  padding: 0 20px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 1.6s ease 1.4s, transform 1.6s ease 1.4s;
}

.is-ready .ui {
  opacity: 1;
  transform: none;
}

.caption {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  letter-spacing: 0.22em;
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.9), 0 0 24px rgba(255, 176, 208, 0.75),
    0 2px 14px rgba(255, 150, 190, 0.55);
  text-align: center;
}

.caption .num {
  font-size: 1.38em;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.95), 0 0 22px rgba(255, 168, 204, 0.85);
}

/* 署名与句子同一行：紧跟「为你慢慢绽放」后面 */
.signature {
  display: inline-block;
  margin-left: 0.12em;
  font-family: "Rose Script", "Snell Roundhand", "Apple Chancery", "Segoe Script",
    "Brush Script MT", cursive;
  font-style: normal;
  font-weight: 400;
  font-size: 1.62em;
  line-height: 1;
  letter-spacing: 0.02em;
  color: #fff;
  white-space: nowrap;
  vertical-align: -0.06em;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.95), 0 0 30px rgba(255, 170, 205, 0.8),
    0 2px 16px rgba(255, 150, 190, 0.6);
}

/* 句子与署名之间的间隔点 */
.sig-sep {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.7em;
  opacity: 1;
  margin: 0 0.4em 0 0.16em;
  vertical-align: 0.2em;
}

.signature-cn {
  font-family: "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif;
  font-size: 0.8em;
  letter-spacing: 0.04em;
  padding-left: 0.02em;
  vertical-align: 0.04em;
}

/* 底部按钮组：主按钮「打开花束」+ 次按钮「重新绽放」 */
.ui-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  pointer-events: none;
}

.btn-bouquet,
.replay {
  pointer-events: auto;
}

.btn-bouquet {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 26px 10px;
  font-family: "Songti SC", "STSong", "SimSun", "Noto Serif SC", "Source Han Serif SC", serif;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  color: #fff;
  text-decoration: none;
  background:
    radial-gradient(120% 170% at 18% 0%, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 58%),
    linear-gradient(135deg, #ffb2ca 0%, #e8577f 52%, #c03460 100%);
  border: 1px solid rgba(255, 230, 238, 0.78);
  border-radius: 999px;
  box-shadow:
    0 8px 24px rgba(178, 42, 88, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 0 0 4px rgba(255, 255, 255, 0.1);
  text-shadow: 0 1px 2px rgba(140, 30, 70, 0.35);
  transition: transform 0.28s ease, box-shadow 0.28s ease, filter 0.28s ease;
  overflow: hidden;
}

/* 高光扫过 */
.btn-bouquet::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 999px;
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0) 34%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 66%
  );
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.btn-bouquet:hover,
.btn-bouquet:focus-visible {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow:
    0 12px 30px rgba(178, 42, 88, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 0 0 5px rgba(255, 255, 255, 0.14);
  outline: none;
}

.btn-bouquet:hover::after,
.btn-bouquet:focus-visible::after {
  opacity: 1;
}

.btn-bouquet:active {
  transform: translateY(0) scale(0.985);
}

/* 宋体字距较大，用负右距把「花束」两个字拉回视觉中心 */
.btn-bouquet-label {
  letter-spacing: 0.42em;
  margin-right: -0.42em;
  padding-top: 1px;
}

.replay {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px 9px;
  font-family: "Songti SC", "STSong", "SimSun", "Noto Serif SC", "Source Han Serif SC", serif;
  font-size: 13px;
  letter-spacing: 0.24em;
  color: rgba(255, 255, 255, 0.96);
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(6px) saturate(1.2);
  -webkit-backdrop-filter: blur(6px) saturate(1.2);
  box-shadow: 0 4px 18px rgba(74, 24, 48, 0.16);
  transition: background 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}

.replay:hover,
.replay:focus-visible {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.8);
  transform: translateY(-1px);
  outline: none;
}

.replay:active {
  transform: translateY(0) scale(0.98);
}

.replay-ico {
  font-size: 14px;
  line-height: 1;
}

/* ---------- 首屏薄纱（遮挡精灵预渲染的几十毫秒） ---------- */

.veil {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #7cc0ec 0%, #b8dcf4 46%, #e8f4fb 100%);
  transition: opacity 1s ease;
  pointer-events: none;
}

.is-ready .veil {
  opacity: 0;
}

.veil-text {
  font-size: 12px;
  letter-spacing: 0.34em;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 8px rgba(52, 96, 128, 0.35);
  animation: breathe 2.4s ease-in-out infinite;
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

/* ---------- 移动端优化 ---------- */

@media (max-width: 640px) {
  .ui {
    gap: 10px;
    bottom: max(18px, env(safe-area-inset-bottom));
    padding: 0 14px;
  }

  .caption {
    font-size: 11.5px;
    letter-spacing: 0.1em;
    line-height: 1.75;
  }

  .caption .num {
    font-size: 1.3em;
  }

  .signature {
    font-size: 1.55em;
  }

  .signature-cn {
    font-size: 0.82em;
  }

  /* 触屏最小点击区 44px */
  .btn-bouquet,
  .replay {
    min-height: 44px;
  }

  .btn-bouquet {
    padding: 0 24px;
    font-size: 14px;
  }

  .btn-bouquet-label {
    letter-spacing: 0.36em;
    margin-right: -0.36em;
  }

  .replay {
    padding: 0 18px;
    font-size: 12.5px;
    gap: 6px;
  }

  .ui-actions {
    gap: 8px;
  }

  .veil-text {
    font-size: 11px;
    letter-spacing: 0.3em;
  }
}

/* 横屏手机 / 矮视口：文案竖排紧凑，别挡住画面 */
@media (max-height: 520px) {
  .ui {
    bottom: max(10px, env(safe-area-inset-bottom));
    gap: 5px;
    flex-direction: column;
    padding: 0 14px;
  }

  .caption {
    font-size: 10.5px;
    letter-spacing: 0.05em;
    line-height: 1.55;
  }

  .caption .num {
    font-size: 1.2em;
  }

  .signature {
    font-size: 1.5em;
  }

  .signature-cn {
    font-size: 0.82em;
  }

  .replay {
    min-height: 34px;
    padding: 0 13px;
    font-size: 10px;
    gap: 5px;
  }

  .btn-bouquet {
    min-height: 34px;
    padding: 0 16px;
    font-size: 11.5px;
  }

  .btn-bouquet-label {
    letter-spacing: 0.3em;
    margin-right: -0.3em;
  }

  .replay {
    min-height: 34px;
    padding: 0 14px;
    font-size: 11px;
    gap: 5px;
  }

  .ui-actions {
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .veil-text {
    animation: none;
  }
}
