/* ============================
   CELLO — CancéroJeune
   Mascot + Présentation
============================ */

/* ===========================
   BASE
=========================== */
#cello-mascot {
  position: fixed;
  z-index: 9998;
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  cursor: pointer;
  touch-action: none;
}

/* ===========================
   INTRO ENTRANCE
=========================== */
/* Stretch upward during the rocket phase */
#cello-mascot.intro-rise #cello-body-group {
  animation: celloRise 0.38s ease-in;
}
@keyframes celloRise {
  0%   { transform: scaleX(0.6)  scaleY(1.55) translateY(6px); }
  100% { transform: scaleX(1)    scaleY(1)    translateY(0); }
}

/* Splat on landing */
#cello-mascot.intro-land #cello-body-group {
  animation: celloLand 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes celloLand {
  0%   { transform: scaleX(1.5)  scaleY(0.55) translateY(12px); }
  35%  { transform: scaleX(0.82) scaleY(1.22) translateY(-14px); }
  65%  { transform: scaleX(1.09) scaleY(0.93) translateY(3px); }
  82%  { transform: scaleX(0.97) scaleY(1.04) translateY(-3px); }
  100% { transform: scaleX(1)    scaleY(1)    translateY(0); }
}

/* Spotted! mega jump */
#cello-mascot.intro-spot #cello-body-group {
  animation: celloSpot 0.75s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes celloSpot {
  0%   { transform: scale(1)    translateY(0); }
  18%  { transform: scale(1.4)  translateY(-28px) rotate(-6deg); }
  45%  { transform: scale(0.88) translateY(6px)   rotate(4deg); }
  68%  { transform: scale(1.15) translateY(-12px) rotate(-2deg); }
  100% { transform: scale(1)    translateY(0)    rotate(0); }
}
/* Flash glow when spotted */
#cello-mascot.intro-spot #cello-svg {
  animation: celloSpotGlow 0.75s ease-out;
}
@keyframes celloSpotGlow {
  0%   { filter: drop-shadow(0 7px 16px rgba(22,163,74,0.32)); }
  25%  { filter: drop-shadow(0 0 55px rgba(74,222,128,1)) drop-shadow(0 0 100px rgba(74,222,128,0.7)); }
  100% { filter: drop-shadow(0 7px 16px rgba(22,163,74,0.32)); }
}

/* ===========================
   SVG
=========================== */
#cello-svg {
  width: 84px;
  height: 84px;
  overflow: visible;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: block;
}

/* ===========================
   IDLE FLOAT
=========================== */
#cello-body-group {
  animation: celloFloat 3s ease-in-out infinite;
  transform-origin: 50% 95%;
}
@keyframes celloFloat {
  0%   { transform: translateY(0)    scaleX(1)    scaleY(1); }
  35%  { transform: translateY(-9px) scaleX(0.97) scaleY(1.04); }
  50%  { transform: translateY(-9px) scaleX(0.97) scaleY(1.04); }
  85%  { transform: translateY(1px)  scaleX(1.03) scaleY(0.97); }
  100% { transform: translateY(0)    scaleX(1)    scaleY(1); }
}

#cello-svg {
  animation: celloGlow 3s ease-in-out infinite;
  filter: drop-shadow(0 7px 16px rgba(22,163,74,0.32));
}
@keyframes celloGlow {
  0%, 100% { filter: drop-shadow(0 7px 16px rgba(22,163,74,0.28)); }
  50%       { filter: drop-shadow(0 16px 32px rgba(22,163,74,0.60)) drop-shadow(0 0 18px rgba(74,222,128,0.25)); }
}

#cello-mascot:hover #cello-svg {
  animation: none;
  filter: drop-shadow(0 14px 30px rgba(22,163,74,0.70)) drop-shadow(0 0 20px rgba(74,222,128,0.35));
  transform: scale(1.09);
}
#cello-mascot:hover #cello-body-group {
  animation: celloFloat 3s ease-in-out infinite;
}

/* ===========================
   BOUTON PRÉSENTATION
=========================== */
#cello-pres-hover-btn {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  right: 8px;
  background: linear-gradient(135deg, #22c55e, #15803d);
  border: none;
  border-radius: 20px;
  padding: 5px 10px;
  font-size: 0.8rem;
  color: white;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(22,163,74,0.4);
  animation: pressBtnIn 0.2s cubic-bezier(0.34,1.56,0.64,1);
  z-index: 2;
}
@keyframes pressBtnIn {
  0%   { transform: scale(0.7) translateY(8px); opacity: 0; }
  100% { transform: scale(1)   translateY(0);   opacity: 1; }
}
#cello-mascot:hover #cello-pres-hover-btn { display: block; }
#cello-pres-hover-btn:hover {
  background: linear-gradient(135deg, #16a34a, #14532d);
  transform: scale(1.06);
}

