:root {
  --bg: #05040a;
  --bg-soft: rgba(15, 15, 28, 0.72);
  --bg-strong: rgba(10, 10, 18, 0.88);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f8f5ff;
  --muted: rgba(248, 245, 255, 0.65);
  --accent: #ff5fa2;
  --accent-soft: #ff89ba;
  --accent-2: #9e7bff;
  --accent-3: #ff7c66;
  --success: #86ffd5;
  --danger: #ff7f96;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --container: min(1120px, calc(100vw - 20px));
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(158, 123, 255, 0.12), transparent 34%),
    radial-gradient(circle at 20% 20%, rgba(255, 95, 162, 0.16), transparent 25%),
    radial-gradient(circle at 80% 10%, rgba(255, 124, 102, 0.12), transparent 22%),
    linear-gradient(180deg, #030308 0%, #070610 45%, #030307 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.04), transparent 30%),
    linear-gradient(315deg, rgba(255, 255, 255, 0.02), transparent 24%);
  pointer-events: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.ambient,
.noise,
.particles,
.confetti-canvas {
  pointer-events: none;
}

.ambient {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.65;
}

.ambient-a {
  top: -120px;
  left: -120px;
  width: 240px;
  height: 240px;
  background: rgba(255, 95, 162, 0.17);
  animation: drift 15s ease-in-out infinite;
}

.ambient-b {
  right: -120px;
  bottom: 8vh;
  width: 240px;
  height: 240px;
  background: rgba(158, 123, 255, 0.16);
  animation: drift 18s ease-in-out infinite reverse;
}

.noise {
  position: fixed;
  inset: 0;
  opacity: 0.055;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.8) 0.6px, transparent 0.8px),
    radial-gradient(circle at 80% 30%, rgba(255, 255, 255, 0.5) 0.5px, transparent 0.8px),
    radial-gradient(circle at 50% 80%, rgba(255, 255, 255, 0.4) 0.7px, transparent 1px);
  background-size: 130px 130px;
}

.particles,
.confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 1;
}

.particle {
  position: absolute;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0));
  opacity: 0;
  animation: particle-float linear infinite;
}

.app-shell {
  position: relative;
  z-index: 2;
  width: var(--container);
  margin: 0 auto;
  padding: 76px 0 28px;
}

.screen {
  display: none;
  min-height: calc(100vh - 104px);
  align-items: center;
  justify-content: center;
  padding: 0 0 10px;
  opacity: 0;
  transform: translateY(24px) scale(0.985);
}

.screen--active {
  display: flex;
  animation: screen-in 0.85s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.panel {
  position: relative;
  width: 100%;
  padding: 20px 16px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04)),
    rgba(7, 7, 16, 0.64);
  border: 1px solid var(--line);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.09), transparent 28%, transparent 72%, rgba(255, 255, 255, 0.03));
  pointer-events: none;
}

.panel--center {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}

.panel--loading {
  padding-top: 28px;
  padding-bottom: 28px;
}

.panel__nav,
.panel__actions,
.screen-intro,
.message-card,
.stats-grid,
.note-card,
.gallery-block,
.gift-card,
.love-meter,
.error-message,
.progress-card {
  position: relative;
  z-index: 1;
}

.panel__nav {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow--danger {
  background: rgba(255, 127, 150, 0.12);
  color: #ffd2dc;
}

.screen-intro {
  max-width: 760px;
}

.hero-title {
  margin: 16px 0 12px;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2.05rem, 10vw, 5.4rem);
  line-height: 1;
  letter-spacing: -0.055em;
}

.hero-title--loading {
  font-size: clamp(1.8rem, 8.5vw, 4.4rem);
}

.hero-title--romantic {
  background: linear-gradient(135deg, #ffffff 10%, #ffc7da 50%, #ffc6f6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-subtitle {
  margin: 0;
  max-width: 720px;
  color: var(--muted);
  font-size: clamp(0.98rem, 4vw, 1.28rem);
  line-height: 1.62;
}

.progress-card,
.love-meter,
.message-card,
.note-card,
.gallery-block {
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.progress-card {
  margin: 24px 0 16px;
  padding: 16px;
}

.progress-card__top,
.love-meter__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.84rem;
}

.progress-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.progress-bar__fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(158, 123, 255, 0.95), rgba(255, 95, 162, 0.96), rgba(255, 124, 102, 0.92));
  box-shadow:
    0 0 24px rgba(255, 95, 162, 0.42),
    0 0 40px rgba(158, 123, 255, 0.22);
  transition: width 0.24s ease;
}

