:root {
  color-scheme: dark;
  --ink: #fff8f0;
  --muted: rgba(255, 248, 240, 0.74);
  --soft: rgba(255, 248, 240, 0.14);
  --line: rgba(255, 248, 240, 0.2);
  --rose: #ff4d74;
  --coral: #ff8f6b;
  --gold: #ffd175;
  --plum: #241124;
  --teal: #7de3d3;
  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 {
  min-height: 100%;
  background: #0f1021;
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 78% 12%, rgba(125, 227, 211, 0.22), transparent 28rem),
    radial-gradient(circle at 16% 18%, rgba(255, 209, 117, 0.18), transparent 24rem),
    linear-gradient(135deg, #111629 0%, #321b3c 46%, #743557 100%);
}

button {
  font: inherit;
}

#love-sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  min-height: 88svh;
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(320px, 1.05fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
  padding: 46px 0 28px;
}

.visual-panel {
  position: relative;
  min-height: 570px;
}

.photo-stage {
  position: relative;
  display: block;
  width: min(100%, 510px);
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 34px 80px rgba(18, 7, 28, 0.5);
  transform: rotate(-1.5deg);
}

.photo-stage img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  transition:
    opacity 180ms ease,
    transform 420ms ease;
}

.photo-stage:hover img {
  transform: scale(1.025);
}

.photo-count {
  position: absolute;
  right: 16px;
  bottom: 16px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(12, 8, 24, 0.54);
  backdrop-filter: blur(10px);
  font-size: 0.82rem;
  font-weight: 900;
}

.photo-tools {
  position: absolute;
  top: 42%;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.icon-btn {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(12, 8, 24, 0.48);
  box-shadow: 0 14px 28px rgba(13, 7, 24, 0.25);
  backdrop-filter: blur(10px);
  cursor: pointer;
  font-size: 2rem;
  line-height: 1;
  pointer-events: auto;
}

.film-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 560px);
  margin: 22px auto 0;
}

.film-thumb {
  position: relative;
  height: 64px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--soft);
  cursor: pointer;
}

.film-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.film-thumb.is-active {
  border-color: var(--gold);
}

.film-thumb:nth-child(n + 15) {
  display: none;
}

.confession {
  width: 100%;
}

.date {
  margin: 0 0 18px;
  color: var(--gold);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 9.2ch;
  font-size: clamp(2.85rem, 7.2vw, 6.2rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.lead {
  max-width: 560px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.2vw, 1.28rem);
  line-height: 1.8;
}

.letter {
  min-height: 214px;
  max-width: 640px;
  margin: 34px 0 0;
  padding: clamp(22px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 70px rgba(12, 7, 26, 0.28);
  backdrop-filter: blur(16px);
}

.letter p {
  min-height: 88px;
  margin: 0;
  color: rgba(255, 252, 246, 0.94);
  font-size: clamp(1.06rem, 2.1vw, 1.22rem);
  line-height: 1.9;
}

.caret {
  display: inline-block;
  width: 2px;
  height: 1.2em;
  margin-left: 4px;
  vertical-align: -0.18em;
  background: var(--gold);
  animation: blink 0.9s steps(1) infinite;
}

.actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  min-height: 72px;
  margin-top: 26px;
}

.primary-btn,
.ghost-btn,
.close-btn {
  border: 0;
  cursor: pointer;
}

.primary-btn,
.ghost-btn {
  min-width: 138px;
  min-height: 50px;
  border-radius: 999px;
  font-weight: 800;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.primary-btn {
  color: #2b1223;
  background: linear-gradient(135deg, var(--gold), var(--coral) 52%, #ff5f81);
  box-shadow: 0 18px 34px rgba(255, 95, 129, 0.3);
}

.ghost-btn {
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.11);
  backdrop-filter: blur(12px);
}

.primary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-2px);
}

.primary-btn:focus-visible,
.ghost-btn:focus-visible,
.close-btn:focus-visible,
.icon-btn:focus-visible,
.film-thumb:focus-visible,
.photo-stage:focus-visible,
.gallery-card:focus-visible,
.lightbox-close:focus-visible,
.lightbox-nav:focus-visible {
  outline: 3px solid rgba(125, 227, 211, 0.8);
  outline-offset: 3px;
}

.ghost-btn.is-running {
  position: absolute;
  z-index: 2;
}

.reply-section {
  padding: 18px 0 48px;
}

.reply-section h2 {
  max-width: 760px;
  margin: 0 0 22px;
  font-size: clamp(2rem, 5vw, 4.5rem);
  line-height: 1.04;
  letter-spacing: 0;
}

.reply-letter {
  max-width: 900px;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
  box-shadow: 0 24px 80px rgba(12, 7, 26, 0.24);
  backdrop-filter: blur(16px);
}

.reply-letter p {
  margin: 0;
  color: rgba(255, 252, 246, 0.9);
  font-size: clamp(1rem, 2vw, 1.14rem);
  line-height: 2;
}