/* ===========================
   BULLE DE CONSEIL
=========================== */
#cello-bubble {
  position: absolute;
  bottom: calc(100% + 14px);
  right: 0;
  width: 220px;
  background: #ffffff;
  border-radius: 16px;
  padding: 12px 14px 12px 14px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.13), 0 1px 4px rgba(0,0,0,0.07);
  border: 1.5px solid rgba(34,197,94,0.18);
  font-size: 0.82rem;
  line-height: 1.5;
  color: #1e293b;
  opacity: 0;
  transform: scale(0.8) translateY(12px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.34,1.56,0.64,1);
  transform-origin: bottom right;
  z-index: 1;
}
/* Flèche */
#cello-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 20px;
  width: 14px;
  height: 8px;
  background: #ffffff;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.06));
}
#cello-bubble.show {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}
#cello-bubble-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  font-size: 0.95rem;
  color: #94a3b8;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
#cello-bubble-close:hover { color: #ef4444; }
#cello-bubble-text { padding-right: 14px; }

/* ===========================
   WALKING
=========================== */
#cello-mascot.walking #cello-body-group {
  animation: celloWalk 0.55s ease-in-out infinite;
}
@keyframes celloWalk {
  0%   { transform: translateY(0)    rotate(-4deg) scaleX(1)    scaleY(1); }
  25%  { transform: translateY(-6px) rotate(0deg)  scaleX(0.97) scaleY(1.03); }
  50%  { transform: translateY(0)    rotate(4deg)  scaleX(1)    scaleY(1); }
  75%  { transform: translateY(-6px) rotate(0deg)  scaleX(0.97) scaleY(1.03); }
  100% { transform: translateY(0)    rotate(-4deg) scaleX(1)    scaleY(1); }
}

/* ===========================
   WIGGLE
=========================== */
#cello-mascot.wiggle #cello-body-group {
  animation: celloWiggle 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
@keyframes celloWiggle {
  0%   { transform: scale(1)    rotate(0deg); }
  15%  { transform: scale(1.14) rotate(-10deg); }
  35%  { transform: scale(1.12) rotate(9deg); }
  55%  { transform: scale(1.05) rotate(-5deg); }
  75%  { transform: scale(1.02) rotate(3deg); }
  100% { transform: scale(1)    rotate(0deg); }
}

/* ===========================
   EXCITED
=========================== */
#cello-mascot.excited #cello-body-group {
  animation: celloExcited 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes celloExcited {
  0%, 100% { transform: translateY(0)     scale(1); }
  25%       { transform: translateY(-20px) scaleX(0.94) scaleY(1.08); }
  50%       { transform: translateY(-8px)  scale(0.98); }
  75%       { transform: translateY(-16px) scaleX(0.95) scaleY(1.06); }
}

/* ===========================
   PARTY MODE
=========================== */
#cello-mascot.party-mode #cello-body-group {
  animation: celloParty 0.28s ease-in-out infinite alternate;
}
@keyframes celloParty {
  0%   { transform: rotate(-12deg) scale(1.13) translateY(-6px); }
  100% { transform: rotate(12deg)  scale(1.13) translateY(-6px); }
}

/* ===========================
   PET MODE
=========================== */
#cello-mascot.pet-mode #cello-body-group {
  animation: celloPet 0.6s ease-in-out infinite;
}
@keyframes celloPet {
  0%, 100% { transform: scale(1); }
  50%       { transform: scaleX(1.09) scaleY(0.93); }
}

/* ===========================
   DRAGGING
=========================== */
#cello-mascot.dragging { cursor: grabbing; }
#cello-mascot.dragging #cello-svg {
  animation: none;
  filter: drop-shadow(0 22px 44px rgba(22,163,74,0.75));
  transform: rotate(6deg) scale(1.08);
  transition: transform 0.12s ease, filter 0.12s ease;
}

/* ===========================
   TALKING (TTS)
=========================== */
#cello-mascot.talking #cello-body-group {
  animation: celloTalk 0.28s ease-in-out infinite alternate;
}
@keyframes celloTalk {
  0%   { transform: scaleX(1.03) scaleY(0.97); }
  100% { transform: scaleX(0.97) scaleY(1.03); }
}

/* ===========================
   CONFETTI
=========================== */
.confetti-piece {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 3px;
  pointer-events: none;
  z-index: 9999;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(0)     rotate(0deg);   opacity: 1; }
  100% { transform: translateY(320px) rotate(680deg); opacity: 0; }
}

/* ===========================
   OVERLAY PRÉSENTATION
=========================== */
#cello-presentation {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: radial-gradient(ellipse at 50% 40%, #0d1f12 0%, #050d08 70%, #000 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: presIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#cello-presentation.hidden { display: none; }

@keyframes presIn {
  0%   { opacity: 0; transform: scale(0.94); }
  100% { opacity: 1; transform: scale(1); }
}

#cp-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 480px;
  padding: 40px 20px;
}

/* ─── Orb ─── */
#cp-orb {
  position: relative;
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cp-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(34,197,94,0.25);
  animation: cpRingPulse 3s ease-in-out infinite;
}
.cp-ring-1 { animation-delay: 0s;   inset: 0px;   }
.cp-ring-2 { animation-delay: 0.6s; inset: -14px; border-color: rgba(34,197,94,0.15); }
.cp-ring-3 { animation-delay: 1.2s; inset: -28px; border-color: rgba(34,197,94,0.08); }

