* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Dancing Script", cursive;
  background: linear-gradient(135deg, #ffeef8 0%, #ffd6e8 50%, #ffc0d9 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
}

/* Login Screen Styles */
.login-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #ffeef8 0%, #ffd6e8 50%, #ffc0d9 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  font-family: "Poppins", sans-serif;
}

.login-container {
  background: rgba(255, 255, 255, 0.95);
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(255, 107, 157, 0.3);
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.login-title {
  font-size: 32px;
  color: #ff6b9d;
  margin-bottom: 10px;
  font-weight: 600;
}

.login-info {
  color: #666;
  font-size: 14px;
  margin-bottom: 30px;
  line-height: 1.6;
}

.password-wrapper {
  position: relative;
  margin-bottom: 20px;
}

.password-input {
  width: 100%;
  padding: 15px 50px 15px 20px;
  border: 2px solid #ffc0d9;
  border-radius: 10px;
  font-size: 16px;
  font-family: "Poppins", sans-serif;
  outline: none;
  transition: border-color 0.3s;
}

.password-input:focus {
  border-color: #ff6b9d;
}

.toggle-password {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  transition: color 0.3s;
}

.toggle-password:hover {
  color: #ff6b9d;
}

.login-button {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #ff6b9d 0%, #ff8fab 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  font-family: "Poppins", sans-serif;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  margin-bottom: 15px;
}

.login-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(255, 107, 157, 0.4);
}

.login-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.error-message {
  color: #ff6b9d;
  font-size: 14px;
  margin-top: 10px;
  min-height: 20px;
  display: none;
}

.brand-text {
  margin-top: 30px;
  font-size: 11px;
  color: #bbb;
  font-weight: 400;
  letter-spacing: 0.3px;
  line-height: 1.6;
}

.brand-link {
  color: #cc9fb3;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s, text-decoration 0.3s;
}

.brand-link:hover {
  color: #b88ba3;
  text-decoration: underline;
}

/* Smooth scrolling for letter body */
.letter-body::-webkit-scrollbar {
  width: 8px;
}

.letter-body::-webkit-scrollbar-track {
  background: rgba(255, 182, 193, 0.1);
  border-radius: 10px;
}

.letter-body::-webkit-scrollbar-thumb {
  background: rgba(255, 107, 157, 0.3);
  border-radius: 10px;
}

.letter-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 107, 157, 0.5);
}

/* Animated Background Gradient */
.background-gradient {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
      circle at 20% 50%,
      rgba(255, 182, 193, 0.4) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 80%,
      rgba(255, 105, 180, 0.3) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 40% 20%,
      rgba(255, 192, 203, 0.3) 0%,
      transparent 50%
    ),
    linear-gradient(135deg, #ffeef8 0%, #ffd6e8 30%, #ffc0d9 60%, #ffb3d1 100%);
  z-index: 0;
}

.container {
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  perspective: 1000px;
}

/* Sparkles Container */
.sparkles-container {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 1;
}

.sparkle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255, 182, 193, 0.8),
    0 0 12px rgba(255, 105, 180, 0.6);
  animation: sparkleFloat 8s infinite ease-in-out;
  pointer-events: none;
}

@keyframes sparkleFloat {
  0% {
    transform: translateY(100vh) translateX(0) scale(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
    transform: translateY(90vh) translateX(20px) scale(1);
  }
  50% {
    opacity: 1;
    transform: translateY(50vh) translateX(50px) scale(1.2);
  }
  90% {
    opacity: 1;
    transform: translateY(10vh) translateX(80px) scale(1);
  }
  100% {
    transform: translateY(-10vh) translateX(100px) scale(0);
    opacity: 0;
  }
}

/* Floating Hearts Background */
.hearts-container {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 2;
}

.heart {
  position: absolute;
  width: 24px;
  height: 24px;
  pointer-events: none;
  filter: drop-shadow(0 0 8px rgba(255, 107, 157, 0.4));
  will-change: transform, left, top;
  user-select: none;
  color: #ff6b9d;
}

.heart svg {
  width: 100%;
  height: 100%;
}

.heart.small {
  width: 18px;
  height: 18px;
}

.heart.medium {
  width: 24px;
  height: 24px;
}

.heart.large {
  width: 32px;
  height: 32px;
}

.inline-heart {
  display: inline-block;
  vertical-align: middle;
  margin-left: 5px;
  color: #ff6b9d;
}

/* Envelope Styles */
.envelope-wrapper {
  position: relative;
  z-index: 10;
  cursor: pointer;
  transition: transform 0.3s ease;
  filter: drop-shadow(0 15px 40px rgba(255, 107, 157, 0.4));
}

.envelope-wrapper:hover {
  transform: scale(1.08);
  filter: drop-shadow(0 20px 50px rgba(255, 107, 157, 0.5));
}

.envelope {
  width: 400px;
  height: 280px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s ease;
}

.envelope.opened {
  transform: rotateY(180deg);
}

.envelope-front,
.envelope-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
}

