:root {
  --bg: #14110f;
  --surface: #1c1816;
  --fg: #f0ebe3;
  --muted: #b7aea4;
  --border: rgba(240, 235, 227, 0.10);
  --accent: #9c3b3b;
  --accent-fg: #f0ebe3;
  --danger: #c45c4a;
  --success: #7a9a6a;
  --font-display: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  --font-body: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", sans-serif;
  --splash: #ffffff;
  --splash-fg: #14110f;
  --radius: 2px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  overflow: hidden;
}
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

#splash {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--splash);
  color: var(--splash-fg);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 2rem;
  transition: opacity 0.9s ease, visibility 0.9s;
}
#splash.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 8vw, 3.1rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  animation: rise 1s ease both;
}
.splash-sub {
  margin: 0;
  font-size: 0.875rem;
  letter-spacing: 0.22em;
  color: #6f6862;
  animation: rise 1s ease 0.2s both;
}
.splash-bar {
  width: 112px;
  height: 1px;
  margin: 2rem auto 0;
  background: #e8e2da;
  overflow: hidden;
}
.splash-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--splash-fg);
  animation: bar 2.2s ease forwards;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes bar { to { width: 100%; } }

#candle-gate {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: #14110f;
  color: var(--fg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 2rem 1.25rem 3rem;
  text-align: center;
  transition: opacity 0.7s ease, visibility 0.7s;
}
#candle-gate.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.candle-kicker {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  color: var(--muted);
}
.candle-title {
  margin: 0.35rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.candle-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.candle-hit {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 1.25rem;
  cursor: pointer;
}
.candle-svg {
  display: block;
  overflow: visible;
  filter: drop-shadow(0 0 14px rgba(224, 138, 60, 0.35));
}
.flame-g {
  transform-origin: 40px 46px;
  animation: flicker 0.9s ease-in-out infinite;
}
@keyframes flicker {
  0%, 100% { transform: scale(1) rotate(-2deg); }
  40% { transform: scale(1.08, 0.94) rotate(3deg); }
  70% { transform: scale(0.94, 1.06) rotate(-1deg); }
}
#candle-gate.is-out .flame-g {
  animation: none;
  opacity: 0;
  transform: scale(0.2);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
#candle-gate.is-out .candle-svg {
  filter: none;
}

.overlay {
  position: relative;
  z-index: 2;
  min-height: 100%;
}
.hero-carousel {
  position: absolute;
  left: 50%;
  top: auto;
  bottom: calc(54% + clamp(2.7rem, 6vw, 3.9rem));
  transform: translateX(-50%);
  width: min(92%, 20em);
  height: auto;
  overflow: hidden;
  background: transparent;
  z-index: 3;
}
.hero-slide {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}
.hero-slide.is-on {
  position: relative;
  opacity: 1;
  pointer-events: auto;
}
.hero-slide img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: var(--carousel-h, 280px);
  margin: 0 auto;
  object-fit: contain;
}
.hero-title {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  width: min(92%, 20em);
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 8.5vw, 4.25rem);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.03em;
  text-align: center;
  text-shadow: 0 2px 18px rgba(20, 17, 15, 0.8);
}
.end-copy {
  position: absolute;
  left: 50%;
  top: calc(46% + clamp(2.8rem, 7vw, 4.2rem));
  transform: translateX(-50%);
  width: min(92%, 28rem);
  text-align: center;
}
.sign {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.closing {
  margin: 0.5rem 0 0;
  font-size: clamp(1rem, 3.4vw, 1.25rem);
  line-height: 1.55;
  color: var(--fg);
}
.lyric-box {
  position: absolute;
  left: 50%;
  top: calc(46% + clamp(6.2rem, 14vw, 8.5rem));
  transform: translateX(-50%);
  width: min(92%, 28rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-align: center;
}
.lyric-prev,
.lyric-next {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  opacity: 0.7;
}
.lyric-now {
  margin: 0;
  font-size: clamp(1rem, 3.4vw, 1.25rem);
  line-height: 1.55;
  color: var(--fg);
}
.lyric-now.is-on {
  color: #f6efe6;
}

#stage {
  position: fixed;
  inset: 0;
}
#cakes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.music {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 32;
  min-height: 44px;
  padding: 0 0.9rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font: 500 0.8125rem/1 var(--font-body);
  cursor: pointer;
  border-radius: var(--radius);
}
.music[aria-pressed="true"] { border-color: var(--accent); }

.wishes-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  padding: 0.75rem 1rem 1rem;
  background: linear-gradient(transparent, var(--bg) 40%);
}
.wishes-wrap form {
  display: flex;
  gap: 0.5rem;
  max-width: 36em;
  margin: 0 auto;
}
.wishes-wrap input {
  flex: 1;
  min-height: 44px;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 0.8rem;
  font: 400 0.95rem/1.4 var(--font-body);
}
.wishes-wrap button {
  min-height: 44px;
  padding: 0 1.1rem;
  background: var(--accent);
  color: var(--accent-fg);
  border: 0;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
}
.wishes-wrap .hint { margin: 0.35rem auto 0; max-width: 36em; font-size: 0.75rem; color: var(--muted); text-align: center; }
.wishes-wrap .error { color: var(--danger); }
.wishes-wrap .ok { color: var(--success); }

.photos {
  display: none;
}


@media (prefers-reduced-motion: reduce) {
  #splash, .splash-title, .splash-sub, .splash-bar i, .flame-g {
    animation: none !important;
    opacity: 1;
  }
}
