:root {
  color-scheme: light;
  --page: #fff6f2;
  --paper: rgba(255, 252, 246, 0.94);
  --paper-strong: #fffdf8;
  --paper-soft: rgba(255, 247, 240, 0.86);
  --line: rgba(188, 139, 86, 0.24);
  --line-rose: rgba(224, 118, 148, 0.18);
  --ink: #4c302e;
  --muted: #8d7068;
  --rose: #ee718a;
  --rose-deep: #c75572;
  --gold: #c99b5c;
  --green: #798a69;
  --shadow: 0 24px 58px rgba(159, 100, 82, 0.14);
  --soft-shadow: 0 14px 34px rgba(181, 112, 118, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 223, 228, 0.8), transparent 20rem),
    radial-gradient(circle at 100% 18%, rgba(241, 219, 169, 0.54), transparent 18rem),
    linear-gradient(180deg, #ffe8ee 0%, #fff7f1 34%, #fffdf9 100%);
  color: var(--ink);
}

body {
  min-height: 100dvh;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.viewer-shell {
  width: min(100%, 820px);
  margin: 0 auto;
  padding: 16px 16px 34px;
}

body[data-viewer-stage="content"] .viewer-shell {
  padding: 0 0 36px;
}

.viewer-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0 18px;
  background: linear-gradient(180deg, rgba(255, 246, 248, 0.94), rgba(255, 246, 248, 0.68), transparent);
  backdrop-filter: blur(14px);
}

body[data-viewer-stage="content"] .viewer-topbar {
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  margin: 0 18px -78px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 18px;
  background: rgba(255, 250, 246, 0.76);
  box-shadow: 0 14px 34px rgba(94, 58, 45, 0.1);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-icon {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--rose-deep);
  box-shadow: 0 10px 22px rgba(214, 112, 145, 0.12);
}

body[data-viewer-stage="content"] .brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.brand-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 20px;
  line-height: 1.2;
}

body[data-viewer-stage="content"] .brand strong {
  font-size: 16px;
}

.brand small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

body[data-viewer-stage="content"] .brand small {
  margin-top: 2px;
  font-size: 11px;
}

.bgm-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(255, 112, 150, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--rose-deep);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 10px 20px rgba(210, 113, 146, 0.1);
}

body[data-viewer-stage="content"] .bgm-toggle {
  min-height: 40px;
  padding: 0 14px;
}

.bgm-toggle.is-on {
  border-color: transparent;
  background: linear-gradient(135deg, #ff8ea5, #e86684);
  color: #fff;
}

.bgm-toggle svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.viewer-main {
  display: grid;
  gap: 20px;
}

body[data-viewer-stage="content"] .viewer-main {
  gap: 0;
}

.error-card,
.landing-card {
  border: 1px solid var(--line-rose);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 32px 24px;
  text-align: center;
}

.error-card h1,
.landing-card h1 {
  margin: 10px 0 0;
  font-size: clamp(34px, 9vw, 64px);
  line-height: 1.05;
}

.landing-kicker,
.article-kicker,
.micro-label {
  margin: 0;
  color: var(--rose-deep);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.5px;
}

.landing-card p:not(.landing-kicker):not(.landing-tip) {
  margin: 14px auto 0;
  max-width: 18em;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.85;
}

.date-entry {
  display: grid;
  gap: 10px;
  margin-top: 26px;
  text-align: left;
}

.date-entry span {
  font-size: 13px;
  font-weight: 850;
}

.date-entry input {
  width: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  text-align: center;
  letter-spacing: 8px;
  color: var(--ink);
  font-size: 30px;
  font-weight: 900;
  outline: 0;
}

.date-entry input:focus {
  border-color: rgba(238, 113, 138, 0.52);
  box-shadow: 0 0 0 4px rgba(238, 113, 138, 0.12);
}

.primary-button,
.voice-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  background: linear-gradient(135deg, #f491a3, #e56584);
  color: #fff;
  box-shadow: 0 18px 32px rgba(213, 101, 128, 0.22);
}

.primary-button {
  width: 100%;
  min-height: 60px;
  margin-top: 18px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 900;
}

.landing-tip {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.article {
  display: grid;
  gap: 26px;
  overflow: hidden;
  border-radius: 0 0 34px 34px;
}

.celebration-hero {
  position: relative;
  min-height: clamp(640px, 92svh, 820px);
  overflow: hidden;
  border-radius: 0 0 34px 34px;
  background: #f9e9de;
  box-shadow: var(--shadow);
}

.hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(1.01);
}

.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 250, 241, 0.88) 0%, rgba(255, 247, 238, 0.62) 34%, rgba(255, 246, 242, 0.06) 70%),
    linear-gradient(180deg, rgba(73, 45, 38, 0.05) 0%, rgba(73, 45, 38, 0.08) 48%, rgba(73, 45, 38, 0.28) 100%);
}

