/* Giao diện thiệp — tự co giãn theo khung chứa (container query units) */
.cs {
  --page: #f4c; --paper: #fff; --accent: #c2185b; --ink: #333; --accent2: #ffd166;
  --tf: 'Great Vibes', cursive; --bf: 'Lora', serif;
  container-type: size; position: absolute; inset: 0; overflow: hidden;
  background: var(--page); display: grid; place-items: center; isolation: isolate;
  perspective: 1200px; -webkit-tap-highlight-color: transparent;
}

/* ---------- lớp nền: hoa văn, quầng sáng, sao ---------- */
.cs-pattern { position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: .18; }
.cs-pattern.dots { background-image: radial-gradient(rgba(255, 255, 255, .9) 1.2px, transparent 1.6px); background-size: 4.5cqmin 4.5cqmin; }
.cs-pattern.lines { background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, .5) 0 1px, transparent 1px 3cqmin); }
.cs-pattern.grid { background-image: linear-gradient(rgba(255, 255, 255, .5) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .5) 1px, transparent 1px); background-size: 6cqmin 6cqmin; }

.cs-glow { position: absolute; inset: -10%; z-index: 0; pointer-events: none; }
.cs-glow i { position: absolute; border-radius: 50%; filter: blur(8cqmin); opacity: .38; animation: cs-drift 18s ease-in-out infinite alternate; }
.cs-glow i:nth-child(1) { width: 55cqmin; height: 55cqmin; left: -5%; top: 5%; background: var(--g1, rgba(255, 255, 255, .7)); }
.cs-glow i:nth-child(2) { width: 45cqmin; height: 45cqmin; right: -5%; bottom: 0; background: var(--g2, rgba(255, 255, 255, .5)); animation-duration: 22s; animation-delay: -6s; }
.cs-glow i:nth-child(3) { width: 30cqmin; height: 30cqmin; left: 55%; top: -5%; background: var(--g3, rgba(255, 255, 255, .45)); animation-duration: 15s; animation-delay: -3s; }
@keyframes cs-drift { to { transform: translate(8cqmin, 6cqmin) scale(1.15); } }

