/* ============ Tixu（自上游开源项目「许愿柳 / One Wish Willow」二次开发）============ */
:root {
  --blood: #7a1424;
  --blood-bright: #b0202f;
  --bone: #e8dcc3;
  --ash: #6f665a;
  --black: #050404;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  background: var(--black);
  overflow: hidden;
  font-family: "Noto Serif SC", serif;
  color: var(--bone);
  user-select: none;
  /* iOS Safari 键盘弹出时用 dvh 锁定视口高度 */
  height: 100dvh;
  /* 微信 / B 站等内置浏览器会自动放大字号（font boosting），会把标题、提示、按钮全部挤成两行 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

#scene {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  height: 100dvh;
  display: block;
}

/* ---------- 氛围层 ---------- */
#vignette {
  position: fixed; inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 46%,
    transparent 30%, rgba(0,0,0,.55) 72%, rgba(0,0,0,.92) 100%);
  z-index: 3;
}

#grain {
  position: fixed; inset: -100px;
  pointer-events: none;
  z-index: 4;
  opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-jitter .42s steps(4) infinite;
}
@keyframes grain-jitter {
  0% { transform: translate(0,0); }
  25% { transform: translate(-32px,18px); }
  50% { transform: translate(22px,-26px); }
  75% { transform: translate(-14px,-30px); }
  100% { transform: translate(0,0); }
}

#flash {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 5;
  background: #fff7e0;
  opacity: 0;
}
#flash.crack { animation: crack-flash .5s ease-out; }
@keyframes crack-flash {
  0% { opacity: 0; }
  8% { opacity: .85; }
  100% { opacity: 0; }
}

/* 成功星爆：两次脉冲的金色闪光 */
#flash.starflash { animation: star-flash 1.15s ease-out; }
@keyframes star-flash {
  0% { opacity: 0; }
  8% { opacity: .95; }
  30% { opacity: .28; }
  52% { opacity: .6; }
  100% { opacity: 0; }
}

/* 3:4 竖屏录制画框：用向外投影把画框以外区域遮成纯黑 */
#recordFrame {
  position: fixed;
  z-index: 5;
  pointer-events: none;
  display: none;
  box-shadow: 0 0 0 100vmax #000;
}
body.record #recordFrame { display: block; }

body.shake #scene, body.shake #ui { animation: cam-shake .45s linear; }
@keyframes cam-shake {
  0%,100% { transform: translate(0,0); }
  15% { transform: translate(-9px,6px); }
  30% { transform: translate(8px,-7px); }
  45% { transform: translate(-6px,-5px); }
  60% { transform: translate(6px,4px); }
  75% { transform: translate(-3px,3px); }
}

body.struggle #scene { animation: tremble .12s linear infinite; }
@keyframes tremble {
  0%,100% { transform: translate(0,0); }
  25% { transform: translate(-1.5px,1px); }
  50% { transform: translate(1.5px,-1px); }
  75% { transform: translate(-1px,-1.5px); }
}

/* ---------- 首页：成功愿望像流星一样飘过 ---------- */
#wishSky {
  position: fixed;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}
#wishSky.hide { display: none; }

#wishSky .swish-line {
  position: absolute;
  left: 0;
  top: var(--ty);
  white-space: nowrap;
  font-family: "Noto Serif SC", serif;
  color: var(--sc);
  text-shadow: 0 0 14px var(--sc), 0 0 34px rgba(255, 225, 170, .35);
  opacity: var(--op);
  will-change: transform;
  animation: swish-pass var(--dur) linear var(--delay) infinite;
}
#wishSky .swish-line .swish-txt {
  display: inline-block;
  vertical-align: baseline;
  max-width: 74vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs);
  letter-spacing: .24em;
  text-indent: .24em;
  color: var(--sc);
  /* 尾部（右侧）渐隐，模拟流星拖尾 */
  -webkit-mask-image: linear-gradient(90deg, #000 52%, transparent 97%);
  mask-image: linear-gradient(90deg, #000 52%, transparent 97%);
}
#wishSky .swish-line .tail-badge {
  font-style: normal;
  font-size: max(10px, calc(var(--fs) * .72));
  letter-spacing: .1em;
  padding: 1px 6px 1px 7px;
  margin-left: 8px;
  border-radius: 3px;
  vertical-align: middle;
  white-space: nowrap;
}
#wishSky .swish-line .tail-badge.premium {
  color: #ffe9c4;
  border: 1px solid rgba(255, 215, 94, .65);
  background: rgba(90, 62, 10, .35);
  box-shadow: 0 0 10px rgba(255, 205, 90, .3);
}
@keyframes swish-pass {
  from { transform: translateX(108vw); }
  to   { transform: translateX(-135vw); }
}

/* 发射瞬间承载愿望文字的飞行层 */
#flightWish {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8vw;
  pointer-events: none;
  opacity: 0;
  transition: opacity .6s ease;
}
#flightWish.show { opacity: 1; }
#flightWish span {
  font-size: clamp(16px, 4.4vw, 26px);
  font-weight: 600;
  letter-spacing: .2em;
  line-height: 2;
  text-align: center;
  overflow-wrap: anywhere;
  color: #fff3df;
  text-shadow: 0 0 16px rgba(255, 236, 190, .9), 0 0 48px rgba(255, 200, 120, .6);
  animation: flight-wish 2.6s ease-in-out;
}
@keyframes flight-wish {
  0% { opacity: 0; transform: scale(.86); filter: blur(6px); }
  18% { opacity: 1; }
  82% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.04); filter: blur(0); }
}

