/* ── AQY Mascot Styles ── */

/* AQY Floating Container - wanders around viewport */
.aqy-container {
  position: fixed;
  z-index: 99999;
  pointer-events: none;
  transition: left 0.8s cubic-bezier(0.34, 1.56, 0.64, 1),
              top 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: left, top, transform;
}

.aqy-container.clickable {
  pointer-events: auto;
  cursor: pointer;
}

/* The character image */
.aqy-character {
  width: 90px;
  height: 90px;
  display: block;
  transition: transform 0.3s ease;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
}

.aqy-container:hover .aqy-character {
  transform: scale(1.1);
}

/* ── Animation States ── */

/* IDLE: gentle floating bounce */
.aqy-idle {
  animation: aqyFloat 3s ease-in-out infinite;
}

@keyframes aqyFloat {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(2deg); }
}

/* WAVE: hand wave effect via scale + rotate */
.aqy-wave {
  animation: aqyWave 1.2s ease-in-out;
}

@keyframes aqyWave {
  0% { transform: rotate(0deg) scale(1); }
  15% { transform: rotate(-15deg) scale(1.05); }
  30% { transform: rotate(15deg) scale(1.05); }
  45% { transform: rotate(-15deg) scale(1.05); }
  60% { transform: rotate(15deg) scale(1.05); }
  75% { transform: rotate(-10deg) scale(1.02); }
  100% { transform: rotate(0deg) scale(1); }
}

/* FLY: soar up with side-to-side */
.aqy-fly {
  animation: aqyFly 2.5s ease-in-out infinite;
}

@keyframes aqyFly {
  0%, 100% { transform: translateY(0px) translateX(0px) rotate(0deg); }
  25% { transform: translateY(-25px) translateX(10px) rotate(-5deg); }
  50% { transform: translateY(-35px) translateX(-10px) rotate(5deg); }
  75% { transform: translateY(-15px) translateX(15px) rotate(-3deg); }
}

/* RUN: bounce forward */
.aqy-run {
  animation: aqyRun 0.6s ease-in-out infinite;
}

@keyframes aqyRun {
  0%, 100% { transform: translateY(0px) scaleX(1); }
  25% { transform: translateY(-5px) scaleX(1.05) rotate(-3deg); }
  50% { transform: translateY(-2px) scaleX(0.95) rotate(3deg); }
  75% { transform: translateY(-6px) scaleX(1.05) rotate(-3deg); }
}

/* SLEEP: tilt + gentle breathing */
.aqy-sleep {
  animation: aqySleep 4s ease-in-out infinite;
}

@keyframes aqySleep {
  0%, 100% { transform: rotate(15deg) scale(0.95); }
  50% { transform: rotate(15deg) scale(1.02); }
}

/* JUMP: happy jump */
.aqy-jump {
  animation: aqyJump 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes aqyJump {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-30px) scale(1.1); }
  50% { transform: translateY(-35px) scale(1.15); }
  70% { transform: translateY(-20px) scale(1.05); }
  100% { transform: translateY(0) scale(1); }
}

/* SPIN: playful spin */
.aqy-spin {
  animation: aqySpin 1s ease-in-out;
}

@keyframes aqySpin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}

/* PEEK: peek from side */
.aqy-peek {
  animation: aqyPeek 2s ease-in-out infinite;
}

@keyframes aqyPeek {
  0%, 100% { transform: translateX(0) scaleX(1); }
  25% { transform: translateX(15px) scaleX(1.1); }
  50% { transform: translateX(0) scaleX(1); }
  75% { transform: translateX(-15px) scaleX(0.9); }
}

/* ── Speech Bubble ── */
.aqy-speech {
  position: absolute;
  background: #fff;
  color: #333;
  padding: 10px 18px;
  border-radius: 16px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  max-width: 360px;
  overflow: visible;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  border: 1px solid rgba(0,0,0,0.06);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.aqy-speech.show {
  opacity: 1;
  transform: scale(1);
}

/* ── Speech Bubble: Tail ── */
.aqy-speech::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  z-index: -1;
}

