* {
  box-sizing: border-box;
}

:root {
  --primary: #8db7d2;
  --secondary: #d4af37;
  --text: #3f3527;

  --card-bg: rgba(255,255,255,0.74);
  --card-border: rgba(212,175,55,0.55);

  --title-font: "Cormorant Garamond", serif;
  --text-font: "Poppins", sans-serif;

  --title-size: 42px;
  --name-size: 34px;
}

/* BASE */

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

body {
  font-family: var(--text-font);
  color: var(--text);
  background: #f6f1e8;
}

/* SCHERMATE */

.screen {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

/* VIDEO INTRO */

#introVideo {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 9999;
  transition: opacity 1s ease;
  background: #000;
}

#introVideo.video-hide {
  opacity: 0;
}

/* COVER */

.cover-screen {
  position: fixed;
  inset: 0;
  z-index: 20;

  display: flex;
  justify-content: center;
  align-items: center;

  padding:
    max(20px, env(safe-area-inset-top))
    16px
    max(20px, env(safe-area-inset-bottom));

  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.cover-card {
  width: 100%;
  max-width: 520px;
  max-height: calc(100dvh -90px);
padding: 10px 24px 90px;

  text-align: center;
  position: relative;

  padding: 10px 24px 16px;
  border-radius: 28px;

  background:
  linear-gradient(
    rgba(255,255,255,0.45),
    rgba(255,255,255,0.45)
  ),
  url("bg-cover.jpg") center center / cover no-repeat;
  border: 2px solid var(--card-border);

  box-shadow: 0 18px 45px rgba(0,0,0,0.16);

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.cover-decoration-wrap {
  position: relative;
  height: 0;
  z-index: 5;
}

.cover-decoration {
  position: absolute;
  left: 50%;
  top: -120px;
  width: 180px;
  max-width: 55vw;
  transform: translateX(-50%);
  z-index: 6;

  filter:
    drop-shadow(0 4px 2px rgba(0,0,0,0.22))
    drop-shadow(0 12px 16px rgba(0,0,0,0.18));

  animation: floatDecoration 3s ease-in-out infinite;
}

/* BUSTA */

.envelope-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 70px auto 8px;
  position: relative;
}

.envelope {
  position: relative;
  width: 260px;
  max-width: 78vw;
  z-index: 2;
}

.envelope::before {
  content: "";
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 30px;
  background: radial-gradient(
    ellipse,
    rgba(0,0,0,0.25) 0%,
    rgba(0,0,0,0.12) 40%,
    transparent 70%
  );
  filter: blur(6px);
  z-index: 1;
}

.envelope-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 220px;
  height: 220px;
  transform: translate(-50%, -50%) scale(0.7);
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 229, 120, 0.95) 0%,
    rgba(255, 213, 79, 0.55) 30%,
    rgba(255, 213, 79, 0.18) 55%,
    rgba(255, 213, 79, 0) 75%
  );
  opacity: 0;
  filter: blur(10px);
  z-index: 0;
  transition: opacity 0.45s ease, transform 0.6s ease;
}

.envelope-img {
  position: relative;
  width: 100%;
  display: block;
  z-index: 1;
  filter: drop-shadow(0 20px 35px rgba(0,0,0,0.22));
  transition: transform 0.6s ease;
}

.envelope.open .envelope-img {
  transform: scale(1.05);
}

.envelope.open .envelope-glow {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.15);
}

/* BOTTONE APRI */

.open-btn {
  border: 2px solid var(--secondary);
  border-radius: 999px;
  padding: 15px 34px;

  font-size: 18px;
  font-weight: 600;
  font-family: var(--title-font);

  cursor: pointer;
  color: var(--text);

  background:
    linear-gradient(
      180deg,
      rgba(255,255,255,0.96) 0%,
      rgba(255,244,218,0.94) 55%,
      rgba(232,210,154,0.95) 100%
    );

  box-shadow:
    0 12px 28px rgba(0,0,0,0.18),
    0 0 18px rgba(255,220,160,0.35),
    inset 0 2px 8px rgba(255,255,255,0.7);

  transition: transform 0.25s ease, filter 0.25s ease;

  position: relative;
}

