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

body {
  font-family: 'Lato', sans-serif;
  background: linear-gradient(135deg, #011f4b 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 90%;
  max-width: 800px;
}

.card-container {
  perspective: 1500px;
  cursor: pointer;
  width: 100%;
}

.card {
  width: 100%;
  max-width: 600px;
  height: 600px;
  margin: 0 auto;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.4, 0.2, 0.2, 1);
}

.card.flipped {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.card-front {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 15px;
}

.image-wrapper {
  position: relative;
  width: 95%;
  aspect-ratio: 4 / 3;
  border-radius: 15px;
  overflow: hidden;
  margin: 0 auto 20px auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.3) 100%);
}

.front-title {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 700;
  color: #2d3748;
  text-align: center;
  margin-bottom: 10px;
}

.shot-msg {
  color: #718096;
  font-size: 12px;
  padding-bottom: 20px;
}

.click-hint {
  color: #718096;
  font-size: 16px;
  animation: pulse 2s infinite;
  font-weight: 300;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

.card-back {
  background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 30px;
  position: relative;
}

.decorative-border {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  bottom: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 15px;
  pointer-events: none;
}

.message-content {
  text-align: center;
  z-index: 1;
}

#to-name {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  color: #2d3748;
  margin-bottom: 30px;
  font-weight: 700;
}

.message-text {
  font-size: 20px;
  line-height: 1.8;
  color: #4a5568;
  margin-bottom: 40px;
  font-weight: 300;
}

.ending {
  font-size: 18px;
  color: #718096;
  font-style: italic;
}

.signature {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  color: #2d3748;
  font-weight: 700;
  font-style: normal;
  display: inline-block;
  margin-top: 10px;
}

.share-section {
  display: none;
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.share-btn {
  background: white;
  color: #764ba2;
  border: none;
  padding: 12px 30px;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.share-btn.copied {
  background: #48bb78;
  color: white;
}

@media (max-width: 480px) {
  .container {
    width: 90%;
  }

  .card {
    width: 100%;
    height: 520px;
    max-width: none;
  }

  .card-front {
    padding: 20px;
  }

  .card-back {
    padding: 30px 20px;
  }

  .image-wrapper {
    aspect-ratio: 4 / 3;
    max-height: 60%;
    margin-bottom: 20px;
  }

  .front-title {
    font-size: 24px;
    margin-bottom: 10px;
  }

  .click-hint {
    font-size: 14px;
  }

  #to-name {
    font-size: 22px;
    margin-bottom: 20px;
  }

  .message-text {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 30px;
  }

  .ending {
    font-size: 16px;
  }

  .signature {
    font-size: 20px;
  }

  .share-btn {
    padding: 10px 24px;
    font-size: 14px;
  }
}

/* Smaller phones */
@media (max-width: 375px) {
  .card {
    height: 480px;
    width: 100%;
    max-width: none;
  }

  .front-title {
    font-size: 22px;
  }

  .message-text {
    font-size: 15px;
  }
}

/* Landscape orientation on phones */
@media (max-height: 600px) and (orientation: landscape) {
  body {
    padding: 10px;
  }

  .card {
    height: 400px;
    max-width: 280px;
  }

  .image-wrapper {
    aspect-ratio: 4 / 3;
    max-height: 50%;
  }

  .front-title {
    font-size: 20px;
    margin-bottom: 8px;
  }

  .click-hint {
    font-size: 13px;
  }

  #to-name {
    font-size: 20px;
    margin-bottom: 15px;
  }

  .message-text {
    font-size: 14px;
    margin-bottom: 20px;
  }
}