/* PM Media · Source Protocol — Lily talking guide for funnel.html
   Self-contained. Reuses PMLilySales brain (pm-lily-sales.js) + Web Speech voice.
   Obsidian Executive: dark glass, cyan→magenta neon, high-density. */

:root {
  --fnl-cyan: #00d4ee;
  --fnl-magenta: #e8328a;
  --fnl-gold: #f0c14b;
  --fnl-panel: rgba(10, 10, 18, 0.94);
  --fnl-line: rgba(255, 255, 255, 0.1);
  --fnl-grad: linear-gradient(135deg, #00c8e8 0%, #e8328a 100%);
}

/* Floating launcher orb */
.fnl-orb {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 120;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--fnl-grad);
  color: #04040a;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 38px rgba(232, 50, 138, 0.45), 0 0 0 0 rgba(0, 212, 238, 0.45);
  animation: fnl-pulse 2.8s ease-out infinite;
  transition: transform 0.2s ease;
}
.fnl-orb:hover { transform: scale(1.06); }
.fnl-orb svg { width: 30px; height: 30px; }
.fnl-orb.is-hidden { display: none; }

@keyframes fnl-pulse {
  0% { box-shadow: 0 12px 38px rgba(232, 50, 138, 0.45), 0 0 0 0 rgba(0, 212, 238, 0.5); }
  70% { box-shadow: 0 12px 38px rgba(232, 50, 138, 0.45), 0 0 0 22px rgba(0, 212, 238, 0); }
  100% { box-shadow: 0 12px 38px rgba(232, 50, 138, 0.45), 0 0 0 0 rgba(0, 212, 238, 0); }
}

/* Teaser bubble beside the orb */
.fnl-teaser {
  position: fixed;
  right: 96px;
  bottom: 34px;
  z-index: 120;
  max-width: 250px;
  background: var(--fnl-panel);
  color: #f4f4fa;
  border: 1px solid var(--fnl-line);
  border-radius: 14px 14px 4px 14px;
  padding: 12px 14px;
  font-size: 0.86rem;
  line-height: 1.4;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  cursor: pointer;
  animation: fnl-rise 0.4s ease both;
}
.fnl-teaser.is-hidden { display: none; }
.fnl-teaser b { color: var(--fnl-cyan); }
@keyframes fnl-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Chat panel */
.fnl-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 130;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  background: var(--fnl-panel);
  border: 1px solid var(--fnl-line);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 40px 110px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(18px);
  transform: translateY(16px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
}
.fnl-panel.is-open { opacity: 1; transform: none; pointer-events: auto; }

/* Header with avatar + speaking equalizer */
.fnl-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--fnl-line);
  background: linear-gradient(180deg, rgba(0, 212, 238, 0.08), transparent);
}
.fnl-avatar {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--fnl-grad);
  display: grid;
  place-items: center;
  color: #04040a;
  font-weight: 800;
  font-family: 'Syne', system-ui, sans-serif;
  flex-shrink: 0;
}
.fnl-avatar::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--fnl-cyan);
  opacity: 0;
}
.fnl-avatar.is-speaking::after { animation: fnl-ring 1s ease-out infinite; }
@keyframes fnl-ring { 0% { opacity: 0.6; transform: scale(1); } 100% { opacity: 0; transform: scale(1.35); } }

.fnl-head-txt { flex: 1; min-width: 0; }
.fnl-head-name { font-family: 'Syne', system-ui, sans-serif; font-weight: 700; font-size: 1rem; color: #fff; display: flex; align-items: center; gap: 8px; }
.fnl-eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; opacity: 0; transition: opacity 0.2s; }
.fnl-eq.is-on { opacity: 1; }
.fnl-eq span { width: 3px; background: var(--fnl-cyan); border-radius: 2px; height: 4px; animation: fnl-bounce 0.7s ease-in-out infinite; }
.fnl-eq span:nth-child(2) { animation-delay: 0.12s; background: var(--fnl-magenta); }
.fnl-eq span:nth-child(3) { animation-delay: 0.24s; }
.fnl-eq span:nth-child(4) { animation-delay: 0.36s; background: var(--fnl-magenta); }
@keyframes fnl-bounce { 0%, 100% { height: 4px; } 50% { height: 12px; } }
.fnl-head-sub { font-size: 0.72rem; color: rgba(244, 244, 250, 0.6); }

