/* ============================================================
   To 小宝贝 ♡  —  粉色梦幻样式
   ============================================================ */

:root {
  --pink-50: #fff5f7;
  --pink-100: #ffeaef;
  --pink-200: #ffd6e0;
  --pink-300: #ffb8cc;
  --pink-400: #ff9ec0;
  --pink-500: #ff7eac;
  --pink-600: #e85f95;
  --pink-700: #c44a7a;

  --rose: #e87fae;
  --cream: #fff8ee;
  --lavender: #f2e1f5;

  --ink: #5d3a4a;
  --ink-soft: #8d6677;
  --ink-faint: #b89aa6;

  --bg-grad: radial-gradient(ellipse at 20% 10%, #ffeaf2 0%, transparent 50%),
             radial-gradient(ellipse at 80% 30%, #ffd9e6 0%, transparent 55%),
             radial-gradient(ellipse at 50% 90%, #ffe7f0 0%, transparent 60%),
             linear-gradient(155deg, #fff5f8 0%, #ffe4ec 45%, #ffd1de 100%);

  --serif-zh: 'Noto Serif SC', 'Songti SC', serif;
  --hand-zh: 'Ma Shan Zheng', 'Liu Jian Mao Cao', cursive;
  --serif-en: 'Playfair Display', Georgia, serif;

  --shadow-soft: 0 20px 60px -20px rgba(232, 95, 149, 0.25),
                 0 6px 20px -6px rgba(196, 74, 122, 0.15);
  --shadow-deep: 0 30px 80px -20px rgba(232, 95, 149, 0.4),
                 0 10px 30px -8px rgba(196, 74, 122, 0.25);
}

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

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

body {
  font-family: var(--serif-zh);
  color: var(--ink);
  background: var(--bg-grad);
  background-attachment: fixed;
  min-height: 100vh;
  position: relative;
  overflow-y: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.4) 0%, transparent 30%),
    radial-gradient(circle at 70% 70%, rgba(255, 255, 255, 0.3) 0%, transparent 40%);
  pointer-events: none;
  z-index: 1;
}

/* ============================================================
   粒子层 / 爆心层
   ============================================================ */
#tsparticles {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

#burst-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  pointer-events: none;
}

/* ============================================================
   通用 Screen 容器
   ============================================================ */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6vh 24px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(24px);
  transition: opacity 0.9s ease, transform 0.9s ease, visibility 0s linear 0.9s;
  z-index: 10;
  overflow-y: auto;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.9s ease 0.2s, transform 0.9s ease 0.2s, visibility 0s linear 0s;
  z-index: 20;
}

/* ============================================================
   Section 1 — 锁屏
   ============================================================ */
.lock-card {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 32px;
  padding: 60px 56px 50px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  max-width: 440px;
  width: 100%;
  position: relative;
}

.lock-card::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 34px;
  background: linear-gradient(135deg, rgba(255, 158, 192, 0.5), rgba(255, 255, 255, 0));
  z-index: -1;
  opacity: 0.5;
}

.hello {
  font-family: var(--hand-zh);
  font-size: 36px;
  font-weight: 400;
  color: var(--rose);
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.heart-spin {
  display: inline-block;
  animation: heart-beat 1.6s ease-in-out infinite;
  color: var(--pink-500);
  margin-left: 4px;
}

@keyframes heart-beat {
  0%, 100% { transform: scale(1); }
  20%      { transform: scale(1.25); }
  40%      { transform: scale(0.95); }
  60%      { transform: scale(1.15); }
  80%      { transform: scale(1); }
}

.subtitle {
  font-family: var(--serif-zh);
  font-size: 18px;
  color: var(--ink-soft);
  margin-bottom: 4px;
  letter-spacing: 0.05em;
}

.sub-subtitle {
  font-family: var(--serif-zh);
  font-size: 15px;
  color: var(--ink-faint);
  margin-bottom: 32px;
  letter-spacing: 0.06em;
}

.sub-subtitle em {
  color: var(--rose);
  font-style: normal;
  font-weight: 500;
}

.input-wrap {
  position: relative;
  margin: 24px auto 16px;
  width: 220px;
}

#birthday-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  text-align: center;
  font-family: var(--serif-en);
  font-size: 32px;
  letter-spacing: 0.4em;
  color: var(--ink);
  padding: 12px 0 16px;
  caret-color: var(--rose);
}

