:root {
  --color-background: #faf6f1;
  --color-surface: #ffffff;
  --color-text: #524545;
  --color-accent: #c26a6a;
  --color-accent-hover: #b44e4e;
}

html,
body {
  height: 100%;
  margin: 0;
}

.font-script {
  font-family: "Petit Formal Script", cursive;
  font-size: 15px!important;
  font-weight: bold;
}

.font-elegant {
  font-family: "Cormorant Garamond", serif;
}

.font-handwritten {
  font-family: "Tangerine", cursive;
  font-weight: 700;
}

.paper-texture {
  background-color: var(--color-background);
  background-image:
    radial-gradient(
      ellipse at 20% 30%,
      rgba(196, 164, 132, 0.08) 0%,
      transparent 50%
    ),
    radial-gradient(
      ellipse at 80% 70%,
      rgba(196, 164, 132, 0.06) 0%,
      transparent 50%
    ),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
}

.letter-texture {
  background-color: #fffef9;
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='paper'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23paper)' opacity='0.04'/%3E%3C/svg%3E"),
    radial-gradient(
      ellipse at 30% 40%,
      rgba(196, 164, 132, 0.03) 0%,
      transparent 40%
    );
}

.close-btn-container {
  width: 100%;
  display: flex;
  justify-content: center;
}

.envelope-container {
  perspective: 1000px;
}

.envelope {
  position: relative;
  width: 280px;
  height: 180px;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.envelope:hover {
  transform: translateY(-8px) rotateX(5deg);
}

.envelope-body {
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, #fffef9 0%, #f5efe6 100%);
  border-radius: 4px;
  box-shadow:
    0 4px 20px rgba(93, 78, 78, 0.12),
    0 8px 40px rgba(196, 164, 132, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(196, 164, 132, 0.3);
}

.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(180deg, #f5efe6 0%, #ede5d8 100%);
  clip-path: polygon(0 0, 50% 100%, 100% 0);
  transform-origin: top center;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
}

.envelope.open .envelope-flap {
  transform: rotateX(180deg);
}

.envelope-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(180deg, #e8dfd2 0%, #f5efe6 100%);
  clip-path: polygon(0 0, 50% 100%, 100% 0);
  z-index: -1;
}

.wax-seal {
  position: absolute;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 50px;
  background: linear-gradient(145deg, var(--color-accent-hover) 0%, var(--color-accent-hover) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 3px 10px rgba(0, 0, 0, 0.25),
    inset 0 2px 4px rgba(255, 255, 255, 0.3),
    inset 0 -2px 4px rgba(0, 0, 0, 0.12);
  transition: all 0.3s ease;
}

.envelope:hover .wax-seal {
  box-shadow:
    0 5px 15px rgba(0, 0, 0, 0.35),
    inset 0 2px 4px rgba(255, 255, 255, 0.3),
    inset 0 -2px 4px rgba(0, 0, 0, 0.12);
}

.wax-seal svg {
  width: 24px;
  height: 24px;
  color: #fffef9;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
}

.letter {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  width: 240px;
  max-height: 200px;
  overflow: hidden;
  padding: 24px 20px;
  border-radius: 2px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  opacity: 0;
  pointer-events: none;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.2s;
  z-index: -2;
}

.letter {
  background-color: #fffef9;
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='paper'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23paper)' opacity='0.04'/%3E%3C/svg%3E"),
    radial-gradient(
      ellipse at 30% 40%,
      rgba(196, 164, 132, 0.03) 0%,
      transparent 40%
    );
}

.envelope.open .letter {
  transform: translateX(-50%) translateY(-140px);
  opacity: 1;
  pointer-events: auto;
}

.floating-hearts {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.heart {
  position: absolute;
  opacity: 0;
  animation: float-up 4s ease-in-out forwards;
}

@keyframes float-up {
  0% {
    opacity: 0;
    transform: translateY(100%) scale(0.5) rotate(0deg);
  }
  20% {
    opacity: 0.6;
  }
  80% {
    opacity: 0.4;
  }
  100% {
    opacity: 0;
    transform: translateY(-100%) scale(1) rotate(20deg);
  }
}

.decorative-line {
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--color-accent),
    transparent
  );
  margin: 16px 0;
}

.receiver-salutation {
  display: block;
  font-family: "Petit Formal Script", cursive;
  color: var(--color-accent);
  margin-bottom: 8px;
}

.receiver-separator {
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--color-accent),
    transparent
  );
  margin: 8px 0 14px;
}