.progress-bar--danger {
  height: 16px;
}

.progress-bar__fill--danger {
  width: 100%;
  background: linear-gradient(90deg, #ff7f96, #ff5fa2, #9e7bff);
  animation: pulse-width 1.8s ease-in-out infinite;
}

.status-line,
.complete-line {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.96rem;
}

.complete-line {
  color: #ffd4e7;
  font-weight: 700;
  letter-spacing: 0.03em;
  font-size: 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 24px;
}

.stat-card {
  padding: 18px 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  min-height: 124px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition:
    transform 0.35s ease,
    border-color 0.35s ease,
    box-shadow 0.35s ease,
    background 0.35s ease;
}

.stat-card:hover {
  transform: translateY(-6px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.28);
  background: rgba(255, 255, 255, 0.075);
}

.stat-card__icon {
  font-size: 1.2rem;
}

.stat-card__label {
  color: var(--muted);
  font-size: 0.92rem;
}

.stat-card__value {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.1rem, 5vw, 1.7rem);
  letter-spacing: -0.04em;
}

.note-card {
  margin-top: 16px;
  padding: 18px 16px;
}

.note-card__main {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 700;
}

.note-card__sub {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.love-meter {
  margin-top: 18px;
  padding: 18px 16px;
}

.error-message {
  margin-top: 16px;
  padding: 18px 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 127, 150, 0.08);
  border: 1px solid rgba(255, 127, 150, 0.22);
  line-height: 1.7;
  color: #ffe2ea;
  transition:
    opacity 0.45s ease,
    transform 0.45s ease;
}

.error-message p {
  margin: 0;
}

.error-message p + p {
  margin-top: 8px;
}

.error-message--hidden {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
}

.message-card {
  margin-top: 22px;
  padding: 20px 16px;
  line-height: 1.78;
  font-size: clamp(0.98rem, 4vw, 1.1rem);
}

.message-card p {
  margin: 0;
}

.message-card p + p {
  margin-top: 12px;
}

.message-card__lead {
  font-size: clamp(1.12rem, 5vw, 1.5rem);
  font-weight: 700;
}

.memory-strip {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.memory-strip--duo,
.memory-strip--mosaic {
  grid-template-columns: 1fr;
}

.memory-card {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  margin: 0;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.04);
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

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

.memory-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(5, 4, 10, 0.16));
  pointer-events: none;
}

.message-card__final {
  margin-top: 16px;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.2rem, 5.4vw, 1.8rem);
  color: #ffd8e8;
}

.gallery-block {
  margin-top: 20px;
  padding: 18px 16px;
}

.gallery-block__header h3 {
  margin: 12px 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.25rem, 5vw, 2rem);
}

.photo-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 16px;
}

.photo-card {
  position: relative;
  overflow: hidden;
  aspect-ratio: 0.9;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s ease, filter 0.6s ease;
}

.photo-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 35%, rgba(5, 4, 10, 0.45) 100%);
}

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

.primary-btn,
.ghost-btn,
.music-toggle {
  border: 0;
  border-radius: 999px;
  transition:
    transform 0.22s ease,
    opacity 0.22s ease,
    box-shadow 0.22s ease,
    background 0.22s ease,
    border-color 0.22s ease;
}