/* 音乐开关 */
.music-toggle {
  position: absolute;
  top: 24px; right: 24px;
  z-index: 10;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(176,32,47,.45);
  background: rgba(8,5,5,.55);
  color: var(--bone);
  display: grid;
  place-items: center;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(2px);
  transition: all .35s ease;
}
.music-toggle:hover {
  border-color: rgba(176,32,47,.85);
  background: rgba(122,20,36,.28);
  box-shadow: 0 0 18px rgba(176,32,47,.35);
}
.music-toggle.off {
  opacity: .45;
  border-color: rgba(111,102,90,.4);
}
.music-toggle.off svg {
  display: none;
}
.music-toggle.off::after {
  content: "\\2016";
  font-size: 14px;
  letter-spacing: -2px;
  color: var(--bone);
}

/* 许愿界面返回首页 */
.back-btn {
  position: absolute;
  top: 76px; left: 24px;
  z-index: 10;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(176,32,47,.45);
  background: rgba(8,5,5,.55);
  color: var(--bone);
  display: grid;
  place-items: center;
  font-size: 26px;
  line-height: 1;
  padding: 0 0 3px 0;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(2px);
  transition: all .35s ease;
}
.back-btn:hover {
  border-color: rgba(232,220,195,.6);
  color: #fff;
  box-shadow: 0 0 18px rgba(176,32,47,.35);
}
.back-btn.hidden { display: none; }

/* 中英切换：与音乐键同款，叠在其正下方（top = 24 + 42 + 10） */
.lang-toggle {
  top: 76px;
  font-family: "IM Fell English SC", serif;
  font-size: 15px;
  line-height: 1;
  letter-spacing: .02em;
  padding: 0;
}
/* 英文模式下键面是“中”字，换回中文字体 */
body.lang-en .lang-toggle {
  font-family: "Noto Serif SC", serif;
  font-size: 16px;
  letter-spacing: 0;
}

/* ---------- UI ---------- */
#ui {
  position: fixed; inset: 0;
  z-index: 6;
  pointer-events: none;
}

#ui-canvas {
  position: absolute;
  top: 50%; left: 50%;
  width: 1600px;
  height: 1000px;
  transform-origin: center center;
  pointer-events: auto;
}

#title {
  position: absolute;
  top: 7%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  opacity: 0;
  animation: fade-down 2.4s ease .6s forwards;
}
@keyframes fade-down {
  from { opacity: 0; transform: translateX(-50%) translateY(-18px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#title .small-cap {
  font-family: "IM Fell English SC", serif;
  letter-spacing: .55em;
  font-size: 11px;
  color: var(--ash);
  margin-bottom: 8px;
}
#title h1 {
  font-family: "IM Fell English SC", serif;
  font-weight: 400;
  font-size: clamp(24px, 6vw, 50px);
  letter-spacing: .18em;
  color: var(--bone);
  text-shadow: 0 0 26px rgba(176,32,47,.35);
  /* 英文主标题始终单行 */
  white-space: nowrap;
}
#title .cn {
  font-family: "IM Fell English SC", serif;
  font-size: clamp(17px, 3.6vw, 26px);
  letter-spacing: .5em;
  margin: 8px 0 0 .5em;
  color: var(--blood-bright);
}
#title .tag {
  margin-top: 10px;
  font-size: clamp(12px, 2.2vw, 15px);
  letter-spacing: .4em;
  color: var(--ash);
}

/* 底部面板坞：各阶段面板重叠在同一格，隐藏时不占布局 */
#dock {
  display: grid;
  place-items: end center;
  position: absolute;
  bottom: 8.5%;
  left: 50%;
  transform: translateX(-50%);
}
#dock .stage { grid-area: 1 / 1; }
/* 竖屏录制：底部预留更多呼吸空间，避免提示文字太贴底 */
body.record #dock { bottom: 11%; }
body.record #title { top: 6%; }

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  pointer-events: auto;
  transition: opacity .8s ease, transform .8s ease;
}
.stage.hidden {
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  visibility: hidden;
}

.rune-btn {
  font-family: "Noto Serif SC", serif;
  font-weight: 600;
  font-size: clamp(15px, 3.6vw, 17px);
  letter-spacing: .3em;
  text-indent: .3em;
  color: var(--bone);
  background: linear-gradient(180deg, rgba(122,20,36,.28), rgba(122,20,36,.08));
  border: 1px solid rgba(176,32,47,.55);
  padding: 15px 54px;
  cursor: pointer;
  position: relative;
  transition: all .35s ease;
  backdrop-filter: blur(2px);
  /* 按钮文字永不折行 */
  white-space: nowrap;
}
.rune-btn::before, .rune-btn::after {
  content: "";
  position: absolute;
  width: 7px; height: 7px;
  border: 1px solid rgba(232,220,195,.5);
}
.rune-btn::before { top: -4px; left: -4px; border-right: none; border-bottom: none; }
.rune-btn::after { bottom: -4px; right: -4px; border-left: none; border-top: none; }
.rune-btn:hover {
  background: linear-gradient(180deg, rgba(176,32,47,.5), rgba(122,20,36,.18));
  box-shadow: 0 0 32px rgba(176,32,47,.35), inset 0 0 18px rgba(176,32,47,.25);
  text-shadow: 0 0 12px rgba(255,220,220,.8);
}
.rune-btn:active { transform: scale(.97); }
.rune-btn:disabled { opacity: .35; cursor: default; }
.rune-btn.hidden { display: none; }

