/* ============================================================
   KÔKÔ — CSS
   Masque gardien flottant de Bassam
   ============================================================ */

/* ── WRAPPER PRINCIPAL ─────────────────────────────────────── */
#koko-wrap {
  position: fixed;
  bottom: 240px;
  left: 14px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(20px) scale(0.85);
  transition: opacity 0.5s cubic-bezier(0.34,1.56,0.64,1),
              transform 0.5s cubic-bezier(0.34,1.56,0.64,1);
}

#koko-wrap.koko-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── MASQUE WRAP ──────────────────────────────────────────── */
#koko-mask-wrap {
  width: 72px;
  height: 96px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  /* Animation de flottement permanente */
  animation: koko-float 3.2s ease-in-out infinite;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.55));
}

#koko-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

/* Flottement */
@keyframes koko-float {
  0%, 100% { transform: translateY(0px) rotate(-1deg); }
  30%       { transform: translateY(-10px) rotate(1.5deg); }
  70%       { transform: translateY(-6px) rotate(-0.5deg); }
}

/* ── GRAND MODE ──────────────────────────────────────────── */
#koko-wrap.koko-big {
  bottom: 200px;
  left: 50%;
  transform: translateX(-50%) scale(1.6) !important;
  z-index: 900;
}

#koko-wrap.koko-big #koko-mask-wrap {
  width: 90px;
  height: 120px;
  animation: koko-float-big 2s ease-in-out infinite;
}

@keyframes koko-float-big {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-14px); }
}

/* ── BULLE DE DIALOGUE ───────────────────────────────────── */
#koko-bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(8px) scale(0.9);
  min-width: 160px;
  max-width: 220px;
  padding: 10px 14px;
  background: rgba(10,6,2,0.96);
  border: 1.5px solid rgba(196,153,42,0.6);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6), 0 0 12px rgba(196,153,42,0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.34,1.56,0.64,1);
  white-space: normal;
  text-align: center;
}

/* Petite flèche pointant vers Kôkô */
#koko-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: rgba(196,153,42,0.6);
  border-bottom: none;
}

#koko-bubble.koko-bubble-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

#koko-nzima {
  font-family: 'Playfair Display', serif;
  font-size: 0.88rem;
  font-weight: 700;
  font-style: italic;
  color: #f0d060;
  line-height: 1.3;
  margin-bottom: 4px;
}

#koko-fr {
  font-family: 'Special Elite', cursive;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  color: rgba(245,237,216,0.6);
  line-height: 1.4;
}

/* ── ANIMATIONS PLUMES ───────────────────────────────────── */
.feather-idle {
  animation: feather-sway 4s ease-in-out infinite;
}

.feather-happy {
  animation: feather-wave 0.5s ease-in-out 3;
}

.feather-excited {
  animation: feather-shake 0.3s ease-in-out 5;
}

.feather-sad {
  animation: feather-droop 1.2s ease-in-out forwards;
}

@keyframes feather-sway {
  0%, 100% { transform: rotate(0deg); }
  50%       { transform: rotate(4deg); }
}

@keyframes feather-wave {
  0%, 100% { transform: rotate(0deg) scaleY(1); }
  50%       { transform: rotate(8deg) scaleY(1.1); }
}

@keyframes feather-shake {
  0%, 100% { transform: rotate(-4deg); }
  50%       { transform: rotate(4deg); }
}

@keyframes feather-droop {
  0%   { transform: rotate(0deg) translateY(0); }
  100% { transform: rotate(-15deg) translateY(6px); }
}

/* ── ÉTATS HUMEUR — SVG colors via CSS ───────────────────── */
#koko-svg.mood-happy   #koko-face-bg { transition: fill 0.4s; }
#koko-svg.mood-excited { filter: drop-shadow(0 0 8px rgba(245,200,66,0.7)); }
#koko-svg.mood-warning { filter: drop-shadow(0 0 8px rgba(192,32,16,0.8)); }
#koko-svg.mood-mystical { filter: drop-shadow(0 0 10px rgba(196,144,232,0.6)); }
#koko-svg.mood-sad      { filter: drop-shadow(0 0 4px rgba(0,0,0,0.9)); }

/* ── ANIMATION BOUNCE ────────────────────────────────────── */
#koko-wrap.koko-bounce {
  animation: koko-float 3.2s ease-in-out infinite,
             koko-bounce 0.5s cubic-bezier(0.34,1.56,0.64,1) 3 !important;
}

@keyframes koko-bounce {
  0%   { transform: scale(1) translateY(0); }
  40%  { transform: scale(1.15) translateY(-16px); }
  70%  { transform: scale(0.95) translateY(4px); }
  100% { transform: scale(1) translateY(0); }
}

/* ── FLASH ROUGE (perte de vie) ──────────────────────────── */
#koko-wrap.koko-flash-red #koko-mask-wrap {
  animation: koko-float 3.2s ease-in-out infinite,
             koko-flash 0.3s ease-in-out 4 !important;
}

@keyframes koko-flash {
  0%, 100% { filter: drop-shadow(0 6px 14px rgba(0,0,0,0.55)); }
  50%       { filter: drop-shadow(0 0 18px rgba(192,32,16,1)) brightness(1.3); }
}

/* ── AURA YEUX PULSANTE ──────────────────────────────────── */
#koko-aura-l, #koko-aura-r {
  animation: aura-pulse 2s ease-in-out infinite;
}

@keyframes aura-pulse {
  0%, 100% { opacity: 0; transform: scale(1); }
  50%       { opacity: inherit; transform: scale(1.15); }
}

/* ── RESPONSIVE — masqué sur écrans non-jeu ──────────────── */
#koko-wrap.koko-hidden-screen {
  opacity: 0 !important;
  pointer-events: none !important;
}