.hero-copy {
  position: absolute;
  left: clamp(28px, 8vw, 76px);
  top: clamp(138px, 23svh, 206px);
  z-index: 1;
  width: min(68%, 520px);
  color: var(--ink);
}

.hero-copy h1 {
  margin: 0;
  font-family: "Songti SC", "SimSun", "STSong", serif;
  font-size: clamp(44px, 11vw, 78px);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: 0;
  text-shadow: 0 1px 16px rgba(255, 255, 255, 0.66);
}

.hero-copy p {
  margin: 20px 0 0;
  max-width: 18em;
  color: #6f4b45;
  font-size: clamp(16px, 4.4vw, 22px);
  line-height: 1.7;
  font-weight: 700;
  text-shadow: 0 1px 14px rgba(255, 255, 255, 0.72);
}

.hero-scroll {
  position: absolute;
  left: 50%;
  bottom: 78px;
  z-index: 1;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.95);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-shadow: 0 4px 14px rgba(67, 37, 34, 0.32);
}

.hero-scroll::after {
  content: "";
  display: block;
  width: 15px;
  height: 15px;
  margin: 9px auto 0;
  border-right: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  transform: rotate(45deg);
  animation: floatArrow 1.4s ease-in-out infinite;
}

.blessing-info {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: -58px 26px 20px;
  border: 1px solid rgba(204, 158, 93, 0.35);
  border-radius: 24px;
  background:
    radial-gradient(circle at 0 100%, rgba(244, 170, 180, 0.16), transparent 9rem),
    radial-gradient(circle at 100% 0, rgba(224, 194, 131, 0.15), transparent 10rem),
    linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(255, 247, 240, 0.92));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.blessing-info div {
  display: grid;
  gap: 8px;
  min-height: 106px;
  align-content: center;
  justify-items: center;
  padding: 18px 12px;
  text-align: center;
}

.blessing-info div + div {
  border-left: 1px dashed rgba(205, 152, 89, 0.38);
}

.blessing-info span {
  color: var(--rose-deep);
  font-size: 12px;
  font-weight: 850;
}

.blessing-info strong {
  color: var(--ink);
  font-family: "Songti SC", "SimSun", "STSong", serif;
  font-size: clamp(18px, 4.8vw, 28px);
  font-weight: 600;
  line-height: 1.2;
}

.memory-section {
  padding: 20px 0 2px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 28px;
}

.section-title-row > div {
  min-width: 0;
}

.section-title-row h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(24px, 6vw, 34px);
  line-height: 1.2;
}

.section-title-row h2::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #fff 0 2px, transparent 3px),
    linear-gradient(135deg, #f5a3b3, #df7188);
  vertical-align: 0.06em;
}

.section-title-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.section-title-row p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.memory-frame {
  position: relative;
}

.memory-rail {
  --slide: min(48vw, 190px);
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 24px calc((100% - var(--slide)) / 2) 18px;
  scroll-padding-inline: calc((100% - var(--slide)) / 2);
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
  scrollbar-width: none;
}

.memory-rail.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

.memory-rail::-webkit-scrollbar {
  display: none;
}

