/* Moved out of encyclopedia.html so the CSP needs no 'unsafe-inline'. */
  *, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
  :root {
    --bg: #0B0F1A;
    --surface: #131926;
    --elevated: #1A2236;
    --border: #1E293B;
    --text: #F1F5F9;
    --text2: #94A3B8;
    --text3: #64748B;
    --primary: #6366F1;
    --primary-glow: rgba(99,102,241,.25);
    --cyan: #06B6D4;
    --indigo-light: #818CF8;
  }
  html { scroll-behavior: smooth; font-size: 16px; }
  body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg); color: var(--text); line-height: 1.7;
    overflow-x: hidden; -webkit-font-smoothing: antialiased;
  }
  a { color: var(--cyan); text-decoration: none; }
  a:hover { text-decoration: underline; }
  ::selection { background: var(--primary); color: #fff; }

  /* Nav */
  nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100; padding: 16px 0;
    background: rgba(11,15,26,.85); backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255,255,255,.04);
  }
  nav .inner {
    max-width: 1280px; margin: 0 auto; padding: 0 24px;
    display: flex; align-items: center; justify-content: space-between;
  }
  nav .logo {
    display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem;
  }
  nav .logo-icon {
    width: 32px; height: 32px; border-radius: 8px;
    background: linear-gradient(135deg, #6366F1, #06B6D4);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; color: #fff; font-weight: 800;
  }
  nav .links { display: flex; align-items: center; gap: 24px; font-size: .9rem; }
  nav .links a { color: var(--text2); }
  nav .links a:hover { color: var(--text); text-decoration: none; }
  nav .cta-sm {
    background: var(--primary); color: #fff !important; padding: 6px 16px;
    border-radius: 8px; font-weight: 600;
  }
  nav .cta-sm:hover { background: #4F46E5; }

  /* Hero */
  .hero {
    max-width: 1100px; margin: 0 auto; padding: 130px 24px 40px; text-align: center;
  }
  .hero .eyebrow {
    display: inline-block; padding: 6px 14px; border-radius: 999px;
    background: rgba(99,102,241,.12); border: 1px solid rgba(99,102,241,.3);
    color: var(--indigo-light); font-size: .8rem; font-weight: 600;
    letter-spacing: .04em; text-transform: uppercase; margin-bottom: 20px;
  }
  .hero h1 {
    font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; line-height: 1.15;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #818CF8, #6366F1, #06B6D4);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  }
  .hero p.lede {
    font-size: 1.15rem; color: var(--text2); max-width: 780px; margin: 0 auto 24px;
    line-height: 1.7;
  }
  .hero .stats {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 32px; margin-top: 32px;
    color: var(--text3); font-size: .9rem;
  }
  .hero .stats strong { color: var(--text); display: block; font-size: 1.4rem; font-weight: 700; }

  /* Search bar */
  .search-wrap {
    max-width: 800px; margin: 40px auto 24px; padding: 0 24px;
  }
  .search-box {
    width: 100%; padding: 14px 20px; border-radius: 12px;
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text); font-size: 1rem; font-family: inherit;
    transition: border-color .2s, box-shadow .2s;
  }
  .search-box:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
  }
  .search-box::placeholder { color: var(--text3); }

  /* Category nav (sticky tabs) */
  .cat-nav {
    position: sticky; top: 64px; z-index: 50;
    background: rgba(11,15,26,.92); backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 12px 0; margin-bottom: 32px;
  }
  .cat-nav .scroll {
    max-width: 1280px; margin: 0 auto; padding: 0 24px;
    display: flex; gap: 8px; overflow-x: auto; scrollbar-width: thin;
  }
  .cat-nav .scroll::-webkit-scrollbar { height: 4px; }
  .cat-nav .scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
  .cat-nav a {
    flex-shrink: 0; padding: 8px 14px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text2); font-size: .85rem; font-weight: 500;
    white-space: nowrap; transition: all .15s;
  }
  .cat-nav a:hover {
    color: var(--text); border-color: var(--primary); text-decoration: none;
  }

  /* Main content */
  .container {
    max-width: 1280px; margin: 0 auto; padding: 0 24px 60px;
  }

  /* Category sections */
  .cat-section { margin-bottom: 56px; scroll-margin-top: 130px; }
  .cat-section h2 {
    font-size: 1.7rem; font-weight: 700; margin-bottom: 8px;
    color: var(--text); display: flex; align-items: center; gap: 12px;
  }
  .cat-section h2 .badge {
    font-size: .75rem; padding: 4px 10px; border-radius: 6px;
    background: rgba(99,102,241,.15); color: var(--indigo-light);
    font-weight: 600; letter-spacing: .03em;
  }
  .cat-section .cat-intro {
    color: var(--text2); margin-bottom: 24px; font-size: 1rem; max-width: 900px;
  }

  /* Grid of entries */
  .entries {
    display: grid; gap: 20px;
    grid-template-columns: 1fr;
  }
  @media (min-width: 720px) {
    .entries { grid-template-columns: repeat(2, 1fr); }
  }
  @media (min-width: 1080px) {
    .entries { grid-template-columns: repeat(3, 1fr); }
  }

  .entry {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; padding: 24px; transition: all .2s;
    display: flex; flex-direction: column;
  }
  .entry:hover {
    border-color: rgba(99,102,241,.4);
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0,0,0,.4);
  }
  .entry h3 {
    font-size: 1.1rem; font-weight: 700; margin-bottom: 10px; color: var(--indigo-light);
    line-height: 1.3;
  }
  .entry .definition {
    font-size: .92rem; color: var(--text); margin-bottom: 12px; font-weight: 500;
  }
  .entry .body {
    font-size: .88rem; color: var(--text2); line-height: 1.65; margin-bottom: 12px;
  }
  .entry .body p { margin-bottom: 10px; }
  .entry .body p:last-child { margin-bottom: 0; }
  .entry .meta {
    margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border);
    display: flex; flex-wrap: wrap; gap: 8px; font-size: .75rem;
  }
  .entry .meta span {
    padding: 3px 8px; border-radius: 6px;
    background: var(--elevated); color: var(--text3);
  }
  .entry .meta span.module {
    background: rgba(6,182,212,.1); color: var(--cyan); border: 1px solid rgba(6,182,212,.2);
  }
  .entry strong { color: var(--text); font-weight: 600; }
  .entry em { color: var(--indigo-light); font-style: normal; font-weight: 500; }
  /* Highlight the entry when navigated to via anchor link */
  .entry:target {
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(99,102,241,.2), 0 12px 32px rgba(0,0,0,.5);
    animation: entry-flash 2s ease-out;
  }
  @keyframes entry-flash {
    0%   { background: rgba(99,102,241,.14); }
    100% { background: var(--surface); }
  }
  /* Permalink icon next to each entry heading */
  .entry h3 .permalink {
    opacity: 0; margin-left: 8px; font-size: .85rem; color: var(--text3);
    text-decoration: none; transition: opacity .15s;
  }
  .entry:hover h3 .permalink { opacity: 1; }
  .entry h3 .permalink:hover { color: var(--indigo-light); text-decoration: none; }

  .no-results {
    text-align: center; padding: 60px 24px; color: var(--text3);
    background: var(--surface); border: 1px dashed var(--border); border-radius: 12px;
    display: none;
  }

  /* Ad container */
  .ad-container {
    max-width: 970px; margin: 40px auto; padding: 0 24px; text-align: center;
  }
  .ad-label {
    font-size: .75rem; color: var(--text3); margin-bottom: 8px;
    text-transform: uppercase; letter-spacing: .08em;
  }

  /* Footer */
  footer {
    border-top: 1px solid var(--border); padding: 40px 24px; text-align: center;
    color: var(--text3); font-size: .85rem; margin-top: 40px;
  }
  footer p { margin-bottom: 12px; }
  footer .footer-links a { color: var(--text3); margin: 0 12px; }
  footer .footer-links a:hover { color: var(--text); }
  footer .ko-fi {
    display: inline-block; margin-top: 16px; padding: 8px 18px;
    background: linear-gradient(135deg, #6366F1, #06B6D4); color: #fff !important;
    border-radius: 8px; font-weight: 600; font-size: .85rem;
  }
  footer .ko-fi:hover { text-decoration: none; opacity: .9; }

  @media (max-width: 640px) {
    .hero { padding: 100px 16px 30px; }
    .container { padding: 0 16px 40px; }
    nav .links a:not(.cta-sm) { display: none; }
    .cat-section h2 { font-size: 1.35rem; }
    .cat-nav { top: 60px; }
  }
