/* ================= Tokens ================= */
:root {
  /* Giao thoa Việt – Hàn: đỏ son & vàng kim (hỷ Việt), xanh lam – đỏ 청홍 (Hàn), nền giấy dó / hanji */
  --bg: #f3ebdd;
  --cream: #fbf6ec;
  --paper: #fffbf3;
  --blush: #f5e8db;
  --blush-2: #e8d3bd;
  --rose: #c0504d;
  --rose-deep: #9b2c35;
  --red: #b8323a;
  --blue: #2f4b7c;
  --gold: #b98f3e;
  --gold-soft: #dcc28a;
  --jade: #4f7f6f;
  --ink: #2b211c;
  --muted: #7a6c62;
  --line: #ecdcc8;
  --serif: "Cormorant Garamond", "Gowun Batang", Georgia, serif;
  --sans: "Be Vietnam Pro", "Gowun Batang", system-ui, sans-serif;
  --ko: "Gowun Batang", "Noto Serif KR", serif;
  color-scheme: light;
}
html:lang(ko) { --sans: "Gowun Batang", "Noto Serif KR", "Be Vietnam Pro", serif; --serif: "Gowun Batang", "Cormorant Garamond", serif; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink);
  background:
    linear-gradient(180deg, #f7f5f3 0%, #f3f0ee 100%);
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ================= Layout ================= */
.page {
  max-width: 480px;
  margin: 0 auto;
  background: var(--paper);
  box-shadow: 0 18px 50px rgba(24, 28, 32, 0.06);
  overflow: hidden;
  border-left: 1px solid rgba(33, 38, 42, 0.04);
  border-right: 1px solid rgba(33, 38, 42, 0.04);
}
section { padding: 78px 28px; text-align: center; position: relative; }
section.alt { background: linear-gradient(180deg, #faf8f6 0%, #f4f1ef 100%); }

.kicker {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--rose-deep);
  opacity: 0.9;
}
h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.3;
  margin: 6px 0 28px;
  letter-spacing: 0.02em;
}
.lead { color: var(--muted); margin: -12px auto 28px; max-width: 340px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 14px; }
.divider { color: var(--rose); font-size: 22px; margin: 18px 0; }

/* ================= Buttons ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.7);
  color: var(--ink);
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn:hover { background: var(--blush); border-color: var(--blush-2); }
.btn-primary {
  width: 100%;
  min-height: 50px;
  font-size: 15px;
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.btn-primary:hover { background: #30363d; }
.btn:disabled { opacity: 0.6; cursor: wait; }
:focus-visible { outline: 2px solid var(--rose-deep); outline-offset: 2px; }

/* ================= Petals ================= */
#petals { position: fixed; inset: 0; z-index: 101; pointer-events: none; }

/* ================= Intro / envelope ================= */
.intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 24px;
  text-align: center;
  background: linear-gradient(180deg, #f8f5f3 0%, #f1eeed 100%);
  transition: opacity 0.9s ease, visibility 0.9s;
}
.intro.hide { opacity: 0; visibility: hidden; }
.intro { perspective: 1100px; overflow: hidden; }
.intro-to { font-family: var(--serif); font-size: 22px; min-height: 1em; }
.intro-hint { font-size: 13px; color: var(--muted); animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }

.envelope {
  position: relative;
  z-index: 1;
  width: min(78vw, 340px);
  aspect-ratio: 1.45;
  margin-top: 40px;
  border: 0;
  background: none;
  cursor: pointer;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.6s ease-out;
  animation: env-float 4.5s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
}
@keyframes env-float { 50% { translate: 0 -10px; } }
.envelope > span, .envelope > svg { position: absolute; display: block; }
/* Thứ tự các lớp theo chiều sâu (translateZ) */
.env-back { inset: 0; border-radius: 8px; background: #e8c4bd; box-shadow: 0 26px 50px rgba(150, 90, 80, 0.25); }
.env-card {
  left: 6%; right: 6%; top: 6%; bottom: 8%;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 4px;
  background: linear-gradient(180deg, #fffdfb, #fbf3ef);
  border: 1px solid #ecd9cf;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  transform: translateZ(1px);
}
.env-card-kicker { font-family: var(--serif); font-style: italic; font-size: 12px; letter-spacing: 0.2em; color: var(--rose); text-transform: uppercase; }
.env-names { font-family: var(--serif); font-size: 22px; font-style: italic; }
.env-date { font-size: 11px; letter-spacing: 0.2em; color: var(--muted); }
.env-front {
  inset: 0;
  border-radius: 8px;
  background: linear-gradient(170deg, #f3d6d0, #e9c0b9);
  clip-path: polygon(0 0, 50% 58%, 100% 0, 100% 100%, 0 100%);
  transform: translateZ(3px);
}
.env-flap {
  left: 0; right: 0; top: 0;
  height: 62%;
  background: linear-gradient(#e2b3ab, #d9a299);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top;
  transform: translateZ(4px);
}
.env-ribbon {
  top: 60%;
  height: 14px;
  margin-top: -7px;
  width: 50%;
  background: linear-gradient(180deg, #eeb3b5, #c96f77 50%, #e3979c);
  box-shadow: 0 2px 4px rgba(120, 40, 50, 0.2);
  transform: translateZ(5px);
  transition: transform 0.55s cubic-bezier(0.6, 0, 0.4, 1);
}
.env-ribbon-l { left: 0; transform-origin: left; }
.env-ribbon-r { right: 0; transform-origin: right; }
.env-bow {
  left: 50%; top: 60%;
  width: 118px;
  translate: -50% -42%;
  filter: drop-shadow(0 4px 4px rgba(120, 40, 50, 0.25));
  transform: translateZ(6px);
  transition: transform 0.6s cubic-bezier(0.5, 0, 0.6, 1), opacity 0.45s ease 0.1s;
}
.seal {
  left: 50%; top: 60%;
  width: 52px; height: 52px;
  display: grid !important;
  place-items: center;
  border-radius: 50%;
  translate: -50% -50%;
  background: radial-gradient(circle at 35% 30%, #d88581, #a24b48 75%);
  color: #fff4f1;
  font-family: var(--serif);
  font-size: 13px;
  box-shadow: 0 3px 8px rgba(120, 40, 40, 0.35), inset 0 0 0 3px rgba(255, 255, 255, 0.15);
  transform: translateZ(8px);
  transition: transform 0.3s;
}
.envelope:hover .seal { transform: translateZ(8px) scale(1.08); }
/* Trình tự mở: tháo nơ → bật nắp → thiệp trượt ra → bay về phía người xem */
.envelope.open { animation: none; }
.envelope.open .env-ribbon { transform: translateZ(5px) scaleX(0); }
.envelope.open .env-bow { transform: translateZ(60px) rotate(-25deg) scale(1.5); opacity: 0; }
.envelope.open .seal { animation: seal-pop 0.5s ease forwards; }
.envelope.open .env-flap { animation: flap-open 0.75s cubic-bezier(0.4, 0, 0.3, 1) 0.35s forwards; }
.envelope.open .env-card { animation: card-out 1.7s cubic-bezier(0.3, 0.7, 0.3, 1) 0.95s forwards; }
@keyframes seal-pop {
  40% { transform: translateZ(14px) scale(1.18); }
  to { transform: translateZ(70px) scale(0.3); opacity: 0; }
}
@keyframes flap-open {
  0% { transform: translateZ(4px) rotateX(0deg); }
  49% { transform: translateZ(4px) rotateX(89deg); }
  51% { transform: translateZ(-1px) rotateX(91deg); }
  100% { transform: translateZ(-1px) rotateX(180deg); }
}
@keyframes card-out {
  0% { transform: translateZ(1px); }
  50% { transform: translateY(-100%) translateZ(1px); }
  100% { transform: translateY(-30%) translateZ(260px) rotateX(-6deg); }
}
.intro-fl {
  position: absolute;
  width: min(64vw, 300px);
  aspect-ratio: 1;
  pointer-events: none;
  translate: calc(var(--mx, 0) * -16px) calc(var(--my, 0) * -12px);
}
.intro-fl-tl { top: -60px; left: -76px; }
.intro-fl-br { bottom: -60px; right: -76px; }

/* ================= Floating controls ================= */
.lang {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  z-index: 110;
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(29, 35, 40, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 20px rgba(24, 28, 32, 0.04);
}
.lang button {
  border: 0;
  background: none;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  letter-spacing: 0.08em;
}
.lang button[aria-pressed="true"] { background: var(--ink); color: #fff; }

.music {
  position: fixed;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 90;
  width: 46px; height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(29, 35, 40, 0.08);
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  box-shadow: 0 10px 22px rgba(24, 28, 32, 0.08);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s, transform 0.2s;
}
.music:hover { transform: translateY(-1px); }
.music.show { opacity: 1; pointer-events: auto; }
.music.playing svg { animation: spin 4s linear infinite; }
.music:not(.playing)::after {
  content: "";
  position: absolute;
  width: 26px; height: 1.5px;
  background: currentColor;
  transform: rotate(-45deg);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= Cover ================= */
.cover { padding: 64px 28px 72px; }
.cover-photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  margin: 22px auto 34px;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(180deg, #eee9e6 0%, #f6f3f1 100%);
  box-shadow: 0 20px 38px rgba(24, 28, 32, 0.08);
}
.cover-photo img { width: 100%; height: 100%; object-fit: cover; }
.cover-names {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 42px;
  line-height: 1.1;
  letter-spacing: 0.02em;
}
.amp { font-style: italic; font-size: 30px; color: var(--rose-deep); margin: 4px 0; }
.cover-date { margin-top: 26px; font-family: var(--serif); font-size: 22px; letter-spacing: 0.18em; }
.cover-sub { font-size: 13px; color: var(--muted); }
.cover-venue { margin-top: 6px; font-size: 13px; color: var(--muted); }

/* ================= Invitation ================= */
.invite-kicker { margin-top: 18px; color: var(--muted); }
.invite-guest { font-family: var(--serif); font-size: 30px; font-weight: 500; color: var(--rose-deep); line-height: 1.3; margin-top: 4px; word-break: break-word; }
.invite-poem { white-space: pre-line; line-height: 2.1; }

/* ================= Families ================= */
.family { padding-top: 64px; padding-bottom: 64px; }
.song-hy {
  font-family: "Noto Serif TC", "Noto Serif KR", serif;
  font-weight: 700;
  font-size: 54px;
  line-height: 1;
  color: #b4473f;
}
.family-intro { margin: 18px auto 30px; max-width: 320px; font-family: var(--serif); font-size: 19px; font-style: italic; line-height: 1.5; }
.families { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.family-side { padding: 0 10px; }
.family-side + .family-side { border-left: 1px solid var(--line); }
.family-label { margin-bottom: 8px; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: #b4473f; }
.family-name { font-family: var(--serif); font-size: 17px; font-weight: 500; line-height: 1.45; }
.family-home { margin-top: 10px; font-size: 12px; line-height: 1.6; color: var(--muted); }

/* ================= Couple ================= */
.couple { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.person img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 999px 999px 10px 10px;
  margin-bottom: 14px;
}
.person-role { font-size: 12px; letter-spacing: 0.15em; color: var(--rose); text-transform: uppercase; }
.person-name { font-family: var(--serif); font-size: 20px; font-weight: 500; line-height: 1.3; margin: 2px 0 6px; }
.person-parents { font-size: 12px; color: var(--muted); line-height: 1.6; }

/* ================= Calendar & countdown ================= */
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 4px;
  max-width: 320px;
  margin: 0 auto;
  padding: 20px 8px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.calendar span { height: 38px; display: grid; place-items: center; }
.calendar .wd { font-size: 12px; color: var(--muted); height: 30px; }
.calendar .sun { color: var(--rose-deep); }
.calendar .wedding-day {
  position: relative;
  width: 38px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--rose-deep);
  color: #fff;
  font-weight: 500;
}
.calendar .wedding-day::after { content: "♥"; position: absolute; right: -6px; top: -6px; font-size: 13px; color: #c95a54; }
.countdown-title { margin: 40px 0 16px; font-weight: 400; font-size: 14px; color: var(--muted); }
.countdown { display: flex; justify-content: center; gap: 10px; }
.countdown div {
  width: 68px;
  padding: 12px 0 8px;
  border-radius: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
}
.countdown b { display: block; font-family: var(--serif); font-size: 30px; font-weight: 500; line-height: 1.1; color: var(--rose-deep); }
.countdown span { font-size: 11px; color: var(--muted); }
.dday { margin-top: 20px; font-family: var(--serif); font-size: 18px; font-style: italic; }

/* ================= Story timeline ================= */
.timeline { list-style: none; position: relative; text-align: left; max-width: 360px; margin: 0 auto; padding-left: 30px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 1px; background: var(--blush-2); }
.tl-item { position: relative; padding-bottom: 34px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -29px; top: 8px;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--rose);
}
.tl-item:last-child::before { background: var(--rose); }
.tl-date { font-family: var(--serif); font-style: italic; color: var(--rose); letter-spacing: 0.08em; }
.tl-title { font-family: var(--serif); font-size: 21px; font-weight: 500; line-height: 1.35; }
.tl-text { color: var(--muted); margin-top: 4px; }
.tl-item img { margin-top: 12px; border-radius: 10px; aspect-ratio: 4 / 3; object-fit: cover; object-position: 50% 8%; width: 100%; }

/* ================= Events ================= */
.event {
  padding: 30px 20px;
  margin-bottom: 18px;
  border-radius: 20px;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line);
  box-shadow: 0 8px 20px rgba(24, 28, 32, 0.03);
}
.event:last-child { margin-bottom: 0; }
.event h3 { font-family: var(--serif); font-size: 25px; font-weight: 500; line-height: 1.3; margin: 2px 0 12px; }
.event-time { font-family: var(--serif); font-size: 24px; color: var(--ink); }
.event-date { font-size: 14px; }
.event-lunar { font-size: 12px; color: var(--muted); font-style: italic; }
.event-venue { margin: 16px 0 20px; font-size: 14px; color: var(--muted); }
.event-venue strong { display: block; color: var(--ink); font-weight: 500; font-size: 15px; }
.schedule-title { margin-bottom: 10px; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--rose-deep); }
.schedule { list-style: none; max-width: 260px; margin: 0 auto 22px; text-align: left; }
.schedule li { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.schedule li:last-child { border-bottom: 0; }
.schedule b { font-family: var(--serif); font-size: 18px; font-weight: 500; color: var(--rose-deep); line-height: 1.3; }
.event-map { display: block; width: 100%; aspect-ratio: 16 / 10; margin: 0 0 18px; border: 0; border-radius: 14px; background: var(--blush); }
.event-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* ================= Gallery & lightbox ================= */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.gallery button { aspect-ratio: 1; padding: 0; border: 0; overflow: hidden; cursor: zoom-in; background: var(--blush); }
.gallery button:first-child { grid-column: span 2; grid-row: span 2; aspect-ratio: auto; }
.gallery img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; transition: transform 0.5s; }
.gallery button:hover img { transform: scale(1.05); }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: rgba(30, 20, 18, 0.94);
  touch-action: pan-y;
}
.lightbox img { max-width: 100vw; max-height: 86vh; object-fit: contain; user-select: none; }
.lb-btn {
  position: absolute;
  width: 48px; height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.lb-close { top: max(14px, env(safe-area-inset-top)); right: 14px; font-size: 20px; }
.lb-prev { left: 10px; top: 50%; translate: 0 -50%; }
.lb-next { right: 10px; top: 50%; translate: 0 -50%; }
.lb-count { position: absolute; bottom: max(18px, env(safe-area-inset-bottom)); color: rgba(255, 255, 255, 0.7); font-size: 13px; }

/* ================= Forms ================= */
.form { text-align: left; display: grid; gap: 16px; max-width: 380px; margin: 0 auto; }
.field { display: grid; gap: 6px; border: 0; min-width: 0; }
.field > span, .field legend { font-size: 13px; color: var(--muted); padding: 0; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px; /* chặn iOS tự zoom */
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  appearance: none;
  -webkit-appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23a95f5b' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--rose); box-shadow: 0 0 0 3px var(--blush); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice label { position: relative; }
.choice input { position: absolute; opacity: 0; }
.choice span {
  display: grid;
  place-items: center;
  min-height: 46px;
  padding: 6px 8px;
  text-align: center;
  font-size: 14px;
  line-height: 1.3;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
}
.choice input:checked + span { border-color: var(--rose-deep); background: var(--blush); color: var(--rose-deep); font-weight: 400; }
.choice input:focus-visible + span { outline: 2px solid var(--rose-deep); outline-offset: 2px; }
.form-status { font-size: 13px; color: #b3403b; text-align: center; min-height: 1em; }
.form-done { display: grid; gap: 18px; justify-items: center; }
.done-msg { font-family: var(--serif); font-size: 22px; color: var(--rose-deep); }
.hp { position: absolute; left: -9999px; }

/* ================= Wishes ================= */
.wishes {
  list-style: none;
  text-align: left;
  display: grid;
  gap: 10px;
  max-width: 380px;
  max-height: 420px;
  overflow-y: auto;
  margin: 32px auto 0;
  padding: 2px;
}
.wishes li { padding: 14px 16px; border-radius: 12px; background: var(--cream); border: 1px solid var(--line); }
.wishes .wishes-empty { text-align: center; color: var(--muted); font-size: 14px; border-style: dashed; background: transparent; }
.wishes b { display: block; font-weight: 500; font-size: 14px; color: var(--rose-deep); }
.wishes p { font-size: 14px; white-space: pre-line; word-break: break-word; }

/* ================= Gifts ================= */
.gifts { display: grid; gap: 16px; }
.gift { padding: 24px 20px; border-radius: 18px; background: rgba(255,255,255,0.7); border: 1px solid var(--line); box-shadow: 0 8px 18px rgba(24, 28, 32, 0.03); }
.gift h3 { font-family: var(--serif); font-size: 21px; font-weight: 500; margin-bottom: 14px; }
.gift img { width: 170px; height: 170px; object-fit: contain; margin: 0 auto 4px; padding: 6px; border-radius: 8px; background: #fff; }
.gift .hint { margin: 0 0 14px; }
.gift dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; text-align: left; font-size: 14px; max-width: 280px; margin: 0 auto 16px; }
.gift dt { color: var(--muted); }
.gift dd { font-weight: 400; word-break: break-all; }

/* ================= Thanks & footer ================= */
.signature { font-family: var(--serif); font-style: italic; font-size: 26px; color: var(--rose-deep); }
.footer { padding: 28px; text-align: center; font-size: 11px; letter-spacing: 0.2em; color: var(--muted); background: var(--cream); border-top: 1px solid var(--line); }

/* ================= Toast ================= */
.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  z-index: 250;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(60, 40, 38, 0.92);
  color: #fff;
  font-size: 13px;
  translate: -50% 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, translate 0.3s;
  white-space: nowrap;
}
.toast.show { opacity: 1; translate: -50% 0; }

/* ================= Scroll reveal ================= */
.js .reveal {
  opacity: 0;
  transform: perspective(1000px) translateY(50px) rotateX(14deg) scale(0.96);
  transform-origin: 50% 0;
  transition: opacity 1s ease, transform 1.2s cubic-bezier(0.2, 0.75, 0.2, 1);
}
.js .reveal.is-visible { opacity: 1; transform: none; }
.js .reveal > * { transition: opacity 0.9s ease, translate 0.9s cubic-bezier(0.2, 0.75, 0.2, 1); }
.js .reveal > [data-depth] { transition: opacity 0.9s ease; }
.js .reveal:not(.is-visible) > * { opacity: 0; translate: 0 26px; }
.js .reveal > :nth-child(2) { transition-delay: 0.08s; }
.js .reveal > :nth-child(3) { transition-delay: 0.16s; }
.js .reveal > :nth-child(4) { transition-delay: 0.24s; }
.js .reveal > :nth-child(5) { transition-delay: 0.32s; }
.js .reveal > :nth-child(n + 6) { transition-delay: 0.4s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .intro-hint, .music.playing svg { animation: none; }
}

/* ================= 3D: thiệp nổi (pop-up) ================= */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.popup { position: relative; margin: 30px auto 40px; perspective: 1000px; }
.popup-stage {
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg));
}
.popup .cover-photo { margin: 0; }
.cover-photo img { scale: 1.06; }
.pop-back {
  position: absolute;
  inset: -16px;
  border-radius: 32px;
  background: linear-gradient(160deg, #fdf6f2, #f1e2dc);
  border: 1px solid #ead6cc;
  box-shadow: 0 34px 60px rgba(120, 80, 70, 0.2);
  transform: translateZ(-40px);
}
.pop-layer {
  transform-origin: 50% 100%;
  transform: translateZ(var(--z, 0px));
  transition: transform 1.3s cubic-bezier(0.2, 0.85, 0.25, 1.05) var(--d, 0s), opacity 0.6s ease var(--d, 0s);
}
.js .popup:not(.is-open) .pop-layer { transform: translateZ(var(--z, 0px)) rotateX(-88deg); opacity: 0; }
.pop-fl { position: absolute; aspect-ratio: 1; pointer-events: none; filter: drop-shadow(0 10px 10px rgba(110, 70, 70, 0.18)); }
.pop-fl-l { left: -17%; bottom: -15%; width: 60%; }
.pop-fl-r { right: -16%; bottom: -12%; width: 52%; }
.pop-bow { position: absolute; top: -8%; left: 50%; width: 34%; margin-left: -17%; filter: drop-shadow(0 6px 6px rgba(120, 40, 50, 0.25)); }

/* Hoa đung đưa */
.sway { transform-box: fill-box; transform-origin: 50% 50%; animation: sway 5.5s ease-in-out infinite alternate; }
.sway-alt { animation-duration: 6.5s; animation-delay: -2s; }
@keyframes sway { from { transform: rotate(-3.5deg) scale(1); } to { transform: rotate(3.5deg) scale(1.03); } }

/* Hoa trang trí góc (có parallax) */
.deco { position: absolute; width: 150px; aspect-ratio: 1; pointer-events: none; opacity: 0.95; z-index: 0; }
.deco-tl { top: -34px; left: -42px; }
.deco-tr { top: -34px; right: -42px; }
.deco-bl { bottom: -30px; left: -42px; }
.deco-br { bottom: -30px; right: -42px; }
.family > :not(.deco), .thanks > :not(.deco) { position: relative; z-index: 1; }

/* Ruy băng tự vẽ khi cuộn, thắt nơ ở giữa */
.ribbon { position: relative; height: 56px; margin: -18px -28px 22px; pointer-events: none; }
.ribbon > svg:first-child { width: 100%; height: 100%; overflow: visible; }
.rb { fill: none; stroke: url(#g-ribbon); stroke-width: 5; stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 0; }
.rb-thin { stroke: #e9bdbb; stroke-width: 1.5; }
.js .ribbon .rb { stroke-dashoffset: var(--draw, 1); }
.ribbon-bow {
  position: absolute;
  left: 50%; top: 50%;
  width: 64px;
  translate: -50% -46%;
  filter: drop-shadow(0 4px 4px rgba(120, 40, 50, 0.2));
  transition: transform 0.7s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.js .ribbon:not(.done) .ribbon-bow { transform: scale(0) rotate(-40deg); }

/* Song Hỷ nổi, xoay nhẹ */
.family { perspective: 700px; }
.song-hy {
  display: inline-block;
  text-shadow: 0 1px 0 #9c3a33, 0 2px 0 #8f332d, 0 3px 0 #842e28, 0 8px 14px rgba(140, 40, 30, 0.3);
  animation: hy-turn 7s ease-in-out infinite;
}
@keyframes hy-turn { 0%, 100% { transform: rotateY(-20deg); } 50% { transform: rotateY(20deg); } }

/* Cô dâu & chú rể lật vào từ hai bên */
.couple { perspective: 900px; }
.person { transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) 0.25s, opacity 1s ease 0.25s; }
.js .reveal:not(.is-visible) .person:first-child { transform: rotateY(38deg) translateX(-30px); opacity: 0; }
.js .reveal:not(.is-visible) .person:last-child { transform: rotateY(-38deg) translateX(30px); opacity: 0; }

/* Album: từng ảnh lật 3D */
.gallery { perspective: 1200px; }
.js .reveal .gallery button {
  transition: transform 0.9s cubic-bezier(0.2, 0.75, 0.2, 1), opacity 0.7s ease;
  transition-delay: calc(var(--i, 0) * 60ms + 0.2s);
}
.js .reveal:not(.is-visible) .gallery button { transform: rotateY(-75deg) translateZ(-40px); opacity: 0; }

/* Thẻ nghiêng theo chuột (máy tính) */
.event, .gift {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.4s ease-out;
}

/* Đếm ngược: số lật như lịch giấy */
.countdown div { perspective: 300px; }
.countdown b.flip { animation: cd-flip 0.55s cubic-bezier(0.2, 0.8, 0.3, 1); }
@keyframes cd-flip { from { transform: rotateX(-100deg); opacity: 0.2; } to { transform: none; opacity: 1; } }
.calendar .wedding-day::after { animation: beat 1.4s ease-in-out infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.3); } 30% { transform: scale(1); } 45% { transform: scale(1.2); } }

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

/* =====================================================================
 *  Phong cách giao thoa Việt Nam – Hàn Quốc
 * ===================================================================== */
body { background: var(--bg) url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%22160%22%20height%3D%22160%22%20viewBox%3D%220%200%20160%20160%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22%23b39672%22%20stroke-width%3D%22.5%22%20opacity%3D%22.13%22%3E%3Cpath%20d%3D%22M10%2020q30%208%2055-2M90%2040q25%2010%2060%200M20%2090q35-6%2060%204M100%20120q20%208%2050-4M30%20140q20-6%2040%202M60%2060q10%2012%2030%208%22/%3E%3C/g%3E%3C/svg%3E"); }
.page { background: var(--paper) url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%22160%22%20height%3D%22160%22%20viewBox%3D%220%200%20160%20160%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22%23b39672%22%20stroke-width%3D%22.5%22%20opacity%3D%22.13%22%3E%3Cpath%20d%3D%22M10%2020q30%208%2055-2M90%2040q25%2010%2060%200M20%2090q35-6%2060%204M100%20120q20%208%2050-4M30%20140q20-6%2040%202M60%2060q10%2012%2030%208%22/%3E%3C/g%3E%3C/svg%3E"); }
section.alt { background: linear-gradient(180deg, rgba(248, 239, 225, 0.9), rgba(243, 232, 215, 0.9)); }
h2 { color: var(--ink); }
h2::after {
  content: "";
  display: block;
  width: 46px; height: 8px;
  margin: 12px auto 0;
  background:
    radial-gradient(circle, var(--red) 2.4px, transparent 2.8px) center / 8px 8px no-repeat,
    linear-gradient(90deg, transparent, var(--gold-soft) 20%, var(--gold-soft) 38%, transparent 38%, transparent 62%, var(--gold-soft) 62%, var(--gold-soft) 80%, transparent) center / 100% 1px no-repeat;
}
.kicker { color: var(--rose-deep); }
.kicker:lang(ko) { font-family: var(--ko); font-style: normal; font-size: 13px; letter-spacing: 0.32em; }
.kicker:lang(vi) { font-family: "Cormorant Garamond", serif; }
[lang="ko"] { font-family: var(--ko); }
.lead, .hint, .muted { color: var(--muted); }

/* Nút & thanh ngôn ngữ */
.btn-primary { background: var(--rose-deep); border-color: var(--rose-deep); }
.btn-primary:hover { background: #81222b; }
.btn:hover { background: #f7eadb; border-color: var(--gold-soft); }
.lang button[aria-pressed="true"] { background: var(--rose-deep); }
.music { color: var(--rose-deep); }

/* Hoa văn song cửa */
.lattice { height: 16px; margin: -40px -28px 30px; background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2216%22%20viewBox%3D%220%200%2024%2016%22%3E%3Cpath%20d%3D%22M0%201.5H24M0%2014.5H24M3%2014.5V4.5H15V11.5H8V7.5H11%22%20fill%3D%22none%22%20stroke%3D%22%23b98f3e%22%20stroke-width%3D%221.2%22/%3E%3Crect%20x%3D%2218.5%22%20y%3D%226%22%20width%3D%223%22%20height%3D%223%22%20transform%3D%22rotate%2845%2020%207.5%29%22%20fill%3D%22%23b8323a%22/%3E%3C/svg%3E") repeat-x center / auto 16px; opacity: 0.85; }
.lattice-bottom { margin: 0; background-color: var(--cream); }

/* ---------- Phong bì đỏ, đai vàng, dấu 囍 ---------- */
.intro { background: #f6efe3 url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%22160%22%20height%3D%22160%22%20viewBox%3D%220%200%20160%20160%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22%23b39672%22%20stroke-width%3D%22.5%22%20opacity%3D%22.13%22%3E%3Cpath%20d%3D%22M10%2020q30%208%2055-2M90%2040q25%2010%2060%200M20%2090q35-6%2060%204M100%20120q20%208%2050-4M30%20140q20-6%2040%202M60%2060q10%2012%2030%208%22/%3E%3C/g%3E%3C/svg%3E"); }
.env-back { background: #a3232c; box-shadow: 0 26px 50px rgba(110, 30, 30, 0.3); }
.env-front { background: linear-gradient(170deg, #c9393f, #a3242d); }
.env-flap { background: linear-gradient(#b52d36, #96202a); }
.env-card { background: linear-gradient(180deg, #fffaf0, #f8eedd); border-color: var(--gold-soft); }
.env-card-kicker { color: var(--rose-deep); letter-spacing: 0.12em; font-style: normal; font-size: 11px; }
.env-ribbon { height: 12px; margin-top: -6px; background: linear-gradient(180deg, #f0d89a, #b98f3e 50%, #e4c477); box-shadow: 0 2px 4px rgba(80, 40, 10, 0.25); }
.env-bow { width: 58px; translate: -50% -36%; filter: drop-shadow(0 4px 4px rgba(80, 20, 20, 0.35)); }
.seal {
  width: 50px; height: 50px;
  background: radial-gradient(circle at 35% 30%, #f6dc97, #c99a3d 70%, #a87c2a);
  color: #8e1f2a;
  font-family: "Noto Serif TC", "Noto Serif KR", serif;
  font-weight: 700;
  font-size: 24px;
  box-shadow: 0 3px 8px rgba(80, 40, 10, 0.4), inset 0 0 0 2px rgba(255, 245, 210, 0.6), inset 0 0 0 4px rgba(150, 100, 30, 0.35);
}

/* ---------- Ảnh bìa: đèn lồng hai nước ---------- */
.cover { position: relative; }
.lantern {
  position: absolute;
  top: 26px;
  z-index: 2;
  width: 44px;
  aspect-ratio: 50 / 120;
  transform-origin: 50% 0;
  animation: lantern-swing 4.6s ease-in-out infinite alternate;
  filter: drop-shadow(0 8px 10px rgba(120, 40, 20, 0.25));
  pointer-events: none;
}
.lantern-l { left: 8px; }
.lantern-r { right: 8px; animation-delay: -2.3s; }
@keyframes lantern-swing { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }
.pop-back {
  background: linear-gradient(160deg, #fffaf0, #f3e4cd);
  border: 1px solid var(--gold-soft);
  box-shadow: 0 34px 60px rgba(110, 60, 30, 0.2), inset 0 0 0 6px #fffaf0, inset 0 0 0 7px var(--gold-soft);
}
.pop-bow { top: -10%; width: 12%; margin-left: -6%; }
.cover .popup { margin-top: 30px; }
.cover-names { color: var(--ink); }
.name-alt { font-family: var(--ko); font-size: 15px; letter-spacing: 0.25em; color: var(--rose-deep); line-height: 1.6; }
.name-alt:lang(vi) { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 18px; letter-spacing: 0.08em; }
.amp { color: var(--gold); }
.cover-date { color: var(--rose-deep); }
.nations {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 6px 14px;
  border: 1px solid var(--gold-soft);
  border-radius: 999px;
  background: rgba(255, 251, 243, 0.8);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink);
}
.flag { width: 21px; height: 14px; flex: none; border-radius: 2px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); }
.heart { color: var(--red); }

/* ---------- Lời mời, hai họ ---------- */
.invite-guest { color: var(--rose-deep); }
.divider { color: var(--gold); }
.song-hy { color: var(--red); }
.family-label { color: var(--rose-deep); }
.family-side + .family-side { border-left-color: var(--gold-soft); }

/* ---------- Cô dâu chú rể ---------- */
.person img { box-shadow: 0 0 0 4px var(--paper), 0 0 0 5px var(--gold-soft), 0 14px 26px rgba(110, 60, 30, 0.15); }
.person-role { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--rose-deep); }
.person-role .flag { width: 18px; height: 12px; }

/* ---------- Lịch, đếm ngược ---------- */
.calendar { border-color: var(--gold-soft); }
.calendar .sun { color: var(--red); }
.calendar .wedding-day { background: var(--rose-deep); box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--gold-soft); }
.calendar .wedding-day::after { color: var(--red); }
.countdown div { border-color: var(--gold-soft); background: var(--paper); }
.countdown b { color: var(--rose-deep); }

/* ---------- Chuyện tình: chấm đỏ – xanh xen kẽ (청홍) ---------- */
.timeline::before { background: linear-gradient(var(--red), var(--blue)); opacity: 0.35; }
.tl-item::before { border-color: var(--red); }
.tl-item:nth-child(even)::before { border-color: var(--blue); }
.tl-item:last-child::before { background: var(--red); border-color: var(--red); }
.tl-date { color: var(--rose-deep); }

/* ---------- Thẻ lễ cưới, mừng cưới ---------- */
.event, .gift {
  background: rgba(255, 251, 243, 0.92);
  border-color: var(--line);
  border-top: 3px solid var(--rose-deep);
  box-shadow: 0 10px 24px rgba(110, 60, 30, 0.06);
}
.gift:nth-child(even) { border-top-color: var(--blue); }
.event:nth-child(even) { border-top-color: var(--blue); }
.schedule b, .schedule-title { color: var(--rose-deep); }
.wishes b { color: var(--rose-deep); }

/* ---------- Ruy băng: chỉ đỏ & chỉ xanh 청실홍실 ---------- */
.rb { stroke: var(--red); stroke-width: 3.5; }
.rb-blue { stroke: var(--blue); stroke-width: 3.5; }
.ribbon-bow { width: 30px; translate: -50% -34%; }
.ribbon { height: 64px; }

.footer { background: var(--cream); color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .lantern { animation: none; } }

/* Chữ Hàn ngắt dòng theo từ (keep-all), tiêu đề cân dòng */
:lang(ko) { word-break: keep-all; }
h1, h2, h3, .family-intro, .invite-poem, .lead, .person-parents { text-wrap: balance; }

/* =====================================================================
 *  Tính năng chuẩn thiệp Hàn / destination wedding
 * ===================================================================== */
/* Giờ hai nước trên mỗi lễ */
.event-tz { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin: 8px 0 2px; font-size: 13px; color: var(--muted); }
.event-tz span { display: inline-flex; align-items: center; gap: 6px; }
.event-tz b { color: var(--ink); font-weight: 500; }
.event-tz .flag { width: 18px; height: 12px; }

/* Hướng dẫn cho khách (FAQ dạng gập/mở) */
.faq { display: grid; gap: 10px; text-align: left; }
.faq-item { border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 251, 243, 0.92); overflow: hidden; }
.faq-item summary {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 44px 14px 16px;
  position: relative;
  cursor: pointer;
  list-style: none;
  font-weight: 400;
  line-height: 1.45;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: ""; position: absolute; right: 18px; top: 50%;
  width: 8px; height: 8px; margin-top: -6px;
  border-right: 1.5px solid var(--rose-deep); border-bottom: 1.5px solid var(--rose-deep);
  transform: rotate(45deg); transition: transform 0.3s;
}
.faq-item[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.faq-item[open] summary { color: var(--rose-deep); }
.faq-icon { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--blush); font-size: 16px; }
.faq-item p { padding: 0 18px 16px 60px; color: var(--muted); font-size: 14px; }

/* Mừng cưới gom theo hai bên */
.gift-group { border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 251, 243, 0.92); overflow: hidden; }
.gift-group summary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 16px 44px; position: relative;
  cursor: pointer; list-style: none;
  font-family: var(--serif); font-size: 19px; font-weight: 500;
}
.gift-group summary::-webkit-details-marker { display: none; }
.gift-group summary::after {
  content: ""; position: absolute; right: 20px; top: 50%;
  width: 8px; height: 8px; margin-top: -6px;
  border-right: 1.5px solid var(--rose-deep); border-bottom: 1.5px solid var(--rose-deep);
  transform: rotate(45deg); transition: transform 0.3s;
}
.gift-group[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.gift-group-body { display: grid; gap: 12px; padding: 0 14px 14px; }
.gift-group .gift { box-shadow: none; }
.gift-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* Liên hệ */
.contacts { display: grid; gap: 22px; text-align: left; }
.contact-group .family-label { text-align: center; }
.contact-group ul { list-style: none; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 251, 243, 0.92); }
.contact-group li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; }
.contact-group li + li { border-top: 1px dashed var(--line); }
.contact-role { display: block; font-size: 12px; color: var(--muted); }
.contact-group b { font-weight: 500; }
.contact-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.icon-btn { width: 42px; padding: 0; }

/* RSVP: chọn lễ + ô đánh dấu */
.choice-wrap { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.choice input[type="checkbox"]:checked + span::before { content: "✓ "; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--ink); cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--rose-deep); flex: none; }

/* Chia sẻ */
.share { display: grid; gap: 10px; max-width: 320px; margin: 30px auto 0; }

/* Lễ đã diễn ra (kỷ niệm) & giờ chưa công bố */
.event-past { padding: 24px 20px; border-top-color: var(--gold) !important; background: linear-gradient(180deg, rgba(255, 251, 243, 0.95), rgba(247, 236, 219, 0.95)); }
.event-past h3 { font-size: 21px; margin-bottom: 4px; }
.event-badge {
  display: inline-block; margin-bottom: 8px; padding: 2px 12px;
  border-radius: 999px; border: 1px solid var(--gold-soft);
  font-size: 12px; letter-spacing: 0.08em; color: var(--gold);
}
.event-past .event-venue { margin: 8px 0 10px; }
.event-note { font-size: 14px; color: var(--muted); font-style: italic; }
.event-tba { margin: 4px 0 6px; font-family: var(--serif); font-size: 19px; font-style: italic; color: var(--rose-deep); }

/* Địa chỉ tiếng Hàn (đưa tài xế taxi), bữa ăn, gửi ảnh */
.addr-ko {
  display: grid; gap: 4px; justify-items: center;
  margin: -8px auto 18px; padding: 12px 14px; max-width: 320px;
  border: 1px dashed var(--gold-soft); border-radius: 12px; background: rgba(255, 251, 243, 0.8);
}
.addr-ko span { font-size: 12px; color: var(--muted); }
.addr-ko b { font-weight: 500; font-size: 15px; line-height: 1.5; }
.addr-ko .btn { min-height: 34px; padding: 0 14px; font-size: 12px; margin-top: 4px; }
.choice-3 { grid-template-columns: repeat(3, 1fr); }
.snap { display: grid; gap: 6px; max-width: 320px; margin: 26px auto 0; }
.snap .btn { width: 100%; border-color: var(--gold-soft); }

.event-photos { margin-top: 14px; }
