:root {
  /* màu nền / chữ */
  --bg: #1a0812; --ink: #fff1f5; --muted: #e6c9d4;
  --gold: #e8c27a; --gold-2: #f6e0a8; --rose: #f472b6;
  --names: #f6e0a8; --heading: #f6e0a8; --num: #f6e0a8;
  --glass: rgba(255, 241, 245, .07); --glass-line: rgba(232, 194, 122, .28);
  /* thẻ */
  --card-bg: linear-gradient(145deg, rgba(255,241,245,.1), rgba(255,241,245,.03));
  --card-shadow: 0 20px 60px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.12);
  --card-blur: 14px; --card-radius: 22px;
  /* phát sáng */
  --tglow: 0 0 40px rgba(232,194,122,.35); --tglow2: 0 0 24px rgba(232,194,122,.45);
  --amp-glow: 0 0 30px rgba(244,114,182,.7); --dot-glow: 0 0 14px var(--gold);
  /* nút, ô nhập, các thành phần nhỏ */
  --btn-fg: #3a0f27; --btn-bg: linear-gradient(120deg, #b5852f, var(--gold), #fff3c9, var(--gold));
  --btn-shadow: 0 8px 28px rgba(232,194,122,.3); --btn-shadow-hover: 0 12px 36px rgba(232,194,122,.5);
  --on-accent: #3a0f27; --input-bg: rgba(0,0,0,.25); --ph-text: rgba(230,201,212,.55); --scheme: dark;
  --panel-bg: rgba(26, 8, 18, .6); --ghost-hover: rgba(232,194,122,.12);
  --err: #ffb4c8; --ok: #bfeccd;
  --ph-bg: #2b0d1e; --ph-grad: radial-gradient(circle at 30% 20%, rgba(244,114,182,.35), transparent 55%), linear-gradient(160deg, #3a0f27, #1a0812);
  --item-shadow: 0 16px 40px rgba(0,0,0,.5);
  --sw-shadow: 0 0 0 3px rgba(255,255,255,.14), 0 8px 24px rgba(0,0,0,.4);
  --qr-shadow: 0 0 0 4px rgba(232,194,122,.35), 0 18px 50px rgba(0,0,0,.45), 0 0 40px rgba(232,194,122,.25);
  --vig: rgba(10, 2, 7, .65); --hero-overlay: linear-gradient(180deg, rgba(26,8,18,.45), rgba(26,8,18,.2) 40%, rgba(26,8,18,.78));
  /* màn hình mở thiệp */
  --cv-bg: radial-gradient(ellipse at 50% 38%, rgba(120, 40, 85, .55), transparent 62%), radial-gradient(ellipse at 50% 100%, rgba(232, 194, 122, .10), transparent 55%), linear-gradient(180deg, #230a17, #1a0812 70%);
  --dust-a: #fff7d6; --dust-b: rgba(232,194,122,.5);
  --env-a: #4a1633; --env-b: #2a0c1b; --env-fa: #7a2450; --env-fb: #4a1633;
  --env-la: #a63571; --env-lb: #66193f; --env-ga: #3a0f27; --env-gb: #5c1a3b; --env-lines: rgba(246,224,168,.20);
  --env-shadow: rgba(0,0,0,.6); --env-ink: #4a1633; --env-script: #7a2450; --env-sub: #8a5a12; --env-line: #c99a3c; --env-amp: #b8466f; --env-date: #7a5212;
  --rays: rgba(246,224,168,.20);
  /* font */
  --script: 'Great Vibes', cursive; --serif: 'Cormorant Infant', Georgia, serif; --sans: 'Be Vietnam Pro', system-ui, sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 300 1rem/1.7 var(--sans); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.locked { overflow: hidden; }
body.no-webgl { background: radial-gradient(circle at 50% 20%, #5b1a3a, var(--bg) 60%); }
[hidden] { display: none !important; }
a { color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 3px; }

#stage { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; }
.vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, var(--vig) 100%);
}
main, .music { position: relative; z-index: 2; }

.script { font-family: var(--script); font-weight: 400; line-height: 1.15; margin: 0; }
.eyebrow {
  font: 400 .8rem/1 var(--sans); letter-spacing: .38em; text-transform: uppercase;
  color: var(--gold); margin: 0 0 1rem;
}

.music {
  position: relative;
  width: 46px; height: 46px; border-radius: 50%; cursor: pointer; color: var(--gold);
  background: var(--panel-bg); border: 1px solid var(--glass-line); backdrop-filter: blur(8px);
  display: grid; place-items: center;
}
.music[aria-pressed="true"] svg { animation: spin 3s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh; display: flex; align-items: flex-end; justify-content: center;
  padding: 2rem 1rem 3rem; text-align: center;
}
.hero-text { max-width: 900px; }
.names { font-size: clamp(3.4rem, 13vw, 8rem); color: var(--names); text-shadow: var(--tglow); }
.names .split { display: inline-block; }
.names .split span { display: inline-block; will-change: transform; }
.amp { font-style: normal; color: var(--rose); padding: 0 .15em; text-shadow: var(--amp-glow); }
.hero-date { font: 400 clamp(1.1rem, 3vw, 1.6rem) var(--serif); letter-spacing: .25em; text-transform: uppercase; margin: 1rem 0 .5rem; }
.hero-invite { max-width: 520px; margin: 0 auto; color: var(--muted); }
.scroll-hint { display: block; width: 26px; height: 44px; margin: 2rem auto 2.4rem; border: 1.5px solid var(--gold); border-radius: 14px; position: relative; }
.scroll-hint span { position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--gold); animation: wheel 1.8s infinite; }
@keyframes wheel { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(16px); } }