/* ── Position: RIGHT side of AQY ── */
.aqy-speech.pos-right {
  left: calc(100% + 14px);
  right: auto;
  top: 50%;
  bottom: auto;
  transform: translateY(-50%) scale(0.9);
  transform-origin: left center;
  border-radius: 16px 16px 16px 4px;
}
.aqy-speech.pos-right.show {
  transform: translateY(-50%) scale(1);
}
.aqy-speech.pos-right::after {
  left: -7px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  border-left: none;
  border-bottom: none;
}

/* ── Position: LEFT side of AQY ── */
.aqy-speech.pos-left {
  right: calc(100% + 14px);
  left: auto;
  top: 50%;
  bottom: auto;
  transform: translateY(-50%) scale(0.9);
  transform-origin: right center;
  border-radius: 16px 16px 4px 16px;
}
.aqy-speech.pos-left.show {
  transform: translateY(-50%) scale(1);
}
.aqy-speech.pos-left::after {
  right: -7px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  border-right: none;
  border-top: none;
}

/* ── Position: ABOVE AQY ── */
.aqy-speech.pos-top {
  bottom: calc(100% + 14px);
  top: auto;
  left: 50%;
  right: auto;
  transform: translateX(-50%) scale(0.9);
  transform-origin: bottom center;
  border-radius: 16px 16px 16px 16px;
}
.aqy-speech.pos-top.show {
  transform: translateX(-50%) scale(1);
}
.aqy-speech.pos-top::after {
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  border-top: none;
  border-left: none;
}

/* ── Position: BELOW AQY ── */
.aqy-speech.pos-bottom {
  top: calc(100% + 14px);
  bottom: auto;
  left: 50%;
  right: auto;
  transform: translateX(-50%) scale(0.9);
  transform-origin: top center;
  border-radius: 16px 16px 16px 16px;
}
.aqy-speech.pos-bottom.show {
  transform: translateX(-50%) scale(1);
}
.aqy-speech.pos-bottom::after {
  top: -7px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  border-bottom: none;
  border-right: none;
}

/* ── Zzz sleep bubbles ── */
.aqy-zzz {
  position: absolute;
  top: -10px;
  right: 25px;
  font-size: 14px;
  font-weight: 800;
  color: #aaa;
  opacity: 0;
  transition: all 0.5s ease;
}

.aqy-zzz.show {
  opacity: 1;
  animation: aqyZzz 2s ease-in-out infinite;
}

@keyframes aqyZzz {
  0%, 100% { transform: translateY(0) translateX(0) scale(1); opacity: 0.8; }
  50% { transform: translateY(-15px) translateX(8px) scale(1.2); opacity: 0.4; }
}

/* ── Welcome Modal ── */
.aqy-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.aqy-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.aqy-modal {
  background: #fff;
  border-radius: 24px;
  padding: 40px 36px 28px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  transform: scale(0.85) translateY(20px);
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.aqy-modal-overlay.active .aqy-modal {
  transform: scale(1) translateY(0);
}

.aqy-modal-img {
  width: 100px;
  height: 100px;
  margin: 0 auto 16px;
  display: block;
  animation: aqyModalBounce 1.5s ease-in-out infinite;
}

@keyframes aqyModalBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(3deg); }
}

.aqy-modal h2 {
  font-family: 'Inter', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: #2C1810;
  margin-bottom: 8px;
}

.aqy-modal p {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  color: #666;
  line-height: 1.6;
  margin-bottom: 24px;
}

.aqy-modal-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #FF6B00;
  color: #fff;
  border: none;
  padding: 14px 32px;
  border-radius: 14px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
}

.aqy-modal-btn:hover {
  background: #e05e00;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255,107,0,0.3);
}

.aqy-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #999;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
  line-height: 1;
}

.aqy-modal-close:hover {
  background: #f5f5f5;
  color: #333;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .aqy-character { width: 70px; height: 70px; }
  .aqy-speech { font-size: 11px; padding: 8px 14px; max-width: 260px; }
  .aqy-modal { padding: 28px 24px 24px; }
  .aqy-modal-img { width: 80px; height: 80px; }
  .aqy-modal h2 { font-size: 1.3rem; }
}

/* ── Entrance animation ── */
.aqy-entrance {
  animation: aqyEntrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes aqyEntrance {
  0% { transform: scale(0) rotate(-180deg); opacity: 0; }
  60% { transform: scale(1.2) rotate(10deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
