body {
  font-family: Arial, sans-serif;
  text-align: center;
  background-color: #f8f3e6;
  margin: 0;
  padding: 0;
}

.container {
  padding: 20px;
}

h1 {
  color: #d4a017;
  margin-bottom: 20px;
}

#tree {
  position: relative;
  display: inline-block;
  width: 50%; /* Mặc định trên máy tính */
  max-width: 100%; /* Đảm bảo không vượt quá khung màn hình */
  margin: auto;
  
}

.mai-image {
  display: block;
  width: 100%; /* Đảm bảo ảnh mai chiếm hết khung cha */
  height: auto;
  border: 2px solid #FFD700;
  border-radius: 10px;
}

/* Lớp bao quanh phong bì */
.envelope-wrapper {
  position: absolute;
  width: 8%; /* Phong bì sẽ tỉ lệ theo ảnh cây mai */
  height: 12%;
  cursor: pointer;
  transition: box-shadow 0.3s ease;
}

/* Phong bì */
.envelope {
  width: 100%;
  height: 100%;
  background-image: url('lixi.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 8px;
}

/* Vị trí phong bì (theo tỉ lệ %) */
.envelope1 {
  top: 10%; /* 20% chiều cao của ảnh cây mai */
  left: 30%; /* 30% chiều rộng của ảnh cây mai */
  animation: shake1 3s ease-in-out infinite;
}

.envelope2 {
  top: 16%;
  left: 68%;
  animation: shake2 3s ease-in-out infinite;
}

.envelope3 {
  top: 51%;
  left: 17%;
  animation: shake3 3s ease-in-out infinite;
}

.envelope4 {
  top: 55%;
  left: 60%;
  animation: shake4 3s ease-in-out infinite;
}

.envelope5 {
  top: 26%;
  left: 22%;
  animation: shake5 3s ease-in-out infinite;
}

.envelope6 {
  top: 28%;
  left: 60%;
  animation: shake6 3s ease-in-out infinite;
}

.envelope7 {
  top: 50%;
  left: 82%;
  animation: shake7 3s ease-in-out infinite;
}

.envelope8 {
  top: 22%;
  left: 47%;
  animation: shake8 3s ease-in-out infinite;
}

@media (max-width: 768px) {
  .envelope-wrapper {
    width: 6%;
    height: 9%;
  }
}


/* Hiệu ứng lắc lư cho phong bì */
@keyframes shake1 {
  0%, 100% {
    transform: rotate(0deg);
    -webkit-transform: rotate(0deg); /* Thêm tiền tố cho Safari */
  }
  25% {
    transform: rotate(3deg);
    -webkit-transform: rotate(3deg); /* Thêm tiền tố cho Safari */
  }
  50% {
    transform: rotate(0deg);
    -webkit-transform: rotate(0deg); /* Thêm tiền tố cho Safari */
  }
  75% {
    transform: rotate(-3deg);
    -webkit-transform: rotate(-3deg); /* Thêm tiền tố cho Safari */
  }
}

/* Hiệu ứng lắc lư cho phong bì */
@keyframes shake4 {
  0%, 100% {
    transform: rotate(0deg);
    -webkit-transform: rotate(0deg); /* Thêm tiền tố cho Safari */
  }
  25% {
    transform: rotate(3deg);
    -webkit-transform: rotate(6deg); /* Thêm tiền tố cho Safari */
  }
  50% {
    transform: rotate(0deg);
    -webkit-transform: rotate(0deg); /* Thêm tiền tố cho Safari */
  }
  75% {
    transform: rotate(-3deg);
    -webkit-transform: rotate(-6deg); /* Thêm tiền tố cho Safari */
  }
}

@keyframes shake2 {
  0%, 100% {
    transform: rotate(0deg);
    -webkit-transform: rotate(0deg); /* Thêm tiền tố cho Safari */
  }
  25% {
    transform: rotate(-3deg);
    -webkit-transform: rotate(-3deg); /* Thêm tiền tố cho Safari */
  }
  50% {
    transform: rotate(0deg);
    -webkit-transform: rotate(0deg); /* Thêm tiền tố cho Safari */
  }
  75% {
    transform: rotate(3deg);
    -webkit-transform: rotate(3deg); /* Thêm tiền tố cho Safari */
  }
}

@keyframes shake3 {
  0%, 100% {
    transform: rotate(0deg);
    -webkit-transform: rotate(0deg); /* Thêm tiền tố cho Safari */
  }
  25% {
    transform: rotate(4deg);
    -webkit-transform: rotate(4deg); /* Thêm tiền tố cho Safari */
  }
  50% {
    transform: rotate(0deg);
    -webkit-transform: rotate(0deg); /* Thêm tiền tố cho Safari */
  }
  75% {
    transform: rotate(-4deg);
    - webkit-transform: rotate(-4deg); /* Thêm tiền tố cho Safari */
  }
}

/* Hiệu ứng sáng lên khi hover */
.envelope-wrapper:hover {
  box-shadow: none;
  -webkit-box-shadow: none; /* Thêm tiền tố cho Safari */
}

/* Hiệu ứng hoa mai rơi xuống */
@keyframes bloom {
  0% {
    transform: scale(0);
    opacity: 0;
    -webkit-transform: scale(0); /* Thêm tiền tố cho Safari */
  }
  50% {
    transform: scale(1.2);
    opacity: 0.7;
    -webkit-transform: scale(1.2); /* Thêm tiền tố cho Safari */
  }
  100% {
    transform: scale(1);
    opacity: 1;
    -webkit-transform: scale(1); /* Thêm tiền tố cho Safari */
  }
}

@keyframes fall {
  0% {
    transform: translateY(-200px);
    opacity: 1;
    -webkit-transform: translateY(-200px); /* Thêm tiền tố cho Safari */
  }
  100% {
    transform: translateY(1000px);
    opacity: 0;
    -webkit-transform: translateY(1000px); /* Thêm tiền tố cho Safari */
  }
}

/* Hiệu ứng hoa mai */
.flower {
  position: absolute;
  width: 40px;
  height: 40px;
  background-image: url('hoa-mai.png'); /* Thay bằng đường dẫn ảnh hoa mai của bạn */
  background-size: cover;
  animation: bloom 2s forwards, fall 4s ease-in forwards;
  pointer-events: none;
}

/* Nút đóng */
.close:hover {
  color: #ff6347; /* Màu cam đậm khi hover */
}

/* Hiệu ứng khi modal xuất hiện */
@keyframes modalIn {
  0% {
    transform: scale(0.7);
    opacity: 0;
    -webkit-transform: scale(0.7); /* Thêm tiền tố cho Safari */
  }
  100% {
    transform: scale(1);
    opacity: 1;
    -webkit-transform: scale(1); /* Thêm tiền tố cho Safari */
  }
}

/* Modal */
.modal {
  display: none; /* Ban đầu modal ẩn */
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7); /* Nền tối mờ cho toàn màn hình */
  z-index: 10;
  opacity: 0; /* Để hiệu ứng mượt mà */
  transition: opacity 0.5s ease; /* Hiệu ứng mờ dần khi mở modal */
  -webkit-transition: opacity 0.5s ease; /* Thêm tiền tố cho Safari */
  display: flex;
  justify-content: center; /* Căn giữa modal theo chiều ngang */
  align-items: flex-start; /* Căn trên modal theo chiều dọc */
  padding-top: 10vh; /* Đệm trên để modal không bị dính vào cạnh trên của màn hình */
}

