.mw-funnel { display: flex; flex-direction: column; align-items: center; gap: 20px; width: 100%; max-width: 480px; position: relative; z-index: 10; }
.mw-funnel-chips { display: grid; grid-template-columns: repeat(4, auto); gap: 8px; justify-content: center; }
.mw-funnel-chip { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10px; padding: 6px 10px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); white-space: nowrap; opacity: 0; animation: mwChipCycle 8s cubic-bezier(0.4, 0, 0.2, 1) infinite; }
.mw-funnel-chip:nth-child(1) { animation-delay: 0s; }
.mw-funnel-chip:nth-child(2) { animation-delay: 0.08s; }
.mw-funnel-chip:nth-child(3) { animation-delay: 0.16s; }
.mw-funnel-chip:nth-child(4) { animation-delay: 0.24s; }
.mw-funnel-chip:nth-child(5) { animation-delay: 0.32s; }
.mw-funnel-chip:nth-child(6) { animation-delay: 0.40s; }
.mw-funnel-chip:nth-child(7) { animation-delay: 0.48s; }
.mw-funnel-chip:nth-child(8) { animation-delay: 0.56s; }
@keyframes mwChipCycle {
  0%   { opacity: 0; transform: translateY(-16px) scale(0.9); }
  8%   { opacity: 1; transform: translateY(0) scale(1); }
  30%  { opacity: 1; transform: translateY(0) scale(1); background: var(--bg-2); }
  38%  { opacity: 1; transform: translateY(0) scale(1); background: linear-gradient(90deg, rgba(139,92,246,0.12), rgba(16,185,129,0.12)); color: var(--text); }
  48%  { opacity: 0; transform: translateY(8px) scale(0.85); }
  100% { opacity: 0; transform: translateY(8px) scale(0.85); }
}

.mw-funnel-svg { width: 200px; height: 100px; }
.mw-funnel-lines { stroke: var(--border); stroke-width: 1.5; fill: none; }
.mw-funnel-lines-active { stroke: url(#mwFunnelGrad); stroke-width: 2; fill: none; stroke-dasharray: 200; stroke-dashoffset: 200; animation: mwFunnelDraw 8s cubic-bezier(0.4, 0, 0.2, 1) infinite; }
@keyframes mwFunnelDraw {
  0%, 40%   { stroke-dashoffset: 200; }
  55%       { stroke-dashoffset: 0; }
  75%       { stroke-dashoffset: 0; }
  90%, 100% { stroke-dashoffset: -200; }
}

.mw-funnel-particle { animation: mwParticleFlow 1.6s ease-in infinite; opacity: 0; }
.mw-funnel-particle:nth-child(3) { animation-delay: 3.6s; }
.mw-funnel-particle:nth-child(4) { animation-delay: 3.9s; }
.mw-funnel-particle:nth-child(5) { animation-delay: 4.2s; }
.mw-funnel-particle:nth-child(6) { animation-delay: 4.5s; }
.mw-funnel-particle:nth-child(7) { animation-delay: 4.8s; }
@keyframes mwParticleFlow {
  0%   { opacity: 0; transform: translateY(0); }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(85px); }
}

.mw-funnel-match {
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 20px; width: 400px; max-width: 100%; position: absolute; overflow: hidden;
  opacity: 0; transform: scale(0.9);
}
/* Drei Karten rotieren im 24s-Cycle (jede 8s aktiv) */
.mw-funnel-match.card-1 { animation: mwMatchAppearMulti 24s cubic-bezier(0.4, 0, 0.2, 1) infinite; animation-delay: 0s; }
.mw-funnel-match.card-2 { animation: mwMatchAppearMulti 24s cubic-bezier(0.4, 0, 0.2, 1) infinite; animation-delay: 8s; }
.mw-funnel-match.card-3 { animation: mwMatchAppearMulti 24s cubic-bezier(0.4, 0, 0.2, 1) infinite; animation-delay: 16s; }
@keyframes mwMatchAppearMulti {
  0%, 18%    { opacity: 0; transform: scale(0.9) translateY(10px); }
  22%        { opacity: 1; transform: scale(1) translateY(0); }
  30%        { opacity: 1; transform: scale(1) translateY(0); }
  33%, 100%  { opacity: 0; transform: scale(0.95) translateY(4px); }
}
.mw-funnel-match::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), var(--accent), transparent);
  opacity: 0; animation: mwHairlineGlow 8s ease-in-out infinite;
}
@keyframes mwHairlineGlow {
  0%, 60%   { opacity: 0; }
  70%, 88%  { opacity: 0.8; }
  95%, 100% { opacity: 0; }
}
.mw-funnel-match::after {
  content: ''; position: absolute; inset: -4px; border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  opacity: 0; z-index: -1; filter: blur(20px); animation: mwMatchGlow 8s ease-in-out infinite;
}
@keyframes mwMatchGlow {
  0%, 60%   { opacity: 0; }
  70%       { opacity: 0.25; }
  80%       { opacity: 0.15; }
  88%       { opacity: 0.25; }
  95%, 100% { opacity: 0; }
}

