:root {
  --ink: #fff8ea;
  --ink-soft: rgba(255, 248, 234, 0.76);
  --gold: #d9bd7d;
  --gold-soft: rgba(217, 189, 125, 0.46);
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; }

body {
  overflow: hidden;
  background: #160b0b;
  color: var(--ink);
  font-family: "Songti SC", "STSong", "Noto Serif SC", "Microsoft YaHei", serif;
}

.wedding-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 0%, rgba(122, 44, 36, 0.34), transparent 50%), #160b0b;
}

.invitation {
  position: relative;
  isolation: isolate;
  width: min(100vw, 520px);
  height: 100vh;
  height: 100dvh;
  min-height: 620px;
  overflow: hidden;
  background: #241313;
  box-shadow: 0 0 70px rgba(0, 0, 0, 0.52);
  touch-action: pan-y;
  user-select: none;
  cursor: grab;
}

.invitation.is-dragging { cursor: grabbing; }

.music-toggle {
  position: absolute;
  z-index: 20;
  top: max(20px, env(safe-area-inset-top));
  right: 20px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(217, 189, 125, 0.7);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(43, 15, 15, 0.58);
  color: #ffe8bd;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  cursor: pointer;
  touch-action: manipulation;
}

.music-toggle::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(255, 232, 189, 0.3);
  border-radius: inherit;
}

.music-icon { font: 20px/1 Georgia, serif; transform: translateY(-1px); }
.music-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.music-toggle.is-playing .music-icon { animation: music-spin 3.6s linear infinite; }
.music-toggle.is-playing { box-shadow: 0 0 22px rgba(217, 189, 125, 0.5); }
.music-toggle.is-unavailable { opacity: 0.5; }
.music-toggle:focus-visible { outline: 2px solid #ffe8bd; outline-offset: 3px; }

@keyframes music-spin { to { transform: translateY(-1px) rotate(360deg); } }

.opening-screen {
  position: absolute;
  inset: 0;
  z-index: 40;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(100, 24, 27, 0.1), rgba(18, 6, 7, 0.72) 72%),
    linear-gradient(to bottom, rgba(12, 5, 6, 0.58), rgba(24, 7, 8, 0.4) 46%, rgba(10, 3, 4, 0.82));
  opacity: 1;
  transform: scale(1);
  transition: opacity 800ms ease, transform 900ms ease, visibility 0s 900ms;
}

.opening-screen.is-leaving {
  visibility: hidden;
  opacity: 0;
  transform: scale(1.035);
  pointer-events: none;
}

.opening-button {
  position: relative;
  width: 100%;
  height: 100%;
  padding: max(56px, env(safe-area-inset-top)) 30px max(52px, env(safe-area-inset-bottom));
  border: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: center;
  text-shadow: 0 3px 20px rgba(0, 0, 0, 0.9);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.opening-button::before {
  content: "";
  position: absolute;
  inset: 22px;
  border: 1px solid rgba(217, 189, 125, 0.58);
  box-shadow: inset 0 0 0 4px rgba(20, 5, 6, 0.12);
  pointer-events: none;
}

.opening-button::after {
  content: "";
  position: absolute;
  top: 31px;
  right: 31px;
  bottom: 31px;
  left: 31px;
  border-width: 1px 0;
  border-style: solid;
  border-color: rgba(217, 189, 125, 0.18);
  pointer-events: none;
}

.opening-eyebrow {
  margin-bottom: 25px;
  color: #ead29e;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 11px;
  letter-spacing: 0.38em;
}

.opening-seal {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 232, 189, 0.82);
  background: rgba(126, 18, 22, 0.8);
  color: #ffe8bd;
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  font-size: 40px;
  line-height: 1;
  box-shadow: 0 9px 35px rgba(35, 3, 5, 0.42);
}

.opening-names {
  margin-top: 30px;
  font-size: clamp(24px, 7vw, 34px);
  letter-spacing: 0.13em;
}

.opening-names i {
  margin: 0 6px;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.62em;
  font-style: normal;
}

