/* ---------- NỀN TOÀN TRANG ---------- */
body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, #ffe6f0, #ffb6c1, #ffd1dc);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  position: relative;
}

/* ---------- HỘP CHÍNH ---------- */
.container {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  padding: 35px;
  border-radius: 20px;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 6px 25px rgba(255, 182, 193, 0.4);
  text-align: center;
  z-index: 10;
  animation: fadeIn 1.5s ease-out;
  max-height: 90vh;
  overflow-y: auto;

}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------- INPUT + BUTTON ---------- */
input {
  width: 85%;
  padding: 12px;
  margin: 8px 0;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid #f8a5c2;
  outline: none;
  transition: all 0.3s ease;
}

input:focus {
  border-color: #ff8cb4;
  box-shadow: 0 0 10px rgba(255, 182, 193, 0.4);
}

button {
  padding: 10px 25px;
  margin-top: 15px;
  background: linear-gradient(135deg, #ff8fab, #f06292);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.3s ease;
}

button:hover {
  background: linear-gradient(135deg, #f06292, #ec407a);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(240, 98, 146, 0.4);
}

/* ---------- DANH SÁCH & NỘI DUNG THƯ ---------- */
ul#letter-list {
  list-style: none;
  padding: 0;
}
ul#letter-list li {
  background: #ffe4ec;
  margin: 8px 0;
  padding: 12px;
  cursor: pointer;
  border-radius: 8px;
  font-weight: bold;
  transition: background 0.2s, transform 0.2s;
}
ul#letter-list li:hover {
  background: #ffc1d6;
  transform: scale(1.02);
}
.letter-body {
  text-align: left;
  white-space: pre-wrap;
  margin-top: 10px;
  font-family: 'Courier New', monospace;
  font-size: 15px;
  line-height: 1.5;
  color: #555;
}

/* ---------- ẢNH BAY LOẠN ---------- */
.hello-kitty, .golden, .kitty-fly, .dog-top {
  position: absolute;
  width: 120px;
  height: auto;
  z-index: 1;
  opacity: 0.9;
  pointer-events: none; /* để không ảnh hưởng khi click */
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
  animation: flyAround 10s linear infinite;
}

/* Animation bay loạn */
@keyframes flyAround {
  0% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(40px, -60px) rotate(15deg); }
  50% { transform: translate(-60px, 40px) rotate(-10deg); }
  75% { transform: translate(60px, 20px) rotate(10deg); }
  100% { transform: translate(-30px, -50px) rotate(-15deg); }
}
/* ---------- RESPONSIVE DESIGN FOR MOBILE ---------- */
@media (max-width: 600px) {
  body {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px;
    background: linear-gradient(180deg, #ffe6f0, #ffd1dc);
  }

  .container {
    width: 95%;
    max-width: none;
    padding: 20px;
    border-radius: 15px;
    max-height: 85vh;
    overflow-y: auto;
  }

  h2 {
    font-size: 1.2rem;
  }

  input {
    width: 100%;
    font-size: 1rem;
    padding: 10px;
  }

  button {
    width: 100%;
    font-size: 1rem;
    padding: 12px;
  }

  ul#letter-list li {
    font-size: 0.95rem;
    padding: 10px;
  }

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

  /* 🩷 Giảm kích thước icon bay để không che màn hình */
  .hello-kitty, .golden, .kitty-fly, .dog-top {
    width: 70px;
    opacity: 0.8;
  }
}
#letter-body {
    white-space: pre-wrap; /* Quan trọng nhất để hiện xuống dòng */
    line-height: 1.6;      /* Khoảng cách dòng cho dễ đọc */
    text-align: left;      /* Căn trái cho giống lá thư */
}