/* ---------- Blocks ---------- */
.block { max-width: 1040px; margin: 0 auto; padding: clamp(4rem, 12vw, 8rem) 1.25rem 0; }
.block.wide { max-width: 1240px; }
.sec-head { text-align: center; margin-bottom: 3rem; }
.sec-head h2 { font-size: clamp(2.4rem, 7vw, 4rem); color: var(--heading); }

.card {
  position: relative; border: 1px solid var(--glass-line); border-radius: var(--card-radius); padding: 2rem;
  background: var(--card-bg);
  backdrop-filter: blur(var(--card-blur)); -webkit-backdrop-filter: blur(var(--card-blur));
  box-shadow: var(--card-shadow);
}
/* Hiệu ứng ánh sáng chạy theo con trỏ */
.tilt { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .25s var(--ease); transform-style: preserve-3d; overflow: hidden; }
.tilt::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 226, 160, .22), transparent 55%);
  opacity: 0; transition: opacity .3s;
}
.tilt:hover::after { opacity: 1; }

/* Couple */
.couple-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.person { text-align: center; }
.avatar {
  width: 170px; height: 170px; margin: 0 auto 1.4rem; border-radius: 50%; padding: 5px;
  background: conic-gradient(from 0deg, var(--gold), #fff3c9, var(--rose), var(--gold));
  animation: spin 9s linear infinite;
}
.avatar > div {
  width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center;
  background: var(--ph-bg) center/cover; font: 400 4rem var(--script); color: var(--gold-2);
  animation: spin 9s linear infinite reverse;
}
.person h3 { font: 600 1.8rem var(--serif); margin: 0; }
.person .role { color: var(--gold); letter-spacing: .3em; text-transform: uppercase; font-size: .75rem; margin: .3rem 0 1rem; }
.person p { margin: .4rem 0; color: var(--muted); }

/* Countdown */
.count { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(.5rem, 2vw, 1.2rem); max-width: 720px; margin: 0 auto; }
.count > div {
  border: 1px solid var(--glass-line); border-radius: 18px; padding: 1.4rem .4rem; text-align: center;
  background: var(--glass); backdrop-filter: blur(10px);
}
.count b { display: block; font: 600 clamp(2rem, 8vw, 3.8rem)/1 var(--serif); color: var(--num); font-variant-numeric: tabular-nums; text-shadow: var(--tglow2); }
.count span { font-size: .72rem; letter-spacing: .25em; text-transform: uppercase; color: var(--muted); }
.done { text-align: center; font: 400 1.6rem var(--serif); color: var(--gold-2); }

/* Timeline */
.timeline { list-style: none; margin: 0 auto; padding: 0; max-width: 820px; position: relative; }
.timeline::before {
  content: ''; position: absolute; left: 18px; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(var(--gold), var(--rose)); box-shadow: var(--dot-glow); opacity: .7;
}
.timeline li { position: relative; padding: 0 0 2.5rem 3.4rem; }
.timeline li::before {
  content: ''; position: absolute; left: 9px; top: .35rem; width: 20px; height: 20px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--gold); box-shadow: var(--dot-glow);
}
.timeline .when { font: 400 1.1rem var(--serif); color: var(--gold); letter-spacing: .2em; }
.timeline h3 { margin: .2rem 0 .4rem; font: 600 1.6rem var(--serif); }
.timeline p { margin: 0; color: var(--muted); }
@media (min-width: 800px) {
  .timeline::before { left: 50%; margin-left: -1px; }
  .timeline li { width: 50%; padding: 0 3rem 3rem 0; text-align: right; }
  .timeline li:nth-child(even) { margin-left: 50%; padding: 0 0 3rem 3rem; text-align: left; }
  .timeline li::before { left: auto; right: -10px; }
  .timeline li:nth-child(even)::before { right: auto; left: -10px; }
}

/* Events */
.event-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.event { text-align: center; }
.event .time { font: 300 3.6rem/1 var(--serif); color: var(--num); text-shadow: var(--tglow2); }
.event h3 { font: 400 2.2rem var(--script); margin: .5rem 0; color: var(--ink); }
.event p { margin: .25rem 0; color: var(--muted); }
.event .place { color: var(--ink); font-weight: 400; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; text-indent: .18em; line-height: 1.2;
  margin-top: 1.4rem; padding: .85rem 2rem; min-height: 44px; border-radius: 999px; cursor: pointer;
  font: 500 .8rem var(--sans); letter-spacing: .18em; text-transform: uppercase; text-decoration: none; border: 0;
  color: var(--btn-fg); background: var(--btn-bg);
  background-size: 250% 100%; transition: background-position .6s var(--ease), transform .3s var(--ease), box-shadow .3s;
  box-shadow: var(--btn-shadow);
}
.btn:hover { background-position: 100% 0; transform: translateY(-2px); box-shadow: var(--btn-shadow-hover); }

