* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Arial, sans-serif;
  color: #4b1f32;
}

body {
  overflow-x: hidden;
}

a {
  text-decoration: none;
}

.page {
  min-height: 100dvh;
}

.envelope-page {
  background: linear-gradient(135deg, #ffd1df, #ff8fb1);
}

.envelope-screen,
.card-page,
.gift-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.envelope-screen {
  flex-direction: column;
  gap: 34px;
}

.hero-title {
  margin: 0;
  padding: 0 16px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(36px, 6vw, 74px);
  line-height: 1.08;
  font-weight: 400;
  text-align: center;
  color: #fff;
  text-shadow:
    0 4px 12px rgba(120, 28, 68, 0.2),
    0 0 24px rgba(255, 255, 255, 0.35);
  animation: titleAppear 1.1s ease forwards;
}

.envelope {
  position: relative;
  width: min(680px, 92vw);
  height: min(420px, 62vw);
  min-height: 280px;
  border-radius: 28px;
  background: #ffc0d3;
  box-shadow: 0 28px 80px rgba(139, 37, 74, 0.25);
  overflow: hidden;
}

.envelope-body::before,
.envelope-body::after,
.envelope-flap {
  content: "";
  position: absolute;
  inset: 0;
}

.envelope-flap {
  clip-path: polygon(0 0, 50% 55%, 100% 0);
  background: #ff9fbd;
}

.envelope-body::before {
  clip-path: polygon(0 100%, 50% 45%, 100% 100%);
  background: #ffb0c8;
}

.envelope-body::after {
  clip-path: polygon(0 0, 48% 52%, 0 100%);
  background: rgba(255, 143, 177, 0.45);
}

.seal-button {
  position: absolute;
  left: 50%;
  top: 56%;
  transform: translate(-50%, -50%);
  width: 180px;
  height: 180px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 22px;
  background: #b92d63;
  color: #fff;
  font-weight: 700;
  line-height: 1.25;
  box-shadow: 0 14px 30px rgba(93, 18, 48, 0.28);
  transition: transform 0.2s ease, background 0.2s ease;
}

.seal-button:hover {
  transform: translate(-50%, -50%) scale(1.04);
  background: #9f2353;
}

.content-page {
  background: linear-gradient(135deg, #fff2f6, #ffd7e5);
}

.content-card,
.gift-card {
  width: min(760px, 100%);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  padding: clamp(24px, 5vw, 54px);
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 24px 70px rgba(139, 37, 74, 0.18);
}

.wide-card {
  width: min(1040px, 100%);
}

.page-number {
  margin: 0 0 12px;
  color: #9e5570;
  font-size: 14px;
}

h1 {
  margin: 0 0 22px;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.05;
}

.hero-title {
  margin: 0;
}

p {
  font-size: clamp(16px, 2.2vw, 20px);
  line-height: 1.55;
}

.congratulation-text {
  margin: 28px 0;
}

.hint {
  margin-bottom: 24px;
  color: #704057;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 24px 0 32px;
}

.video-item {
  margin: 0;
}

.video-item video {
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 420px;
  border-radius: 22px;
  background: #1e1e1e;
  display: block;
}

.video-item p {
  margin: 10px 0 0;
  font-size: 16px;
  text-align: center;
}

.nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 30px;
}

.nav-buttons a,
.ticket-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 14px 22px;
  border-radius: 999px;
  background: #b92d63;
  color: #fff;
  font-weight: 700;
}

.nav-buttons a:first-child {
  background: #e68cab;
}

.gift-page {
    background: #ffd7e5;
}

.gift-card {
  text-align: center;
  backdrop-filter: blur(6px);
}

.ticket-button {
  margin-top: 18px;
  font-size: 18px;
}

@keyframes titleAppear {
  from {
    opacity: 0;
    transform: translateY(-18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .envelope-screen,
  .card-page,
  .gift-screen {
    padding: 16px;
    align-items: stretch;
  }
  .cringe-grid {
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  }

  .cringe-grid img {
  border-radius: 16px;
  }
  .envelope-screen {
    justify-content: center;
    gap: 24px;
  }

  .hero-title {
    font-size: clamp(34px, 11vw, 52px);
  }

  .envelope {
    margin: auto;
    width: 100%;
    height: 48dvh;
  }

  .seal-button {
    width: 150px;
    height: 150px;
    font-size: 15px;
  }

  .content-card,
  .gift-card {
    max-height: none;
    min-height: calc(100dvh - 32px);
    border-radius: 24px;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }

  .video-item video {
    aspect-ratio: 16 / 9;
    max-height: none;
  }

  .nav-buttons {
    flex-direction: column;
  }

  .nav-buttons a,
  .ticket-button {
    width: 100%;
  }
}

.cringe-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 28px 0 34px;
}

.cringe-grid img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  border-radius: 22px;
  background: #ffd7e5;
  box-shadow: 0 14px 34px rgba(139, 37, 74, 0.18);
  transform: rotate(-1deg);
}

.cringe-grid img:nth-child(even) {
  transform: rotate(1.5deg);
}
/* ---------- Страница с кринж-фото ---------- */

.photo-page {
  height: 100dvh;
  max-height: 100dvh;
  display: grid;
  grid-template-rows: 24px 1fr 54px;
  gap: 8px;
  padding: 8px;
  overflow: hidden;
}

.photo-page .page-number {
  margin: 0;
  font-size: 13px;
  line-height: 24px;
}

.photo-strip {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 4px;
  overflow: hidden;
}

.photo-strip img {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: cover;
  display: block;
  border-radius: 8px;
}

.photo-page .nav-buttons {
  margin: 0;
  height: 54px;
  display: flex;
  align-items: center;
}

