.candle-wax {
  --candle-wax-dark: #49200f;
  --candle-wax-body: #b96626;
  --candle-wax-light: #ffd492;
  position: relative;
  overflow: hidden;
}

.candle-wax > .candle-wax-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

@media (prefers-reduced-motion: reduce) {
  .candle-wax > .candle-wax-canvas {
    display: none;
  }
}

:is(.candle-wax, .candle-wax-overlay) > .candle-wax-candle {
  position: absolute;
  top: calc(var(--candle-wax-flame-size, 19px) + 5px + var(--candle-wax-position, 0px));
  left: 50%;
  width: min(72%, var(--candle-wax-width, 260px));
  height: var(--candle-wax-height, 34px);
  translate: -50% 0;
  border-radius: 46% 48% 18% 20% / 16% 19% 12% 13%;
  background: linear-gradient(90deg, #71371b, #df9d58 32%, #f5c887 48%, #a25227 84%, #623116);
  box-shadow: 0 1px 3px #36180890;
  pointer-events: none;
  z-index: 6;
}

:is(.candle-wax, .candle-wax-overlay) > .candle-wax-candle::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: calc(50% - 1px);
  width: 2px;
  height: 6px;
  background: #452212;
}

:is(.candle-wax, .candle-wax-overlay) > .candle-wax-candle::after {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  translate: -50% 0;
  width: calc(var(--candle-wax-flame-size, 19px) * 0.737);
  height: var(--candle-wax-flame-size, 19px);
  border-radius: 78% 22% 55% 45% / 75% 49% 51% 25%;
  background: radial-gradient(ellipse at 48% 74%, #fff8c8 10%, #ffcb5b 42%, #ee7927 78%);
  box-shadow: 0 0 13px 3px #ffad4a85;
  transform-origin: 50% 95%;
}

@media (prefers-reduced-motion: no-preference) {
  :is(.candle-wax, .candle-wax-overlay) > .candle-wax-candle::after {
    animation: candle-wax-flame 2.3s ease-in-out infinite alternate;
  }
}

@keyframes candle-wax-flame {
  0%, 100% { transform: rotate(-7deg) scaleY(0.92); }
  38% { transform: rotate(8deg) scaleY(1.04); }
  71% { transform: rotate(-2deg) scaleY(0.97); }
}

.candle-wax-overlay {
  position: fixed;
  inset: 0 auto auto 0;
  pointer-events: none;
  z-index: 1000;
}

.candle-wax-overlay[hidden] {
  display: none;
}

.candle-wax-candle > .candle-wax-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .candle-wax-candle > .candle-wax-face {
    display: none;
  }
}
