:root {
  --bg: #fdfbf8;
  --bg-soft: #fffdfb;
  --panel: rgba(255, 255, 255, 0.76);
  --panel-strong: rgba(255, 255, 255, 0.9);
  --text: #473d43;
  --muted: #7d6b75;
  --accent: #dd9aa9;
  --accent-strong: #b8697f;
  --border: rgba(234, 214, 220, 0.9);
  --shadow: 0 18px 55px rgba(142, 97, 119, 0.14);
  --hero: #eab6c2;
  --focus: #7e5667;
}

:root[data-theme="dark"] {
  --bg: #171315;
  --bg-soft: #211b1e;
  --panel: rgba(41, 31, 35, 0.76);
  --panel-strong: rgba(52, 39, 43, 0.92);
  --text: #f4e9ec;
  --muted: #dbbec9;
  --accent: #e8a6b7;
  --accent-strong: #f3c4d3;
  --border: rgba(104, 72, 82, 0.8);
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.38);
  --hero: #7c4555;
  --focus: #f3c4d3;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(237, 201, 216, 0.28), transparent 32%),
    radial-gradient(circle at bottom right, rgba(226, 182, 192, 0.18), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", sans-serif;
  overflow-x: hidden;
  letter-spacing: 0.01em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.26), transparent 40%);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

main.story-layout {
  position: relative;
  width: min(100%, 820px);
  margin: 0 auto;
  padding: 20px 16px 72px;
}

.story-step {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 760ms ease, transform 760ms ease;
  pointer-events: none;
  padding: 20px 16px 72px;
}

.story-step.is-active,
.story-step.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.story-step.is-leaving {
  opacity: 0;
  transform: translateY(-30px);
}

.story-step.is-hidden {
  display: none;
}

.glass-panel {
  width: 100%;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(255, 250, 252, 0.78));
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  border-radius: 32px;
  padding: clamp(28px, 4vw, 54px);
  position: relative;
}

:root[data-theme="dark"] .glass-panel {
  background: linear-gradient(135deg, rgba(49, 36, 41, 0.92), rgba(38, 29, 31, 0.9));
}

.glass-panel::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 24px;
  border: 1px solid rgba(239, 224, 229, 0.45);
  pointer-events: none;
}

.intro-panel,
.final-panel,
.text-panel {
  text-align: center;
}

h1,
h2 {
  font-family: "Cormorant Garamond", serif;
  letter-spacing: 0.02em;
}

h1 {
  margin: 0 0 18px;
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 600;
  color: var(--text);
  text-shadow: 0 2px 12px rgba(195, 146, 167, 0.16);
}

h2 {
  margin: 0 0 26px;
  font-size: clamp(2.3rem, 6vw, 3.6rem);
  font-weight: 600;
  line-height: 0.98;
}

.section-label,
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 12px;
}

.lead,
.quiet-copy,
.final-copy,
.truth-line,
.learn-card p,
.appreciation-card p,
.promise-before,
.promise-after,
.popup-message {
  line-height: 1.7;
}

.lead {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  color: var(--text);
  max-width: 620px;
  margin: 0 auto 32px;
  line-height: 1.55;
}

.continue-button,
.icon-button,
.close-popup {
  border: none;
  background: transparent;
}

.continue-button {
  margin-top: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-strong);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  cursor: pointer;
  transition: transform 220ms ease, color 220ms ease, background-color 220ms ease;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(246, 230, 234, 0.92);
}

.continue-button:hover {
  background: rgba(238, 214, 221, 0.98);
}

.continue-button:hover {
  transform: translateX(3px);
  color: var(--focus);
}

.truth-sentences {
  display: grid;
  gap: 10px;
  margin: 8px auto 0;
  max-width: 620px;
}

.truth-line {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 520ms ease, transform 520ms ease;
  font-size: 1.2rem;
  font-family: "Cormorant Garamond", serif;
  margin: 0;
}

.truth-line.visible {
  opacity: 1;
  transform: translateY(0);
}

.learn-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
}

.learn-card {
  padding: 24px 22px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 245, 248, 0.84));
  border: 1px solid rgba(232, 206, 214, 0.75);
  box-shadow: 0 12px 30px rgba(139, 99, 116, 0.1);
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 640ms ease, transform 640ms ease;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.22rem;
}

:root[data-theme="dark"] .learn-card {
  background: linear-gradient(180deg, rgba(64, 46, 51, 0.96), rgba(40, 31, 35, 0.94));
}

.learn-card.reveal {
  opacity: 1;
  transform: translateY(0);
}

.learn-card:hover {
  transform: translateY(-6px);
}

.appreciation-panel {
  min-height: 460px;
}

