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

body.invite-body {
  font-family: 'Be Vietnam Pro', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-weight: 300;
}

/* ===== Màn mở thiệp (chạm để mở) ===== */
body.envelope-closed { overflow: hidden; height: 100vh; }
.envelope {
  position: fixed;
  inset: 0;
  z-index: 1000;
  cursor: pointer;
}
.env-half {
  position: absolute;
  left: 0;
  right: 0;
  height: 50.5%;
  background: var(--bg-alt);
  transition: transform 1.1s cubic-bezier(.65, 0, .35, 1);
}
.env-top {
  top: 0;
  border-bottom: 1px solid var(--accent);
  background:
    radial-gradient(circle at 50% 130%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 60%),
    var(--bg-alt);
}
.env-bottom {
  bottom: 0;
  border-top: 1px solid var(--accent);
  background:
    radial-gradient(circle at 50% -30%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 60%),
    var(--bg-alt);
}
.env-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  transition: opacity .5s ease, transform .5s ease;
  padding: 24px;
}
.env-seal {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--primary);
  background:
    radial-gradient(circle at 34% 30%, color-mix(in srgb, #ffffff 26%, var(--primary)), var(--primary) 55%, var(--primary-dark) 100%);
  box-shadow:
    0 10px 28px color-mix(in srgb, var(--primary-dark) 45%, transparent),
    inset 0 0 0 6px color-mix(in srgb, #ffffff 14%, transparent),
    inset 0 0 0 12px color-mix(in srgb, var(--primary-dark) 55%, transparent);
  animation: seal-pulse 2.4s ease-in-out infinite;
}
.env-seal-orn { font-size: 52px; line-height: 1; text-shadow: 0 2px 6px rgba(0,0,0,.35); }
@keyframes seal-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.env-names {
  font-family: 'Dancing Script', cursive;
  font-size: clamp(26px, 5vw, 38px);
  color: var(--heading);
}
.env-date { font-size: 14px; letter-spacing: 4px; color: var(--muted); }
.env-hint {
  font-family: 'Dancing Script', cursive;
  font-size: 22px;
  color: var(--primary);
}
.env-open-btn {
  border: none;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .5px;
  padding: 12px 34px;
  border-radius: 26px;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--primary-dark) 40%, transparent);
  animation: hint-blink 1.8s ease-in-out infinite;
}
.env-open-btn:hover { background: var(--primary-dark); }
@keyframes hint-blink {
  0%, 100% { opacity: .45; }
  50% { opacity: 1; }
}
/* Trạng thái đang mở */
.envelope.opening .env-center { opacity: 0; transform: scale(1.25); pointer-events: none; }
.envelope.opening .env-top { transform: translateY(-101%); }
.envelope.opening .env-bottom { transform: translateY(101%); }
.envelope.opened { display: none; }

/* ===== Dải cảnh báo bản xem thử ===== */
.preview-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 950;
  background: #a12744;
  color: #fff;
  text-align: center;
  padding: 9px 12px;
  font-size: 13px;
  letter-spacing: .3px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
}
.preview-banner a { color: #ffe3ac; font-weight: 600; text-decoration: none; }
body.is-preview .cover { padding-top: 60px; }

.invite-footer a { color: var(--primary); text-decoration: none; font-weight: 500; }
.invite-footer a:hover { text-decoration: underline; }

/* Nút theo dõi khách - chỉ hiện với cặp đôi mở link có mã riêng */
.couple-guest-btn {
  position: fixed;
  right: 12px;
  z-index: 940;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
}
.couple-guest-btn:hover { background: var(--primary-dark); }

/* ===== Nút nhạc nền ===== */
.music-btn {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 900;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  font-size: 20px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .22);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: music-spin 5s linear infinite;
}
.music-btn.paused { animation: none; opacity: .75; }
@keyframes music-spin {
  from { transform: rotate(0); }
  to { transform: rotate(360deg); }
}