/* Gallery */
.gallery { columns: 3 260px; column-gap: 1rem; }
.shot {
  break-inside: avoid; margin: 0 0 1rem; border-radius: 16px; overflow: hidden; position: relative;
  border: 1px solid var(--glass-line); cursor: zoom-in; background: var(--ph-bg);
}
.shot img { display: block; width: 100%; height: auto; transition: transform .8s var(--ease); }
.shot:hover img { transform: scale(1.06); }
.shot.ph { display: grid; place-items: center; cursor: default; color: var(--gold); font: 400 3.2rem var(--script);
  background: var(--ph-grad); }
.shot.ph small { display: block; font: 300 .75rem var(--sans); letter-spacing: .2em; color: var(--muted); text-transform: uppercase; text-align: center; }
dialog#lb { border: 0; background: transparent; max-width: 94vw; max-height: 94vh; padding: 0; }
dialog#lb::backdrop { background: rgba(10, 2, 7, .88); backdrop-filter: blur(6px); }
dialog#lb img { max-width: 94vw; max-height: 90vh; border-radius: 12px; display: block; }

/* RSVP */
.rsvp-wrap { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
form label { display: block; margin: 1rem 0 .4rem; font-size: .85rem; color: var(--gold); letter-spacing: .06em; }
input[type=text], input[type=number], select, textarea {
  width: 100%; padding: .8rem 1rem; min-height: 44px; border-radius: 12px; color: var(--ink);
  background: var(--input-bg); border: 1px solid var(--glass-line); font: inherit;
}
input::placeholder, textarea::placeholder { color: var(--ph-text); }
fieldset { border: 0; padding: 0; margin: 1rem 0 0; }
legend { font-size: .85rem; color: var(--gold); padding: 0; }
.chip { display: inline-block !important; margin: .5rem .5rem 0 0 !important; }
.chip input { position: absolute; opacity: 0; }
.chip span { display: inline-block; padding: .55rem 1.1rem; border-radius: 999px; border: 1px solid var(--glass-line); cursor: pointer; color: var(--ink); transition: .25s; }
.chip input:checked + span { background: var(--gold); color: var(--on-accent); }
.chip input:focus-visible + span { outline: 2px solid var(--gold-2); outline-offset: 3px; }
.err { color: var(--err); margin: .8rem 0 0; }
.wishes h3 { font: 600 1.6rem var(--serif); margin: 0 0 1rem; color: var(--gold-2); }
.wishes ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; max-height: 480px; overflow: auto; }
.wishes li { padding: 1rem 1.2rem; border-radius: 14px; background: var(--glass); border: 1px solid var(--glass-line); }
.wishes li b { color: var(--gold-2); font-weight: 500; }
.wishes li p { margin: .3rem 0 0; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Gift */
.gift { max-width: 520px; margin: 0 auto; text-align: center; }
.gift img { width: 190px; max-width: 60%; border-radius: 14px; margin-bottom: 1rem; background: #fff; padding: 8px; }
.gift .acc { font: 600 2rem var(--serif); color: var(--gold-2); letter-spacing: .08em; margin: .3rem 0; }
.gift p { margin: .2rem 0; color: var(--muted); }

.foot { text-align: center; padding: 7rem 1rem 4rem; color: var(--muted); }
.foot .big { font-size: clamp(3rem, 10vw, 5.5rem); color: var(--heading); text-shadow: var(--tglow); }
.foot .small { font-size: .85rem; }

/* Tia lấp lánh theo con trỏ */
.spark {
  position: fixed; z-index: 60; pointer-events: none; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: radial-gradient(circle, #fff7d6, var(--gold) 55%, transparent 70%);
  animation: spark .9s ease-out forwards;
}
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; } }

@media (max-width: 560px) {
  .card { padding: 1.4rem; }
  .hero { padding-bottom: 2rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .spark { display: none; }
}

/* ---------- Khách mời riêng ---------- */
.cover-to { font: 400 1.5rem var(--serif); color: var(--gold-2); margin: 1.2rem 0 0; letter-spacing: .08em; }
.foryou { text-align: center; padding: 2.6rem 1.6rem; }
.foryou h2 { font-size: clamp(2.8rem, 9vw, 5rem); color: var(--heading); text-shadow: var(--tglow); }
.foryou .personal { font: italic 400 1.35rem/1.6 var(--serif); color: var(--ink); max-width: 560px; margin: 1.2rem auto; }
.chips { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin: 1.4rem 0 .6rem; }
.tag { padding: .5rem 1.1rem; border-radius: 999px; border: 1px solid var(--glass-line); background: var(--glass); font-size: .9rem; }
.tag.gold { background: var(--gold); color: var(--on-accent); font-weight: 500; }
.hint { color: var(--muted); font-size: .85rem; margin: 1rem 0 0; }

/* ---------- Lộ trình ---------- */
.route { list-style: none; margin: 0 auto; padding: 0; max-width: 700px; }
.route li { display: grid; grid-template-columns: 78px 1fr; gap: 1.4rem; position: relative; padding-bottom: 2rem; }
.route li::before { content: ''; position: absolute; left: 78px; top: .55rem; bottom: -.4rem; width: 2px; margin-left: .55rem; background: linear-gradient(var(--gold), transparent); opacity: .5; }
.route li:last-child::before { display: none; }
.route time { font: 600 1.5rem var(--serif); color: var(--gold-2); text-align: right; padding-top: .1rem; }
.route .rb { position: relative; padding-left: 1.6rem; }
.route .rb::before { content: ''; position: absolute; left: -.3rem; top: .6rem; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); box-shadow: var(--dot-glow); }
.route h3 { margin: 0 0 .2rem; font: 600 1.35rem var(--serif); }
.route p { margin: 0; color: var(--muted); }
.route small { color: var(--gold); letter-spacing: .08em; }

@media (max-width: 480px) { .route li { grid-template-columns: 62px 1fr; gap: 1rem; } .route li::before { left: 62px; } }

/* ---------- Trang tạo link khách mời ---------- */
.tool { max-width: 920px; margin: 0 auto; padding: 3rem 1.25rem 5rem; position: relative; z-index: 2; }
.tool h1 { font: 400 clamp(2.6rem, 8vw, 4rem) var(--script); color: var(--gold-2); margin: 0 0 .5rem; text-align: center; }
.tool textarea { font: 400 .95rem/1.6 ui-monospace, Consolas, monospace; }
.tool table { width: 100%; border-collapse: collapse; margin-top: 1.5rem; font-size: .9rem; }
.tool th, .tool td { text-align: left; padding: .7rem .6rem; border-bottom: 1px solid var(--glass-line); vertical-align: top; }
.tool td.url { max-width: 340px; overflow-wrap: anywhere; color: var(--muted); font-size: .8rem; }
.btn.sm { margin: 0; padding: .5rem 1rem; font-size: .7rem; }

html { background: var(--bg); }
body:not(.ok) { visibility: hidden; }

/* ---------- Bản đồ & hành trình ---------- */
.map { display: block; width: 100%; height: 240px; border: 0; border-radius: 14px; margin-top: 1.2rem; }
.event .btn.sm { margin-top: 1rem; }
.trip-intro { max-width: 560px; margin: 1rem auto 0; color: var(--muted); }
.route li.day { display: block; padding: .4rem 0 1.4rem; font: 400 .85rem var(--sans); letter-spacing: .3em; text-transform: uppercase; color: var(--gold); border-bottom: 1px solid var(--glass-line); margin-bottom: 1.6rem; }
.route li.day::before { display: none; }
.mapbox { margin-top: .7rem; }
.mapbox summary { cursor: pointer; color: var(--gold); font-size: .85rem; min-height: 32px; }
.mapbox .btn.sm { margin-top: .8rem; }

.scroll-hint::after { content: 'Cuộn xuống'; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: .6rem; white-space: nowrap; font: 400 .68rem var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }

/* ---------- Mừng cưới bằng QR ---------- */
.gift .qr { width: min(280px, 78%); aspect-ratio: 1; margin: 0 auto 1.2rem; padding: 12px; border-radius: 20px; background: #fff; box-shadow: var(--qr-shadow); display: grid; place-items: center; }
.gift .qr img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 8px; padding: 0; background: none; margin: 0; max-width: none; }
.gift .qr.empty { background: rgba(255,255,255,.06); box-shadow: none; border: 2px dashed var(--glass-line); color: var(--muted); font-size: .85rem; text-align: center; }
.gift .who { font: 600 1.5rem var(--serif); color: var(--gold-2); letter-spacing: .08em; margin: .2rem 0; }


/* ---------- Mở thiệp: phong bì 3D (màu lấy từ theme) ---------- */
#cover { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; overflow: hidden; }
.cover-bg { position: absolute; inset: 0; background: var(--cv-bg); }
.cover-dust { position: absolute; inset: 0; pointer-events: none; }
.cover-dust i { position: absolute; border-radius: 50%; background: radial-gradient(circle, var(--dust-a), var(--dust-b) 45%, transparent 70%); animation: twinkle var(--d, 3s) ease-in-out var(--l, 0s) infinite; opacity: 0; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.4) translateY(0); } 50% { opacity: .9; transform: scale(1) translateY(-14px); } }
.cover-stage { position: relative; text-align: center; padding: 1rem; width: 100%; max-width: 100%; }
.cover-names { font-size: clamp(2rem, 8vw, 4.6rem); color: var(--names); text-shadow: var(--tglow); }
.cover-names i { font-style: normal; color: var(--rose); }