.appreciation-card {
  min-height: 210px;
  display: grid;
  place-items: center;
  margin: 12px 0 8px;
  padding: 28px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 244, 247, 0.9));
  border: 1px solid rgba(230, 205, 211, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

:root[data-theme="dark"] .appreciation-card {
  background: linear-gradient(180deg, rgba(60, 44, 49, 0.94), rgba(42, 31, 35, 0.94));
}

.appreciation-card p {
  font-size: clamp(1.32rem, 2.8vw, 1.95rem);
  margin: 0;
  color: var(--text);
  font-family: "Cormorant Garamond", serif;
}

.appreciation-controls,
.promise-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.promise-stack {
  position: relative;
  min-height: 270px;
  display: grid;
  place-items: center;
}

.promise-before,
.promise-after {
  position: absolute;
  inset: 0;
  margin: 0;
  font-size: clamp(1.45rem, 2.8vw, 2.05rem);
  font-family: "Cormorant Garamond", serif;
  display: grid;
  place-items: center;
  text-align: center;
}

.promise-before {
  opacity: 1;
  transition: opacity 650ms ease;
}

.promise-after {
  opacity: 0;
  transition: opacity 650ms ease;
}

.promise-after span {
  display: block;
}

.promise-panel.is-swapped .promise-before {
  opacity: 0;
}

.promise-panel.is-swapped .promise-after {
  opacity: 1;
}

.final-copy {
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: var(--text);
  margin: 0 auto 12px;
  max-width: 640px;
  font-family: "Cormorant Garamond", serif;
}

.heart-wrap {
  margin: 8px auto 10px;
}

.heart {
  display: inline-block;
  font-size: 2rem;
  animation: beat 1.8s infinite ease-in-out;
}

@keyframes beat {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.12); }
  40% { transform: scale(0.98); }
  65% { transform: scale(1.16); }
}

.site-footer {
  text-align: center;
  padding: 12px 16px 22px;
  color: var(--muted);
  font-size: 0.94rem;
  letter-spacing: 0.04em;
}

.floating-controls {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 30;
  display: flex;
  gap: 8px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(241, 226, 232, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text);
}

.icon-button.is-playing {
  color: var(--accent-strong);
}

.loading-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 50;
  background: rgba(253, 251, 248, 0.9);
  backdrop-filter: blur(10px);
  transition: opacity 600ms ease;
}

:root[data-theme="dark"] .loading-screen {
  background: rgba(23, 19, 21, 0.86);
}

.loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-card {
  padding: 18px 26px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.loading-text {
  margin: 0;
  font-family: "Parisienne", cursive;
  font-size: clamp(2rem, 4vw, 2.5rem);
  color: var(--accent-strong);
}

.petals {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.petal {
  position: absolute;
  width: 14px;
  height: 18px;
  opacity: 0.2;
  background: linear-gradient(135deg, rgba(222, 169, 185, 0.86), rgba(246, 210, 222, 0.5));
  border-radius: 70% 0 70% 0;
  animation: floatPetal linear infinite;
}

@keyframes floatPetal {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  50% {
    transform: translate3d(20px, -80px, 0) rotate(80deg);
  }
  100% {
    transform: translate3d(-16px, -150px, 0) rotate(140deg);
  }
}

.petal-1 { left: 5%; top: 14%; animation-duration: 17s; }
.petal-2 { left: 17%; top: 78%; animation-duration: 20s; }
.petal-3 { left: 26%; top: 32%; animation-duration: 18s; }
.petal-4 { left: 38%; top: 60%; animation-duration: 16s; }
.petal-5 { left: 46%; top: 10%; animation-duration: 21s; }
.petal-6 { left: 58%; top: 66%; animation-duration: 24s; }
.petal-7 { left: 68%; top: 20%; animation-duration: 19s; }
.petal-8 { left: 76%; top: 58%; animation-duration: 22s; }
.petal-9 { left: 84%; top: 14%; animation-duration: 20s; }
.petal-10 { left: 92%; top: 76%; animation-duration: 18s; }
.petal-11 { left: 12%; top: 48%; animation-duration: 23s; }
.petal-12 { left: 72%; top: 83%; animation-duration: 17s; }

.star-popup {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(36, 24, 30, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
  z-index: 35;
}

.star-popup.is-open {
  opacity: 1;
  pointer-events: auto;
}

.popup-card {
  width: min(92vw, 380px);
  background: var(--panel-strong);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 22px;
  padding: 22px;
  position: relative;
}

.close-popup {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text);
}

.popup-message {
  margin: 0;
  text-align: center;
  font-family: "Parisienne", cursive;
  font-size: 1.35rem;
}

.star-hidden {
  position: fixed;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: rgba(203, 141, 160, 0.8);
  font-size: 0.9rem;
  cursor: pointer;
  z-index: 5;
  user-select: none;
}

.star-hidden:hover {
  transform: scale(1.1);
}

.is-hidden {
  display: none !important;
}

@media (min-width: 640px) {
  .learn-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .story-step {
    padding: 0 4px;
  }
}

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

@media (pointer: fine) {
  body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(216, 128, 151, 0.32), rgba(216, 128, 151, 0.05));
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 40;
    mix-blend-mode: multiply;
  }
}