/* 许愿面板整体比按钮坞抬高（约 1/10 屏高），提示文字与输入区离底更远 */
#wishPanel { margin-bottom: 10vh; }

#wishPanel .lead {
  font-size: clamp(12px, 3vw, 15px);
  letter-spacing: .28em;
  color: var(--bone);
  opacity: .85;
  margin: 0;
  position: relative;
  z-index: 5;
}
#wishText {
  width: min(460px, 70%);
  font-family: "Noto Serif SC", serif;
  font-size: 16px;
  letter-spacing: .12em;
  line-height: 1.9;
  text-align: center;
  color: var(--bone);
  background: rgba(8,5,5,.66);
  border: none;
  border-bottom: 1px solid rgba(176,32,47,.6);
  outline: none;
  resize: none;
  padding: 12px 16px;
  caret-color: var(--blood-bright);
  transition: border-color .3s, box-shadow .3s;
}
#wishText::placeholder { color: rgba(111,102,90,.8); }
#wishText:focus {
  border-bottom-color: var(--blood-bright);
  box-shadow: 0 14px 30px -18px rgba(176,32,47,.5);
}
#wishPanel .hint {
  font-size: clamp(10px, 2.4vw, 11.5px);
  letter-spacing: .3em;
  line-height: 2.0;
  text-align: center;
  color: var(--ash);
}

/* ---------- 违规内容黑屏：涉黄 / 涉政 / 反人类 ---------- */
/* 整屏纯黑，盖住 3D、氛围层与所有 UI，并阻止下方任何交互；只能刷新页面恢复 */
body.blackout #scene,
body.blackout #ui,
body.blackout #vignette,
body.blackout #grain,
body.blackout #flash,
body.blackout #judging { display: none; }
body.blackout::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  background: #000;
  animation: blackout-in .45s ease forwards;
}
@keyframes blackout-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
/* 黑屏出口：黑屏时 #ui 整体隐藏，这块在 #ui 之外，所以仍然可见可点 */
#blackoutExit { display: none; }
body.blackout #blackoutExit {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 1001;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 32px;
  text-align: center;
  animation: blackout-in .6s ease .35s both;
}
body.blackout #blackoutExit .bx-title {
  font-family: "Noto Serif SC", serif;
  font-size: 16px;
  letter-spacing: .22em;
  text-indent: .22em;
  color: var(--bone);
  margin: 0;
}
body.blackout #blackoutExit .bx-msg {
  font-size: 12.5px;
  line-height: 2;
  color: var(--ash);
  margin: 0;
  max-width: 300px;
}

/* ---------- 自定义编辑模式 ---------- */
#editBadge {
  position: absolute;
  top: 28px; left: 24px;
  z-index: 10;
  display: none;
  padding: 5px 12px;
  font-size: 11px;
  letter-spacing: .3em;
  text-indent: .3em;
  color: var(--bone);
  border: 1px solid rgba(176,32,47,.55);
  background: rgba(122,20,36,.22);
  backdrop-filter: blur(2px);
}
body.edit #editBadge { display: block; }

#editToast {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
  padding: 14px 26px;
  font-size: 13px;
  letter-spacing: .22em;
  text-align: center;
  color: var(--bone);
  background: rgba(8,5,5,.85);
  border: 1px solid rgba(176,32,47,.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .45s ease;
}
#editToast.show { opacity: 1; }

/* 编辑模式下，柳枝的回答（标题 + 裁决文案）可直接点开改写 */
body.edit #resultTitle,
body.edit #resultSub {
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
  outline: 1px dashed rgba(176,32,47,.45);
  outline-offset: 8px;
}
body.edit #resultTitle:focus,
body.edit #resultSub:focus {
  outline-style: solid;
  outline-color: rgba(232,220,195,.55);
}
/* 改写时允许换行，不然长句会冲出画面 */
body.edit #resultTitle { white-space: normal; }

/* ---------- 结果 ---------- */
#resultPanel.center {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  /* 不再有柳枝占位，结果文字整体居中 */
  padding: 40px 24px 30px;
  pointer-events: auto;
  transition: opacity .8s ease, transform .8s ease, visibility .8s;
}
#resultPanel.center.hidden {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  visibility: hidden;
  z-index: -1;
}

