/* ===== 七夕微电影 · 竖屏优先样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --pink: #ff8fb1;
  --gold: #ffd9a0;
  --soft: rgba(255, 255, 255, .88);
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", "Source Han Serif SC", serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
}

html, body {
  width: 100%; height: 100%;
  background: #05060f;
  overflow: hidden;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  /* 移动端：禁止长按选中、禁止橡皮筋滚动、禁止双击缩放 */
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}

#stage { position: fixed; inset: 0; overflow: hidden; }

canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#fx { pointer-events: none; }

/* 暗角 */
#vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 42%, rgba(0,0,0,0) 32%, rgba(0,0,0,.5) 100%);
  mix-blend-mode: multiply;
}
/* 柔光 */
#bloom {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at 50% 62%, rgba(255,190,220,.22), rgba(255,190,220,0) 62%);
  transition: opacity 1.6s ease;
}

/* ===== 文字层 ===== */
#texts { position: absolute; inset: 0; pointer-events: none; }

.cue {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) translateY(18px);
  width: min(88vw, 900px);
  text-align: center;
  opacity: 0;
  transition: opacity 1.5s ease, transform 1.8s cubic-bezier(.16,.8,.3,1), filter 1.5s ease;
  filter: blur(6px);
  will-change: opacity, transform;
  padding: 0 4vw;
}
.cue.on { opacity: 1; transform: translate(-50%, -50%) translateY(0); filter: blur(0); }

.cue .big {
  font-family: var(--serif);
  font-size: clamp(40px, 8.4vw, 96px);
  font-weight: 700;
  letter-spacing: .2em;
  text-indent: .2em;
  color: #fff;
  text-shadow: 0 0 26px rgba(255,170,205,.65), 0 0 70px rgba(255,120,180,.35), 0 2px 12px rgba(0,0,0,.5);
}
.cue .mid {
  font-family: var(--serif);
  font-size: clamp(22px, 4.4vw, 44px);
  font-weight: 500;
  letter-spacing: .12em;
  text-indent: .12em;
  color: rgba(255,255,255,.95);
  line-height: 2;
  text-shadow: 0 0 20px rgba(255,180,210,.5), 0 2px 10px rgba(0,0,0,.55);
  /* 防止长文本溢出：中文按字换行 */
  word-break: break-all;
  overflow-wrap: anywhere;
}
.cue .sub {
  margin-top: 20px;
  font-size: clamp(16px, 3.6vw, 26px);
  letter-spacing: .42em;
  text-indent: .42em;
  color: rgba(255,225,235,.7);
}
.cue .rule {
  width: 74px; height: 1px; margin: 22px auto 0;
  background: linear-gradient(90deg, transparent, rgba(255,200,220,.8), transparent);
}

/* ===== 信纸 ===== */
#letter {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(.94);
  width: min(90vw, 680px);
  max-height: 86vh;
  overflow: hidden;
  padding: clamp(28px, 5vw, 54px) clamp(24px, 5vw, 56px);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(255,252,248,.96), rgba(255,244,240,.93));
  box-shadow: 0 30px 80px rgba(60,10,40,.45), 0 0 0 1px rgba(255,255,255,.5) inset;
  opacity: 0; pointer-events: none;
  transition: opacity 2s ease, transform 2.4s cubic-bezier(.16,.8,.3,1);
}
#letter.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#letter::before {
  content: ""; position: absolute; inset: 10px; border: 1px solid rgba(200,120,150,.28);
  border-radius: 3px; pointer-events: none;
}
#letter .ln {
  font-family: var(--serif);
  font-size: clamp(16px, 3.2vw, 21px);
  line-height: 2.4;
  color: #5b2a3e;
  letter-spacing: .04em;
  opacity: 0; transform: translateY(10px);
  transition: opacity 1.1s ease, transform 1.1s ease;
}
#letter .ln.on { opacity: 1; transform: translateY(0); }
#letter .ln.sign { text-align: right; margin-top: 16px; color: #8a4560; }
#letter .ln.head { font-weight: 700; color: #3f1c2c; }

/* ===== 封面 ===== */
#cover {
  position: absolute; inset: 0; z-index: 30;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 24px;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 40%, #1b1030 0%, #07060f 70%);
  transition: opacity 1.1s ease, visibility 1.1s;
}
#cover.hide { opacity: 0; visibility: hidden; }
#cover h1 {
  font-family: var(--serif);
  font-size: clamp(36px, 11vw, 68px);
  font-weight: 700; color: #fff;
  letter-spacing: .26em; text-indent: .26em;
  text-shadow: 0 0 30px rgba(255,160,200,.6);
}
#cover .tip { color: rgba(255,225,240,.55); font-size: 13px; letter-spacing: .22em; text-indent: .22em; text-align: center; }
/* 封面顶部新增一行：字号取“四季予你”(h1) 的一半，颜色与“陪你走过春夏秋冬”(.tip) 一致 */
#cover .cover-top {
  color: rgba(255,225,240,.55);
  font-size: clamp(18px, 5.5vw, 34px);   /* h1 为 clamp(36px,11vw,68px)，此处取一半 */
  font-weight: 700;
  letter-spacing: .2em; text-indent: .2em;
  text-align: center;
}
/* 5 秒倒计时数字 */
#cd {
  margin-top: 4px;
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(64px, 20vw, 140px); line-height: 1.1; color: #fff;
  text-shadow: 0 0 34px rgba(255,160,200,.7), 0 0 80px rgba(255,120,180,.35);
}
#cd.tick { animation: cdPulse 1s ease-in-out; }
@keyframes cdPulse {
  0%   { transform: scale(1.55); opacity: 0; }
  22%  { transform: scale(1);    opacity: 1; }
  100% { transform: scale(.82);  opacity: .5; }
}
#cdHint { animation: hintBlink 1.4s ease-in-out infinite; }
@keyframes hintBlink { 0%,100% { opacity: .35; } 50% { opacity: .92; } }

