:root {
  --paper: #fff9f2;
  --ink: #352822;
  --muted: #7b675d;
  --rose: #d46f88;
  --rose-dark: #b65069;
  --apricot: #f2b46a;
  --mint: #8db6a0;
  --line: rgba(91, 64, 53, 0.14);
  --shadow: 0 24px 56px rgba(72, 43, 33, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(242, 180, 106, 0.24), transparent 26rem),
    radial-gradient(circle at bottom right, rgba(141, 182, 160, 0.22), transparent 24rem),
    linear-gradient(145deg, #fffaf4 0%, #fff1f2 52%, #f6fbff 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
}

.moments-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.moments-hero,
.moment-card {
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 28px;
  background: rgba(255, 250, 244, 0.76);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.moments-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.8fr);
  gap: 24px;
  padding: clamp(20px, 3.5vw, 34px);
}

.eyebrow,
.card-kicker {
  margin: 0 0 10px;
  color: var(--rose-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  font-family: "ZCOOL XiaoWei", "Noto Sans SC", serif;
  font-weight: 400;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  line-height: 1.04;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
}

.hero-text,
.card-text,
.viewer-hint,
.form-status,
.viewer-meta p,
.composer-summary p {
  color: var(--muted);
  line-height: 1.75;
}

.moments-hero-side {
  display: grid;
  align-content: start;
  gap: 16px;
}

.sync-card,
.identity-field,
.composer-summary,
.reveal-panel,
.empty-state,
.history-item,
.puzzle-stats {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
}

.sync-card {
  display: grid;
  gap: 8px;
  padding: 18px 20px;
}

.sync-card span,
.identity-field span,
.date-badge,
.viewer-meta p,
.history-meta,
.upload-placeholder small {
  font-size: 0.92rem;
}

.sync-card strong {
  font-size: 1.08rem;
}

.sync-card small {
  color: var(--muted);
  line-height: 1.6;
}

.identity-field {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.92rem 1rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  outline: none;
}

textarea {
  min-height: 118px;
  resize: vertical;
}

select:focus,
textarea:focus,
.upload-tile:focus-within,
.soft-button:focus-visible,
.puzzle-piece:focus-visible,
.history-item:focus-visible {
  border-color: rgba(212, 111, 136, 0.56);
  box-shadow: 0 0 0 4px rgba(212, 111, 136, 0.12);
}

.hero-actions,
.composer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.soft-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.82rem 1.15rem;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(135deg, var(--rose-dark), var(--rose));
  box-shadow: 0 14px 28px rgba(182, 80, 105, 0.18);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease;
}

.soft-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px rgba(182, 80, 105, 0.2);
}

.soft-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.soft-button.ghost {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: none;
}

.soft-button.small {
  min-height: 38px;
  padding: 0.62rem 0.94rem;
  font-size: 0.9rem;
}

.moment-layout {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.moment-card {
  padding: clamp(18px, 3vw, 28px);
}

.card-head,
.viewer-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.date-badge {
  flex: 0 0 auto;
  align-self: center;
  padding: 0.55rem 0.9rem;
  color: var(--rose-dark);
  background: rgba(212, 111, 136, 0.12);
  border-radius: 999px;
}

.composer-form {
  display: grid;
  gap: 14px;
}

.slot-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.slot-chip {
  min-height: 44px;
  border: 1px solid rgba(182, 80, 105, 0.18);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.slot-chip:hover {
  transform: translateY(-1px);
}

.slot-chip.is-active {
  color: #fff;
  border-color: rgba(182, 80, 105, 0.18);
  background: linear-gradient(135deg, var(--rose-dark), var(--rose));
  box-shadow:
    0 14px 24px rgba(182, 80, 105, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.upload-tile {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 286px;
  overflow: hidden;
  border: 1px dashed rgba(182, 80, 105, 0.35);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 246, 248, 0.88)),
    radial-gradient(circle at 20% 20%, rgba(242, 180, 106, 0.18), transparent 16rem);
  cursor: pointer;
}

.upload-tile input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-placeholder {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 20px;
  text-align: center;
}

.upload-plus {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  color: #fff;
  font-size: 1.8rem;
  background: linear-gradient(135deg, var(--rose), var(--apricot));
}

#uploadPreview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.note-field {
  display: grid;
  gap: 10px;
}

.composer-summary,
.puzzle-stats,
.empty-state {
  padding: 16px 18px;
}

.composer-summary strong,
.empty-state strong,
#revealTitle {
  display: block;
  margin-bottom: 6px;
}