#resultTitle {
  font-size: clamp(30px, 8vw, 50px);
  font-weight: 900;
  letter-spacing: .32em;
  text-indent: .32em;
  text-align: center;
  white-space: nowrap;
}
#resultTitle.granted {
  color: var(--bone);
  text-shadow: 0 0 40px rgba(232,220,195,.6), 0 0 90px rgba(176,32,47,.55);
  animation: granted-in 1.6s ease forwards;
}
@keyframes granted-in {
  from { opacity: 0; letter-spacing: .8em; filter: blur(8px); }
  to { opacity: 1; letter-spacing: .32em; filter: blur(0); }
}
#resultTitle.denied {
  color: var(--blood-bright);
  text-shadow: 0 0 30px rgba(176,32,47,.8);
  animation: denied-in 2.4s ease forwards;
}
@keyframes denied-in {
  0% { opacity: 0; filter: blur(10px); transform: scale(1.15); }
  40% { opacity: .9; }
  55% { opacity: .25; }
  70% { opacity: 1; }
  100% { opacity: 1; filter: blur(0); transform: scale(1); }
}

#resultSub {
  font-size: clamp(12px, 3vw, 14px);
  letter-spacing: .34em;
  text-align: center;
  line-height: 2.4;
  color: var(--ash);
  opacity: 0;
  animation: fade-in 1.6s ease 1.2s forwards;
}
/* 每个断句整体不断行，只在断句之间的零宽空格处换行 */
#resultSub .ln {
  white-space: nowrap;
}

/* 结果页里被引起来的愿望原文（仅成功升空时展示） */
#resultSub .wish-quote {
  display: block;
  margin: 2px auto 10px;
  max-width: min(620px, 88vw);
  font-size: clamp(15px, 3.6vw, 20px);
  font-weight: 600;
  letter-spacing: .18em;
  line-height: 1.9;
  word-break: break-word;
  overflow-wrap: anywhere;
  color: var(--bone);
  text-shadow: 0 0 22px rgba(255, 236, 200, .55);
  opacity: 0;
  animation: fade-in 1.2s ease .6s forwards;
}

#resultPanel .rune-btn {
  opacity: 0;
  animation: fade-in 1.2s ease 2.2s forwards;
}

@keyframes fade-in { to { opacity: 1; } }

/* 裁决加载层 */
#judging {
  position: fixed; inset: 0;
  z-index: 7;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 26px;
  background: rgba(3,2,2,.72);
  backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none;
  transition: opacity .6s ease;
}
#judging.visible { opacity: 1; pointer-events: auto; }
#judging p {
  font-size: 13px; letter-spacing: .5em;
  color: var(--bone);
  animation: pulse-text 1.6s ease-in-out infinite;
}
@keyframes pulse-text {
  0%,100% { opacity: .4; }
  50% { opacity: 1; }
}
.loader {
  width: 42px; height: 42px;
  border: 2px solid rgba(176,32,47,.25);
  border-top-color: var(--blood-bright);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 手机竖屏（含微信 / B 站内置浏览器） ----------
   目标：标题、输入提示、按钮全部单行，且柳枝与文字不重叠
   尺寸用 min(vw, px)：窄屏跟着宽度缩，宽一点的屏不超过上限 */
@media (max-width: 640px) {
  /* 1. 英文标题单行：字距收到 .06em，字号跟宽度缩；整块下移一点并让开右上角音乐键 */
  #title { top: 8.5%; max-width: 92vw; }
  #title h1 { font-size: min(6vw, 26px); letter-spacing: .06em; }
  .music-toggle { width: 34px; height: 34px; top: 12px; right: 12px; }
  .music-toggle svg { width: 16px; height: 16px; }
  .back-btn { width: 34px; height: 34px; top: 54px; left: 12px; font-size: 22px; }
  .lang-toggle { top: 54px; font-size: 13px; }
  body.lang-en .lang-toggle { font-size: 14px; }
  #title .cn { font-size: min(4.6vw, 22px); letter-spacing: .32em; margin: 6px 0 0 .32em; }
  #title .tag { font-size: min(3.2vw, 13px); letter-spacing: .3em; margin-top: 8px; }

  /* 2. 面板整体收紧，给柳枝腾出空间；面板宽度固定成视口百分比，不再由内容撑出来 */
  .stage { gap: 14px; }
  #wishPanel { margin-bottom: 7vh; width: min(460px, 90vw); }

  /* 3. 提示语与输入提示各单行 */
  #wishPanel .lead { font-size: min(3.5vw, 14px); letter-spacing: .1em; white-space: nowrap; }
  /* 字号保持 16px（防 iOS 聚焦时自动放大页面）；宽度用 vw 而不是 %，否则会按面板宽度算得太窄 */
  #wishText {
    font-size: 16px;
    width: min(440px, 84vw);
    letter-spacing: .04em;
    line-height: 1.7;
    padding: 10px 12px;
  }

  /* 4. 按钮四个字单行 */
  .rune-btn { font-size: min(4.2vw, 17px); letter-spacing: .22em; text-indent: .22em; padding: 13px 30px; }

  #wishPanel .hint { font-size: min(2.9vw, 11.5px); letter-spacing: .16em; line-height: 1.9; }
  #resultTitle { font-size: min(9vw, 40px); letter-spacing: .22em; text-indent: .22em; }
  #resultSub { font-size: min(3.4vw, 14px); letter-spacing: .18em; line-height: 2.1; }
}

