/* 替代版式：独立于 #stage，避免与 view.html 全局 .bubble 冲突 */
#altStage {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 15;
  overflow: hidden;
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* 星空/情书：整页滚动（微信 web-view 内 fixed 子容器常无法滑动） */
html.alt-scroll,
html.alt-scroll body {
  height: auto !important;
  min-height: 100% !important;
  width: 100% !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  position: static !important;
  touch-action: pan-y;
}

html.alt-scroll #altStage {
  display: block;
  position: relative;
  inset: auto;
  width: 100%;
  min-height: 100vh;
  height: auto;
  overflow: visible;
}

/* 聊天风：仍用内部滚动 */
html.alt-scroll-chat,
html.alt-scroll-chat body {
  height: 100% !important;
  overflow: hidden !important;
  position: fixed !important;
  width: 100%;
}

html.alt-scroll-chat #altStage {
  position: fixed;
  inset: 0;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

#altStage * {
  box-sizing: border-box;
}

.alt-stage {
  width: 100%;
  min-height: 100%;
  overflow: visible;
}

/* ========== 星空 ========== */
.starry-end-spacer {
  height: max(140px, calc(80px + env(safe-area-inset-bottom)));
  flex-shrink: 0;
}
.alt-starry {
  padding-bottom: 24px;
  background: radial-gradient(ellipse 120% 80% at 50% -10%, #2a3568 0%, #12182e 45%, #080812 100%);
  position: relative;
}
.alt-starry::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 30% 65%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 70% 30%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 85% 75%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 50% 90%, rgba(255,255,255,0.5), transparent);
  animation: altTwinkle 4s ease-in-out infinite alternate;
  z-index: 0;
}
@keyframes altTwinkle {
  from { opacity: 0.6; }
  to { opacity: 1; }
}
.starry-scroll-hint {
  position: sticky;
  bottom: 8px;
  left: 0;
  right: 0;
  z-index: 2;
  text-align: center;
  font-size: 12px;
  color: rgba(168, 199, 255, 0.55);
  padding: 8px;
  pointer-events: none;
  animation: altHintBounce 2s ease-in-out infinite;
}
@keyframes altHintBounce {
  0%, 100% { opacity: 0.45; transform: translateY(0); }
  50% { opacity: 0.9; transform: translateY(-4px); }
}
#altStage.alt-scrolled .starry-scroll-hint {
  display: none;
}
.starry-hero {
  position: relative;
  z-index: 1;
  min-height: 32vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 52px 24px 28px;
}
.starry-tag {
  font-size: 12px;
  letter-spacing: 0.35em;
  color: rgba(168, 199, 255, 0.85);
  margin-bottom: 14px;
  text-transform: uppercase;
}
.starry-hero h1 {
  font-size: clamp(22px, 6vw, 30px);
  font-weight: 500;
  line-height: 1.55;
  color: #eef4ff;
  text-shadow: 0 0 48px rgba(140, 180, 255, 0.45);
}
.starry-sub {
  margin-top: 14px;
  font-size: 15px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.62);
  max-width: 300px;
}
.starry-track {
  position: relative;
  z-index: 1;
  padding: 8px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.starry-card {
  background: linear-gradient(145deg, rgba(255,255,255,0.1), rgba(255,255,255,0.04));
  border: 1px solid rgba(168, 199, 255, 0.22);
  border-radius: 18px;
  padding: 22px 20px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transform: translateY(32px);
  opacity: 0;
  transition: transform 0.75s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.75s ease;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}
.starry-card.in {
  transform: translateY(0);
  opacity: 1;
}
.starry-card .sc {
  font-size: 32px;
  display: block;
  margin-bottom: 10px;
  line-height: 1;
}
.starry-card p {
  font-size: 16px;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.92);
  word-break: break-word;
}
.starry-card small {
  display: block;
  margin-top: 10px;
  font-size: 12px;
  color: rgba(168, 199, 255, 0.55);
  text-align: right;
}
.starry-card.starry-photo {
  padding: 0;
  overflow: hidden;
}
.starry-card.starry-photo img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
}
.starry-card.starry-photo p {
  padding: 14px 18px 16px;
  text-align: center;
  font-size: 14px;
}
.starry-final {
  position: relative;
  z-index: 1;
  padding: 36px 24px 72px;
  text-align: center;
}
.starry-final p {
  font-size: 17px;
  line-height: 2;
  color: rgba(232, 240, 255, 0.88);
  opacity: 0;
  transform: translateY(14px);
  transition: all 0.65s ease;
  margin-bottom: 4px;
}
.starry-final p.in {
  opacity: 1;
  transform: translateY(0);
}
.starry-final p:last-child {
  font-size: 22px;
  font-weight: 600;
  color: var(--alt-gold, #a8c7ff);
  margin-top: 12px;
}

/* ========== 微信聊天（全屏） ========== */
.alt-chat {
  background: #ededed;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  min-height: 100%;
}
.alt-chat .phone-shell {
  width: 100%;
  max-width: 430px;
  min-height: 100%;
  height: 100%;
  margin: 0 auto;
  background: #ededed;
  border-radius: 0;
  border: none;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.alt-chat .phone-notch {
  display: none;
}
.alt-chat .chat-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: #2e2e2e;
  color: #fff;
  font-size: 17px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.08);
}
.alt-chat .chat-head .back,
.alt-chat .chat-head .more {
  width: 32px;
  text-align: center;
  opacity: 0.85;
  font-size: 22px;
  line-height: 1;
}
.alt-chat .chat-name {
  font-weight: 600;
  flex: 1;
  text-align: center;
}
.alt-chat .chat-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 12px 20px;
  background: #ededed url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h60v60H0z' fill='%23ededed'/%3E%3Cpath d='M30 0v60M0 30h60' stroke='%23e2e2e2' stroke-width='0.5'/%3E%3C/svg%3E");
}
.alt-chat .chat-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 14px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.alt-chat .chat-row.in {
  opacity: 1;
  transform: translateY(0);
}
.alt-chat .chat-row.right {
  flex-direction: row-reverse;
}
.alt-chat .chat-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}
.alt-chat .chat-row.left .chat-avatar {
  background: linear-gradient(135deg, #6b8cce, #4a6fa5);
}
.alt-chat .chat-row.right .chat-avatar {
  background: linear-gradient(135deg, #7bc96f, #4caf50);
}
.alt-chat .chat-col {
  max-width: calc(100% - 52px);
  display: flex;
  flex-direction: column;
}
.alt-chat .chat-row.right .chat-col {
  align-items: flex-end;
}
.alt-chat .alt-bubble {
  display: block;
  max-width: 100%;
  padding: 10px 14px;
  font-size: 16px;
  line-height: 1.55;
  word-break: break-word;
  border-radius: 4px;
  position: relative;
  opacity: 1;
  transform: none;
}
.alt-chat .chat-row.left .alt-bubble {
  background: #fff;
  color: #1a1a1a;
  border-radius: 4px 12px 12px 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.alt-chat .chat-row.right .alt-bubble {
  background: #95ec69;
  color: #1a1a1a;
  border-radius: 12px 4px 12px 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.alt-chat .chat-meta {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
  padding: 0 2px;
}
.alt-chat .alt-bubble.img-bubble {
  padding: 0;
  overflow: hidden;
  background: #fff !important;
  border-radius: 8px;
}
.alt-chat .alt-bubble.img-bubble img {
  width: 200px;
  max-width: 56vw;
  display: block;
  vertical-align: top;
}
.alt-chat .chat-input-fake {
  flex-shrink: 0;
  padding: 10px 16px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: #f7f7f7;
  border-top: 1px solid #d9d9d9;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #999;
}
.alt-chat .chat-input-fake::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #95ec69;
  animation: altPulse 1.2s ease-in-out infinite;
}
@keyframes altPulse {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1); }
}
.alt-chat .chat-sticker {
  position: fixed;
  left: 50%;
  bottom: 22%;
  transform: translateX(-50%) scale(0);
  font-size: 36px;
  font-weight: 700;
  color: #ff4d6d;
  text-shadow: 0 4px 24px rgba(255, 77, 109, 0.45);
  transition: transform 0.45s cubic-bezier(0.34, 1.5, 0.64, 1);
  z-index: 20;
  pointer-events: none;
}
.alt-chat .chat-sticker.in {
  transform: translateX(-50%) scale(1);
}

/* ========== 复古情书 ========== */
.alt-letter {
  background: linear-gradient(180deg, #1f1610 0%, #2a1f14 100%);
  padding: max(16px, env(safe-area-inset-top)) 14px max(48px, env(safe-area-inset-bottom));
  min-height: 100%;
}
.alt-letter .scroll-paper {
  max-width: 420px;
  margin: 0 auto;
  min-height: calc(100vh - 64px);
  background: linear-gradient(180deg, #faf3e4 0%, #efe0c8 50%, #e6d4b4 100%);
  color: #3d2818;
  border-radius: 2px;
  box-shadow:
    0 2px 0 #d4c4a8,
    0 16px 48px rgba(0, 0, 0, 0.35),
    inset 0 0 80px rgba(139, 90, 43, 0.06);
  padding: 40px 26px 52px;
  font-family: "STKaiti", "KaiTi", "Songti SC", "Noto Serif SC", serif;
  position: relative;
}
.alt-letter .scroll-paper::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(61, 36, 24, 0.12);
  pointer-events: none;
}
.alt-letter .wax-open {
  width: 64px;
  height: 64px;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #d4896a, #8b3a2a 70%);
  color: #faf3e4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: bold;
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.25), 0 4px 12px rgba(0,0,0,0.2);
  transition: transform 0.5s ease, opacity 0.5s ease;
}
.alt-letter .wax-open.broken {
  transform: scale(1.15);
  opacity: 0;
}
.alt-letter .scroll-paper h2 {
  text-align: center;
  font-size: 21px;
  font-weight: normal;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(61, 36, 24, 0.15);
  letter-spacing: 0.15em;
}
.alt-letter .letter-body p.type-line {
  font-size: 17px;
  line-height: 2.1;
  margin-bottom: 18px;
  min-height: 1.6em;
  text-indent: 2em;
}
.alt-letter .letter-body p.type-line:first-child {
  text-indent: 0;
}
.alt-letter .letter-photo {
  margin: 20px 0;
  text-align: center;
}
.alt-letter .letter-photo img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border: 6px solid #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}
.alt-letter .letter-photo figcaption {
  margin-top: 10px;
  font-size: 13px;
  color: rgba(61, 36, 24, 0.55);
}
.alt-letter .letter-sign {
  text-align: right;
  margin-top: 36px;
  font-size: 16px;
  opacity: 0;
  transition: opacity 0.8s ease;
  letter-spacing: 0.1em;
}
.alt-letter .letter-sign.in {
  opacity: 1;
}