/* ===== 进度条 + 播放时间（调试用，可被 HUD 内 ▤ 开关隐藏） ===== */
#scrubber {
  position: absolute; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 26;
  width: min(86vw, 720px);
  display: flex; align-items: center; gap: 12px;
  opacity: 1; transition: opacity .4s;
}
#scrubber.hide { opacity: 0; pointer-events: none; }
#bar {
  position: relative; flex: 1; height: 8px; border-radius: 999px;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.16);
  cursor: pointer; touch-action: none;
}
#bar:active { height: 10px; }
#fill {
  position: absolute; left: 0; top: 0; height: 100%; width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink), var(--gold));
  box-shadow: 0 0 10px rgba(255,143,177,.6);
  pointer-events: none;
}
#time {
  flex: none;
  font-size: 12px; letter-spacing: .06em;
  color: rgba(255,225,235,.85);
  font-variant-numeric: tabular-nums;
  min-width: 92px; text-align: center;
}

/* ===== HUD（播放 / 音乐开关，底部居中；触屏点按才出现，平常隐藏） ===== */
#hud {
  position: absolute; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 26;
  display: flex; align-items: center; gap: 18px;
  padding: 10px 18px; border-radius: 999px;
  background: rgba(8,6,16,.32); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.14);
  opacity: 0; transition: opacity .5s;
}
#hud.show { opacity: 1; }
.btn {
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.08); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: .25s; flex: none;
}
.btn:hover { background: rgba(255,143,177,.28); border-color: var(--pink); }

/* 结束卡 */
#end {
  position: absolute; inset: 0; z-index: 25;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: calc(30px + env(safe-area-inset-bottom, 0px));
  opacity: 0; visibility: hidden; transition: opacity 1s;
  pointer-events: none;        /* 透明区域不拦截点击，避免盖住 HUD/全屏按钮 */
}
#end.on { opacity: 1; visibility: visible; }
#end button {
  pointer-events: auto;        /* 仅“再看一遍”按钮可点 */
  padding: 13px 40px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255,190,215,.55);
  background: rgba(20,8,20,.35); backdrop-filter: blur(6px);
  color: #ffd9e6; font-size: 14px; letter-spacing: .3em; text-indent: .3em;
  font-family: var(--serif);
  transition: .3s;
}
#end button:hover { background: rgba(255,143,177,.25); }

/* ===== 全屏开关按钮 ===== */
.btn svg { width: 18px; height: 18px; display: block; }
.btn .ic-exit { display: none; }
.btn.active .ic-enter { display: none; }
.btn.active .ic-exit { display: block; }
/* 全屏开关按钮激活态（已进入全屏） */
.btn.active {
  background: rgba(255,143,177,.32);
  border-color: var(--pink);
  box-shadow: 0 0 12px rgba(255,143,177,.6);
}
/* 全屏且竖屏：把 #stage 旋转 90° 横向铺满全屏（全屏即横屏观看） */
html.fs-rotate #stage {
  position: fixed; top: 0; left: 0;
  width: 100vh; height: 100vw;
  transform: rotate(90deg) translateY(-100vw);
  transform-origin: 0 0;
}

/* ===== 竖屏 / 小屏增强 ===== */
@media (orientation: portrait) {
  .cue { width: 96vw; padding: 0; }
  .cue .big { font-size: clamp(30px, 8.5vw, 56px); letter-spacing: .06em; text-indent: .06em; }
  .cue .mid { font-size: clamp(17px, 4.4vw, 22px); letter-spacing: 0; text-indent: 0; line-height: 2; }
  .cue .sub { font-size: clamp(15px, 4vw, 20px); letter-spacing: .3em; text-indent: .3em; margin-top: 14px; }
  .cue .rule { margin-top: 14px; }
  #letter { width: 90vw; padding: clamp(26px, 7vw, 48px) clamp(22px, 6vw, 42px); }
  #letter .ln { font-size: clamp(17px, 4.6vw, 22px); line-height: 2.3; }
  #cover h1 { font-size: clamp(34px, 10vw, 58px); letter-spacing: .18em; text-indent: .18em; }
  #cover .tip { font-size: 11px; letter-spacing: .14em; text-indent: 0; }
  #cover .cover-top { font-size: clamp(17px, 5vw, 29px); letter-spacing: .14em; text-indent: 0; }
}

@media (max-width: 480px) {
  #letter .ln { line-height: 2.2; }
}
