/* ============================================
   Pockets & Friends — Mysterious Box
   Homepage daily-surprise-story widget + modal
============================================ */

.pf-mystery-box {
  position: fixed;
  right: 1.75rem;
  bottom: 1.75rem;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--fb);
}

.pf-mystery-box__icon-wrap {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--hat-purple), var(--bow-pink));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.1rem;
  box-shadow: 0 8px 28px rgba(91,58,155,0.45), 0 0 0 1px rgba(255,255,255,0.12);
  animation: pf-mb-float 3.2s ease-in-out infinite, pf-mb-wiggle 6s ease-in-out infinite;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}

.pf-mystery-box__ring {
  position: absolute;
  inset: -6px;
  border-radius: 24px;
  border: 2px solid var(--pocket-gold);
  opacity: .55;
  animation: pf-mb-ring 2.4s ease-out infinite;
  pointer-events: none;
}

.pf-mystery-box__label {
  font-size: .72rem;
  font-weight: 800;
  color: #fff;
  background: rgba(14,11,30,0.82);
  border: 1px solid rgba(255,255,255,0.14);
  padding: 5px 12px;
  border-radius: 100px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}

.pf-mystery-box:hover .pf-mystery-box__icon-wrap {
  transform: translateY(-4px) scale(1.06);
  box-shadow: 0 12px 32px rgba(91,58,155,0.55), 0 0 0 1px rgba(255,255,255,0.18);
}

.pf-mystery-box.is-opened .pf-mystery-box__icon-wrap {
  background: linear-gradient(135deg, rgba(91,58,155,.45), rgba(232,65,154,.35));
  animation: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  opacity: .55;
  filter: grayscale(.4);
}

.pf-mystery-box.is-opened:hover .pf-mystery-box__icon-wrap {
  opacity: .85;
  filter: none;
}

.pf-mystery-box.is-opened .pf-mystery-box__ring { display: none; }

.pf-mystery-box.is-opened .pf-mystery-box__label {
  background: rgba(14,11,30,0.55);
  color: rgba(255,255,255,0.6);
}

@keyframes pf-mb-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

@keyframes pf-mb-wiggle {
  0%, 92%, 100% { rotate: 0deg; }
  93%  { rotate: -8deg; }
  95%  { rotate: 8deg; }
  97%  { rotate: -5deg; }
  99%  { rotate: 0deg; }
}

@keyframes pf-mb-ring {
  0%   { transform: scale(1);    opacity: .55; }
  100% { transform: scale(1.35); opacity: 0; }
}

/* ── Modal ── */
.pf-mystery-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.pf-mystery-modal.is-active { display: flex; }

.pf-mystery-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8,6,20,0.82);
  backdrop-filter: blur(4px);
}

.pf-mystery-modal__panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  background: rgba(20,16,38,0.98);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius, 20px);
  padding: 2.25rem 1.5rem 1.5rem;
  box-shadow: 0 24px 64px rgba(0,0,0,0.55);
  transform: scale(.85) rotate(-2deg);
  opacity: 0;
  transition: transform .38s cubic-bezier(.34,1.56,.64,1), opacity .28s ease;
}

.pf-mystery-modal.is-active .pf-mystery-modal__panel {
  transform: scale(1) rotate(0deg);
  opacity: 1;
}

.pf-mystery-modal__eyebrow {
  text-align: center;
  font-family: var(--fh);
  font-weight: 800;
  font-size: .95rem;
  color: var(--pocket-gold);
  margin-bottom: 1rem;
  letter-spacing: .03em;
}

.pf-mystery-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s var(--ease);
}
.pf-mystery-modal__close:hover { background: rgba(255,255,255,0.22); }

.pf-mystery-modal__body { min-height: 120px; }

.pf-mystery-modal__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  padding: 2rem 0;
  color: rgba(255,255,255,0.7);
  font-weight: 700;
  font-size: .85rem;
  text-align: center;
}

.pf-mystery-modal__spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.18);
  border-top-color: var(--pocket-gold);
  animation: pf-mb-spin .8s linear infinite;
}

@keyframes pf-mb-spin { to { transform: rotate(360deg); } }

.pf-mystery-modal__body .pf-story-card { margin: 0; }

@media (max-width: 480px) {
  .pf-mystery-box { right: 1.1rem; bottom: 1.1rem; }
  .pf-mystery-box__icon-wrap { width: 58px; height: 58px; font-size: 1.8rem; }
  .pf-mystery-box__label { display: none; }
}