/* 3:4 录制模式：UI 在 900×1200 设计稿内等比缩放，字号用固定 px（随画布缩放），
   不能用基于视口的 vw/clamp（会算错） */
body.record #title h1 { font-size: 48px; }
body.record #title .cn { font-size: 26px; }
body.record #title .tag { font-size: 15px; }
body.record .rune-btn { font-size: 17px; }
body.record #wishPanel .lead { font-size: 15px; }
body.record #wishPanel .hint { font-size: 11.5px; }
body.record #wishPanel { margin-bottom: 120px; }
body.record #resultTitle { font-size: 50px; }
body.record #resultSub { font-size: 14px; }

/* ---------- 英文模式排版 ----------
   中文靠大字距排出仪式感，西文拉开同样的字距只会散掉；
   且英文句子更长，标题与裁决语必须允许换行，不能再 nowrap */
body.lang-en #title .cn { display: none; }
body.lang-en #title .tag { letter-spacing: .2em; }
body.lang-en #editBadge { letter-spacing: .18em; text-indent: .18em; }
body.lang-en #editToast { letter-spacing: .04em; }
body.lang-en #judging p { letter-spacing: .16em; }
body.lang-en .rune-btn { letter-spacing: .14em; text-indent: .14em; }
/* 西文提示语较长，窄屏会换行，必须显式居中（中文单行时看不出来） */
body.lang-en #wishPanel .lead { letter-spacing: .07em; white-space: normal; text-align: center; }
body.lang-en #wishText { letter-spacing: .01em; }
body.lang-en #wishPanel .hint { letter-spacing: .05em; line-height: 1.9; }

body.lang-en #resultTitle {
  font-size: clamp(26px, 6.4vw, 42px);
  letter-spacing: .12em;
  text-indent: .12em;
  white-space: normal;
  line-height: 1.3;
  max-width: min(760px, 88vw);
}
/* granted 的入场动画会把字距回弹到 .32em，英文得换一组关键帧 */
body.lang-en #resultTitle.granted { animation-name: granted-in-en; }
@keyframes granted-in-en {
  from { opacity: 0; letter-spacing: .45em; filter: blur(8px); }
  to { opacity: 1; letter-spacing: .12em; filter: blur(0); }
}
body.lang-en #resultSub {
  letter-spacing: .05em;
  line-height: 1.95;
  max-width: min(620px, 86vw);
}
/* 西文整行一个 span，必须允许在单词间换行 */
body.lang-en #resultSub .ln { white-space: normal; }
/* 3:4 录制模式里 UI 是固定设计稿缩放，字号不能再跟视口走 */
body.record.lang-en #resultTitle { font-size: 42px; }
body.record.lang-en #resultSub { font-size: 14px; }

@media (max-width: 640px) {
  body.lang-en #resultTitle { font-size: min(7.6vw, 32px); letter-spacing: .08em; text-indent: .08em; }
  body.lang-en #resultSub { font-size: min(3.4vw, 14px); letter-spacing: .03em; line-height: 1.8; }
  body.lang-en #wishPanel .lead { font-size: min(3.3vw, 13px); }
  body.lang-en .rune-btn { letter-spacing: .1em; text-indent: .1em; padding: 13px 24px; }
}

/* ============================================================
   商业版：VIP 入口 / 许愿档位 / 支付弹层 / VIP 领取弹层
   ============================================================ */
/* ---------- 开学锦鲤 · 低调灰色文字入口（许愿界面底部） ---------- */
.vip-link {
  font-family: "Noto Serif SC", serif;
  font-size: 11px;
  letter-spacing: .22em;
  text-indent: .22em;
  color: var(--ash);
  background: none;
  border: none;
  padding: 2px 0;
  cursor: pointer;
  opacity: .85;
  transition: opacity .3s ease;
  white-space: nowrap;
}
.vip-link:hover {
  opacity: 1;
  color: var(--bone);
}
/* ---------- 开学锦鲤：显眼的金色发光入口（未领取时吸引注意） ---------- */
#btnVip {
  font-size: 13px;
  padding: 8px 18px;
  border-radius: 999px;
  color: #ffd75e;
  background: linear-gradient(135deg, rgba(255, 215, 94, .16), rgba(255, 215, 94, .04));
  border: 1px solid rgba(255, 215, 94, .5);
  box-shadow: 0 0 14px rgba(255, 205, 90, .22), inset 0 0 10px rgba(255, 215, 94, .1);
  opacity: 1;
  animation: vip-breathe 2.6s ease-in-out infinite;
  transition: opacity .3s ease, transform .2s ease, box-shadow .3s ease, color .3s ease;
}
#btnVip::before {
  content: "✦";
  font-size: .78em;
  margin-right: 8px;
  color: #ffd75e;
  text-shadow: 0 0 10px rgba(255, 215, 94, .9);
}
#btnVip:hover {
  color: #ffe9b0;
  border-color: rgba(255, 215, 94, .85);
  box-shadow: 0 0 28px rgba(255, 205, 90, .55), inset 0 0 14px rgba(255, 215, 94, .16);
  transform: translateY(-1px);
}
/* 已领取：收住光效，变成安静的确认状态，避免打扰 */
#btnVip.claimed {
  font-size: 13px;
  color: rgba(214, 199, 164, .85);
  background: rgba(255, 255, 255, .03);
  border-color: rgba(214, 199, 164, .3);
  box-shadow: none;
  animation: none;
}
#btnVip.claimed::before {
  content: "✓";
  font-size: .9em;
  color: #9fd9a8;
  text-shadow: none;
}
@keyframes vip-breathe {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 205, 90, .18), inset 0 0 8px rgba(255, 215, 94, .08); }
  50% { box-shadow: 0 0 26px rgba(255, 205, 90, .55), inset 0 0 12px rgba(255, 215, 94, .14); }
}
/* ---------- 首页底部入口行：免费领取会员 / 意见反馈 / 隐私协议 ---------- */
.wish-foot,
.home-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: -4px;
  pointer-events: auto;
}
.foot-dot {
  color: rgba(111, 102, 90, .6);
  font-size: 10px;
  line-height: 1;
}

