/* 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: 1px solid rgba(15,23,42,.10);
  border-radius: 22px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 18px 46px rgba(15,23,42,.16);
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none;
  overflow: visible;
}
.ap-fox-orb:active { cursor: grabbing; }
.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-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: grab;
  touch-action: none;
}
.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); }
}
@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;
  }
}