.mw-funnel-match-badge {
  position: absolute; top: 12px; right: 12px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 9px; color: var(--accent); font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 8px; background: var(--accent-bg); border-radius: 4px;
}
.mw-funnel-match-company {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em;
}
.mw-funnel-match-name { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.3; margin-top: 4px; }
.mw-funnel-match-meta { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11px; color: var(--text-2); display: flex; gap: 4px; align-items: center; margin-top: 6px; }
.mw-funnel-match-meta-sep { color: var(--text-3); opacity: 0.5; }
.mw-funnel-match-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.mw-funnel-match-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 500; font-family: 'Inter', ui-sans-serif, system-ui, sans-serif; }
.mw-funnel-match-pill.pill-green { background: var(--accent-bg); color: var(--accent); }
.mw-funnel-match-pill.pill-closed { background: var(--closed-bg, rgba(239,68,68,0.1)); color: var(--closed, #ef4444); }
.mw-funnel-match-pill-dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.mw-funnel-match-gehalt { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; font-weight:400; color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  .mw-funnel-chip, .mw-funnel-lines-active, .mw-funnel-particle,
  .mw-funnel-match, .mw-funnel-match::before, .mw-funnel-match::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    animation-fill-mode: forwards !important;
  }
  .mw-funnel-chip { opacity: 1; }
  .mw-funnel-match { opacity: 1; transform: scale(1); }
}
#ti-im-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.04);
  z-index: 999;
  overflow: hidden;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.4s cubic-bezier(0.16,1,0.3,1), transform 0.4s cubic-bezier(0.16,1,0.3,1);
}
#ti-im-toast[hidden] { display: none !important; }
#ti-im-toast.ti-im-visible { opacity: 1; transform: translateX(0); }
#ti-im-toast::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), var(--accent), transparent);
  opacity: 0.7;
  z-index: 5;
  pointer-events: none;
}
.ti-im-toast-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
  background: rgba(255,255,255,0.7);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: none;
  color: var(--text-2);
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  transition: color 0.15s, background 0.15s;
}
html[data-theme="dark"] .ti-im-toast-close { background: rgba(0,0,0,0.4); }
.ti-im-toast-close:hover { color: var(--text); background: rgba(255,255,255,0.9); }
html[data-theme="dark"] .ti-im-toast-close:hover { background: rgba(0,0,0,0.6); }

