.candle-room {
  display: grid;
  justify-items: center;
  gap: 14px;
  max-width: 42rem;
  margin: 12px auto 36px;
  padding: clamp(16px, 5vw, 40px);
  border-radius: 32px;
  text-align: center;
  color: #fff4dc;
  background: radial-gradient(ellipse at 50% 48%, #54352a, #221d27 66%, #161824);
}
.candle-room h1 { font-size: clamp(2rem, 7vw, 4rem); }
.candle-room p { color: inherit; max-width: 36ch; }
#candle-status:empty, .candle-controls[hidden] { display: none; }
.candle-scene {
  position: relative;
  width: min(100%, 23rem);
  height: clamp(175px, 40vh, 315px);
  display: grid;
  place-items: end center;
  isolation: isolate;
  background: radial-gradient(ellipse at 50% 38%, #ffae5c36, transparent 56%);
}
.candle-wax {
  position: relative;
  width: clamp(65px, 29%, 105px);
  height: 46%;
  margin-bottom: 6%;
  border-radius: 50% 50% 24% 24% / 8% 8% 6% 6%;
  background: linear-gradient(100deg, #74504b, #c48a62 25%, #f0bc87 47%, #b17759 67%, #5b3b49);
  box-shadow: 0 12px 20px #1913219a, 0 -3px 16px #f5a55e4a;
}
.candle-wax::before {
  position: absolute;
  inset: 0 0 auto;
  height: 13%;
  border-radius: 50%;
  background: radial-gradient(ellipse, #ffd49b, #dca072 78%);
  content: '';
}
.candle-flame {
  position: absolute;
  left: 50%;
  bottom: 51%;
  width: clamp(17px, 7.5%, 31px);
  height: 30%;
  translate: -50% 0;
  border-radius: 64% 36% 52% 48% / 78% 65% 35% 22%;
  background: radial-gradient(ellipse at 48% 78%, #fff9da 9%, #ffd88a 38%, #f78f45 74%, #d85d58);
  box-shadow: 0 0 20px #ffc480a8, 0 0 65px #ffad5c80;
  transform-origin: 50% 97%;
  z-index: 1;
}
.candle-room.is-running .candle-flame { animation: candle-sway 5s ease-in-out infinite alternate; }
@keyframes candle-sway {
  0% { transform: rotate(-3deg) scaleX(.94); }
  100% { transform: rotate(4deg) scaleX(1.04); }
}
@media (prefers-reduced-motion: reduce) {
  .candle-room.is-running .candle-flame { animation: none; }
}
.candle-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.candle-controls select { min-height: 44px; border-radius: 12px; padding: 4px 8px; }
.candle-controls output { flex-basis: 100%; font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.candle-controls .button { min-height: 44px; background: #fff4dc; color: #271e24; padding-inline: 17px; }
.candle-controls .button.light { background: transparent; color: #fff4dc; border-color: #fff4dc86; }
.candle-scene::after {
  content: '✧    ·    ✦      ·    ✧';
  position: absolute;
  inset: 6% 0 auto;
  color: #ffdb94;
  word-spacing: .6em;
  pointer-events: none;
}
.candle-heart {
  position: absolute;
  inset: 16% 0 auto;
  opacity: 0;
  color: #ffe2ad;
  font-size: clamp(5rem, 22vw, 9rem);
  line-height: 1;
  text-shadow: 0 0 25px #ffbd70;
  transition: opacity 1.3s;
}
.candle-heart span { position: absolute; inset: 32% 0 auto; font-size: .31em; }
.heart-stage .candle-heart { opacity: 1; }
.heart-stage :is(.candle-flame,.candle-wax) { opacity: 0; }
.candle-flame, .candle-wax { transition: opacity 1.3s; }
@media (prefers-reduced-motion: reduce) {
  .candle-heart, .candle-flame, .candle-wax { transition: none; }
}
