body {
  direction: rtl;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(#f4e9d8, #f7ecd9);
  background-attachment: fixed;
  background-position: center;
  background-size: cover;
}

#closed-letter {
  position: relative;
  margin: 140px auto;
  width: 380px;
  height: 240px;
  /* envelope body: more ornate gradient */
  background: linear-gradient(135deg, #fffbea, #f1e0c8);
  border: 4px solid #dcb67c;
  border-radius: 18px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  cursor: pointer;
  color: #5c3a1d;
  font-size: 1.5em;
  overflow: hidden;
}

#closed-letter:hover {
  transform: scale(1.05);
  transition: transform 0.2s ease-in-out;
}

/* add a triangular flap to make the envelope look more ornate */
#closed-letter .flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0;
  /* adjust flap dimensions for larger envelope */
  border-bottom: 120px solid #f5e6d0;
  border-left: 190px solid transparent;
  border-right: 190px solid transparent;
  z-index: 1;
}

/* give the flap a slight shadow for depth */
#closed-letter .flap::after {
  content: '';
  position: absolute;
  bottom: -110px;
  left: -175px;
  width: 0;
  height: 0;
  border-bottom: 120px solid rgba(0, 0, 0, 0.05);
  border-left: 190px solid transparent;
  border-right: 190px solid transparent;
  z-index: -1;
}

#closed-letter .envelope-icon {
  font-size: 3em;
  margin-bottom: 10px;
}

#closed-letter .decor {
  position: absolute;
  font-size: 1.5em;
  color: #e84393;
  user-select: none;
  pointer-events: none;
  /* gentle floating animation for decorative hearts */
  animation: floatHeart 3s ease-in-out infinite;
}

/* animation for floating hearts on the envelope */
@keyframes floatHeart {
  0% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0); }
}

#closed-letter .top-left {
  top: 8px;
  left: 12px;
}

#closed-letter .bottom-right {
  bottom: 8px;
  right: 12px;
}

#letter-container {
  display: none;
}

#response-buttons {
  margin-top: 30px;
  display: none;
  justify-content: center;
  gap: 20px;
}

button.choice {
  background-color: #e6c79c;
  border: none;
  border-radius: 10px;
  padding: 12px 24px;
  font-size: 1.2em;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

button.choice:hover {
  background-color: #d5b482;
}

#message-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 2000;
}

#message-overlay .msg {
  font-size: 2em;
  margin-bottom: 20px;
}

#message-overlay button {
  background-color: #e6c79c;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 1em;
  color: #fff;
  cursor: pointer;
}

.confetti-heart {
  position: absolute;
  font-size: 2em;
  color: #e84393;
  user-select: none;
  pointer-events: none;
  opacity: 0.8;
}

/* Verse container above the envelope */
#verse-container {
  text-align: center;
  margin-top: 40px;
  margin-bottom: 10px;
  color: #6f3f23;
  font-family: 'Georgia', serif;
}
#verse-container .verse-text {
  font-size: 1.8em;
  font-weight: bold;
}
#verse-container .verse-source {
  font-size: 1em;
  font-style: italic;
  margin-left: 6px;
}

/* Personal message on the envelope */
#closed-letter .for-message {
  position: absolute;
  bottom: 35px;
  width: 100%;
  text-align: center;
  font-family: 'Georgia', serif;
  font-size: 1em;
  font-style: italic;
  font-weight: 600;
  color: #6f3f23;
  user-select: none;
  pointer-events: none;
}

.highlight {
  color: #c45d5d;
  font-weight: bold;
}

/* emphasise the final proposal question */
#letter-text p.question {
  font-size: 1.6em;
  font-weight: bold;
  color: #a8332f;
  text-align: center;
  margin-top: 20px;
  margin-bottom: 10px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

#letter-container {
  background-color: rgba(255, 249, 240, 0.97);
  border: 2px solid #e5c69a;
  border-radius: 20px;
  margin: 80px auto;
  padding: 50px;
  max-width: 900px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  position: relative;
  overflow: hidden;
}

#header {
  position: relative;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#header h1 {
  flex-grow: 1;
  text-align: center;
  font-family: 'Georgia', serif;
  font-size: 3.5em;
  margin: 0;
  color: #6f3f23;
  text-shadow: 2px 2px 3px rgba(0,0,0,0.25);
  letter-spacing: 1.5px;
  border-bottom: 2px solid #e6c79c;
  padding-bottom: 12px;
}

/* profile images: larger size and decorative frame */
.portrait {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 5px solid #e6c79c;
  object-fit: cover;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.man {
  margin-right: 20px;
}

.woman {
  margin-left: 20px;
}

#letter-text p {
  font-size: 1.2em;
  line-height: 1.5em;
  margin-bottom: 15px;
  color: #5c3a1d;
  white-space: pre-wrap;
}

.heart {
  position: fixed;
  bottom: 20px;
  left: 20px;
  font-size: 2em;
  color: #ff5e5e;
  z-index: 1000;
}

@media (max-width: 600px) {
  .portrait {
    /* larger images on mobile to keep prominence */
    width: 110px;
    height: 110px;
  }
  #letter-container {
    margin: 40px 10px;
    padding: 20px;
  }
}