/* ===== Cánh hoa rơi ===== */
.petals {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 800;
  overflow: hidden;
}
.petal {
  position: absolute;
  top: -5vh;
  left: var(--x);
  width: var(--size);
  height: calc(var(--size) * 1.25);
  background: linear-gradient(135deg,
    color-mix(in srgb, #ffffff 45%, var(--accent)),
    var(--accent) 55%,
    color-mix(in srgb, var(--primary) 45%, var(--accent)));
  background-color: var(--accent);
  border-radius: 150% 0 150% 0;
  opacity: var(--op);
  animation: petal-fall var(--dur) linear var(--delay) infinite;
  will-change: transform;
}
@keyframes petal-fall {
  0% { transform: translate3d(0, -6vh, 0) rotate(0deg); }
  25% { transform: translate3d(var(--sway), 24vh, 0) rotate(calc(var(--spin) * .25)); }
  50% { transform: translate3d(calc(var(--sway) * -0.6), 52vh, 0) rotate(calc(var(--spin) * .5)); }
  75% { transform: translate3d(var(--sway), 80vh, 0) rotate(calc(var(--spin) * .75)); }
  100% { transform: translate3d(0, 112vh, 0) rotate(var(--spin)); }
}

/* ===== Cover ===== */
.cover {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 15%, var(--bg-alt) 0%, transparent 45%),
    radial-gradient(circle at 80% 85%, var(--bg-alt) 0%, transparent 45%),
    var(--bg);
}
.cover-frame {
  max-width: 640px;
  width: 100%;
  text-align: center;
  border: 1px solid var(--accent);
  outline: 4px double var(--accent);
  outline-offset: 8px;
  border-radius: 6px;
  padding: 64px 32px;
  background: var(--card);
  box-shadow: 0 24px 60px rgba(0,0,0,.08);
}
.cover-eyebrow {
  font-family: 'Dancing Script', cursive;
  font-size: 30px;
  color: var(--primary);
  margin-bottom: 18px;
}
.cover-frame::before {
  content: var(--ornament, '❦');
  display: block;
  font-size: 30px;
  color: var(--primary);
  margin-bottom: 10px;
}
.cover-photo {
  width: min(280px, 70%);
  margin: 6px auto 22px;
  border-radius: 160px 160px 14px 14px;
  overflow: hidden;
  border: 4px solid var(--card);
  outline: 1px solid var(--accent);
  box-shadow: 0 14px 34px rgba(0,0,0,.14);
}
.cover-photo img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
}
.cover-names {
  font-family: 'Playfair Display', serif;
  font-size: clamp(22px, 4.5vw, 40px);
  color: var(--heading);
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  margin-bottom: 24px;
}
.cover-names .amp { font-family: 'Dancing Script', cursive; color: var(--primary); font-weight: 500; }
.cover-date {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 18px 0 26px;
  color: var(--muted);
  letter-spacing: 2px;
  font-size: 14px;
}
.cover-dm {
  font-family: 'Playfair Display', serif;
  font-size: 40px;
  color: var(--primary);
  border-left: 1px solid var(--accent);
  border-right: 1px solid var(--accent);
  padding: 0 18px;
  letter-spacing: 0;
}
.cover-venue { color: var(--muted); font-size: 15px; margin-bottom: 8px; }
.cover-venue strong { color: var(--heading); font-weight: 600; letter-spacing: 1px; }
.cover-guest { margin-top: 18px; font-size: 15px; color: var(--muted); }
.cover-guest strong { font-family: 'Playfair Display', serif; font-size: 22px; color: var(--primary); }
.cover-actions { display: flex; gap: 14px; justify-content: center; margin-top: 30px; flex-wrap: wrap; }

