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

html {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
}

body {
  margin: 0;
  padding: 0;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  font-family: "M PLUS Rounded 1c", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #3b1438 0, #170818 40%, #050308 100%);
  background-attachment: fixed;
  color: #f6eafa;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.letter-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 700px;
  height: calc(100vh - 24px);
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 12px;
  overflow: hidden;
}

.letter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  height: auto;
}

.title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.title-katakana {
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #c7a5ff;
}

.letter-header h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 800;
  letter-spacing: 0.03em;
  font-family: "Cinzel", "M PLUS Rounded 1c", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Hello Kitty Animation */
.hello-kitty-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  height: auto;
}

.hello-kitty-gif {
  max-width: 120px;
  max-height: 120px;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
  animation: gifFloat 3s ease-in-out infinite;
}

@keyframes gifFloat {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-8px) scale(1.02);
  }
}

/* Letter Content */
.letter-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.letter-paper {
  background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), rgba(250, 240, 255, 0.98));
  border-radius: 18px;
  padding: 20px 28px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85),
              inset 0 1px 0 rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(206, 138, 255, 0.3);
  color: #2d1a35;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.letter-paper::-webkit-scrollbar {
  width: 6px;
}

.letter-paper::-webkit-scrollbar-track {
  background: transparent;
}

.letter-paper::-webkit-scrollbar-thumb {
  background: rgba(206, 138, 255, 0.3);
  border-radius: 3px;
}

.letter-paper::-webkit-scrollbar-thumb:hover {
  background: rgba(206, 138, 255, 0.5);
}

.letter-paper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 55px;
  width: 2px;
  height: 100%;
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 28px,
    rgba(206, 138, 255, 0.2) 28px,
    rgba(206, 138, 255, 0.2) 29px
  );
  pointer-events: none;
}

.letter-date {
  text-align: right;
  font-size: 11px;
  color: #7a5a8a;
  margin-bottom: 10px;
  font-style: italic;
  flex-shrink: 0;
}

.letter-greeting {
  font-size: 15px;
  margin-bottom: 12px;
  font-weight: 600;
  color: #3b1438;
  flex-shrink: 0;
}

.letter-greeting p {
  margin: 0;
}

.highlight-name {
  color: #ff2b7f;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255, 43, 127, 0.3);
}

.letter-body {
  font-size: 13px;
  line-height: 1.65;
  color: #2d1a35;
  flex: 1;
  min-height: 0;
}

.letter-body p {
  margin: 0 0 10px 0;
  text-align: justify;
}

.letter-body p:last-of-type {
  margin-bottom: 0;
}

.custom-message {
  font-style: italic;
  color: #5b2a6b;
  padding-left: 12px;
  border-left: 3px solid rgba(255, 107, 165, 0.5);
  margin: 10px 0 !important;
}

.letter-signature {
  text-align: right;
  margin-top: 12px;
  font-size: 13px;
  color: #3b1438;
  flex-shrink: 0;
}

.signature-name {
  font-weight: 700;
  color: #ff2b7f;
  display: block;
  margin-top: 6px;
  font-size: 15px;
}

.letter-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #c39df1;
  flex-shrink: 0;
  padding-top: 2px;
}

.tiny-text {
  color: #aa87dd;
}

.bg-decor {
  position: fixed;
  border-radius: 999px;
  filter: blur(48px);
  opacity: 0.7;
  z-index: 0;
  pointer-events: none;
}

.bg-decor-1 {
  width: 220px;
  height: 220px;
  background: #3c1036;
  top: -40px;
  left: -40px;
}

.bg-decor-2 {
  width: 260px;
  height: 260px;
  background: #1f0c2c;
  bottom: -80px;
  right: -40px;
}

.bg-decor-3 {
  width: 160px;
  height: 160px;
  background: #3a1220;
  top: 40%;
  right: 15%;
}

#heartConfetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
}

.heart-piece {
  position: absolute;
  width: 16px;
  height: 16px;
  color: #ff3b7d;
  animation: fall 3s ease-in forwards;
  opacity: 0.9;
  font-size: 20px;
}

@keyframes fall {
  0% {
    transform: translate3d(0, -10%, 0) rotate(0deg) scale(1);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  100% {
    transform: translate3d(0, 120vh, 0) rotate(360deg) scale(0.5);
    opacity: 0;
  }
}

@media (max-width: 600px) {
  .letter-container {
    height: calc(100vh - 16px);
    max-height: calc(100vh - 16px);
    padding: 0 8px;
    gap: 8px;
  }

  .letter-header {
    gap: 8px;
  }

  .letter-header h1 {
    font-size: 22px;
  }

  .hello-kitty-gif {
    max-width: 80px;
    max-height: 80px;
  }

  .letter-paper {
    padding: 18px 20px;
    border-radius: 16px;
  }

  .letter-body {
    font-size: 12px;
    line-height: 1.6;
  }

  .letter-greeting {
    font-size: 14px;
    margin-bottom: 10px;
  }

  .letter-body p {
    margin: 0 0 8px 0;
  }

  .letter-signature {
    font-size: 12px;
    margin-top: 10px;
  }

  .signature-name {
    font-size: 14px;
  }
}
