/* =========================================================
   SUCCESS MODAL - Envelope + Paper Plane Animation
   ========================================================= */

.success-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.success-modal.show {
  opacity: 1;
  pointer-events: all;
}

/* Inner card layout */
.success-modal-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  background: var(--bg-card, #111);
  border: 1px solid var(--border, #1f1f1f);
  border-radius: 16px;
  padding: 44px 52px 36px;
  min-width: 320px;
  max-width: 420px;
  width: 90vw;
  position: relative;
  box-shadow: 0 0 60px rgba(0,255,136,0.08), 0 24px 64px rgba(0,0,0,0.5);
}

/* Animation stage */
.success-anim {
  width: 180px;
  height: 140px;
  position: relative;
}

.success-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Text */
.success-msg {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary, #f0f0f0);
  margin-top: 4px;
  text-align: center;
}
.success-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--text-secondary, #888);
  text-align: center;
  line-height: 1.5;
}

/* Countdown */
.success-countdown {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-muted, #444);
  letter-spacing: 0.04em;
  text-align: center;
}
.success-countdown span {
  color: var(--text-secondary, #888);
  font-weight: 400;
}

/* Done button */
.success-done-btn {
  margin-top: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 10px 32px;
  border-radius: 6px;
  border: 1px solid var(--accent, #00ff88);
  background: transparent;
  color: var(--accent, #00ff88);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  letter-spacing: 0.06em;
}
.success-done-btn:hover {
  background: var(--accent-dim, #00ff8820);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-dim, #00ff8820);
}
.success-done-btn:active {
  transform: translateY(0);
}

/* =========================================================
   SVG ANIMATION PIECES
   ========================================================= */

/* Envelope body - always visible */
.env-body {
  fill: var(--bg-card, #111);
  stroke: var(--accent, #00ff88);
  stroke-width: 2.2;
}

/* Envelope flap */
.env-flap {
  fill: var(--bg-card, #111);
  stroke: var(--accent, #00ff88);
  stroke-width: 2.2;
  transform-origin: 90px 54px;
  transform: rotateX(0deg);
}

/* Envelope fold lines */
.env-fold {
  fill: none;
  stroke: var(--accent, #00ff88);
  stroke-width: 1.4;
  opacity: 0.45;
}

/* Paper plane */
.plane {
  transform-origin: 90px 70px;
  opacity: 0;
}

/* Open flap keyframe */
@keyframes openFlap {
  0%   { d: path("M 30,54 L 90,82 L 150,54"); }
  100% { d: path("M 30,54 L 90,26 L 150,54"); }
}

/* Plane fly out then orbit */
/* Phase 1: slide up out of envelope */
@keyframes planeExit {
  0%   { transform: translate(0px, 0px) rotate(-10deg) scale(0.7); opacity: 0; }
  30%  { opacity: 1; }
  100% { transform: translate(0px, -55px) rotate(-15deg) scale(1); opacity: 1; }
}

/* Phase 2: oval orbit with CSS offset-path for smooth curve */
.plane-orbit {
  offset-path: ellipse(62px 28px at 50% 50%);
  offset-rotate: auto;
  animation: none;
  opacity: 0;
  transform-origin: center center;
}

@keyframes orbitFly {
  0%   { offset-distance: 0%;   opacity: 1; }
  95%  { offset-distance: 100%; opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; }
}

/* Phase 3: plane lands back into envelope */
@keyframes planeLand {
  0%   { transform: translate(0px, -55px) rotate(-15deg) scale(1);   opacity: 1; }
  100% { transform: translate(0px, 0px)   rotate(0deg)   scale(0.5); opacity: 0; }
}

/* Close flap after plane lands */
@keyframes closeFlap {
  0%   { d: path("M 30,54 L 90,26 L 150,54"); }
  100% { d: path("M 30,54 L 90,82 L 150,54"); }
}

/* Envelope glow pulse */
@keyframes envGlow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(0,255,136,0.3)); }
  50%       { filter: drop-shadow(0 0 12px rgba(0,255,136,0.7)); }
}

/* Envelope bounce in */
@keyframes envBounceIn {
  0%   { transform: scale(0) translateY(20px); opacity: 0; }
  60%  { transform: scale(1.08) translateY(-4px); opacity: 1; }
  80%  { transform: scale(0.96) translateY(2px); }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

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

/* envelope group wrapper */
.env-group {
  transform-origin: 90px 80px;
  animation: none;
}

/* shimmer line inside envelope */
@keyframes shimmerLine {
  0%   { stroke-dashoffset: 40; opacity: 0; }
  40%  { opacity: 0.6; }
  100% { stroke-dashoffset: -40; opacity: 0; }
}
.env-shimmer {
  stroke: var(--accent, #00ff88);
  stroke-width: 1.2;
  stroke-dasharray: 20 20;
  stroke-dashoffset: 40;
  opacity: 0;
  stroke-linecap: round;
}
