:root {
  --cream: #fff7ef;
  --blush: #ffd9e7;
  --rose: #ff8fab;
  --plum: #6e2c50;
  --gold: #e7b15e;
  --ink: #2b1b2e;
  --font-display: "Fraunces", serif;
  --font-script: "Dancing Script", cursive;
  --font-ui: "Quicksand", sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-ui);
  overflow: hidden;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

.bg-glow {
  position: fixed;
  inset: 0;
  /* z-index: 0; */
  pointer-events: none;
  overflow: hidden;
}

.bg-glow span {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
}

.bg-glow .g1 {
  width: 420px;
  height: 420px;
  background: var(--blush);
  top: -120px;
  left: -100px;
  animation: drift1 18s ease-in-out infinite;
}
.bg-glow .g2 {
  width: 360px;
  height: 360px;
  background: var(--gold);
  bottom: -100px;
  right: -80px;
  opacity: 0.35;
  animation: drift2 22s ease-in-out infinite;
}
.bg-glow .g3 {
  width: 300px;
  height: 300px;
  background: var(--rose);
  top: 40%;
  right: 10%;
  opacity: 0.3;
  animation: drift3 16s ease-in-out infinite;
}

@keyframes drift1 {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(60px, 40px);
  }
}
@keyframes drift2 {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(-50px, -30px);
  }
}
@keyframes drift3 {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(-40px, 50px);
  }
}

#particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  /* z-index: 1; */
  /* overflow: hidden; */
}

.particle {
  position: absolute;
  bottom: -40px;
  font-size: 24px;
  opacity: 0;
  animation: floatUp linear infinite;
  will-change: transform;
}

@keyframes floatUp {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.85;
  }
  90% {
    opacity: 0.6;
  }
  100% {
    transform: translateY(-110vh) translateX(var(--drift, 20px)) rotate(360deg);
    opacity: 0;
  }
}

#confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9;
  overflow: hidden;
}

.confetti-bit {
  position: absolute;
  top: -20px;
  width: 8px;
  height: 14px;
  opacity: 0.95;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to {
    transform: translateY(110vh) rotate(600deg);
    opacity: 0.2;
  }
}

.screen {
  position: fixed;
  inset: 0;
  /* z-index: 5; */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s ease;
}
.screen.active {
  opacity: 1;
  pointer-events: auto;
}

#screen-hero {
  flex-direction: column;
  text-align: center;
  padding: 24px;
}

.hero-inner {
  max-width: 560px;
  width: 100%;
}

.count-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.count-label {
  font-family: var(--font-ui);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--plum);
  opacity: 0.75;
}

#count-number {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(90px, 22vw, 170px);
  line-height: 1;
  color: var(--plum);
  text-shadow: 0 6px 24px rgba(110, 44, 80, 0.18);
}

.count-number-anim {
  animation: popNum 0.9s cubic-bezier(0.2, 0.9, 0.25, 1.2);
}
@keyframes popNum {
  0% {
    transform: scale(0.3) rotate(-8deg);
    opacity: 0;
  }
  55% {
    transform: scale(1.12) rotate(2deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.hero-message {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}
.hero-message.show {
  display: flex;
  animation: fadeUp 0.9s ease both;
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.eyebrow-script {
  font-family: var(--font-script);
  font-size: clamp(30px, 6vw, 44px);
  color: var(--rose);
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(30px, 6vw, 46px);
  color: var(--ink);
  line-height: 1.15;
}

.hero-sub {
  font-size: 15px;
  color: var(--plum);
  max-width: 420px;
  line-height: 1.6;
  opacity: 0.85;
}

.btn-fancy {
  margin-top: 6px;
  padding: 16px 46px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--rose), var(--plum));
  color: #fff;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.03em;
  box-shadow: 0 10px 30px rgba(110, 44, 80, 0.35);
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
}
.btn-fancy:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 14px 34px rgba(110, 44, 80, 0.45);
}
.btn-fancy:active {
  transform: translateY(0) scale(0.98);
}

#screen-lock {
  padding: 28px;
}

.lock-grid {
  width: 100%;
  max-width: 960px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}

.collage {
  position: relative;
  height: 440px;
}

.polaroid {
  position: absolute;
  width: 46%;
  background: #fff;
  padding: 10px 10px 34px 10px;
  border-radius: 4px;
  box-shadow: 0 14px 28px rgba(43, 27, 46, 0.22);
}

