/* ══════════════════════════════════════════════════════════════
   WINR v6 — Elegant Institutional Wax Seal Loader
   ══════════════════════════════════════════════════════════════ */

#winr-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #060608; /* Deep minimal premium background */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: 'Times New Roman', Times, serif;
}

/* v21/v22 timing pass — tightened from 0.4s → 0.28s for snappier exit */
#winr-loader.fade-out {
  animation: loaderFadeOut 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes loaderFadeOut {
  0% { opacity: 1; }
  100% { opacity: 0; pointer-events: none; }
}

/* ── Container ── */
.stamp-container {
  position: relative;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
}

/* ── Splatter / Melt ── */
.wax-goo-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.wax-splatter {
  position: absolute;
  width: 130px;
  height: 130px;
  background: #B83800;
  border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
  opacity: 0;
  transform: scale(0.5);
  will-change: transform, opacity;
}

.wax-drop {
  position: absolute;
  background: #B83800;
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.2);
  will-change: transform, opacity;
}
.drop-1 { width: 40px; height: 40px; top: 30px; left: 40px; }
.drop-2 { width: 50px; height: 50px; bottom: 25px; right: 40px; }
.drop-3 { width: 30px; height: 30px; bottom: 40px; left: 30px; }

/* v21/v22 timing pass — splatter+drop 0.6s → 0.42s (punchier impact) */
.wax-goo-layer.squish .wax-splatter {
  animation: splatterSquish 0.42s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.wax-goo-layer.squish .wax-drop {
  animation: dropSquish 0.42s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes splatterSquish {
  0% { opacity: 0; transform: scale(0.5) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.1) rotate(15deg); }
  100% { opacity: 1; transform: scale(1) rotate(20deg); }
}

@keyframes dropSquish {
  0% { opacity: 0; transform: scale(0.2) translate(0, 0); }
  50% { opacity: 1; transform: scale(1.2) translate(0, 0); }
  100% { opacity: 1; transform: scale(1) translate(0, 0); }
}

/* ── Wax Seal Body ── */
.wax-seal {
  position: absolute;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle at 35% 35%, #FFFFFF 0%, #E6501A 40%, #992E00 100%);
  border-radius: 50%;
  box-shadow: 
    inset 0 0 12px rgba(0,0,0,0.8),
    inset 2px 2px 8px rgba(255,160,100,0.3),
    6px 8px 16px rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(3) translateY(-30px);
  z-index: 2;
  will-change: transform, opacity;
}

/* Irregular edge via pseudo-elements */
.wax-seal::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 48% 52% 47% 53% / 51% 49% 52% 48%;
  background: radial-gradient(circle at 30% 30%, #F25C1D 0%, #A33000 100%);
  z-index: -1;
  box-shadow: inset 1px 1px 3px rgba(255,255,255,0.1), 2px 4px 8px rgba(0,0,0,0.4);
}

/* Inner indented ring */
.wax-seal::after {
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.3);
  box-shadow: 
    inset 1px 1px 3px rgba(255,255,255,0.15),
    1px 1px 2px rgba(255,255,255,0.1);
  z-index: 1;
}

.wax-seal.reveal {
  animation: sealReveal 0.25s cubic-bezier(0.2, 0, 0, 1) forwards;
}

@keyframes sealReveal {
  0% { opacity: 0; transform: scale(3) translateY(-30px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── The Letter 'W' ── */
.w-mark {
  font-size: 64px;
  font-weight: bold;
  color: #A33000; /* Dark embossed color */
  text-shadow: 
    -1px -1px 1px rgba(0,0,0,0.8),
    1px 1px 2px rgba(255,160,100,0.4);
  position: relative;
  z-index: 3;
  margin-top: -4px; /* optical centering */
  letter-spacing: -2px;
  opacity: 0;
  will-change: transform, opacity, color, text-shadow;
}

/* v21/v22 timing pass — markPress 0.3s → 0.22s */
.w-mark.pressed {
  animation: markPress 0.22s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

@keyframes markPress {
  0% { 
    opacity: 0; 
    transform: scale(1.1) translateY(-2px); 
  }
  100% { 
    opacity: 1; 
    transform: scale(1) translateY(0); 
  }
}

/* ── Expansion Transition ── */
/* v21/v22 timing pass — wExpand 0.4s → 0.32s; sealFade 0.2s → 0.16s */
.stamp-container.expand .w-mark {
  animation: wExpand 0.32s cubic-bezier(0.7, 0, 0.3, 1) forwards;
}
.stamp-container.expand .wax-seal,
.stamp-container.expand .wax-goo-layer {
  animation: sealFade 0.16s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes wExpand {
  0% {
    transform: scale(1);
    color: #A33000;
    text-shadow: 0 0 20px rgba(255,160,100,0.8);
  }
  100% {
    transform: scale(40);
    color: var(--orange);
    text-shadow: 0 0 100px rgba(255, 255, 255, 1);
    opacity: 0;
  }
}

@keyframes sealFade {
  to { opacity: 0; transform: scale(0.8); }
}

/* Screen Shake on Impact */
/* v21/v22 timing pass — impactShake 0.4s → 0.32s for tighter recoil */
.stamp-container.shake {
  animation: impactShake 0.32s ease-out;
}

@keyframes impactShake {
  0% { transform: translateY(0); }
  10% { transform: translateY(8px); }
  30% { transform: translateY(-4px); }
  50% { transform: translateY(2px); }
  70% { transform: translateY(-1px); }
  100% { transform: translateY(0); }
}
