* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: url('/images/background.webp') center center / cover no-repeat fixed;
  font-family: 'Nanum Myeongjo', Georgia, serif;
  display: flex;
  flex-direction: column;
}

/* Header */
.site-header {
  text-align: center;
  padding: 30px 20px 20px;
  z-index: 20;
  background: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, transparent 100%);
}

.site-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.5);
  margin-bottom: 8px;
}

.site-subtitle {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.9);
  text-shadow: 1px 1px 4px rgba(0,0,0,0.5);
  font-weight: 400;
}

/* Letter Container */
.letter-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  perspective: 1200px;
  padding: 20px;
}

/* Letter Styles */
.letter {
  width: 100%;
  max-width: 450px;
  min-height: 400px;
  background: linear-gradient(180deg, #FFF8E7 0%, #F5E6C8 100%);
  border-radius: 8px;
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.3),
    inset 0 0 60px rgba(255, 255, 255, 0.3);
  padding: 25px 30px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 1.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 1.2s ease-out;
}

.letter::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    transparent,
    transparent 27px,
    #E8D4B8 27px,
    #E8D4B8 28px
  );
  pointer-events: none;
  border-radius: 8px;
}

.letter::after {
  content: '';
  position: absolute;
  left: 28px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #FFB6C1;
  opacity: 0.5;
}

.letter-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

textarea {
  width: 100%;
  height: 300px;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 17px;
  line-height: 28px;
  color: #333;
  padding-left: 12px;
}

textarea::placeholder {
  color: #888;
  font-style: italic;
  line-height: 1.8;
}

.letter-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px dashed #ddd;
}

.char-count {
  font-size: 13px;
  color: #999;
}

button {
  padding: 12px 28px;
  background: linear-gradient(135deg, #2d7a2d 0%, #228B22 100%);
  color: white;
  border: none;
  border-radius: 25px;
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(34, 139, 34, 0.3);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(34, 139, 34, 0.4);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  background: #aaa;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Flying Animation */
.letter.flying {
  animation: none;
  transition:
    transform 1.5s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 1.2s ease-out,
    box-shadow 0.5s ease;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

/* New Letter Animation */
.letter.appearing {
  animation: appear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes appear {
  0% {
    opacity: 0;
    transform: scale(0.5) translateY(50px) rotateX(20deg);
  }
  60% {
    transform: scale(1.05) translateY(-10px) rotateX(-5deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0) rotateX(0deg);
  }
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 20px;
  z-index: 20;
  background: linear-gradient(0deg, rgba(0,0,0,0.3) 0%, transparent 100%);
}

.site-footer p {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.8);
  text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

/* Responsive */
@media (max-width: 500px) {
  .site-header {
    padding: 20px 15px 15px;
  }

  .site-title {
    font-size: 2rem;
  }

  .site-subtitle {
    font-size: 0.95rem;
  }

  .letter {
    min-height: 350px;
    padding: 20px 25px;
  }

  textarea {
    height: 250px;
    font-size: 16px;
  }
}
