* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background: #f5efff url("background.png") center top / cover no-repeat;
  overflow-x: hidden;
  color: #764797;
  position: relative;
}

.page {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  position: relative;
  z-index: 1;
}

.invitation {
  width: min(100%, 500px);
  text-align: center;
  position: relative;
  padding: 12px 10px 20px;
}

.name {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 6.4vw, 4.4rem);
  line-height: 0.95;
  font-weight: 700;
  color: #764797;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
  word-break: break-word;
}

.badge {
  display: inline-block;
  margin-top: 14px;
  padding: 10px 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, #764797, #b67cff);
  color: #fff;
  font-size: clamp(1rem, 3.8vw, 1.55rem);
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(141, 67, 255, 0.22);
  line-height: 1;
}

.curved-text {
  width: 100%;
  max-width: 400px;
  margin: 14px auto 0;
  display: block;
}

.curved-text svg {
  width: 100%;
  height: auto;
  display: block;
}

.event {
  margin-top: 16px;
  font-size: clamp(1rem, 2.8vw, 1.2rem);
  line-height: 1.55;
  color: #764797;
}

.date-time {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  font-weight: 700;
  font-size: clamp(1rem, 3vw, 1.2rem);
  row-gap: 6px;
}

.date-time span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.venue {
  margin-top: 10px;
  font-weight: 700;
  font-size: clamp(1rem, 3vw, 1.2rem);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.address {
  margin-top: 6px;
  font-size: clamp(0.88rem, 2.5vw, 0.98rem);
  color: #764797;
  line-height: 1.45;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.buttons {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.btn {
  min-height: 44px;
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: #f5eeff;
  color: #764797;
  border: 2px solid #fff;
  box-shadow: 0 4px 12px rgba(141, 67, 255, 0.15);
  line-height: 1.2;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  background-color: #efe4ff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(141, 67, 255, 0.18);
}

.btn:active {
  transform: translateY(0);
}

.btn svg {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
}

.icons {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.butterfly,
.heart {
  position: absolute;
  opacity: 0.85;
  user-select: none;
  pointer-events: none;
}

.butterfly {
  color: #f7ebff;
  font-size: 1.25rem;
  filter: drop-shadow(0 0 10px rgba(141, 67, 255, 0.16));
  animation: drift linear infinite;
}

.heart {
  color: rgba(141, 67, 255, 0.28);
  font-size: 1.1rem;
  animation: floatSlow linear infinite;
}

@keyframes drift {
  0% { transform: translateY(10vh) translateX(0) rotate(0deg); opacity: 0.2; }
  50% { transform: translateY(30vh) translateX(18px) rotate(18deg); opacity: 0.75; }
  100% { transform: translateY(60vh) translateX(-12px) rotate(-10deg); opacity: 0.2; }
}

@keyframes floatSlow {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(-12px) rotate(8deg); }
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(40, 20, 55, 0.55);
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 999;
}

.modal.open {
  display: flex;
}

.modal-panel {
  width: min(100%, 560px);
  max-height: 90vh;
  overflow: auto;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 22px;
  padding: 20px;
  position: relative;
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.24);
}

.modal-panel h2 {
  font-size: clamp(1.15rem, 3.6vw, 1.45rem);
  line-height: 1.25;
  margin-bottom: 10px;
  color: #4b2560;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #ece1ff;
  color: #4b2560;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
}

iframe {
  width: 100%;
  height: 320px;
  border: 0;
  border-radius: 16px;
  margin-top: 12px;
  display: block;
}

.gift-list {
  margin: 12px 0 0;
  padding-left: 18px;
  text-align: left;
  line-height: 1.7;
  color: #4b2560;
  font-size: 0.98rem;
}

.sound-wrapper {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1001;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sound-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 18px;
  width: 26px;
}

.sound-bar {
  width: 3px;
  height: 5px;
  background: #764797;
  border-radius: 2px;
  opacity: 0;
  transform-origin: bottom;
}

.sound-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(245, 238, 255, 0.95);
  color: #764797;
  box-shadow: 0 2px 8px rgba(141, 67, 255, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.sound-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sound-btn.playing .waves {
  display: block;
}

.sound-btn.muted .waves {
  display: none;
}

.sound-btn.playing .mute-line {
  display: none;
}

.sound-btn.muted .mute-line {
  display: block;
}

.sound-btn.playing ~ .sound-bars .sound-bar {
  opacity: 1;
}

.sound-btn.playing ~ .sound-bars .sound-bar:nth-child(1) {
  animation: bar1 1.2s ease-in-out infinite;
}
.sound-btn.playing ~ .sound-bars .sound-bar:nth-child(2) {
  animation: bar2 1.3s ease-in-out infinite;
}
.sound-btn.playing ~ .sound-bars .sound-bar:nth-child(3) {
  animation: bar3 1.1s ease-in-out infinite;
}
.sound-btn.playing ~ .sound-bars .sound-bar:nth-child(4) {
  animation: bar4 1.4s ease-in-out infinite;
}

@keyframes bar1 {
  0%, 100% { height: 4px; }
  25% { height: 12px; }
  75% { height: 7px; }
}

@keyframes bar2 {
  0%, 100% { height: 3px; }
  35% { height: 10px; }
  65% { height: 6px; }
}

@keyframes bar3 {
  0%, 100% { height: 2px; }
  50% { height: 11px; }
}

@keyframes bar4 {
  0%, 100% { height: 4px; }
  20% { height: 8px; }
  80% { height: 13px; }
}

@media (max-width: 640px) {
  body {
    background-attachment: scroll;
  }

  .page {
    min-height: 100vh;
    align-items: center;
    padding: 18px 14px 24px;
  }

  .invitation {
    width: 100%;
    padding: 16px 8px 20px;
  }

  .name {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .badge {
    margin-top: 12px;
    padding: 9px 18px;
  }

  .event {
    margin-top: 14px;
  }

  .date-time {
    gap: 6px;
  }

  .buttons {
    max-width: 100%;
    gap: 8px;
  }

  .btn {
    padding: 10px 8px;
    font-size: 0.8rem;
  }

  .btn svg {
    width: 18px;
    height: 18px;
  }

  .modal {
    padding: 10px;
  }

  .modal-panel {
    width: 100%;
    max-height: 92vh;
    padding: 16px;
    border-radius: 18px;
  }

  iframe {
    height: 260px;
  }

  .curved-text {
    max-width: 320px;
  }

  .sound-wrapper {
    top: 12px;
    right: 12px;
    gap: 6px;
  }

  .sound-btn {
    width: 36px;
    height: 36px;
  }

  .sound-icon {
    width: 16px;
    height: 16px;
  }

  .sound-bars {
    height: 16px;
    width: 22px;
    gap: 1px;
  }

  .sound-bar {
    width: 2px;
  }
}

@media (max-width: 420px) {
  .buttons {
    grid-template-columns: 1fr 1fr;
  }

  .btn {
    min-height: 42px;
    font-size: 0.74rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}