  .madlib-dd {
    position: relative;
    display: inline-flex;
    vertical-align: baseline;
    margin: 0 0.12em;
    z-index: 1;
  }
  .madlib-dd.is-open {
    z-index: 80;
  }
  /* Keep the madlib line above the CTA / helper copy while a menu is open */
  .madlib-line {
    position: relative;
    z-index: 20;
  }
  .madlib-line:has(.madlib-dd.is-open) {
    z-index: 40;
  }
  .madlib-cta {
    position: relative;
    z-index: 1;
  }
  /* Flow-inspired madlib trigger — expanding brand fill + radius morph */
  .madlib-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    overflow: hidden;
    isolation: isolate;
    font-family: "Albert Sans", system-ui, sans-serif;
    font-weight: 600;
    font-size: 0.7em;
    line-height: 1.2;
    color: #582D82;
    background: rgba(255, 255, 255, 0.72);
    border: 1.5px solid rgba(88, 45, 130, 0.4);
    border-radius: 100px;
    padding: 0.55em 1.05em 0.55em 1.15em;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 1px 2px rgba(63, 31, 92, 0.05), 0 6px 18px rgba(88, 45, 130, 0.1);
    transition:
      border-color 0.55s cubic-bezier(0.23, 1, 0.32, 1),
      border-radius 0.55s cubic-bezier(0.23, 1, 0.32, 1),
      color 0.55s cubic-bezier(0.23, 1, 0.32, 1),
      background-color 0.55s cubic-bezier(0.23, 1, 0.32, 1),
      box-shadow 0.55s cubic-bezier(0.23, 1, 0.32, 1),
      transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  .madlib-trigger-label {
    position: relative;
    z-index: 1;
    transition: transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  .madlib-trigger-fill {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 0;
    width: 0.85em;
    height: 0.85em;
    border-radius: 50%;
    background: #582D82;
    opacity: 0;
    transform: translate(-50%, -50%);
    pointer-events: none;
    transition:
      width 0.7s cubic-bezier(0.19, 1, 0.22, 1),
      height 0.7s cubic-bezier(0.19, 1, 0.22, 1),
      opacity 0.45s cubic-bezier(0.19, 1, 0.22, 1);
  }
  .madlib-trigger:hover,
  .madlib-dd.is-open .madlib-trigger {
    color: #ffffff;
    border-color: transparent;
    border-radius: 10px;
    /* Solid brand fallback once fill settles / when cursor leaves into the panel */
    background: #582D82;
    box-shadow: 0 2px 8px rgba(88, 45, 130, 0.22), 0 10px 24px rgba(63, 31, 92, 0.14);
  }
  .madlib-trigger:hover .madlib-trigger-fill,
  .madlib-dd.is-open .madlib-trigger-fill {
    width: 260%;
    height: 260%;
    min-width: 14em;
    min-height: 14em;
    opacity: 1;
    background: #3F1F5C;
  }
  .madlib-trigger:hover .madlib-trigger-label,
  .madlib-dd.is-open .madlib-trigger-label {
    transform: translateX(0.12em);
  }
  .madlib-trigger:active {
    transform: scale(0.97);
  }
  .madlib-trigger:focus-visible {
    outline: 3px solid #582D82;
    outline-offset: 2px;
  }
  .madlib-chevron {
    position: relative;
    z-index: 1;
    width: 0.95em;
    height: 0.95em;
    flex-shrink: 0;
    transition: transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  .madlib-trigger:hover .madlib-chevron {
    transform: translateY(0.08em);
  }
  .madlib-dd.is-open .madlib-chevron {
    transform: rotate(180deg);
  }
  .madlib-dd.is-open .madlib-trigger:hover .madlib-chevron {
    transform: rotate(180deg);
  }
  .madlib-panel {
    position: absolute;
    top: calc(100% + 0.45rem);
    left: 0;
    z-index: 60;
    min-width: max(100%, 14rem);
    width: max-content;
    max-width: min(20rem, calc(100vw - 2rem));
    padding: 0.4rem;
    border-radius: 0.85rem;
    border: 1px solid rgba(88, 45, 130, 0.18);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow:
      0 0 24px rgba(88, 45, 130, 0.16),
      0 12px 28px rgba(35, 31, 32, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px) scale(0.95);
    filter: blur(10px);
    transition:
      opacity 0.35s cubic-bezier(0.32, 0.72, 0, 1),
      transform 0.45s cubic-bezier(0.32, 0.72, 0, 1),
      filter 0.45s cubic-bezier(0.32, 0.72, 0, 1),
      visibility 0.35s;
  }
  .madlib-dd.is-open .madlib-panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    filter: none;
  }
  .madlib-option {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    text-align: left;
    padding: 0.7rem 0.85rem;
    border: none;
    border-radius: 0.65rem;
    background: transparent;
    color: #582D82;
    font-family: "Albert Sans", system-ui, sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.3;
    cursor: pointer;
    opacity: 0;
    transform: translateX(10px) scale(0.95);
    filter: blur(8px);
    transition:
      background-color 0.3s cubic-bezier(0.32, 0.72, 0, 1),
      transform 0.2s cubic-bezier(0.32, 0.72, 0, 1),
      opacity 0.35s cubic-bezier(0.32, 0.72, 0, 1),
      filter 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  }
  .madlib-dd.is-open .madlib-option {
    opacity: 1;
    transform: translateX(0) scale(1);
    filter: none;
  }
  .madlib-dd.is-open .madlib-option:nth-child(1) { transition-delay: 0.05s; }
  .madlib-dd.is-open .madlib-option:nth-child(2) { transition-delay: 0.12s; }
  .madlib-dd.is-open .madlib-option:nth-child(3) { transition-delay: 0.19s; }
  .madlib-dd.is-open .madlib-option:nth-child(4) { transition-delay: 0.26s; }
  .madlib-option:hover,
  .madlib-option:focus-visible,
  .madlib-option[aria-selected="true"] {
    background: rgba(88, 45, 130, 0.08);
  }
  .madlib-option:focus-visible {
    outline: 2px solid #582D82;
    outline-offset: 1px;
  }
  .madlib-option:active {
    transform: scale(0.97);
  }
  .madlib-option-icon {
    width: 1.05rem;
    height: 1.05rem;
    flex-shrink: 0;
    color: rgba(88, 45, 130, 0.7);
  }
  @media (prefers-reduced-motion: reduce) {
    .madlib-panel,
    .madlib-option,
    .madlib-chevron,
    .madlib-trigger,
    .madlib-trigger-label,
    .madlib-trigger-fill {
      transition: none !important;
      filter: none !important;
    }
    .madlib-trigger:hover .madlib-trigger-fill,
    .madlib-dd.is-open .madlib-trigger-fill {
      width: 100%;
      height: 100%;
      min-width: 0;
      min-height: 0;
      border-radius: inherit;
    }
    .madlib-trigger:hover .madlib-trigger-label,
    .madlib-dd.is-open .madlib-trigger-label,
    .madlib-trigger:active {
      transform: none;
    }
    .madlib-dd.is-open .madlib-option {
      opacity: 1;
      transform: none;
    }
  }