.memory-slide {
  position: relative;
  flex: 0 0 var(--slide);
  scroll-snap-align: center;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 18px;
  background: #fffaf5;
  box-shadow: 0 16px 32px rgba(116, 73, 54, 0.14);
  transition: transform 0.24s ease, box-shadow 0.24s ease;
}

.memory-slide.is-featured {
  transform: translateY(-6px) scale(1.06);
  box-shadow: 0 20px 38px rgba(116, 73, 54, 0.2);
}

.memory-slide img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center;
}

.memory-slide p {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  margin: 0;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 250, 245, 0.84);
  color: #68453e;
  font-size: 12px;
  font-weight: 850;
  text-align: center;
  backdrop-filter: blur(10px);
}

.memory-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  min-height: 10px;
}

.memory-dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(194, 156, 126, 0.26);
}

.memory-dots .is-active {
  width: 18px;
  background: linear-gradient(90deg, #f590a1, #df6e86);
}

.memory-nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  transform: translateY(-50%);
  border: 1px solid rgba(204, 158, 93, 0.28);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.92);
  color: var(--rose-deep);
  box-shadow: 0 14px 30px rgba(116, 73, 54, 0.16);
  font-size: 30px;
  line-height: 1;
  font-weight: 700;
}

.memory-prev {
  left: 16px;
}

.memory-next {
  right: 16px;
}

.memory-nav:disabled {
  opacity: 0.32;
  cursor: default;
}

.story-stream {
  display: grid;
  gap: 14px;
  padding: 24px 24px 0;
}

.chapter-card {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  align-items: stretch;
  min-height: 170px;
  overflow: hidden;
  border: 1px solid rgba(204, 158, 93, 0.28);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.96), rgba(255, 248, 242, 0.92));
  box-shadow: var(--soft-shadow);
}

.chapter-card.is-reverse {
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
}

.chapter-card.is-reverse .chapter-image {
  order: 2;
}

.chapter-image {
  min-height: 170px;
}

.chapter-image img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 170px;
  object-fit: cover;
  object-position: center;
}

.chapter-copy {
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 24px;
}

.chapter-copy h3 {
  margin: 0;
  font-family: "Songti SC", "SimSun", "STSong", serif;
  color: #5c3c36;
  font-size: clamp(24px, 6vw, 34px);
  font-weight: 600;
  line-height: 1.2;
}

.chapter-copy h3::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--rose);
  vertical-align: 0.22em;
}

.chapter-main {
  margin: 0;
  color: #6a4a42;
  font-size: 15px;
  line-height: 1.8;
  font-weight: 700;
}

.chapter-sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
}

.voice-card,
.letter-card {
  margin: 2px 24px 0;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: var(--soft-shadow);
}

.voice-card {
  display: grid;
  grid-template-columns: 58px 1fr 58px;
  gap: 14px;
  align-items: center;
  padding: 20px;
}

.voice-card-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.78), transparent 0 32%),
    linear-gradient(135deg, #f59aaa, #c95772);
  color: #fff;
}

.voice-card-icon svg,
.voice-button svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.voice-card-body h3 {
  margin: 4px 0 6px;
  font-size: 18px;
  line-height: 1.35;
}

.voice-card-body p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.voice-button {
  width: 58px;
  height: 58px;
  border-radius: 50%;
}

.waveform {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  margin-top: 4px;
}

.waveform span {
  width: 100%;
  height: var(--h, 16px);
  border-radius: 999px;
  background: linear-gradient(180deg, #ed6f89, #f4aa8c);
  opacity: 0.78;
  transform-origin: center;
}

.waveform span:nth-child(1) { --h: 12px; }
.waveform span:nth-child(2) { --h: 22px; }
.waveform span:nth-child(3) { --h: 16px; }
.waveform span:nth-child(4) { --h: 28px; }
.waveform span:nth-child(5) { --h: 18px; }
.waveform span:nth-child(6) { --h: 24px; }
.waveform span:nth-child(7) { --h: 14px; }

.is-playing .waveform span {
  animation: wave 0.86s ease-in-out infinite alternate;
}

.letter-card {
  position: relative;
  width: min(calc(100% - 48px), 720px);
  margin: 6px auto 16px;
  padding: 32px 30px 28px;
  overflow: hidden;
  border-color: rgba(204, 158, 93, 0.3);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(255, 245, 247, 0.76), rgba(255, 255, 255, 0) 44%),
    linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(255, 247, 238, 0.94));
}

