/* Surcouche décorative limitée à la zone utile du champ de récit. */
.cxsfx-layer {
  position: fixed;
  z-index: 2147483000;
  overflow: hidden;
  pointer-events: none;
  contain: layout paint;
  --field: #fffdf9;
  --flame: #bd5904;
}
.cxsfx-stage {
  position: absolute;
  inset: auto 0 0;
  height: min(100%, 66px);
  overflow: hidden;
  --a: var(--a-day);
  --b: var(--b-day);
}
.cxsfx-layer[data-tone="night"] {
  --field: #262037;
  --flame: #ffda81;
}
.cxsfx-layer[data-tone="night"] .cxsfx-stage {
  --a: var(--a-night);
  --b: var(--b-night);
}
@media (prefers-color-scheme: dark) {
  .cxsfx-layer:not([data-tone]) {
    --field: #262037;
    --flame: #ffda81;
  }
  .cxsfx-layer:not([data-tone]) .cxsfx-stage {
    --a: var(--a-night);
    --b: var(--b-night);
  }
}
  .cxsfx-stage[data-theme="love"] { --a-day: #c83371; --a-night: #ff8db7; --b-day: #a837a4; --b-night: #f0a1ec; }
  .cxsfx-stage[data-theme="friend"] { --a-day: #b9690a; --a-night: #ffce67; --b-day: #664ac8; --b-night: #b8a2ff; }
  .cxsfx-stage[data-theme="christmas"] { --a-day: #286baa; --a-night: #a7deff; --b-day: #957015; --b-night: #ffe095; }
  .cxsfx-stage[data-theme="birthday"] { --a-day: #af3b78; --a-night: #ff91c6; --b-day: #6e46ce; --b-night: #b9a3ff; }
  .cxsfx-stage[data-theme="wedding"] { --a-day: #9b6608; --a-night: #ffdd8c; --b-day: #b85c7e; --b-night: #ffaac2; }
  .cxsfx-stage[data-theme="rain"] { --a-day: #287bb8; --a-night: #84cfff; --b-day: #3273a3; --b-night: #b6ddf5; }
  .cxsfx-stage[data-theme="heat"] { --a-day: #b9500b; --a-night: #ffae72; --b-day: #93610b; --b-night: #ffe088; }
  .cxsfx-stage[data-theme="speed"] { --a-day: #6e37ae; --a-night: #c5a4ff; --b-day: #a12963; --b-night: #ff98bc; }
  .cxsfx-stage[data-theme="laugh"] { --a-day: #8b3d02; --a-night: #ffcf7d; --b-day: #762e9e; --b-night: #dfa1ff; }
  .cxsfx-stage[data-theme="fear"] { --a-day: #61399a; --a-night: #d2adff; --b-day: #ab385e; --b-night: #ffa2bb; }
  .cxsfx-stage[data-theme]::before {
    content: "";
    position: absolute;
    inset: 12px 0 0;
    background: radial-gradient(ellipse at bottom, var(--a), transparent 69%);
    animation: cx-recit-halo 1.55s ease-out both;
  }
  .cxsfx-stage .cx-particle {
    position: absolute;
    left: var(--x);
    bottom: var(--y, 12px);
    display: block;
    color: var(--a);
    opacity: 0;
    font-size: var(--size, 21px);
    line-height: 1;
    animation: var(--motion) 1.24s var(--delay) both;
  }
  .cxsfx-stage .cx-particle:nth-child(even) { color: var(--b); }
  .cxsfx-stage .cx-particle.ring { width: 22px; height: 16px; border: 3px double currentColor; border-radius: 50%; }
  .cxsfx-stage .cx-particle.drop { width: 2px; height: 20px; border-radius: 3px; background: linear-gradient(transparent, currentColor); }
  .cxsfx-stage .cx-particle.dash { width: var(--size); height: 2px; border-radius: 3px; background: linear-gradient(90deg, transparent, currentColor); }
  .cxsfx-stage .cx-particle.confetti { width: 5px; height: 9px; border-radius: 2px; background: currentColor; animation-delay: calc(var(--delay) + 260ms); animation-duration: .98s; }
  .cxsfx-stage .cx-particle.petal { width: 8px; height: 5px; border-radius: 60% 25%; background: currentColor; }
  .cxsfx-stage .cx-particle.candle { width: 5px; height: 16px; border-radius: 2px; background: currentColor; }
  .cxsfx-stage .cx-particle.candle::before { content: ""; display: block; width: 5px; height: 7px; margin-top: -8px; border-radius: 70% 55% 65% 55%; background: var(--flame); animation: cx-recit-flame .5s ease-out both; }
  .cxsfx-stage .cx-particle.bubble {
    padding: 3px 6px;
    border: 1px solid currentColor;
    border-radius: 10px 9px 11px 3px;
    background: var(--field);
    font-size: var(--size, 14px);
    font-weight: 500;
    white-space: nowrap;
  }
  @keyframes cx-recit-halo { 0%, 100% { opacity: 0; } 27%, 56% { opacity: .19; } }
  @keyframes cx-recit-flame { 0%, 65% { opacity: 1; } 100% { opacity: 0; transform: translateY(-5px) scale(.3); } }
  @keyframes cx-recit-meet {
    0% { opacity: 0; transform: translate(var(--dx), 13px) rotate(var(--tilt)) scale(.6); }
    35%, 60% { opacity: 1; transform: translate(0, -12px) rotate(var(--tilt)) scale(1); }
    100% { opacity: 0; transform: translate(0, -35px) rotate(0) scale(.82); }
  }
  @keyframes cx-recit-float {
    0% { opacity: 0; transform: translate(0, 9px) rotate(-20deg) scale(.6); }
    25%, 55% { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--dx), -43px) rotate(35deg) scale(.8); }
  }
  @keyframes cx-recit-fall {
    0% { opacity: 0; transform: translate(0, -58px) rotate(var(--tilt)); }
    25%, 62% { opacity: .95; }
    100% { opacity: 0; transform: translate(var(--dx), 22px) rotate(var(--tilt)); }
  }
  @keyframes cx-recit-dash {
    0% { opacity: 0; transform: translateX(-39px) scaleX(.55); }
    25%, 52% { opacity: 1; }
    100% { opacity: 0; transform: translateX(45px) scaleX(1.25); }
  }
  @keyframes cx-recit-wave {
    0% { opacity: 0; transform: translate(0, 12px) rotate(-12deg); }
    35% { opacity: .8; transform: translate(8px, -7px) rotate(12deg); }
    66% { opacity: .7; transform: translate(-6px, -19px) rotate(-8deg); }
    100% { opacity: 0; transform: translate(5px, -31px) rotate(0); }
  }
  @keyframes cx-recit-pop {
    0% { opacity: 0; transform: translateY(8px) rotate(-15deg) scale(.55); }
    25% { opacity: 1; transform: translateY(-15px) rotate(8deg) scale(1.15); }
    52%, 67% { opacity: 1; transform: translateY(-10px) rotate(-5deg) scale(1); }
    100% { opacity: 0; transform: translateY(-24px) scale(.9); }
  }
  @keyframes cx-recit-shiver {
    0% { opacity: 0; transform: translateY(9px) scale(.6); }
    22% { opacity: 1; transform: translate(-3px, -10px) rotate(-7deg) scale(1.12); }
    33% { transform: translate(3px, -10px) rotate(6deg); }
    45% { transform: translate(-2px, -10px) rotate(-4deg); }
    62% { opacity: 1; transform: translate(0, -10px); }
    100% { opacity: 0; transform: translateY(-23px); }
  }
@media (prefers-reduced-motion: reduce) {
  .cxsfx-stage[data-theme]::before { animation: none; opacity: .15; }
  .cxsfx-stage .cx-particle { animation: none; opacity: 1; }
  .cxsfx-stage .cx-particle.candle::before { animation: none; }
}
