/* 开场 3D 暗夜火漆信封、黑金丝绒贺卡与手势胶囊样式（零外网依赖） */

.letter-stage {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  perspective: 1100px;
  background: radial-gradient(circle at 50% 48%, rgba(8, 13, 28, 0.24) 0%, rgba(2, 3, 9, 0.56) 100%);
  transition: opacity 0.85s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.85s ease;
}

.letter-stage.is-dismissed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* 3D 暗夜长信封 */
.envelope-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  transform: translateY(5vh);
  transition: opacity 0.65s ease, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.envelope-wrap.is-hidden {
  opacity: 0;
  transform: translateY(24px) scale(0.92);
  pointer-events: none;
  position: absolute;
}

.envelope-box {
  position: relative;
  width: min(82vw, 310px);
  height: 200px;
  border: 1px solid rgba(232, 207, 157, 0.34);
  border-radius: 6px;
  background: linear-gradient(155deg, #10192e 0%, #090e1c 58%, #050710 100%);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.72),
    inset 0 0 0 1px rgba(232, 207, 157, 0.08),
    0 0 36px rgba(228, 184, 106, 0.08);
  cursor: pointer;
  transform-style: preserve-3d;
  outline: none;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  animation: envFloat 4.8s ease-in-out infinite;
}

@keyframes envFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
}

.envelope-box:active {
  transform: scale(0.97);
}

/* 信封内衬淡金细线与左右折痕 */
.envelope-pocket {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  overflow: hidden;
  pointer-events: none;
}

.envelope-pocket::before,
.envelope-pocket::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.envelope-pocket::before {
  background:
    linear-gradient(148deg, rgba(232, 207, 157, 0.14) 0%, transparent 49.5%),
    linear-gradient(212deg, rgba(232, 207, 157, 0.14) 0%, transparent 49.5%);
}

.envelope-pocket::after {
  inset: 8px;
  border: 1px solid rgba(232, 207, 157, 0.14);
  border-radius: 3px;
}

/* 3D 翻折顶盖 */
.envelope-flap {
  position: absolute;
  top: 0;
  left: -1px;
  right: -1px;
  height: 112px;
  transform-origin: top center;
  transform-style: preserve-3d;
  transition: transform 0.72s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  z-index: 3;
}

.envelope-flap::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #16223e 0%, #0b1224 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-top: 1px solid rgba(232, 207, 157, 0.38);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.envelope-flap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(232, 207, 157, 0.32), rgba(232, 207, 157, 0.04));
  clip-path: polygon(0 0, 50% 100%, 100% 0, 98.8% 0, 50% 97.6%, 1.2% 0);
}

.envelope-wrap.is-opening .envelope-flap {
  transform: rotateX(168deg);
}

/* 古铜暗红八芒星火漆蜡印 */
.wax-seal {
  position: absolute;
  left: 50%;
  top: 96px;
  width: 52px;
  height: 52px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 36% 32%, #a63d42 0%, #7a2328 56%, #4a1216 100%);
  border: 1px solid rgba(232, 207, 157, 0.48);
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.65),
    0 0 18px rgba(176, 62, 68, 0.32),
    inset 0 2px 5px rgba(255, 220, 190, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f4daa6;
  z-index: 4;
  transition: opacity 0.35s ease, transform 0.45s ease;
}

.wax-seal svg {
  width: 24px;
  height: 24px;
}

.envelope-wrap.is-opening .wax-seal {
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.25);
}

.envelope-tip {
  font-size: clamp(13px, 3.3vw, 14.5px);
  letter-spacing: 0.26em;
  padding-left: 0.26em;
  color: rgba(232, 207, 157, 0.88);
  text-shadow: 0 0 16px rgba(232, 207, 157, 0.24);
  animation: tipBreath 2.8s ease-in-out infinite;
}

@keyframes tipBreath {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

/* 黑金丝绒烫金立体贺卡 */
.letter-card {
  position: relative;
  width: min(88vw, 376px);
  padding: 12px;
  border-radius: 10px;
  background: linear-gradient(158deg, rgba(16, 24, 44, 0.96) 0%, rgba(7, 10, 21, 0.98) 55%, rgba(4, 5, 12, 0.99) 100%);
  border: 1px solid rgba(232, 207, 157, 0.38);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.82),
    0 0 42px rgba(228, 184, 106, 0.10);
  overflow: hidden;
  opacity: 0;
  transform: translateY(34px) scale(0.93);
  pointer-events: none;
  transition:
    opacity 0.78s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.86s cubic-bezier(0.22, 1, 0.36, 1);
}

.letter-card.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.letter-card::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(115deg, transparent 42%, rgba(244, 218, 166, 0.08) 50%, transparent 58%);
  animation: cardSheen 7.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes cardSheen {
  0% { transform: translateX(-45%); }
  60%, 100% { transform: translateX(55%); }
}

.letter-frame {
  position: relative;
  padding: 28px 24px 26px;
  border: 1px solid rgba(232, 207, 157, 0.24);
  border-radius: 6px;
  text-align: center;
  background: radial-gradient(circle at 50% 25%, rgba(232, 207, 157, 0.045) 0%, transparent 72%);
}

