:root {
  --bg-ivory: #fbf7f2;
  --bg-card: rgba(255, 253, 250, 0.92);
  --ink-primary: #2c1e21;
  --ink-secondary: #634d52;
  --ink-muted: #8c757a;
  --rose-accent: #b84c5b;
  --rose-accent-hover: #9d3c4a;
  --sakura-pink: #e59aa6;
  --rose-soft: #f4e2e4;
  --border-subtle: rgba(184, 76, 91, 0.16);
  --status-green: #2f8f5b;
  --shadow-card: 0 24px 60px rgba(44, 30, 33, 0.08), 0 4px 16px rgba(44, 30, 33, 0.04);
  --font-serif: "Cormorant Garamond", "Noto Serif JP", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background-color: var(--bg-ivory);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

html[lang="ja"] body {
  line-height: 1.9;
  letter-spacing: 0.02em;
}

.ambient-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 18% 15%, rgba(235, 182, 192, 0.36), transparent 46%),
    radial-gradient(circle at 82% 80%, rgba(242, 208, 188, 0.32), transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.6), transparent 70%);
}

.hearts-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 20;
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.25rem 1.25rem 2rem;
  gap: 1.4rem;
}

.top-bar {
  width: 100%;
  max-width: 720px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(8px);
  font-size: 0.82rem;
  color: var(--ink-secondary);
  letter-spacing: 0.01em;
  box-shadow: 0 4px 16px rgba(44, 30, 33, 0.04);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--status-green);
  box-shadow: 0 0 0 0 rgba(47, 143, 91, 0.45);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(47, 143, 91, 0.45);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(47, 143, 91, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(47, 143, 91, 0);
  }
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(44, 30, 33, 0.04);
}

.lang-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.34rem 0.78rem;
  border-radius: 999px;
  cursor: pointer;
  transition:
    background-color 0.18s ease,
    color 0.18s ease;
}

.lang-btn:hover {
  color: var(--rose-accent);
}

.lang-btn.is-active {
  background: var(--rose-accent);
  color: #ffffff;
}

.lang-btn:focus-visible {
  outline: 2px solid var(--rose-accent);
  outline-offset: 2px;
}

.letter-card {
  width: 100%;
  max-width: 720px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  padding: clamp(2rem, 5vw, 3.75rem);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
  animation: fadeUp 0.75s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.letter-header {
  text-align: center;
  margin-bottom: 2rem;
}

.eyebrow {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--rose-accent);
  font-weight: 500;
}

.letter-header h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(2.1rem, 5.5vw, 3.25rem);
  font-weight: 600;
  line-height: 1.18;
  color: var(--ink-primary);
}

html[lang="ja"] .letter-header h1 {
  font-size: clamp(1.85rem, 4.8vw, 2.65rem);
  font-weight: 500;
  line-height: 1.35;
}

.sub-jp {
  margin: 0.55rem 0 0;
  font-family: "Noto Serif JP", var(--font-serif);
  font-size: 0.98rem;
  letter-spacing: 0.24em;
  color: var(--ink-muted);
}

.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin-top: 1.25rem;
  color: var(--rose-accent);
}

.divider span {
  height: 1px;
  width: 64px;
  background: linear-gradient(90deg, transparent, rgba(184, 76, 91, 0.38), transparent);
}

.letter-body {
  font-size: 1.03rem;
  color: var(--ink-secondary);
}

.letter-body p {
  margin: 0 0 1.25rem;
}

.letter-body .lead {
  font-family: var(--font-serif);
  font-size: clamp(1.28rem, 2.7vw, 1.48rem);
  line-height: 1.55;
  color: var(--ink-primary);
  font-style: italic;
}

html[lang="ja"] .letter-body .lead {
  font-style: normal;
  font-size: clamp(1.08rem, 2.3vw, 1.2rem);
  line-height: 1.9;
}

.signature {
  margin-top: 2rem;
  margin-bottom: 0;
  text-align: right;
  font-family: var(--font-serif);
  font-size: 1.32rem;
  line-height: 1.5;
  color: var(--ink-primary);
}

html[lang="ja"] .signature {
  font-size: 1.08rem;
  line-height: 1.8;
}

.signature-from {
  color: var(--rose-accent);
  font-style: italic;
  font-weight: 600;
}

html[lang="ja"] .signature-from {
  font-style: normal;
  font-weight: 500;
}

.reasons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2.4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
}

.reason-item {
  background: rgba(244, 226, 228, 0.28);
  border: 1px solid rgba(184, 76, 91, 0.11);
  border-radius: 16px;
  padding: 1.1rem 1rem;
}

.reason-index {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--rose-accent);
  margin-bottom: 0.35rem;
}

.reason-item h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-serif);
  font-size: 1.22rem;
  font-weight: 600;
  color: var(--ink-primary);
}

html[lang="ja"] .reason-item h2 {
  font-size: 1.05rem;
  font-weight: 500;
}

.reason-item p {
  margin: 0;
  font-size: 0.87rem;
  line-height: 1.58;
  color: var(--ink-secondary);
}

.interactive-box {
  margin-top: 2.2rem;
  padding: 1.5rem 1.25rem;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(244, 226, 228, 0.45), rgba(251, 244, 236, 0.7));
  border: 1px solid var(--border-subtle);
  text-align: center;
}

.note-display {
  margin: 0 0 1.15rem;
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 2.5vw, 1.4rem);
  font-style: italic;
  color: var(--ink-primary);
  min-height: 2.3em;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.22s ease;
}

html[lang="ja"] .note-display {
  font-style: normal;
  font-size: clamp(1.02rem, 2.2vw, 1.15rem);
}

.note-display.is-fading {
  opacity: 0;
}

.love-button {
  appearance: none;
  border: none;
  border-radius: 999px;
  background: var(--rose-accent);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.78rem 1.55rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(184, 76, 91, 0.28);
  transition:
    transform 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease;
}

.love-button:hover {
  background: var(--rose-accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(184, 76, 91, 0.34);
}

.love-button:active {
  transform: translateY(1px);
}

.love-button:focus-visible {
  outline: 2px solid var(--rose-accent);
  outline-offset: 3px;
}

.floating-heart {
  position: fixed;
  bottom: -24px;
  font-size: 1.25rem;
  color: var(--rose-accent);
  opacity: 0;
  user-select: none;
  animation: floatHeart var(--duration, 3.2s) ease-out forwards;
}

.floating-heart.is-petal {
  color: var(--sakura-pink);
}

@keyframes floatHeart {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(0deg) scale(0.72);
  }
  18% {
    opacity: 0.88;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--drift, 20px), -88vh, 0) rotate(var(--spin, 24deg)) scale(1.22);
  }
}

.site-footer {
  font-size: 0.8rem;
  color: var(--ink-muted);
  text-align: center;
}

@media (max-width: 680px) {
  .top-bar {
    justify-content: center;
  }

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

  .signature {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-dot,
  .letter-card,
  .floating-heart {
    animation: none;
  }

  .love-button,
  .note-display,
  .lang-btn {
    transition: none;
  }
}