/* ---------- 意见反馈弹层 ---------- */
.feedback-body {
  text-align: center;
  margin: 4px 0 16px;
}
.feedback-body p {
  color: var(--ash);
  font-size: 13.5px;
  line-height: 1.9;
  margin: 0 0 8px;
}
.feedback-qq {
  color: var(--bone) !important;
  font-size: 15px !important;
  letter-spacing: .08em;
}
.feedback-qq b {
  color: #ffd75e;
  font-size: 20px;
  letter-spacing: .12em;
  text-shadow: 0 0 12px rgba(255, 205, 90, .45);
}
.feedback-note {
  font-size: 12px !important;
  opacity: .75;
}

/* ---------- 自伤关怀页 ---------- */
.care-card h3 {
  color: #ffd9b0;
}
.care-body {
  text-align: center;
  margin: 2px 0 16px;
}
.care-body p {
  color: var(--ash);
  font-size: 13px;
  line-height: 1.95;
  margin: 0 0 10px;
}
.care-hotline {
  color: var(--bone) !important;
  font-size: 14px !important;
  letter-spacing: .04em;
}
.care-hotline b {
  color: #ffd75e;
  font-size: 19px;
  letter-spacing: .06em;
  text-shadow: 0 0 12px rgba(255, 205, 90, .45);
}
.care-hotline span {
  display: block;
  font-size: 11px;
  letter-spacing: .12em;
  opacity: .6;
  margin-top: 2px;
}
.care-note {
  font-size: 11.5px !important;
  opacity: .7;
}

/* ---------- 隐私协议弹层 ---------- */
.privacy-card .privacy-body {
  text-align: left;
  max-height: 52vh;
  overflow-y: auto;
  margin: 0 0 14px;
  padding: 0 2px;
}
.privacy-body h4 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--bone);
  margin: 12px 0 4px;
}
.privacy-body p {
  font-size: 12px;
  letter-spacing: .04em;
  line-height: 1.9;
  color: var(--ash);
  margin: 0 0 6px;
}
@media (max-width: 640px) {
  .privacy-body { max-height: 58vh; }
  .privacy-body p { font-size: 11.5px; }
}

/* ---------- 通用弹层 ---------- */
.modal {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(2, 1, 1, .72);
  backdrop-filter: blur(3px);
  pointer-events: auto;
  transition: opacity .4s ease, visibility .4s;
}
.modal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.modal-card {
  position: relative;
  width: min(430px, 88vw);
  max-height: 86vh;
  overflow-y: auto;
  padding: 30px 28px 24px;
  text-align: center;
  background: linear-gradient(180deg, #140a06, #070403);
  border: 1px solid rgba(176, 32, 47, .5);
  box-shadow: 0 0 60px rgba(0, 0, 0, .8), inset 0 0 40px rgba(122, 20, 36, .12);
  animation: modal-in .45s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(22px) scale(.96); }
  to { opacity: 1; transform: none; }
}
.modal-x {
  position: absolute;
  top: 10px; right: 14px;
  background: none;
  border: none;
  color: var(--ash);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 6px;
  transition: color .3s;
}
.modal-x:hover { color: var(--bone); }
.modal-card h3 {
  font-size: 21px;
  font-weight: 900;
  letter-spacing: .24em;
  text-indent: .24em;
  color: var(--bone);
  margin-bottom: 14px;
}
.modal-card h3 b { color: #e8b93c; }

/* ---------- 支付弹层 ---------- */
.pay-price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}
.pay-price b {
  font-size: 38px;
  font-weight: 900;
  color: #ffd75e;
  text-shadow: 0 0 24px rgba(255, 215, 94, .45);
}
.pay-price span {
  font-size: 12px;
  letter-spacing: .2em;
  color: var(--ash);
}
.pay-perks {
  list-style: none;
  margin: 0 auto 16px;
  padding: 12px 14px;
  width: 100%;
  text-align: left;
  background: rgba(8, 5, 5, .55);
  border: 1px solid rgba(111, 102, 90, .35);
}
.pay-perks li {
  position: relative;
  padding: 5px 0 5px 20px;
  font-size: 13px;
  letter-spacing: .06em;
  line-height: 1.8;
  color: var(--bone);
}
.pay-perks li::before {
  content: "✦";
  position: absolute;
  left: 2px;
  top: 7px;
  color: #e8b93c;
  font-size: 12px;
}
.pay-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 auto 20px;
  padding: 10px 14px;
  border: 1px dashed rgba(232, 185, 60, .4);
  max-width: 100%;
}
.preview-star {
  font-size: 24px;
  color: #ffe9c4;
  text-shadow: 0 0 16px rgba(255, 233, 196, .8);
  flex: none;
}
.preview-star.premium {
  color: #ffd75e;
  text-shadow: 0 0 20px rgba(255, 215, 94, 1);
  font-size: 30px;
}
.pay-preview p {
  font-size: 12.5px;
  letter-spacing: .08em;
  line-height: 1.8;
  color: var(--ash);
  text-align: left;
  margin: 0;
}
.modal-card .ghost-btn {
  margin-top: 10px;
  width: 100%;
  background: none;
  border: none;
  color: var(--ash);
  font-family: "Noto Serif SC", serif;
  font-size: 12.5px;
  letter-spacing: .3em;
  text-indent: .3em;
  padding: 10px;
  cursor: pointer;
  transition: color .3s;
}
.modal-card .ghost-btn:hover { color: var(--bone); }
.pay-tip {
  margin-top: 12px;
  font-size: 11px;
  letter-spacing: .14em;
  line-height: 1.9;
  color: var(--ash);
}
.modal-card .rune-btn { width: 100%; padding-left: 0; padding-right: 0; }