.envelope-front {
  transform: rotateY(0deg);
}

.envelope-back {
  transform: rotateY(180deg);
}

.envelope-body {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #ff9ec0 0%, #ff6b9d 50%, #ff4d94 100%);
  border-radius: 12px;
  position: relative;
  box-shadow: 0 15px 40px rgba(255, 107, 157, 0.4),
    0 5px 15px rgba(255, 105, 180, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.envelope-flap {
  width: 100%;
  height: 50%;
  background: linear-gradient(135deg, #ffb3d1 0%, #ff9ec0 50%, #ff8bb5 100%);
  border-radius: 12px 12px 0 0;
  position: absolute;
  top: 0;
  transform-origin: top;
  transition: transform 0.6s ease;
  z-index: 2;
  box-shadow: 0 -2px 10px rgba(255, 107, 157, 0.2);
}

.envelope.opened .envelope-flap {
  transform: rotateX(-180deg);
}

.seal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  z-index: 3;
  transition: opacity 0.3s ease;
  filter: drop-shadow(0 4px 8px rgba(255, 107, 157, 0.5));
  animation: sealPulse 2s ease-in-out infinite;
}

@keyframes sealPulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.05);
  }
}

.envelope.opened .seal {
  opacity: 0;
}

/* Letter Styles */
.letter-container {
  position: absolute;
  z-index: 5;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  left: 50%;
  top: 50%;
  opacity: 0;
  transform: translate(-50%, calc(-50% + 50px)) scale(0.8);
  transition: all 0.8s ease;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0;
}

