.letter-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  animation: fadeIn 0.4s ease-out forwards;
}

.letter-content {
  background: linear-gradient(135deg, rgba(20, 61, 44, 0.95) 0%, rgba(26, 77, 58, 0.9) 100%);
  border: 3px solid;
  border-image: linear-gradient(135deg, #00D9C0, #2DD881, #FFB800) 1;
  border-radius: 32px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 
    0 20px 60px rgba(0, 217, 192, 0.5),
    0 10px 40px rgba(45, 216, 129, 0.4),
    inset 0 0 80px rgba(255, 184, 0, 0.15);
  animation: letterOpen 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
  transform: scale(0.8) rotateX(-15deg);
}

@keyframes letterOpen {
  to {
    transform: scale(1) rotateX(0deg);
  }
}

.letter-header {
  padding: 3rem 3rem 2rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.15);
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, transparent 100%);
}

.close-button {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0, 217, 192, 0.3), rgba(45, 216, 129, 0.3));
  color: var(--color-text);
  font-size: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-smooth);
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 15px rgba(0, 217, 192, 0.3);
  z-index: 100;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.close-button:hover {
  background: linear-gradient(135deg, #00D9C0, #2DD881);
  transform: rotate(90deg) scale(1.1);
  box-shadow: 0 8px 25px rgba(0, 217, 192, 0.5);
}

.letter-title {
  font-size: clamp(2rem, 5vw, 3rem);
  background: linear-gradient(135deg, #00D9C0, #2DD881);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 4px 20px rgba(0, 217, 192, 0.5));
}

.letter-body {
  padding: 3rem;
  position: relative;
}

.letter-image {
  width: 100%;
  height: 300px;
  object-fit: contain;
  background: #000;
  border-radius: 20px;
  margin-bottom: 2rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.letter-text {
  font-size: 1.25rem;
  line-height: 1.8;
  color: var(--color-text);
  white-space: pre-wrap;
  font-family: var(--font-body);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.letter-text::first-letter {
  font-size: 4rem;
  font-family: var(--font-display);
  font-weight: 900;
  background: linear-gradient(135deg, #00D9C0, #FFB800);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  float: left;
  line-height: 1;
  margin: 0.1em 0.15em 0 0;
  filter: drop-shadow(0 2px 10px rgba(0, 217, 192, 0.5));
}

.letter-signature {
  font-family: var(--font-handwriting);
  font-size: 2.25rem;
  background: linear-gradient(90deg, #FFB800, #FFD966);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: right;
  margin-top: 3rem;
  padding-right: 2rem;
  filter: drop-shadow(0 4px 15px rgba(255, 184, 0, 0.5));
}

.letter-decorations {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  overflow: hidden;
}

.decoration-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  opacity: 0.6;
  box-shadow: 0 0 20px currentColor;
}

.decoration-dot:nth-child(1) {
  top: 10%;
  left: 5%;
  background: #00D9C0;
  animation: float 4s ease-in-out infinite;
}

.decoration-dot:nth-child(2) {
  top: 70%;
  right: 10%;
  background: #2DD881;
  animation: float 5s ease-in-out infinite 1s;
}

.decoration-dot:nth-child(3) {
  bottom: 15%;
  left: 15%;
  background: #FFB800;
  animation: float 6s ease-in-out infinite 2s;
}

.letter-content::-webkit-scrollbar {
  width: 10px;
}

.letter-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
}

.letter-content::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #00D9C0, #2DD881);
  border-radius: 6px;
  box-shadow: 0 0 10px rgba(0, 217, 192, 0.5);
}

.letter-content::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #2DD881, #FFB800);
}

@media (max-width: 768px) {
  .letter-modal {
    padding: 1rem;
  }
  
  .letter-header {
    padding: 2rem 2rem 1.5rem;
  }
  
  .letter-body {
    padding: 2rem;
  }
  
  .letter-text {
    font-size: 1.125rem;
  }
  
  .letter-signature {
    font-size: 1.75rem;
    padding-right: 1rem;
  }
  
  .close-button {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }
}