/* ---------- 全局轻提示 ---------- */
#toast {
  position: fixed;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  z-index: 60;
  max-width: 86vw;
  padding: 13px 24px;
  font-size: 13px;
  letter-spacing: .18em;
  text-align: center;
  color: var(--bone);
  background: rgba(8, 5, 5, .92);
  border: 1px solid rgba(232, 185, 60, .55);
  box-shadow: 0 0 26px rgba(0, 0, 0, .6);
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s ease;
}
#toast.show { opacity: 1; }

/* ============ 分站系统：拦截层 / 站长入口 ============ */
#siteBlock.hidden { display: none; }
#siteBlock {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 2, 2, .86);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.site-block-card {
  max-width: 78vw;
  padding: 34px 40px;
  text-align: center;
  color: #e9ddc8;
  border: 1px solid rgba(255, 215, 94, .28);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(24, 20, 30, .96), rgba(10, 8, 12, .96));
  box-shadow: 0 0 60px rgba(0, 0, 0, .6);
}
.site-block-icon {
  font-size: 40px;
  color: #ffd75e;
  text-shadow: 0 0 18px rgba(255, 215, 94, .55);
}
.site-block-card h2 {
  margin: 10px 0 8px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 3px;
}
.site-block-card p {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.7;
  color: rgba(233, 221, 200, .78);
}
.site-block-btn {
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
  padding: 0 30px;
  border-radius: 999px;
  color: #100d10;
  background: linear-gradient(135deg, #ffd75e, #f5b93f);
  font-size: 15px;
  text-decoration: none;
  letter-spacing: 2px;
}
#agentEntry.hidden { display: none; }
#agentEntry {
  position: fixed;
  right: 14px;
  bottom: 12px;
  z-index: 700;
  padding: 10px 14px;
  color: rgba(233, 221, 200, .5);
  font-size: 12px;
  letter-spacing: 1px;
  text-decoration: none;
  background: rgba(20, 15, 20, .55);
  border: 1px solid rgba(233, 221, 200, .14);
  border-radius: 999px;
}
#agentEntry:active { opacity: .7; }

/* ---------- 飞行层：VIP / 高级 尾巴标识 ---------- */
#flightWish .tail-badge {
  font-style: normal;
  font-size: .72em;
  letter-spacing: .12em;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 3px;
  vertical-align: middle;
  white-space: nowrap;
}
#flightWish .tail-badge.premium {
  color: #ffe9c4;
  border: 1px solid rgba(255, 215, 94, .7);
  background: rgba(90, 62, 10, .4);
}
#flightWish.premium span {
  color: transparent;
  background-image:
    linear-gradient(100deg, #caa04d 0%, #f3d27a 30%, #ffe9b0 50%, #f3d27a 70%, #caa04d 100%),
    linear-gradient(100deg, rgba(255, 255, 255, 0) 0%, rgba(255, 252, 235, .98) 50%, rgba(255, 255, 255, 0) 100%);
  background-size: 100% 100%, 45% 100%;
  background-position: 0 0, -70% 0;
  background-repeat: no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: 0 0 26px rgba(255, 215, 94, .8);
  animation: flight-wish 2.6s ease-in-out, shine-sweep 1.5s linear infinite;
}

/* 流光扫过效果（高级许愿金色文字） */
@keyframes flowshine {
  0%   { background-position: 0% 0; }
  100% { background-position: 220% 0; }
}

/* 高级许愿流光：一道亮光从文字头扫到尾 */
@keyframes shine-sweep {
  0%   { background-position: 0 0, -70% 0; }
  60%, 100% { background-position: 0 0, 280% 0; }
}