@keyframes cpRingPulse {
  0%, 100% { transform: scale(1);    opacity: 0.6; }
  50%       { transform: scale(1.06); opacity: 1; }
}

#cello-presentation[data-state="listening"] .cp-ring {
  animation-duration: 0.7s;
  border-color: rgba(74,222,128,0.55);
}
#cello-presentation[data-state="listening"] .cp-ring-1 { border-color: rgba(74,222,128,0.8); }

#cello-presentation[data-state="speaking"] .cp-ring {
  animation-duration: 0.5s;
  border-color: rgba(34,197,94,0.5);
}

#cp-avatar-wrap {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(74,222,128,0.18) 0%, rgba(21,128,61,0.08) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px rgba(34,197,94,0.3), 0 0 40px rgba(34,197,94,0.2), inset 0 0 30px rgba(34,197,94,0.05);
}
#cp-avatar-svg { width: 80px; height: 80px; }

#cp-body-group {
  animation: cpFloat 3s ease-in-out infinite;
  transform-origin: 50% 90%;
}
@keyframes cpFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

#cello-presentation[data-state="listening"] #cp-body-group,
#cello-presentation[data-state="speaking"]  #cp-body-group {
  animation: cpTalk 0.28s ease-in-out infinite alternate;
}
@keyframes cpTalk {
  0%   { transform: scaleY(1.03) scaleX(0.98); }
  100% { transform: scaleY(0.97) scaleX(1.02); }
}

/* ─── Nom ─── */
#cp-name {
  color: #f0fdf4;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-shadow: 0 0 30px rgba(34,197,94,0.4);
}

/* ─── Status ─── */
#cp-status-text {
  color: rgba(255,255,255,0.55);
  font-size: 0.85rem;
  letter-spacing: 0.3px;
  min-height: 22px;
  transition: color 0.3s;
}
#cello-presentation[data-state="listening"] #cp-status-text { color: #4ade80; }
#cello-presentation[data-state="speaking"]  #cp-status-text { color: #86efac; }
#cp-status-text kbd {
  background: rgba(255,255,255,0.12);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.78rem;
  font-family: inherit;
}

/* ─── Transcript ─── */
#cp-transcript-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
}
.cp-line {
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.5;
  word-wrap: break-word;
  animation: cpLineIn 0.3s ease;
}
@keyframes cpLineIn {
  0%   { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}
.cp-line:empty { display: none; }
.cp-line-user {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.65);
  border-left: 2px solid rgba(255,255,255,0.2);
  font-style: italic;
}
.cp-line-cello {
  background: rgba(34,197,94,0.12);
  color: #d1fae5;
  border-left: 2px solid #22c55e;
  font-weight: 500;
}

/* ─── Contrôles ─── */
#cp-controls {
  display: flex;
  gap: 14px;
  align-items: center;
}

#cp-mic-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 50px;
  border: 1.5px solid rgba(34,197,94,0.35);
  background: rgba(34,197,94,0.18);
  color: #4ade80;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  font-family: inherit;
  letter-spacing: 0.3px;
}
#cp-mic-btn:hover {
  background: rgba(34,197,94,0.28);
  transform: scale(1.04);
  box-shadow: 0 0 24px rgba(34,197,94,0.3);
}
#cp-mic-btn.active {
  background: rgba(239,68,68,0.2);
  border-color: rgba(239,68,68,0.5);
  color: #f87171;
  animation: cpMicPulse 0.7s ease-in-out infinite;
  box-shadow: 0 0 28px rgba(239,68,68,0.25);
}
@keyframes cpMicPulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.06); }
}
#cp-mic-btn span:first-child { font-size: 1.1rem; }

#cp-exit-btn {
  padding: 12px 20px;
  border-radius: 50px;
  border: 1.5px solid rgba(255,255,255,0.15);
  background: transparent;
  color: rgba(255,255,255,0.45);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  font-family: inherit;
}
#cp-exit-btn:hover { border-color: rgba(239,68,68,0.5); color: #f87171; }

/* ─── Hint ─── */
#cp-hint {
  color: rgba(255,255,255,0.25);
  font-size: 0.75rem;
  letter-spacing: 0.3px;
}
#cp-hint kbd {
  background: rgba(255,255,255,0.10);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: inherit;
  font-size: 0.72rem;
}

/* ===========================
   TRANSITION DE PAGE
=========================== */
#cello-transition {
  position: fixed;
  inset: 0;
  z-index: 99997;
  background: #030c05;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  overflow: hidden;
}
#cello-transition.ct-active {
  opacity: 1;
  pointer-events: all;
}
.ct-line {
  position: absolute;
  border-radius: 99px;
  transform: translateX(120vw);
}
.ct-line.shoot {
  animation: ctShoot linear forwards;
}
@keyframes ctShoot {
  from { transform: translateX(120vw); }
  to   { transform: translateX(-140vw); }
}

/* ===========================
   RESPONSIVE
=========================== */
@media (max-width: 500px) {
  #cello-svg { width: 66px; height: 66px; }
}
