/* Atlas Eye FAB — fixed bottom-right, above all content */
#atlas-eye-fab {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  right: max(16px, env(safe-area-inset-right));
  width: 52px;
  height: 52px;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#atlas-eye-fab.visible {
  display: flex;
}

#atlas-eye-fab .atlas-eye-wrap {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 6px #9B59FF);
}

#atlas-eye-fab.atlas-eye--tap .atlas-eye-wrap {
  animation: atlas-eye-tap-flash 0.35s ease-out;
}

#atlas-eye-fab.atlas-eye--message .atlas-eye-wrap {
  animation: atlas-eye-msg-pulse 0.6s ease-out;
}

#atlas-eye-fab.atlas-eye--thinking .atlas-eye-wrap {
  filter: drop-shadow(0 0 18px #9B59FF);
}

#atlas-eye-fab:not(.atlas-eye--no-motion) .atlas-eye-svg {
  animation:
    atlas-eye-bob 4s ease-in-out infinite,
    atlas-eye-pulse 3s ease-in-out infinite;
}

#atlas-eye-fab:not(.atlas-eye--no-motion).atlas-eye--thinking .atlas-eye-svg {
  animation:
    atlas-eye-bob-fast 2.5s ease-in-out infinite,
    atlas-eye-pulse 2s ease-in-out infinite;
}

#atlas-eye-fab:not(.atlas-eye--no-motion) .atlas-eye-wrap {
  animation: atlas-eye-glow 3s ease-in-out infinite;
}

#atlas-eye-fab.atlas-eye--no-motion .atlas-eye-wrap,
#atlas-eye-fab.atlas-eye--no-motion .atlas-eye-svg,
#atlas-eye-fab.atlas-eye--no-motion .atlas-eye-iris {
  animation: none !important;
}

#atlas-eye-fab .atlas-eye-svg {
  width: 36px;
  height: 36px;
  transform-origin: center center;
}

#atlas-eye-fab .atlas-eye-iris {
  transform-origin: 18px 18px;
}

#atlas-eye-fab:not(.atlas-eye--no-motion) .atlas-eye-iris {
  animation: atlas-eye-iris-spin 8s linear infinite;
}

#atlas-eye-fab.atlas-eye--thinking:not(.atlas-eye--no-motion) .atlas-eye-iris {
  animation: atlas-eye-iris-spin 2s linear infinite;
}

#atlas-eye-fab .atlas-eye-lid-top,
#atlas-eye-fab .atlas-eye-lid-bottom {
  transition: none;
}

#atlas-eye-fab.atlas-eye--blink .atlas-eye-lid-top {
  animation: atlas-eye-lid-close-top 0.1s ease-in forwards,
             atlas-eye-lid-open-top 0.2s ease-out 0.1s forwards;
}

#atlas-eye-fab.atlas-eye--blink .atlas-eye-lid-bottom {
  animation: atlas-eye-lid-close-bottom 0.1s ease-in forwards,
             atlas-eye-lid-open-bottom 0.2s ease-out 0.1s forwards;
}

/* Onboarding center eye (80px) */
.atlas-eye-onboard {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.atlas-eye-onboard .atlas-eye-wrap {
  filter: drop-shadow(0 0 10px #9B59FF);
  animation: atlas-eye-glow 3s ease-in-out infinite;
}

.atlas-eye-onboard .atlas-eye-svg {
  width: 56px;
  height: 56px;
  animation: atlas-eye-bob 4s ease-in-out infinite, atlas-eye-pulse 3s ease-in-out infinite;
}

.atlas-eye-onboard .atlas-eye-iris {
  transform-origin: 28px 28px;
  animation: atlas-eye-iris-spin 8s linear infinite;
}

.atlas-eye-onboard.atlas-eye--no-motion .atlas-eye-wrap,
.atlas-eye-onboard.atlas-eye--no-motion .atlas-eye-svg,
.atlas-eye-onboard.atlas-eye--no-motion .atlas-eye-iris {
  animation: none !important;
}

@keyframes atlas-eye-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes atlas-eye-bob-fast {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes atlas-eye-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes atlas-eye-glow {
  0%, 100% { filter: drop-shadow(0 0 6px #9B59FF); }
  50% { filter: drop-shadow(0 0 14px #9B59FF); }
}

@keyframes atlas-eye-iris-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes atlas-eye-tap-flash {
  0% { transform: scale(1); filter: drop-shadow(0 0 6px #9B59FF); }
  40% { transform: scale(1.15); filter: drop-shadow(0 0 22px #9B59FF); }
  100% { transform: scale(1); filter: drop-shadow(0 0 6px #9B59FF); }
}

@keyframes atlas-eye-msg-pulse {
  0% { filter: drop-shadow(0 0 6px #9B59FF); }
  30% { filter: drop-shadow(0 0 24px #C084FC); }
  100% { filter: drop-shadow(0 0 6px #9B59FF); }
}

@keyframes atlas-eye-lid-close-top {
  to { d: path("M 8 16 Q 18 20 28 16"); }
}

@keyframes atlas-eye-lid-open-top {
  from { d: path("M 8 16 Q 18 20 28 16"); }
  to { d: path("M 6 14 Q 18 8 30 14"); }
}

@keyframes atlas-eye-lid-close-bottom {
  to { d: path("M 8 22 Q 18 18 28 22"); }
}

@keyframes atlas-eye-lid-open-bottom {
  from { d: path("M 8 22 Q 18 18 28 22"); }
  to { d: path("M 6 24 Q 18 30 30 24"); }
}

@media (prefers-reduced-motion: reduce) {
  #atlas-eye-fab .atlas-eye-wrap,
  #atlas-eye-fab .atlas-eye-svg,
  #atlas-eye-fab .atlas-eye-iris,
  .atlas-eye-onboard .atlas-eye-wrap,
  .atlas-eye-onboard .atlas-eye-svg,
  .atlas-eye-onboard .atlas-eye-iris {
    animation: none !important;
  }
}
