/*
 * Extra presentation rules are kept separate so the animation can be tuned
 * without changing the page structure in 中秋.html.
 */

body.desktop {
  min-width: 1000px;
}

body.mobile {
  min-width: 320px;
}

@media (max-width: 768px) {
  html, body {
    overflow: hidden;
  }

  .intro {
    gap: 14px;
    padding: 18px;
  }

  .intro p {
    font-size: 15px;
    line-height: 1.6;
    width: min(92vw, 320px);
    text-align: center;
  }

  .envelope {
    width: 92px;
    height: 54px;
  }

  .heart {
    top: 18px;
    width: 22px;
    height: 18px;
  }

  .heart::before,
  .heart::after {
    width: 22px;
    height: 18px;
  }

  .scene {
    background:
      radial-gradient(circle at 50% 42%, rgba(255, 198, 92, .42), transparent 26%),
      radial-gradient(circle at 25% 73%, rgba(255, 155, 63, .34), transparent 34%),
      linear-gradient(180deg, #2b0d16 0%, #4c1d2d 38%, #12080c 100%);
  }

  .barrage {
    inset: -18% -22%;
    transform: rotate(0deg) scale(1.03);
    font-size: clamp(17px, 4.3vw, 26px);
  }

  .barrage span {
    opacity: .82;
    animation-duration: calc(var(--duration) * 1.4);
  }

  .watermark {
    bottom: 10px;
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .barrage span,
  .message {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
}

.theme-picker {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.theme-btn {
  position: relative;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.04));
  color: rgba(255, 255, 255, .92);
  padding: 8px 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all .25s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 4px 12px rgba(0,0,0,.18);
}

.theme-btn::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: inherit;
  background: rgba(255,255,255,.02);
  pointer-events: none;
}

.theme-btn.is-active {
  background: linear-gradient(180deg, rgba(255, 195, 89, .26), rgba(255, 116, 146, .22));
  border-color: rgba(255, 214, 140, .9);
  box-shadow: 0 0 18px rgba(255, 170, 92, .3), inset 0 1px 0 rgba(255,255,255,.3);
  transform: translateY(-1px);
}

.theme-btn:hover {
  transform: translateY(-1px) scale(1.02);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 48px;
  transform: translateX(-50%) translateY(12px);
  z-index: 25;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .36);
  border: 1px solid rgba(255, 219, 159, .32);
  color: rgba(255, 243, 217, .9);
  font-size: 12px;
  letter-spacing: 1px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease, transform .35s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.egg-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .8s ease;
}

.egg-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.egg-start {
  position: absolute;
  z-index: 1;
  padding: 14px 24px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 999px;
  color: #fff;
  background: rgba(70, 24, 39, .88);
  font-size: 16px;
  cursor: pointer;
}

.egg-overlay.is-playing .egg-start {
  display: none;
}

.egg-orientation-hint {
  display: none;
  position: absolute;
  z-index: 2;
  bottom: max(20px, env(safe-area-inset-bottom));
  margin: 0;
  padding: 10px 16px;
  border-radius: 999px;
  color: #fff;
  background: rgba(0, 0, 0, .72);
  font-size: 14px;
  text-align: center;
}

@media (orientation: portrait) {
  .egg-overlay.is-playing .egg-orientation-hint {
    display: block;
  }
}

#eggVideo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  opacity: 0;
  transition: opacity .8s ease .15s;
}

.egg-overlay.is-playing #eggVideo {
  opacity: 1;
}

.watermark {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 20;
  color: rgba(255, 240, 195, .35);
  font-size: 11px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
  text-shadow: none;
}

