:root {
  --accent: #f5c56a;
  --danger: #f34b4b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #f6efe2;
  background: #000;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 58%, rgb(255 173 59 / 10%) 0%, rgb(255 173 59 / 2%) 18%, transparent 55%);
  pointer-events: none;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  padding: 24px;
}

.meta {
  font-size: 13px;
  opacity: 0.88;
  line-height: 1.7;
}

.candle-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.candle {
  position: relative;
  width: 220px;
  height: 340px;
}

.candle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 6px;
  width: 160px;
  height: 190px;
  transform: translateX(-50%);
  background: radial-gradient(circle at 50% 60%, rgb(255 171 72 / 34%) 0%, rgb(255 171 72 / 12%) 40%, transparent 72%);
  filter: blur(8px);
  animation: auraPulse 2.8s ease-in-out infinite;
  pointer-events: none;
}

.candle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 88px;
  width: 4px;
  height: 20px;
  transform: translateX(-50%);
  border-radius: 4px;
  background: linear-gradient(180deg, #58412e 0%, #271a14 100%);
  box-shadow: 0 0 6px rgb(0 0 0 / 70%);
}

.flame {
  --flame-scale: 1;
  --flicker-duration: 1.1s;
  position: absolute;
  top: 44px;
  left: 50%;
  width: 38px;
  height: 56px;
  transform: translateX(-50%) scale(var(--flame-scale));
  transform-origin: center bottom;
  border-radius: 50% 50% 58% 42%;
  background: radial-gradient(circle at 50% 68%, #fff7db 0%, #ffd068 34%, #ff9732 62%, #ff4f1f 88%);
  filter: drop-shadow(0 0 18px rgb(255 162 56 / 70%));
  animation: flameSwing var(--flicker-duration) ease-in-out infinite alternate;
}

.flame::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 10px;
  width: 18px;
  height: 28px;
  transform: translateX(-50%);
  border-radius: 60% 40% 55% 45%;
  background: radial-gradient(circle at 50% 70%, rgb(255 253 237 / 96%) 0%, rgb(255 233 166 / 92%) 54%, transparent 82%);
  animation: flameCore calc(var(--flicker-duration) * 0.8) ease-in-out infinite alternate;
}

.flame::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -6px;
  width: 56px;
  height: 70px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgb(255 162 56 / 48%) 0%, rgb(255 120 37 / 22%) 36%, transparent 72%);
  filter: blur(4px);
  animation: flameHalo calc(var(--flicker-duration) * 1.3) ease-in-out infinite alternate;
}

.body {
  position: absolute;
  bottom: 8px;
  left: 50%;
  width: 108px;
  height: 228px;
  transform: translateX(-50%);
  border-radius: 14px 14px 10px 10px;
  background:
    linear-gradient(110deg, rgb(255 255 255 / 30%) 8%, rgb(255 255 255 / 0%) 28%),
    linear-gradient(180deg, rgb(254 245 222 / 98%) 0%, rgb(240 223 186 / 96%) 55%, rgb(216 192 150 / 96%) 100%);
  box-shadow:
    inset -8px 0 16px rgb(132 99 62 / 22%),
    inset 0 10px 12px rgb(255 255 255 / 16%),
    0 14px 28px rgb(255 171 72 / 16%);
}

.shadow {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 168px;
  height: 22px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgb(0 0 0 / 62%) 0%, rgb(0 0 0 / 8%) 62%, transparent 82%);
  filter: blur(3px);
}

.wax-level {
  position: static;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-shadow: 0 0 8px rgb(255 170 74 / 35%);
  opacity: 0.92;
}

.dark-age-panel {
  text-align: center;
  font-size: 18px;
  line-height: 1.6;
  letter-spacing: 0.5px;
}

.dark-age-panel strong {
  display: inline-block;
  margin-top: 6px;
  font-size: 36px;
}

.hidden {
  visibility: hidden;
  opacity: 0;
  height: 0;
}

.actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

#nickname {
  width: min(360px, 88vw);
  background: rgb(255 255 255 / 8%);
  border: 1px solid rgb(255 255 255 / 22%);
  color: #f6efe2;
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}

#add-wax-btn {
  width: min(280px, 78vw);
  border: none;
  border-radius: 999px;
  padding: 14px 22px;
  color: #1f170f;
  background: var(--accent);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgb(245 197 106 / 35%);
  animation: breath 2s ease-in-out infinite;
}

#add-wax-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  animation: none;
}

.hint {
  font-size: 13px;
  opacity: 0.8;
}

@keyframes flameSwing {
  from {
    transform: translateX(-50%) rotate(-3deg) scale(var(--flame-scale));
  }
  to {
    transform: translateX(-50%) rotate(3deg) scale(calc(var(--flame-scale) * 1.03));
  }
}

@keyframes flameCore {
  from {
    transform: translateX(-50%) scale(0.95);
    opacity: 0.78;
  }
  to {
    transform: translateX(-50%) scale(1.08);
    opacity: 1;
  }
}

@keyframes flameHalo {
  from {
    opacity: 0.55;
  }
  to {
    opacity: 0.85;
  }
}

@keyframes auraPulse {
  from {
    transform: translateX(-50%) scale(0.96);
    opacity: 0.75;
  }
  to {
    transform: translateX(-50%) scale(1.06);
    opacity: 1;
  }
}

@keyframes breath {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}
