/* Floating AI button (Claude Code 2026-11-12, owner: AI "fly anywhere in our app"). Theme glass + calm gold ring like the
   Home cards; sits above the bottom bar and the name ribbon on phones, bottom-right on computers. Drag = move (snaps to a side). */
.ai-float {
  position: fixed; z-index: 40;
  right: 14px; bottom: calc(var(--nav-h, 66px) + var(--safe-b, 0px) + 30px);
  width: 52px; height: 52px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; touch-action: none; user-select: none; -webkit-user-select: none;
  background: radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .16), transparent 55%),
              color-mix(in srgb, var(--btn-a, #1B3155) 82%, #000);
  box-shadow: inset 0 0 0 1.5px #C9AE76, 0 8px 22px rgba(0, 0, 0, .35), 0 0 0 4px rgba(201, 174, 118, .10);
  color: #E4D2A0;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
  -webkit-tap-highlight-color: transparent;
}
.ai-float[hidden] { display: none !important; }
.ai-float[data-side] { bottom: auto; }
.ai-float[data-side="r"] { right: 14px; left: auto; }
.ai-float[data-side="l"] { left: 14px; right: auto; }
.ai-float-in { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; }
.ai-float-in svg { width: 24px; height: 24px; fill: currentColor; stroke: currentColor; filter: drop-shadow(0 0 6px rgba(228, 210, 160, .45)); }
.ai-float:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1.5px #E4D2A0, 0 12px 26px rgba(0, 0, 0, .4), 0 0 0 5px rgba(201, 174, 118, .16); }
.ai-float:active { transform: scale(.94); }
.ai-float:focus-visible { outline: 2px solid #E4D2A0; outline-offset: 3px; }
.ai-float.drag { transition: none; transform: scale(1.08); opacity: .92; cursor: grabbing; }
/* a soft breathing ring every few seconds so it is noticed, never flashing */
.ai-float::after {
  content: ''; position: absolute; inset: -1px; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 0 rgba(228, 210, 160, .45); animation: aiFloatPulse 6s ease-out infinite;
}
@keyframes aiFloatPulse { 0%, 70% { box-shadow: 0 0 0 0 rgba(228, 210, 160, .40); } 100% { box-shadow: 0 0 0 12px rgba(228, 210, 160, 0); } }
@media (prefers-reduced-motion: reduce) { .ai-float::after { animation: none; } .ai-float { transition: none; } }


/* Computers (no bottom bar) */
@media (min-width: 1100px) and (((hover: hover) and (pointer: fine)) or (orientation: landscape)) {
  .ai-float:not([data-side]) { right: 26px; bottom: 26px; }
  .ai-float[data-side="r"] { right: 26px; }
  .ai-float[data-side="l"] { left: 290px; }   /* clear of the side bar */
  .ai-float { width: 56px; height: 56px; }
}
/* inside the dictionary side panel (iframe) there is no button at all */
html.embed .ai-float { display: none !important; }

/* chat window: what the AI knows you are looking at + one-tap page questions */
.aic-about { margin: 6px auto 0; display: inline-flex; gap: 6px; align-items: center; padding: 4px 12px; border-radius: 999px;
  background: rgba(201, 174, 118, .14); box-shadow: inset 0 0 0 1px rgba(201, 174, 118, .5); color: #E4D2A0; font-size: .82rem; font-weight: 600; }
.aic-quick { display: flex; gap: 8px; align-items: center; overflow-x: auto; padding: 6px 14px 2px; scrollbar-width: none; flex: none; }
.aic-quick::-webkit-scrollbar { display: none; }
.aic-quick .aic-chip { flex: none; white-space: nowrap; font-size: .78rem; padding: 6px 12px; }
.aic-quick-l { flex: none; color: #E4D2A0; font-size: .74rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }

/* scrolling: tuck half behind the nearest edge, faded (comes back 0.9 s after scrolling stops) */
.ai-float.tuck { opacity: .55; transform: translateX(62%) scale(.9); }
.ai-float[data-side="l"].tuck { transform: translateX(-62%) scale(.9); }
@media (prefers-reduced-motion: reduce) { .ai-float.tuck { transform: none; opacity: .35; } }

/* 2026-11-12 owner ("hide AI Chat key, we use only fly AI"): on Home the button sat on the My Space Stop key —
   phones / tablets: lifted above the Photo · Music · Themes · Stop bar (only where the user has not dragged it). */
@media not ((min-width: 1100px) and (((hover: hover) and (pointer: fine)) or (orientation: landscape))) {
  body[data-route="home"] .ai-float:not([data-side]) { bottom: calc(var(--nav-h, 66px) + var(--safe-b, 0px) + 100px); }
}
/* 2026-11-13: phone word page — the button rests as a tab at the screen edge, clear of the meanings' ^ and speaker keys
   (AiFloat.js adds .edge); tap opens Lexi AI as usual, drag still works */
.ai-float.edge:not(.drag) { opacity: .92; transform: translateX(72%) scale(.9); }
.ai-float[data-side="l"].edge:not(.drag) { transform: translateX(-72%) scale(.9); }
@media (prefers-reduced-motion: reduce) { .ai-float.edge:not(.drag) { transition: none; } }