#birthday-input::placeholder {
  color: var(--ink-faint);
  letter-spacing: 0.4em;
  font-style: italic;
}

.input-underline {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--pink-400), transparent);
  border-radius: 2px;
  transform-origin: center;
  transition: transform 0.3s ease, background 0.3s ease;
}

#birthday-input:focus + .input-underline {
  background: linear-gradient(90deg, transparent, var(--pink-600), transparent);
  transform: scaleX(1.08);
}

.lock-card.shake {
  animation: shake 0.5s cubic-bezier(.36,.07,.19,.97);
}

@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); }
  40%, 60% { transform: translateX(8px); }
}

.hint {
  font-size: 13px;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
  margin-top: 4px;
}

.error-msg {
  font-family: var(--hand-zh);
  font-size: 18px;
  color: var(--pink-600);
  margin-top: 16px;
  height: 22px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.error-msg.show {
  opacity: 1;
}

/* ============================================================
   Section 2 — 欢迎页
   ============================================================ */
.welcome-inner {
  text-align: center;
  max-width: 720px;
  width: 100%;
}

.welcome-tiny {
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 16px;
  color: var(--rose);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(10px);
}

.big-title {
  font-family: var(--hand-zh);
  font-size: clamp(48px, 9vw, 96px);
  font-weight: 400;
  line-height: 1.1;
  color: var(--ink);
  letter-spacing: 0.04em;
  margin-bottom: 36px;
}

.big-title .line {
  display: block;
  opacity: 0;
  transform: translateY(20px);
}

.big-title .line.italic {
  font-family: var(--serif-en);
  font-style: italic;
  font-weight: 400;
  color: var(--rose);
  font-size: 0.7em;
  margin-top: 4px;
}

.hb-heart {
  display: inline-block;
  color: var(--pink-500);
  animation: heart-beat 1.6s ease-in-out infinite;
}

.message-box {
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  padding: 28px 32px;
  margin: 24px auto 36px;
  max-width: 560px;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  transform: translateY(20px);
}

.message-text {
  font-family: var(--serif-zh);
  font-size: 17px;
  line-height: 1.9;
  color: var(--ink);
  letter-spacing: 0.05em;
  text-align: left;
  white-space: pre-wrap;
}

.message-text::after {
  content: '|';
  color: var(--rose);
  animation: blink 1s infinite;
  margin-left: 2px;
}

.message-text.typing-done::after {
  display: none;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ============================================================
   通用 Next 按钮
   ============================================================ */
.next-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--pink-400), var(--pink-500));
  color: white;
  border: none;
  border-radius: 999px;
  padding: 14px 32px;
  font-family: var(--serif-zh);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.1em;
  cursor: pointer;
  box-shadow: 0 14px 30px -8px rgba(232, 95, 149, 0.5);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  opacity: 0;
}

.next-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 40px -10px rgba(232, 95, 149, 0.6);
}

.next-btn:active {
  transform: translateY(0);
}

.next-btn .arrow {
  display: inline-block;
  transition: transform 0.3s ease;
}

.next-btn:hover .arrow {
  transform: translateX(4px);
}

/* ============================================================
   Section 3 — 照片墙
   ============================================================ */
.section-eyebrow {
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 15px;
  color: var(--rose);
  letter-spacing: 0.4em;
  text-transform: lowercase;
  margin-bottom: 12px;
  opacity: 0;
  transform: translateY(10px);
}

.section-title {
  font-family: var(--hand-zh);
  font-size: clamp(40px, 7vw, 64px);
  font-weight: 400;
  color: var(--ink);
  letter-spacing: 0.06em;
  margin-bottom: 40px;
  opacity: 0;
  transform: translateY(10px);
}

.polaroid-stack {
  position: relative;
  width: min(720px, 92vw);
  min-height: 360px;
  margin: 0 auto 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1000px;
}

.polaroid {
  position: absolute;
  width: 240px;
  background: #fffaf6;
  padding: 14px 14px 50px;
  border-radius: 4px;
  box-shadow: 0 16px 40px -10px rgba(196, 74, 122, 0.3),
              0 4px 12px -4px rgba(196, 74, 122, 0.2);
  transition: transform 0.5s cubic-bezier(.22,1,.36,1), box-shadow 0.4s ease, z-index 0s 0.25s;
  cursor: pointer;
}