.envelope { --w: min(84vw, 380px); position: relative; width: var(--w); height: calc(var(--w) * .68); margin: 2.6rem auto 0; perspective: 1100px; filter: drop-shadow(0 30px 34px var(--env-shadow)); }
.envelope > * { position: absolute; }
.env-back { inset: 0; border-radius: 8px; z-index: 0; background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .09 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"), linear-gradient(160deg, var(--env-a), var(--env-b)); }
.env-glow { left: -25%; right: -25%; top: -45%; bottom: 10%; z-index: 1; opacity: 0; background: radial-gradient(closest-side, rgba(255,236,170,.75), rgba(232,194,122,.28) 55%, transparent); pointer-events: none; }
.env-card { left: 6%; right: 6%; top: 7%; height: 86%; z-index: 2; border-radius: 5px; padding: .5rem .6rem; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .08rem; color: var(--env-ink);
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .09 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"), linear-gradient(165deg, #fffdf8, #f8eed8);
  box-shadow: inset 0 0 0 1px var(--env-line), inset 0 0 0 5px #fffaf0, inset 0 0 0 6px var(--env-line), 0 3px 14px rgba(0,0,0,.25); }
.env-card .eyebrow { color: var(--env-sub); font-size: .54rem; letter-spacing: .3em; margin: .15rem 0 0; }
.env-rings { display: block; }
.env-to { font-size: clamp(1.6rem, 7.6vw, 2.3rem); color: var(--env-script); line-height: 1.05; overflow-wrap: anywhere; margin: .1rem 0; }
.env-line { font: italic 400 .78rem var(--serif); margin: 0; color: #6b5a50; }
.env-names { font-size: clamp(1.25rem, 5.6vw, 1.7rem); color: var(--env-ink); margin: 0; line-height: 1.1; }
.env-names i { font-style: normal; color: var(--env-amp); }
.env-date { font: 600 .8rem var(--serif); letter-spacing: .26em; margin: .2rem 0 .1rem; color: var(--env-date); }
.env-shine { position: absolute; top: -10%; bottom: -10%; left: -45%; width: 28%; transform: skewX(-18deg); pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.85), transparent); mix-blend-mode: soft-light; }
.env-front { inset: 0; z-index: 3; border-radius: 8px; clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%);
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .09 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"), linear-gradient(112deg, rgba(255,255,255,.07) 0 30%, transparent 30% 100%), linear-gradient(160deg, var(--env-fa), var(--env-fb) 75%); }
.env-flap { left: 0; top: 0; width: 100%; height: 56%; z-index: 4; transform-origin: 50% 0; transform-style: preserve-3d; }
.env-flap i { position: absolute; inset: 0; clip-path: polygon(0 0, 100% 0, 50% 100%); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.env-flap .ff { background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .09 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"), linear-gradient(180deg, var(--env-la), var(--env-lb)); }
.env-flap .fb { transform: rotateY(180deg); background:
  repeating-linear-gradient(45deg, var(--env-lines) 0 1px, transparent 1px 10px),
  repeating-linear-gradient(-45deg, var(--env-lines) 0 1px, transparent 1px 10px),
  linear-gradient(180deg, var(--env-ga), var(--env-gb)); }
.seal { z-index: 5; left: calc(50% - 39px); top: calc(56% - 39px); width: 78px; height: 78px; padding: 0; display: block; border: 0; background: none; cursor: pointer;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.35)) drop-shadow(0 0 14px rgba(232,194,122,.55)); animation: sealGlow 2.4s ease-in-out infinite; transition: transform .3s var(--ease); }
.seal:hover { transform: scale(1.08); }
.seal svg { display: block; }
@keyframes sealGlow { 50% { filter: drop-shadow(0 4px 10px rgba(0,0,0,.35)) drop-shadow(0 0 26px rgba(246,224,168,.95)); } }
.cover-hint { color: var(--muted); font-size: .85rem; margin: 2.2rem 0 0; letter-spacing: .08em; }

/* ---------- Ảnh / video nền hero ---------- */
.herobg { position: fixed; inset: 0; z-index: 0; background: center / cover no-repeat; opacity: 0; pointer-events: none; }
.has-media .herobg { opacity: 1; }
.herobg video { width: 100%; height: 100%; object-fit: cover; display: block; }
.herobg::after { content: ''; position: absolute; inset: 0; background: var(--hero-overlay); }
[data-scene="rings"] body.has-media #stage { mix-blend-mode: screen; }

/* ---------- Album 3D ---------- */
.ring3d { --ch: 294px; perspective: 1400px; height: calc(var(--ch) + 70px); position: relative; display: grid; place-items: center; touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; }
.ring3d.drag { cursor: grabbing; }
.ring-track { position: relative; transform-style: preserve-3d; will-change: transform; }
.ring-item { position: absolute; inset: 0; margin: 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--glass-line); background: var(--ph-bg); backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: var(--item-shadow); }
.ring-item img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.ring-item.ph { display: grid; place-items: center; color: var(--gold); font: 400 3rem var(--script); background: var(--ph-grad); }
.ring-item.ph small { display: block; font: 300 .62rem var(--sans); letter-spacing: .15em; color: var(--muted); text-transform: uppercase; text-align: center; padding: 0 .5rem; }
.ring-hint { text-align: center; margin-top: 1.4rem; }