.letter-container.revealed {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.letter-container.closing {
  opacity: 0;
  transform: translate(-50%, calc(-50% + 50px)) scale(0.8);
}

.letter {
  background: linear-gradient(135deg, #fff9fc 0%, #ffeef8 50%, #fff0f5 100%);
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 25px 70px rgba(255, 107, 157, 0.5),
    0 10px 30px rgba(255, 105, 180, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  position: relative;
  border: 3px solid rgba(255, 182, 193, 0.6);
  overflow: hidden;
  width: 100%;
  max-height: 90vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.letter::after {
  content: "";
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 182, 193, 0.1) 0%,
    transparent 70%
  );
  animation: letterGlow 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes letterGlow {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

.letter::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, #ff6b9d, #ffb3d1);
  border-radius: 12px 0 0 12px;
}

.letter-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 50px;
  box-sizing: border-box;
}

.letter-header {
  position: sticky;
  top: 0;
  background: linear-gradient(135deg, #fff9fc 0%, #ffeef8 50%, #fff0f5 100%);
  z-index: 2;
  padding-top: 20px;
  padding-bottom: 20px;
  margin-bottom: 15px;
  margin-top: 0;
}

.letter-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  overflow-x: hidden;
}

.letter-close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: rgba(255, 107, 157, 0.2);
  border: 2px solid rgba(255, 107, 157, 0.4);
  color: #ff6b9d;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.3s ease;
  z-index: 10;
  backdrop-filter: blur(5px);
}

.letter-close-btn:hover {
  background: rgba(255, 107, 157, 0.4);
  border-color: rgba(255, 107, 157, 0.6);
  transform: scale(1.1);
}

.letter-title {
  font-family: "Great Vibes", cursive;
  font-size: 3rem;
  color: #ff4d94;
  text-align: center;
  margin-bottom: 0;
  margin-top: 0;
  padding-top: 0;
  padding-left: 50px;
  padding-right: 50px;
  text-shadow: 2px 2px 4px rgba(255, 107, 157, 0.3),
    0 0 20px rgba(255, 182, 193, 0.4);
  animation: fadeInUp 0.8s ease 0.3s both;
  background: linear-gradient(135deg, #ff4d94 0%, #ff6b9d 50%, #ff8bb5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.letter-message {
  font-family: "Dancing Script", cursive;
  font-size: 2rem;
  color: #a64d79;
  line-height: 2;
  text-align: center;
  margin-bottom: 35px;
  padding-top: 20px;
  animation: fadeInUp 0.8s ease 0.5s both;
  text-shadow: 1px 1px 2px rgba(255, 182, 193, 0.2);
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

.letter-signature {
  font-family: "Dancing Script", cursive;
  font-size: 1.8rem;
  color: #ff6b9d;
  text-align: right;
  font-weight: 600;
  animation: fadeInUp 0.8s ease 0.7s both;
  text-shadow: 1px 1px 3px rgba(255, 107, 157, 0.3);
  white-space: pre-line;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Music Toggle Button */
.music-toggle {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 55px;
  height: 55px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    rgba(255, 107, 157, 0.9) 0%,
    rgba(255, 105, 180, 0.9) 100%
  );
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(255, 107, 157, 0.4),
    0 2px 8px rgba(255, 105, 180, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.music-toggle:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 107, 157, 1) 0%,
    rgba(255, 105, 180, 1) 100%
  );
  transform: scale(1.15);
  box-shadow: 0 8px 25px rgba(255, 107, 157, 0.5),
    0 3px 10px rgba(255, 105, 180, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.music-toggle svg {
  width: 24px;
  height: 24px;
}

.music-toggle.muted svg {
  opacity: 0.5;
}

/* Responsive Design */
@media (max-width: 768px) {
  .envelope {
    width: 320px;
    height: 224px;
  }

  .envelope-body {
    border-radius: 12px;
  }

  .envelope-flap {
    border-radius: 12px 12px 0 0;
  }

  .seal {
    width: 65px;
    height: 65px;
  }

  .letter-container {
    width: 95%;
    padding: 0;
    margin: 0;
    max-height: min(
      85vh,
      calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom))
    );
  }

  .letter {
    border-radius: 16px;
    box-shadow: 0 25px 70px rgba(255, 107, 157, 0.5),
      0 10px 30px rgba(255, 105, 180, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.6);
    max-height: 85vh;
    margin: 0;
  }

  .letter-content {
    padding: 50px 25px 35px 25px;
    max-height: calc(85vh - 100px);
  }

  .letter-header {
    padding-top: 20px;
    padding-bottom: 20px;
    margin-top: 0;
    flex-shrink: 0;
  }

  .letter-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .letter-close-btn {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    font-size: 24px;
    z-index: 15;
    min-width: 40px;
    min-height: 40px;
  }

  .letter-title {
    font-size: 2.8rem;
    padding-top: 5px;
    margin-top: 0;
    padding-left: 50px;
    padding-right: 50px;
  }

  .letter-message {
    font-size: 1.6rem;
    line-height: 1.8;
  }

  .letter-signature {
    font-size: 1.5rem;
  }

  .music-toggle {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
  }

  .heart.large {
    font-size: 26px;
  }

  .heart.medium {
    font-size: 20px;
  }

  .heart.small {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .envelope {
    width: 280px;
    height: 196px;
  }

  .envelope-body {
    border-radius: 10px;
  }

  .envelope-flap {
    border-radius: 10px 10px 0 0;
  }

  .seal {
    width: 55px;
    height: 55px;
  }

  .letter-container {
    width: 95%;
    padding: 0;
    margin: 0;
    max-height: min(
      80vh,
      calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom))
    );
  }

  .letter {
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(255, 107, 157, 0.5),
      0 8px 25px rgba(255, 105, 180, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.6);
    max-height: 80vh;
    margin: 0;
  }

  .letter-content {
    padding: 45px 20px 30px 20px;
    max-height: calc(80vh - 90px);
  }

  .letter-header {
    padding-top: 15px;
    padding-bottom: 15px;
    margin-top: 0;
    flex-shrink: 0;
  }

  .letter-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .letter-close-btn {
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
    font-size: 22px;
    z-index: 15;
    min-width: 38px;
    min-height: 38px;
  }

  .letter-title {
    font-size: 2.2rem;
    padding-top: 5px;
    margin-top: 0;
    padding-right: 45px;
    padding-left: 15px;
  }

  .letter-message {
    font-size: 1.4rem;
    line-height: 1.7;
  }

  .letter-signature {
    font-size: 1.3rem;
  }

  .heart.large {
    font-size: 22px;
  }

  .heart.medium {
    font-size: 18px;
  }

  .heart.small {
    font-size: 14px;
  }
}

/* Background color variations */
body.soft-pink .background-gradient {
  background: radial-gradient(
      circle at 20% 50%,
      rgba(255, 182, 193, 0.4) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 80%,
      rgba(255, 105, 180, 0.3) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 40% 20%,
      rgba(255, 192, 203, 0.3) 0%,
      transparent 50%
    ),
    linear-gradient(135deg, #ffeef8 0%, #ffd6e8 30%, #ffc0d9 60%, #ffb3d1 100%);
}

body.lavender .background-gradient {
  background: radial-gradient(
      circle at 20% 50%,
      rgba(230, 230, 250, 0.4) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 80%,
      rgba(221, 160, 221, 0.3) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 40% 20%,
      rgba(238, 130, 238, 0.3) 0%,
      transparent 50%
    ),
    linear-gradient(135deg, #f3e5f5 0%, #e1bee7 30%, #ce93d8 60%, #ba68c8 100%);
}

body.rose .background-gradient {
  background: radial-gradient(
      circle at 20% 50%,
      rgba(255, 192, 203, 0.4) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 80%,
      rgba(255, 105, 180, 0.3) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 40% 20%,
      rgba(255, 20, 147, 0.2) 0%,
      transparent 50%
    ),
    linear-gradient(135deg, #fce4ec 0%, #f8bbd0 30%, #f48fb1 60%, #f06292 100%);
}

body.peach .background-gradient {
  background: radial-gradient(
      circle at 20% 50%,
      rgba(255, 218, 185, 0.4) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 80%,
      rgba(255, 182, 193, 0.3) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 40% 20%,
      rgba(255, 160, 122, 0.3) 0%,
      transparent 50%
    ),
    linear-gradient(135deg, #fff3e0 0%, #ffe0b2 30%, #ffccbc 60%, #ffb3ba 100%);
}

/* Demo Container Styles */
.demo-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.demo-balloon {
  background: rgba(255, 255, 255, 0.95);
  padding: 15px 20px;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  max-width: 280px;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}

.demo-balloon.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.demo-text {
  font-family: "Poppins", sans-serif;
  font-size: 14px;
  color: #555;
  margin-bottom: 8px;
  text-align: center;
}

.demo-link {
  display: block;
  font-family: "Poppins", sans-serif;
  font-size: 14px;
  color: #ff6b9d;
  text-decoration: none;
  text-align: center;
  font-weight: 500;
  transition: color 0.3s;
}

.demo-link:hover {
  color: #ff4785;
}

.demo-cart {
  width: 55px;
  height: 55px;
  background: linear-gradient(135deg, #ffc0d9 0%, #ffb3d1 100%);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 107, 157, 0.3);
  transition: transform 0.3s, box-shadow 0.3s;
}

.demo-cart:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(255, 107, 157, 0.5);
}

.demo-cart svg {
  width: 24px;
  height: 24px;
  color: #ff6b9d;
}

@media (max-width: 480px) {
  .demo-container {
    bottom: 15px;
    right: 15px;
  }

  .demo-balloon {
    max-width: 240px;
    padding: 12px 16px;
  }

  .demo-text,
  .demo-link {
    font-size: 13px;
  }

  .demo-cart {
    width: 50px;
    height: 50px;
  }

  .demo-cart svg {
    width: 22px;
    height: 22px;
  }
}