.polaroid::before {
  content: '';
  position: absolute;
  top: 0;
  left: 30%;
  width: 40%;
  height: 24px;
  background: rgba(255, 158, 192, 0.4);
  transform: translateY(-12px);
  border-radius: 2px;
  box-shadow: 0 2px 6px rgba(232, 95, 149, 0.2);
}

.polaroid img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
  border-radius: 2px;
}

.polaroid .caption {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--hand-zh);
  font-size: 16px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}

.polaroid:hover {
  transform: translate(var(--tx, 0), var(--ty, 0)) rotate(0deg) scale(1.06) !important;
  z-index: 50 !important;
  box-shadow: 0 30px 60px -10px rgba(196, 74, 122, 0.45);
  transition: transform 0.4s cubic-bezier(.22,1,.36,1), box-shadow 0.4s ease, z-index 0s 0s;
}

.polaroid.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 280px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink-faint);
  font-family: var(--hand-zh);
  font-size: 14px;
  text-align: center;
  line-height: 1.6;
}

.polaroid.placeholder::after {
  content: '把照片放到 /photos 里';
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-faint);
}

/* ============================================================
   Section 4 — 礼物
   ============================================================ */
.gift-stage {
  position: relative;
  margin: 24px auto 0;
  width: 220px;
  height: 240px;
  perspective: 1200px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gift-box {
  position: relative;
  width: 200px;
  height: 180px;
  transform-style: preserve-3d;
  cursor: pointer;
  margin: 0 auto;
  filter: drop-shadow(0 18px 24px rgba(232, 95, 149, 0.35));
  transition: transform 0.4s ease;
}

.gift-box:hover {
  transform: translateY(-6px);
}

.gift-body {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 130px;
  background: linear-gradient(155deg, #ff9ec0 0%, #ff7eac 60%, #e85f95 100%);
  border-radius: 6px;
  box-shadow: inset 0 -16px 24px -8px rgba(196, 74, 122, 0.5),
              inset 0 8px 12px -2px rgba(255, 255, 255, 0.4);
}

.gift-lid {
  position: absolute;
  top: 0;
  left: -6px;
  width: calc(100% + 12px);
  height: 56px;
  background: linear-gradient(165deg, #ffb8cc 0%, #ff9ec0 50%, #ff7eac 100%);
  border-radius: 6px;
  box-shadow: inset 0 -10px 16px -6px rgba(196, 74, 122, 0.4),
              inset 0 6px 10px -2px rgba(255, 255, 255, 0.6),
              0 4px 8px rgba(196, 74, 122, 0.3);
  transform-origin: bottom left;
  transition: transform 0.9s cubic-bezier(.22,1,.36,1);
  z-index: 3;
}

.gift-ribbon-v {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 24px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #fff5d6 0%, #ffd76e 50%, #f5b524 100%);
  box-shadow: inset 0 0 8px rgba(196, 74, 122, 0.2);
}

.gift-ribbon-h {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 22px;
  transform: translateY(-50%);
  background: linear-gradient(180deg, #fff5d6 0%, #ffd76e 50%, #f5b524 100%);
  box-shadow: inset 0 0 8px rgba(196, 74, 122, 0.2);
}

.gift-ribbon-top {
  position: absolute;
  top: 0;
  left: 50%;
  bottom: 0;
  width: 24px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #fff5d6 0%, #ffd76e 50%, #f5b524 100%);
  box-shadow: inset 0 0 8px rgba(196, 74, 122, 0.2);
}

.gift-bow {
  position: absolute;
  top: -36px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 44px;
  z-index: 4;
  background:
    radial-gradient(circle at 30% 50%, #ffd76e 0%, #f5b524 60%, transparent 60%),
    radial-gradient(circle at 70% 50%, #ffd76e 0%, #f5b524 60%, transparent 60%);
  background-size: 70% 100%, 70% 100%;
  background-position: left center, right center;
  background-repeat: no-repeat;
  filter: drop-shadow(0 4px 6px rgba(196, 74, 122, 0.3));
  transition: transform 0.9s cubic-bezier(.22,1,.36,1);
}

.gift-bow::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 18px;
  background: radial-gradient(circle, #ffd76e 30%, #f5b524 70%);
  border-radius: 50%;
}

.gift-box.opened .gift-lid {
  transform: rotateX(-120deg) translateY(-8px);
}

.gift-box.opened .gift-bow {
  transform: translateX(-50%) translateY(-30px) rotateZ(-15deg);
  opacity: 0.85;
}

.gift-shadow {
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 180px;
  height: 18px;
  background: radial-gradient(ellipse, rgba(196, 74, 122, 0.3) 0%, transparent 70%);
  filter: blur(4px);
}

.gift-hint {
  margin-top: 36px;
  font-family: var(--hand-zh);
  font-size: 18px;
  color: var(--rose);
  letter-spacing: 0.1em;
  animation: hint-bounce 1.8s ease-in-out infinite;
}

@keyframes hint-bounce {
  0%, 100% { transform: translateY(0); opacity: 0.8; }
  50%      { transform: translateY(-4px); opacity: 1; }
}

.gift-content {
  margin-top: 28px;
  text-align: center;
  max-width: 540px;
  width: 100%;
  opacity: 0;
  transform: translateY(20px);
  visibility: hidden;
  transition: opacity 0.8s ease, transform 0.8s ease, visibility 0s linear 0.8s;
}

.gift-content.show {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
  transition: opacity 0.8s ease 0.6s, transform 0.8s ease 0.6s, visibility 0s linear 0s;
}

.gift-intro-text {
  font-family: var(--serif-zh);
  font-size: 18px;
  line-height: 1.9;
  color: var(--ink);
  margin-bottom: 12px;
  letter-spacing: 0.04em;
}

.gift-intro-text .ck {
  font-family: var(--serif-en);
  font-style: italic;
  font-weight: 500;
  color: var(--rose);
  font-size: 1.08em;
}

.gift-sub-text {
  font-family: var(--hand-zh);
  font-size: 20px;
  color: var(--rose);
  margin-bottom: 32px;
  letter-spacing: 0.06em;
}

.credentials {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  padding: 20px 24px;
  margin: 0 auto 32px;
  box-shadow: var(--shadow-soft);
  max-width: 460px;
}

.credential-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.credential-row + .credential-row {
  border-top: 1px dashed rgba(232, 95, 149, 0.2);
}

.cred-label {
  font-family: var(--serif-zh);
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: 0.1em;
  min-width: 42px;
  text-align: left;
}

.cred-value {
  flex: 1;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 14px;
  color: var(--ink);
  text-align: left;
  word-break: break-all;
  user-select: all;
}

.cred-value.masked {
  letter-spacing: 0.2em;
}

.copy-btn {
  background: rgba(255, 158, 192, 0.2);
  color: var(--pink-700);
  border: 1px solid rgba(232, 95, 149, 0.3);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: var(--serif-zh);
  font-size: 12px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.copy-btn:hover {
  background: rgba(255, 158, 192, 0.4);
}

.copy-btn:active {
  transform: scale(0.94);
}

.copy-btn.copied {
  background: var(--pink-500);
  color: white;
  border-color: var(--pink-500);
}

.love-end {
  margin-top: 4px;
}

.love-end-zh {
  display: block;
  font-family: var(--hand-zh);
  font-size: 28px;
  color: var(--rose);
  letter-spacing: 0.12em;
  margin-bottom: 4px;
}

.love-end-en {
  display: block;
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 16px;
  color: var(--pink-500);
  letter-spacing: 0.1em;
}

/* ============================================================
   音乐开关
   ============================================================ */
.audio-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 158, 192, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rose);
  font-size: 18px;
  cursor: pointer;
  z-index: 200;
  box-shadow: 0 6px 16px -4px rgba(232, 95, 149, 0.25);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, transform 0.2s ease;
}

.audio-toggle.show {
  opacity: 0.85;
  visibility: visible;
}

.audio-toggle:hover {
  transform: scale(1.1);
  opacity: 1;
}

.audio-toggle.muted {
  color: var(--ink-faint);
}

.audio-toggle.muted::after {
  content: '';
  position: absolute;
  inset: 12px;
  border-top: 2px solid var(--ink-faint);
  transform: rotate(-45deg);
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 640px) {
  .lock-card {
    padding: 44px 28px 36px;
    border-radius: 24px;
  }
  .hello { font-size: 30px; }
  #birthday-input { font-size: 26px; }
  .input-wrap { width: 180px; }
  .message-box { padding: 22px 22px; }
  .message-text { font-size: 16px; }
  .polaroid { width: 200px; }
  .polaroid img { height: 200px; }
  .gift-box { width: 170px; height: 150px; }
  .gift-body { height: 110px; }
  .gift-lid { height: 48px; }
  .credential-row { flex-wrap: wrap; gap: 6px; }
  .cred-value { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
