:root {
  --ivory: #fbf7ef;
  --paper: #f8f1e3;
  --cream: #efe3cb;
  --gold: #b8913a;
  --gold-2: #d9b86a;
  --gold-3: #f1dca0;
  --ink: #2b2118;
  --ink-2: #1c150f;
  --muted: #7a6a58;
  --wine: #7a1f2b;
  --line: rgba(184, 145, 58, .35);
  --gold-grad: linear-gradient(135deg, #8a6a24 0%, #d9b86a 30%, #f6e7b8 50%, #c9a24e 70%, #8a6a24 100%);
  --script: 'Great Vibes', cursive;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Be Vietnam Pro', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--sans); color: var(--ink); background: var(--ivory);
  font-weight: 300; line-height: 1.6; overflow-x: hidden;
}
body.locked { overflow: hidden; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
.script { font-family: var(--script); font-weight: 400; word-spacing: .15em; }

/* ---------- Nút ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  padding: .85em 1.6em; border-radius: 999px; border: 1px solid transparent;
  font-weight: 500; font-size: .95rem; letter-spacing: .02em; text-decoration: none;
  transition: transform .2s, box-shadow .2s, background .2s;
}
.btn:active { transform: scale(.97); }
.btn-gold { background: var(--gold-grad); background-size: 200% 200%; color: var(--ink-2); box-shadow: 0 6px 20px rgba(184, 145, 58, .35); animation: shimmer 6s ease infinite; }
.btn-ghost { border-color: var(--gold-2); color: var(--gold-3); background: rgba(255, 255, 255, .04); }
.btn-ghost-dark { border-color: var(--gold); color: var(--ink); background: transparent; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
@keyframes shimmer { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

/* ---------- Hoa rơi ---------- */
#petals { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }

/* ---------- Ảnh bìa ---------- */
.hero { position: relative; height: 100svh; min-height: 560px; display: grid; place-items: end center; color: #fff; overflow: hidden; }
.hero-bg { position: absolute; inset: -5%; background-size: cover; background-position: 27% 20%; transform-origin: 43% 30%; animation: kenburns 24s ease-in-out infinite alternate; }
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.1) translateY(-2%); } }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(to top,
  rgba(18, 12, 8, .97) 0%, rgba(18, 12, 8, .9) 22%, rgba(18, 12, 8, .65) 40%, rgba(18, 12, 8, .25) 58%, rgba(18, 12, 8, 0) 72%); }
.hero-content { position: relative; text-align: center; padding: 0 16px 90px; }
.kicker { letter-spacing: .45em; text-transform: uppercase; font-size: .72rem; margin: 0; color: var(--gold-3); }
.names { margin: 14px 0 12px; line-height: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.names .script { font-size: clamp(3.4rem, 15vw, 6.5rem); background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .7)); padding: .12em .4em .2em; line-height: 1.1; }
.names .amp { font-family: var(--serif); font-style: italic; font-size: 1.6rem; line-height: 1.2; color: var(--gold-3); margin: -2px 0; }
.hero-date { display: flex; align-items: center; justify-content: center; gap: clamp(6px, 3vw, 14px); white-space: nowrap; font-size: .78rem; letter-spacing: .15em; text-transform: uppercase; }
.hero-date b { font-family: var(--serif); font-weight: 400; font-size: clamp(1.05rem, 5.4vw, 1.4rem); letter-spacing: .12em; padding: 4px 14px; border-left: 1px solid var(--gold-2); border-right: 1px solid var(--gold-2); }
.hero-lunar { font-family: var(--serif); font-style: italic; margin: 10px 0 0; color: var(--gold-3); font-size: .95rem; }
.scroll-hint { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); color: var(--gold-3); font-size: 2rem; text-decoration: none; animation: bob 2s infinite; }
@keyframes bob { 50% { transform: translate(-50%, 8px); } }