/* ---------- Hàng nút, liên hệ, lịch, RSVP ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin-top: 1.2rem; }
.event .btn-row .btn.sm, .btn-row .btn { margin: 0; }
.btn.ghost { background: transparent; color: var(--gold); box-shadow: inset 0 0 0 1px var(--glass-line); }
.btn.ghost:hover { background: var(--ghost-hover); box-shadow: inset 0 0 0 1px var(--gold); transform: translateY(-2px); }
.cal-row { text-align: center; margin-top: 2rem; }
.contacts { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); max-width: 720px; margin: 0 auto; }
.contact { text-align: center; }
.contact h3 { font: 600 1.6rem var(--serif); margin: 0; }
.contact .role { color: var(--gold); letter-spacing: .3em; text-transform: uppercase; font-size: .72rem; margin: .3rem 0 0; }
.ok-note { color: var(--ok); margin: .8rem 0 0; }
select { color-scheme: var(--scheme); appearance: none; -webkit-appearance: none; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
input[readonly] { opacity: .85; cursor: default; }
.wishes li small { margin-left: .6rem; color: var(--muted); font-size: .75rem; }

/* ---------- Thanh công cụ & tuỳ chỉnh hiệu ứng ---------- */
.tools { position: fixed; top: max(1rem, env(safe-area-inset-top)); right: 1rem; z-index: 40; display: flex; gap: .6rem; }
.music[aria-expanded="true"] { background: var(--gold); color: var(--on-accent); }
.fx-panel { position: fixed; z-index: 41; top: calc(max(1rem, env(safe-area-inset-top)) + 56px); right: 1rem; width: min(300px, calc(100vw - 2rem)); padding: 1.1rem 1.1rem 1.2rem; }
.fx-title { margin: 0; font: 600 1.25rem var(--serif); color: var(--gold-2); }
.fx-choices { display: flex; flex-wrap: wrap; margin-bottom: .8rem; }
.fx-panel .btn { margin: 0; }