.cs-stars { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.cs-stars b { position: absolute; width: .45cqmin; height: .45cqmin; border-radius: 50%; background: #fff; box-shadow: 0 0 1cqmin #fff; animation: cs-twinkle 3s ease-in-out infinite; }
@keyframes cs-twinkle { 0%, 100% { opacity: .15; transform: scale(.6); } 50% { opacity: 1; transform: scale(1.2); } }
.cs-fw { position: absolute; inset: 0; z-index: 4; pointer-events: none; width: 100%; height: 100%; }

/* ---------- hạt rơi ---------- */
.cs-particles { position: absolute; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.cs-p { position: absolute; top: -8%; will-change: transform; animation: cs-fall linear infinite; line-height: 1; }
.cs-p > span { display: block; animation: cs-flutter 3s ease-in-out infinite alternate; }
@keyframes cs-fall {
  0% { transform: translate3d(0, 0, 0); }
  25% { transform: translate3d(var(--dx, 20px), 30cqh, 0); }
  50% { transform: translate3d(calc(var(--dx, 20px) * -.6), 58cqh, 0); }
  75% { transform: translate3d(var(--dx, 20px), 86cqh, 0); }
  100% { transform: translate3d(0, 118cqh, 0); }
}
@keyframes cs-flutter { from { transform: rotate3d(1, .3, .2, -50deg) rotate(-20deg); } to { transform: rotate3d(.4, 1, .2, 60deg) rotate(200deg); } }
.cs-p.rise { top: auto; bottom: -15%; animation-name: cs-rise-up; }
@keyframes cs-rise-up { 0% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(var(--dx), -60cqh, 0) rotate(4deg); } 100% { transform: translate3d(0, -125cqh, 0) rotate(-4deg); } }
.cs-p.petal > span { width: 1.9cqmin; height: 2.6cqmin; background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .6), transparent 60%), var(--pc, #ff8fab); border-radius: 80% 0 80% 0; box-shadow: inset -.3cqmin -.3cqmin .6cqmin rgba(0, 0, 0, .08); }
.cs-p.confetti > span { width: 1.2cqmin; height: 2.2cqmin; background: var(--pc); border-radius: 2px; animation-duration: 1.2s; }
.cs-p.snow > span { width: 1.5cqmin; height: 1.5cqmin; border-radius: 50%; background: radial-gradient(#fff 40%, rgba(255, 255, 255, .2)); box-shadow: 0 0 1cqmin rgba(255, 255, 255, .9); animation: none; }
.cs-p.heart > span, .cs-p.sparkle > span, .cs-p.leaf > span, .cs-p.flower > span, .cs-p.star > span { font-size: 3.2cqmin; color: var(--pc); text-shadow: 0 0 1.2cqmin color-mix(in srgb, var(--pc) 60%, transparent); }
.cs-p.sparkle > span { animation: cs-sparkle 1.6s ease-in-out infinite; }
@keyframes cs-sparkle { 50% { transform: scale(.4) rotate(90deg); opacity: .4; } }
.cs-p.balloon > span { width: 5cqmin; height: 6.2cqmin; border-radius: 50% 50% 48% 52% / 55% 55% 45% 45%; background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .7), transparent 28%), var(--pc); position: relative; animation: cs-sway 3s ease-in-out infinite alternate; }
.cs-p.balloon > span::after { content: ''; position: absolute; left: 50%; top: 100%; width: 1px; height: 7cqmin; background: rgba(255, 255, 255, .6); }
@keyframes cs-sway { from { transform: rotate(-8deg); } to { transform: rotate(8deg); } }
.cs.static .cs-p, .cs.static .cs-p > span, .cs.static .cs-glow i, .cs.static .cs-stars b, .cs.static .cs-title, .cs.static .cs-orn { animation-play-state: paused; }

/* tim bung ra khi chạm */
.cs-burst { position: absolute; z-index: 6; pointer-events: none; font-size: 4cqmin; color: var(--pc, var(--accent)); animation: cs-burst 1s cubic-bezier(.2, .8, .3, 1) forwards; text-shadow: 0 0 1cqmin rgba(255, 255, 255, .8); }
@keyframes cs-burst { from { transform: translate(-50%, -50%) scale(.3); opacity: 1; } to { transform: translate(calc(-50% + var(--bx)), calc(-50% + var(--by))) scale(1.1) rotate(var(--br)); opacity: 0; } }

/* ---------- tờ thiệp ---------- */
.cs-tilt { position: relative; z-index: 2; transform-style: preserve-3d; transition: transform .25s ease-out; }
.cs-paper {
  --w: min(86cqw, 62cqh);
  position: relative; width: var(--w); max-height: 92cqh; aspect-ratio: 3 / 4.3;
  background: var(--paper); color: var(--ink); font-family: var(--bf);
  font-size: calc(var(--w) / 22); border-radius: calc(var(--w) / 22);
  box-shadow: 0 .4cqmin 1cqmin rgba(0, 0, 0, .12), 0 3cqmin 8cqmin rgba(0, 0, 0, .3);
  padding: calc(var(--w) / 10) calc(var(--w) / 11);
  display: flex; flex-direction: column; align-items: center; text-align: center;
  overflow-y: auto; overflow-x: hidden; scrollbar-width: none;
}
.cs-paper::-webkit-scrollbar { display: none; }
/* vân giấy */
.cs-paper::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; opacity: .35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .45 0 0 0 0 .4 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.cs-paper::before { content: ''; position: absolute; pointer-events: none; }
.frame-double::before { inset: calc(var(--w) / 34); border: 3px double var(--accent); border-radius: calc(var(--w) / 30); opacity: .5; }
.frame-arch { border-radius: calc(var(--w) / 2) calc(var(--w) / 2) calc(var(--w) / 22) calc(var(--w) / 22); padding-top: calc(var(--w) / 5.5); }
.frame-arch::before { inset: calc(var(--w) / 30); border: 1.5px solid var(--accent); border-radius: calc(var(--w) / 2) calc(var(--w) / 2) calc(var(--w) / 30) calc(var(--w) / 30); opacity: .45; }
.frame-soft { border-radius: calc(var(--w) / 12); }
.frame-soft::before { left: 0; right: 0; top: 0; height: calc(var(--w) / 50); background: linear-gradient(90deg, var(--accent), var(--accent2), var(--accent)); border-radius: calc(var(--w) / 12) calc(var(--w) / 12) 0 0; }

/* góc hoa văn */
.cs-corner { position: absolute; width: calc(var(--w) / 4.2); height: calc(var(--w) / 4.2); color: var(--accent); opacity: .7; pointer-events: none; z-index: 1; }
.cs-corner.tl { left: calc(var(--w) / 40); top: calc(var(--w) / 40); }
.cs-corner.tr { right: calc(var(--w) / 40); top: calc(var(--w) / 40); transform: scaleX(-1); }
.cs-corner.bl { left: calc(var(--w) / 40); bottom: calc(var(--w) / 40); transform: scaleY(-1); }
.cs-corner.br { right: calc(var(--w) / 40); bottom: calc(var(--w) / 40); transform: scale(-1, -1); }
.frame-arch .cs-corner.tl, .frame-arch .cs-corner.tr { display: none; }

.cs-inner { margin: auto 0; width: 100%; display: flex; flex-direction: column; align-items: center; gap: .55em; position: relative; z-index: 2; }
.cs-orn { font-size: 2.4em; line-height: 1; color: var(--accent); animation: cs-beat 2.4s ease-in-out infinite; filter: drop-shadow(0 .15em .25em rgba(0, 0, 0, .15)); }
@keyframes cs-beat { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.15); } 24% { transform: scale(1); } 36% { transform: scale(1.1); } }
.cs-title {
  font-family: var(--tf); font-size: 2.2em; line-height: 1.15; margin: .1em 0; overflow-wrap: anywhere; padding: 0 .1em;
  background: linear-gradient(100deg, var(--accent) 20%, color-mix(in srgb, var(--accent) 62%, #fff) 40%, var(--accent) 60%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: cs-shine 5s linear infinite;
}
.foil .cs-title, .foil .cs-w-names { background-image: linear-gradient(100deg, #8a5a14 10%, #b8862b 28%, #e9c46a 42%, #a8761c 56%, #7a4e10 80%); }
@keyframes cs-shine { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.cs-photo { width: 62%; aspect-ratio: 1; border-radius: 50%; object-fit: cover; border: .25em solid #fff; box-shadow: 0 0 0 .1em var(--accent), 0 .4em 1.2em rgba(0, 0, 0, .2); }
.cs-photo.rect { width: 82%; aspect-ratio: 4 / 3; border-radius: .6em; box-shadow: 0 .4em 1.2em rgba(0, 0, 0, .2); }
.cs-to { font-weight: 700; font-size: 1.05em; }
.cs-to em { font-family: var(--tf); font-style: normal; font-weight: 400; color: var(--accent); font-size: 1.55em; }
.cs-msg { white-space: pre-line; line-height: 1.65; font-size: .98em; overflow-wrap: anywhere; }
.cs-msg.typing::after { content: '|'; color: var(--accent); animation: cs-caret .8s steps(1) infinite; margin-left: .05em; }
@keyframes cs-caret { 50% { opacity: 0; } }
.cs-from { margin-top: .3em; font-style: italic; }
.cs-from b { font-family: var(--tf); font-style: normal; font-weight: 400; color: var(--accent); font-size: 1.6em; display: block; }
.cs-divider { width: 45%; height: 1px; background: linear-gradient(90deg, transparent, var(--accent), transparent); opacity: .6; position: relative; margin: .4em 0; }
.cs-divider::after { content: '❦'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -55%); background: var(--paper); color: var(--accent); padding: 0 .4em; font-size: .9em; border-radius: 50%; }

/* ---------- bố cục cưới ---------- */
.cs-w-names { font-family: var(--tf); color: var(--accent); font-size: 2.4em; line-height: 1.05; overflow-wrap: anywhere; background: linear-gradient(100deg, var(--accent) 20%, color-mix(in srgb, var(--accent) 62%, #fff) 40%, var(--accent) 60%); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: cs-shine 5s linear infinite; padding: 0 .1em; }
.cs-w-amp { display: block; font-size: .6em; opacity: .75; margin: .05em 0; }
.cs-w-fam { display: grid; grid-template-columns: 1fr 1fr; gap: .8em; width: 100%; font-size: .78em; line-height: 1.45; }
.cs-w-fam b { display: block; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; font-size: .9em; }
.cs-w-date { display: flex; align-items: center; justify-content: center; gap: .8em; font-weight: 700; }
.cs-w-date .d { font-size: 2.3em; color: var(--accent); line-height: 1; border-left: 1px solid; border-right: 1px solid; padding: 0 .35em; border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.cs-w-date small { display: block; font-weight: 500; font-size: .75em; text-transform: uppercase; letter-spacing: .1em; }
.cs-w-venue { font-size: .9em; }
.cs-w-venue b { display: block; font-size: 1.1em; }
.cs-w-map { display: inline-block; margin-top: .4em; padding: .4em 1.1em; border-radius: 999px; background: var(--accent); color: #fff !important; font-size: .82em; text-decoration: none; font-family: system-ui, sans-serif; box-shadow: 0 .2em .6em color-mix(in srgb, var(--accent) 45%, transparent); }
.cs-count { display: flex; gap: .5em; justify-content: center; }
.cs-count div { background: color-mix(in srgb, var(--accent) 10%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); border-radius: .5em; padding: .3em .5em; min-width: 2.9em; }
.cs-count b { display: block; font-size: 1.25em; color: var(--accent); line-height: 1.1; font-variant-numeric: tabular-nums; }
.cs-count span { font-size: .6em; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- bố cục polaroid ---------- */
.layout-polaroid .cs-inner { gap: .7em; }
.cs-pola { position: relative; background: #fff; padding: .55em .55em 1.9em; width: 78%; box-shadow: 0 .5em 1.4em rgba(0, 0, 0, .25); transform: rotate(-3.5deg); margin-top: .4em; }
.cs-pola .ph { aspect-ratio: 1; width: 100%; object-fit: cover; display: grid; place-items: center; font-size: 4em; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 25%, #fff), color-mix(in srgb, var(--accent2) 35%, #fff)); }
.cs-pola .cap { position: absolute; left: 0; right: 0; bottom: .25em; font-family: var(--tf); color: var(--accent); font-size: 1.35em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 .4em; }
.cs-tape { position: absolute; width: 38%; height: 1.4em; background: rgba(255, 255, 255, .55); border: 1px solid rgba(0, 0, 0, .05); top: -.7em; left: 31%; transform: rotate(4deg); backdrop-filter: blur(1px); box-shadow: 0 .1em .2em rgba(0, 0, 0, .08); }
.cs-sticker { position: absolute; right: -.6em; bottom: 1.2em; font-size: 2.2em; transform: rotate(14deg); filter: drop-shadow(0 .1em .2em rgba(0, 0, 0, .25)); }

/* ---------- bố cục thư tay ---------- */
.layout-letter { text-align: left; align-items: stretch; }
.layout-letter .cs-inner { align-items: stretch; margin: 0; gap: 0; }
.layout-letter.cs-paper { background-image: linear-gradient(90deg, transparent calc(var(--w) / 7.2), rgba(220, 60, 60, .35) calc(var(--w) / 7.2), rgba(220, 60, 60, .35) calc(var(--w) / 7.2 + 1.5px), transparent calc(var(--w) / 7.2 + 1.5px)), repeating-linear-gradient(transparent 0, transparent calc(1.65em - 1px), color-mix(in srgb, var(--accent) 22%, transparent) calc(1.65em - 1px), color-mix(in srgb, var(--accent) 22%, transparent) 1.65em), var(--paper); background-position: 0 0, 0 .55em, 0 0; padding-left: calc(var(--w) / 5.6); }
.cs-stamp { position: absolute; top: calc(var(--w) / 18); right: calc(var(--w) / 18); width: 3.6em; height: 4.2em; display: grid; place-items: center; font-size: 1em; background: #fff; border: .25em dotted var(--paper); outline: 1.5px solid var(--accent); outline-offset: -.5em; transform: rotate(6deg); box-shadow: 0 .1em .3em rgba(0, 0, 0, .15); z-index: 3; }
.cs-stamp span { font-size: 2em; }
.cs-postmark { position: absolute; top: calc(var(--w) / 7); right: calc(var(--w) / 4.2); width: 4.2em; height: 4.2em; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); color: color-mix(in srgb, var(--accent) 70%, transparent); font: 700 .5em/1.2 system-ui, sans-serif; display: grid; place-items: center; text-align: center; transform: rotate(-14deg); z-index: 3; text-transform: uppercase; letter-spacing: .05em; }
.layout-letter .cs-l-head { font-family: var(--tf); color: var(--accent); font-size: 1.9em; line-height: 1.6; margin-top: 2.2em; padding-right: 3em; }
.layout-letter .cs-l-to { font-size: 1.1em; line-height: 1.65; font-weight: 700; }
.layout-letter .cs-msg { font-size: 1.05em; line-height: 1.65; text-indent: 1.5em; }
.layout-letter .cs-from { text-align: right; line-height: 1.65; margin-top: .4em; }
.layout-letter .cs-photo.rect { width: 70%; margin: .6em auto; transform: rotate(-2deg); border: .3em solid #fff; }

/* ---------- watermark ---------- */
.cs-wm {
  position: absolute; z-index: 7; bottom: 2.2cqh; left: 50%; transform: translateX(-50%);
  background: rgba(0, 0, 0, .45); color: #fff; font: 600 max(10px, 2.2cqmin) / 1.2 'Be Vietnam Pro', system-ui, sans-serif;
  padding: .5em 1em; border-radius: 999px; white-space: nowrap; text-decoration: none; backdrop-filter: blur(6px);
}
.cs-wm:hover { color: #fff; background: rgba(0, 0, 0, .6); }
.cs-wm img { width: 1.4em; height: 1.4em; display: inline-block; vertical-align: -.35em; border-radius: 4px; margin-right: .4em; }

/* ---------- hiệu ứng mở thiệp ---------- */
.cs.reveal .cs-tilt { animation: cs-enter 1.1s cubic-bezier(.2, .9, .3, 1.1) both; }
.cs.reveal .cs-inner > * { animation: cs-up .8s ease both; }
.cs.reveal .cs-inner > *:nth-child(1) { animation-delay: .6s; }
.cs.reveal .cs-inner > *:nth-child(2) { animation-delay: .8s; }
.cs.reveal .cs-inner > *:nth-child(3) { animation-delay: 1s; }
.cs.reveal .cs-inner > *:nth-child(4) { animation-delay: 1.2s; }
.cs.reveal .cs-inner > *:nth-child(5) { animation-delay: 1.4s; }
.cs.reveal .cs-inner > *:nth-child(6) { animation-delay: 1.6s; }
.cs.reveal .cs-inner > *:nth-child(7) { animation-delay: 1.8s; }
.cs.reveal .cs-inner > *:nth-child(n+8) { animation-delay: 2s; }
.cs.reveal .cs-corner { animation: cs-grow 1.2s .5s ease both; }
.cs.reveal .cs-pola { animation: cs-drop 1s .7s cubic-bezier(.3, 1.4, .5, 1) both; }
.cs.reveal .cs-stamp, .cs.reveal .cs-postmark { animation: cs-stampin .5s 1.6s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes cs-enter { 0% { opacity: 0; transform: translateY(14cqh) scale(.85) rotateX(25deg); } 100% { opacity: 1; } }
@keyframes cs-up { from { opacity: 0; transform: translateY(1em); filter: blur(4px); } }
@keyframes cs-grow { from { opacity: 0; scale: .2; } }
@keyframes cs-drop { from { opacity: 0; transform: translateY(-3em) rotate(12deg) scale(1.2); } }
@keyframes cs-stampin { from { opacity: 0; transform: scale(2.4) rotate(-20deg); } }
@media (prefers-reduced-motion: reduce) { .cs-p, .cs-fw { display: none; } .cs *, .cs { animation: none !important; } }

/* ---------- cảnh động: trái tim hạt, thiên hà ---------- */
.cs.scene { background: var(--page); }
.sc-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; display: block; }
.sc-text { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.sc-name { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); font-family: var(--tf); color: #fff; font-size: clamp(16px, 8.5cqmin, 64px); max-width: 80cqw; text-align: center; line-height: 1.15; overflow-wrap: anywhere; text-shadow: 0 0 1.5cqmin var(--accent), 0 0 4cqmin var(--accent), 0 0 8cqmin var(--accent2); }
.sc-text.galaxy .sc-name { top: 42%; font-size: clamp(16px, 7.5cqmin, 56px); }
.sc-bottom { position: absolute; left: 50%; bottom: 7cqh; transform: translateX(-50%); width: min(88cqw, 560px); z-index: 3; text-align: center; color: #fff; font-family: var(--bf); font-size: clamp(11px, 3.4cqmin, 20px); line-height: 1.6; text-shadow: 0 1px 8px rgba(0, 0, 0, .8); max-height: 30cqh; overflow-y: auto; scrollbar-width: none; }
.sc-title { font-family: var(--tf); font-size: 1.7em; color: var(--accent2); line-height: 1.2; text-shadow: 0 0 1.5cqmin var(--accent); }
.sc-msg { white-space: pre-line; overflow-wrap: anywhere; }
.sc-msg.typing::after { content: '|'; animation: cs-caret .8s steps(1) infinite; }
.sc-from { margin-top: .3em; opacity: .9; font-style: italic; }
.sc-from b { font-family: var(--tf); font-style: normal; font-weight: 400; font-size: 1.5em; color: var(--accent2); }
.sc-orbit { position: absolute; left: 0; top: 0; width: 14cqmin; height: 14cqmin; border-radius: 50%; object-fit: cover; border: .5cqmin solid rgba(255, 255, 255, .85); box-shadow: 0 0 3cqmin var(--accent); will-change: transform; z-index: 2; pointer-events: none; }
.sc-orbit.emoji { border: 0; box-shadow: none; display: grid; place-items: center; font-size: 7cqmin; width: auto; height: auto; }
.sc-word { position: absolute; left: 50%; top: 42%; z-index: 3; pointer-events: none; color: #fff; font-family: var(--tf); font-size: clamp(14px, 5.5cqmin, 36px); white-space: nowrap; text-shadow: 0 0 1.5cqmin var(--accent2), 0 0 3cqmin var(--accent); animation: sc-fly 6s ease-out forwards; }
@keyframes sc-fly { 0% { transform: translate(-50%, -50%) scale(.2); opacity: 0; } 15% { opacity: 1; } 80% { opacity: .9; } 100% { transform: translate(calc(-50% + var(--wx)), calc(-50% + var(--wy))) scale(1.15); opacity: 0; } }
.cs.static .sc-word { display: none; }

/* hình minh họa SVG */
.cs-decor { width: 58%; max-width: 13em; line-height: 0; filter: drop-shadow(0 .15em .25em rgba(0, 0, 0, .12)); }
.cs-decor svg { width: 100%; height: auto; display: block; overflow: visible; }
.cs-decor.wreath { width: 30%; } .cs-decor.balloons, .cs-decor.cake { width: 30%; } .cs-decor.cap { width: 36%; }
.cs-decor.rings { width: 40%; } .cs-decor.lantern { width: 50%; } .cs-decor.snow { width: 44%; } .cs-decor.hearts { width: 62%; }
.cs-decor.balloons, .cs-decor.lantern { animation: cs-sway 3.5s ease-in-out infinite alternate; transform-origin: top center; }
.cs.static .cs-decor { animation-play-state: paused; }

/* ---------- trình chiếu ảnh ---------- */
.ss { position: relative; overflow: hidden; isolation: isolate; perspective: 900px; background: #111; cursor: pointer; }
.ss-slide { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; }
.ss-img { position: absolute; inset: -2%; background-size: cover; background-position: center; animation: kb1 6s ease-in-out forwards; }
.ss-static .ss-img { animation: none; }
@keyframes kb1 { from { transform: scale(1.02) translate(0, 0); } to { transform: scale(1.14) translate(-2%, -1%); } }
@keyframes kb2 { from { transform: scale(1.14) translate(2%, 1%); } to { transform: scale(1.02) translate(0, 0); } }
@keyframes kb3 { from { transform: scale(1.04) translate(-2%, 1%); } to { transform: scale(1.15) translate(2%, -2%); } }
@keyframes kb4 { from { transform: scale(1.15) translate(0, -2%); } to { transform: scale(1.03) translate(0, 1%); } }
.ss-slide.in { z-index: 2; animation: 1.25s cubic-bezier(.65, 0, .35, 1) both; }
.ss-slide.out { z-index: 1; }
.ss-slide.in.fx-fade { animation-name: ss-fade; }
.ss-slide.in.fx-zoom { animation-name: ss-zoom; }
.ss-slide.in.fx-slide { animation-name: ss-slide; }
.ss-slide.in.fx-slide.rev { animation-name: ss-slide-r; }
.ss-slide.in.fx-flip { animation-name: ss-flip; transform-origin: left center; }
.ss-slide.in.fx-circle { animation-name: ss-circle; }
.ss-slide.in.fx-diamond { animation-name: ss-diamond; }
.ss-slide.in.fx-wipe { animation-name: ss-wipe; }
.ss-slide.in.fx-blur { animation-name: ss-blur; }
.ss-slide.out { animation: ss-out 1.25s ease both; }
@keyframes ss-fade { from { opacity: 0; } }
@keyframes ss-zoom { from { opacity: 0; transform: scale(1.35); } }
@keyframes ss-slide { from { transform: translateX(100%); } }
@keyframes ss-slide-r { from { transform: translateX(-100%); } }
@keyframes ss-flip { from { transform: rotateY(-95deg); opacity: .3; } }
@keyframes ss-circle { from { clip-path: circle(0% at 50% 50%); } to { clip-path: circle(75% at 50% 50%); } }
@keyframes ss-diamond { from { clip-path: polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%); } to { clip-path: polygon(50% -60%, 160% 50%, 50% 160%, -60% 50%); } }
@keyframes ss-wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes ss-blur { from { filter: blur(24px) brightness(1.6); opacity: 0; transform: scale(1.1); } }
@keyframes ss-out { to { filter: brightness(.7); transform: scale(1.04); } }
.ss-dots { position: absolute; left: 0; right: 0; bottom: 10px; z-index: 5; display: flex; justify-content: center; gap: 6px; }
.ss-dots button { width: 8px; height: 8px; border-radius: 99px; border: 0; padding: 0; background: rgba(255, 255, 255, .55); cursor: pointer; transition: width .3s, background .3s; }
.ss-dots button.on { width: 22px; background: #fff; }
.ss-count { position: absolute; top: 10px; right: 10px; z-index: 5; background: rgba(0, 0, 0, .45); color: #fff; font: 600 12px system-ui, sans-serif; padding: 3px 9px; border-radius: 99px; }
/* khung ảnh trên thiệp */
.cs-photo.ss { display: block; }
.cs-pola .ph.ss { display: block; }
.sc-text.text .sc-name, .sc-text.bloom .sc-name { top: 14%; }
.sc-text.bloom .sc-name { color: var(--accent); text-shadow: 0 2px 10px rgba(255, 255, 255, .8); }
.cs.scene.light .sc-bottom { color: var(--ink); text-shadow: 0 1px 6px rgba(255, 255, 255, .9); }
.cs.scene.light .sc-bottom .sc-title, .cs.scene.light .sc-from b { color: var(--accent); text-shadow: none; }
.cs-decor.moon { width: 52%; } .cs-decor.baby { width: 46%; } .cs-decor.peach { width: 52%; } .cs-decor.house { width: 40%; } .cs-decor.ribbon { width: 60%; }
.sc-text.rain::before { content: ''; position: absolute; left: 50%; top: 40%; width: 80cqw; height: 26cqh; transform: translate(-50%, -50%); background: radial-gradient(closest-side, rgba(0, 0, 0, .7), transparent); }
.sc-text.rain .sc-name { z-index: 1; }

/* ---------- tim ghép ảnh ---------- */
.ph-heart { position: absolute; left: 50%; top: 5cqh; width: min(88cqw, 60cqh); aspect-ratio: 1.07; transform: translateX(-50%); z-index: 2; animation: hb-grid 1.4s ease-in-out infinite; }
.cs.static .ph-heart { animation: none; }
@keyframes hb-grid { 0%, 100% { transform: translateX(-50%) scale(1); } 14% { transform: translateX(-50%) scale(1.04); } 28% { transform: translateX(-50%) scale(1); } 42% { transform: translateX(-50%) scale(1.03); } }
.ph-tile { position: absolute; padding: .35cqmin; perspective: 400px; }
.ph-in { width: 100%; height: 100%; border-radius: .8cqmin; background-size: cover; background-position: center; box-shadow: 0 .4cqmin 1.2cqmin rgba(0, 0, 0, .35); display: grid; place-items: center; font-size: 3cqmin; transition: transform .6s; }
.ph-tile.fly { animation: ph-fly 1.4s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes ph-fly { from { transform: translate(var(--fx), var(--fy)) rotate(var(--fr)) scale(.3); opacity: 0; } }
.ph-tile.flip .ph-in { animation: ph-flip .6s ease; }
@keyframes ph-flip { 50% { transform: rotateY(90deg) scale(.9); } }
.ph-heart.boom .ph-tile { animation: ph-boom 1.2s ease; }
@keyframes ph-boom { 30% { transform: scale(1.35) rotate(8deg); filter: brightness(1.4); } }
.sc-text.photoheart .sc-name { top: auto; bottom: 26cqh; transform: translate(-50%, 0) !important; font-size: clamp(16px, 7cqmin, 52px); }
.sc-text.photoheart ~ .sc-bottom { bottom: 5cqh; max-height: 18cqh; }

/* ---------- vòng ảnh 3D ---------- */
.car-wrap { position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%); width: 30cqmin; height: 40cqmin; perspective: 110cqmin; z-index: 2; cursor: grab; --car-r: 44cqmin; }
.car-ring { position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateX(-8deg); }
.car-ring.spin { animation: car-spin 24s linear infinite; }
.cs.static .car-ring.spin { animation: none; transform: rotateX(-8deg) rotateY(-20deg); }
@keyframes car-spin { from { transform: rotateX(-8deg) rotateY(0); } to { transform: rotateX(-8deg) rotateY(-360deg); } }
.car-panel { position: absolute; inset: 0; transform-style: preserve-3d; }
.car-face { position: absolute; inset: 0; border-radius: 2cqmin; background-size: cover; background-position: center; border: .6cqmin solid rgba(255, 255, 255, .9); box-shadow: 0 0 4cqmin color-mix(in srgb, var(--accent) 50%, transparent); display: grid; place-items: center; font-size: 8cqmin; -webkit-box-reflect: below 1.5cqmin linear-gradient(transparent 65%, rgba(255, 255, 255, .28)); }
.car-floor { position: absolute; left: 50%; top: 118%; width: 120cqmin; height: 22cqmin; transform: translateX(-50%); background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 35%, transparent), transparent); filter: blur(2cqmin); }
.sc-text.carousel .sc-name { top: 9%; }

/* ---------- sách lật trang ---------- */
.bk { position: absolute; left: 50%; top: 39%; transform: translate(-50%, -50%); width: min(88cqw, 88cqh); aspect-ratio: 1.45; perspective: 220cqmin; z-index: 2; cursor: pointer; }
.bk-left { position: absolute; left: 0; top: 0; width: 50%; height: 100%; background: linear-gradient(90deg, #efe6d6, #fbf6ec 85%, #e3d6bf); border-radius: 1.4cqmin 0 0 1.4cqmin; box-shadow: 0 2cqmin 5cqmin rgba(0, 0, 0, .4); opacity: .95; }
.bk-book { position: absolute; inset: 0; transition: transform .8s; }
.bk-book.closed { transform: translateX(-25%); }
.bk-book.closed ~ .bk-left, .bk:has(.bk-book.closed) .bk-left { opacity: 0; }
.bk-sheet { position: absolute; left: 50%; top: 0; width: 50%; height: 100%; transform-origin: left center; transform-style: preserve-3d; transition: transform 1.2s cubic-bezier(.45, .05, .25, 1); }
.bk-sheet.flipped { transform: rotateY(-180deg); }
.bk-page { position: absolute; inset: 0; backface-visibility: hidden; background: linear-gradient(90deg, #e8dcc6, #fffaf1 12%, #fffaf1); border-radius: 0 1.4cqmin 1.4cqmin 0; box-shadow: 0 2cqmin 5cqmin rgba(0, 0, 0, .35); padding: 7% 8%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6em; text-align: center; color: #3b2a1e; font-family: var(--bf); font-size: clamp(9px, 2.6cqmin, 18px); overflow: hidden; }
.bk-page.back { transform: rotateY(180deg); background: linear-gradient(270deg, #e8dcc6, #fffaf1 12%, #fffaf1); border-radius: 1.4cqmin 0 0 1.4cqmin; }
.bk-page.cover { background: radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--accent) 75%, #fff), var(--accent)); color: #fff; }
.bk-page.cover::after { content: ''; position: absolute; inset: 5%; border: 2px solid rgba(255, 255, 255, .55); border-radius: 1cqmin; }
.bk-orn { font-size: 2.6em; }
.bk-t { font-family: var(--tf); font-size: 2em; line-height: 1.1; }
.bk-n { font-family: var(--tf); font-size: 2.2em; line-height: 1.1; color: inherit; }
.bk-page:not(.cover) .bk-n { color: var(--accent); }
.bk-x { font-family: var(--tf); font-size: 1.6em; line-height: 1.35; white-space: pre-line; }
.bk-photo { width: 100%; flex: 1; border-radius: 1cqmin; background-size: cover; background-position: center; box-shadow: 0 .6cqmin 2cqmin rgba(0, 0, 0, .2); border: .6cqmin solid #fff; display: grid; place-items: center; font-size: 3em; }
.bk-num { position: absolute; bottom: 3%; font-size: .7em; opacity: .5; }
.cs.scene .sc-text.book ~ .sc-bottom { bottom: 5cqh; }

/* ---------- đèn trời ---------- */
.sc-text.lantern .sc-name { top: 30%; color: #fff4dc; text-shadow: 0 0 1.5cqmin #ff9a3c, 0 0 5cqmin #ff7b00; }

/* hạt mới */
.cs-p.bubble > span { width: 4.2cqmin; height: 4.2cqmin; border-radius: 50%; background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .95) 0 8%, rgba(255, 255, 255, .15) 18%, rgba(173, 216, 255, .18) 55%, rgba(255, 182, 230, .35) 72%, rgba(255, 255, 255, .55) 76%, transparent 78%); animation: cs-sway 3s ease-in-out infinite alternate; }
.cs-p.butterfly > span { font-size: 3.6cqmin; animation: cs-wing .35s ease-in-out infinite alternate; }
@keyframes cs-wing { from { transform: rotateY(0) rotate(-8deg); } to { transform: rotateY(65deg) rotate(8deg); } }
.cs-p.lantern > span { font-size: 4cqmin; filter: drop-shadow(0 0 1.5cqmin #ff9a3c); animation: cs-sway 3s ease-in-out infinite alternate; }
.cs-p.bokeh > span { width: 9cqmin; height: 9cqmin; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--pc) 70%, #fff) 0, color-mix(in srgb, var(--pc) 40%, transparent) 55%, transparent 70%); filter: blur(.4cqmin); opacity: .65; animation: none; }
.sc-text.book ~ .sc-bottom .sc-title { display: none; }
.sc-text.book ~ .sc-bottom { max-height: 20cqh; }

/* vuốt ngang trên màn hình cảm ứng (cho phép cuộn dọc trang) */
.ss { touch-action: pan-y; user-select: none; }
