:root{
  --bgA:#f7a9b8;
  --bgB:#f9c2cf;
  --bgC:#fbe0e8;

  --glass1: rgba(255,255,255,.42);
  --glass2: rgba(255,255,255,.22);
  --stroke: rgba(255,255,255,.55);

  --text:#1f1f26;

  --yes1:#ff4b5a;
  --yes2:#c8102e;

  --noBg: rgba(255,255,255,.60);
  --noStroke: rgba(0,0,0,.25);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color:var(--text);
  overflow-x:hidden;
  overflow-y:auto;

  background:
    radial-gradient(800px 600px at 20% 25%, rgba(255,255,255,.35) 0%, transparent 60%),
    radial-gradient(900px 650px at 80% 80%, rgba(255,255,255,.25) 0%, transparent 60%),
    linear-gradient(135deg, var(--bgA), var(--bgB), var(--bgC));
}

body.modal-open{
  overflow: hidden;
}

.page{
  min-height: 100svh;
  display:grid;
  place-items:center;
  padding: 16px;
}

.card{
  width: min(820px, 94vw);
  border-radius: 22px;
  background: linear-gradient(180deg, var(--glass1), var(--glass2));
  border: 1px solid var(--stroke);
  box-shadow: 0 22px 70px rgba(0,0,0,.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 34px;
  text-align:center;
}

.hidden{ display:none !important; }

.title{
  margin:0 0 22px;
  font-size: clamp(26px, 7vw, 52px);
  font-weight:900;
  line-height: 1.05;
}
.nowrap{ white-space: nowrap; }

/* ===== ACCES ===== */
.access-title{ margin-bottom: 10px; }

.access-sub{
  margin: 0 0 18px;
  font-weight: 700;
  opacity: .9;
}

.access-form{
  width: min(420px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 10px;
}

.access-label{
  text-align: left;
  font-weight: 800;
}

.access-input{
  width: 100%;
  border: 1px solid rgba(0,0,0,.22);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 17px;
  background: rgba(255,255,255,.85);
}

.access-input:focus{
  outline: 2px solid rgba(200,16,46,.35);
  border-color: rgba(200,16,46,.55);
}

.access-btn{ margin-top: 4px; }

.access-error{
  margin: 14px 0 0;
  font-weight: 800;
  color: #9a1024;
}

/* ===== BOUTONS ASK ===== */
.btn-area{
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 6px;
}

.btn{
  border:0;
  font-weight:900;
  letter-spacing:.8px;
  padding: 14px 34px;
  border-radius: 14px;
  cursor:pointer;
  user-select:none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, filter .12s ease, box-shadow .12s ease;
  flex: 0 0 auto;
}
.btn:active{ transform: translateY(1px); }

.btn--yes{
  color:white;
  background: linear-gradient(135deg, var(--yes1), var(--yes2));
  box-shadow: 0 14px 30px rgba(200,16,46,.22);
}

.btn--no{
  color:#2a2a2f;
  background: var(--noBg);
  border:1px solid var(--noStroke);
  box-shadow: 0 12px 22px rgba(0,0,0,.10);
  pointer-events: none;
}

/* slot fixe anti-décalage */
.no-slot{
  position: relative;
  width: 240px;
  height: 120px;
  flex: 0 0 240px;
}
.no-wrap{
  position:absolute;
  left:0;
  top:32px;
  transition: transform 85ms linear;
  will-change: transform;
  touch-action: none;
}
.no-wrap.pos-0{ transform: translate(0px, 0px); }
.no-wrap.pos-1{ transform: translate(18px, -14px); }
.no-wrap.pos-2{ transform: translate(44px, -20px); }
.no-wrap.pos-3{ transform: translate(72px, -10px); }
.no-wrap.pos-4{ transform: translate(102px, -18px); }
.no-wrap.pos-5{ transform: translate(124px, 2px); }
.no-wrap.pos-6{ transform: translate(108px, 24px); }
.no-wrap.pos-7{ transform: translate(78px, 36px); }
.no-wrap.pos-8{ transform: translate(46px, 30px); }
.no-wrap.pos-9{ transform: translate(20px, 24px); }
.no-wrap.pos-10{ transform: translate(6px, 42px); }
.no-wrap.pos-11{ transform: translate(34px, 54px); }
.no-wrap.pos-12{ transform: translate(68px, 56px); }
.no-wrap.pos-13{ transform: translate(100px, 48px); }
.no-wrap.pos-14{ transform: translate(126px, 36px); }
.no-wrap.is-moving .btn--no{ pointer-events:none; }

/* ===== ÉCRAN 2 ===== */
.yay-title{
  margin: 0 0 10px;
  font-size: clamp(30px, 7vw, 58px);
  font-weight:950;
}
.yay-sub{
  margin: 0 0 14px;
  font-size: clamp(16px, 4.2vw, 22px);
  font-weight:700;
}

.media-wrap{
  width: 100%;
  max-width: 560px;
  margin: 0 auto 14px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 44px rgba(0,0,0,.18);
  border: 1px solid rgba(255,255,255,.45);
  position: relative;
  aspect-ratio: 4 / 5;
  background: rgba(255,255,255,.18);
}

.celebrate-video{
  width:100%;
  height:100%;
  display:block;
  object-fit: cover;
  object-position: center;
}

.gift-btn{
  position:absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  width: min(92%, 520px);

  border: 0;
  padding: 14px 18px;
  border-radius: 14px;
  font-weight: 950;
  letter-spacing: .8px;
  cursor: pointer;

  color: #fff;
  background: linear-gradient(135deg, #ff4b5a, #c8102e);
  box-shadow: 0 16px 34px rgba(200,16,46,.25);
}

.love{
  margin:0;
  font-size: clamp(16px, 4.5vw, 20px);
  font-weight:800;
}

/* ===== MODAL POPUP ===== */
.modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: start center;
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal__backdrop{
  position: fixed;
  inset:0;
  z-index: 0;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal__card{
  position: relative;
  z-index: 1;
  margin: 0 auto;
  width: min(560px, 92vw);
  max-height: calc(100vh - 36px);
  max-height: calc(100dvh - 36px);
  border-radius: 20px;
  padding: 22px 18px 18px;
  text-align:center;
  overflow-y: auto;
  overscroll-behavior: contain;

  background: linear-gradient(180deg, rgba(255,255,255,.70), rgba(255,255,255,.45));
  border: 1px solid rgba(255,255,255,.60);
  box-shadow: 0 28px 80px rgba(0,0,0,.28);

  animation: popIn .18s ease-out;
}

@keyframes popIn{
  from{ transform: scale(.92); opacity: .0; }
  to{ transform: scale(1); opacity: 1; }
}

.modal__emoji{
  font-size: 34px;
  margin-bottom: 6px;
}
.modal__title{
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 950;
}
.modal__text{
  margin: 0 0 14px;
  font-weight: 800;
}

.modal__actions{
  display:flex;
  gap: 10px;
  justify-content:center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.modal__btn{
  border: 0;
  cursor:pointer;
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 950;
  color:#fff;
  background: linear-gradient(135deg, #ff4b5a, #c8102e);
  box-shadow: 0 14px 30px rgba(200,16,46,.22);
}

.modal__btn--close{
  background: rgba(0,0,0,.55);
  box-shadow: 0 14px 30px rgba(0,0,0,.18);
}

/* ===== Reveal animé (évite display:none) ===== */
.gift-reveal{
  position: relative;
  margin-top: 10px;
  transform-origin: 50% 30%;
  transition: opacity 220ms ease, transform 220ms ease, max-height 260ms ease;
  max-height: 1600px;
}

.gift-reveal--hidden{
  opacity: 0;
  transform: scale(.92);
  max-height: 0;
  overflow: hidden;
  pointer-events: none;
}

.gift-reveal.is-magic{
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

/* image */
.gift-img{
  display:block;
  width: 100%;
  height: auto;
  border-radius: 16px;
}

/* effet magique */
.gift-reveal.is-magic .gift-img{
  animation: magicPop 650ms cubic-bezier(.2,.9,.2,1) both;
  filter: drop-shadow(0 26px 50px rgba(255, 40, 120, .30));
}

.gift-reveal::before{
  content:"";
  position:absolute;
  inset: 6px;
  border-radius: 18px;
  background: radial-gradient(circle at 50% 35%, rgba(255,255,255,.75), rgba(255,80,140,.22), transparent 70%);
  opacity: 0;
  pointer-events:none;
}

.gift-reveal.is-magic::before{
  animation: glowIn 780ms ease-out both;
}

.gift-reveal::after{
  content:"";
  position:absolute;
  inset: -12px;
  border-radius: 22px;
  pointer-events:none;
  opacity: 0;
  background:
    radial-gradient(circle, rgba(255,255,255,.95) 0 2px, transparent 3px) 10% 20%/120px 120px,
    radial-gradient(circle, rgba(255,255,255,.85) 0 2px, transparent 3px) 80% 30%/140px 140px,
    radial-gradient(circle, rgba(255,255,255,.90) 0 2px, transparent 3px) 30% 85%/160px 160px,
    radial-gradient(circle, rgba(255,255,255,.80) 0 2px, transparent 3px) 70% 80%/150px 150px;
  mix-blend-mode: screen;
}

.gift-reveal.is-magic::after{
  animation: sparkles 1050ms ease-out both;
}

@keyframes magicPop{
  0%   { transform: scale(.86) rotate(-1.2deg); filter: blur(10px); opacity: 0; }
  55%  { transform: scale(1.04) rotate(.7deg); filter: blur(0px); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); filter: blur(0px); opacity: 1; }
}

@keyframes glowIn{
  0%   { opacity: 0; transform: scale(.95); }
  55%  { opacity: 1; transform: scale(1.02); }
  100% { opacity: .92; transform: scale(1); }
}

@keyframes sparkles{
  0%   { opacity: 0; transform: scale(.98); }
  25%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.03); }
}

.love-letter{
  margin-top: 14px;
  padding: 16px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.84);
  text-align: left;
  line-height: 1.55;
  font-size: clamp(14px, 2.8vw, 16px);
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  position: relative;
  z-index: 1;
}

.love-letter p{
  margin: 0 0 10px;
}

.love-letter p:last-child{
  margin-bottom: 0;
}

.gift-img-error{
  margin: 12px 0 0;
  font-weight: 800;
  background: rgba(0,0,0,.10);
  padding: 10px 12px;
  border-radius: 12px;
}

/* ===== MOBILE ===== */
@media (max-width: 480px){
  .card{
    width: 94vw;
    padding: 18px;
    border-radius: 18px;
  }
  .btn-area{
    max-width: 100%;
    padding-top: 10px;
    gap: 12px;
  }
  .btn{
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 16px;
  }
  .no-slot{
    width: 190px;
    height: 112px;
    flex-basis: 190px;
  }
  .no-wrap{
    top: 28px;
  }
  .media-wrap{
    max-width: 100%;
    aspect-ratio: 3 / 4;
  }
  .modal__card{
    width: 94vw;
  }
}