.open-btn:hover {
  transform: translateY(-3px);
  filter: brightness(1.05);
}

.open-btn:disabled {
  opacity: 0.75;
  cursor: default;
}

/* INVITO */

.invite-screen {
  display: flex;
  justify-content: center;
  align-items: center;

  padding:
    max(20px, env(safe-area-inset-top))
    16px
    max(20px, env(safe-area-inset-bottom));

  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.invite-card {
  width: 100%;
  max-width: 650px;

  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  border-radius: 28px;
  padding: 14px;

  background:
    linear-gradient(
      180deg,
      rgba(255,255,255,0.24),
      rgba(255,255,255,0.08)
    );

  border: 1px solid var(--card-border);

  box-shadow:
    0 18px 45px rgba(0,0,0,0.18);

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.invite-inner {
  width: 100%;
  min-height: 100%;

  border-radius: 22px;

  padding: 34px 24px 30px;

  text-align: center;
  position: relative;

  background:
    linear-gradient(
      rgba(255,255,255,0.72),
      rgba(255,255,255,0.72)
    ),
    url("bg-invito.jpg") center center / cover no-repeat;

  border: 2px solid var(--card-border);

  box-shadow:
    inset 0 0 0 2px rgba(255,255,255,0.25),
    inset 0 0 28px rgba(0,0,0,0.04);
}

/* TESTI */

h1 {
  margin: 0 0 16px;
  font-family: var(--title-font);
  font-size: var(--title-size);
  line-height: 1.08;
  font-weight: 600;
  color: var(--primary);
}

.subtitle {
  margin: 0 auto 22px;
  max-width: 440px;
  font-size: 18px;
  line-height: 1.55;
  color: var(--text);
}

.main-text {
  margin-bottom: 22px;
  font-size: 18px;
  line-height: 1.7;
}

.main-text p {
  margin: 0;
}

.name-highlight {
  margin-top: 8px !important;
  font-family: var(--title-font);
  font-size: var(--name-size);
  line-height: 1.15;
  color: var(--primary);
  font-weight: 700;
}

.footer-text {
  max-width: 460px;
  margin: 0 auto 28px;
  font-size: 17px;
  line-height: 1.7;
  white-space: pre-line;
}

/* DATA */

.event-date {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 28px 0 16px;
}

.line {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--secondary), transparent);
}

