.stage[data-demo="roll"], .stage[data-demo="slide"], .stage[data-demo="parallax"], .stage[data-demo="scroll"] {
  --demo-bg: #e7eff9;
  --demo-ink: #194670;
}
.stage[data-demo="fade"], .stage[data-demo="zoom"] { --demo-bg: #f8eddf; --demo-ink: #623815; }
.stage[data-demo="float"], .stage[data-demo="pulse"], .stage[data-demo="stagger"] {
  --demo-bg: #e6f1ec;
  --demo-ink: #285543;
}

.type-word, .fade-word, .mask-word {
  font-size: clamp(1.12rem, 1.85vw, 1.47rem);
  font-weight: 760;
  letter-spacing: -.055em;
  line-height: 1.22;
  white-space: nowrap;
}
.type-word {
  display: block;
  width: 5.05em;
  overflow: hidden;
  text-align: left;
  border-right: .085em solid #7247e7;
  animation: typing 4.4s steps(6, end) infinite;
}
@keyframes typing {
  0%, 8% { width: 0; border-color: #7247e7; }
  35%, 73% { width: 5.05em; border-color: #7247e7; }
  77% { width: 5.05em; border-color: transparent; }
  83% { width: 5.05em; border-color: #7247e7; }
  96%, 100% { width: 0; border-color: #7247e7; }
}

.roll-line { display: block; height: 1.55em; overflow: hidden; font-size: 1.55rem; line-height: 1.55; }
.roll-stack { display: block; animation: roll 4.8s cubic-bezier(.6, .12, .2, 1) infinite; }
.roll-stack b { display: block; color: #225683; font-weight: 790; letter-spacing: -.06em; }
.roll-stack b:nth-child(2) { color: #267366; }
.roll-stack b:nth-child(3) { color: #6746ac; }
@keyframes roll {
  0%, 17% { transform: translateY(0); }
  24%, 47% { transform: translateY(-25%); }
  54%, 77% { transform: translateY(-50%); }
  84%, 100% { transform: translateY(-75%); }
}

.fade-word { animation: fade 4.2s ease-in-out infinite; }
@keyframes fade {
  0%, 16% { opacity: .12; }
  40%, 64% { opacity: 1; }
  87%, 100% { opacity: .12; }
}

.scene { position: absolute; inset: 0; overflow: hidden; }
.scene-day { background: linear-gradient(155deg, #cfdfff, #f4eaf8 75%); --sky-disc: #fff6db; --ground: #bca8ed; --building: #9479c9; color: #332453; }
.scene-night { background: linear-gradient(145deg, #241c46, #5e4b99); --sky-disc: #f9d9aa; --ground: #392e6f; --building: #afa0df; color: #fff; animation: crossfade 5.2s ease-in-out infinite; }
.scene::before { content: ""; position: absolute; top: 15%; left: 23%; width: 30px; aspect-ratio: 1; border-radius: 50%; background: var(--sky-disc); }
.scene::after { content: ""; position: absolute; inset: auto -1% -1px; height: 55%; background: var(--ground); clip-path: polygon(0 43%, 22% 21%, 46% 42%, 66% 12%, 83% 25%, 100% 15%, 100% 100%, 0 100%); }
.scene i { position: absolute; bottom: 27%; left: 60%; width: 13px; height: 29px; border-radius: 2px 2px 0 0; background: var(--building); box-shadow: 16px -9px var(--building), 31px -1px var(--building); }
.scene b { position: absolute; z-index: 1; left: 12px; bottom: 10px; font-size: .9rem; }
@keyframes crossfade {
  0%, 29%, 100% { opacity: 0; }
  47%, 77% { opacity: 1; }
  94% { opacity: 0; }
}

.mini-panel { width: 58%; border-radius: 9px; display: grid; align-content: center; gap: 6px; padding: 11px 13px; background: #fff; box-shadow: 0 7px 16px #3320541d; text-align: left; }
.mini-panel b { font-weight: 740; font-size: .82rem; }
.mini-panel i { border-radius: 999px; height: 4px; background: #d9ccf6; }
.mini-panel i:last-child { width: 62%; }
.rise-panel { animation: rise 4.5s cubic-bezier(.2, .7, .2, 1) infinite; }
@keyframes rise {
  0%, 13%, 100% { transform: translateY(68px); opacity: 0; }
  39%, 73% { transform: translateY(0); opacity: 1; }
  87% { transform: translateY(0); opacity: 0; }
}

.slide-window { display: block; width: 53%; overflow: hidden; border-radius: 8px; box-shadow: 0 5px 14px #1a486b27; }
.slide-track { display: flex; width: 300%; animation: slide 4.9s cubic-bezier(.68, .03, .26, .98) infinite; }
.slide-track b { flex: 1; padding-block: 14px; color: #16456d; background: #fff; font-size: 1.18rem; font-weight: 760; }
.slide-track b:nth-child(2) { background: #266e9b; color: white; }
@keyframes slide {
  0%, 25% { transform: translateX(0); }
  44%, 69% { transform: translateX(-33.3333%); }
  88%, 100% { transform: translateX(-66.6666%); }
}

.zoom-frame { position: relative; overflow: hidden; width: 68px; aspect-ratio: 1.2; border: 2px solid #fff; border-radius: 11px; background: #edbe96; box-shadow: 0 5px 12px #75401b26; animation: zoom 4.3s cubic-bezier(.26, .72, .26, 1) infinite; }
.zoom-frame i { position: absolute; width: 11px; aspect-ratio: 1; border-radius: 50%; background: #fff0c7; top: 17%; right: 17%; }
.zoom-frame i:nth-child(2), .zoom-frame i:nth-child(3) { inset: auto auto -19% -6%; width: 63%; height: 80%; border-radius: 0; transform: rotate(43deg); background: #b66952; }
.zoom-frame i:nth-child(3) { left: 46%; background: #cf8c6f; }
@keyframes zoom {
  0%, 13%, 100% { transform: scale(.53); opacity: .6; }
  44%, 73% { transform: scale(1.22); opacity: 1; }
}

.mask-word { padding: .18em .38em; background: #fbf9ff; border-bottom: 2px solid #a58ae9; animation: reveal 4.5s cubic-bezier(.5, .1, .28, .98) infinite; }
@keyframes reveal {
  0%, 15%, 100% { clip-path: inset(0 100% 0 0); }
  41%, 70% { clip-path: inset(0); }
  89% { clip-path: inset(0 0 0 100%); }
  90% { clip-path: inset(0 100% 0 0); }
}

.stagger-list { display: grid; gap: 6px; width: min(67%, 106px); }
.stagger-list i { height: 12px; border-radius: 5px; background: #5a967e; box-shadow: 0 3px 5px #1d503921; animation: stagger 4s ease-out infinite; }
.stagger-list i:nth-child(2) { width: 85%; background: #79ab98; animation-delay: .16s; }
.stagger-list i:nth-child(3) { width: 68%; background: #a4c6b9; animation-delay: .32s; }
@keyframes stagger {
  0%, 12%, 100% { transform: translateX(-22px); opacity: .16; }
  33%, 73% { transform: translateX(0); opacity: 1; }
  88% { transform: translateX(5px); opacity: 0; }
}

.parallax-back, .parallax-mid, .parallax-front { position: absolute; width: 145%; bottom: 0; animation: parallax 4.8s ease-in-out infinite; }
.parallax-back { height: 82%; --distance: 7%; background: #b8d4ed; clip-path: polygon(0 57%, 21% 17%, 44% 68%, 63% 27%, 85% 64%, 100% 44%, 100% 100%, 0 100%); }
.parallax-mid { height: 61%; --distance: 12%; background: #729fc6; clip-path: polygon(0 46%, 25% 75%, 54% 17%, 72% 46%, 100% 25%, 100% 100%, 0 100%); }
.parallax-front { height: 36%; --distance: 17%; background: #3a6993; clip-path: polygon(0 56%, 28% 22%, 56% 64%, 76% 11%, 100% 50%, 100% 100%, 0 100%); }
@keyframes parallax {
  0%, 100% { transform: translateX(calc(-1 * var(--distance))); }
  50% { transform: translateX(var(--distance)); }
}

.float-pill, .pulse-pill { position: relative; z-index: 1; padding: 8px 13px; border-radius: 99px; font-size: .87rem; font-weight: 740; color: white; background: #347762; }
.float-pill { box-shadow: 0 5px 10px #25553c26; animation: float 3.1s ease-in-out infinite; }
.float-shadow { position: absolute; bottom: 23%; width: 50px; height: 8px; border-radius: 50%; background: #50806f42; filter: blur(3px); animation: shadow 3.1s ease-in-out infinite; }
@keyframes float {
  0%, 100% { transform: translateY(4px); }
  50% { transform: translateY(-13px); }
}
@keyframes shadow {
  0%, 100% { transform: scaleX(.9); opacity: .9; }
  50% { transform: scaleX(1.22); opacity: .3; }
}
.pulse-ring { position: absolute; width: 75px; height: 33px; border: 2px solid #347762; border-radius: 999px; animation: pulse 2.6s ease-out infinite; }
@keyframes pulse {
  0%, 10% { transform: scale(1); opacity: .7; }
  72%, 100% { transform: scale(1.62, 1.82); opacity: 0; }
}

.flip-shell { display: block; width: 68px; aspect-ratio: 1.35; perspective: 320px; }
.flip-tile { display: block; position: relative; width: 100%; height: 100%; transform-style: preserve-3d; animation: flip 4.7s cubic-bezier(.63, .07, .29, .94) infinite; }
.flip-tile b { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 9px; background: white; color: #51327f; font-size: .93rem; backface-visibility: hidden; box-shadow: 0 7px 13px #33205423; }
.flip-tile b:last-child { background: #6642a4; color: white; transform: rotateY(180deg); }
@keyframes flip {
  0%, 22%, 100% { transform: rotateY(0deg); }
  41%, 71% { transform: rotateY(180deg); }
  90% { transform: rotateY(0deg); }
}

.mock-browser { width: 68%; height: 76%; display: grid; grid-template-rows: 13px 1fr; overflow: hidden; border-radius: 8px; background: #fafcff; box-shadow: 0 5px 15px #143a6426; }
.mock-browser > i { display: block; background: #b8cce2; }
.mock-browser > i::before { content: ""; display: block; width: 3px; height: 3px; margin: 5px 8px; border-radius: 50%; background: white; box-shadow: 6px 0 white, 12px 0 white; }
.scroll-viewport { display: block; overflow: hidden; }
.scroll-track { display: grid; gap: 7px; padding: 8px; animation: demo-scroll 5.1s ease-in-out infinite; }
.scroll-track u { display: block; height: 48px; border-radius: 6px; background: linear-gradient(145deg, #80a8db, #b9d2f0); }
.scroll-track b { display: grid; place-items: center; min-height: 37px; border-radius: 6px; background: #ddebf6; text-decoration: none; font-size: .72rem; animation: scroll-item 5.1s ease-in-out infinite; }
@keyframes demo-scroll {
  0%, 19%, 100% { transform: translateY(0); }
  44%, 78% { transform: translateY(-44px); }
}
@keyframes scroll-item {
  0%, 24%, 100% { opacity: 0; transform: translateY(13px); }
  49%, 78% { opacity: 1; transform: translateY(0); }
}

.gradient-field { position: absolute; inset: 0; background: linear-gradient(120deg, #d5c5fb, #705abe, #efb9c6, #c8d7fc); background-size: 260% 260%; animation: gradient 6s ease-in-out infinite; }
@keyframes gradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.stage[data-running="false"] .animate { animation-play-state: paused; }
.stage[data-once] .animate { animation-iteration-count: 1; animation-fill-mode: both; }
@media (prefers-reduced-motion: reduce) {
  .stage[data-running="false"] .animate { animation-name: none; }
}