/* 结果页愿望引文：高级许愿同样带流光 */
#resultSub .wish-quote.premium {
  color: transparent;
  background-image:
    linear-gradient(100deg, #caa04d 0%, #f3d27a 30%, #ffe9b0 50%, #f3d27a 70%, #caa04d 100%),
    linear-gradient(100deg, rgba(255, 255, 255, 0) 0%, rgba(255, 252, 235, .95) 50%, rgba(255, 255, 255, 0) 100%);
  background-size: 100% 100%, 45% 100%;
  background-position: 0 0, -70% 0;
  background-repeat: no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  animation: shine-sweep 2.2s linear infinite;
  text-shadow: none;
  filter: drop-shadow(0 0 16px rgba(255, 205, 90, .5));
}

/* ---------- 手机竖屏适配 ---------- */
@media (max-width: 640px) {
  .modal { padding: 12px; }
  .modal-card { padding: 24px 18px 18px; }
  .modal-card h3 { font-size: 18px; letter-spacing: .16em; text-indent: .16em; }
  .pay-price b { font-size: 32px; }
  .vip-link { font-size: 10px; }
  #btnVip { font-size: 14px; padding: 7px 16px; }
  #btnVip.claimed { font-size: 12px; }
}
/* 3:4 录制模式：设计稿内固定尺寸 */
body.record .vip-link { font-size: 13px; }
body.record #btnVip { font-size: 19px; padding: 11px 28px; }
body.record #btnVip.claimed { font-size: 15px; }
body.record .modal-card h3 { font-size: 24px; }
body.record .pay-price b { font-size: 44px; }
body.record .pay-perks li { font-size: 15px; }
body.record .modal-card .ghost-btn { font-size: 14px; }

/* ---------- 许愿档位：两个同款主按钮（许下愿望 / 高级许愿），金额只在支付弹层显示 ---------- */
.tier-ctas {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.tier-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-width: min(340px, 70vw);
  padding: 15px 42px;
  line-height: 1.2;
  white-space: nowrap;
}
.tier-btn .tb-line {
  letter-spacing: .3em;
  text-indent: .3em;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .tier-btn { min-width: min(330px, 88vw); padding: 13px 18px; gap: 10px; }
  .tier-btn .tb-line { letter-spacing: .2em; text-indent: .2em; }
}
body.record .tier-btn { min-width: min(460px, 72%); padding: 17px 46px; gap: 18px; }
body.record .tier-btn .tb-line { letter-spacing: .34em; text-indent: .34em; }

/* ---------- 首页星野：高级愿望 = 金色大字 + 亮带扫光 + 粒子尾巴 ---------- */
#wishSky .swish-line.premium .swish-txt {
  font-weight: 700;
  max-width: 86vw;
  color: transparent;
  background-image:
    linear-gradient(100deg, #caa04d 0%, #f3d27a 30%, #ffe9b0 50%, #f3d27a 70%, #caa04d 100%),
    linear-gradient(100deg, rgba(255, 255, 255, 0) 0%, rgba(255, 252, 235, .98) 50%, rgba(255, 255, 255, 0) 100%);
  background-size: 100% 100%, 42% 100%;
  background-position: 0 0, -70% 0;
  background-repeat: no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  letter-spacing: .3em;
  text-shadow: 0 0 16px rgba(255, 215, 94, 1), 0 0 46px rgba(255, 200, 90, .9), 0 0 90px rgba(255, 190, 70, .6);
  animation: shine-sweep 2s linear infinite;
}
/* 高级愿望的尾部粒子尾巴：跟随文字划过星野，像流星拖出的星尘 */
#wishSky .swish-line.premium::after {
  content: "";
  position: absolute;
  left: 100%;
  top: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 2px;
  border-radius: 50%;
  background: radial-gradient(circle, #fffbe8 0%, rgba(255, 230, 150, .95) 40%, rgba(255, 210, 90, 0) 72%);
  box-shadow:
    12px 3px 0 -1px rgba(255, 235, 170, .95),
    24px -4px 0 -2px rgba(255, 215, 100, .8),
    38px 2px 0 -3px rgba(255, 205, 90, .6),
    52px -2px 0 -4px rgba(255, 190, 75, .42),
    68px 4px 0 -5px rgba(255, 175, 60, .28);
  opacity: .9;
  pointer-events: none;
  animation: premium-tail 1.1s ease-in-out var(--delay, 0s) infinite;
}
@keyframes premium-tail {
  0%, 100% { transform: translateX(0) scale(1); opacity: .9; }
  50% { transform: translateX(4px) scale(1.18); opacity: 1; }
}
/* VIP 愿望：暖白高亮（不带流光与粒子，保持区分） */
#wishSky .swish-line.vip .swish-txt {
  color: #ffefd2;
  font-weight: 600;
  text-shadow: 0 0 16px rgba(255, 225, 170, .9), 0 0 42px rgba(255, 200, 120, .5);
}


/* WebGL 不可用时的可读降级页（避免整页白屏） */
.webgl-fallback {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 32px; text-align: center;
  background: radial-gradient(circle at 50% 30%, #1a1430 0%, #060409 70%);
  color: #f3ecdc; font-family: "Noto Serif SC", serif;
}
.webgl-fallback h2 { font-size: 22px; font-weight: 600; letter-spacing: 2px; }
.webgl-fallback p { font-size: 14px; opacity: .7; }
