/* ==========================================================================
   diana-pin.css — Tela de Abertura Lúdica com PIN Numérico de 6 Dígitos
   O Mundo da Diana (5 Anos) — Paleta Safari Rosa Mágico & Mobile 9:19
   ========================================================================== */

:root {
  /* Safari Rosa Mágico da Diana */
  --safari-pink-deep: #4a044e;     /* Fundo base escuro contrastante */
  --safari-pink-dark: #701a75;     /* Magenta noturno da selva mágica */
  --safari-pink-magenta: #be185d;  /* Magenta vibrante */
  --safari-pink-hot: #db2777;      /* Rosa choque mágico */
  --safari-pink-bubble: #ec4899;   /* Rosa chiclete favorito da Diana */
  --safari-pink-light: #f472b6;    /* Rosa alegre e luminoso */
  --safari-pink-soft: #fbcfe8;     /* Rosa suave acolhedor */
  --safari-pink-pastel: #fdf2f8;   /* Rosa pastel das nuvens */

  /* Dourados do Leãozinho Leo */
  --safari-gold: #fbbf24;          /* Amarelo ouro do Leão */
  --safari-gold-light: #fef08a;    /* Sol da selva / coroas */
  --safari-orange: #f97316;        /* Laranja juba do Leão */
  --safari-sand: #fef3c7;          /* Areia quente / balões */
}

/* ── Container Principal da Tela de PIN (Overlay em Tela Cheia) ── */
#diana-pin-gate {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: radial-gradient(circle at 50% 12%, #701a75 0%, #4a044e 50%, #2a0230 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: max(16px, calc(env(safe-area-inset-top, 0px) + 12px)) 16px max(24px, calc(env(safe-area-inset-bottom, 0px) + 18px));
  color: #fff;
  font-family: 'Fredoka', 'Quicksand', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overflow-y: auto;
  overflow-x: hidden;
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-sizing: border-box;
}

#diana-pin-gate.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.04);
}

/* ── Partículas Mágicas da Tela de PIN ── */
.pin-stars-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.pin-star-sparkle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, #fde047 0%, rgba(244, 114, 182, 0) 70%);
  animation: pinSparkle 4s infinite ease-in-out;
}

@keyframes pinSparkle {
  0%, 100% { opacity: 0.2; transform: scale(0.6); }
  50% { opacity: 0.9; transform: scale(1.2); }
}

/* ── Conteúdo Centralizado do PIN (Otimizado para Celular 9:19) ── */
.pin-wrapper {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  position: relative;
  z-index: 2;
  gap: 12px;
}

/* ── Topo com Mascote Leo e Título Lúdico ── */
.pin-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  width: 100%;
}

.pin-mascot-avatar {
  position: relative;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24 0%, #ea580c 100%);
  border: 4px solid var(--safari-gold-light);
  box-shadow: 0 8px 24px rgba(219, 39, 119, 0.5), 0 0 0 4px rgba(251, 191, 36, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.2rem;
  animation: pinLeoBounce 3s infinite ease-in-out;
  cursor: pointer;
}

@keyframes pinLeoBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(4deg); }
}

.pin-mascot-crown {
  position: absolute;
  top: -14px;
  right: -4px;
  font-size: 1.6rem;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
  animation: crownTwinkle 2s infinite alternate ease-in-out;
}

@keyframes crownTwinkle {
  0% { transform: rotate(-5deg) scale(1); }
  100% { transform: rotate(8deg) scale(1.1); }
}

.pin-title {
  font-size: 1.6rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.5px;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.4), 0 0 20px rgba(236, 72, 153, 0.6);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.pin-speech-bubble {
  background: rgba(253, 242, 248, 0.95);
  color: var(--safari-pink-deep);
  border: 3px solid var(--safari-gold);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.95rem;
  font-weight: 800;
  max-width: 340px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  position: relative;
  line-height: 1.35;
  transition: all 0.2s ease;
}

.pin-speech-bubble::after {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 0 10px 10px 10px;
  border-style: solid;
  border-color: transparent transparent var(--safari-gold) transparent;
}

/* ── Slots dos 6 Dígitos do PIN ── */
.pin-slots-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 6px 0 12px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(251, 191, 36, 0.3);
  border-radius: 50px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.pin-slot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 3px solid rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--safari-gold-light);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pin-slot.filled {
  background: linear-gradient(135deg, #ec4899, #db2777);
  border-color: var(--safari-gold);
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.6), 0 0 0 2px rgba(251, 191, 36, 0.5);
  transform: scale(1.12);
}

.pin-slot.success {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: #fef08a;
  transform: scale(1.2) rotate(8deg);
}

/* Animação de Erro nos Dígitos */
.pin-slots-container.shake {
  animation: pinShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes pinShake {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(5px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

/* ── Teclado Numérico Lúdico (Thumb Zone 9:19) ── */
.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 16px;
  width: 100%;
  max-width: 340px;
  margin-top: auto;
  padding-bottom: 4px;
}

.pin-key {
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.1));
  border: 3px solid rgba(254, 240, 138, 0.45);
  color: #fff;
  font-size: 2rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3), inset 0 2px 4px rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.15s ease, border-color 0.15s ease;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.pin-key:active {
  transform: scale(0.9);
  background: linear-gradient(145deg, rgba(236, 72, 153, 0.6), rgba(219, 39, 119, 0.8));
  border-color: var(--safari-gold);
  box-shadow: 0 2px 8px rgba(219, 39, 119, 0.5);
}

/* Botões especiais: Dica (Chave) e Apagar (Backspace) */
.pin-key.key-action {
  font-size: 1.45rem;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

.pin-key.key-action:active {
  background: rgba(255, 255, 255, 0.3);
  border-color: var(--safari-gold);
}

.pin-key.key-backspace {
  color: #fca5a5;
}

.pin-key.key-hint {
  color: var(--safari-gold-light);
}

/* ── Modal de Dica dos Pais ── */
.pin-hint-card {
  position: absolute;
  bottom: 12px;
  background: rgba(74, 4, 78, 0.95);
  border: 3px solid var(--safari-gold);
  border-radius: 24px;
  padding: 16px 20px;
  width: 90%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  z-index: 10;
  animation: hintSlideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: none;
}

.pin-hint-card.show {
  display: block;
}

@keyframes hintSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.pin-hint-title {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--safari-gold-light);
  margin-bottom: 6px;
}

.pin-hint-text {
  font-size: 0.92rem;
  color: #fdf2f8;
  line-height: 1.4;
  margin-bottom: 12px;
}

.pin-hint-btn {
  background: linear-gradient(135deg, var(--safari-gold), var(--safari-orange));
  color: var(--safari-pink-deep);
  border: none;
  padding: 8px 18px;
  border-radius: 50px;
  font-size: 0.95rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

/* ── Ajustes Finos para Telas Pequenas e Smartphones Estreitos (9:19) ── */
@media (max-height: 700px) {
  .pin-mascot-avatar {
    width: 72px;
    height: 72px;
    font-size: 2.7rem;
  }
  .pin-title {
    font-size: 1.35rem;
  }
  .pin-key {
    height: 58px;
    font-size: 1.75rem;
  }
  .pin-slot {
    width: 38px;
    height: 38px;
    font-size: 1.25rem;
  }
  .pin-keypad {
    gap: 10px 14px;
  }
}
