/* Card rendering + motion. Shared by the editor, the in-Messages viewer and the web fallback. */
.page { position: relative; overflow: hidden; flex: none; -webkit-user-select: none; user-select: none; }
.page .el { position: absolute; transform-origin: center center; }
.el-in, .el-loop, .el-c { width: 100%; height: 100%; }
.el-c { position: relative; box-sizing: border-box; }
.el-text .el-c { white-space: pre-wrap; overflow-wrap: break-word; word-break: break-word; outline: none; -webkit-user-select: text; user-select: text; }
.el-art svg { width: 100%; height: 100%; display: block; overflow: visible; }
.el-image .el-c { display: flex; }
.img-box { flex: 1; overflow: hidden; position: relative; min-height: 0; }
.img-box img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.el-signature img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }

.ph { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font: 600 13px/1 -apple-system, system-ui, sans-serif; letter-spacing: .02em; }
.ph-photo { color: #9a7b62; background: repeating-linear-gradient(135deg, #f1e4d3 0 12px, #ecdcc8 12px 24px); }
.ph-sign { color: rgba(120, 80, 50, .65); border: 1.5px dashed rgba(120, 80, 50, .35); border-radius: 10px; }

/* ---------- entrance (only while .playing) ---------- */
.playing .in-fade { animation: in-fade .9s ease var(--d, 0s) both; }
.playing .in-rise { animation: in-rise 1s cubic-bezier(.2, .7, .2, 1) var(--d, 0s) both; }
.playing .in-pop { animation: in-pop .75s cubic-bezier(.3, 1.6, .5, 1) var(--d, 0s) both; }
.playing .in-drop { animation: in-drop 1.05s cubic-bezier(.3, 1.35, .5, 1) var(--d, 0s) both; }
.playing .in-zoom { animation: in-zoom 1.2s cubic-bezier(.2, .7, .2, 1) var(--d, 0s) both; }
.playing .in-write { animation: in-write 1.8s ease-in-out var(--d, 0s) both; }
.playing .in-spin { animation: in-spin 1s cubic-bezier(.3, 1.3, .5, 1) var(--d, 0s) both; }
@keyframes in-fade { from { opacity: 0; } }
@keyframes in-rise { from { opacity: 0; transform: translateY(26px); } }
@keyframes in-pop { from { opacity: 0; transform: scale(.3); } }
@keyframes in-drop { from { opacity: 0; transform: translateY(-90px) rotate(-10deg); } }
@keyframes in-zoom { from { opacity: 0; transform: scale(1.3); filter: blur(8px); } }
@keyframes in-write { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes in-spin { from { opacity: 0; transform: rotate(-200deg) scale(.3); } }

/* ---------- loops (only while .playing) ---------- */
.playing .loop-float { animation: lp-float 4.2s ease-in-out var(--ld, 0s) infinite; }
.playing .loop-sway { animation: lp-sway 3.6s ease-in-out var(--ld, 0s) infinite; }
.playing .loop-pulse { animation: lp-pulse 2.2s ease-in-out var(--ld, 0s) infinite; }
.playing .loop-wobble { animation: lp-wobble 1.5s ease-in-out var(--ld, 0s) infinite; }
.playing .loop-bounce { animation: lp-bounce 1.6s cubic-bezier(.5, 0, .5, 1) var(--ld, 0s) infinite; }
.playing .loop-spin { animation: lp-spin 14s linear infinite; }
.playing .loop-shimmer { animation: lp-shimmer 3.2s ease-in-out var(--ld, 0s) infinite; }
@keyframes lp-float { 50% { transform: translateY(-9px); } }
@keyframes lp-sway { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
@keyframes lp-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes lp-wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-4deg) translateY(-3px); } 75% { transform: rotate(4deg) translateY(-3px); } }
@keyframes lp-bounce { 0%, 100% { transform: translateY(0) scale(1, 1); } 45% { transform: translateY(-14px) scale(.98, 1.03); } 90% { transform: translateY(0) scale(1.04, .96); } }
@keyframes lp-spin { to { transform: rotate(360deg); } }
@keyframes lp-shimmer { 0%, 100% { filter: brightness(1) drop-shadow(0 0 0 rgba(255, 220, 140, 0)); } 50% { filter: brightness(1.15) drop-shadow(0 0 12px rgba(255, 220, 140, .55)); } }

/* ---------- ambient particles ---------- */
.ambient { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.amb-p { position: absolute; top: -8%; }
.amb-p > i { display: block; width: 100%; height: 100%; background-size: contain; background-repeat: no-repeat; background-position: center; }
.amb-p, .amb-p > i { animation-play-state: paused !important; }
.amb-on .amb-p, .amb-on .amb-p > i { animation-play-state: running !important; }
.amb-leaves .amb-p { animation: amb-fall var(--dur) linear var(--del) infinite; }
.amb-leaves .amb-p > i { animation: amb-flutter var(--fl) ease-in-out infinite alternate; }
.amb-confetti .amb-p { animation: amb-fall var(--dur) linear var(--del) infinite; }
.amb-confetti .amb-p > i { animation: amb-tumble var(--fl) linear infinite; }
.amb-sparkle .amb-p { animation: amb-twinkle var(--dur) ease-in-out var(--del) infinite; }
.amb-embers .amb-p { top: auto; bottom: -4%; animation: amb-rise var(--dur) ease-in var(--del) infinite; }
.amb-embers .amb-p > i { border-radius: 50%; background: radial-gradient(circle, #ffd58a, #f08a3c 55%, transparent 70%); box-shadow: 0 0 8px #f5a04a; }
@keyframes amb-fall { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(var(--dx), 640px, 0); } }
@keyframes amb-flutter { from { transform: rotate(-45deg) translateX(-14px); } to { transform: rotate(55deg) translateX(14px); } }
@keyframes amb-tumble { to { transform: rotate3d(1, .6, .2, 720deg); } }
@keyframes amb-twinkle { 0%, 100% { opacity: 0; transform: scale(.2); } 50% { opacity: 1; transform: scale(1) rotate(45deg); } }
@keyframes amb-rise { 0% { opacity: 0; transform: translate3d(0, 0, 0); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate3d(var(--dx), -600px, 0); } }

@media (prefers-reduced-motion: reduce) {
  .playing *, .amb-on .amb-p, .amb-on .amb-p > i { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* video */
.vid-box video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; background: #111; }
.vid-badge { position: absolute; right: 8px; top: 8px; width: 26px; height: 26px; border-radius: 50%; background: rgba(0,0,0,.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5l11 7-11 7z' fill='white'/%3E%3C/svg%3E") center/14px no-repeat; }
.vid-sound { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); padding: 6px 12px; border-radius: 99px; border: 0; background: rgba(0,0,0,.6); color: #fff;
  font: 600 12px/1 -apple-system, system-ui, sans-serif; white-space: nowrap; cursor: pointer; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