.ti-im-animation {
  position: relative;
  padding: 44px 18px 20px;   /* Padding-Top 44px: Chips genug Abstand zum close-Button */
  background: linear-gradient(135deg, rgba(139,92,246,0.03), rgba(16,185,129,0.03));
  height: 260px;             /* etwas höher für stack + zusätzlicher padding-top */
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Wrapper für die 3 rotierenden Match-Cards */
.mw-funnel-match-stack {
  position: relative;
  width: 100%;
  height: 90px;             /* Reserviert Platz für eine Card */
  display: flex;
  align-items: center;
  justify-content: center;
}

.ti-im-content {
  padding: 18px 22px 20px;
  border-top: 1px solid var(--border);
  opacity: 0;
  transform: translateY(8px);
}
#ti-im-toast.ti-im-visible .ti-im-content {
  animation: ti-im-content-in 0.6s cubic-bezier(0.16,1,0.3,1) 2.2s forwards;
}
@keyframes ti-im-content-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ti-im-content-eyebrow {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 9px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 6px; display: inline-block;
}
.ti-im-content-title {
  font-family: 'Source Serif 4', ui-serif, Georgia, serif;
  font-size: 17px; font-weight: 500; color: var(--text);
  margin: 0 0 6px; line-height: 1.3;
}
.ti-im-content-text {
  font-size: 13px; color: var(--text-2); line-height: 1.5;
  margin: 0 0 14px;
}
.ti-im-content-cta {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; background:var(--cta); color:var(--cta-fg);
  border-radius: 8px; font-size: 13px; font-weight: 500;
  text-decoration: none; transition: transform 0.15s;
}
.ti-im-content-cta:hover { transform: translateY(-1px); }
.ti-im-content-arrow {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.ti-im-content-cta:hover .ti-im-content-arrow { transform: translateX(3px); }

/* Funnel-Animation kompakter im Popup (Desktop) */
#ti-im-toast .mw-funnel { max-width: 320px; gap: 12px; }
#ti-im-toast .mw-funnel-chips { gap: 5px; grid-template-columns: repeat(4, 1fr); }
#ti-im-toast .mw-funnel-chip { font-size: 8px; padding: 3px 7px; text-align: center; justify-content: center; }
#ti-im-toast .mw-funnel-svg { width: 140px; height: 68px; }
#ti-im-toast .mw-funnel-match { padding: 10px 14px; width: 260px; border-radius: 10px; }
#ti-im-toast .mw-funnel-match-badge { font-size: 8px; padding: 2px 6px; top: 8px; right: 8px; }
#ti-im-toast .mw-funnel-match-company { font-size: 9px; }
#ti-im-toast .mw-funnel-match-name { font-size: 12px; margin-top: 2px; }
#ti-im-toast .mw-funnel-match-meta { font-size: 10px; margin-top: 4px; }
#ti-im-toast .mw-funnel-match-gehalt { font-size: 11px; }
#ti-im-toast .mw-funnel-match-pill { font-size: 10px; padding: 2px 6px; }
#ti-im-toast .mw-funnel-match-bottom { margin-top: 6px; }
/* Pills FLAT im Popup: kein Background, kein Padding, kein Border — nur Dot bekommt Farbe */
#ti-im-toast .mw-funnel-match-pill,
#ti-im-toast .mw-funnel-match-pill.pill-green,
#ti-im-toast .mw-funnel-match-pill.pill-closed {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  color: var(--text-2) !important;
  font-size: 10px !important;
  gap: 5px !important;
}
#ti-im-toast .mw-funnel-match-pill.pill-green .mw-funnel-match-pill-dot {
  background: var(--accent, #10b981) !important;
}
#ti-im-toast .mw-funnel-match-pill.pill-closed .mw-funnel-match-pill-dot {
  background: var(--closed, #ef4444) !important;
}
#ti-im-toast .mw-funnel-match-pill-dot {
  width: 6px !important; height: 6px !important;
  border-radius: 999px !important;
  animation: none !important;
  flex-shrink: 0;
  display: inline-block;
}
/* Glow/Hairline-Effects im Popup deaktivieren (würden mit 24s-Rotation out-of-sync laufen) */
#ti-im-toast .mw-funnel-match::before,
#ti-im-toast .mw-funnel-match::after { display: none !important; }

/* ─── MOBILE ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  #ti-im-toast {
    bottom: 76px;   /* über Mobile-Bottom-Nav */
    right: 12px;
    left: 12px;
    width: auto;
    transform: translateY(20px);
  }
  #ti-im-toast.ti-im-visible { transform: translateY(0); }
  .ti-im-animation { padding: 44px 12px 16px; height: 220px; }  /* Padding-Top 44px + höher damit Stack Platz hat */
  .ti-im-content { padding: 16px 18px 16px; text-align: center; align-items: center; }
  .ti-im-content-eyebrow { align-self: center; }
  .ti-im-content-title { font-size: 16px; }
  .ti-im-content-text { text-align: center; }
  .ti-im-content-cta { align-self: center; margin-left: auto; margin-right: auto; }
  #ti-im-toast .mw-funnel { max-width: 300px; gap: 10px; }
  #ti-im-toast .mw-funnel-chips { gap: 4px; }
  #ti-im-toast .mw-funnel-chip { font-size: 8px; padding: 3px 6px; }
  #ti-im-toast .mw-funnel-svg { width: 130px; height: 60px; }
  #ti-im-toast .mw-funnel-match-stack { height: 78px; }
  #ti-im-toast .mw-funnel-match { padding: 10px 12px; width: 240px; }
  #ti-im-toast .mw-funnel-match-name { font-size: 11px; }
  #ti-im-toast .mw-funnel-match-meta { font-size: 9px; }
  #ti-im-toast .mw-funnel-match-gehalt { font-size: 10px; }
  /* Animation-Speed 25% schneller auf Mobile (8s→6s / 24s→18s) — snappier UX */
  #ti-im-toast .mw-funnel-chip { animation-duration: 6s !important; }
  #ti-im-toast .mw-funnel-lines-active { animation-duration: 6s !important; }
  #ti-im-toast .mw-funnel-match.card-1 { animation-duration: 18s !important; animation-delay: 0s !important; }
  #ti-im-toast .mw-funnel-match.card-2 { animation-duration: 18s !important; animation-delay: 6s !important; }
  #ti-im-toast .mw-funnel-match.card-3 { animation-duration: 18s !important; animation-delay: 12s !important; }
}