.form-status {
  min-height: 1.5rem;
  margin: 0;
}

.puzzle-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.72fr);
  gap: 18px;
  margin-top: 12px;
  align-items: start;
}

.puzzle-stage {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 251, 255, 0.88)),
    radial-gradient(circle at top, rgba(242, 180, 106, 0.12), transparent 18rem);
  border: 1px solid var(--line);
  padding: 14px;
}

.puzzle-stage.is-revealed::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 24px;
  border: 1px solid rgba(212, 111, 136, 0.22);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.46) inset,
    0 0 36px rgba(212, 111, 136, 0.16);
  pointer-events: none;
}

.puzzle-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  aspect-ratio: 1;
  transition:
    opacity 320ms ease,
    transform 420ms ease,
    filter 420ms ease;
}

.puzzle-stage.is-revealed .puzzle-board {
  opacity: 0.16;
  transform: scale(0.965);
  filter: blur(2px) saturate(0.92);
}

.puzzle-piece {
  position: relative;
  min-height: 92px;
  border: 0;
  border-radius: 20px;
  background-color: #f5e4df;
  background-repeat: no-repeat;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.75);
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    filter 150ms ease;
}

.puzzle-piece:hover {
  transform: translateY(-1px);
}

.puzzle-piece.is-selected {
  box-shadow:
    inset 0 0 0 2px rgba(182, 80, 105, 0.72),
    0 0 0 5px rgba(212, 111, 136, 0.15);
  filter: saturate(1.08);
}

.puzzle-piece.is-solved {
  pointer-events: none;
}

.heart-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 4;
}

.burst-heart {
  position: absolute;
  left: 50%;
  top: 56%;
  color: rgba(212, 111, 136, 0.85);
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0;
  animation: heartFloat 1700ms ease-out forwards;
}

.stage-reveal {
  position: absolute;
  inset: 14px;
  display: grid;
  align-content: end;
  overflow: hidden;
  border-radius: 24px;
  opacity: 0;
  transform: scale(0.92);
  transition:
    opacity 360ms ease,
    transform 520ms cubic-bezier(0.2, 0.9, 0.25, 1);
  z-index: 3;
}

.puzzle-stage.is-revealed .stage-reveal {
  opacity: 1;
  transform: scale(1);
}

.stage-reveal-glow {
  position: absolute;
  inset: 10% 14%;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 222, 229, 0.88), rgba(255, 222, 229, 0));
  filter: blur(18px);
  opacity: 0;
  transform: scale(0.72);
}

.puzzle-stage.is-revealed .stage-reveal-glow {
  animation: revealGlowPulse 1200ms ease-out both;
}

.stage-reveal img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
}

.puzzle-stage.is-revealed .stage-reveal img {
  animation: stageRevealZoom 1500ms cubic-bezier(0.18, 0.88, 0.28, 1) both;
}

.stage-reveal::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(55, 32, 25, 0.14)),
    radial-gradient(circle at top, rgba(255, 244, 246, 0.14), transparent 56%);
  pointer-events: none;
}

.stage-reveal-copy {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  color: #fff;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(41, 25, 20, 0.16), rgba(41, 25, 20, 0.56));
  backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(16px);
}

.puzzle-stage.is-revealed .stage-reveal-copy {
  animation: revealCopyRise 700ms ease-out 180ms both;
}

.stage-reveal-copy strong {
  font-size: clamp(1rem, 2vw, 1.28rem);
}

.stage-reveal-copy span {
  font-size: 0.92rem;
  color: rgba(255, 247, 248, 0.92);
}

.puzzle-side {
  display: grid;
  gap: 12px;
}

.viewer-meta p {
  margin-bottom: 0;
}

.puzzle-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.completion-card {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.76);
}

.completion-status-list {
  display: grid;
  gap: 10px;
}

.completion-status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.completion-status-item span {
  color: var(--muted);
}

.completion-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0.38rem 0.78rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #9b6a56;
  background: rgba(242, 180, 106, 0.16);
}

.completion-pill.is-done {
  color: #fff;
  background: linear-gradient(135deg, #cf6f82, #e69173);
  box-shadow: 0 10px 18px rgba(207, 111, 130, 0.18);
}

.reveal-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  overflow: hidden;
}