.date-center {
  min-width: 128px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.month,
.year {
  font-size: 18px;
  color: var(--text);
}

.day {
  font-size: 72px;
  line-height: 1;
  color: var(--secondary);
  font-weight: 700;
  margin: 4px 0;
}

/* INFO */

.event-info {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 10px 0 22px;
  flex-wrap: wrap;
}

.info-box {
  min-width: 120px;
  padding: 10px 14px;
  border-top: 2px solid var(--secondary);
  border-bottom: 2px solid var(--secondary);
  font-size: 17px;
  font-weight: 500;
}

.place-box {
  max-width: 460px;
  margin: 0 auto 26px;
  padding: 14px 16px;

  display: flex;
  flex-direction: column;
  gap: 6px;

  border-radius: 14px;
  background: rgba(255,255,255,0.45);
  border: 1px solid rgba(255,255,255,0.35);

  font-size: 16px;
  line-height: 1.5;
}

.place-box strong {
  color: var(--primary);
  font-size: 18px;
}

/* PULSANTI */

.actions {
  margin-top: 30px;

  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 18px;

  flex-wrap: wrap;
}

.circle-action {
  width: 94px;

  text-decoration: none;
  color: var(--text);

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;

  font-size: 15px;
  font-weight: 600;

  background: transparent;
  border: 0;
  cursor: pointer;

  transition: transform 0.25s ease, filter 0.25s ease;
}

.circle-action:hover {
  transform: translateY(-5px) scale(1.04);
  filter: brightness(1.06);
}

.icon {
  width: 76px;
  height: 76px;

  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 30px;

  background:
    radial-gradient(circle at 30% 30%, #fffdf4 0%, #f1df9d 48%, var(--secondary) 100%);

  border: 3px solid var(--secondary);

  box-shadow:
    0 0 0 4px rgba(212,175,55,0.16),
    0 10px 22px rgba(0,0,0,0.14),
    inset 0 2px 10px rgba(255,255,255,0.5);

  overflow: hidden;
}

.icon-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
}

.action-text {
  font-size: 15px;
  line-height: 1.2;
}

/* MODALE */

.modal {
  position: fixed;
  inset: 0;
  z-index: 99999;

  display: flex;
  justify-content: center;
  align-items: center;

  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;

  background: rgba(0,0,0,0.68);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-content {
  position: relative;
  z-index: 2;

  width: 100%;
  max-width: 520px;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;

  padding: 26px 20px 22px;
  border-radius: 22px;

  background: rgba(255,255,255,0.94);

  box-shadow:
    0 20px 55px rgba(0,0,0,0.32);

  text-align: center;

  animation: fadeZoom 0.25s ease;
}

.modal-content h2 {
  margin: 0 0 12px;
  font-family: var(--title-font);
  font-size: 34px;
  color: var(--primary);
}

.modal-content p {
  margin: 0 0 16px;
  line-height: 1.6;
}

.modal-image {
  width: 100%;
  height: auto;
  max-height: 70dvh;
  object-fit: contain;

  border-radius: 14px;

  box-shadow:
    0 10px 35px rgba(0,0,0,0.20);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;

  width: 36px;
  height: 36px;

  border-radius: 50%;
  border: none;

  background: var(--secondary);
  color: white;

  font-size: 24px;
  line-height: 1;

  cursor: pointer;
}

/* AUDIO HINT */

.tap-audio-hint {
   position: absolute;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%);

  z-index: 999999;

  width: 54px;
  height: 54px;

  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 24px;

  background: rgba(255,255,255,0.24);
  color: #fff;

  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  box-shadow: 0 10px 28px rgba(0,0,0,0.22);

  animation: tapHintPulse 1.35s ease-in-out infinite;

  pointer-events: none;
}

/* FLASH */

.flash-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;

  pointer-events: none;

  background:
    radial-gradient(circle, rgba(255,255,255,0.95), rgba(255,255,255,0.35));

  opacity: 0;
}

.flash-overlay.active {
  animation: flashEffect 0.8s ease-out;
}

/* EFFETTI */

.confetti-layer,
.balloons-layer,
.sparkles-layer,
.disco-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti-layer {
  z-index: 30;
}

.balloons-layer {
  z-index: 29;
}

.sparkles-layer {
  z-index: 31;
}

.disco-layer {
  z-index: 15;
  mix-blend-mode: screen;
}

.confetti-layer::before,
.confetti-layer::after {
  content: "";
  position: absolute;
  inset: -20%;

  background-image:
    radial-gradient(circle, rgba(255,219,120,0.9) 0 2px, transparent 3px),
    radial-gradient(circle, rgba(255,245,220,0.85) 0 1.8px, transparent 2.8px),
    radial-gradient(circle, rgba(214,168,67,0.8) 0 2.2px, transparent 3.2px);

  background-size: 120px 120px, 160px 160px, 200px 200px;

  animation: confettiFall 11s linear infinite;

  opacity: 0.9;
}

.confetti-layer::after {
  animation-duration: 16s;
  transform: translateY(-30%);
  opacity: 0.55;
}

.balloon {
  position: absolute;
  bottom: -120px;

  width: 42px;
  height: 56px;

  border-radius: 50% 50% 45% 45%;

  box-shadow: 0 10px 24px rgba(0,0,0,0.12);

  animation: floatUp linear infinite;
}

.balloon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -20px;

  width: 2px;
  height: 22px;

  background: rgba(80,80,80,0.7);

  transform: translateX(-50%);
}

.sparkle {
  position: absolute;

  width: 10px;
  height: 10px;

  transform: rotate(45deg);

  animation: sparkleBlink ease-in-out infinite;
}

.sparkle::before,
.sparkle::after {
  content: "";
  position: absolute;

  background: rgba(255,245,190,0.95);

  border-radius: 999px;
}