.fnl-head-btns { display: flex; gap: 4px; }
.fnl-icon-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--fnl-line);
  background: rgba(255, 255, 255, 0.04); color: #f4f4fa; cursor: pointer; font-size: 0.9rem;
  display: grid; place-items: center; transition: border-color 0.16s, background 0.16s;
}
.fnl-icon-btn:hover { border-color: var(--fnl-cyan); }
.fnl-icon-btn.is-muted { opacity: 0.55; }

/* Messages */
.fnl-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.fnl-log::-webkit-scrollbar { width: 6px; }
.fnl-log::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 3px; }
.fnl-msg { max-width: 86%; padding: 11px 14px; border-radius: 14px; font-size: 0.9rem; line-height: 1.5; }
.fnl-msg p { margin: 0 0 8px; }
.fnl-msg p:last-child { margin-bottom: 0; }
.fnl-msg.agent { align-self: flex-start; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--fnl-line); border-bottom-left-radius: 4px; }
.fnl-msg.user { align-self: flex-end; background: var(--fnl-grad); color: #04040a; font-weight: 500; border-bottom-right-radius: 4px; }
.fnl-msg em { color: var(--fnl-cyan); font-style: normal; opacity: 0.85; }
.fnl-msg a.chat-book-link {
  display: inline-block; margin-top: 4px; color: var(--fnl-cyan); font-weight: 700; text-decoration: none;
  border-bottom: 1px dashed var(--fnl-cyan);
}
.fnl-typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; }
.fnl-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--fnl-cyan); opacity: 0.5; animation: fnl-dot 1s infinite; }
.fnl-typing span:nth-child(2) { animation-delay: 0.2s; }
.fnl-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes fnl-dot { 0%, 100% { opacity: 0.3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

/* Quick chips */
.fnl-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 8px; }
.fnl-chip {
  font-size: 0.76rem; padding: 7px 12px; border-radius: 999px; cursor: pointer;
  background: rgba(0, 212, 238, 0.08); border: 1px solid rgba(0, 212, 238, 0.28); color: var(--fnl-cyan);
  transition: background 0.16s, transform 0.16s;
}
.fnl-chip:hover { background: rgba(0, 212, 238, 0.18); transform: translateY(-1px); }

/* Footer input */
.fnl-foot { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--fnl-line); }
.fnl-mic {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--fnl-line); flex-shrink: 0;
  background: rgba(255, 255, 255, 0.04); color: #f4f4fa; cursor: pointer; font-size: 1rem;
}
.fnl-mic.is-listening { border-color: var(--fnl-magenta); color: var(--fnl-magenta); animation: fnl-pulse-mic 1s infinite; }
@keyframes fnl-pulse-mic { 0%, 100% { box-shadow: 0 0 0 0 rgba(232, 50, 138, 0.4); } 50% { box-shadow: 0 0 0 6px rgba(232, 50, 138, 0); } }
.fnl-input {
  flex: 1; padding: 0 14px; border-radius: 12px; border: 1px solid var(--fnl-line);
  background: rgba(255, 255, 255, 0.03); color: #f4f4fa; font-family: inherit; font-size: 0.9rem;
}
.fnl-input:focus { outline: none; border-color: var(--fnl-cyan); }
.fnl-send {
  width: 44px; height: 40px; border-radius: 12px; border: none; cursor: pointer; flex-shrink: 0;
  background: var(--fnl-grad); color: #04040a; font-size: 1.1rem; font-weight: 700;
}
.fnl-send:active { transform: translateY(1px); }

@media (max-width: 480px) {
  .fnl-panel { width: calc(100vw - 20px); height: calc(100vh - 30px); right: 10px; bottom: 10px; }
  .fnl-teaser { right: 90px; max-width: 200px; }
}

@media (prefers-reduced-motion: reduce) {
  .fnl-orb, .fnl-avatar.is-speaking::after, .fnl-eq span, .fnl-typing span, .fnl-mic.is-listening { animation: none !important; }
}
