/* Futuresphinx chat widget — floating button + consent gate + chat panel */
/* Layout (all three sites, futuresphinx style): chat launcher in the bottom-right
   corner, .to-top stacked ABOVE it on desktop / below it on mobile, panel above
   the launcher. !important + body-prefix so this file wins regardless of load order. */
body .fs-chat-btn {
  position: fixed; right: clamp(16px, 4vw, 32px) !important; bottom: clamp(16px, 4vw, 32px) !important; z-index: 9998;
  width: 58px; height: 58px; border-radius: 50%; border: 1px solid #d8ff33;
  background: rgba(8,10,8,.85); color: #d8ff33;
  font-size: 24px; cursor: pointer; box-shadow: 0 8px 30px rgba(217,164,65,.35);
  display: flex; align-items: center; justify-content: center;
  transition: transform .18s ease, box-shadow .18s ease;
}
.fs-chat-btn:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 12px 36px rgba(216,255,51,.35); }
body .fs-chat {
  position: fixed; right: clamp(16px, 4vw, 32px) !important;
  bottom: calc(clamp(16px, 4vw, 32px) + 74px) !important; z-index: 9999;
  width: min(380px, calc(100vw - 32px)) !important; height: min(540px, calc(100vh - 160px)) !important;
  background: rgba(8,10,8,.96); border: 1px solid #d8ff33; border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 0 1px rgba(216,255,51,.15), 0 0 28px rgba(216,255,51,.10);
  display: flex; flex-direction: column;
  font-family: 'Inter', system-ui, sans-serif; color: #e8ffe0; overflow: hidden;
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(16px) scale(.97); transform-origin: bottom right;
  transition: opacity .28s ease, transform .32s cubic-bezier(.34,1.4,.64,1), visibility 0s linear .32s;
}
.fs-chat.open {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: translateY(0) scale(1);
  transition: opacity .28s ease, transform .32s cubic-bezier(.34,1.4,.64,1), visibility 0s;
}
/* .to-top stacks ABOVE the chat launcher (futuresphinx layout) */
body .to-top { right: clamp(16px, 4vw, 32px) !important; bottom: calc(clamp(16px, 4vw, 32px) + 74px) !important; }
/* Mobile: near-fullscreen sheet, same geometry as the futuresphinx premium.css override */
@media (max-width: 559px) {
  /* Mobile: launcher in the corner, to-top below it, chat = sheet above the launcher */
  body .fs-chat-btn { right: 16px !important; bottom: 84px !important; }
  body .to-top { right: 16px !important; bottom: 16px !important; }
  body .fs-chat {
    right: 12px !important; left: 12px !important; bottom: 152px !important;
    width: auto !important;
    height: min(560px, calc(100dvh - 200px)) !important;
  }
}
.fs-chat__head {
  padding: 14px 16px; border-bottom: 1px solid rgba(216,255,51,.35);
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #0c1008, #101408);
}
.fs-chat__title { font-family: 'JetBrains Mono', ui-monospace, monospace; font-weight: 600; font-size: 14px; letter-spacing: .04em; color: #d8ff33; }
.fs-chat__sub { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11px; color: #9aa87f; margin-top: 2px; }
.fs-chat__close { background: none; border: none; color: #9aa87f; font-size: 18px; cursor: pointer; padding: 4px 8px; transition: color .15s ease; }
.fs-chat__close:hover { color: #d8ff33; }
.fs-chat__body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.fs-msg { max-width: 85%; padding: 9px 12px; border-radius: 12px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.fs-msg--agent { background: rgba(216,255,51,.07); border: 1px solid rgba(216,255,51,.30); color: #eaffd6; align-self: flex-start; border-bottom-left-radius: 4px; }
.fs-msg--client { background: rgba(216,255,51,.14); border: 1px solid rgba(216,255,51,.40); color: #f4ffe8; align-self: flex-end; border-bottom-right-radius: 4px; }
.fs-msg--sys { align-self: center; background: none; color: #8a9a6f; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11.5px; text-align: center; }
.fs-consent { padding: 16px; display: flex; flex-direction: column; gap: 10px; height: 100%; overflow-y: auto; }
.fs-consent h3 { margin: 0 0 4px; font-size: 15px; }
.fs-consent p { margin: 0; font-size: 12.5px; line-height: 1.55; color: #cfe0b0; }
.fs-consent a { color: #d8ff33; }
.fs-consent__legal { font-size: 11.5px; }
/* Actions pinned to the bottom of the consent screen so the agree button +
   checkbox are visible on a phone without scrolling past the policy text. */
.fs-consent__actions {
  margin-top: auto;
  display: flex; flex-direction: column; gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
  position: sticky; bottom: 0;
  background: linear-gradient(to bottom, rgba(14,18,32,0), #0e1220 18%);
}
.fs-consent__agree { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: #cfc9e2; cursor: pointer; }
.fs-consent__agree input { margin-top: 2px; accent-color: #7c5cff; }
.fs-consent__start { padding: 11px 16px; width: 100%; }
.fs-chat__foot { padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.08); display: flex; gap: 8px; }
.fs-chat__input {
  flex: 1; background: #161b2e; border: 1px solid rgba(255,255,255,.12); border-radius: 10px;
  color: #e8e6f0; padding: 10px 12px; font-size: 14px; font-family: inherit; resize: none; outline: none;
}
.fs-chat__input:focus { border-color: rgba(150,120,255,.5); }
.fs-chat__send {
  background: #d8ff33; border: 1px solid #d8ff33; border-radius: 10px; color: #0a0c0a; padding: 0 16px;
  font-size: 14px; font-weight: 700; cursor: pointer; font-family: 'JetBrains Mono', ui-monospace, monospace; letter-spacing: .02em; transition: filter .15s ease;
}
.fs-chat__send:hover { filter: brightness(1.08);
}
.fs-chat__send:disabled { opacity: .45; cursor: not-allowed; }
.fs-chat__count { font-size: 11px; color: #8a83a8; padding: 0 12px 6px; text-align: right; }
.fs-chat__presence {
  font-size: 11.5px; color: #d8b45a; background: rgba(216,180,90,.08);
  border-top: 1px solid rgba(216,180,90,.18); padding: 7px 12px; text-align: center;
}

/* ── Marketing nudge bubble + pointing hand ── */
.fs-nudge {
  position: fixed; z-index: 9997;
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  opacity: 0; transform: translateY(14px) scale(.92);
  pointer-events: none;
  transition: opacity .45s ease, transform .45s cubic-bezier(.34,1.56,.64,1);
  font-family: 'Inter', system-ui, sans-serif;
}
.fs-nudge--in { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; cursor: pointer; }
.fs-nudge__bubble { max-width: min(320px, calc(100vw - 56px)); }
.fs-nudge__text { display: block; }
.fs-nudge--gone { opacity: 0; transform: translateY(10px) scale(.9); pointer-events: none; }

/* pulsing halo behind the bubble */
.fs-nudge__glow {
  position: absolute; inset: -18px; border-radius: 26px; z-index: -1;
  background: radial-gradient(ellipse at 70% 60%, rgba(255,215,110,.55), rgba(155,123,255,.3) 55%, transparent 78%);
  filter: blur(14px);
  animation: fs-glow-pulse 2.2s ease-in-out infinite;
}
@keyframes fs-glow-pulse {
  0%, 100% { opacity: .6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.12); }
}

.fs-nudge__bubble {
  position: relative;
  background: linear-gradient(135deg, #241a08, #3a2a10);
  border: 1.5px solid rgba(255,215,110,.75);
  color: #ffd76e; font-size: 14px; font-weight: 700; line-height: 1.35;
  padding: 11px 32px 11px 15px; border-radius: 14px 14px 4px 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.55), 0 0 22px rgba(255,215,110,.35), 0 0 0 0 rgba(240,199,94,.5);
  max-width: 250px; overflow: hidden;
  animation: fs-nudge-bob 2.6s ease-in-out infinite, fs-bubble-ring 2.2s ease-out infinite;
}
/* sweeping shine across the bubble */
.fs-nudge__shine {
  position: absolute; top: 0; left: -60%; width: 45%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,.45), transparent);
  transform: skewX(-18deg);
  animation: fs-shine 2.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes fs-shine {
  0% { left: -60%; }
  55%, 100% { left: 135%; }
}
@keyframes fs-bubble-ring {
  0% { box-shadow: 0 12px 40px rgba(0,0,0,.55), 0 0 22px rgba(255,215,110,.35), 0 0 0 0 rgba(255,215,110,.6); }
  70%, 100% { box-shadow: 0 12px 40px rgba(0,0,0,.55), 0 0 22px rgba(255,215,110,.35), 0 0 0 20px rgba(255,215,110,0); }
}
/* floating sparkles around the text */
.fs-nudge__spark {
  position: absolute; font-size: 15px; pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(255,215,110,.9));
  animation: fs-spark-float 2.8s ease-in-out infinite;
}
.fs-nudge__spark--1 { top: 0px; right: 28px; animation-delay: 0s; }
.fs-nudge__spark--2 { bottom: 2px; left: 6px; animation-delay: .9s; font-size: 12px; }
.fs-nudge__spark--3 { top: 12px; left: 44%; animation-delay: 1.7s; font-size: 11px; }
@keyframes fs-spark-float {
  0%, 100% { opacity: 0; transform: translateY(5px) scale(.5) rotate(0deg); }
  40%, 60% { opacity: 1; transform: translateY(-4px) scale(1.25) rotate(20deg); }
}
.fs-nudge__close {
  position: absolute; top: 4px; right: 4px;
  background: none; border: none; color: #9a93b8; font-size: 13px;
  cursor: pointer; padding: 2px 6px; line-height: 1; z-index: 2;
  transition: color .15s ease, transform .15s ease;
}
.fs-nudge__close:hover { color: #fff; transform: rotate(90deg); }
.fs-nudge__hand {
  align-self: flex-end; margin-right: 2px; margin-top: 2px;
  transform-origin: 70% 20%;
  animation: fs-nudge-point 1.4s ease-in-out infinite;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.6)) drop-shadow(0 0 8px rgba(255,215,110,.5));
}
.fs-nudge--pulse .fs-nudge__bubble { animation: fs-nudge-bob 1.1s ease-in-out infinite, fs-bubble-ring 1.1s ease-out infinite; }
.fs-nudge--pulse .fs-nudge__hand { animation: fs-nudge-point .7s ease-in-out infinite; }
@keyframes fs-nudge-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
@keyframes fs-nudge-point {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(4px, 6px) rotate(8deg); }
}

/* expanding rings from the chat button */
.fs-nudge__rings {
  position: absolute; right: -22px; bottom: -36px; width: 58px; height: 58px;
  pointer-events: none;
}
.fs-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid rgba(255,215,110,.85);
  opacity: 0;
  animation: fs-ring-expand 2.4s ease-out infinite;
}
.fs-ring--2 { animation-delay: .8s; border-color: rgba(155,123,255,.8); }
.fs-ring--3 { animation-delay: 1.6s; border-color: rgba(255,215,110,.6); }
@keyframes fs-ring-expand {
  0% { transform: scale(.5); opacity: 1; }
  80% { opacity: 0; }
  100% { transform: scale(3); opacity: 0; }
}

/* confetti burst layer */
.fs-confetti-layer {
  position: fixed; inset: 0; z-index: 10000; pointer-events: none; overflow: hidden;
}
.fs-confetti {
  position: absolute; display: block; opacity: 0;
  animation: fs-confetti-fly 1.9s cubic-bezier(.16,.84,.44,1) forwards;
  animation-delay: var(--delay, 0s);
  box-shadow: 0 0 10px rgba(255,215,110,.8), 0 0 4px rgba(255,255,255,.6);
}
@keyframes fs-confetti-fly {
  0% { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(.3); }
}
@media (prefers-reduced-motion: reduce) {
  /* Drop only the HEAVY/decorative motion. Keep the widget looking alive:
     icon, panel, and gentle fades remain; confetti/hand-nudge/ring/typing-bounce go. */
  .fs-confetti, .fs-confetti-fly,
  .fs-nudge__hand, .fs-nudge__spark, .fs-ring {
    animation: none !important; display: none !important;
  }
  .fs-nudge, .fs-nudge__bubble, .fs-nudge__glow, .fs-nudge__shine {
    animation: none !important;
  }
  .fs-typing i { animation: none !important; opacity: .7; }
  /* keep subtle entrance fades (cheap) so messages/panel still appear smoothly */
  .fs-msg, .fs-consent, .fs-chat__foot {
    animation-duration: .12s !important;
  }
  /* panel: keep opacity fade, drop the springy transform */
  .fs-chat, .fs-chat.open { transition: opacity .2s ease !important; transform: none !important; }
  /* launcher: keep hover glow, drop the lift/scale */
  .fs-chat-btn { transition: box-shadow .18s ease !important; }
  .fs-chat-btn:hover { transform: none !important; }
}

/* ── agent typing indicator ── */
.fs-msg--typing { opacity: .92; }
.fs-typing { display: inline-flex; gap: 4px; align-items: center; vertical-align: middle; }
.fs-typing i { width: 6px; height: 6px; border-radius: 50%; background: #d4af37; display: inline-block; animation: fs-typing-blink 1.2s infinite ease-in-out; }
.fs-typing i:nth-child(2) { animation-delay: .2s; }
.fs-typing i:nth-child(3) { animation-delay: .4s; }
.fs-typing__label { color: #b9b0d6; font-size: 12px; margin-left: 2px; }
@keyframes fs-typing-blink { 0%,80%,100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* ── entrance animations (match futuresphinx) ── */
.fs-msg { animation: fs-msg-in .3s ease both; }
.fs-consent { animation: fs-fade-in .35s ease both; }
.fs-chat__foot { animation: fs-fade-in .3s ease both; }
@keyframes fs-msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fs-fade-in { from { opacity: 0; } to { opacity: 1; } }
/* === SVG icons (replace OS-dependent emoji; render identically on all systems) === */
.fs-chat-btn svg{display:block;width:26px;height:26px}
.fs-chat__send{display:flex;align-items:center;justify-content:center}
.fs-chat__send svg{width:18px;height:18px}
.fs-chat__close svg,.fs-nudge__close svg{display:block}
.fs-nudge__spark svg{display:block;width:14px;height:14px}
.fs-chat__presence svg,.fs-consent p svg{vertical-align:-2px}