.primary-btn {
  width: 100%;
  justify-content: center;
  padding: 15px 18px;
  color: #fff9fd;
  background:
    linear-gradient(135deg, rgba(255, 95, 162, 0.96), rgba(158, 123, 255, 0.96));
  box-shadow:
    0 16px 40px rgba(255, 95, 162, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  font-weight: 800;
  letter-spacing: 0.02em;
  min-height: 54px;
}

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

.primary-btn:active,
.ghost-btn:active,
.music-toggle:active {
  transform: translateY(0);
}

.primary-btn--danger {
  background: linear-gradient(135deg, rgba(255, 127, 150, 0.95), rgba(255, 95, 162, 0.96));
}

.primary-btn--glow {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 18px 50px rgba(255, 95, 162, 0.32),
    0 0 40px rgba(158, 123, 255, 0.26);
}

.ghost-btn,
.music-toggle {
  padding: 11px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.music-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.music-toggle.is-playing {
  background: rgba(255, 95, 162, 0.16);
  border-color: rgba(255, 95, 162, 0.32);
}

.music-toggle__icon {
  font-size: 1rem;
}

.build-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.build-pill--danger {
  color: #ffdbe4;
  background: rgba(255, 127, 150, 0.12);
}

.build-pill--soft {
  color: #f7d8ff;
}

.build-pill--success {
  color: #d8ffea;
  background: rgba(134, 255, 213, 0.08);
}

.hidden {
  display: none !important;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes particle-float {
  0% {
    transform: translate3d(0, 30px, 0) scale(0.8);
    opacity: 0;
  }
  12% {
    opacity: 0.55;
  }
  88% {
    opacity: 0.12;
  }
  100% {
    transform: translate3d(var(--drift-x), -120vh, 0) scale(1.2);
    opacity: 0;
  }
}

@keyframes pulse-width {
  0%,
  100% {
    transform: scaleX(0.985);
    transform-origin: center;
  }
  50% {
    transform: scaleX(1);
    transform-origin: center;
  }
}

@keyframes drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(24px, 20px, 0) scale(1.08);
  }
}

@media (min-width: 640px) {
  .app-shell {
    width: min(100vw - 28px, 1120px);
    padding-top: 88px;
  }

  .panel {
    padding: 24px 22px;
    border-radius: 28px;
  }

  .panel__nav {
    align-items: center;
    flex-direction: row;
    margin-bottom: 26px;
  }

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

  .hero-title {
    font-size: clamp(2.4rem, 8vw, 5.4rem);
  }

  .hero-title--loading {
    font-size: clamp(2rem, 6vw, 4.4rem);
  }

  .progress-card,
  .love-meter,
  .message-card,
  .note-card,
  .gallery-block {
    padding-left: 20px;
    padding-right: 20px;
  }

  .primary-btn {
    width: auto;
    min-width: 260px;
  }

  .memory-strip--duo {
    grid-template-columns: 1.08fr 0.92fr;
    align-items: stretch;
  }

  .memory-strip--mosaic {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .memory-card--wide {
    grid-column: 1 / -1;
    min-height: 260px;
  }
}

@media (min-width: 860px) {
  :root {
    --container: min(1120px, calc(100vw - 40px));
  }

  .ambient-a,
  .ambient-b {
    width: 340px;
    height: 340px;
  }

  .app-shell {
    padding: 24px 0 48px;
  }

  .screen {
    min-height: calc(100vh - 72px);
    padding: 8px 0;
  }

  .panel {
    padding: 28px;
    border-radius: var(--radius-xl);
  }

  .panel--loading {
    padding-top: 40px;
    padding-bottom: 40px;
  }

  .panel__nav {
    margin-bottom: 30px;
  }

  .hero-subtitle {
    font-size: clamp(1rem, 2.6vw, 1.28rem);
  }

  .stats-grid {
    gap: 16px;
    margin-top: 30px;
  }

  .stat-card {
    padding: 22px;
    min-height: 148px;
  }

  .note-card {
    margin-top: 22px;
    padding: 24px;
  }

  .love-meter {
    margin-top: 26px;
    padding: 22px;
  }

  .error-message {
    margin-top: 22px;
    padding: 22px;
  }

  .message-card {
    margin-top: 28px;
    padding: clamp(22px, 4vw, 36px);
  }

  .gallery-block {
    margin-top: 24px;
    padding: 24px;
  }

  .photo-grid {
    gap: 14px;
    margin-top: 20px;
  }

  .photo-card {
    aspect-ratio: 0.82;
    border-radius: 20px;
  }

  .memory-strip {
    gap: 14px;
    margin: 22px 0;
  }

  .memory-card {
    min-height: 240px;
    border-radius: 20px;
  }

  .memory-card--tall {
    min-height: 340px;
  }

  .memory-card--wide {
    min-height: 280px;
  }

  .music-toggle {
    top: 18px;
    right: 18px;
  }
}

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