/* ---------- Bố cục chung ---------- */
.section { padding: 80px 16px; text-align: center; position: relative; }
.paper { background: var(--ivory); }
.cream { background: var(--cream); }
.dark { background: radial-gradient(ellipse at top, #3a2c1e, var(--ink-2) 70%); color: #f3e9d6; }
.title { margin: 0 0 30px; font-weight: 400; line-height: 1; }
.title small { display: block; font-family: var(--sans); font-size: .72rem; letter-spacing: .4em; text-transform: uppercase; color: var(--gold); margin-bottom: 10px; }
.title .script { font-size: clamp(2.6rem, 11vw, 3.8rem); color: var(--gold); }
.dark .title .script { background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { max-width: 520px; margin: -10px auto 26px; color: var(--muted); }
.dark .sub { color: #d8c9ac; }

.reveal { opacity: 0; transform: translateY(30px); transition: opacity .9s ease, transform .9s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Thiệp ---------- */
.card {
  position: relative; max-width: 560px; margin: 0 auto; padding: 46px 22px 40px;
  background: #fffdf8; border: 1px solid var(--line); box-shadow: 0 30px 60px -30px rgba(90, 60, 20, .35);
  outline: 1px solid var(--line); outline-offset: -10px;
}
.card-corner { position: absolute; width: 46px; height: 46px; border: 2px solid var(--gold); }
.card-corner.tl { top: 16px; left: 16px; border-right: 0; border-bottom: 0; }
.card-corner.tr { top: 16px; right: 16px; border-left: 0; border-bottom: 0; }
.card-corner.bl { bottom: 16px; left: 16px; border-right: 0; border-top: 0; }
.card-corner.br { bottom: 16px; right: 16px; border-left: 0; border-top: 0; }
.hy { font-size: 2.6rem; color: var(--wine); font-family: serif; line-height: 1; margin-bottom: 16px; }
.families { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: .85rem; }
.family h3 { font-family: var(--serif); font-weight: 600; letter-spacing: .2em; text-transform: uppercase; font-size: .8rem; color: var(--gold); margin: 0 0 6px; }
.family p { margin: 0; color: var(--muted); }
.family.dim { opacity: .45; }
.card-lead { margin: 28px 0 14px; font-family: var(--serif); font-style: italic; }
.couple-names { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 2px; margin: 0 -8px; }
.couple-names small { display: block; letter-spacing: .25em; text-transform: uppercase; font-size: .65rem; color: var(--muted); }
.couple-names .script { display: block; font-size: clamp(1.55rem, 7.4vw, 2.6rem); color: var(--gold); line-height: 1.3; white-space: nowrap; }
.couple-names > div { min-width: 0; }
.couple-names em { font-size: .75rem; color: var(--muted); font-style: normal; }
.heart { color: var(--wine); font-size: 1.2rem; }
.card-time { margin: 26px 0 4px; }
.card-day { margin: 0; text-transform: uppercase; letter-spacing: .3em; font-size: .78rem; color: var(--gold); }
.card-date { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 4px 0; }
.card-date span { text-transform: uppercase; letter-spacing: .15em; font-size: .78rem; border-top: 1px solid var(--gold); border-bottom: 1px solid var(--gold); padding: 4px 6px; }
.card-date b { font-family: var(--serif); font-size: 3.4rem; font-weight: 400; color: var(--gold); line-height: 1; }
.card-lunar { margin: 0; font-style: italic; color: var(--muted); font-size: .9rem; }
.card-place { margin: 18px 0 0; font-weight: 500; }
.card-invite { margin: 22px 0 0; font-family: var(--serif); font-style: italic; }
.card-invite b { font-style: normal; color: var(--wine); font-size: 1.15rem; }

/* ---------- Lịch + đếm ngược ---------- */
.calendar { max-width: 340px; margin: 0 auto 34px; }
.calendar h4 { margin: 0 0 12px; font-family: var(--serif); font-weight: 400; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-3); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; font-size: .85rem; }
.cal-grid .dow { color: var(--gold-2); font-size: .7rem; letter-spacing: .1em; padding-bottom: 6px; }
.cal-grid .d { aspect-ratio: 1; display: grid; place-items: center; color: #d8c9ac; position: relative; }
.cal-grid .d.mark { color: #fff; font-weight: 600; }
.cal-grid .d.mark::before { content: '♥'; position: absolute; font-size: 2.3rem; color: var(--wine); z-index: -1; animation: beat 1.4s infinite; }
.cal-grid .d.mark { z-index: 0; isolation: isolate; }
.cal-grid .d.mark2 { outline: 1px dashed var(--gold-2); border-radius: 50%; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.18); } 30% { transform: scale(1); } 45% { transform: scale(1.12); } }
.cal-legend { margin-top: 10px; font-size: .75rem; color: #c8b896; }
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 420px; margin: 0 auto 28px; }
.countdown div { border: 1px solid rgba(217, 184, 106, .4); border-radius: 12px; padding: 14px 4px; background: rgba(255, 255, 255, .03); }
.countdown b { display: block; font-family: var(--serif); font-size: clamp(1.6rem, 8vw, 2.4rem); font-weight: 400; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.countdown span { font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: #c8b896; }

/* ---------- Cô dâu chú rể ---------- */
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 760px; margin: 0 auto; }
.person { margin: 0; }
.arch { border-radius: 999px 999px 12px 12px; overflow: hidden; border: 1px solid var(--line); padding: 6px; background: #fff; box-shadow: 0 20px 40px -24px rgba(90, 60, 20, .5); }
.arch img { border-radius: 999px 999px 8px 8px; aspect-ratio: 2 / 3; object-fit: cover; width: 100%; transition: transform 1.2s; }
.person:hover .arch img { transform: scale(1.05); }
.person figcaption { margin-top: 12px; }
.person small { display: block; letter-spacing: .3em; text-transform: uppercase; font-size: .65rem; color: var(--muted); }
.person .script { display: block; font-size: clamp(1.8rem, 8vw, 2.6rem); color: var(--gold); line-height: 1.1; }
.person em { font-style: normal; font-size: .8rem; color: var(--muted); }

/* ---------- Sự kiện ---------- */
.events { display: grid; gap: 20px; max-width: 760px; margin: 0 auto; }
.event { background: #fffdf8; border: 1px solid var(--line); border-radius: 18px; padding: 28px 20px; position: relative; overflow: hidden; }
.event::before { content: ''; position: absolute; inset: 0 0 auto; height: 4px; background: var(--gold-grad); }
.event h3 { font-family: var(--serif); font-weight: 400; font-size: 1.6rem; margin: 0 0 4px; color: var(--ink); }
.event .when { font-weight: 500; margin: 0; }
.event .lunar { font-style: italic; color: var(--muted); margin: 2px 0 6px; font-size: .9rem; }
.event .time { display: inline-block; background: var(--ink); color: var(--gold-3); border-radius: 999px; padding: 3px 14px; font-size: .85rem; margin-bottom: 14px; }
.places { display: grid; gap: 10px; }
.place { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; border-top: 1px dashed var(--line); padding-top: 10px; }
.place b { display: block; font-size: .78rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.place span { font-size: .9rem; }
.place a { flex: none; font-size: .8rem; padding: .55em 1em; }

/* ---------- Album ---------- */
.gallery { columns: 2; column-gap: 10px; max-width: 980px; margin: 0 auto; }
.gallery button { display: block; width: 100%; padding: 0; border: 0; margin: 0 0 10px; border-radius: 10px; overflow: hidden; break-inside: avoid; background: var(--cream); }
.gallery img { width: 100%; transition: transform .8s; }
.gallery button:hover img { transform: scale(1.06); }
.lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(15, 11, 8, .96); display: flex; align-items: center; justify-content: center; touch-action: pan-y; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 94vw; max-height: 86vh; object-fit: contain; border-radius: 6px; animation: zoomIn .35s ease; }
@keyframes zoomIn { from { opacity: 0; transform: scale(.94); } }
.lightbox button { position: absolute; background: none; border: 0; color: var(--gold-3); font-size: 2.6rem; padding: 10px 16px; line-height: 1; }
.lb-close { top: 8px; right: 6px; }
.lb-prev { left: 0; top: 50%; transform: translateY(-50%); }
.lb-next { right: 0; top: 50%; transform: translateY(-50%); }
.lb-count { position: absolute; bottom: 18px; color: var(--gold-3); font-size: .85rem; letter-spacing: .2em; }

/* ---------- Lời chúc ---------- */
.wish-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 30px; }
.wall { columns: 2; column-gap: 12px; max-width: 980px; margin: 0 auto; text-align: left; }
.post { break-inside: avoid; margin: 0 0 12px; background: #fffdf8; color: var(--ink); border-radius: 12px; overflow: hidden; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }
.post img { width: 100%; }
.post .txt { padding: 12px 14px; }
.post b { color: var(--gold); font-family: var(--serif); }
.post p { margin: 4px 0 0; font-size: .9rem; white-space: pre-wrap; word-break: break-word; }
.wall-empty { color: #c8b896; font-style: italic; }

#bubbles { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.bubble {
  position: absolute; bottom: -80px; max-width: min(260px, 70vw); padding: 10px 14px; border-radius: 18px 18px 18px 4px;
  background: rgba(255, 253, 248, .92); color: var(--ink); font-size: .85rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  border: 1px solid var(--line); animation: floatUp 11s linear forwards; backdrop-filter: blur(4px);
}
.bubble b { color: var(--gold); display: block; font-size: .75rem; }
@keyframes floatUp {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  10% { opacity: 1; }
  50% { transform: translateY(-55vh) translateX(18px); }
  85% { opacity: 1; }
  100% { transform: translateY(-110vh) translateX(-10px); opacity: 0; }
}

/* ---------- Vòng quay ---------- */
.wheel-wrap { position: relative; width: min(360px, 88vw); aspect-ratio: 1; margin: 0 auto 22px; }
.wheel-wrap::before { content: ''; position: absolute; inset: -12px; border-radius: 50%; background: var(--gold-grad); box-shadow: 0 20px 50px -10px rgba(90, 60, 20, .5); }
#wheel { position: relative; width: 100%; height: 100%; border-radius: 50%; transition: transform 6.5s cubic-bezier(.12, .7, .08, 1); }
.wheel-pointer { position: absolute; z-index: 3; top: -22px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 16px solid transparent; border-right: 16px solid transparent; border-top: 34px solid var(--wine); filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .4)); }
.wheel-hub { position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 25%; aspect-ratio: 1; border-radius: 50%; border: 4px solid #fff; background: radial-gradient(circle at 35% 30%, #a83246, #6d1a26 70%); color: var(--gold-3); font-weight: 600; letter-spacing: .1em; box-shadow: 0 6px 16px rgba(0, 0, 0, .4); }
.wheel-hub:disabled { filter: grayscale(.4); cursor: default; }
.wheel-lock { position: absolute; z-index: 4; inset: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(28, 21, 15, .78); color: var(--gold-3); backdrop-filter: blur(3px); }
.wheel-lock[hidden] { display: none; }
.wheel-lock p { margin: 6px 0; font-size: .9rem; }
.wheel-lock b { font-family: var(--serif); font-size: 1.3rem; font-weight: 400; }
.lock-icon { font-size: 2rem; }
.spin-form { max-width: 320px; margin: 0 auto; }
.spin-form[hidden] { display: none; }
.spin-note { color: var(--muted); font-size: .9rem; min-height: 1.4em; }

/* ---------- Biểu mẫu ---------- */
input, textarea {
  width: 100%; font: inherit; font-weight: 400; padding: 13px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); margin-bottom: 10px; outline: none;
}
input:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184, 145, 58, .18); }
.modal { position: fixed; inset: 0; z-index: 110; background: rgba(15, 11, 8, .7); display: flex; align-items: flex-end; justify-content: center; backdrop-filter: blur(4px); }
.modal[hidden] { display: none; }
.sheet { position: relative; width: min(480px, 100%); max-height: 92svh; overflow: auto; background: var(--ivory); border-radius: 22px 22px 0 0; padding: 26px 18px calc(22px + env(safe-area-inset-bottom)); animation: up .35s ease; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet.center { text-align: center; }
.sheet h3 { margin: 0 0 12px; font-size: 2.4rem; color: var(--gold); text-align: center; font-weight: 400; }
.sheet-close { position: absolute; top: 8px; right: 12px; border: 0; background: none; font-size: 1.8rem; color: var(--muted); }
@media (min-width: 640px) { .modal { align-items: center; } .sheet { border-radius: 22px; } }
.photo-pick { margin-bottom: 12px; text-align: center; }
.photo-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.photo-btns .btn { font-size: .85rem; padding: .7em 1.1em; }
#photoPreview { border-radius: 12px; max-height: 44svh; margin: 0 auto 6px; }
.link { background: none; border: 0; color: var(--wine); text-decoration: underline; font-size: .85rem; }
.form-msg { min-height: 1.2em; font-size: .9rem; color: var(--wine); margin: 0 0 8px; }
.form-msg.ok { color: #3c6b3a; }
.confetti-emoji { font-size: 3.4rem; animation: pop .6s ease; }
@keyframes pop { from { transform: scale(0); } 70% { transform: scale(1.2); } }
.prize-code { font-family: var(--serif); font-size: 1.8rem; letter-spacing: .15em; color: var(--wine); border: 2px dashed var(--gold); border-radius: 12px; padding: 8px; margin: 14px auto; max-width: 260px; }
.prize-code:empty { display: none; }
.small { font-size: .82rem; color: var(--muted); }

/* ---------- Chân trang ---------- */
.footer { position: relative; min-height: 70svh; display: grid; place-items: center; color: #fff; text-align: center; overflow: hidden; }
.footer-bg { position: absolute; inset: 0; background-size: cover; background-position: center; }
.footer::after { content: ''; position: absolute; inset: 0; background: rgba(28, 21, 15, .55); }
.footer-content { position: relative; z-index: 1; padding: 0 16px; }
.footer .big { font-size: clamp(3.6rem, 16vw, 5.5rem); margin: 0; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.footer-names { letter-spacing: .3em; text-transform: uppercase; font-size: .8rem; color: var(--gold-3); }

/* ---------- Nút nổi ---------- */
.floating { position: fixed; right: 14px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 60; display: flex; flex-direction: column; gap: 10px; }
.fab { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--gold-2); background: rgba(28, 21, 15, .82); color: var(--gold-3); font-size: 1.1rem; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); backdrop-filter: blur(6px); }
.fab.on { animation: spin 4s linear infinite; }
.fab.off { opacity: .55; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 760px) {
  .gallery { columns: 3; }
  .wall { columns: 3; }
  .events { grid-template-columns: 1fr 1fr; }
  .section { padding: 110px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