.reply-letter p + p {
  margin-top: 18px;
}

.moments {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 0 0 48px;
}

.moment {
  min-height: 148px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
}

.moment span {
  display: block;
  color: var(--teal);
  font-size: 1.45rem;
  font-weight: 900;
}

.moment p {
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.gallery-section {
  padding: 8px 0 70px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 22px;
}

.section-heading .date {
  margin-bottom: 10px;
}

.section-heading h2 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.gallery-card {
  position: relative;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.gallery-card img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  transition:
    filter 180ms ease,
    transform 220ms ease;
}

.gallery-card:hover img {
  filter: saturate(1.08) brightness(1.04);
  transform: scale(1.035);
}

.gallery-card span {
  position: absolute;
  left: 10px;
  bottom: 10px;
  min-width: 40px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(12, 8, 24, 0.54);
  backdrop-filter: blur(8px);
  font-size: 0.78rem;
  font-weight: 900;
}

.answer {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 24px;
  visibility: hidden;
  opacity: 0;
  background: rgba(8, 6, 16, 0.58);
  backdrop-filter: blur(12px);
  transition:
    opacity 220ms ease,
    visibility 220ms ease;
}

.answer.is-open {
  visibility: visible;
  opacity: 1;
}

.answer-dialog {
  position: relative;
  width: min(520px, 100%);
  padding: clamp(28px, 5vw, 44px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  color: #321428;
  background: linear-gradient(135deg, #fff9ef, #ffd3c2);
  box-shadow: 0 36px 90px rgba(7, 2, 15, 0.45);
}

.answer-kicker {
  margin: 0 0 10px;
  color: #e24365;
  font-weight: 900;
}

.answer-dialog h2 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 3rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.answer-dialog p:not(.answer-kicker) {
  margin: 18px 0 26px;
  color: rgba(50, 20, 40, 0.78);
  line-height: 1.75;
}

.compact {
  min-width: 124px;
}

.close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: rgba(50, 20, 40, 0.72);
  background: rgba(255, 255, 255, 0.54);
  font-size: 1.45rem;
  line-height: 1;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 22px;
  visibility: hidden;
  opacity: 0;
  background: rgba(6, 5, 12, 0.82);
  backdrop-filter: blur(16px);
  transition:
    opacity 200ms ease,
    visibility 200ms ease;
}

.lightbox.is-open {
  visibility: visible;
  opacity: 1;
}

.lightbox-dialog {
  position: relative;
  display: grid;
  place-items: center;
  width: min(860px, 100%);
}

.lightbox-dialog img {
  display: block;
  max-width: min(100%, 78vh);
  max-height: 82vh;
  border-radius: 8px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.42);
}

.lightbox-dialog p {
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(12, 8, 24, 0.62);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.lightbox-close {
  top: -14px;
  right: -14px;
  width: 42px;
  height: 42px;
  font-size: 1.55rem;
  line-height: 1;
}

.lightbox-nav {
  top: 50%;
  width: 48px;
  height: 48px;
  transform: translateY(-50%);
  font-size: 2.1rem;
  line-height: 1;
}

.lightbox-nav.prev {
  left: -66px;
}

.lightbox-nav.next {
  right: -66px;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@media (max-width: 880px) {
  .page {
    width: min(100% - 28px, 620px);
  }

  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    padding-top: 28px;
  }

  .visual-panel {
    order: 2;
    min-height: auto;
  }

  .photo-stage {
    width: min(100%, 390px);
    border-radius: 18px;
  }

  .confession {
    order: 1;
  }

  .letter {
    min-height: 164px;
  }

  .reply-section {
    padding-top: 8px;
  }

  .moments {
    grid-template-columns: 1fr;
  }

  .section-heading {
    display: block;
  }

  .photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .lightbox-nav.prev {
    left: 12px;
  }

  .lightbox-nav.next {
    right: 12px;
  }
}

@media (max-width: 520px) {
  .page {
    width: min(100% - 22px, 420px);
  }

  .hero {
    gap: 22px;
  }

  h1 {
    font-size: clamp(2.85rem, 15vw, 4.2rem);
  }

  .lead {
    margin-top: 18px;
  }

  .letter {
    margin-top: 24px;
    padding: 20px;
  }

  .letter p {
    min-height: 134px;
  }

  .reply-letter {
    padding: 20px;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .primary-btn,
  .ghost-btn {
    min-width: 0;
    width: 100%;
  }

  .visual-panel {
    min-height: auto;
  }

  .photo-tools {
    top: 40%;
    padding: 0 6px;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
    font-size: 1.8rem;
  }

  .film-strip {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .film-thumb {
    height: 54px;
  }

  .film-thumb:nth-child(n + 11) {
    display: none;
  }

  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .lightbox {
    padding: 12px;
  }

  .lightbox-dialog img {
    max-width: 100%;
    max-height: 78vh;
  }

  .lightbox-close {
    top: 8px;
    right: 8px;
  }
}

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