.reveal-photo-shell {
  overflow: hidden;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(212, 111, 136, 0.1), rgba(242, 180, 106, 0.12));
  transform-origin: center center;
}

.reveal-photo-shell img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

#revealTitle {
  font-size: 1.12rem;
}

#revealNote {
  margin-bottom: 0;
}

.reveal-panel.is-active {
  animation: revealRise 520ms ease-out both;
}

.reveal-panel.is-active .reveal-photo-shell {
  animation: revealShellPop 620ms cubic-bezier(0.18, 0.88, 0.28, 1) both;
}

.reveal-panel.is-active .reveal-photo-shell img {
  animation: revealZoom 1500ms ease-out both;
}

.reveal-panel.is-active #revealTitle,
.reveal-panel.is-active #revealNote {
  opacity: 0;
  transform: translateY(12px);
}

.reveal-panel.is-active #revealTitle {
  animation: revealTextRise 560ms ease-out 120ms both;
}

.reveal-panel.is-active #revealNote {
  animation: revealTextRise 620ms ease-out 260ms both;
}

.empty-state {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.history-card {
  margin-top: 18px;
}

.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(184px, 1fr));
  gap: 12px;
}

.history-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.history-select-button {
  display: grid;
  gap: 10px;
  width: 100%;
  padding: 0;
  text-align: left;
  background: transparent;
}

.history-item:hover {
  transform: translateY(-1px);
}

.history-item.is-active {
  border-color: rgba(182, 80, 105, 0.46);
  background: linear-gradient(180deg, rgba(255, 245, 247, 0.98), rgba(255, 255, 255, 0.88));
}

.history-thumb {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 18px;
  object-fit: cover;
  background: linear-gradient(135deg, rgba(212, 111, 136, 0.12), rgba(242, 180, 106, 0.14));
}

.history-thumb-locked {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 18px;
  color: #8f796d;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.3)),
    linear-gradient(135deg, rgba(212, 111, 136, 0.14), rgba(242, 180, 106, 0.18));
}

.history-thumb-locked span {
  font-size: 1rem;
  font-weight: 700;
}

.history-thumb-locked small {
  line-height: 1.6;
  text-align: center;
}

.history-title {
  font-weight: 700;
}

.history-meta,
.history-note {
  color: var(--muted);
}

.history-note {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.6;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.history-delete-button {
  justify-self: start;
  min-height: 36px;
  padding: 0.58rem 0.9rem;
  border: 1px solid rgba(182, 80, 105, 0.16);
  border-radius: 999px;
  color: var(--rose-dark);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.history-delete-button:hover {
  transform: translateY(-1px);
}

@keyframes heartFloat {
  0% {
    opacity: 0;
    transform: translate3d(-50%, 14px, 0) scale(0.7);
  }

  20% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate3d(calc(-50% + var(--drift-x, 0px)), calc(-90px + var(--drift-y, 0px)), 0) scale(1.15);
  }
}

@keyframes revealZoom {
  0% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1.06);
  }
}

@keyframes revealRise {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes revealGlowPulse {
  0% {
    opacity: 0;
    transform: scale(0.72);
  }

  45% {
    opacity: 1;
  }

  100% {
    opacity: 0.62;
    transform: scale(1.14);
  }
}

@keyframes stageRevealZoom {
  0% {
    transform: scale(1.18);
  }

  100% {
    transform: scale(1.05);
  }
}

@keyframes revealCopyRise {
  0% {
    opacity: 0;
    transform: translateY(16px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes revealShellPop {
  0% {
    opacity: 0;
    transform: scale(0.92);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes revealTextRise {
  0% {
    opacity: 0;
    transform: translateY(12px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .moments-hero,
  .moment-layout,
  .puzzle-wrap {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .moments-shell {
    width: min(100%, calc(100% - 16px));
    padding: 12px 0 24px;
  }

  .moments-hero,
  .moment-card {
    border-radius: 22px;
    padding: 16px;
  }

  .upload-tile {
    min-height: 220px;
  }

  .puzzle-stage {
    padding: 10px;
    border-radius: 22px;
  }

  .puzzle-piece {
    min-height: 74px;
    border-radius: 16px;
  }

  .history-list {
    grid-template-columns: 1fr 1fr;
  }
}