@keyframes gentle-pulse {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

.pulse-hint {
  animation: gentle-pulse 2s ease-in-out infinite;
}

.message-overlay {
  position: fixed;
  inset: 0;
  background: rgba(250, 246, 241, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  z-index: 100;
}

.message-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.message-card {
  background-color: #fffef9;
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='paper'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23paper)' opacity='0.04'/%3E%3C/svg%3E"),
    radial-gradient(
      ellipse at 30% 40%,
      rgba(196, 164, 132, 0.03) 0%,
      transparent 40%
    );
  max-height: 90vh;
  max-width: 90vw;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #c4a484;
  padding: 48px 40px;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(93, 78, 78, 0.15);
  width: 500px;
  text-align: left;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.message-overlay.visible .message-card {
  transform: scale(1) translateY(0);
}

.music-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: #2d2d2d;
  background-image: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
  border-radius: 12px;
  padding: 16px;
  width: 280px;
  max-width: 280px;
  min-width: 280px;
  max-height: 170px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  z-index: 50;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.music-widget-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.music-widget-play-icon {
  width: 12px;
  height: 12px;
  background: var(--color-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse-play 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

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

.music-widget-header p {
  color: #999;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}

.music-album {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.music-album > div {
  flex: 1;
  min-width: 0;
}

.music-album-art {
  width: 80px;
  height: 80px;
  min-width: 80px;
  min-height: 80px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.music-info {
  flex: 1;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

.music-title {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 6px 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.music-artist {
  color: #999;
  font-size: 12px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.music-text-inner {
  display: inline-block;
  white-space: nowrap;
  transform: translateX(0);
}

.is-marquee .music-text-inner {
  animation: marquee-loop var(--marquee-duration, 8s) linear infinite;
}

@keyframes marquee-loop {
  0% {
    transform: translateX(100%);
  }
  100% {
    transform: translateX(-100%);
  }
}

.music-progress {
  margin-top: 10px;
  height: 3px;
  background: #444;
  border-radius: 2px;
  overflow: visible;
  position: relative;
  cursor: pointer;
  touch-action: none;
}

.music-progress-bar {
  height: 100%;
  background: var(--color-accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.2s linear;
}

.music-progress-knob {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
  transition: left 0.2s linear;
}

.music-controls {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.music-control-btn {
  background: transparent;
  border: none;
  color: #fff;
  opacity: 0.95;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px;
  transition: opacity 0.2s ease;
}

.music-control-btn:hover:not(:disabled) {
  opacity: 1;
}

.music-control-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.music-control-btn.main {
  font-size: 22px;
}

@media (max-width: 640px) {
  #app {
    justify-content: flex-start;
    padding-top: 20px;
    padding-bottom: 190px;
  }

  #ctaText {
    margin-top: 3.5rem;
    margin-bottom: 16px;
  }

  .music-widget {
    bottom: 12px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 250px;
    min-width: 250px;
    max-width: 250px;
    max-height: 160px;
  }

  .music-album-art {
    width: 70px;
    height: 70px;
    min-width: 70px;
    min-height: 70px;
  }

  .music-title {
    font-size: 13px;
  }

  .music-artist {
    font-size: 11px;
  }
}

body {
  box-sizing: border-box;
}

.access-gate {
  position: fixed;
  inset: 0;
  background: rgba(250, 246, 241, 0.98);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.access-gate.visible {
  display: flex;
}

.access-card {
  width: 100%;
  max-width: 420px;
  background: #fffef9;
  border: 1px solid rgba(196, 164, 132, 0.35);
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(93, 78, 78, 0.15);
  padding: 28px 24px;
  text-align: center;
}

.access-title {
  color: var(--color-accent);
  font-size: 32px;
  margin: 0 0 6px;
}

.access-subtitle {
  color: var(--color-text);
  margin: 0 0 16px;
}

.access-input {
  width: 100%;
  border: 1px solid rgba(196, 164, 132, 0.5);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  color: var(--color-text);
  margin-bottom: 10px;
}

.access-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(196, 164, 132, 0.15);
}

.access-button {
  width: 100%;
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--color-accent);
  color: #fffef9;
  cursor: pointer;
}

.access-button:hover {
  background: var(--color-accent-hover);
}

.access-error {
  min-height: 18px;
  margin: 10px 0 0;
  color: #b45353;
  font-size: 13px;
}

.access-gate {
  position: fixed;
  inset: 0;
  background: rgba(250, 246, 241, 0.98);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.access-gate.visible {
  display: flex;
}

.access-card {
  width: 100%;
  max-width: 420px;
  background: #fffef9;
  border: 1px solid rgba(196, 164, 132, 0.35);
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(93, 78, 78, 0.15);
  padding: 28px 24px;
  text-align: center;
}

.access-title {
  color: var(--color-accent);
  font-size: 32px;
  margin: 0 0 6px;
}

.access-subtitle {
  color: var(--color-text);
  margin: 0 0 16px;
}

.access-input {
  width: 100%;
  border: 1px solid rgba(196, 164, 132, 0.5);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  color: var(--color-text);
  margin-bottom: 10px;
}

.access-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(196, 164, 132, 0.15);
}

.access-button {
  width: 100%;
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--color-accent);
  color: #fffef9;
  cursor: pointer;
}

.access-button:hover {
  background: var(--color-accent-hover);
}

.access-error {
  min-height: 18px;
  margin: 10px 0 0;
  color: #b45353;
  font-size: 13px;
}
