/* ── Gavi Guide ── */
.gavi-container {
  position: fixed;
  bottom: 20px;
  right: calc(50% - 200px);
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  gap: 0;
  pointer-events: none;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  cursor: grab;
  user-select: none;
}
.gavi-container.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.gavi-container.dragging {
  cursor: grabbing;
  transition: none;
}

/* Speech bubble */
.gavi-bubble {
  position: relative;
  background: #fff;
  color: #1e293b;
  border-radius: 16px;
  padding: 16px 18px;
  max-width: 280px;
  font-size: 14px;
  line-height: 1.55;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  margin-bottom: 30px;
  transform: scale(0.8);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}
.gavi-container.visible .gavi-bubble {
  transform: scale(1);
  opacity: 1;
  transition-delay: 0.15s;
}

/* Bubble arrow pointing right toward Gavi */
.gavi-bubble::after {
  content: '';
  position: absolute;
  right: -10px;
  bottom: 24px;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 12px solid #fff;
}

/* Close button */
.gavi-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  font-size: 18px;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}
.gavi-close:hover {
  color: #475569;
  background: rgba(0,0,0,0.06);
}

/* Character wrapper */
.gavi-character {
  flex-shrink: 0;
  width: 120px;
  height: 180px;
  position: relative;
}

/* Idle bobbing animation */
@keyframes gaviBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
.gavi-container.visible .gavi-character {
  animation: gaviBob 2.5s ease-in-out infinite;
}

/* Waving hand animation */
@keyframes gaviWave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-20deg); }
  50% { transform: rotate(15deg); }
  75% { transform: rotate(-10deg); }
}
.gavi-character.waving .gavi-hand-right {
  transform-origin: 75px 105px;
  animation: gaviWave 0.8s ease-in-out 3;
}

/* Thinking head tilt */
@keyframes gaviThink {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(5deg); }
}
.gavi-character.thinking .gavi-head {
  transform-origin: 60px 40px;
  animation: gaviThink 1.5s ease-in-out infinite;
}

/* Mini help button (always visible) */
.gavi-help-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9998;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid #4a90d9;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  cursor: pointer;
  overflow: hidden;
  padding: 4px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.gavi-help-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(0,0,0,0.22);
}
.gavi-help-btn svg {
  width: 100%;
  height: 100%;
}
.gavi-help-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: #1e293b;
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.gavi-help-btn:hover[data-tooltip]::after {
  opacity: 1;
}

/* Hide help button when guide is active */
.gavi-container.visible ~ .gavi-help-btn {
  opacity: 0;
  pointer-events: none;
}

/* Responsive */
@media (max-width: 600px) {
  .gavi-container {
    bottom: 12px;
    right: 12px;
    left: 12px;
    flex-direction: column-reverse;
    align-items: flex-end;
  }
  .gavi-bubble {
    max-width: calc(100vw - 80px);
    margin-bottom: 0;
    margin-right: 10px;
  }
  .gavi-bubble::after {
    right: 20px;
    bottom: -10px;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 12px solid #fff;
    border-bottom: none;
  }
  .gavi-character {
    width: 80px;
    height: 120px;
  }
  .gavi-help-btn {
    width: 44px;
    height: 44px;
    bottom: 12px;
    right: 12px;
  }
}
