/* ===== 基础 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: #fff;
  background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 45%, #a18cd1 100%);
  background-size: 200% 200%;
  animation: bgShift 18s ease infinite;
  position: relative;
  touch-action: manipulation;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

@keyframes bgShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

#bg-canvas,
#fx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#bg-canvas { z-index: 1; }
#fx-canvas { z-index: 3; }

.scene {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(20px + env(safe-area-inset-top)) calc(18px + env(safe-area-inset-right))
    calc(20px + env(safe-area-inset-bottom)) calc(18px + env(safe-area-inset-left));
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.96);
  transition: opacity 0.7s ease, transform 0.7s ease, visibility 0.7s;
}

.scene.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.card {
  width: min(560px, 100%);
  padding: 48px 36px;
  border-radius: 28px;
  text-align: center;
  margin: auto;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 20px 60px rgba(160, 60, 120, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: cardIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(26px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

h1 {
  font-size: clamp(22px, 5vw, 30px);
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 14px;
  text-shadow: 0 2px 12px rgba(190, 80, 140, 0.35);
}

h2 {
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 22px;
  text-shadow: 0 2px 12px rgba(190, 80, 140, 0.35);
}

.sub {
  font-size: 15px;
  letter-spacing: 1px;
  opacity: 0.9;
  margin-bottom: 30px;
}

.date {
  margin-top: 18px;
  font-size: 13px;
  letter-spacing: 2px;
  opacity: 0.75;
}

.hint {
  margin-top: 20px;
  font-size: 13px;
  height: 18px;
  letter-spacing: 1px;
  opacity: 0.85;
}

.heart {
  font-size: 54px;
  line-height: 1;
  margin-bottom: 18px;
  color: #ff4d6d;
  filter: drop-shadow(0 0 16px rgba(255, 77, 109, 0.7));
}
.heart-pulse { animation: pulse 1.4s ease-in-out infinite; }
.heart-beat { animation: beat 0.9s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.95; }
  50% { transform: scale(1.18); opacity: 1; }
}
@keyframes beat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.25); }
  30% { transform: scale(1); }
  45% { transform: scale(1.18); }
}

.btn {
  border: none;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 2px;
  padding: 14px 38px;
  border-radius: 999px;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.25s ease, opacity 0.4s ease;
}
.btn.primary {
  color: #fff;
  background: linear-gradient(135deg, #ff5f8f, #ff3d6e);
  box-shadow: 0 10px 26px rgba(255, 61, 110, 0.45);
}
.btn.primary:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 16px 34px rgba(255, 61, 110, 0.55);
}
.btn.ghost {
  color: #ff3d6e;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 8px 22px rgba(180, 80, 140, 0.25);
}
.btn.ghost:hover { transform: translateY(-3px) scale(1.04); }
.btn.small {
  margin-top: 26px;
  font-size: 14px;
  padding: 10px 26px;
  letter-spacing: 1px;
}
.btn-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

#btn-no {
  position: relative;
  transition: left 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    top 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.25s ease, font-size 0.3s ease;
}

.hidden { display: none; }

.letter {
  text-align: left;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
#typewriter {
  font-size: clamp(16px, 4vw, 19px);
  line-height: 2.1;
  letter-spacing: 1px;
  white-space: pre-wrap;
  width: 100%;
  text-shadow: 0 1px 8px rgba(190, 80, 140, 0.3);
}
.cursor::after {
  content: "|";
  margin-left: 2px;
  animation: blink 0.8s step-end infinite;
  color: #ff3d6e;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* 找不到链接时的提示 */
.notice {
  font-size: 15px;
  line-height: 1.9;
  letter-spacing: 1px;
  opacity: 0.95;
  margin-bottom: 26px;
}
.notice code {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.3);
  font-size: 13px;
  word-break: break-all;
}

/* ===== 竖屏手机 ===== */
@media (max-width: 480px) {
  .card { padding: 34px 20px; border-radius: 22px; }
  .heart { font-size: 46px; margin-bottom: 14px; }
  h1 { font-size: 21px; }
  h2 { font-size: 20px; margin-bottom: 18px; }
  .sub { font-size: 14px; margin-bottom: 24px; }
  .btn { padding: 14px 28px; font-size: 15px; letter-spacing: 1px; }
  .btn-row { gap: 12px; }
  .letter { min-height: 200px; }
  #typewriter { font-size: 16px; line-height: 2; }
}

/* ===== 触屏设备 ===== */
@media (hover: none) {
  .btn.primary:hover,
  .btn.ghost:hover {
    transform: none;
    box-shadow: 0 10px 26px rgba(255, 61, 110, 0.45);
  }
  .btn { min-height: 48px; }
}

/* ===== 矮屏 ===== */
@media (max-height: 560px) {
  .card { padding: 22px 20px; }
  .heart { font-size: 34px; margin-bottom: 8px; }
  h1, h2 { margin-bottom: 10px; }
  .sub { margin-bottom: 18px; }
  .letter { min-height: 150px; }
}

/* ===== 回忆相册 ===== */
.scene.tall { align-items: flex-start; }

.gallery-wrap {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 28px 0 40px;
}
.gallery-head { text-align: center; margin-bottom: 26px; }
.gallery-head h2 { margin-bottom: 8px; }
.gallery-head .sub { margin-bottom: 0; }

.media-item {
  margin: 0 0 26px;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 14px 36px rgba(160, 60, 120, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: itemIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes itemIn {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

.media-item img,
.media-item video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 72vh;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.14);
}
.media-item img { cursor: zoom-in; }
.media-item video { cursor: default; }

.media-item figcaption {
  padding: 13px 18px;
  font-size: 14px;
  line-height: 1.8;
  letter-spacing: 1px;
  text-align: center;
  background: rgba(255, 255, 255, 0.16);
  text-shadow: 0 1px 6px rgba(190, 80, 140, 0.3);
}

.gallery-foot { text-align: center; padding: 6px 0 30px; }

/* 全屏看图 */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(18, 6, 16, 0.93);
  cursor: zoom-out;
}
#lightbox.show { display: flex; }
#lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  animation: cardIn 0.35s ease both;
}

@media (max-width: 480px) {
  .gallery-wrap { padding: 18px 0 30px; }
  .media-item { margin-bottom: 18px; border-radius: 16px; }
  .media-item figcaption { font-size: 13px; padding: 11px 14px; }
}
