/* ── Hover preview popover ───────────────── */
.kw tr.has-demo { cursor: help; }
.kw tr.has-demo:focus-visible { outline: none; }
.kw tr.has-demo td.name::after {
  content: ""; display: inline-block; margin-left: 8px; vertical-align: 1px;
  border-left: 6px solid var(--muted); border-top: 4px solid transparent; border-bottom: 4px solid transparent;
}
.kw tr.has-demo:hover td, .kw tr.has-demo.demo-on td { background: #121216; }
.kw tr.has-demo:hover td.name::after, .kw tr.has-demo.demo-on td.name::after { border-left-color: var(--key); }

.demo-pop {
  position: fixed; z-index: 50; width: 280px; pointer-events: none;
  background: #0e0e11; border: 1px solid var(--line-2); box-shadow: 0 16px 40px rgba(0, 0, 0, .6);
  opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s;
}
.demo-pop.show { opacity: 1; transform: none; }
.demo-pop header { display: flex; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--line); font: 11px var(--mono); color: var(--text-2); }
.demo-pop header span:last-child { color: var(--key); }
.demo-stage { position: relative; height: 160px; overflow: hidden; display: grid; place-items: center; font-family: var(--sans); color: var(--text); }

/* ── Shared demo parts ───────────────────── */
.d-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.d-col { flex-direction: column; gap: 6px; }
.d-big { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.d-mono { font-family: var(--mono); font-weight: 500; letter-spacing: .08em; }
.d-cap { font-size: 11px; color: var(--muted); }
.d-screen { position: relative; width: 200px; height: 120px; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: #131317; }
.d-line { height: 6px; border-radius: 3px; background: #2a2a31; margin: 7px 12px; }
.d-line.w0 { width: 70%; } .d-line.w1 { width: 48%; } .d-line.w2 { width: 82%; }
.d-gap { height: 10px; }
.d-card { height: 30px; margin: 8px 12px; border-radius: 6px; background: #1d1d23; border: 1px solid #2a2a31; }
.d-row { display: flex; align-items: center; gap: 8px; padding: 6px 12px; }
.d-row i { width: 18px; height: 18px; border-radius: 4px; background: #2a2a31; flex: none; }
.d-row span { height: 6px; border-radius: 3px; background: #2a2a31; flex: 1; }
.d-btn { font: 600 13px var(--sans); padding: 10px 18px; border-radius: 8px; border: 0; background: var(--key); color: #111; position: relative; overflow: hidden; }
.d-cursor { position: absolute; width: 14px; height: 14px; left: 50%; top: 50%; pointer-events: none;
  background: #fff; clip-path: polygon(0 0, 0 100%, 30% 72%, 52% 100%, 66% 92%, 46% 66%, 85% 66%); }
.d-spin { width: 18px; height: 18px; margin: 8px auto; border-radius: 50%; border: 2px solid #2a2a31; border-top-color: var(--key); animation: d-rot 0.8s linear infinite; }
.d-grid4 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px; height: 100%; }
.d-grid4 div { background: #1d1d23; border: 1px solid #2a2a31; border-radius: 6px; }
@keyframes d-rot { to { transform: rotate(360deg); } }

/* ── KineticType ─────────────────────────── */
.d-split span { display: inline-block; overflow: hidden; vertical-align: bottom; }
.d-split i { display: inline-block; font-style: normal; animation: d-rise 3s cubic-bezier(.2, .8, .2, 1) infinite; animation-delay: var(--d); }
@keyframes d-rise { 0% { transform: translateY(110%); } 18%, 78% { transform: none; } 92%, 100% { transform: translateY(-110%); } }
.d-rot { color: var(--key); }
.d-rot b { display: inline-block; font-weight: inherit; }
.d-rot b.in { animation: d-rot-in .45s cubic-bezier(.2, .8, .2, 1); }
@keyframes d-rot-in { from { transform: translateY(60%); opacity: 0; filter: blur(4px); } }
.d-caret { display: inline-block; width: 2px; height: 1.1em; background: var(--key); margin-left: 2px; vertical-align: -3px; animation: d-blink 1s steps(1) infinite; }
@keyframes d-blink { 50% { opacity: 0; } }
.d-num { font: 600 34px var(--mono); color: var(--key); font-variant-numeric: tabular-nums; }
.d-dec em { font-style: normal; color: var(--key); }
.d-sweep { background: linear-gradient(var(--key), var(--key)) no-repeat 0 100% / 0% 32%; color: inherit; padding: 0 2px; animation: d-sweep 2.4s ease-in-out infinite; }
@keyframes d-sweep { 0% { background-size: 0% 32%; } 40%, 80% { background-size: 100% 32%; } 100% { background-size: 0% 32%; background-position: 100% 100%; } }
.d-marquee { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%) rotate(-4deg); background: var(--key); color: #111; padding: 8px 0; overflow: hidden; white-space: nowrap; font: 700 15px var(--sans); }
.d-marquee div { display: inline-block; animation: d-marq 6s linear infinite; }
@keyframes d-marq { to { transform: translateX(-50%); } }
.d-weight { font-size: 44px; letter-spacing: -.02em; animation: d-wght 2.4s ease-in-out infinite; }
@keyframes d-wght { 0%, 100% { font-weight: 100; } 50% { font-weight: 900; color: var(--key); } }

/* ── Scroll ──────────────────────────────── */
.d-reveal { padding-top: 4px; }
.d-reveal .d-card { opacity: 0; animation: d-fadeup 3s ease-out infinite; animation-delay: var(--d); }
@keyframes d-fadeup { 0% { opacity: 0; transform: translateY(14px); } 20%, 85% { opacity: 1; transform: none; border-color: var(--key); } 100% { opacity: 0; } }
.d-pin { display: flex; }
.d-pin-l { width: 42%; padding: 12px; font-weight: 700; font-size: 14px; border-right: 1px solid #2a2a31; color: var(--key); }
.d-pin-l small { font-weight: 400; font-size: 10px; color: var(--muted); }
.d-pin-r { flex: 1; overflow: hidden; }
.d-pin-track { animation: d-scrollup 5s linear infinite; }
@keyframes d-scrollup { from { transform: translateY(10px); } to { transform: translateY(-50%); } }
.d-feed { animation: d-feed 4s ease-in-out infinite; }
@keyframes d-feed { 0% { transform: none; } 70%, 100% { transform: translateY(-128px); } }
.d-para > * { position: absolute; }
.d-sun { width: 30px; height: 30px; border-radius: 50%; background: var(--key); right: 30px; top: 18px; animation: d-px 4s ease-in-out infinite alternate; --px: 6px; }
.d-hill { left: -40px; right: -40px; height: 60px; border-radius: 50% 50% 0 0; }
.d-hill.back { bottom: 22px; background: #26262d; animation: d-px 4s ease-in-out infinite alternate; --px: 12px; }
.d-hill.mid { bottom: 6px; background: #1e1e24; left: 40px; right: -80px; animation: d-px 4s ease-in-out infinite alternate; --px: 24px; }
.d-hill.front { bottom: -24px; background: #16161a; border-top: 1px solid #2f2f37; animation: d-px 4s ease-in-out infinite alternate; --px: 40px; }
@keyframes d-px { from { transform: translateX(0); } to { transform: translateX(calc(var(--px) * -1)); } }
.d-htrack-row { display: flex; position: absolute; top: 40px; left: 0; animation: d-htrack 4s ease-in-out infinite alternate; }
.d-htrack-row .d-card { width: 56px; height: 40px; flex: none; margin: 0 0 0 10px; }
.d-htrack-row .d-card:nth-child(3) { border-color: var(--key); }
@keyframes d-htrack { to { transform: translateX(-240px); } }
.d-vbar { position: absolute; right: 4px; top: 6px; bottom: 6px; width: 3px; background: #22222a; border-radius: 2px; }
.d-vbar i { position: absolute; left: 0; right: 0; height: 30%; background: var(--key); border-radius: 2px; animation: d-vthumb 4s ease-in-out infinite alternate; }
@keyframes d-vthumb { to { top: 70%; } }
.d-progress { position: absolute; z-index: 2; top: 0; left: 0; height: 3px; background: var(--key); animation: d-prog 4s linear infinite; }
@keyframes d-prog { from { width: 0; } to { width: 100%; } }
.d-text-scroll { padding-top: 8px; animation: d-scrollup 4s linear infinite; }
.d-snap { height: 100%; animation: d-snap 4.5s infinite; }
.d-snap section { height: 120px; display: grid; place-items: center; font: 600 22px var(--mono); }
.d-snap section:nth-child(1), .d-snap section:nth-child(4) { background: #18181d; }
.d-snap section:nth-child(2) { background: #202027; color: var(--key); }
.d-snap section:nth-child(3) { background: #15151a; }
@keyframes d-snap {
  0%, 25% { transform: translateY(0); } 33%, 58% { transform: translateY(-120px); }
  66%, 91% { transform: translateY(-240px); } 100% { transform: translateY(-360px); }
}
.d-scrub { display: grid; place-items: center; }
.d-orbit { width: 60px; height: 60px; border-radius: 50%; border: 1px dashed #3a3a44; position: relative; margin-top: -14px; animation: d-rot 3s linear infinite; }
.d-orbit i { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--key); top: -7px; left: 23px; }
.d-scrubbar { position: absolute; left: 12px; right: 12px; bottom: 12px; height: 3px; background: #2a2a31; border-radius: 2px; }
.d-scrubbar i { position: absolute; top: -4px; width: 11px; height: 11px; border-radius: 50%; background: #fff; animation: d-scrubthumb 3s linear infinite; }
@keyframes d-scrubthumb { from { left: 0; } to { left: calc(100% - 11px); } }

/* ── ViewTransition ──────────────────────── */
.d-xfade > div { position: absolute; inset: 0; padding: 14px 0; }
.d-xfade b { display: block; padding: 0 12px 4px; font-size: 14px; }
.d-xfade .a { animation: d-xa 3s ease-in-out infinite; }
.d-xfade .b { animation: d-xa 3s ease-in-out infinite reverse; }
.d-xfade .b b { color: var(--key); }
@keyframes d-xa { 0%, 35% { opacity: 1; } 50%, 85% { opacity: 0; } 100% { opacity: 1; } }
.d-flip { display: grid; grid-template-columns: repeat(2, 44px); gap: 8px; }
.d-flip div { height: 44px; border-radius: 8px; display: grid; place-items: center; font: 600 14px var(--mono); background: #1d1d23; border: 1px solid #2a2a31; }
.d-flip div:first-child { border-color: var(--key); color: var(--key); }
.d-tabs { position: relative; display: flex; gap: 4px; font-size: 13px; border-bottom: 1px solid #2a2a31; }
.d-tabs span { width: 70px; text-align: center; padding: 8px 0; color: var(--text-2); }
.d-tabs i { position: absolute; bottom: -1px; left: 0; width: 70px; height: 2px; background: var(--key); animation: d-tabs 3.6s cubic-bezier(.6, 0, .2, 1) infinite; }
@keyframes d-tabs { 0%, 25% { transform: translateX(0); } 33%, 58% { transform: translateX(74px); } 66%, 91% { transform: translateX(148px); } 100% { transform: translateX(0); } }
.d-shared .d-list { animation: d-shared-list 3.6s ease-in-out infinite; padding-top: 6px; }
.d-shared .ghost { visibility: hidden; }
.d-hero-el { position: absolute; background: var(--key); border-radius: 4px; animation: d-shared 3.6s cubic-bezier(.6, 0, .2, 1) infinite; }
.d-detail { position: absolute; left: 0; right: 0; top: 70px; animation: d-shared-detail 3.6s ease-in-out infinite; }
@keyframes d-shared { 0%, 20%, 100% { left: 12px; top: 12px; width: 18px; height: 18px; } 40%, 80% { left: 0; top: 0; width: 200px; height: 60px; border-radius: 0; } }
@keyframes d-shared-list { 0%, 20%, 100% { opacity: 1; } 35%, 85% { opacity: 0; } }
@keyframes d-shared-detail { 0%, 30%, 92%, 100% { opacity: 0; } 45%, 80% { opacity: 1; } }
.d-expand .d-grid4 div:first-child { visibility: hidden; }
.d-grow { position: absolute; background: #1d1d23; border: 1px solid var(--key); border-radius: 6px; animation: d-grow 3.4s cubic-bezier(.6, 0, .2, 1) infinite; }
@keyframes d-grow { 0%, 20%, 100% { left: 10px; top: 10px; width: 87px; height: 46px; } 45%, 80% { left: 6px; top: 6px; width: 186px; height: 106px; } }
.d-stagger { padding-top: 4px; }
.d-stagger .d-row { animation: d-stag 3s cubic-bezier(.2, .8, .2, 1) infinite; animation-delay: var(--d); opacity: 0; }
.d-stagger .d-row i { background: var(--key); }
@keyframes d-stag { 0% { opacity: 0; transform: translateX(-16px); } 15%, 80% { opacity: 1; transform: none; } 95%, 100% { opacity: 0; } }
.d-dir-track { display: flex; width: 400px; height: 100%; animation: d-dir 4s cubic-bezier(.6, 0, .2, 1) infinite; }
.d-dir-track div { width: 200px; display: grid; place-items: center; font-weight: 700; }
.d-dir-track div:last-child { color: var(--key); background: #18181d; }
@keyframes d-dir { 0%, 30% { transform: translateX(0); } 45%, 80% { transform: translateX(-200px); } 95%, 100% { transform: translateX(0); } }
.d-dir-hint { position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; font: 10px var(--mono); color: var(--muted); }
.d-dir-hint span { position: absolute; left: 0; right: 0; animation: d-xa 4s steps(1) infinite; }
.d-dir-hint .b { animation-direction: reverse; }

/* ── Micro-motion ────────────────────────── */
.d-lift { width: 110px; height: 70px; border-radius: 8px; display: grid; place-items: center; background: #1d1d23; border: 1px solid #2a2a31; font-size: 13px; animation: d-lift 3s ease-in-out infinite; }
@keyframes d-lift { 0%, 30%, 90%, 100% { transform: none; box-shadow: none; } 45%, 75% { transform: translateY(-6px); box-shadow: 0 12px 24px rgba(0, 0, 0, .6); border-color: var(--key); } }
.c-lift { animation: d-cur-lift 3s ease-in-out infinite; }
@keyframes d-cur-lift { 0%, 10% { transform: translate(70px, 50px); } 40%, 80% { transform: translate(10px, 6px); } 100% { transform: translate(70px, 50px); } }
.d-press { animation: d-press 2s ease-in-out infinite; }
@keyframes d-press { 0%, 45%, 60%, 100% { transform: none; } 50%, 55% { transform: scale(.92); } }
.c-press { animation: d-cur-press 2s ease-in-out infinite; }
@keyframes d-cur-press { 0% { transform: translate(60px, 40px); } 40%, 70% { transform: translate(14px, 4px); } 50%, 55% { transform: translate(14px, 4px) scale(.85); } 100% { transform: translate(60px, 40px); } }
.d-input { width: 170px; padding: 9px 12px; border-radius: 6px; border: 1px solid #3a3a44; font-size: 13px; color: var(--text-2); animation: d-shake 2.4s ease-in-out infinite; }
@keyframes d-shake {
  0%, 30% { transform: none; border-color: #3a3a44; } 34% { transform: translateX(-7px); border-color: #ff5a5a; } 38% { transform: translateX(7px); }
  42% { transform: translateX(-5px); } 46% { transform: translateX(4px); } 50%, 90% { transform: none; border-color: #ff5a5a; } 100% { border-color: #3a3a44; }
}
.d-err { font-size: 11px; color: #ff6b6b; width: 170px; animation: d-err 2.4s infinite; }
@keyframes d-err { 0%, 32% { opacity: 0; } 40%, 90% { opacity: 1; } 100% { opacity: 0; } }
.d-check circle { fill: none; stroke: var(--key); stroke-width: 2.5; stroke-dasharray: 151; animation: d-circ 2.6s ease-out infinite; }
.d-check path { fill: none; stroke: var(--key); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 36; animation: d-tick 2.6s ease-out infinite; }
@keyframes d-circ { 0% { stroke-dashoffset: 151; } 30%, 85% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes d-tick { 0%, 30% { stroke-dashoffset: 36; } 50%, 85% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; opacity: 0; } }
.d-ripple i { position: absolute; left: 30%; top: 50%; width: 10px; height: 10px; margin: -5px; border-radius: 50%; background: rgba(255, 255, 255, .7); animation: d-ripple 1.8s ease-out infinite; }
@keyframes d-ripple { 0% { transform: scale(0); opacity: .8; } 60%, 100% { transform: scale(18); opacity: 0; } }
.d-drag { position: relative; width: 160px; height: 104px; }
.d-drag div { position: absolute; left: 0; right: 0; height: 28px; padding: 0 10px; display: flex; align-items: center; font-size: 12px; border-radius: 6px; background: #1d1d23; border: 1px solid #2a2a31; }
.d-drag .r1 { top: 0; z-index: 2; animation: d-drag1 3.6s ease-in-out infinite; }
.d-drag .r2 { top: 38px; animation: d-drag2 3.6s ease-in-out infinite; }
.d-drag .r3 { top: 76px; }
@keyframes d-drag1 { 0%, 10% { top: 0; transform: none; } 20% { top: 0; transform: scale(1.05); box-shadow: 0 8px 20px rgba(0, 0, 0, .6); border-color: var(--key); } 45% { top: 38px; transform: scale(1.05); border-color: var(--key); } 55%, 80% { top: 38px; transform: none; } 100% { top: 0; } }
@keyframes d-drag2 { 0%, 25% { top: 38px; } 42%, 80% { top: 0; } 100% { top: 38px; } }
.d-swipe { position: relative; width: 200px; height: 44px; border-radius: 8px; overflow: hidden; background: #ff5a5a; }
.d-swipe .act { position: absolute; right: 0; top: 0; bottom: 0; width: 70px; display: grid; place-items: center; font: 600 12px var(--sans); color: #fff; }
.d-swipe .row { position: absolute; inset: 0; background: #1d1d23; padding: 0 12px; font-size: 12px; animation: d-swipe 3s ease-in-out infinite; }
.d-swipe .row span { background: none; height: auto; color: var(--text-2); }
@keyframes d-swipe { 0%, 20%, 90%, 100% { transform: none; } 40%, 75% { transform: translateX(-70px); } }
.d-pull .d-spin { position: absolute; left: 0; right: 0; top: 4px; opacity: 0; animation: d-rot .8s linear infinite, d-pullspin 3s ease-in-out infinite; }
.d-pull-body { animation: d-pull 3s ease-in-out infinite; background: #131317; position: relative; }
@keyframes d-pull { 0%, 10% { transform: none; } 35%, 70% { transform: translateY(36px); } 85%, 100% { transform: none; } }
@keyframes d-pullspin { 0%, 20% { opacity: 0; } 35%, 70% { opacity: 1; } 80%, 100% { opacity: 0; } }
.d-mag { animation: d-mag 3s ease-in-out infinite; }
.c-mag { animation: d-cur-mag 3s ease-in-out infinite; }
@keyframes d-mag { 0%, 100% { transform: none; } 25% { transform: translate(8px, -6px); } 50% { transform: translate(-8px, 6px); } 75% { transform: translate(6px, 6px); } }
@keyframes d-cur-mag { 0%, 100% { transform: translate(70px, 40px); } 25% { transform: translate(50px, -30px); } 50% { transform: translate(-60px, 20px); } 75% { transform: translate(40px, 34px); } }
.d-link { font-size: 15px; font-weight: 600; border-bottom: 1px solid #3a3a44; }
.d-cc-dot, .d-cc-ring { position: absolute; left: 50%; top: 50%; border-radius: 50%; pointer-events: none; }
.d-cc-dot { width: 6px; height: 6px; margin: -3px; background: var(--key); animation: d-cc 3s ease-in-out infinite; }
.d-cc-ring { width: 30px; height: 30px; margin: -15px; border: 1px solid var(--key); animation: d-cc 3s ease-in-out infinite, d-ccring 3s ease-in-out infinite; animation-delay: .12s, .12s; }
@keyframes d-cc { 0%, 100% { translate: -90px -40px; } 40%, 65% { translate: 0 0; } 80% { translate: 80px 40px; } }
@keyframes d-ccring { 0%, 30%, 75%, 100% { scale: 1; background: transparent; } 40%, 65% { scale: 2.6; background: rgba(198, 255, 61, .12); } }

/* ── DynamicColor ────────────────────────── */
.d-theme { animation: d-theme 3.2s steps(1) infinite; padding-top: 34px; }
.d-tog { position: absolute; top: 10px; right: 10px; width: 30px; height: 16px; border-radius: 8px; background: #2a2a31; }
.d-tog i { position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--key); transition: transform .3s; animation: d-togi 3.2s steps(1) infinite; }
@keyframes d-theme { 0% { background: #131317; } 50% { background: #f2f2f4; } }
@keyframes d-togi { 0% { transform: none; } 50% { transform: translateX(14px); } }
.d-theme .d-line { animation: d-themeline 3.2s steps(1) infinite; }
@keyframes d-themeline { 0% { background: #2a2a31; } 50% { background: #d4d4da; } }
.d-spot .d-light { position: absolute; width: 140px; height: 140px; margin: -70px; border-radius: 50%; background: radial-gradient(closest-side, rgba(198, 255, 61, .35), transparent); mix-blend-mode: screen; animation: d-spot 4s ease-in-out infinite; }
@keyframes d-spot { 0%, 100% { left: 30px; top: 30px; } 33% { left: 170px; top: 40px; } 66% { left: 100px; top: 100px; } }
.d-tint { animation: d-tint 4s linear infinite; }
@keyframes d-tint { 0%, 100% { background: #131317; } 33% { background: #1b2410; } 66% { background: #1a1424; } }
.d-drift { display: grid; place-items: center; background: linear-gradient(120deg, #1a1a20, #3b4d12, #c6ff3d, #2b1e3d, #1a1a20); background-size: 300% 300%; animation: d-drift 5s ease-in-out infinite alternate; }
.d-drift b { font-size: 16px; color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, .5); }
@keyframes d-drift { to { background-position: 100% 100%; } }
.d-accent .d-img { position: absolute; left: 10px; top: 10px; right: 10px; height: 62px; border-radius: 6px; animation: d-accimg 4s steps(1) infinite; }
.d-acc-btn { position: absolute; left: 10px; bottom: 10px; padding: 6px 14px; border-radius: 6px; font: 600 12px var(--sans); color: #111; animation: d-accbtn 4s steps(1) infinite; }
@keyframes d-accimg { 0% { background: linear-gradient(135deg, #ff7a3d, #6a1f00); } 50% { background: linear-gradient(135deg, #3dd6ff, #0b2a5a); } }
@keyframes d-accbtn { 0% { background: #ff7a3d; } 50% { background: #3dd6ff; } }
.d-contrast { display: grid; place-items: center; animation: d-cbg 3.2s steps(1) infinite; }
.d-contrast b { font-size: 14px; animation: d-ctext 3.2s steps(1) infinite; }
@keyframes d-cbg { 0% { background: #111; } 25% { background: var(--key); } 50% { background: #2b2bd6; } 75% { background: #f4f4f6; } }
@keyframes d-ctext { 0% { color: #fff; } 25% { color: #111; } 50% { color: #fff; } 75% { color: #111; } }

@media (prefers-reduced-motion: reduce) { .demo-stage * { animation-duration: 0s !important; animation-iteration-count: 1 !important; } }