.letter-card::before,
.letter-card::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(204, 158, 93, 0.32);
  pointer-events: none;
}

.letter-card::before {
  inset: 12px;
  border-radius: 22px;
}

.letter-card::after {
  display: none;
}

.letter-card h2 {
  position: relative;
  z-index: 1;
  max-width: 11em;
  margin: 0 auto 18px;
  color: #5a403a;
  font-family: "Songti SC", "SimSun", "STSong", serif;
  font-size: clamp(32px, 8vw, 48px);
  font-weight: 600;
  line-height: 1.18;
  text-align: center;
  overflow-wrap: anywhere;
}

.letter-card .micro-label {
  position: relative;
  z-index: 1;
  width: fit-content;
  margin: 0 auto 14px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 239, 243, 0.78);
  text-align: center;
  letter-spacing: 0;
}

.letter-body {
  position: relative;
  z-index: 1;
  width: min(100%, 34em);
  margin: 0 auto;
  padding: 22px 22px 20px;
  border: 1px solid rgba(204, 158, 93, 0.18);
  border-radius: 20px;
  background: rgba(255, 252, 247, 0.7);
  color: #5a4741;
  font-size: clamp(15px, 4vw, 17px);
  line-height: 1.9;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-line;
}

.signature {
  position: relative;
  z-index: 1;
  width: min(100%, 34em);
  margin: 16px auto 0;
  padding: 0 4px;
  border-top: 0;
  text-align: right;
  color: #5a4741;
  font-size: 15px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.opening-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  background: #1d1115;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.opening-overlay.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.opening-overlay.is-leaving {
  opacity: 0;
  visibility: hidden;
}

.opening-slides,
.opening-scrim {
  position: absolute;
  inset: 0;
}

.opening-slide {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  opacity: 0;
  transform: scale(1.08);
  transition: opacity 1.2s ease, transform 5.8s ease;
}

.opening-slide.is-active {
  opacity: 1;
  transform: scale(1.02);
}

.opening-scrim {
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 223, 233, 0.18), transparent 28rem),
    linear-gradient(180deg, rgba(23, 11, 15, 0.3), rgba(23, 11, 15, 0.64) 38%, rgba(23, 11, 15, 0.86));
}

.opening-content {
  position: relative;
  z-index: 1;
  width: min(100%, 460px);
  text-align: center;
  color: #fff;
}

.opening-kicker {
  margin: 0;
  color: rgba(255, 233, 240, 0.86);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 4px;
  opacity: 0.9;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.opening-name {
  margin: 18px 0 10px;
  font-size: clamp(34px, 10vw, 58px);
  line-height: 1.12;
  font-weight: 900;
  letter-spacing: 2px;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.55s ease, transform 0.7s ease;
}

.opening-words {
  display: grid;
  gap: 12px;
  min-height: 156px;
  margin-top: 18px;
  align-content: center;
}

.opening-word {
  margin: 0;
  font-size: clamp(32px, 10vw, 58px);
  line-height: 1.08;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff7fa;
  text-shadow: 0 10px 34px rgba(0, 0, 0, 0.26);
}

.opening-word-secondary {
  font-size: clamp(38px, 12vw, 68px);
}

.opening-word span {
  display: inline-block;
  min-width: 1em;
  opacity: 0;
  transform: translateY(24px) scale(0.88);
  filter: blur(8px);
}

.opening-overlay[data-phase="wish1"] .opening-word span,
.opening-overlay[data-phase="wish2"] .opening-word span,
.opening-overlay[data-phase="countdown"] #openingWishOne span {
  animation: openingCharIn 0.72s cubic-bezier(.2,.8,.2,1) forwards;
}