.sparkle::before {
  width: 10px;
  height: 2px;
  left: 0;
  top: 4px;
}

.sparkle::after {
  width: 2px;
  height: 10px;
  left: 4px;
  top: 0;
}

.disco-beam {
  position: absolute;
  top: -10%;

  width: 120px;
  height: 140%;

  transform: rotate(18deg);

  filter: blur(18px);

  opacity: 0.18;

  animation: discoMove 5s ease-in-out infinite alternate;
}

.disco-beam:nth-child(1) {
  background: linear-gradient(180deg, rgba(255,0,128,0.5), transparent);
}

.disco-beam:nth-child(2) {
  background: linear-gradient(180deg, rgba(0,200,255,0.5), transparent);
}

.disco-beam:nth-child(3) {
  background: linear-gradient(180deg, rgba(255,255,0,0.45), transparent);
}

.disco-beam:nth-child(4) {
  background: linear-gradient(180deg, rgba(0,255,170,0.45), transparent);
}

/* UTILITY */

.hidden {
  display: none !important;
}

.fade-out {
  animation: fadeOut 0.9s ease forwards;
}

.fade-in {
  animation: fadeIn 0.9s ease forwards;
}

/* MOBILE */

@media (max-width: 768px) {
  .invite-screen {
    align-items: flex-start;
    padding: 16px;
  }

  .invite-card {
    max-width: 430px;
    max-height: none;
    overflow: visible;
  }

  .invite-inner {
    padding: 32px 22px 28px;
  }

  h1 {
    font-size: clamp(34px, 10vw, var(--title-size));
  }

  .name-highlight {
    font-size: clamp(28px, 8vw, var(--name-size));
  }

  .day {
    font-size: 68px;
  }

  .actions {
    gap: 14px;
  }

  .circle-action {
    width: 86px;
  }

  .icon {
    width: 72px;
    height: 72px;
  }
}

/* MOBILE PICCOLI */

@media (max-width: 380px) {
  .invite-inner {
    padding: 28px 18px 24px;
  }

  .subtitle,
  .main-text {
    font-size: 16px;
  }

  .day {
    font-size: 60px;
  }

  .info-box {
    min-width: 110px;
    font-size: 15px;
  }

  .circle-action {
    width: 78px;
  }

  .icon {
    width: 66px;
    height: 66px;
  }

  .icon-img {
    width: 42px;
    height: 42px;
  }

  .action-text {
    font-size: 14px;
  }
}

/* ANIMAZIONI */

@keyframes floatDecoration {
  0%, 100% {
    transform: translateX(-50%) translateY(0);
  }

  50% {
    transform: translateX(-50%) translateY(-10px);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: scale(1);
  }

  to {
    opacity: 0;
    transform: scale(1.04);
    visibility: hidden;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes flashEffect {
  0% {
    opacity: 0;
  }

  40% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes tapHintPulse {
  0% {
    opacity: 0.62;
    transform: translateX(-50%) scale(1) rotate(0deg);
  }

  20% {
    transform: translateX(-50%) scale(1.08) rotate(-2deg);
  }

  40% {
    transform: translateX(-50%) scale(1.08) rotate(2deg);
  }

  60% {
    transform: translateX(-50%) scale(1.08) rotate(-1deg);
  }

  80% {
    transform: translateX(-50%) scale(1.05) rotate(1deg);
  }

  100% {
    opacity: 1;
    transform: translateX(-50%) scale(1) rotate(0deg);
  }
}

@keyframes confettiFall {
  from {
    transform: translateY(-8%);
  }

  to {
    transform: translateY(18%);
  }
}

@keyframes floatUp {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-130vh);
  }
}

@keyframes sparkleBlink {
  0%, 100% {
    opacity: 0.2;
    transform: rotate(45deg) scale(0.7);
  }

  50% {
    opacity: 1;
    transform: rotate(45deg) scale(1.2);
  }
}

@keyframes discoMove {
  from {
    transform: rotate(18deg) translateX(-20px);
  }

  to {
    transform: rotate(-18deg) translateX(40px);
  }
}
