/* ===== Tokens：手账纸感 + 二次元清透，避开紫渐变 / 奶油橙红套路 ===== */
:root {
  --paper: #f6faf7;
  --paper-deep: #eef5f0;
  --ink: #243447;
  --ink-soft: #5a6b7d;
  --accent: #ff7b72;
  --accent-2: #3db8c5;
  --washi-pink: #ffc6c1;
  --washi-mint: #9fd8c6;
  --washi-sky: #9ec9e8;
  --tape: rgba(255, 214, 170, 0.72);
  --shadow: 0 18px 50px rgba(36, 52, 71, 0.12);
  --radius: 18px;
  --font-display: "Liu Jian Mao Cao", "ZCOOL XiaoWei", cursive;
  --font-title: "ZCOOL XiaoWei", "Zen Maru Gothic", serif;
  --font-body: "Zen Maru Gothic", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-en: "Caveat", cursive;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(ellipse 80% 60% at 10% 0%, rgba(158, 201, 232, 0.45), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 10%, rgba(255, 198, 193, 0.4), transparent 50%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(159, 216, 198, 0.35), transparent 55%),
    linear-gradient(165deg, #d9ece8 0%, #f3e9ef 45%, #e4f0f6 100%);
  overflow-x: hidden;
}

.paper-grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.starfield {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 22%, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(1.5px 1.5px at 78% 18%, rgba(255, 255, 255, 0.75), transparent),
    radial-gradient(1px 1px at 56% 64%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 30% 78%, rgba(255, 255, 255, 0.65), transparent),
    radial-gradient(1px 1px at 88% 72%, rgba(255, 255, 255, 0.8), transparent);
  animation: twinkle 6s ease-in-out infinite alternate;
}

@keyframes twinkle {
  from {
    opacity: 0.45;
  }
  to {
    opacity: 0.9;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.stage {
  position: relative;
  z-index: 1;
}

/* ===== Music dock ===== */
.music-dock {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
}

.music-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  max-width: min(260px, calc(100vw - 2rem));
  padding: 0.55rem 0.85rem;
  border: 1.5px dashed rgba(36, 52, 71, 0.25);
  border-radius: 999px;
  background: rgba(246, 250, 247, 0.92);
  box-shadow: var(--shadow);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.music-btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent-2);
}

.music-btn[aria-pressed="true"] .music-icon {
  animation: bounce-note 0.9s ease-in-out infinite;
  color: var(--accent);
}

@keyframes bounce-note {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

.music-icon {
  font-size: 1.15rem;
  color: var(--accent-2);
}

.music-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  text-align: left;
}

.music-title {
  font-family: var(--font-en);
  font-size: 1.05rem;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.music-artist {
  font-size: 0.7rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

/* ===== Puzzle cover ===== */
.stage-puzzle {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem 3rem;
}

.journal-cover {
  position: relative;
  width: min(520px, 100%);
  padding: 2.4rem 1.6rem 2rem;
  border-radius: 22px 26px 20px 24px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.55), transparent 40%),
    var(--paper);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.65);
  animation: cover-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes cover-in {
  from {
    opacity: 0;
    transform: translateY(24px) rotate(-1deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.washi {
  position: absolute;
  height: 28px;
  border-radius: 2px;
  opacity: 0.85;
  mix-blend-mode: multiply;
}

.washi-a {
  top: 18px;
  left: -8px;
  width: 46%;
  background: linear-gradient(90deg, var(--washi-mint), var(--washi-sky));
  transform: rotate(-3deg);
}

.washi-b {
  bottom: 36px;
  right: -10px;
  width: 38%;
  background: linear-gradient(90deg, var(--washi-pink), #ffe0b5);
  transform: rotate(4deg);
}

.sticker {
  position: absolute;
  font-size: 1.4rem;
  color: var(--accent-2);
  animation: floaty 4.5s ease-in-out infinite;
}

.star-sticker {
  top: 4.2rem;
  right: 1.2rem;
  color: var(--accent);
}

.heart-sticker {
  bottom: 1.2rem;
  left: 1.1rem;
  animation-delay: 1.2s;
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0) rotate(-6deg);
  }
  50% {
    transform: translateY(-8px) rotate(4deg);
  }
}

.cover-eyebrow {
  margin: 0.4rem 0 0.2rem;
  font-family: var(--font-en);
  font-size: 1.35rem;
  color: var(--accent-2);
  letter-spacing: 0.04em;
}

.cover-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  font-weight: 400;
  line-height: 1.15;
  color: var(--ink);
}

.cover-sub {
  margin: 0.6rem 0 1.2rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.6;
}

.progress-dots {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.progress-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(36, 52, 71, 0.15);
  transition: background 0.3s ease, transform 0.3s ease;
}

.progress-dots span.done {
  background: var(--accent-2);
  transform: scale(1.1);
}

.progress-dots span.current {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 123, 114, 0.2);
}

.puzzle-card {
  position: relative;
  padding: 1.15rem 1rem 1rem;
  border-radius: var(--radius);
  background: var(--paper-deep);
  border: 1.5px solid rgba(36, 52, 71, 0.08);
}

.puzzle-step {
  margin: 0;
  font-family: var(--font-en);
  font-size: 1.15rem;
  color: var(--accent);
}

.puzzle-title {
  margin: 0.15rem 0 0.7rem;
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 400;
}

.puzzle-prompt {
  margin: 0 0 0.5rem;
  white-space: pre-line;
  line-height: 1.7;
  font-size: 0.95rem;
}

.puzzle-hint {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.puzzle-form {
  display: grid;
  gap: 0.7rem;
}

.puzzle-form input,
.reply-form textarea {
  width: 100%;
  padding: 0.8rem 0.95rem;
  border: 1.5px solid rgba(36, 52, 71, 0.15);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  font: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.puzzle-form input:focus,
.reply-form textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(61, 184, 197, 0.15);
}

.btn-ink,
.btn-ghost {
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.btn-ink {
  justify-self: start;
  padding: 0.7rem 1.4rem;
  border: none;
  background: var(--ink);
  color: #f7fbf9;
}

.btn-ink:hover {
  transform: translateY(-1px);
  background: #1a2736;
}

.btn-ghost {
  margin-top: 0.6rem;
  padding: 0.45rem 0.95rem;
  border: 1.5px dashed rgba(36, 52, 71, 0.3);
  background: transparent;
  color: var(--ink);
}

.btn-ghost:hover {
  border-style: solid;
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.puzzle-feedback {
  min-height: 1.25rem;
  margin: 0.7rem 0 0;
  font-size: 0.85rem;
  color: var(--accent);
}

.puzzle-feedback.ok {
  color: #2a9a7c;
}

/* unlock transition */
.stage-puzzle.opening .journal-cover {
  animation: open-book 0.85s ease forwards;
}

@keyframes open-book {
  to {
    opacity: 0;
    transform: translateY(-30px) scale(0.96) rotate(-2deg);
  }
}

/* ===== Journal sheets ===== */
.stage-journal {
  display: grid;
  gap: 1.75rem;
  width: min(720px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 5rem;
}

.sheet {
  position: relative;
  padding: clamp(1.5rem, 4vw, 2.4rem);
  border-radius: 20px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.5), transparent 35%),
    var(--paper);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.sheet.visible {
  opacity: 1;
  transform: none;
}

.tape {
  position: absolute;
  width: 86px;
  height: 22px;
  background: var(--tape);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset;
}

.tape-tl {
  top: 12px;
  left: 18px;
  transform: rotate(-8deg);
}

.tape-br {
  right: 22px;
  bottom: 16px;
  background: rgba(158, 201, 232, 0.65);
  transform: rotate(12deg);
}

.sheet-label {
  margin: 0 0 0.35rem;
  font-family: var(--font-en);
  font-size: 1.25rem;
  color: var(--accent-2);
}

.sheet-title {
  margin: 0 0 0.45rem;
  font-family: var(--font-title);
  font-size: clamp(1.6rem, 4vw, 2rem);
  font-weight: 400;
}

.sheet-lead {
  margin: 0 0 1.4rem;
  color: var(--ink-soft);
  line-height: 1.7;
}

.hero-sheet {
  min-height: min(72vh, 560px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.hero-name {
  margin: 0.4rem 0 0.8rem;
  font-family: var(--font-display);
  font-size: clamp(3rem, 12vw, 4.6rem);
  font-weight: 400;
  line-height: 1.05;
}

.hero-for {
  display: block;
  font-family: var(--font-en);
  font-size: 0.42em;
  color: var(--accent);
  letter-spacing: 0.06em;
}

.hero-line {
  max-width: 18em;
  margin: 0;
  font-size: clamp(1.15rem, 3.2vw, 1.45rem);
  line-height: 1.75;
  animation: line-rise 1s 0.25s ease both;
}

@keyframes line-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero-sign {
  margin-top: 1.6rem;
  font-family: var(--font-en);
  font-size: 1.4rem;
  color: var(--ink-soft);
}

.ink-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 0.35rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
  animation: pulse-dot 2.2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.35);
    opacity: 0.55;
  }
}

.float-deco {
  position: absolute;
  font-size: 1.6rem;
  color: rgba(61, 184, 197, 0.55);
  animation: floaty 5s ease-in-out infinite;
}

.float-star {
  top: 18%;
  right: 12%;
  color: rgba(255, 123, 114, 0.55);
}

.float-note {
  bottom: 18%;
  left: 10%;
  animation-delay: 0.8s;
}

/* Timeline */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.1rem;
}

.timeline-item {
  position: relative;
  padding: 1rem 1rem 1rem 1.15rem;
  border-left: 3px solid var(--washi-mint);
  background: rgba(255, 255, 255, 0.45);
  border-radius: 0 14px 14px 0;
}

.timeline-date {
  margin: 0;
  font-family: var(--font-en);
  font-size: 1.1rem;
  color: var(--accent);
}

.timeline-title {
  margin: 0.1rem 0 0.35rem;
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 400;
}

.timeline-text {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.7;
  font-size: 0.95rem;
}

/* Polaroid details */
.polaroid-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.polaroid {
  padding: 0.85rem 0.85rem 1.1rem;
  background: #fff;
  border-radius: 4px 4px 10px 10px;
  box-shadow: 0 10px 28px rgba(36, 52, 71, 0.1);
  transform: rotate(var(--tilt, -1.5deg));
  transition: transform 0.3s ease;
}

.polaroid:nth-child(even) {
  --tilt: 1.8deg;
}

.polaroid:hover {
  transform: rotate(0deg) translateY(-4px);
}

.polaroid-frame {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  margin-bottom: 0.7rem;
  border-radius: 3px;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.35), transparent),
    var(--wash, linear-gradient(135deg, #c8ebe3, #f7d4d0));
  font-family: var(--font-en);
  font-size: 2rem;
  color: rgba(36, 52, 71, 0.35);
}

.polaroid-frame.has-photo {
  background: #1a222c;
}

.polaroid-frame.has-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.polaroid:nth-child(5) {
  grid-column: 1 / -1;
  max-width: 420px;
  justify-self: center;
  --tilt: -0.8deg;
}

.polaroid:nth-child(1) .polaroid-frame {
  --wash: linear-gradient(135deg, #bfe6df, #e8f4fb);
}
.polaroid:nth-child(2) .polaroid-frame {
  --wash: linear-gradient(135deg, #f8d5d1, #ffe9d4);
}
.polaroid:nth-child(3) .polaroid-frame {
  --wash: linear-gradient(135deg, #d4e8f7, #e4f3ea);
}
.polaroid:nth-child(4) .polaroid-frame {
  --wash: linear-gradient(145deg, #f3e0f0, #d9f0ea);
}

.polaroid-title {
  margin: 0 0 0.25rem;
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 400;
}

.polaroid-text {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

/* CTA */
.cta-message {
  margin: 0 0 1.3rem;
  line-height: 1.8;
  font-size: 1.02rem;
}

.invite-card {
  padding: 1rem 1.1rem;
  margin-bottom: 1.2rem;
  border-radius: 14px;
  background: rgba(158, 201, 232, 0.18);
  border: 1.5px dashed rgba(61, 184, 197, 0.45);
}

.invite-label {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.invite-wechat {
  margin: 0.25rem 0 0;
  font-family: var(--font-title);
  font-size: 1.45rem;
}

.cta-hint {
  margin: 0 0 0.6rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.reply-form {
  display: grid;
  gap: 0.7rem;
}

.reply-saved {
  margin: 0.7rem 0 0;
  color: #2a9a7c;
  font-size: 0.9rem;
}

.reply-saved.is-error {
  color: var(--accent);
}

.journal-end {
  margin-top: 2rem;
  text-align: center;
  font-family: var(--font-en);
  font-size: 1.2rem;
  color: var(--ink-soft);
}

@media (max-width: 560px) {
  .polaroid-grid {
    grid-template-columns: 1fr;
  }

  .journal-cover {
    padding: 2rem 1.15rem 1.5rem;
  }

  .music-dock {
    right: 0.75rem;
    bottom: 0.75rem;
  }
}
