html, body {
  margin: 0;
  overflow: hidden;
}

.stage {
  box-sizing: border-box;
  min-height: 100vh;
  display: grid;
  place-items: center;
  margin: 0;
  background: #ffffff;
  font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
  padding: clamp(8px, 4vw, 24px);
}

.bd {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.bd__card {
  position: relative;
  width: min(100%, 268px);
  aspect-ratio: 268/176;
  background: #fff7e6;
  border-radius: 16px;
  box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
  overflow: hidden;
}

.bd__closed, .bd__open {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.bd__closed {
  background: linear-gradient(160deg, #ff9ebb, #ebd6dc);
}

.bd__closedTitle {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  font-weight: 800;
  font-size: clamp(15px, 4.6vw, 20px);
  color: #17141a;
}

.bd__ico {
  width: 22px;
  height: 22px;
  color: #17141a;
}

.bd__openBtn {
  border: 0;
  cursor: pointer;
  background: #17141a;
  color: #fff7e6;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 800;
  font-size: clamp(11px, 3.2vw, 13px);
  padding: 8px 20px;
  line-height: 1.2;
  transition: transform 140ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.bd__openBtn:active {
  transform: scale(0.94);
}

.bd__openBtn:focus-visible {
  outline: 3px solid #2f6df6;
  outline-offset: 2px;
}

.bd__open {
  background: #fff7e6;
  clip-path: inset(0 0 100% 0);
}

.bd.is-open .bd__open {
  clip-path: inset(0 0 0 0);
  transition: clip-path 600ms ease-out;
}

.bd.is-open .bd__closed {
  visibility: hidden;
}

.bd__candle {
  position: relative;
  width: 24px;
  height: 64px;
}

.bd__wax {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 18px;
  height: 44px;
  border-radius: 4px 4px 0 0;
  background: #b9a0ff;
}

.bd__flame {
  position: absolute;
  left: calc(50% - 5px);
  bottom: 42px;
  width: 10px;
  height: 16px;
  border-radius: 50% 50% 50% 50%/62% 62% 38% 38%;
  background: radial-gradient(circle at 50% 78%, #fff3c4, #d1bda1 62%, #d1ada1 100%);
  transform-origin: 50% 100%;
}

.bd__glow {
  position: absolute;
  left: calc(50% - 13px);
  bottom: 32px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 176, 58, 0.5), transparent 70%);
  filter: blur(4px);
}

.bd__room {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 42%, rgba(255, 176, 58, 0.55), rgba(255, 109, 58, 0.22) 46%, transparent 74%);
}

.bd.is-lit-off .bd__room {
  opacity: 0 !important;
  animation: none !important;
}

.bd__say {
  margin: 0;
  font-weight: 700;
  font-size: clamp(10px, 3vw, 12px);
  color: rgba(23, 20, 26, 0.78);
}

.bd__pct {
  margin: 0;
  font-weight: 700;
  font-size: clamp(13px, 4vw, 16px);
  color: #17141a;
}

.bd__pct b {
  font-weight: 800;
  font-size: 1.6em;
  color: #2f6df6;
}

.bd__blowBtn {
  border: 0;
  cursor: pointer;
  background: #ff9ebb;
  color: #17141a;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 800;
  font-size: clamp(11px, 3.2vw, 13px);
  padding: 4px 16px;
  line-height: 1.3;
  transition: transform 140ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.bd__blowBtn:active {
  transform: scale(0.94);
}

.bd__blowBtn:focus-visible {
  outline: 3px solid #2f6df6;
  outline-offset: 2px;
}

.bd.is-lit-off .bd__flame {
  animation: none;
  transform: scaleY(0);
}

.bd.is-lit-off .bd__glow {
  animation: none;
  opacity: 0;
}

.bd.is-lit-off .bd__say {
  visibility: hidden;
}

.bd__live {
  margin: 0;
  min-height: 1.2em;
  font-weight: 700;
  font-size: clamp(10px, 2.8vw, 11px);
  color: rgba(23, 20, 26, 0.6);
}

.bd__flame {
  animation: bdFlicker 900ms ease-in-out infinite;
}

@keyframes bdFlicker {
  0%, 100% {
    transform: skewX(0deg) scaleY(1) scaleX(1);
  }
  25% {
    transform: skewX(4deg) scaleY(1.08) scaleX(0.94);
  }
  55% {
    transform: skewX(-3deg) scaleY(0.94) scaleX(1.05);
  }
  80% {
    transform: skewX(2deg) scaleY(1.05) scaleX(0.97);
  }
}
.bd__glow {
  animation: bdGlow 900ms ease-in-out infinite;
}

@keyframes bdGlow {
  0%, 100% {
    transform: scale(1);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.25);
    opacity: 0.55;
  }
}
.bd.is-demo .bd__open {
  clip-path: inset(0 0 0 0);
}

.bd.is-demo .bd__closed {
  visibility: hidden;
}

.bd.is-demo .bd__flame {
  animation: bdFlameLoop 2s ease-in-out infinite;
}

@keyframes bdFlameLoop {
  0%, 10% {
    transform: scaleY(0);
  }
  16% {
    transform: scaleY(1);
  }
  22% {
    transform: skewX(4deg) scaleY(1.08) scaleX(0.94);
  }
  30% {
    transform: skewX(-3deg) scaleY(0.94) scaleX(1.05);
  }
  38% {
    transform: skewX(2deg) scaleY(1.05) scaleX(0.97);
  }
  46% {
    transform: skewX(-4deg) scaleY(1.1) scaleX(0.93);
  }
  54% {
    transform: skewX(3deg) scaleY(0.96) scaleX(1.04);
  }
  62% {
    transform: skewX(0deg) scaleY(1);
  }
  67%, 92% {
    transform: scaleY(0);
  }
  92.5%, 100% {
    transform: scaleY(0);
  }
}
.bd.is-demo .bd__glow {
  animation: bdGlowLoop 2s ease-in-out infinite;
}

@keyframes bdGlowLoop {
  0%, 16% {
    transform: scale(0.6);
    opacity: 0;
  }
  22% {
    transform: scale(1);
    opacity: 0.9;
  }
  40% {
    transform: scale(1.2);
    opacity: 0.6;
  }
  56% {
    transform: scale(1.05);
    opacity: 0.85;
  }
  62%, 92% {
    transform: scale(0.4);
    opacity: 0;
  }
  92.5%, 100% {
    transform: scale(0.4);
    opacity: 0;
  }
}
.bd.is-demo .bd__room {
  animation: bdRoom 2s infinite;
}

@keyframes bdRoom {
  0%, 13% {
    opacity: 0;
    animation-timing-function: steps(1, end);
  }
  14%, 40% {
    opacity: 0.95;
    animation-timing-function: ease-in-out;
  }
  52% {
    opacity: 0.7;
  }
  60% {
    opacity: 0.95;
    animation-timing-function: steps(1, end);
  }
  62%, 100% {
    opacity: 0;
  }
}
.bd.is-open:not(.is-lit-off) .bd__room {
  opacity: 0.85;
  animation: bdRoomLive 900ms ease-in-out infinite;
}

@keyframes bdRoomLive {
  0%, 100% {
    opacity: 0.85;
  }
  50% {
    opacity: 0.62;
  }
}
.bd.is-demo .bd__pct {
  animation: bdPop 2s ease-out infinite;
}

@keyframes bdPop {
  0%, 68% {
    transform: scale(0.6);
    opacity: 0;
  }
  74%, 92% {
    transform: scale(1);
    opacity: 1;
  }
  94%, 100% {
    transform: scale(0.6);
    opacity: 0;
  }
}
.bd.is-demo .bd__say {
  animation: bdSayCut 2s steps(1, end) infinite;
}

@keyframes bdSayCut {
  0%, 62% {
    visibility: visible;
  }
  62.5%, 92% {
    visibility: hidden;
  }
  92.5%, 100% {
    visibility: visible;
  }
}
@media (max-width: 340px) {
  .bd__candle {
    height: 44px;
    width: 20px;
  }
  .bd__wax {
    height: 28px;
    width: 14px;
  }
  .bd__flame {
    bottom: 26px;
  }
  .bd__glow {
    bottom: 16px;
  }
  .bd__card {
    width: min(100%, 228px);
  }
  .bd__closed, .bd__open {
    gap: 4px;
  }
  .bd {
    gap: 4px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .bd.is-demo .bd__flame,
  .bd.is-demo .bd__glow,
  .bd.is-demo .bd__room,
  .bd.is-demo .bd__pct,
  .bd.is-demo .bd__say,
  .bd.is-open:not(.is-lit-off) .bd__room,
  .bd__flame,
  .bd__glow {
    animation: none !important;
  }
  .bd.is-demo .bd__room {
    opacity: 0.85;
  }
  .bd__openBtn, .bd__blowBtn {
    transition: none !important;
  }
  .bd.is-demo .bd__flame {
    transform: scaleY(1);
  }
  .bd.is-demo .bd__glow {
    transform: scale(1);
    opacity: 0.8;
  }
  .bd.is-demo .bd__pct {
    transform: scale(1);
    opacity: 1;
  }
  .bd.is-demo .bd__say {
    visibility: hidden;
  }
}