.btn-invite {
  display: inline-block;
  border: none;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 28px;
  border-radius: 999px;
  text-decoration: none;
  transition: all .2s;
}
.btn-invite:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-invite.ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-invite.ghost:hover { background: var(--primary); color: #fff; }

/* ===== Sections ===== */
.sec {
  padding: 72px 24px;
  max-width: 860px;
  margin: 0 auto;
  text-align: center;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .7s ease, transform .7s ease;
}
.sec.visible { opacity: 1; transform: none; }
.sec-alt {
  max-width: none;
  background: var(--bg-alt);
}
.sec-alt > * { max-width: 860px; margin-left: auto; margin-right: auto; }
.sec-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(26px, 4.5vw, 38px);
  color: var(--heading);
  font-weight: 600;
  margin-bottom: 12px;
  position: relative;
  padding-bottom: 18px;
}
.sec-title::after {
  content: var(--ornament, '❦');
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -6px;
  color: var(--primary);
  font-size: 20px;
}
.sec-script {
  font-family: 'Dancing Script', cursive;
  font-size: clamp(30px, 5vw, 42px);
  color: var(--primary);
  margin-bottom: 16px;
}
.sec-script.small { font-size: 26px; margin: 6px 0 20px; }
.sec-text { font-size: 15.5px; color: var(--text); }
.sec-text.center { max-width: 640px; margin: 16px auto 0; }
.sec-text.muted { color: var(--muted); font-size: 14px; }
.sign { font-family: 'Dancing Script', cursive; font-size: 34px; color: var(--heading); margin: 10px auto 18px; text-align: center; }

/* ===== Couple ===== */
.couple {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
  margin-top: 36px;
}
.person {
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 36px 28px;
  box-shadow: 0 10px 30px rgba(0,0,0,.05);
}
.person-avatar {
  width: 92px; height: 92px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 44px;
}
.person-role { font-family: 'Dancing Script', cursive; font-size: 24px; color: var(--primary); }
.person-name { font-family: 'Playfair Display', serif; font-size: 24px; color: var(--heading); margin: 4px 0 12px; }
.person-intro { font-size: 14.5px; color: var(--text); }
.person-family { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--accent); font-size: 14px; color: var(--muted); }
.family-title { font-weight: 600; color: var(--heading); margin-bottom: 4px; }

/* ===== Timeline ===== */
.quote { font-style: italic; color: var(--muted); max-width: 560px; margin: 14px auto 0; font-size: 15px; }
.timeline { position: relative; margin-top: 44px; padding: 10px 0; }
.timeline::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  width: 2px;
  background: var(--accent);
  transform: translateX(-50%);
}
.tl-item { position: relative; width: 50%; padding: 14px 40px; text-align: left; }
.tl-item.left { left: 0; text-align: right; }
.tl-item.right { left: 50%; }
.tl-dot {
  position: absolute;
  top: 30px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--primary);
}
.tl-item.left .tl-dot { right: -9px; }
.tl-item.right .tl-dot { left: -9px; }
.tl-card {
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: 0 8px 24px rgba(0,0,0,.05);
}
.tl-date { font-family: 'Playfair Display', serif; color: var(--primary); font-size: 15px; letter-spacing: 1px; }
.tl-title { font-family: 'Playfair Display', serif; color: var(--heading); font-size: 19px; margin: 4px 0 8px; }
.tl-text { font-size: 14px; color: var(--text); }
@media (max-width: 640px) {
  .timeline::before { left: 12px; }
  .tl-item, .tl-item.left, .tl-item.right { width: 100%; left: 0; text-align: left; padding: 12px 0 12px 40px; }
  .tl-item.left .tl-dot, .tl-item.right .tl-dot { left: 5px; right: auto; }
}

/* ===== Album ===== */
.album {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 32px;
}
.album-item {
  aspect-ratio: 3/4;
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--accent);
}
.album-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s; }
.album-item:hover img { transform: scale(1.05); }
.album-item.placeholder { display: flex; align-items: center; justify-content: center; font-size: 52px; background: linear-gradient(160deg, var(--card), var(--bg-alt)); }
.dresscode { margin-top: 34px; }
.dresscode h3 { font-family: 'Dancing Script', cursive; font-size: 28px; color: var(--primary); margin-bottom: 6px; }
.dresscode p { color: var(--muted); font-size: 15px; }