.photo-page .nav-buttons a {
  min-height: 44px;
  padding: 10px 18px;
}

@media (max-width: 760px) {
  .photo-page {
    grid-template-rows: 20px 1fr 100px;
    gap: 6px;
    padding: 6px;
  }

  .photo-page .page-number {
    line-height: 20px;
  }

  .photo-strip {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(5, minmax(0, 1fr));
    gap: 3px;
  }

  .photo-page .nav-buttons {
    height: 100px;
    gap: 8px;
  }
}
.video-slider{

display:flex;
align-items:center;
justify-content:center;
gap:20px;

margin:30px 0;

}

.video-wrapper{

flex:1;
text-align:center;

}

.video-wrapper video{

width:min(420px,100%);
max-height:70vh;

border-radius:24px;

background:#000;

}

.slider-btn{

width:60px;
height:60px;

border:none;
border-radius:50%;

font-size:32px;

cursor:pointer;

background:#b92d63;
color:white;

transition:.2s;

}

.slider-btn:hover{

transform:scale(1.08);

}

#videoTitle{

margin-top:20px;

font-size:24px;

}

.video-dots{

display:flex;
justify-content:center;
gap:10px;

margin-top:18px;

}

.dot{

width:12px;
height:12px;

border-radius:50%;

background:#d5a2b5;

cursor:pointer;

}

.dot.active{

background:#b92d63;

}

@media(max-width:760px){

.video-slider{

gap:8px;

}

.slider-btn{

width:46px;
height:46px;

font-size:24px;

}

.video-wrapper video{

max-height:55vh;

}

}
/* ---------- Подарок ---------- */

.gift-box-card {
  overflow: hidden;
}

.gift-box {
  position: relative;
  width: min(320px, 80vw);
  height: 280px;
  margin: 30px auto;
  display: block;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.gift-base {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 260px;
  height: 170px;
  transform: translateX(-50%);
  border-radius: 18px;
  background: linear-gradient(135deg, #ff8fb1, #b92d63);
  box-shadow: 0 24px 50px rgba(139, 37, 74, 0.25);
}

.gift-lid {
  position: absolute;
  left: 50%;
  bottom: 165px;
  width: 290px;
  height: 70px;
  transform: translateX(-50%);
  border-radius: 18px;
  background: linear-gradient(135deg, #ffc0d3, #ff75a3);
  z-index: 4;
  transition: 0.7s ease;
}

.gift-ribbon {
  position: absolute;
  background: #fff3f8;
  z-index: 5;
  transition: 0.7s ease;
}

.gift-ribbon-vertical {
  left: 50%;
  bottom: 0;
  width: 42px;
  height: 235px;
  transform: translateX(-50%);
}

.gift-ribbon-horizontal {
  left: 50%;
  bottom: 70px;
  width: 260px;
  height: 36px;
  transform: translateX(-50%);
}

.gift-bow {
  position: absolute;
  left: 50%;
  bottom: 220px;
  width: 120px;
  height: 70px;
  transform: translateX(-50%);
  z-index: 6;
  transition: 0.7s ease;
}

.gift-bow::before,
.gift-bow::after {
  content: "";
  position: absolute;
  width: 60px;
  height: 55px;
  border: 16px solid #fff3f8;
  border-radius: 50%;
  top: 0;
}

.gift-bow::before {
  left: 0;
  transform: rotate(-25deg);
}

.gift-bow::after {
  right: 0;
  transform: rotate(25deg);
}

.gift-box.step-1 .gift-bow {
  opacity: 0;
  transform: translateX(-50%) translateY(-60px) scale(0.6) rotate(25deg);
}

.gift-box.step-2 .gift-ribbon {
  opacity: 0;
}

.gift-box.step-2 .gift-ribbon-vertical {
  transform: translateX(-50%) translateY(80px) scaleY(0.2);
}

.gift-box.step-2 .gift-ribbon-horizontal {
  transform: translateX(-50%) scaleX(0.1);
}

.gift-box.opened .gift-lid {
  transform: translateX(-50%) translateY(-120px) rotate(-14deg);
  opacity: 0;
}

.ticket-reveal{

    position:fixed;

    inset:0;

    display:flex;
    justify-content:center;
    align-items:center;

    background:#000;

    opacity:0;
    visibility:hidden;

    transition:.8s;

    z-index:999;

}

.ticket-reveal.show{

    opacity:1;
    visibility:visible;

}

.ticket-reveal img {
    width: 100%;
    height: 100%;

    object-fit: cover;

    display: block;
}
@keyframes ticketZoom{

    from{

        transform:scale(.8);
        opacity:0;

    }

    to{

        transform:scale(1);
        opacity:1;

    }

}
.ticket-button{

    position:absolute;

    bottom:50px;
    left:50%;

    transform:translateX(-50%);

    z-index:1001;

}
#confetti{
    position:fixed;
    inset:0;
    width:100%;
    height:100%;
    pointer-events:none;
    z-index:9999;
}
.restart-page-button {
    position: fixed;
    left: 24px;
    bottom: 24px;

    padding: 14px 22px;

    border-radius: 999px;

    background: rgba(255,255,255,.95);
    color: #b92d63;

    text-decoration: none;
    font-weight: 700;

    box-shadow: 0 10px 25px rgba(0,0,0,.18);

    z-index: 10000;

    transition: .2s;
}

.restart-page-button:hover {
    transform: translateY(-2px);
    background: #fff;
}

@media (max-width:760px) {

    .restart-page-button {
        left: 16px;
        bottom: 16px;
        padding: 12px 18px;
        font-size: 14px;
    }

}