<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>MultiSearch Tag Explorer</title>
  <style>
    *, *::before, *::after { box-sizing: border-box; }
    body {
      font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
      margin: 0; 
      padding: 4rem 2rem;
      background: #fbfbfd;
      color: #1d1d1f;
      min-height: 100vh;
      display: flex; 
      flex-direction: column; 
      align-items: center;
      -webkit-font-smoothing: antialiased;
      text-rendering: optimizeLegibility;
    }
    h1 {
      font-size: 2.5rem;
      font-weight: 700;
      margin-bottom: 1.5rem;
      letter-spacing: -0.015em;
      color: #1d1d1f;
      text-align: center;
      line-height: 1.1;
    }
    form#searchForm {
      display: flex;
      max-width: 520px;
      width: 100%;
      margin: 1rem auto 3rem auto;
      background: #f5f5f7;
      border: 1px solid transparent;
      border-radius: 12px;
      overflow: hidden;
      transition: all 0.2s ease;
    }
    form#searchForm:focus-within {
      background: #ffffff;
      border-color: #0071e3;
      box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
    }
    #searchBox {
      flex-grow: 1;
      padding: 1rem 1.25rem;
      font-size: 1.05rem;
      border: none;
      outline: none;
      background: transparent;
      color: #1d1d1f;
    }
    #searchBox::placeholder {
      color: #86868b;
    }
    button[type="submit"] {
      background: transparent;
      border: none;
      color: #0071e3;
      font-weight: 600;
      font-size: 1rem;
      padding: 0 1.5rem;
      cursor: pointer;
      transition: opacity 0.2s ease;
    }
    button[type="submit"]:hover {
      opacity: 0.7;
    }
    #searchResults {
      max-width: 520px;
      width: 100%;
    }
    #searchResults a.result-title {
      font-weight: 600;
      font-size: 1.25rem;
      color: #0066cc !important;
      text-decoration: none !important;
      transition: color 0.15s ease;
    }
    #searchResults a.result-title:hover {
      color: #0044bb !important;
      text-decoration: underline !important;
    }
    #searchResults div.result-item {
      margin-bottom: 2rem;
      background: #ffffff;
      border: 1px solid #e3e3e8;
      padding: 1.5rem;
      border-radius: 16px;
      transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }
    #searchResults div.result-item:hover {
      border-color: #d2d2d7;
      box-shadow: 0 4px 18px rgba(0, 0, 0, 0.03);
    }
    #searchResults p.description {
      margin: 0.6rem 0 1rem 0;
      color: #515154;
      font-size: 0.95rem;
      line-height: 1.5;
    }
    .future-search-container {
      display: flex !important;
      flex-wrap: wrap !important;
      gap: 12px 20px;
      justify-content: flex-start !important;
      width: 100% !important;
      margin-top: 10px;
      margin-bottom: 14px;
    }
    .future-link {
      position: relative;
      display: inline-flex !important;
      align-items: center;
      flex-shrink: 0 !important;
      font-size: 0.75rem;
      font-weight: 600;
      text-decoration: none;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: #86868b;
      font-family: -apple-system, BlinkMacSystemFont, sans-serif;
      transition: color 0.15s ease;
    }
    .future-link::after {
      content: '';
      position: absolute;
      bottom: -2px; left: 0;
      width: 0; height: 2px;
      border-radius: 2px;
      transition: width 0.15s ease;
    }
    .future-link:hover::after {
      width: 100%;
    }
    .future-link.wp:hover { color: #1d1d1f; }
    .future-link.wp::after { background: #1d1d1f; }
    .future-link.gg:hover { color: #1a73e8; }
    .future-link.gg::after { background: #1a73e8; }
    .future-link.yh:hover { color: #7b1fa2; }
    .future-link.yh::after { background: #7b1fa2; }
    .future-link.bg:hover { color: #008374; }
    .future-link.bg::after { background: #008374; }
    .future-link.yd:hover { color: #e53935; }
    .future-link.yd::after { background: #e53935; }
    .future-link.bd:hover { color: #0c4dd3; }
    .future-link.bd::after { background: #0c4dd3; }
    .future-link.dd:hover { color: #e05300; }
    .future-link.dd::after { background: #e05300; }
    .future-link:active { opacity: 0.6; }
    #searchResults div.tags {
      display: flex;
      flex-wrap: wrap;
      gap: 0.5rem;
    }
    #searchResults div.tags a {
      background: #f0f2f5;
      color: #050505;
      padding: 0.3rem 0.8rem;
      font-size: 0.82rem;
      font-weight: 500;
      border-radius: 8px;
      text-decoration: none;
      white-space: nowrap;
      transition: background-color 0.15s ease;
    }
    #searchResults div.tags a:hover {
      background: #e4e6eb;
    }
    @media (max-width: 480px) {
      body { padding: 2rem 1rem; }
      h1 { font-size: 2rem; }
      form#searchForm, #searchResults { max-width: 100%; }
      #searchResults div.result-item { padding: 1.25rem; border-radius: 12px; margin-bottom: 1.2rem; }
    }
  </style>
</head>
<body>
  <h1>MultiSearch Tag Explorer</h1>
  <form id="searchForm" role="search" aria-label="Wikipedia search form">
    <input
      id="searchBox"
      type="search"
      name="q"
      placeholder="Search…"
      aria-label="Search Wikipedia"
      autocomplete="off"
      spellcheck="false"
      required
    />
    <button type="submit" aria-label="Submit search">Go</button>
  </form>
  <div id="searchResults" role="region" aria-live="polite" aria-atomic="true"></div>
  <script>
    const searchForm = document.getElementById('searchForm');
    const searchBox = document.getElementById('searchBox');
    const resultsDiv = document.getElementById('searchResults');
    const language = 'en';
    const defaultFallback = 'Technology';
    function decodeHTML(html) {
      const txt = document.createElement('textarea');
      txt.innerHTML = html;
      return txt.value;
    }
    function escapeHTML(str) {
      return str
        .replace(/&/g, '&amp;')
        .replace(/</g, '&lt;')
        .replace(/>/g, '&gt;')
        .replace(/"/g, '&quot;')
        .replace(/'/g, '&#039;');
    }
    function extractTags(title) {
      const parts = title.split(/[^0-9\p{L}]+/u);
      return parts.filter(w => w.length > 1);
    }
    async function getLiveStartingTag() {
      const url = `https://${language}.wikipedia.org/w/api.php?action=query&list=recentchanges&rcnamespace=0&rclimit=5&rcprop=title|timestamp&rctype=edit&format=json&origin=*`;
      try {
        const res = await fetch(url);
        if (!res.ok) throw new Error();
        const data = await res.json();
        const changes = data.query?.recentchanges || [];
        for (let change of changes) {
          const fullTitle = decodeHTML(change.title).trim();
          if (fullTitle.length > 0 && !fullTitle.includes(':')) {
            return fullTitle; 
          }
        }
        return defaultFallback;
      } catch (e) {
        console.error("");
        return defaultFallback;
      }
    }
    function updateURLQuery(query) {
      const newUrl = new URL(window.location);
      if (query) {
        newUrl.searchParams.set('q', query);
      } else {
        newUrl.searchParams.delete('q');
      }
      history.pushState(null, '', newUrl);
    }
    function updateTitle(query) {
      if (query) {
        document.title = `${query}`;
      } else {
        document.title = '';
      }
    }
    async function performSearch(query) {
      updateTitle(query);
      resultsDiv.textContent = '';
      window.scrollTo({ top: 0, behavior: 'smooth' });
      const apiUrl = `https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=${encodeURIComponent(query)}&format=json&origin=*`;
      try {
        const res = await fetch(apiUrl);
        if (!res.ok) throw new Error('Network error');
        const data = await res.json();
        if (!data.query || data.query.search.length === 0) {
          if (query.toLowerCase() !== defaultFallback.toLowerCase()) {
            console.warn(`"${query}" "${defaultFallback}"...`);
            searchBox.value = defaultFallback;
            updateURLQuery(defaultFallback);
            performSearch(defaultFallback);
          } else {
            resultsDiv.textContent = '';
          }
          return;
        }
        resultsDiv.innerHTML = data.query.search
          .map(item => {
            const cleanTitle = decodeHTML(item.title);
            const rawSnippet = item.snippet.replace(/<\/?span[^>]*>/g, '');
            const cleanSnippet = decodeHTML(rawSnippet);
            const tags = extractTags(cleanTitle);
            const safeTitle = escapeHTML(cleanTitle);
            const safeSnippet = escapeHTML(cleanSnippet);
            const tagsHtml = tags.map(tag => {
              const encodedTag = encodeURIComponent(tag);
              return `<a href="?q=${encodedTag}" class="tag-link" aria-label="Search for tag ${tag}">${escapeHTML(tag)}</a>`;
            }).join(' ');
            const secondaryEngines = [
              { id: 'gg', name: 'Google', url: `https://www.google.com/search?q=${encodeURIComponent(cleanTitle)}` },
              { id: 'yh', name: 'Yahoo', url: `https://search.yahoo.com/search?p=${encodeURIComponent(cleanTitle)}` },
              { id: 'bg', name: 'Bing', url: `https://www.bing.com/search?q=${encodeURIComponent(cleanTitle)}` },
              { id: 'yd', name: 'Yandex', url: `https://yandex.com/search/?text=${encodeURIComponent(cleanTitle)}` },
              { id: 'bd', name: 'Baidu', url: `https://www.baidu.com/s?wd=${encodeURIComponent(cleanTitle)}` },
              { id: 'dd', name: 'DuckGo', url: `https://duckduckgo.com/?q=${encodeURIComponent(cleanTitle)}` }
            ];
            const shuffled = secondaryEngines.sort(() => 0.5 - Math.random());
            const randomThree = shuffled.slice(0, 3);
            const dynamicEnginesHtml = randomThree.map(engine => {
              return `<a href="${engine.url}" target="_blank" class="future-link ${engine.id}">${engine.name}</a>`;
            }).join('');
  const aiPromptsList = [
  `Provide a comprehensive, multi-dimensional analysis of "${cleanTitle}". Please cover the following aspects in detail: 1) Core definition, historical background, and origin. 2) Social impact, public perception, and contemporary relevance. 3) Cultural significance, presence in art, media, or literature, and global footprint. 4) A curated summary of notable multimedia representations available online (including key imagery, landmark video documentation, and essential web resources). Deliver a highly structured, objective, and deeply informative response suitable for advanced educational research. This prompt was created by the free aéPiot application - https://aepiot.com/`,
  `Act as an expert academic researcher and provide an in-depth breakdown of "${cleanTitle}". Please analyze: 1) Major chronological milestones, 2) Key debates, controversies, or conflicting perspectives surrounding it, 3) Its long-term future outlook and technological/social implications. Ensure a highly analytical tone. This prompt was created by the free aéPiot application - https://aepiot.com/`,
  `Create an executive summary and a detailed conceptual guide about "${cleanTitle}". Walk through: 1) A clear, jargon-free explanation for beginners, 2) Core technical or theoretical principles, 3) Real-world use cases and practical applications happening right now. This prompt was created by the free aéPiot application - https://aepiot.com/`,
  `Conduct a rigorous epistemological and ethical evaluation of "${cleanTitle}". Analyze it through the competing frameworks of utilitarianism, deontological ethics, and virtue ethics. Discuss any inherent paradoxes it presents to modern existential thought and its implications for human agency in the 21st century. This prompt was created by the free aéPiot application - https://aepiot.com/`,
  `Provide a comprehensive socio-historical analysis of "${cleanTitle}". Identify the precise historical catalysts, geopolitical shifts, and paradigm changes that led to its emergence. Examine how its historical narrative has been revisioned or reinterpreted across different cultures over time. This prompt was created by the free aéPiot application - https://aepiot.com/`,
  `Deconstruct "${cleanTitle}" from a strictly theoretical and scientific perspective. Detail its foundational mathematical, physical, or computational axioms. Explain the underlying mechanics, current experimental limitations, and the primary theoretical anomalies currently being debated in peer-reviewed literature. This prompt was created by the free aéPiot application - https://aepiot.com/`,
  `Analyze "${cleanTitle}" through the lens of macroeconomics and behavioral economics. Evaluate its impact on global market structures, resource allocation, and supply chain dynamics. Detail the economic externalities (both positive and negative) it generates and its role in shaping future fiscal policies. This prompt was created by the free aéPiot application - https://aepiot.com/`,
  `Investigate the sociological dimensions and cultural footprint of "${cleanTitle}". How does it influence collective behavior, social stratification, and institutional power dynamics? Analyze its representation in contemporary media and its role in reshaping identity politics or global subcultures. This prompt was created by the free aéPiot application - https://aepiot.com/`,
  `Perform an anthropological and semiotic deconstruction of "${cleanTitle}". Map the core symbols, rituals, or foundational myths associated with it across distinct geographical regions. Explain how it reflects fundamental human anxieties, desires, or evolutionary adaptations. This prompt was created by the free aéPiot application - https://aepiot.com/`,
  `Examine "${cleanTitle}" from the perspective of cognitive psychology and neuroscience. Analyze how it interacts with human perception, memory formation, heuristics, and bias. Discuss its implications for psychological well-being, neuroplasticity, or collective mental models. This prompt was created by the free aéPiot application - https://aepiot.com/`,
  `Evaluate the technological architecture and long-term evolutionary trajectory of "${cleanTitle}". Discuss its convergence with artificial intelligence, quantum computing, or biotechnology. Map out a plausible 50-year future roadmap, outlining the systemic risks and existential safeguards required. This prompt was created by the free aéPiot application - https://aepiot.com/`,
  `Conduct a hermeneutic and literary critique of "${cleanTitle}". Trace its thematic development, structural metaphors, and allegorical presence in world literature and advanced narrative theory. Analyze how it challenges traditional storytelling frameworks or semiotic systems. This prompt was created by the free aéPiot application - https://aepiot.com/`,
  `Analyze the legal, regulatory, and geopolitical dimensions of "${cleanTitle}". Examine the challenges it poses to international law, national sovereignty, and global governance frameworks. Suggest a comprehensive, multidisciplinary policy framework designed to mitigate its institutional risks. This prompt was created by the free aéPiot application - https://aepiot.com/`,
  `Provide a critical environmental and ecological assessment of "${cleanTitle}". Analyze its relationship with biosphere integrity, climate dynamics, and the Anthropocene epoch. Evaluate it through the principles of industrial ecology, resource circularity, and long-term sustainability metrics. This prompt was created by the free aéPiot application - https://aepiot.com/`,
  `Deconstruct the aesthetic theory and formal design principles underlying "${cleanTitle}". Analyze it through historical and contemporary artistic movements (e.g., modernism, postmodernism, avant-garde). Explain how it redefines the relationship between form, function, and human sensory experience. This prompt was created by the free aéPiot application - https://aepiot.com/`
  ];
  const randomPrompt = aiPromptsList[Math.floor(Math.random() * aiPromptsList.length)];
  const encodedPrompt = encodeURIComponent(randomPrompt);
            const braveUrl = `https://search.brave.com/ask?q=${encodedPrompt}`;
            const perplexityUrl = `https://www.perplexity.ai/search/new?q=${encodedPrompt}`;
            const chatgptUrl = `https://chatgpt.com/?prompt=${encodedPrompt}`;
            const baiduUrl = `https://chat.baidu.com/search?word=${encodedPrompt}`;
            return `<div class="result-item">
              <a href="?q=${encodeURIComponent(cleanTitle)}" class="tag-link result-title" style="font-size: 1.25rem; font-weight: 600; text-decoration: none;">${safeTitle}</a>
              <div class="search-engines-wrapper">
                <style>
                  .future-search-container, .ai-links-container {
                    display: flex !important;
                    flex-wrap: wrap !important;
                    gap: 12px 18px;
                    justify-content: flex-start !important;
                    width: 100% !important;
                    margin-top: 10px;
                    margin-bottom: 14px;
                  }
                  .future-link {
                    position: relative;
                    display: inline-flex !important;
                    align-items: center;
                    flex-shrink: 0 !important;
                    font-size: 0.72rem;
                    font-weight: 600;
                    text-decoration: none;
                    text-transform: uppercase;
                    letter-spacing: 1.5px;
                    color: #94a3b8;
                    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
                    padding-bottom: 4px;
                    transition: color 0.25s ease;
                  }
                  .future-link::after {
                    content: '';
                    position: absolute;
                    bottom: 0; left: 0;
                    width: 0; height: 1px;
                    transition: width 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
                  }
                  .future-link:hover::after {
                    width: 100%;
                  }
                  .future-link.wp:hover { color: #1d1d1f; }
                  .future-link.wp::after { background: #1d1d1f; }
                  .future-link.gg:hover { color: #4285F4; }
                  .future-link.gg::after { background: #4285F4; box-shadow: 0 0 4px #4285F4; }
                  .future-link.yh:hover { color: #a855f7; }
                  .future-link.yh::after { background: #a855f7; box-shadow: 0 0 4px #a855f7; }
                  .future-link.bg:hover { color: #00A4EF; }
                  .future-link.bg::after { background: #00A4EF; box-shadow: 0 0 4px #00A4EF; }
                  .future-link.yd:hover { color: #ef4444; }
                  .future-link.yd::after { background: #ef4444; box-shadow: 0 0 4px #ef4444; }
                  .future-link.bd:hover { color: #3b82f6; }
                  .future-link.bd::after { background: #3b82f6; box-shadow: 0 0 4px #3b82f6; }
                  .future-link.dd:hover { color: #f97316; }
                  .future-link.dd::after { background: #f97316; box-shadow: 0 0 4px #f97316; }
                  .future-link.brv:hover { color: #ff4500; }
                  .future-link.brv::after { background: #ff4500; box-shadow: 0 0 4px #ff4500; }
                  .future-link.prp:hover { color: #10b981; }
                  .future-link.prp::after { background: #10b981; box-shadow: 0 0 4px #10b981; }
                  .future-link.gpt:hover { color: #0f172a; }
                  .future-link.gpt::after { background: #0f172a; box-shadow: 0 0 4px #0f172a; }
                  .future-link.bd-chat:hover { color: #002fa7; }
                  .future-link.bd-chat::after { background: #002fa7; box-shadow: 0 0 4px #002fa7; }
                  .future-link:active {
                    opacity: 0.5;
                  }
                  .ai-divider {
                    border: 0;
                    height: 1px;
                    background: #e3e3e8;
                    margin: 18px -1.5rem 14px -1.5rem;
                  }
                </style>
                <div class="future-search-container">
                  <a href="https://en.wikipedia.org/wiki/${encodeURIComponent(cleanTitle)}" target="_blank" class="future-link wp">Wiki</a>
                  ${dynamicEnginesHtml}
                </div>
              </div>
              <p class="description">${safeSnippet}...</p>
              <div class="tags" aria-label="Tags">${tagsHtml}</div>
              <hr class="ai-divider">
              <div class="ai-links-container">
                <a href="${braveUrl}" target="_blank" class="future-link brv">Brave</a>
                <a href="${perplexityUrl}" target="_blank" class="future-link prp">Perplexity</a>
                <a href="${chatgptUrl}" target="_blank" class="future-link gpt">ChatGPT</a>
                <a href="${baiduUrl}" target="_blank" class="future-link bd-chat">BAIDU</a>
              </div>
              <div style="display: flex; justify-content: flex-end; align-items: center; width: 100%; margin-bottom: 0px; gap: 35px;">
              <svg onclick="window.open('https://www.addtoany.com/share?url=${encodeURIComponent(window.location.origin + window.location.pathname + '?q=' + encodeURIComponent(cleanTitle))}&title=${encodeURIComponent(cleanTitle)}', '_blank');" aria-label="Share" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#3b82f6" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="width: 16px; height: 16px; cursor: pointer; transition: transform 0.2s ease, stroke 0.2s ease;" onmouseover="this.style.transform='scale(1.15)'; this.setAttribute('stroke', '#1d4ed8');" onmouseout="this.style.transform='scale(1)'; this.setAttribute('stroke', '#3b82f6');"><circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"/><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"/></svg>
              <svg onclick="window.location.href = '/';" aria-label="Refresh" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#3b82f6" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="width: 16px; height: 16px; cursor: pointer; transition: transform 0.2s ease, stroke 0.2s ease;" onmouseover="this.style.transform='scale(1.15)'; this.setAttribute('stroke', '#1d4ed8');"     onmouseout="this.style.transform='scale(1)'; this.setAttribute('stroke', '#3b82f6');"><path d="M21.5 2v6h-6M21.34 15.57a10 10 0 1 1-.57-8.38l5.67-5.67"/></svg>
              </div>
            </div>`;
          })
          .join('');
      } catch (e) {
        resultsDiv.textContent = '';
        console.error(e);
      }
    }
    searchForm.addEventListener('submit', e => {
      e.preventDefault();
      const query = searchBox.value.trim();
      if (query.length === 0) {
        resultsDiv.textContent = '';
        updateURLQuery('');
        updateTitle('');
        return;
      }
      updateURLQuery(query);
      performSearch(query);
    });
    resultsDiv.addEventListener('click', e => {
      if (e.target.classList.contains('tag-link')) {
        e.preventDefault();
        const urlParams = new URLSearchParams(e.target.search);
        const tagQuery = urlParams.get('q');
        if (tagQuery) {
          searchBox.value = tagQuery;
          updateURLQuery(tagQuery);
          performSearch(tagQuery);
        }
      }
    });
    window.addEventListener('popstate', () => {
      const urlParams = new URLSearchParams(window.location.search);
      const q = urlParams.get('q') || '';
      searchBox.value = q;
      if (q) {
        performSearch(q);
      } else {
        resultsDiv.textContent = '';
        updateTitle('');
      }
    });
    window.addEventListener('DOMContentLoaded', async () => {
      const urlParams = new URLSearchParams(window.location.search);
      const q = urlParams.get('q');
      if (q) {
        searchBox.value = q;
        performSearch(q);
      } else {
        resultsDiv.textContent = '';
        const liveExpression = await getLiveStartingTag();
        searchBox.value = liveExpression;
        performSearch(liveExpression);
      }
    });
  </script>
  <footer style="margin-top: 4rem; padding: 2rem 1rem; text-align: center; color: #86868b; font-size: 0.85rem; background: transparent; border-top: 1px solid #e3e3e8; width: 100%; max-width: 520px;">
  <div style="
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; font-size: 1.1rem; font-weight: 500; line-height: 1.5; color: #1e293b; background-color: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 20px 24px; text-align: center; max-width: 500px; margin: 0px auto 20px auto; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);">Loving <span style="color: #3b82f6; font-weight: 700;">aéPiot</span>? Add it to your desktop for quick access or share it with your network!</div>
  <div style="margin-bottom: 0.8rem; font-weight: 500; color: #1d1d1f;">
    &copy; aéPiot - MultiSearch Tag Explorer. All rights reserved.
  </div>
  <div style="display: flex; justify-content: center; flex-wrap: wrap; gap: 0.5rem 1.2rem; font-size: 0.8rem;">
    <a href="https://headlines-world.com/" target="_self" style="color: #0066cc; text-decoration: none; font-weight: 500; transition: color 0.15s ease;">Headlines World</a>
    <a href="https://aepiot.com/" target="_self" style="color: #0066cc; text-decoration: none; font-weight: 500; transition: color 0.15s ease;">aéPiot.com</a>
    <a href="https://aepiot.ro/" target="_self" style="color: #0066cc; text-decoration: none; font-weight: 500; transition: color 0.15s ease;">aéPiot.ro</a>
    <a href="https://allgraph.ro/" target="_self" style="color: #0066cc; text-decoration: none; font-weight: 500; transition: color 0.15s ease;">allGraph</a>
  </div>
  </footer>
  <script>
    (function() {
        const linkSettings = [
            ["band, orchestra, choir, voice, piano, instrumental, genre, digital, teacher", "https://www.sheetmusicplus.com/en/explore?aff_id=541503&q=%s", 3],
            ["music, sheet music", "https://www.sheetmusicplus.com?aff_id=541503", 1]
        ];
        const randomSettings = [
            ["https://www.sheetmusicplus.com?aff_id=541503", 1],
            ["https://www.sheetmusicplus.com/en/explore?aff_id=541503&q=%s", 10]
        ];
        const blueWords = linkSettings.flatMap(([wordsString]) => 
            wordsString.split(',').map(w => w.trim().toLowerCase())
        );
        const injectStyles = () => {
            if (document.getElementById('combined-dynamic-styles')) return;
            const style = document.createElement('style');
            style.id = 'combined-dynamic-styles';
            style.innerHTML = `
            .dynamic-link { 
                color: #4f46e5 !important; 
                font-weight: 700 !important; 
                font-size: 1.1em !important;
                text-decoration: none !important; 
                background: rgba(79, 70, 229, 0.05) !important;
                border: 1px solid rgba(79, 70, 229, 0.3) !important;
                padding: 2px 6px !important;
                border-radius: 6px !important;
                box-shadow: 0 2px 4px rgba(79, 70, 229, 0.08) !important;
                transition: all 0.2s ease; 
                cursor: help !important; 
                display: inline-block;
            }
            .dynamic-link:hover { 
                background: rgba(79, 70, 229, 0.12) !important;
                border-color: #4f46e5 !important;
                box-shadow: 0 4px 8px rgba(79, 70, 229, 0.15) !important;
                transform: translateY(-1px);
            }
            .random-link { 
                color: #059669 !important; 
                font-weight: 700 !important; 
                font-size: 1.1em !important;
                text-decoration: none !important; 
                background: rgba(5, 150, 105, 0.05) !important;
                border: 1px solid rgba(5, 150, 105, 0.3) !important;
                padding: 2px 6px !important; 
                border-radius: 6px !important; 
                box-shadow: 0 2px 4px rgba(5, 150, 105, 0.08) !important; 
                transition: all 0.2s ease; 
                cursor: help !important; 
                display: inline-block;
            }
            .random-link:hover { 
                background: rgba(5, 150, 105, 0.12) !important; 
                border-color: #059669 !important; 
                box-shadow: 0 4px 8px rgba(5, 150, 105, 0.15) !important; 
                transform: translateY(-1px); 
            }
            .premium-tooltip { position: fixed; z-index: 2147483647; background: rgba(255, 255, 255, 0.98); backdrop-filter: blur(8px); border: 1px solid #d1d5db; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); padding: 18px 22px; border-radius: 18px; font-family: sans-serif; pointer-events: none; display: none; width: calc(100% - 40px); max-width: 320px; opacity: 0; transform: translateY(15px) scale(0.95); transition: opacity 0.2s ease, transform 0.2s ease; box-sizing: border-box; color: #000; }
            .t-label { font-size: 11px; font-weight: 800; text-transform: uppercase; color: #4338ca; letter-spacing: 1.2px; display: block; margin-bottom: 6px; }
            .t-title { font-size: 20px; font-weight: 800; color: #000000; display: block; margin-bottom: 2px; }
            .t-source { font-size: 12px; color: #4f46e5; font-weight: 700; display: block; margin-bottom: 12px; }
            .t-desc { font-size: 14px; color: #1f2937; border-top: 1px solid #f3f4f6; padding-top: 12px; line-height: 1.5; }
            @media (max-width: 768px) { .premium-tooltip { left: 20px !important; right: 20px !important; bottom: 30px !important; top: auto !important; max-width: none; width: auto; } }
        `;
            document.head.appendChild(style);
        };
        let tooltip;
        const createTooltip = () => {
            if (document.querySelector('.premium-tooltip')) { tooltip = document.querySelector('.premium-tooltip'); return; }
            tooltip = document.createElement('div');
            tooltip.className = 'premium-tooltip';
            document.body.appendChild(tooltip);
        };
        const getDomain = (url) => {
            try { return new URL(url.replace('%s', 'search')).hostname.replace('www.', ''); } catch(e) { return "External Link"; }
        };
        function shuffle(array) {
            for (let i = array.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [array[i], array[j]] = [array[j], array[i]]; }
            return array;
        }
        let isProcessing = false;
        function processAllLinks() {
            if (isProcessing) return;
            isProcessing = true;
            linkSettings.forEach(([wordsString, urlPattern, limit]) => {
                const wordsArray = wordsString.split(',').map(c => c.trim());
                const domain = getDomain(urlPattern);
                wordsArray.forEach(word => {
                    const instances = [];
                    const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT, null, false);
                    let node;
                    while(node = walker.nextNode()) {
                        const parent = node.parentElement;
                        if (!parent || parent.closest('.dynamic-link') || parent.closest('.random-link') || ['SCRIPT', 'STYLE', 'A', 'FOOTER', 'NAV', 'HEADER', 'BUTTON', 'INPUT', 'TEXTAREA', 'H1', 'H2', 'H3'].includes(parent.tagName)) continue;
                        const regex = new RegExp(`\\b(${word})\\b`, "gi");
                        if (regex.test(node.nodeValue)) { instances.push({ node, regex }); }
                    }
                    const shuffledInstances = shuffle(instances);
                    let count = 0;
                    shuffledInstances.forEach(item => {
                        if (count < limit && item.node.parentNode) {
                            const span = document.createElement('span');
                            span.innerHTML = item.node.nodeValue.replace(item.regex, (match) => {
                                if (count < limit) { count++; return `<a href="${urlPattern.includes('%s') ? urlPattern.replace('%s', encodeURIComponent(match)) : urlPattern}" target="_blank" class="dynamic-link" data-t="${match}" data-d="${domain}" data-type="indigo">${match}</a>`; }
                                return match;
                            });
                            if (span.innerHTML !== item.node.nodeValue) { item.node.parentNode.replaceChild(span, item.node); }
                        }
                    });
                });
            });
            const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT, null, false);
       let node; 
       let textNodes = [];
       while(node = walker.nextNode()) {
       const parent = node.parentElement;
    if (!parent || 
        parent.closest('.dynamic-link') || 
        parent.closest('.random-link') || 
        parent.closest('#mw-footer, .mw-footer, footer, #footer, .catlinks, #catlinks') || 
        parent.closest('h1, h2, h3, H1, H2, H3') ||
        ['SCRIPT', 'STYLE', 'A', 'FOOTER', 'NAV', 'HEADER', 'BUTTON', 'INPUT', 'TEXTAREA'].includes(parent.tagName)) {
        continue;
    }
    if (node.nodeValue.trim().length > 0) {
        textNodes.push(node);
        }
    }
            textNodes.sort(() => Math.random() - 0.5);
            randomSettings.forEach(([urlPattern, limit]) => {
                let appliedCount = 0; const domain = getDomain(urlPattern);
                for (let i = 0; i < textNodes.length && appliedCount < limit; i++) {
                    let targetNode = textNodes[i]; if (!targetNode.parentNode) continue;
                    const words = targetNode.nodeValue.match(/[a-zA-Z]{3,12}/g);
                    if (words && words.length > 0) {
                        const picked = words[Math.floor(Math.random() * words.length)];
                        const regex = new RegExp(`\\b(${picked})\\b`, "i");
                        const span = document.createElement('span');
                        span.innerHTML = targetNode.nodeValue.replace(regex, `<a href="${urlPattern.includes('%s') ? urlPattern.replace('%s', encodeURIComponent(picked)) : urlPattern}" target="_blank" class="random-link" data-t="${picked}" data-d="${domain}" data-type="emerald">${picked}</a>`);
                        if (span.innerHTML !== targetNode.nodeValue) { targetNode.parentNode.replaceChild(span, targetNode); appliedCount++; textNodes.splice(i, 1); i--; }
                    }
                }
            });
            setTimeout(() => { isProcessing = false; }, 50);
        }
        const showTooltip = (link) => {
            const { t, d, type } = link.dataset;
            if (type === 'emerald') {
                tooltip.innerHTML = `<span class="t-label" style="color: #059669;">Discovery Mode</span><span class="t-title">${t}</span><span class="t-source" style="color: #059669;">Resource: ${d}</span><div class="t-desc">Explore more about "<b>${t}</b>".</div>`;
            } else {
                tooltip.innerHTML = `<span class="t-label">Quick Insight</span><span class="t-title">${t}</span><span class="t-source">Resource: ${d}</span><div class="t-desc">Discover more about "<b>${t}</b>".</div>`;
            }
            tooltip.style.display = 'block';
            if (window.innerWidth > 768) { setTimeout(() => { tooltip.style.opacity = '1'; tooltip.style.transform = 'translateY(0) scale(1)'; }, 10); } else { tooltip.classList.add('active'); tooltip.style.opacity = '1'; }
        };
        const hideTooltip = () => {
            if (!tooltip) return; tooltip.style.opacity = '0';
            if (window.innerWidth > 768) { tooltip.style.transform = 'translateY(15px) scale(0.95)'; } else { tooltip.classList.remove('active'); }
            setTimeout(() => { if(tooltip && tooltip.style.opacity === '0') tooltip.style.display = 'none'; }, 200);
        };
        document.addEventListener('mouseover', (e) => { const link = e.target.closest('.dynamic-link, .random-link'); if (link) showTooltip(link); });
        document.addEventListener('mousemove', (e) => { if (window.innerWidth > 768 && tooltip && tooltip.style.display === 'block') { let x = e.clientX + 20; let y = e.clientY + 20; if (x + tooltip.offsetWidth > window.innerWidth) x = e.clientX - tooltip.offsetWidth - 20; if (y + tooltip.offsetHeight > window.innerHeight) y = e.clientY - tooltip.offsetHeight - 20; tooltip.style.left = x + 'px'; tooltip.style.top = y + 'px'; } });
        document.addEventListener('mouseout', (e) => { if (e.target.closest('.dynamic-link, .random-link')) hideTooltip(); });
        function init() {
            injectStyles(); createTooltip(); processAllLinks();
            const observer = new MutationObserver((mutations) => {
                let shouldProcess = false;
                for (let mutation of mutations) {
                    if (mutation.target.closest && (mutation.target.closest('.premium-tooltip') || mutation.target.closest('.dynamic-link') || mutation.target.closest('.random-link'))) continue;
                    shouldProcess = true; break;
                }
                if (shouldProcess && !isProcessing) { clearTimeout(window.dynamicLinkTimeout); window.dynamicLinkTimeout = setTimeout(processAllLinks, 500); }
            });
            observer.observe(document.body, { childList: true, subtree: true });
        }
        if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', init); } else { init(); }
    })();
    </script>
</body>
</html>