.opening-date {
  margin-top: 12px;
  color: var(--ink-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  letter-spacing: 0.24em;
}

.opening-action {
  position: absolute;
  bottom: max(82px, calc(env(safe-area-inset-bottom) + 58px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.opening-action b {
  min-width: 148px;
  padding: 11px 22px;
  border-top: 1px solid rgba(217, 189, 125, 0.66);
  border-bottom: 1px solid rgba(217, 189, 125, 0.66);
  color: #ffe8bd;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0.26em;
  animation: opening-breathe 2.2s ease-in-out infinite;
}

.opening-action small {
  color: rgba(255, 248, 234, 0.66);
  font-size: 10px;
  letter-spacing: 0.2em;
}

.opening-button:focus-visible { outline: 2px solid #ffe8bd; outline-offset: -7px; }

@keyframes opening-breathe {
  0%, 100% { opacity: 0.72; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

.photo-stage, .background-photo, .photo-veil, .paper-grain, .ornamental-frame, .invitation-content {
  position: absolute;
  inset: 0;
}

.photo-stage { z-index: 0; background: #2a1716; }

.background-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1);
  filter: saturate(0.88) contrast(1.03);
  transition: opacity 1.8s ease-in-out, transform 6.8s ease-out;
  pointer-events: none;
}

.background-photo.is-active { opacity: 1; transform: scale(1.045); z-index: 1; }

.photo-veil {
  z-index: 2;
  background:
    linear-gradient(to bottom, rgba(14, 7, 7, 0.62) 0%, rgba(14, 7, 7, 0.2) 25%, rgba(14, 7, 7, 0.28) 58%, rgba(14, 7, 7, 0.78) 100%),
    radial-gradient(circle at 50% 44%, transparent 5%, rgba(28, 8, 8, 0.17) 55%, rgba(20, 5, 5, 0.58) 100%);
}

.paper-grain {
  z-index: 3;
  opacity: 0.12;
  mix-blend-mode: soft-light;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,.11) 0, rgba(255,255,255,.11) 1px, transparent 1px, transparent 4px),
    repeating-linear-gradient(90deg, rgba(0,0,0,.14) 0, rgba(0,0,0,.14) 1px, transparent 1px, transparent 5px);
}

.ornamental-frame {
  z-index: 5;
  pointer-events: none;
  margin: 14px;
  border: 1px solid var(--gold-soft);
  box-shadow: inset 0 0 0 4px rgba(15, 5, 4, 0.13);
}

.corner { position: absolute; width: 28px; height: 28px; border-color: var(--gold); border-style: solid; }
.corner-tl { top: 7px; left: 7px; border-width: 1px 0 0 1px; }
.corner-tr { top: 7px; right: 7px; border-width: 1px 1px 0 0; }
.corner-bl { bottom: 7px; left: 7px; border-width: 0 0 1px 1px; }
.corner-br { right: 7px; bottom: 7px; border-width: 0 1px 1px 0; }

.invitation-content {
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: max(30px, env(safe-area-inset-top)) 34px max(26px, env(safe-area-inset-bottom));
  text-align: center;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.76);
}

.invitation-header, .couple-block, .date-block, .venue-block, .invitation-footer { position: relative; z-index: 1; }
.invitation-header { display: flex; flex-direction: column; align-items: center; gap: 5px; }

.eyebrow {
  margin: 0;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 10px;
  letter-spacing: 0.34em;
}

.seal {
  width: 46px;
  height: 46px;
  margin-top: 4px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 233, 195, 0.75);
  background: rgba(128, 21, 24, 0.72);
  color: #ffe8bd;
  font-size: 29px;
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  line-height: 1;
  box-shadow: 0 5px 22px rgba(38, 4, 5, 0.34);
  transform: none;
}

.welcome { margin: 2px 0 0; color: var(--ink-soft); font-size: 12px; letter-spacing: 0.24em; }
.couple-block h1 { margin: 0; display: flex; align-items: center; justify-content: center; gap: 13px; font-size: clamp(30px, 8vw, 42px); font-weight: 400; letter-spacing: 0.14em; white-space: nowrap; }
.couple-block h1 b { color: var(--gold); font-family: Georgia, "Times New Roman", serif; font-size: 19px; font-weight: 400; letter-spacing: 0; }
.couple-block p { margin: 9px 0 0; color: var(--ink-soft); font-size: 12px; letter-spacing: 0.22em; }

.date-block {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(100%, 350px);
  padding: 11px 0;
  border-top: 1px solid var(--gold-soft);
  border-bottom: 1px solid var(--gold-soft);
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.15em;
}

.date-block strong {
  padding: 0 18px;
  border-right: 1px solid var(--gold-soft);
  border-left: 1px solid var(--gold-soft);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 7vw, 34px);
  font-weight: 400;
  letter-spacing: 0.05em;
}

.divider { display: flex; align-items: center; width: min(78%, 330px); color: var(--gold); }
.divider i { height: 1px; flex: 1; background: linear-gradient(to right, transparent, var(--gold-soft)); }
.divider i:last-child { background: linear-gradient(to left, transparent, var(--gold-soft)); }
.divider span { margin: 0 10px; font-size: 13px; }
.lyric-divider i { min-width: 18px; }
.lyric-text {
  --lyric-spacing: 0.08em;
  --lyric-opacity: 0.78;
  --lyric-scale: 1;
  --lyric-glow: 8px;
  max-width: min(68vw, 250px);
  overflow: hidden;
  color: #f1d79f;
  font-size: clamp(10px, 2.8vw, 13px) !important;
  letter-spacing: var(--lyric-spacing);
  line-height: 1.4;
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: var(--lyric-opacity);
  transform: scale(var(--lyric-scale));
  text-shadow: 0 0 var(--lyric-glow) rgba(235, 198, 123, 0.75);
  transition: opacity 100ms linear, transform 100ms linear, letter-spacing 180ms ease;
}

.lyric-text.is-changing { animation: lyric-change 650ms ease both; }

@keyframes lyric-change {
  0% { opacity: 0; transform: translateY(5px) scale(0.98); filter: blur(3px); }
  45% { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
.invitation-copy { margin: 0 0 12px; font-size: 14px; letter-spacing: 0.12em; }
.venue-label { margin: 0 0 5px; color: var(--gold); font-size: 10px; letter-spacing: 0.34em; }
.venue-block address { font-size: clamp(16px, 4.5vw, 20px); font-style: normal; line-height: 1.65; letter-spacing: 0.1em; }
.venue-map-link {
  display: block;
  padding: 3px 18px 8px;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  touch-action: manipulation;
  transition: background-color 180ms ease, box-shadow 180ms ease;
  -webkit-tap-highlight-color: rgba(217, 189, 125, 0.18);
}
.venue-map-link:hover,
.venue-map-link:focus-visible {
  background: rgba(56, 14, 15, 0.34);
  box-shadow: 0 0 0 1px rgba(217, 189, 125, 0.34);
  outline: none;
}
.map-action {
  width: max-content;
  min-width: 116px;
  margin: 9px auto 0;
  padding: 6px 12px;
  border: 1px solid rgba(217, 189, 125, 0.56);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: rgba(64, 15, 16, 0.46);
  color: #f1d79f;
  font-size: 10px;
  letter-spacing: 0.16em;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}
.map-action i { font-family: Georgia, "Times New Roman", serif; font-size: 14px; font-style: normal; line-height: 1; }
.invitation-footer p { margin: 0 0 11px; color: var(--ink-soft); font-size: 11px; letter-spacing: 0.28em; }
.slide-indicator { display: flex; justify-content: center; gap: 5px; }
.slide-indicator span { width: 3px; height: 3px; border-radius: 999px; background: rgba(255, 248, 234, 0.36); transition: width 1s ease, background-color 1s ease; }
.slide-indicator span.is-active { width: 15px; background: var(--gold); }

@media (max-height: 700px) {
  .invitation-content { padding-top: 24px; padding-bottom: 22px; }
  .seal { width: 39px; height: 39px; font-size: 25px; }
  .couple-block h1 { font-size: 28px; }
  .date-block { padding: 7px 0; }
  .date-block strong { font-size: 24px; }
  .invitation-copy { margin-bottom: 7px; }
  .venue-block address { font-size: 16px; line-height: 1.45; }
  .opening-eyebrow { margin-bottom: 18px; }
  .opening-seal { width: 54px; height: 54px; font-size: 34px; }
  .opening-names { margin-top: 22px; }
  .opening-action { bottom: max(58px, calc(env(safe-area-inset-bottom) + 40px)); }
}

@media (prefers-reduced-motion: reduce) {
  .background-photo, .slide-indicator span, .lyric-text { transition: none; }
  .background-photo.is-active { transform: none; }
  .music-toggle.is-playing .music-icon, .lyric-text.is-changing, .opening-action b { animation: none; }
  .opening-screen { transition-duration: 1ms; }
}
