/* 黑金香槟雪夜 · 3D 粒子圣诞贺卡样式表（零外网依赖） */

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

html,
body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  position: relative;
  background-color: #020309;
  background: radial-gradient(ellipse at 50% 42%, #0d152a 0%, #060916 52%, #020309 100%);
  color: #e8cf9d;
  font-family: "Songti SC", "STSong", "Noto Serif SC", "PingFang SC", serif;
}

/* 流动暗夜极光薄纱背景层（低饱和、克制而不抢戏） */
.aurora-layer {
  position: fixed;
  inset: -12%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.78;
}

.aurora-layer::before,
.aurora-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  will-change: transform, opacity;
}

.aurora-layer::before {
  background: radial-gradient(
    ellipse 58% 42% at 32% 30%,
    rgba(30, 58, 108, 0.24) 0%,
    rgba(22, 42, 82, 0.10) 48%,
    rgba(2, 3, 9, 0) 76%
  );
  animation: auroraDriftA 22s ease-in-out infinite alternate;
}

.aurora-layer::after {
  background: radial-gradient(
    ellipse 48% 36% at 68% 38%,
    rgba(196, 152, 82, 0.085) 0%,
    rgba(42, 64, 110, 0.14) 44%,
    rgba(2, 3, 9, 0) 78%
  );
  animation: auroraDriftB 28s ease-in-out infinite alternate;
}

@keyframes auroraDriftA {
  0% { transform: translate3d(-4%, -2%, 0) scale(1); opacity: 0.72; }
  100% { transform: translate3d(5%, 3%, 0) scale(1.08); opacity: 0.96; }
}

@keyframes auroraDriftB {
  0% { transform: translate3d(4%, 2%, 0) scale(1.04); opacity: 0.68; }
  100% { transform: translate3d(-5%, -3%, 0) scale(0.96); opacity: 0.94; }
}

/* 极轻电影暗角遮罩，增强星夜深邃层次 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(
    circle at 50% 46%,
    rgba(0, 0, 0, 0) 56%,
    rgba(2, 3, 9, 0.54) 100%
  );
}

#card-canvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* 右上角极简操作栏 */
.top-controls {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  right: calc(16px + env(safe-area-inset-right));
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition:
    opacity 0.95s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.95s cubic-bezier(0.22, 1, 0.36, 1);
}

.top-controls.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(232, 207, 157, 0.22);
  background: rgba(8, 12, 26, 0.36);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(232, 207, 157, 0.78);
  cursor: pointer;
  transition:
    border-color 0.28s ease,
    color 0.28s ease,
    background-color 0.28s ease,
    transform 0.22s ease,
    opacity 0.28s ease;
}

.icon-btn svg {
  width: 17px;
  height: 17px;
  display: block;
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn:focus-visible {
  outline: 1.5px solid rgba(232, 207, 157, 0.65);
  outline-offset: 2px;
}

@media (hover: hover) {
  .icon-btn:hover {
    border-color: rgba(232, 207, 157, 0.5);
    color: #f4daa6;
    background: rgba(13, 21, 42, 0.56);
  }
}

.icon-btn .sound-waves {
  transition: opacity 0.25s ease;
}

.icon-btn .sound-slash {
  opacity: 0;
  transition: opacity 0.25s ease;
}

.icon-btn.is-muted {
  color: rgba(232, 207, 157, 0.46);
  border-color: rgba(232, 207, 157, 0.14);
}

.icon-btn.is-muted .sound-waves {
  opacity: 0;
}

.icon-btn.is-muted .sound-slash {
  opacity: 1;
}

.icon-btn.is-active {
  color: #f4daa6;
  border-color: rgba(244, 218, 166, 0.64);
  background: rgba(26, 38, 72, 0.56);
  box-shadow: 0 0 16px rgba(232, 207, 157, 0.24);
}

.icon-btn.is-spinning svg {
  transform: rotate(-180deg);
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 底部杂志感祝福层 */
.wish-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(28px + env(safe-area-inset-bottom));
  z-index: 6;
  padding: 0 24px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 1.15s cubic-bezier(0.22, 1, 0.36, 1),
    transform 1.15s cubic-bezier(0.22, 1, 0.36, 1);
}

.wish-footer.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.wish-en {
  font-family: "Didot", "Bodoni MT", "Cormorant Garamond", "Times New Roman", "Songti SC", serif;
  font-size: clamp(13px, 3.2vw, 17px);
  font-weight: 400;
  letter-spacing: 0.34em;
  padding-left: 0.34em;
  color: #e8cf9d;
  text-shadow: 0 1px 18px rgba(232, 207, 157, 0.18);
  margin-bottom: 8px;
}

.wish-cn {
  font-family: "Songti SC", "STSong", "Noto Serif SC", "PingFang SC", serif;
  font-size: clamp(12px, 3vw, 13.5px);
  font-weight: 400;
  letter-spacing: 0.18em;
  padding-left: 0.18em;
  line-height: 1.6;
  color: rgba(244, 224, 186, 0.78);
}

@media (max-height: 540px) {
  .wish-footer {
    bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .wish-en {
    margin-bottom: 4px;
  }
}

/* WebGL 不支持时的优雅兜底 */
.fallback-note {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  background: rgba(2, 3, 9, 0.9);
  color: rgba(244, 224, 186, 0.84);
  font-size: 14px;
  letter-spacing: 0.1em;
  line-height: 1.85;
}

[hidden] {
  display: none !important;
}