/* Không cho phần tử đang trượt vào (hiệu ứng) hay khối 3D làm trang rộng ra ngang trên điện thoại */
html, body { overflow-x: clip; max-width: 100%; }
main { overflow-x: clip; }


/* ======================================================================
   THEME SÁNG (ivory / blush / sage): đơn giản, thanh lịch như thiệp cưới giấy
   ====================================================================== */
[data-mode="light"] .vignette { display: none; }
[data-mode="light"] .avatar { animation: none; padding: 4px; background: var(--gold); box-shadow: 0 0 0 6px var(--bg), 0 0 0 7px var(--glass-line); }
[data-mode="light"] .avatar > div { animation: none; color: var(--gold-2); }
[data-mode="light"] .card { border-radius: var(--card-radius); }
[data-mode="light"] .tilt::after { background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 0%), rgba(255,255,255,.55), transparent 55%); }
[data-mode="light"] .sec-head::after { content: ''; display: block; width: 64px; height: 1px; margin: 1.3rem auto 0; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
[data-mode="light"] .eyebrow { letter-spacing: .32em; }
[data-mode="light"] .btn { text-indent: .18em; font-weight: 500; }
[data-mode="light"] .timeline::before, [data-mode="light"] .route li::before { opacity: .45; }
[data-mode="light"] .ring-item, [data-mode="light"] .shot { border-color: rgba(255,255,255,.9); border-width: 5px; }
[data-mode="light"] .foot { border-top: 1px solid var(--glass-line); margin-top: 6rem; padding-top: 5rem; }

/* Màn hình đầu: chữ ở giữa, hai nhành lá trang trí ở góc */
[data-mode="light"] .hero { align-items: center; padding: 5.5rem 1rem 4rem; position: relative; overflow: hidden; }
[data-mode="light"] .hero::before, [data-mode="light"] .hero::after {
  content: ''; position: absolute; width: clamp(130px, 34vw, 260px); aspect-ratio: 200 / 260; background: var(--gold); opacity: .5; pointer-events: none;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 260'><path d='M22 252C34 172 74 100 164 18' stroke='black' stroke-width='2.4' fill='none'/><g fill='black'><ellipse cx='30' cy='214' rx='20' ry='8' transform='rotate(-30 30 214)'/><ellipse cx='46' cy='196' rx='20' ry='8' transform='rotate(-120 46 196)'/><ellipse cx='52' cy='160' rx='20' ry='8' transform='rotate(-38 52 160)'/><ellipse cx='72' cy='146' rx='20' ry='8' transform='rotate(-128 72 146)'/><ellipse cx='78' cy='116' rx='20' ry='8' transform='rotate(-46 78 116)'/><ellipse cx='102' cy='106' rx='20' ry='8' transform='rotate(-136 102 106)'/><ellipse cx='108' cy='80' rx='19' ry='7.5' transform='rotate(-52 108 80)'/><ellipse cx='132' cy='72' rx='19' ry='7.5' transform='rotate(-142 132 72)'/><ellipse cx='140' cy='48' rx='18' ry='7' transform='rotate(-58 140 48)'/><ellipse cx='160' cy='36' rx='17' ry='6.5' transform='rotate(-120 160 36)'/><circle cx='170' cy='14' r='7'/></g></svg>") center / contain no-repeat; mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 260'><path d='M22 252C34 172 74 100 164 18' stroke='black' stroke-width='2.4' fill='none'/><g fill='black'><ellipse cx='30' cy='214' rx='20' ry='8' transform='rotate(-30 30 214)'/><ellipse cx='46' cy='196' rx='20' ry='8' transform='rotate(-120 46 196)'/><ellipse cx='52' cy='160' rx='20' ry='8' transform='rotate(-38 52 160)'/><ellipse cx='72' cy='146' rx='20' ry='8' transform='rotate(-128 72 146)'/><ellipse cx='78' cy='116' rx='20' ry='8' transform='rotate(-46 78 116)'/><ellipse cx='102' cy='106' rx='20' ry='8' transform='rotate(-136 102 106)'/><ellipse cx='108' cy='80' rx='19' ry='7.5' transform='rotate(-52 108 80)'/><ellipse cx='132' cy='72' rx='19' ry='7.5' transform='rotate(-142 132 72)'/><ellipse cx='140' cy='48' rx='18' ry='7' transform='rotate(-58 140 48)'/><ellipse cx='160' cy='36' rx='17' ry='6.5' transform='rotate(-120 160 36)'/><circle cx='170' cy='14' r='7'/></g></svg>") center / contain no-repeat;
}
[data-mode="light"] .hero::before { top: -1rem; left: -1rem; transform: rotate(-8deg); }
[data-mode="light"] .hero::after { bottom: -1rem; right: -1rem; transform: rotate(172deg); }
[data-mode="light"] .hero-text { position: relative; z-index: 1; }
[data-mode="light"] .names { font-size: clamp(3.2rem, 12vw, 7rem); }
[data-mode="light"] .hero-date { color: var(--ink); }

/* Có ảnh nền hero: chữ chuyển sang màu trắng cho dễ đọc */
[data-mode="light"] body.has-media .hero-text, [data-mode="light"] body.has-media .hero-date, [data-mode="light"] body.has-media .hero-invite,
[data-mode="light"] body.has-media .names, [data-mode="light"] body.has-media .eyebrow { color: #fff; }
[data-mode="light"] body.has-media .hero-text .eyebrow { color: rgba(255,255,255,.85); }
[data-mode="light"] body.has-media .hero::before, [data-mode="light"] body.has-media .hero::after { background: #fff; opacity: .35; }

/* Cảnh 3D chế độ nhẹ: chỉ có hoa/đèn lồng/pháo hoa bay phía trước nội dung, nền trong suốt */
[data-scene="lite"] #stage { z-index: 30; pointer-events: none; }


/* ---------- Ảnh cưới: hero, dòng thời gian, lời cảm ơn ---------- */
.hero-photo, .thanks-photo { aspect-ratio: 3 / 4; margin: 0 auto 1.8rem; border-radius: 999px 999px 16px 16px; overflow: hidden;
  box-shadow: 0 0 0 1px var(--glass-line), 0 0 0 8px var(--bg), 0 0 0 9px var(--gold), 0 26px 50px rgba(40,25,20,.22); }
.hero-photo { width: min(62vw, 280px); }
.thanks-photo { width: min(56vw, 230px); margin-bottom: 2.4rem; }
.hero-photo img, .thanks-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; display: block; }
.thanks-photo img { object-position: 50% 30%; }
[data-scene="rings"] .hero-photo { display: none; }   /* mẫu tối đã có nhẫn 3D ở màn hình đầu */
.timeline .sp { display: block; width: min(100%, 250px); aspect-ratio: 4 / 3; object-fit: cover; object-position: 50% 28%; border-radius: 12px; margin: .9rem 0 0; box-shadow: 0 10px 28px rgba(40,25,20,.2); }
@media (min-width: 800px) { .timeline li:not(:nth-child(even)) .sp { margin-left: auto; } }

.wish-problem { color: var(--err); font-size: .9rem; }


/* ---------- Icon trong nút & liên hệ ---------- */
.btn svg { width: 1.15em; height: 1.15em; fill: currentColor; flex: none; margin-right: .6em; margin-left: -.1em; }
.contact .tel { display: inline-flex; align-items: center; gap: .55rem; margin: .9rem 0 0; font: 600 1.25rem var(--serif); letter-spacing: .06em; color: var(--ink); text-decoration: none; }
.contact .tel svg { width: 1.1em; height: 1.1em; fill: var(--gold); }
.btn.zalo { background: #0a7cff; color: #fff; box-shadow: 0 8px 22px rgba(10,124,255,.28); }
.btn.messenger { background: linear-gradient(120deg, #0a7cff, #a334fa 60%, #ff6968); color: #fff; box-shadow: 0 8px 22px rgba(163,52,250,.25); }

/* ---------- Mừng cưới: hai phong bao lì xì chéo chữ V ---------- */
.lixi-stage { position: relative; width: min(100%, 340px); height: 290px; margin: 0 auto; }
.lixi { position: absolute; bottom: 0; left: 50%; width: 130px; height: 196px; padding: 0; border: 0; border-radius: 12px; cursor: pointer; display: block; transform-origin: 50% 100%;
  background: linear-gradient(165deg, #e22b3d, #b3111f 60%, #8f0b17); color: #f6dd9b;
  box-shadow: inset 0 0 0 2px #f0c75e, inset 0 0 0 5px #b3111f, inset 0 0 0 6px rgba(240,199,94,.55), 0 16px 28px rgba(90,0,10,.35);
  animation: lixiBob 3.4s ease-in-out infinite, lixiGlow 2.2s ease-in-out infinite; transition: scale .3s var(--ease); }
.lixi:hover, .lixi:focus-visible { scale: 1.07; }
.lixi-l { margin-left: -112px; rotate: -15deg; z-index: 1; }
.lixi-r { margin-left: -18px; rotate: 15deg; z-index: 2; animation-delay: -1.2s, -.9s; }
.lixi-c { margin-left: -65px; z-index: 1; }
.lx-flap { position: absolute; left: 0; right: 0; top: 0; height: 46%; border-radius: 12px 12px 0 0; clip-path: polygon(0 0, 100% 0, 50% 100%); background: linear-gradient(180deg, #cc1d2f, #9a0e1b); }
.lx-seal { position: absolute; left: 50%; top: 46%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; color: #8f0b17;
  background: radial-gradient(circle at 30% 25%, #fff3c9, #e8c27a 55%, #9a6a1a); box-shadow: 0 3px 8px rgba(0,0,0,.3); }
.lx-name { position: absolute; left: 0; right: 0; bottom: 15%; text-align: center; text-indent: .22em; font: 600 .74rem var(--sans); letter-spacing: .22em; text-transform: uppercase; }
.lx-name::before { content: ''; display: block; width: 34px; height: 1px; margin: 0 auto .6rem; background: rgba(246,221,155,.7); }
@keyframes lixiBob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
@keyframes lixiGlow { 0%, 100% { filter: drop-shadow(0 0 0 rgba(255,200,90,0)); } 50% { filter: drop-shadow(0 0 20px rgba(255,200,90,.85)); } }
.tw { position: absolute; width: 10px; height: 10px; border-radius: 50%; pointer-events: none; z-index: 3; opacity: 0;
  background: radial-gradient(circle, #fff7d6, #f0c75e 50%, transparent 72%); animation: twinkle var(--d, 2.2s) ease-in-out var(--l, 0s) infinite; }
#giftCard .hint { text-align: center; margin-top: 1.4rem; }

/* Cửa sổ mã QR */
dialog#qrDlg { border: 0; background: transparent; padding: 0; max-width: 94vw; max-height: 94vh; overflow: visible; }
dialog#qrDlg::backdrop { background: rgba(30,5,10,.72); backdrop-filter: blur(5px); }
.qr-pop { position: relative; width: min(92vw, 340px); padding: 1.6rem 1.3rem 1.4rem; border-radius: 20px; text-align: center; color: #fff3d6;
  background: linear-gradient(165deg, #d9263a, #a50f1e);
  box-shadow: inset 0 0 0 2px #f0c75e, inset 0 0 0 6px #a50f1e, inset 0 0 0 7px rgba(240,199,94,.5), 0 30px 70px rgba(0,0,0,.5); }
.qr-x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(240,199,94,.6); background: rgba(0,0,0,.18); color: #f6dd9b; font-size: 1.4rem; line-height: 1; cursor: pointer; }
.qr-eyebrow { font: 400 .72rem var(--sans); letter-spacing: .3em; text-transform: uppercase; color: #f6dd9b; margin: .3rem 0 1rem; text-indent: .3em; }
.qr-pop .qr { width: min(240px, 66vw); aspect-ratio: 1; margin: 0 auto 1rem; padding: 10px; border-radius: 16px; background: #fff; display: grid; place-items: center; box-shadow: 0 12px 30px rgba(0,0,0,.35); }
.qr-pop .qr img { width: 100%; height: 100%; object-fit: contain; display: block; }
.qr-pop .qr.empty { background: rgba(255,255,255,.12); box-shadow: none; border: 2px dashed rgba(246,221,155,.6); color: #ffe9c0; font-size: .85rem; padding: 1rem; }
.qr-pop .who { font: 600 1.25rem var(--serif); letter-spacing: .08em; margin: .2rem 0 0; color: #fff3d6; }
.qr-pop .bank { margin: .1rem 0 .6rem; color: #f6dd9b; }
.qr-hint { font-size: .82rem; color: #ffe2c0; margin: .4rem 0 .2rem; }
.qr-pop .btn { background: linear-gradient(120deg, #b5852f, #e8c27a, #fff3c9, #e8c27a); color: #5a0a12; }


/* ---------- Nếp gập phong bì: đường V có bóng đổ để nắp và thân phong bì tách bạch ---------- */
.env-seam { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4; pointer-events: none; overflow: visible; }
.env-seam polyline { fill: none; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.env-seam .sh { stroke: rgba(35, 15, 5, .38); stroke-width: 9; filter: url(#seamBlur); transform: translateY(1.6px); }
.env-seam .ln { stroke: rgba(60, 35, 15, .42); stroke-width: 1.3; }
.env-seam .hl { stroke: rgba(255, 255, 255, .75); stroke-width: 1.1; transform: translateY(-.55px); }
.env-flap .ff::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0) 60%); }
.env-back::after, .env-front::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28), inset 0 -22px 30px -18px rgba(40, 20, 10, .28); pointer-events: none; }


/* ---------- Xem ảnh toàn màn hình ---------- */
.lb { position: fixed; inset: 0; z-index: 90; opacity: 0; transition: opacity .18s; --fade: 1; }
.lb.on { opacity: 1; }
.lb::before { content: ''; position: absolute; inset: 0; background: rgba(10, 4, 8, calc(.93 * var(--fade))); backdrop-filter: blur(6px); }
.lb-stage { position: absolute; inset: 0; display: grid; place-items: center; touch-action: none; overflow: hidden; }
.lb-img { max-width: min(96vw, 1100px); max-height: 84svh; object-fit: contain; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.6); user-select: none; -webkit-user-select: none; -webkit-user-drag: none; will-change: transform; }
.lb-x, .lb-nav { position: absolute; z-index: 2; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255,255,255,.4); background: rgba(0,0,0,.55); color: #fff; cursor: pointer; backdrop-filter: blur(6px); }
.lb-x { top: max(12px, env(safe-area-inset-top)); right: 12px; }
.lb-nav { top: 50%; margin-top: -23px; }
.lb-prev { left: 10px; } .lb-next { right: 10px; }
.lb-x:hover, .lb-nav:hover { background: rgba(255,255,255,.2); }
.lb-count { position: absolute; left: 0; right: 0; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 2; text-align: center; color: #fff; font: 400 .85rem var(--sans); letter-spacing: .14em; text-shadow: 0 1px 6px rgba(0,0,0,.8); pointer-events: none; }
@media (hover: none) { .lb-nav { width: 40px; height: 40px; margin-top: -20px; opacity: .65; } }
.timeline .sp { cursor: zoom-in; }
.hint.warn { color: var(--gold-2); max-width: 520px; margin: .9rem auto 0; padding: .7rem .9rem; border-radius: 10px; border: 1px dashed var(--glass-line); }