.polaroid img {
  width: 100%;
  display: block;
  border-radius: 2px;
  aspect-ratio: 1/1;
  object-fit: contain;
}
.polaroid .tape {
  position: absolute;
  top: -12px;
  left: 50%;
  width: 70px;
  height: 24px;
  background: rgba(231, 177, 94, 0.55);
  transform: translateX(-50%) rotate(-3deg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.polaroid .cap {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-script);
  font-size: 18px;
  color: var(--plum);
}
.p1 {
  top: 0;
  left: 2%;
  transform: rotate(-7deg);
  z-index: 2;
}
.p2 {
  top: 8%;
  left: 38%;
  transform: rotate(5deg);
  z-index: 3;
  width: 44%;
}
.p3 {
  top: 46%;
  left: 0;
  transform: rotate(4deg);
  z-index: 1;
}
.p4 {
  top: 52%;
  left: 34%;
  transform: rotate(-6deg);
  z-index: 2;
  width: 42%;
}

.lock-panel {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 22px;
  padding: 32px 28px;
  box-shadow: 0 20px 44px rgba(110, 44, 80, 0.14);
  text-align: center;
}
.lock-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  color: var(--ink);
  margin-bottom: 6px;
}
.lock-sub {
  font-size: 13px;
  color: var(--plum);
  opacity: 0.8;
  margin-bottom: 20px;
}
.dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 22px;
}
.dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--rose);
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}
.dot.filled {
  background: var(--rose);
  transform: scale(1.15);
}
.dots.shake {
  animation: shakeErr 0.45s ease;
}
@keyframes shakeErr {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-10px);
  }
  40% {
    transform: translateX(10px);
  }
  60% {
    transform: translateX(-6px);
  }
  80% {
    transform: translateX(6px);
  }
}

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 260px;
  margin: 0 auto;
}
.key {
  aspect-ratio: 1/1;
  border-radius: 16px;
  background: #fff;
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
  box-shadow: 0 6px 14px rgba(110, 44, 80, 0.12);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}
.key:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 18px rgba(110, 44, 80, 0.2);
}
.key:active {
  transform: translateY(0) scale(0.94);
  background: var(--blush);
}
.key.fn {
  background: transparent;
  box-shadow: none;
  color: var(--plum);
  font-size: 13px;
  font-weight: 700;
}
.key.fn:hover {
  background: rgba(255, 143, 171, 0.15);
}

.lock-hint {
  margin-top: 18px;
  font-size: 12px;
  color: var(--plum);
  opacity: 0.65;
}

/* ================= SCREEN 3 — reveal / swipe cards ================= */
#screen-reveal{flex-direction:column;padding:28px;}
.reveal-heading{
  font-family:var(--font-script);
  font-size:clamp(28px,5vw,38px);
  color:var(--rose);
  margin-bottom:18px;
  text-align:center;
}
.card-stage{
  position:relative;
  width:min(320px,86vw);
  height:min(430px,58vh);
  touch-action:none;
}
.swipe-card{
  position:absolute;inset:0;
  background:#fff;
  border-radius:22px;
  overflow:hidden;
  box-shadow:0 24px 50px rgba(43,27,46,.28);
  display:flex;flex-direction:column;
  user-select:none;
  cursor:grab;
  will-change:transform;
}
.swipe-card:active{cursor:grabbing;}
.swipe-card img{
  width:100%;height:65%;
  object-fit:contain;
  display:block;
  pointer-events:none;
}
.swipe-card .cardtext{
  flex:1;
  display:flex;align-items:center;justify-content:center;
  padding:18px;
  text-align:center;
  font-family:var(--font-display);
  font-style:italic;
  font-size:17px;
  color:var(--ink);
}
.swipe-card.finale{
  background:linear-gradient(160deg,var(--blush),var(--gold));
  align-items:center;justify-content:center;
  padding:30px;
}
.finale .fin-title{
  font-family:var(--font-script);
  font-size:38px;
  color:var(--plum);
  margin-bottom:12px;
}
.finale .fin-text{
  font-family:var(--font-display);
  font-size:17px;
  line-height:1.6;
  color:var(--ink);
}

.stage-controls{
  display:flex;align-items:center;gap:22px;margin-top:22px;
}
.arrow-btn{
  width:46px;height:46px;border-radius:50%;
  background:#fff;
  box-shadow:0 8px 18px rgba(110,44,80,.18);
  font-size:18px;color:var(--plum);
  display:flex;align-items:center;justify-content:center;
  transition:transform .2s ease;
}
.arrow-btn:hover{transform:scale(1.08);}
.arrow-btn:active{transform:scale(.94);}
.progress-dots{display:flex;gap:8px;}
.pdot{width:7px;height:7px;border-radius:50%;background:rgba(110,44,80,.25);transition:all .25s ease;}
.pdot.on{background:var(--plum);width:20px;border-radius:5px;}

.swipe-hint{
  margin-top:14px;
  font-size:12px;
  color:var(--plum);
  opacity:.6;
}

div#allCounts{
  display: flex;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
}

div#allCounts span{
  font-size: clamp(32px, 2vw, 64px);
  display: block;
}

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .lock-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .collage {
    height: 300px;
    max-width: 340px;
    width: 65vw;
    transform: translate(5vw, 10vw);
    margin: 0 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