/* Modal nội dung */
.modal-content {
  background-color: #fff7e6; /* Nền màu vàng nhạt để tạo cảm giác ấm áp */
  margin: 15px auto; /* Đảm bảo khoảng cách bên ngoài */
  padding: 30px;
  border-radius: 15px;
  width: 50%;
  max-width: 600px; /* Đảm bảo chiều rộng tối đa */
  max-height: 80vh; /* Giới hạn chiều cao modal để tránh vượt quá màn hình */
  overflow-y: auto; /* Thêm thanh cuộn khi nội dung quá dài */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3); /* Bóng đổ mềm mại */
  text-align: center;
  animation: modalIn 0.5s ease-out; /* Hiệu ứng khi modal xuất hiện */
}

/* Khung lời chúc */
.modal-content p {
  font-size: 24px;
  font-weight: bold;
  color: #d4a017; /* Màu vàng ấm áp, dễ đọc */
  margin: 0;
  padding: 20px;
  background-color: #fff; /* Nền trắng để nổi bật lời chúc */
  border-radius: 10px;
  border: 2px solid #f4a261; /* Viền mềm mại màu cam */
  box-shadow: 0 4px 10px rgba(0 , 0, 0.2); /* Bóng đổ cho lời chúc */
}

/* Nút đóng */
.close {
  position: absolute;
  top: 10px;
  right: 20px;
  font-size: 30px;
  cursor: pointer;
  color: #ff4500; /* Màu cam sáng để dễ thấy */
  transition: color 0.3s ease; /* Hiệu ứng thay đổi màu sắc */
  -webkit-transition: color 0.3s ease; /* Thêm tiền tố cho Safari */
}


@media (max-width: 768px) { /* Màn hình nhỏ hơn hoặc bằng 768px */
  #tree {
    width: 100%; /* Chiếm 90% chiều rộng màn hình trên thiết bị nhỏ */
  }
}


#footer-text {
    text-align: center;
    margin-top: 20px;
    font-size: 16px;
    font-weight: bold;
    color: #007bff;
    font-family: 'Roboto', sans-serif;
    animation: pulse 2s infinite;
}

#footer-text span {
    color: #ff4500;
    font-size: 18px;
    font-style: italic;
}

@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}


h1 {
    font-size: 24px; /* Kích thước chữ vừa phải */
    text-align: center; /* Căn giữa tiêu đề */
    color: #d4a017; /* Màu chữ tối */
    font-family: 'Arial', sans-serif; /* Phông chữ */
    margin-top: 20px; /* Khoảng cách phía trên */
}