.letter-corner {
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: rgba(232, 207, 157, 0.56);
  border-style: solid;
  pointer-events: none;
}

.letter-corner.tl { top: 6px; left: 6px; border-width: 1px 0 0 1px; }
.letter-corner.tr { top: 6px; right: 6px; border-width: 1px 1px 0 0; }
.letter-corner.bl { bottom: 6px; left: 6px; border-width: 0 0 1px 1px; }
.letter-corner.br { bottom: 6px; right: 6px; border-width: 0 1px 1px 0; }

.letter-emblem {
  width: 30px;
  height: 30px;
  margin: 0 auto 12px;
  color: #e8cf9d;
  opacity: 0.9;
}

.letter-kicker {
  font-family: "Didot", "Bodoni MT", "Cormorant Garamond", "Times New Roman", "Songti SC", serif;
  font-size: 11px;
  letter-spacing: 0.32em;
  padding-left: 0.32em;
  color: rgba(232, 207, 157, 0.76);
  margin-bottom: 16px;
}

.letter-divider {
  width: 48px;
  height: 1px;
  margin: 0 auto 20px;
  background: linear-gradient(90deg, transparent, rgba(232, 207, 157, 0.52), transparent);
}

.letter-body {
  font-size: clamp(14px, 3.6vw, 15.5px);
  line-height: 2.05;
  letter-spacing: 0.11em;
  color: rgba(248, 236, 212, 0.90);
  margin-bottom: 24px;
}

.letter-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 196px;
  padding: 11px 26px;
  border-radius: 999px;
  border: 1px solid rgba(232, 207, 157, 0.56);
  background: linear-gradient(135deg, rgba(232, 207, 157, 0.16) 0%, rgba(198, 143, 73, 0.10) 100%);
  color: #f4daa6;
  font-family: inherit;
  font-size: 13.5px;
  letter-spacing: 0.2em;
  padding-left: calc(26px + 0.2em);
  cursor: pointer;
  box-shadow: 0 0 22px rgba(232, 207, 157, 0.12);
  transition: transform 0.24s ease, border-color 0.28s ease, background-color 0.28s ease;
}

.letter-cta:active {
  transform: scale(0.96);
}

@media (hover: hover) {
  .letter-cta:hover {
    border-color: rgba(244, 218, 166, 0.88);
    background: linear-gradient(135deg, rgba(232, 207, 157, 0.24) 0%, rgba(198, 143, 73, 0.16) 100%);
  }
}

/* 右上角手势速查条（支持手势同步也可直接轻触切换）、全息骨骼小窗与全局温和提示条 */
.gesture-guide {
  position: fixed;
  top: calc(64px + env(safe-area-inset-top));
  left: 50%;
  transform: translate(-50%, -6px);
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  max-width: calc(100vw - 16px);
  padding: 4px 6px;
  border-radius: 999px;
  border: 1px solid rgba(232, 207, 157, 0.22);
  background: rgba(8, 12, 26, 0.60);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.38s ease, transform 0.38s ease;
}

.gesture-guide.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.guide-chip {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  color: rgba(244, 224, 186, 0.88);
  font-family: inherit;
  font-size: clamp(9.5px, 2.6vw, 11px);
  line-height: 1.25;
  padding: 4px 5px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s ease, color 0.2s ease;
}

.guide-chip:active,
.guide-chip.is-active {
  background: rgba(232, 207, 157, 0.24);
  color: #fff6dd;
}

.hand-holo-box {
  position: fixed;
  right: calc(14px + env(safe-area-inset-right));
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 8;
  width: 140px;
  padding: 6px 6px 7px;
  border-radius: 10px;
  border: 1px solid rgba(232, 207, 157, 0.28);
  background: linear-gradient(160deg, rgba(13, 21, 42, 0.68) 0%, rgba(5, 8, 18, 0.78) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), inset 0 0 18px rgba(232, 207, 157, 0.06);
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition: opacity 0.38s ease, transform 0.38s ease;
}

.hand-holo-box.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.hand-holo-canvas {
  display: block;
  width: 126px;
  height: 92px;
  border-radius: 6px;
  background: radial-gradient(circle at 50% 50%, rgba(232, 207, 157, 0.06) 0%, rgba(2, 3, 9, 0.35) 100%);
}

.hand-holo-status {
  margin-top: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: rgba(244, 218, 166, 0.90);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gesture-dot {
  width: 5px;
  height: 5px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #e8cf9d;
  box-shadow: 0 0 8px rgba(232, 207, 157, 0.8);
  animation: dotPulse 1.6s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { opacity: 0.5; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

.toast-tip {
  position: fixed;
  left: 50%;
  top: calc(68px + env(safe-area-inset-top));
  transform: translate(-50%, -8px);
  z-index: 25;
  max-width: min(88vw, 350px);
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid rgba(232, 207, 157, 0.28);
  background: rgba(8, 13, 28, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: rgba(244, 224, 186, 0.92);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-align: center;
  line-height: 1.5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.32s ease, transform 0.32s ease;
}

.toast-tip.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