body[data-theme="classic"] .scene {
  background:
    radial-gradient(circle at 52% 48%, rgba(255, 89, 123, .2), transparent 22%),
    radial-gradient(circle at 25% 35%, rgba(111, 30, 52, .55), transparent 35%),
    linear-gradient(135deg, #16070d, #4a1c29 48%, #1a080e);
}

body[data-theme="classic"] .scene::before {
  opacity: .33;
  background:
    radial-gradient(ellipse at 30% 40%, #8d3a51 0 4%, transparent 5%),
    radial-gradient(ellipse at 72% 25%, #8d3a51 0 5%, transparent 6%),
    radial-gradient(ellipse at 62% 78%, #8d3a51 0 6%, transparent 7%);
  filter: blur(17px);
}

body[data-theme="classic"] .barrage {
  color: rgba(255, 159, 177, .78);
  text-shadow: 0 0 8px rgba(255, 109, 142, .28);
}

body[data-theme="warm"] .scene {
  background:
    radial-gradient(ellipse at 50% 42%, rgba(255, 238, 132, .55), transparent 36%),
    radial-gradient(ellipse at 18% 78%, rgba(255, 190, 36, .42), transparent 38%),
    linear-gradient(115deg, #ffd95a 0%, #ffc229 48%, #ff9e0b 100%);
}

body[data-theme="warm"] .scene::before {
  opacity: .3;
  background:
    radial-gradient(ellipse at 18% 28%, #fff0a1 0 5%, transparent 13%),
    radial-gradient(ellipse at 76% 70%, #f28b05 0 7%, transparent 16%),
    radial-gradient(ellipse at 50% 47%, #ffe36a 0 4%, transparent 19%);
  filter: blur(28px);
}

body[data-theme="warm"] .barrage {
  color: rgba(107, 48, 8, .88);
  text-shadow: 0 0 7px rgba(255, 244, 161, .75);
}

.scene {
  font-family: "小瘦金", "XiaoShouJin", "STKaiti", "KaiTi", serif;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(255, 238, 132, .55), transparent 36%),
    radial-gradient(ellipse at 18% 78%, rgba(255, 190, 36, .42), transparent 38%),
    linear-gradient(115deg, #ffd95a 0%, #ffc229 48%, #ff9e0b 100%);
}

.scene::before {
  opacity: .3;
  background:
    radial-gradient(ellipse at 18% 28%, #fff0a1 0 5%, transparent 13%),
    radial-gradient(ellipse at 76% 70%, #f28b05 0 7%, transparent 16%),
    radial-gradient(ellipse at 50% 47%, #ffe36a 0 4%, transparent 19%);
  filter: blur(28px);
}

.barrage {
  inset: -12% -20%;
  overflow: visible;
  transform: rotate(9deg) rotateY(-16deg) scale(1.08);
  transform-style: preserve-3d;
  perspective: 720px;
  perspective-origin: 50% 42%;
  color: rgba(107, 48, 8, .88);
  font-family: "小瘦金", "XiaoShouJin", "STKaiti", "KaiTi", serif;
  font-size: clamp(19px, 5.4vw, 44px);
  font-weight: 400;
  text-shadow: 0 0 7px rgba(255, 244, 161, .75);
}

.barrage span {
  left: var(--x);
  bottom: -22%;
  font-size: var(--size);
  opacity: .8;
  animation: cloudRise var(--duration) linear infinite;
  animation-delay: var(--delay);
  transform-origin: center center;
  transform-style: preserve-3d;
}

.barrage span:nth-child(7n) {
  color: #8a3900;
  text-shadow: 0 0 13px rgba(255, 246, 166, .9);
}

.barrage span:nth-child(11n) {
  color: #5b2600;
}

@keyframes cloudRise {
  0% {
    opacity: 0;
    transform: translate3d(0, 18vh, var(--depth)) rotate(var(--tilt)) rotateY(-22deg) scale(.36);
  }
  9% { opacity: .5; }
  40% {
    opacity: .95;
    transform: translate3d(0, -42vh, 180px) rotate(var(--tilt)) rotateY(-22deg) scale(1.2);
  }
  74% { opacity: .9; }
  100% {
    opacity: 0;
    transform: translate3d(0, -145vh, -260px) rotate(var(--tilt)) rotateY(-22deg) scale(.42);
  }
}