/* ===== Events ===== */
.events {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
  margin-top: 36px;
}
.event-card {
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 34px 26px;
  box-shadow: 0 10px 30px rgba(0,0,0,.05);
}
.event-name { font-family: 'Dancing Script', cursive; font-size: 30px; color: var(--primary); margin-bottom: 12px; }
.event-venue { font-weight: 600; color: var(--heading); letter-spacing: 1px; font-size: 16px; }
.event-address { color: var(--muted); font-size: 14px; margin: 6px 0 10px; }
.event-time { font-size: 14px; letter-spacing: 2px; color: var(--text); font-weight: 500; }
.event-date {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin: 14px 0 8px; color: var(--muted); font-size: 13px; letter-spacing: 1px;
}
.event-date strong {
  font-family: 'Playfair Display', serif;
  font-size: 30px;
  color: var(--primary);
  border-left: 1px solid var(--accent);
  border-right: 1px solid var(--accent);
  padding: 0 14px;
}
.event-lunar { font-size: 13px; color: var(--muted); font-style: italic; }
.event-map { display: inline-block; margin-top: 12px; color: var(--primary); text-decoration: none; font-size: 14px; }
.event-map:hover { text-decoration: underline; }

/* ===== Countdown ===== */
.countdown { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.cd-box {
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: 14px;
  min-width: 92px;
  padding: 20px 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.05);
}
.cd-num { display: block; font-family: 'Playfair Display', serif; font-size: 40px; color: var(--primary); font-weight: 600; }
.cd-label { font-size: 13px; color: var(--muted); letter-spacing: 1px; }
/* Điện thoại: 4 ô đếm ngược nằm gọn 1 hàng */
@media (max-width: 480px) {
  .countdown { gap: 8px; flex-wrap: nowrap; }
  .cd-box { min-width: 0; flex: 1 1 0; padding: 14px 4px; }
  .cd-num { font-size: 28px; }
  .cd-label { font-size: 11px; }
}

/* ===== Calendar ===== */
.calendar {
  max-width: 360px;
  margin: 28px auto 0;
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 20px 18px;
  box-shadow: 0 8px 24px rgba(0,0,0,.05);
}
.cal-title {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  color: var(--heading);
  margin-bottom: 12px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  font-size: 13.5px;
}
.cal-dow { color: var(--muted); font-size: 11.5px; font-weight: 600; padding: 4px 0; letter-spacing: .5px; }
.cal-day { padding: 7px 0; border-radius: 50%; color: var(--text); position: relative; }
.cal-day.wedding {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent);
}
.cal-day.wedding::after {
  content: '♥';
  position: absolute;
  top: -9px; right: -2px;
  font-size: 11px;
  color: var(--primary);
}

/* ===== Forms ===== */
.form {
  max-width: 480px;
  margin: 28px auto 0;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 30px 28px;
  box-shadow: 0 10px 30px rgba(0,0,0,.05);
}
.form label { display: block; font-size: 13.5px; font-weight: 500; color: var(--heading); margin-bottom: 16px; }
.form input, .form select, .form textarea {
  width: 100%;
  margin-top: 6px;
  padding: 11px 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
.form button { width: 100%; margin-top: 4px; }
.form-msg { margin-top: 12px; font-size: 14px; text-align: center; }
.form-msg.ok { color: #2e7d32; }
.form-msg.err { color: #c62828; }

/* ===== Wishes ===== */
.wish-list {
  max-width: 640px;
  margin: 30px auto 0;
  display: grid;
  gap: 14px;
  text-align: left;
}
.wish {
  background: var(--card);
  border: 1px solid var(--accent);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  padding: 16px 20px;
}
.wish-msg { font-size: 14.5px; color: var(--text); font-style: italic; }
.wish-name { margin-top: 6px; font-size: 13.5px; color: var(--primary); font-weight: 500; }

/* ===== Gifts ===== */
.gifts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-top: 32px;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}
.gift-card {
  background: var(--card);
  border: 1px dashed var(--primary);
  border-radius: 14px;
  padding: 30px 24px;
}
.gift-card h3 { font-family: 'Dancing Script', cursive; font-size: 26px; color: var(--primary); margin-bottom: 12px; }
.gift-holder { font-weight: 600; color: var(--heading); letter-spacing: 1px; }
.gift-bank { color: var(--muted); font-size: 14px; margin: 2px 0; }
.gift-account { font-family: 'Playfair Display', serif; font-size: 24px; color: var(--heading); letter-spacing: 2px; margin: 8px 0 14px; }

/* ===== Footer ===== */
.invite-footer {
  text-align: center;
  padding: 28px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--accent);
}
