/* ANYPROG Fox assistant */
.ap-fox-orb {
  position: fixed;
  right: 18px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 120;
  width: 82px;
  height: 82px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  touch-action: manipulation;
  overflow: visible;
}
.ap-fox-orb:active { transform: scale(.98); }
.ap-fox-orb::before {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.54), rgba(255,255,255,0) 68%);
  filter: blur(2px);
}
.ap-fox-dog {
  display: block;
  width: 78px;
  height: 78px;
  object-fit: contain;
  transform: translateY(3px);
  filter: drop-shadow(0 10px 14px rgba(15,23,42,.18));
  animation: apFoxBob 1.9s ease-in-out infinite;
}
.ap-fox-tail {
  display: none;
  position: absolute;
  right: 8px;
  bottom: 17px;
  z-index: -1;
  width: 28px;
  height: 18px;
  border-radius: 999px 999px 999px 0;
  border: 5px solid #f2c08a;
  border-left: 0;
  border-bottom-color: #eab56f;
  transform-origin: left bottom;
  transform: rotate(-22deg);
  filter: drop-shadow(0 8px 9px rgba(15,23,42,.12));
}
.ap-fox-orb.is-wagging .ap-fox-tail,
.ap-fox-orb.is-happy .ap-fox-tail,
.ap-fox-orb.is-active .ap-fox-tail {
  animation: apFoxTail 620ms ease-in-out infinite;
}
.ap-fox-orb.is-wagging .ap-fox-dog {
  transform-origin: 52% 78%;
  animation: apFoxDragWiggle 520ms ease-in-out infinite;
}
.ap-fox-mood {
  position: absolute;
  top: 1px;
  left: 2px;
  z-index: 2;
  min-width: 24px;
  height: 24px;
  display: none;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(203,213,225,.8);
  color: #2563eb;
  font-size: 13px;
  font-weight: 950;
  box-shadow: 0 8px 20px rgba(15,23,42,.12);
}
.ap-fox-mood.is-visible { display: grid; }
.ap-fox-orb.is-happy .ap-fox-dog {
  transform: translateY(-1px) rotate(1deg) scale(1.035);
  filter: drop-shadow(0 12px 16px rgba(15,23,42,.18)) saturate(1.08) brightness(1.04);
}
.ap-fox-orb.is-active .ap-fox-dog {
  animation-duration: 1.1s;
  filter: drop-shadow(0 12px 16px rgba(37,99,235,.20)) saturate(1.12);
}
.ap-fox-orb.is-curious .ap-fox-dog {
  transform: translateY(1px) rotate(-5deg);
}
.ap-fox-orb.is-sleepy .ap-fox-dog {
  filter: drop-shadow(0 10px 14px rgba(15,23,42,.12)) saturate(.88) brightness(.98);
}
.ap-fox-orb::after {
  content: "";
  position: absolute;
  right: 9px;
  top: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #fff;
  box-shadow: 0 0 0 4px rgba(34,197,94,.18);
}
.ap-fox-orb.is-talking { animation: apFoxPulse 1.1s ease-in-out infinite; }
.ap-fox-bubble {
  position: fixed;
  right: 92px;
  bottom: calc(36px + env(safe-area-inset-bottom));
  z-index: 119;
  width: min(260px, calc(100vw - 118px));
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(15,23,42,.12);
  background: rgba(255,255,255,.96);
  color: #0f172a;
  box-shadow: 0 18px 44px rgba(15,23,42,.18);
  font-size: 13px;
  line-height: 1.42;
  display: none;
}
.ap-fox-bubble.is-visible { display: block; }
.ap-fox-bubble b { display: block; margin-bottom: 3px; font-weight: 950; }
.ap-fox-panel {
  position: fixed;
  right: 18px;
  bottom: calc(98px + env(safe-area-inset-bottom));
  z-index: 121;
  width: min(360px, calc(100vw - 24px));
  height: min(470px, calc(100vh - 118px));
  display: none;
  grid-template-rows: auto 1fr auto;
  border: 1px solid rgba(15,23,42,.12);
  border-radius: 9px;
  background: rgba(255,255,255,.97);
  color: #0f172a;
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 70px rgba(15,23,42,.22);
  overflow: hidden;
}
.ap-fox-panel.is-open { display: grid; }
.ap-fox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(135deg, #fff7ed, #eef2ff);
  cursor: default;
  touch-action: auto;
}
.ap-fox-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 950;
}
.ap-fox-title-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #9a3412;
  font-size: 11px;
}
.ap-fox-title small {
  display: block;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}
.ap-fox-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 7px;
  background: #f1f5f9;
  color: #0f172a;
  font-size: 20px;
  font-weight: 950;
  cursor: pointer;
}
.ap-fox-body {
  min-height: 0;
  padding: 12px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ap-fox-msg {
  max-width: 90%;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid #e2e8f0;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ap-fox-msg.user {
  align-self: flex-end;
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #312e81;
}
.ap-fox-msg.ai {
  align-self: flex-start;
  background: #f8fafc;
  border-color: #dbeafe;
  color: #0f172a;
}
.ap-fox-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 12px 10px;
  background: #fff;
}
.ap-fox-chip {
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 7px 10px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}
.ap-fox-form {
  display: grid;
  grid-template-columns: minmax(0,1fr) 38px auto;
  gap: 7px;
  padding: 10px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}
.ap-fox-input {
  min-width: 0;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  padding: 9px 10px;
  outline: none;
}
.ap-fox-send,
.ap-fox-mic {
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  background: #4f46e5;
  color: #fff;
  font-size: 12px;
  font-weight: 950;
  padding: 0 10px;
  cursor: pointer;
}
.ap-fox-mic.is-listening {
  background: rgba(244,63,94,.32);
  border-color: rgba(251,113,133,.45);
}
@keyframes apFoxPulse {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.03); }
}
@keyframes apFoxBob {
  0%, 100% { transform: translateY(2px) rotate(-1deg); }
  50% { transform: translateY(-2px) rotate(1deg); }
}
@keyframes apFoxTail {
  0%, 100% { transform: rotate(-30deg) translateX(0); }
  50% { transform: rotate(18deg) translateX(2px); }
}
@keyframes apFoxDragWiggle {
  0%, 100% { transform: translateY(1px) rotate(-2deg) scale(1.01); }
  50% { transform: translateY(-1px) rotate(2deg) scale(1.035); }
}
@media (max-width: 1280px) {
  .ap-fox-panel {
    width: min(340px, calc(100vw - 24px));
    height: min(430px, calc(100vh - 112px));
    right: 12px;
    bottom: calc(86px + env(safe-area-inset-bottom));
  }
  .ap-fox-body {
    padding: 10px;
  }
  .ap-fox-chips {
    max-height: 86px;
    overflow: auto;
  }
  .ap-fox-chip {
    padding: 6px 9px;
    font-size: 11px;
  }
}
@media (max-width: 640px) {
  .ap-fox-orb {
    right: 12px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    width: 72px;
    height: 72px;
  }
  .ap-fox-panel {
    left: 10px;
    right: 10px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    width: auto;
    height: min(540px, calc(100vh - 110px));
  }
  .ap-fox-bubble {
    right: 78px;
    bottom: calc(26px + env(safe-area-inset-bottom));
    width: min(250px, calc(100vw - 96px));
  }
  .ap-fox-form {
    grid-template-columns: minmax(0,1fr) auto;
  }
  .ap-fox-mic {
    display: none;
  }
}
