:root {
  --pink: #f7dfe3;
  --pink-2: #efcbd2;
  --rose: #8a4259; /* đủ tương phản AA cho chữ nhỏ trên nền hồng */
  --rose-deco: #9b5068;
  --ink: #5e3442;
  --surface: rgba(255, 252, 253, 0.92);
  --border-soft: rgba(138, 66, 89, 0.16);
  --border-strong: rgba(138, 66, 89, 0.34);
  --shadow-soft: 0 10px 28px rgba(110, 50, 71, 0.1);
  --ok: #2e6f4e;
  --ok-bg: #eef8f2;
  --err: #a33349;
  --err-bg: #fdf0f3;
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-exit: cubic-bezier(0.4, 0, 1, 1);
  --script: "Great Vibes", cursive;
  --serif: "Playfair Display", serif;
}
* { box-sizing: border-box; margin: 0; }
dialog { margin: auto; } /* reset ở trên xoá margin:auto giúp dialog căn giữa */
html { scroll-behavior: smooth; }
button, input, textarea { touch-action: manipulation; }
body {
  font-family: "Be Vietnam Pro", sans-serif;
  color: var(--ink);
  background: #ecdfe2;
  line-height: 1.6;
}
body.locked { overflow: hidden; }
:focus-visible { outline: 2px solid var(--rose); outline-offset: 3px; }
::placeholder { color: #8a6470; }
img { display: block; max-width: 100%; object-fit: cover; background: var(--pink-2); }

#card {
  max-width: 440px;
  margin: 0 auto;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 10% 20%, #fff8 0 20%, transparent 50%),
    radial-gradient(ellipse at 90% 60%, #f2c9d255 0 25%, transparent 55%),
    linear-gradient(160deg, #fdf1f3, var(--pink) 60%, #fbe9ec);
  box-shadow: 0 0 40px #0001;
}
section { padding: 40px 24px; text-align: center; }
/* đường phân cách nhỏ giữa các mục */
section + section::before { content: "♥"; display: block; margin: 0 auto 28px; width: 140px; color: var(--rose-deco); opacity: 0.6; font-size: 0.8rem; line-height: 1; background: linear-gradient(var(--rose-deco), var(--rose-deco)) left center / 55px 1px no-repeat, linear-gradient(var(--rose-deco), var(--rose-deco)) right center / 55px 1px no-repeat; }
section.thanks::before { display: none; }
h2.script { margin-bottom: 8px; }
.script { font-family: var(--script); font-weight: 400; color: var(--rose); }
.big { font-size: 3.6rem; line-height: 1.1; }
.mid { font-size: 2.4rem; line-height: 1.2; }
.label { text-transform: uppercase; letter-spacing: 0.2em; font-size: 0.72rem; margin-top: 16px; }
.small { font-size: 0.8rem; }
.center { text-align: center; margin: 12px 0; }
.up { text-transform: uppercase; font-size: 0.78rem; }

/* Hiện dần khi cuộn */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.9s ease, transform 0.9s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* Phong bì */
#envelope {
  position: fixed; inset: 0; z-index: 50; cursor: pointer; overflow: hidden;
  touch-action: none; overscroll-behavior: contain;
}
/* bóng đổ đặt ở lớp bọc vì clip-path sẽ cắt mất drop-shadow của chính phần tử */
.fw { position: absolute; inset: 0; filter: drop-shadow(0 2px 4px #7a3a4c66); transition: transform 1.2s cubic-bezier(0.7, 0, 0.3, 1) 0.25s; }
.flap { position: absolute; inset: 0; }
.flap::after { content: ""; position: absolute; inset: 0; opacity: 0.35; background: repeating-linear-gradient(115deg, #0000 0 22px, #ffffff40 23px 24px, #0000 25px 46px); }
.top .flap { clip-path: polygon(0 0, 100% 0, 50% 52%); background: linear-gradient(180deg, #f7dde1, #eec3cb); }
.bottom .flap { clip-path: polygon(0 100%, 100% 100%, 50% 48%); background: linear-gradient(0deg, #f4d3d9, #eabcc5); }
.left .flap { clip-path: polygon(0 0, 50% 50%, 0 100%); background: linear-gradient(90deg, #e7b6c0, #efc6ce); }
.right .flap { clip-path: polygon(100% 0, 50% 50%, 100% 100%); background: linear-gradient(270deg, #e7b6c0, #efc6ce); }
.seal {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%; z-index: 2;
  width: 92px; aspect-ratio: 1; filter: drop-shadow(0 5px 8px #6a2b3d66);
  transition: opacity 0.3s, scale 0.3s;
}
.hint {
  position: absolute; left: 50%; bottom: 7%; translate: -50% 0;
  background: #fff; padding: 8px 18px; border-radius: 99px;
  font-size: 0.8rem; letter-spacing: 0.15em; text-transform: uppercase;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.55; } }
#envelope.open { pointer-events: none; }
#envelope.open .seal, #envelope.open .hint { opacity: 0; scale: 1.4; animation: none; }
#envelope.open .top { transform: translateY(-100%); }
#envelope.open .bottom { transform: translateY(100%); }
#envelope.open .left { transform: translateX(-100%); }
#envelope.open .right { transform: translateX(100%); }

/* Cụm nút điều khiển góc dưới phải (hộp quà, bong bóng lời chúc, mini-player nhạc) */
.fab-dock {
  position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 40;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  pointer-events: none;
}
.fab-dock > * { pointer-events: auto; }
.fab-btn {
  width: 44px; height: 44px; margin-right: 2px; border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(255, 250, 251, 0.96);
  color: var(--rose); cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 4px 14px rgba(110, 50, 71, 0.16);
  opacity: 0; transform: scale(0.85);
  transition: opacity 0.3s ease, transform 0.3s var(--ease-spring), background 0.18s;
}
.fab-btn[hidden] { display: none; }
.fab-btn.in { opacity: 1; transform: none; }
.fab-btn:hover { background: #fff; }
.fab-btn:active { transform: scale(0.92); }

/* Mini-player bung ngang từ nút đĩa nhạc */
.music-pill {
  position: relative; width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: flex-end;
}
.music-pill[hidden] { display: none; }
.mp-tray {
  position: absolute; right: 0; top: 0; height: 48px; width: 48px;
  border-radius: 999px; overflow: hidden;
  background: rgba(255, 250, 252, 0.97);
  box-shadow:
    inset 0 0 0 1px var(--border-strong),
    0 8px 24px rgba(110, 50, 71, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: width 0.36s var(--ease-spring), opacity 0.2s ease, visibility 0s linear 0.36s;
}
.music-pill.open .mp-tray {
  width: min(316px, calc(100vw - 32px));
  opacity: 1; visibility: visible; pointer-events: auto;
  transition: width 0.36s var(--ease-spring), opacity 0.2s ease, visibility 0s;
}
.mp-inner {
  width: min(316px, calc(100vw - 32px)); height: 48px;
  padding: 0 54px 0 4px;
  display: flex; align-items: center; gap: 4px;
}
.mp-btn {
  position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: transparent; color: var(--rose); cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.16s ease, transform 0.14s var(--ease-spring);
}
.mp-btn::after { content: ""; position: absolute; inset: -4px 0; } /* mở rộng vùng chạm trọn 48px chiều cao */
.mp-btn:hover { background: rgba(138, 66, 89, 0.09); }
.mp-btn:active { background: rgba(138, 66, 89, 0.16); transform: scale(0.92); }
.mp-btn[hidden] { display: none; }
.mp-info {
  flex: 1; min-width: 0; padding: 0 2px;
  display: flex; flex-direction: column; justify-content: center; gap: 1px;
  text-align: left;
}
.mp-title {
  font-size: 0.78rem; font-weight: 600; color: var(--rose); line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mp-artist {
  font-size: 0.68rem; color: #7c5664; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

#music {
  position: relative; z-index: 2;
  width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer;
  color: var(--rose); font-size: 1rem;
  background: radial-gradient(circle, #fff 0 20%, var(--rose-deco) 22% 100%);
  box-shadow: 0 4px 12px #9b506855;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  transition: box-shadow 0.25s ease;
}
.music-pill.open #music { box-shadow: 0 2px 10px rgba(110, 50, 71, 0.22), 0 0 0 2px rgba(255, 250, 252, 0.9); }
#music[hidden] { display: none; }
#music.playing { animation: spin 4s linear infinite; will-change: transform; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Thông báo tên bài đang phát (pill mảnh phía trên giữa màn hình) */
.music-toast {
  position: fixed; top: max(12px, env(safe-area-inset-top)); left: 50%; z-index: 41;
  max-width: min(360px, calc(100vw - 28px));
  pointer-events: none;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 14px 6px 9px; border-radius: 999px;
  background: rgba(255, 250, 252, 0.96);
  border: 1px solid rgba(138, 66, 89, 0.22);
  box-shadow: 0 6px 20px rgba(110, 50, 71, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  color: var(--ink); font-size: 0.76rem; line-height: 1.25;
  opacity: 0; transform: translate3d(-50%, -12px, 0) scale(0.96);
  transition: opacity 0.28s ease, transform 0.34s var(--ease-spring);
}
.music-toast[hidden] { display: none; }
.music-toast.show { opacity: 1; transform: translate3d(-50%, 0, 0) scale(1); }
.mt-note {
  flex: none; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #b86c82, var(--rose)); color: #fff;
  font-size: 0.68rem;
}
.mt-text { min-width: 0; display: flex; align-items: baseline; gap: 5px; overflow: hidden; }
.mt-title { flex: 0 1 auto; min-width: 0; font-weight: 600; color: var(--rose); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-sep { flex: none; color: var(--rose-deco); opacity: 0.6; }
.mt-artist { flex: 0 2 auto; min-width: 0; color: #7c5664; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Hero */
.hero .welcome { font-size: 4.2rem; line-height: 1; color: #2b1d22; }
.hero .sub { font-family: var(--serif); letter-spacing: 0.1em; }
.hero h1 { font-family: var(--serif); font-weight: 600; text-transform: uppercase; font-size: 1.5rem; margin: 14px 0 20px; letter-spacing: 0.05em; }
.frame { padding: 10px; background: #fff8; border: 2px solid var(--pink-2); border-radius: 20px; }
.frame img { width: 100%; aspect-ratio: 3 / 4; border-radius: 14px; object-position: center 20%; }
.hero .date { font-family: "EB Garamond", serif; font-size: 1.8rem; letter-spacing: 0.15em; margin-top: 24px; }
.hero .guest { font-size: 2rem; }

/* Gia đình */
.quote { font-size: 1.6rem; line-height: 1.4; margin-bottom: 24px; }
.family { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: center; margin: 20px 0; }
.family.flip img { order: 2; }
.family img { width: 100%; aspect-ratio: 3 / 4; border: 2px solid var(--pink-2); object-position: center 20%; }
.family h3 { font-family: var(--serif); text-transform: uppercase; font-size: 1rem; margin-bottom: 6px; }
.family .up { font-size: clamp(0.62rem, 2.7vw, 0.7rem); white-space: nowrap; }
.family .role { font-family: var(--script); font-size: 1.1rem; margin-top: 10px; }
.family .name { font-size: 2rem; line-height: 1; }

/* Save the date */
.std { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 20px 0 32px; }
.std figure { position: relative; overflow: hidden; border-radius: 8px; }
.std img { width: 100%; aspect-ratio: 3 / 4; object-position: center 20%; }
.std figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 24px 0 6px; color: #fff; font: italic 2.4rem "EB Garamond", serif; text-shadow: 0 2px 8px #0008; background: linear-gradient(transparent, #2b1d2266); }
.countdown { display: flex; justify-content: center; gap: 10px; margin: 16px 0 24px; }
.countdown div { background: #fff9; border: 1px solid var(--pink-2); border-radius: 14px; width: 72px; padding: 12px 0; }
.countdown b { display: block; font: 600 1.8rem var(--serif); color: var(--rose); line-height: 1.2; }
.countdown small { text-transform: uppercase; font-size: 0.68rem; letter-spacing: 0.1em; }

/* Sự kiện */
.event {
  background: linear-gradient(#f6dade, #f3d1d7);
  border-radius: 20px; padding: 32px 18px 28px; margin-bottom: 28px;
  box-shadow: 0 8px 20px #9b506820;
}
.event h3 { font-family: var(--serif); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 400; }
.event h4 { font-family: var(--serif); text-transform: uppercase; margin-top: 4px; }
.when { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin: 10px 0; }
.when .day { font: 600 2.4rem var(--serif); color: var(--rose); padding: 0 16px; border-inline: 1px solid var(--rose); }
.lunar { font: italic 0.85rem "EB Garamond", serif; }
.pill { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; margin-top: 12px; padding: 10px 22px; border-radius: 99px; border: 1px solid var(--rose); color: var(--rose); background: #fff8; font: inherit; font-size: 0.8rem; text-decoration: none; cursor: pointer; }
.pill.solid { background: var(--rose); color: #fff; }

/* Lịch */
.calendar { background: #fff6; border: 6px double var(--pink-2); border-radius: 40px; padding: 24px 18px; }
.calendar h3 { font: 400 1.4rem var(--serif); color: var(--rose); margin-bottom: 12px; }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.grid b { font-size: 0.75rem; }
.grid .heart { justify-self: center; width: 2em; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--rose); box-shadow: 0 0 0 3px #fff8; }

/* Chuyện tình */
.story { list-style: none; padding: 0; text-align: left; border-left: 1px solid var(--rose); margin-left: 60px; }
.story li { position: relative; padding: 0 0 28px 18px; }
.story .year { position: absolute; left: -56px; top: 6px; font-size: 0.8rem; }
.story li::before { content: ""; position: absolute; left: -5px; top: 12px; width: 9px; height: 9px; border-radius: 50%; background: var(--rose); }
.story h3 { font-size: 1.7rem; line-height: 1.2; }
.story p { font: italic 0.9rem "EB Garamond", serif; }

/* Album */
.coverflow { position: relative; margin: 24px -24px 0; }
.stage { position: relative; height: 380px; perspective: 1000px; touch-action: pan-y; user-select: none; }
.stage img {
  position: absolute; left: 50%; top: 0; width: 62%; height: 100%; margin-left: -31%;
  border-radius: 18px; border: 4px solid #fff; box-shadow: 0 12px 30px #6e324740;
  object-position: center 20%;
  transition: transform 0.6s cubic-bezier(0.3, 0.7, 0.2, 1), opacity 0.6s; cursor: pointer;
}
.stage img.active { cursor: zoom-in; }
.nav { position: absolute; top: 50%; translate: 0 -50%; z-index: 20; width: 44px; height: 44px; border-radius: 50%; border: 0; background: #fffd; color: var(--rose); font-size: 1.5rem; cursor: pointer; box-shadow: 0 2px 8px #0002; }
.prev { left: 10px; } .next { right: 10px; }
.dots { display: flex; justify-content: center; gap: 6px; margin-top: 18px; }
.dots button { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 99px; background: var(--pink-2); cursor: pointer; transition: width 0.3s, background 0.3s; }
.dots button.on { width: 24px; background: var(--rose); }
.thumbs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 14px 4px 4px; }
.thumbs button { flex: 0 0 56px; padding: 0; border: 2px solid transparent; border-radius: 10px; background: none; cursor: pointer; opacity: 0.55; transition: opacity 0.3s, border-color 0.3s; }
.thumbs button.on { opacity: 1; border-color: var(--rose); }
.thumbs img { width: 100%; aspect-ratio: 3 / 4; border-radius: 8px; object-position: center 20%; }
@media (prefers-reduced-motion: reduce) { .stage img { transition: none; } }
#lightbox { padding: 0; border: 0; background: none; max-width: 95vw; }
#lightbox::backdrop { background: #000c; }
#lightbox img { max-height: 90vh; width: auto; }

/* Quà */
.gifts { display: flex; justify-content: center; gap: 40px; margin-top: 20px; }
.gift { background: #fff8; border: 1px solid var(--pink-2); border-radius: 16px; padding: 16px 20px; font: italic 1rem "EB Garamond", serif; color: var(--ink); cursor: pointer; }
.gift .box { display: block; width: 72px; margin: 0 auto 6px; color: var(--rose); transition: transform 0.3s; }
.gift:hover .box { transform: rotate(-8deg) scale(1.08); }
#gift-dialog { border: 0; border-radius: 20px; padding: 0; text-align: center; width: min(90vw, 340px); color: var(--ink); background: #fdf1f3; }
#gift-dialog > div { padding: 28px; }
#gift-dialog::backdrop { background: #3a1d2688; }
#gift-dialog img { width: 200px; margin: 14px auto 16px; aspect-ratio: 1; object-fit: contain; border-radius: 14px; background: #fff; box-shadow: 0 4px 16px #9b50681f; }
#gift-dialog .acc { font-size: clamp(1.15rem, 5vw, 1.35rem); font-weight: 600; letter-spacing: 0.08em; user-select: all; margin: 2px 0; }
#gift-dialog .dialog-actions { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
#gift-dialog .dialog-actions .pill { width: 100%; margin-top: 0; }

/* Lịch trình */
.schedule { list-style: none; padding: 0; text-align: left; margin-top: 20px; border-left: 1px dashed var(--rose); margin-left: 18px; }
.schedule li { display: flex; gap: 16px; align-items: center; padding-bottom: 26px; }
.schedule .dot { flex: none; width: 34px; height: 34px; margin-left: -18px; display: grid; place-items: center; border-radius: 50%; background: var(--rose); color: #fff; }
.schedule .dot svg { width: 18px; }
.schedule p { font-family: var(--serif); text-transform: uppercase; font-size: 1.05rem; }

/* Lưu ý */
.note { background: #ffffff55; border-radius: 14px; padding: 18px; margin-top: 14px; box-shadow: 0 2px 10px #9b506812; }
.note svg { width: 28px; color: var(--rose); }
.note p { font: 0.9rem "EB Garamond", serif; }

/* Icon SVG & trạng thái chung cho phần lời chúc */
.ico { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }
.ico-sm { width: 15px; height: 15px; }
.avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #b86c82, var(--rose));
  color: #fff; font-size: 0.82rem; font-weight: 600; text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(138, 66, 89, 0.24);
}
.avatar.invite { background: linear-gradient(135deg, #d88fa2, #a8546e); }
.hp { position: absolute; left: -9999px; }
.btn-spin {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  display: inline-block; animation: spin 0.75s linear infinite;
}

/* Sổ lưu bút dạng Bưu thiếp + CTA mở Bottom Sheet (không cuộn lồng nhau trên mobile) */
.wish-head-meta { display: flex; justify-content: center; margin: 4px 0 12px; }
.wish-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 999px;
  background: rgba(138, 66, 89, 0.1); color: var(--rose);
  font-size: 0.78rem; font-weight: 600;
}
.wish-cta {
  background: linear-gradient(145deg, #fffafb, #f8e2e8);
  border: 1px solid var(--border-soft); border-radius: 18px;
  padding: 14px 16px; margin-bottom: 14px;
  box-shadow: var(--shadow-soft);
}
.wish-cta p { font-size: 0.86rem; line-height: 1.5; margin-bottom: 11px; color: var(--ink); }
.wish-btn-primary {
  width: 100%; min-height: 44px; padding: 10px 18px; border: 0; border-radius: 999px;
  background: linear-gradient(135deg, #9d4f68, var(--rose)); color: #fff;
  font: 600 0.92rem/1 "Be Vietnam Pro", sans-serif; letter-spacing: 0.02em;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; box-shadow: 0 8px 20px rgba(138, 66, 89, 0.26);
  transition: transform 0.16s var(--ease-spring), opacity 0.2s, box-shadow 0.2s;
}
.wish-btn-primary:hover { box-shadow: 0 10px 24px rgba(138, 66, 89, 0.34); }
.wish-btn-primary:active:not(:disabled) { transform: scale(0.98); }
.wish-btn-primary:disabled { opacity: 0.65; cursor: wait; }

.wish-wall {
  position: relative; overflow: hidden; text-align: left;
  padding: 6px 8px 12px; margin: -6px -8px -12px;
  touch-action: pan-y;
  transition: height 0.3s var(--ease-spring);
}
.wish-page {
  display: grid; gap: 9px;
  transition: transform 0.32s var(--ease-spring), opacity 0.28s ease;
}
.wish-page.enter-next { opacity: 0; transform: translate3d(40px, 0, 0); transition: none; }
.wish-page.enter-prev { opacity: 0; transform: translate3d(-40px, 0, 0); transition: none; }
.wish-page.leaving {
  position: absolute; inset: 6px 8px auto 8px; pointer-events: none;
  transition: transform 0.22s var(--ease-exit), opacity 0.2s ease;
}
.wish-page.leave-next { opacity: 0; transform: translate3d(-34px, 0, 0); }
.wish-page.leave-prev { opacity: 0; transform: translate3d(34px, 0, 0); }
.wish-postcard {
  position: relative; background: #fffcfd;
  border: 1px solid var(--border-soft); border-radius: 14px;
  padding: 11px 14px 10px;
  box-shadow: 0 4px 14px rgba(110, 50, 71, 0.07);
}
.wish-postcard::before {
  content: "“"; position: absolute; right: 12px; top: 2px;
  font: 400 2.1rem/1 var(--serif); color: rgba(155, 80, 104, 0.16); pointer-events: none;
}
.wish-postcard.fresh {
  border-color: rgba(138, 66, 89, 0.42);
  animation: card-pop 0.45s var(--ease-spring);
}
@keyframes card-pop {
  from { opacity: 0; transform: translateY(-10px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.wish-postcard p {
  font: 400 1rem/1.45 "EB Garamond", serif;
  color: var(--ink); word-break: break-word; white-space: pre-line; margin-bottom: 7px; padding-right: 16px;
}
.wish-postcard footer {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-top: 1px dashed rgba(138, 66, 89, 0.18); padding-top: 7px;
}
.wish-author { display: flex; align-items: center; gap: 7px; min-width: 0; }
.wish-author .avatar { width: 22px; height: 22px; font-size: 0.66rem; box-shadow: none; }
.wish-author b { font-size: 0.8rem; font-weight: 600; color: var(--rose); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wish-time { font-size: 0.7rem; color: #8c6472; white-space: nowrap; flex: none; }

/* Thanh phân trang Sổ Lưu Bút */
.wish-pager {
  margin-top: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.wp-btn {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  border: 1px solid var(--border-strong);
  background: rgba(255, 252, 253, 0.88); color: var(--rose);
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 3px 10px rgba(110, 50, 71, 0.08);
  transition: background 0.18s, transform 0.15s var(--ease-spring), opacity 0.2s;
}
.wp-btn:hover:not(:disabled) { background: #fff; }
.wp-btn:active:not(:disabled) { transform: scale(0.93); }
.wp-btn:disabled { opacity: 0.36; cursor: not-allowed; box-shadow: none; }
.wp-mid {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.wp-dots { display: flex; align-items: center; justify-content: center; gap: 6px; }
.wp-dot {
  position: relative; width: 8px; height: 8px; padding: 0; border: 0; border-radius: 99px;
  background: var(--pink-2); cursor: pointer;
  transition: width 0.28s var(--ease-spring), background 0.24s ease;
}
.wp-dot::after { content: ""; position: absolute; inset: -14px -6px; } /* mở rộng vùng chạm trên mobile */
.wp-dot.on { width: 24px; background: var(--rose); }
.wp-info {
  font-size: 0.76rem; font-weight: 500; color: #7c5664;
  font-variant-numeric: tabular-nums;
}

.wish-empty {
  background: rgba(255, 255, 255, 0.72); border: 1px dashed var(--border-strong);
  border-radius: 18px; padding: 24px 16px; text-align: center;
  display: grid; gap: 10px; justify-items: center;
}
.wish-empty p { font-size: 0.86rem; color: var(--ink); }

/* Skeleton shimmer lúc tải Apps Script */
.wish-skel {
  display: flex; gap: 10px; align-items: flex-start;
  background: rgba(255, 255, 255, 0.76); border: 1px solid var(--border-soft);
  border-radius: 14px; padding: 12px 14px;
}
.skel-dot { width: 26px; height: 26px; border-radius: 50%; flex: none; background: linear-gradient(90deg, #f3d8de 25%, #faeef0 50%, #f3d8de 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; }
.skel-lines { flex: 1; display: grid; gap: 8px; padding-top: 2px; }
.skel-line { height: 11px; border-radius: 99px; background: linear-gradient(90deg, #f3d8de 25%, #faeef0 50%, #f3d8de 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; }
.skel-line.w40 { width: 42%; }
.skel-line.w90 { width: 92%; }
.skel-line.w70 { width: 68%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Bottom Sheet viết lời chúc */
.ws-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(46, 22, 31, 0.48);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 0; transition: opacity 0.24s ease;
}
.ws-backdrop[hidden] { display: none; }
.ws-backdrop.open { opacity: 1; }

.ws-sheet {
  position: fixed; left: 50%; bottom: 0; z-index: 61;
  width: min(440px, 100vw); max-height: 90dvh; overflow-y: auto; overscroll-behavior: contain;
  background: #fff9fa; border-radius: 26px 26px 0 0;
  padding: 10px 20px max(24px, env(safe-area-inset-bottom));
  box-shadow: 0 -16px 40px rgba(46, 22, 31, 0.24);
  text-align: left;
  transform: translate3d(-50%, 100%, 0);
  transition: transform 0.22s var(--ease-exit);
}
.ws-sheet[hidden] { display: none; }
.ws-sheet.open { transform: translate3d(-50%, 0, 0); transition: transform 0.34s var(--ease-spring); }
.ws-sheet.dragging { transition: none; }

.ws-drag-zone { padding: 4px 0 10px; cursor: grab; touch-action: none; }
.ws-handle { width: 42px; height: 4px; border-radius: 99px; background: rgba(138, 66, 89, 0.28); margin: 0 auto; }
.ws-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.ws-head h3 { font-family: var(--script); font-size: 2.1rem; font-weight: 400; color: var(--rose); line-height: 1.1; }
.ws-close {
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--pink); color: var(--rose); cursor: pointer;
  display: grid; place-items: center; transition: background 0.18s;
}
.ws-close:hover { background: var(--pink-2); }

.ws-field { display: grid; gap: 6px; margin-bottom: 14px; }
.ws-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ws-label { font-size: 0.82rem; font-weight: 600; color: var(--rose); }
.ws-req { color: #b54560; margin-left: 2px; }
.ws-count { font-size: 0.72rem; color: #8c6472; font-variant-numeric: tabular-nums; }
.ws-input {
  width: 100%; min-height: 46px; padding: 11px 14px;
  border: 1.5px solid var(--border-soft); border-radius: 14px;
  background: #fff; font: 400 1rem/1.5 "Be Vietnam Pro", sans-serif; color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ws-input:focus { outline: none; border-color: var(--rose); box-shadow: 0 0 0 3px rgba(138, 66, 89, 0.16); }
.ws-input[aria-invalid="true"] { border-color: var(--err); }
.ws-err { font-size: 0.76rem; color: var(--err); min-height: 1em; }

.ws-chips-head { font-size: 0.74rem; color: #7c5664; display: flex; align-items: center; gap: 5px; margin-bottom: 2px; }
.ws-chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 2px 2px 6px; margin: 0 -2px 2px; scroll-snap-type: x proximity;
}
.ws-chips::-webkit-scrollbar { display: none; }
.ws-chip {
  flex: 0 0 auto; max-width: 250px; min-height: 44px; padding: 8px 14px;
  border-radius: 999px; border: 1px solid var(--border-soft);
  background: #fdf4f6; color: var(--ink);
  font: 400 0.82rem/1.3 "Be Vietnam Pro", sans-serif;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; scroll-snap-align: start;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.14s;
}
.ws-chip:active { transform: scale(0.97); }
.ws-chip.active { background: var(--rose); border-color: var(--rose); color: #fff; }

.ws-feedback {
  margin-top: 12px; border-radius: 12px; padding: 10px 12px; font-size: 0.82rem;
  display: none; align-items: center; gap: 8px;
}
.ws-feedback.ok { display: flex; background: var(--ok-bg); color: var(--ok); border: 1px solid rgba(46, 111, 78, 0.22); }
.ws-feedback.err { display: flex; background: var(--err-bg); color: var(--err); border: 1px solid rgba(163, 51, 73, 0.22); }

/* Bong bóng lời chúc bay nhẹ (Petal Bubbles — Whisper Pill siêu mảnh, responsive) */
.wb-stage {
  position: fixed; left: 12px; bottom: max(18px, calc(env(safe-area-inset-bottom) + 4px)); z-index: 39;
  width: min(280px, calc(100vw - 84px)); height: 145px;
  pointer-events: none; overflow: visible;
  transition: opacity 0.25s ease, transform 0.34s var(--ease-spring);
}
.wb-stage[hidden] { display: none; }
.wb-stage.paused { opacity: 0; pointer-events: none; }
@media (max-width: 699px) {
  /* Khi thanh nhạc bung ra trên màn hẹp, nhấc nhẹ bong bóng lên phía trên thanh nhạc thay vì ẩn đi */
  .wb-stage { transform: translate3d(0, 0, 0); }
  .wb-stage.lifted { transform: translate3d(0, -56px, 0); }
}

.wb-float {
  position: absolute; left: 0; bottom: 0; max-width: 100%;
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px 5px 5px; border-radius: 999px;
  background: rgba(255, 250, 252, 0.88);
  border: 1px solid rgba(138, 66, 89, 0.16);
  box-shadow: 0 3px 12px rgba(110, 50, 71, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  animation: wb-rise 5.8s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
.wb-float::after { content: ""; position: absolute; inset: -6px 0; } /* mở rộng vùng chạm >=44px mà giữ pill mảnh 32px */
@media (hover: hover) {
  .wb-float:hover { animation-play-state: paused; }
}
.wb-float:focus-visible { animation-play-state: paused; }
.wb-ava { width: 22px; height: 22px; font-size: 0.65rem; box-shadow: none; }
.wb-ava .ico { width: 11px; height: 11px; }
.wb-line { min-width: 0; display: flex; align-items: baseline; gap: 4px; overflow: hidden; line-height: 1.25; }
.wb-name { flex: none; max-width: clamp(68px, 22vw, 110px); font-size: 0.72rem; font-weight: 600; color: var(--rose); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-sep { flex: none; font-size: 0.7rem; color: var(--rose-deco); opacity: 0.65; }
.wb-msg { min-width: 0; font-size: 0.73rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 480px) {
  .wb-stage { left: 16px; width: min(340px, calc(100vw - 96px)); }
  .wb-float { padding: 6px 14px 6px 6px; }
  .wb-name { font-size: 0.76rem; }
  .wb-msg { font-size: 0.77rem; }
}
@media (min-width: 1024px) {
  /* Trên desktop, đặt gọn vào vùng lề trái ngoài thân thiệp 440px để không đè lên ảnh/chữ và hiển thị trọn câu dài */
  .wb-stage { left: 20px; bottom: 24px; width: min(360px, calc(50vw - 252px)); height: 185px; }
  .wb-float { border-radius: 18px; align-items: flex-start; padding: 8px 13px 8px 8px; animation-name: wb-rise-lg; }
  .wb-line { display: grid; gap: 2px; }
  .wb-name { max-width: none; }
  .wb-sep { display: none; }
  .wb-msg { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}
/* Không dùng var() trong transform của @keyframes vì iOS Safari không nội suy biến trong keyframe */
@keyframes wb-rise {
  0% { opacity: 0; transform: translate3d(0, 18px, 0) scale(0.92); }
  12% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
  74% { opacity: 0.94; transform: translate3d(4px, -68px, 0) scale(1); }
  100% { opacity: 0; transform: translate3d(-2px, -112px, 0) scale(0.96); }
}
@keyframes wb-rise-lg {
  0% { opacity: 0; transform: translate3d(0, 18px, 0) scale(0.92); }
  12% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
  74% { opacity: 0.94; transform: translate3d(4px, -88px, 0) scale(1); }
  100% { opacity: 0; transform: translate3d(-2px, -144px, 0) scale(0.96); }
}

.wb-heart {
  position: absolute; bottom: 6px;
  width: 12px; height: 12px; color: #c76f87; opacity: 0; pointer-events: none;
  animation: wb-heart-a 3.1s ease-out forwards;
}
.wb-heart.d2 { animation-name: wb-heart-b; }
.wb-heart.d3 { animation-name: wb-heart-c; }
@keyframes wb-heart-a {
  0% { opacity: 0; transform: translate3d(0, 8px, 0) scale(0.6); }
  22% { opacity: 0.68; }
  100% { opacity: 0; transform: translate3d(14px, -110px, 0) scale(1.05) rotate(14deg); }
}
@keyframes wb-heart-b {
  0% { opacity: 0; transform: translate3d(0, 8px, 0) scale(0.6); }
  22% { opacity: 0.68; }
  100% { opacity: 0; transform: translate3d(-14px, -110px, 0) scale(1.05) rotate(-14deg); }
}
@keyframes wb-heart-c {
  0% { opacity: 0; transform: translate3d(0, 8px, 0) scale(0.6); }
  22% { opacity: 0.68; }
  100% { opacity: 0; transform: translate3d(4px, -116px, 0) scale(1.05) rotate(6deg); }
}

/* Trạng thái tắt của nút bật/tắt bong bóng (vị trí dùng chung .fab-dock / .fab-btn) */
.wb-toggle[aria-pressed="false"] { opacity: 0.62; color: #8c6472; }

/* Hiệu ứng tim bung nhẹ khi gửi lời chúc thành công */
.burst-layer { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.burst-petal {
  position: fixed; width: 16px; height: 16px; color: var(--rose-deco);
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .wb-stage { height: auto; }
  .wb-float { position: relative; animation: none; opacity: 1; transform: none; }
  .wb-heart, .burst-petal { display: none; }
  #music.playing { animation: none; }
  .ws-sheet, .ws-backdrop, .fab-btn, .mp-tray, .mp-btn, .music-toast, .wb-stage, .wish-wall, .wish-page, .wish-postcard.fresh, .skel-dot, .skel-line { animation: none; transition: none; }
}

/* Cảm ơn */
.thanks { margin: 0 24px 40px; padding: 72px 24px 40px; border-radius: 20px; color: #fff; background: linear-gradient(#9a6274, #6e3247); }
.thanks .big { color: #fff; }
.thanks p { font: 0.9rem "EB Garamond", serif; margin-top: 12px; }
.thanks .credit { font-size: 0.7rem; opacity: 0.75; margin-top: 20px; }