.opening-overlay[data-phase="wish1"] .opening-word span:nth-child(2),
.opening-overlay[data-phase="wish2"] .opening-word span:nth-child(2),
.opening-overlay[data-phase="countdown"] #openingWishOne span:nth-child(2) {
  animation-delay: 0.08s;
}

.opening-overlay[data-phase="wish1"] .opening-word span:nth-child(3),
.opening-overlay[data-phase="wish2"] .opening-word span:nth-child(3),
.opening-overlay[data-phase="countdown"] #openingWishOne span:nth-child(3) {
  animation-delay: 0.16s;
}

.opening-overlay[data-phase="wish1"] .opening-word span:nth-child(4),
.opening-overlay[data-phase="wish2"] .opening-word span:nth-child(4),
.opening-overlay[data-phase="countdown"] #openingWishOne span:nth-child(4) {
  animation-delay: 0.24s;
}

.opening-message {
  margin: 6px 0 0;
  font-size: clamp(18px, 5vw, 26px);
  line-height: 1.6;
  color: rgba(255, 245, 248, 0.96);
  font-weight: 600;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.opening-countdown {
  position: relative;
  display: grid;
  gap: 8px;
  width: fit-content;
  min-width: 124px;
  margin: 34px auto 0;
  padding: 16px 18px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(24px) scale(0.95);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.opening-countdown::before {
  content: "";
  width: 18px;
  height: 58px;
  margin: 0 auto -6px;
  border-radius: 10px 10px 4px 4px;
  background:
    radial-gradient(circle at 50% -7px, #fff9b8 0 8px, #ffb764 9px 15px, transparent 16px),
    repeating-linear-gradient(135deg, #fff4f1 0 8px, #ff8ea4 9px 16px);
  box-shadow: 0 0 24px rgba(255, 209, 124, 0.9);
  animation: candleGlow 1.1s ease-in-out infinite alternate;
}

.opening-countdown::after {
  content: "";
  position: absolute;
  inset: -18px;
  z-index: -1;
  border-radius: 32px;
  background:
    radial-gradient(circle at 25% 28%, rgba(255, 240, 177, 0.55), transparent 0.35rem),
    radial-gradient(circle at 70% 18%, rgba(255, 210, 226, 0.5), transparent 0.3rem),
    radial-gradient(circle at 78% 78%, rgba(255, 245, 210, 0.5), transparent 0.28rem),
    radial-gradient(circle at 35% 82%, rgba(255, 198, 218, 0.45), transparent 0.28rem);
  animation: countdownSparkle 1.6s ease-in-out infinite alternate;
}

.opening-count {
  font-size: clamp(40px, 12vw, 72px);
  line-height: 1;
  font-weight: 900;
}

.opening-countdown small {
  color: rgba(255, 237, 242, 0.86);
  font-size: 12px;
  letter-spacing: 1px;
}

.opening-overlay[data-phase="intro"] .opening-name,
.opening-overlay[data-phase="ready"] .opening-name {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.opening-overlay[data-phase="intro"] .opening-message,
.opening-overlay[data-phase="ready"] .opening-message,
.opening-overlay[data-phase="wish1"] .opening-message,
.opening-overlay[data-phase="wish2"] .opening-message,
.opening-overlay[data-phase="countdown"] .opening-message {
  opacity: 1;
  transform: translateY(0);
}

.opening-overlay[data-phase="countdown"] .opening-countdown {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.opening-overlay[data-phase="countdown"] .opening-count {
  animation: openingCountPop 1.15s cubic-bezier(.2,.8,.2,1);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 50;
  width: min(calc(100vw - 32px), 420px);
  padding: 14px 16px;
  transform: translate(-50%, 18px);
  border-radius: 16px;
  background: rgba(66, 45, 52, 0.94);
  color: #fff;
  font-size: 14px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes wave {
  from { transform: scaleY(0.7); opacity: 0.55; }
  to { transform: scaleY(1.08); opacity: 0.95; }
}

@keyframes floatArrow {
  0%, 100% { transform: translateY(0) rotate(45deg); opacity: 0.88; }
  50% { transform: translateY(6px) rotate(45deg); opacity: 1; }
}

@keyframes openingCharIn {
  0% {
    opacity: 0;
    transform: translateY(24px) scale(0.88);
    filter: blur(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes openingCountPop {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.72);
    filter: blur(8px);
  }
  45% {
    opacity: 1;
    transform: translateY(0) scale(1.14);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes candleGlow {
  from {
    filter: drop-shadow(0 0 8px rgba(255, 222, 140, 0.65));
    transform: translateY(1px);
  }
  to {
    filter: drop-shadow(0 0 18px rgba(255, 222, 140, 0.95));
    transform: translateY(-1px);
  }
}

@keyframes countdownSparkle {
  from {
    opacity: 0.55;
    transform: scale(0.96) rotate(-2deg);
  }
  to {
    opacity: 1;
    transform: scale(1.02) rotate(2deg);
  }
}

@media (max-width: 720px) {
  .viewer-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  body[data-viewer-stage="content"] .viewer-topbar {
    align-items: center;
    flex-direction: row;
    gap: 10px;
    margin: 0 12px -72px;
  }

  .bgm-toggle span {
    max-width: 6.8em;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .celebration-hero {
    min-height: 92svh;
  }

  .hero-copy {
    top: clamp(134px, 22svh, 188px);
    width: min(78%, 420px);
  }

  .hero-shade {
    background:
      linear-gradient(90deg, rgba(255, 250, 241, 0.9) 0%, rgba(255, 247, 238, 0.58) 47%, rgba(255, 246, 242, 0.04) 100%),
      linear-gradient(180deg, rgba(73, 45, 38, 0.02) 0%, rgba(73, 45, 38, 0.08) 50%, rgba(73, 45, 38, 0.3) 100%);
  }

  .blessing-info {
    margin-inline: 18px;
  }

  .story-stream {
    padding-inline: 18px;
  }

  .chapter-card,
  .chapter-card.is-reverse {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  }

  .chapter-card.is-reverse .chapter-image {
    order: initial;
  }

  .chapter-copy {
    padding: 18px;
  }

  .voice-card {
    grid-template-columns: 56px 1fr;
    margin-inline: 18px;
  }

  .voice-button {
    grid-column: 1 / -1;
    justify-self: center;
  }

  .letter-card {
    width: calc(100% - 36px);
    padding: 28px 22px 24px;
  }
}

@media (max-width: 440px) {
  body[data-viewer-stage="content"] .viewer-topbar {
    padding: 8px 9px;
    border-radius: 16px;
  }

  body[data-viewer-stage="content"] .brand {
    gap: 8px;
  }

  body[data-viewer-stage="content"] .brand-icon {
    width: 36px;
    height: 36px;
  }

  body[data-viewer-stage="content"] .brand strong {
    font-size: 15px;
  }

  body[data-viewer-stage="content"] .brand small {
    font-size: 10px;
  }

  body[data-viewer-stage="content"] .bgm-toggle {
    min-height: 36px;
    padding: 0 10px;
    font-size: 12px;
  }

  .hero-copy h1 {
    font-size: clamp(40px, 12vw, 52px);
  }

  .blessing-info {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: -52px;
  }

  .blessing-info div {
    min-height: 92px;
    padding: 14px 8px;
  }

  .blessing-info strong {
    font-size: clamp(16px, 4.6vw, 22px);
  }

  .chapter-card,
  .chapter-card.is-reverse {
    grid-template-columns: 1fr;
  }

  .chapter-image {
    min-height: 150px;
  }

  .chapter-image img {
    min-height: 150px;
    aspect-ratio: 16 / 8.6;
  }

  .memory-nav {
    width: 38px;
    height: 38px;
    font-size: 27px;
  }

  .memory-prev {
    left: 10px;
  }

  .memory-next {
    right: 10px;
  }

  .letter-card {
    width: calc(100% - 28px);
    padding: 26px 16px 22px;
    border-radius: 24px;
  }

  .letter-card::before {
    inset: 8px;
    border-radius: 18px;
  }

  .letter-body {
    padding: 18px 16px;
    font-size: 15.5px;
    line-height: 1.85;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
