
    :root {
      color-scheme: dark;
      --bg: #0a0f1e;
      --bg-rgb: 10, 15, 30;
      --surface-rgb: 15, 23, 42;
      --surface-2-rgb: 30, 41, 59;
      --fg: #e2e8f0;
      --fg-strong: #f1f5f9;
      --fg-soft: #cbd5e1;
      --fg-muted: #94a3b8;
      --fg-dim: #64748b;
      --fg-faint: #475569;
      --blue: #60a5fa;
      --blue-soft: #93c5fd;
      --blue-deep: #3b82f6;
      --purple: #a78bfa;
      --purple-soft: #c4b5fd;
      --purple-deep: #8b5cf6;
      --green: #34d399;
      --green-soft: #6ee7b7;
      --green-deep: #10b981;
      --pink: #f472b6;
      --pink-deep: #ec4899;
      --amber: #fbbf24;
      --amber-soft: #fcd34d;
      --amber-deep: #f59e0b;
      --cyan: #22d3ee;
      --cyan-soft: #67e8f9;
      --red: #f87171;
      --red-soft: #fca5a5;
      --red-deep: #ef4444;
      --shadow: rgba(0, 0, 0, 0.4);
    }

    [data-theme="light"] {
      color-scheme: light;
      --bg: #f8fafc;
      --bg-rgb: 248, 250, 252;
      --surface-rgb: 255, 255, 255;
      --surface-2-rgb: 241, 245, 249;
      --fg: #1e293b;
      --fg-strong: #0f172a;
      --fg-soft: #334155;
      --fg-muted: #475569;
      --fg-dim: #52606d;
      --fg-faint: #94a3b8;
      --blue: #1d4ed8;
      --blue-soft: #2563eb;
      --blue-deep: #1e40af;
      --purple: #6d28d9;
      --purple-soft: #7c3aed;
      --purple-deep: #5b21b6;
      --green: #047857;
      --green-soft: #059669;
      --green-deep: #065f46;
      --pink: #be185d;
      --pink-deep: #9d174d;
      --amber: #a16207;
      --amber-soft: #b45309;
      --amber-deep: #92400e;
      --cyan: #0e7490;
      --cyan-soft: #0891b2;
      --red: #b91c1c;
      --red-soft: #dc2626;
      --red-deep: #991b1b;
      --shadow: rgba(15, 23, 42, 0.12);
    }


    * { margin: 0; padding: 0; box-sizing: border-box; }

    html { scroll-behavior: smooth; }
    @media (prefers-reduced-motion: reduce) {
      html { scroll-behavior: auto; }
      *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
      }
    }

    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
      background: var(--bg);
      color: var(--fg);
      min-height: 100vh;
      overflow-x: hidden;
    }

    :focus-visible {
      outline: 3px solid var(--accent);
      outline-offset: 3px;
      border-radius: 2px;
    }

    .skip-link {
      position: absolute;
      left: -9999px;
      top: 0;
      z-index: 200;
      padding: 0.75rem 1.25rem;
      background: var(--accent);
      color: var(--bg);
      font-weight: 600;
      border-radius: 0 0 8px 0;
    }
    .skip-link:focus { left: 0; }

    /* Navigation */
    .nav {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      z-index: 100;
      background: rgba(var(--bg-rgb), 0.9);
      backdrop-filter: blur(10px);
      border-bottom: 1px solid rgba(var(--surface-2-rgb), 0.8);
      padding: 1rem 2rem;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 1rem;
    }

    .nav-links {
      display: flex;
      flex-wrap: wrap;
      gap: 0.5rem 1.1rem;
      align-items: center;
      justify-content: flex-end;
    }

    .nav-links a {
      color: var(--accent);
      text-decoration: none;
      font-size: 0.9rem;
      font-weight: 500;
      transition: color 0.3s;
    }

    .nav-links a:hover { color: var(--fg-strong); }
    .nav-links a[aria-current="page"] { color: var(--fg-strong); font-weight: 600; }

    .nav-title {
      font-size: 1.1rem;
      font-weight: 600;
      color: var(--fg-strong);
      text-decoration: none;
      white-space: nowrap;
      transition: color 0.3s;
    }
    .nav-title:hover { color: var(--accent); }

    .nav-tools { display: flex; gap: 0.5rem; align-items: center; }

    .nav-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.4rem;
      min-width: 2.25rem;
      height: 2.25rem;
      padding: 0 0.6rem;
      background: rgba(var(--surface-rgb), 0.6);
      border: 1px solid rgba(var(--surface-2-rgb), 0.9);
      border-radius: 8px;
      color: var(--fg-muted);
      font: inherit;
      font-size: 0.85rem;
      cursor: pointer;
      transition: color 0.2s, border-color 0.2s;
    }
    .nav-btn:hover { color: var(--fg-strong); border-color: var(--accent); }
    .nav-btn kbd {
      font: inherit;
      font-size: 0.7rem;
      color: var(--fg-dim);
      border: 1px solid rgba(var(--surface-2-rgb), 0.9);
      border-radius: 4px;
      padding: 0 0.25rem;
    }

    /* Table of contents */
    .toc {
      position: fixed;
      top: 50%;
      right: 1.25rem;
      transform: translateY(-50%);
      z-index: 90;
      max-width: 15rem;
      max-height: 70vh;
      overflow-y: auto;
      padding: 1rem 1.1rem;
      background: rgba(var(--surface-rgb), 0.75);
      backdrop-filter: blur(10px);
      border: 1px solid rgba(var(--surface-2-rgb), 0.9);
      border-radius: 12px;
list-style: none;
    }
    .toc-heading {
      font-size: 0.7rem;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--fg-dim);
      margin-bottom: 0.6rem;
    }
    .toc ol { list-style: none; display: flex; flex-direction: column; gap: 0.45rem; }
    .toc a {
      color: var(--fg-muted);
      text-decoration: none;
      font-size: 0.82rem;
      line-height: 1.3;
      display: block;
      border-left: 2px solid transparent;
      padding-left: 0.6rem;
      transition: color 0.2s, border-color 0.2s;
    }
    .toc a:hover { color: var(--fg-strong); }
    .toc a.active { color: var(--accent); border-left-color: var(--accent); }
    @media (max-width: 1500px) { .toc { display: none; } }

    /* Search */
    .search-dialog {
      width: min(40rem, 92vw);
      padding: 0;
      border: 1px solid rgba(var(--surface-2-rgb), 0.9);
      border-radius: 14px;
      background: var(--bg);
      color: var(--fg);
    }
    .search-dialog::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(3px); }
    .search-input {
      width: 100%;
      padding: 1.1rem 1.25rem;
      border: 0;
      border-bottom: 1px solid rgba(var(--surface-2-rgb), 0.9);
      background: transparent;
      color: var(--fg-strong);
      font: inherit;
      font-size: 1.05rem;
    }
    .search-input:focus { outline: none; }
    .search-results { list-style: none; max-height: 55vh; overflow-y: auto; }
    .search-results li + li { border-top: 1px solid rgba(var(--surface-2-rgb), 0.6); }
    .search-results a {
      display: block;
      padding: 0.85rem 1.25rem;
      text-decoration: none;
      color: var(--fg);
    }
    .search-results a:hover, .search-results a:focus-visible { background: rgba(var(--surface-2-rgb), 0.6); }
    .search-results .r-title { color: var(--fg-strong); font-weight: 600; font-size: 0.95rem; }
    .search-results .r-page { color: var(--accent); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
    .search-results .r-desc { color: var(--fg-muted); font-size: 0.85rem; margin-top: 0.2rem; }
    .search-empty { padding: 1.25rem; color: var(--fg-muted); font-size: 0.9rem; }

    /* Hero */
    .hero {
      min-height: 60vh;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 8rem 2rem 4rem;
      text-align: center;
      position: relative;
    }

    .hero-content { position: relative; z-index: 1; }

    .badge {
      display: inline-block;
      padding: 0.5rem 1.5rem;
      background: color-mix(in srgb, var(--accent) 12%, transparent);
      border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
      border-radius: 50px;
      font-size: 0.85rem;
      font-weight: 600;
      letter-spacing: 0.1em;
      color: var(--accent);
      margin-bottom: 2rem;
    }

    .section-title {
      font-size: 2rem;
      font-weight: 700;
      text-align: center;
      margin-bottom: 1rem;
      color: var(--fg-strong);
      scroll-margin-top: 7rem;
    }

    /* Next Section CTA */
    .next-section { padding: 4rem 2rem; max-width: 800px; margin: 0 auto; }

    .next-card {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 2rem;
      padding: 2rem;
      background: rgba(var(--surface-rgb), 0.6);
      border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
      border-radius: 16px;
      text-decoration: none;
      transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
    }

    .next-card:hover {
      transform: translateY(-4px);
      border-color: color-mix(in srgb, var(--accent) 60%, transparent);
      box-shadow: 0 20px 60px color-mix(in srgb, var(--accent) 20%, transparent);
    }

    .next-card-content h3 {
      font-size: 0.85rem;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--accent);
      margin-bottom: 0.5rem;
    }
    .next-card-content p { font-size: 1.5rem; font-weight: 700; color: var(--fg-strong); margin-bottom: 0.25rem; }
    .next-card-content span { color: var(--fg-muted); font-size: 0.95rem; }
    .next-arrow { font-size: 2rem; color: var(--accent); transition: transform 0.3s; }
    .next-card:hover .next-arrow { transform: translateX(8px); }

    /* Footer */
    .footer {
      padding: 3rem 2rem;
      text-align: center;
      border-top: 1px solid rgba(var(--surface-2-rgb), 0.8);
      color: var(--fg-dim);
      font-size: 0.9rem;
    }
    .footer a { color: var(--accent); text-decoration: none; }
    .footer a:hover { text-decoration: underline; }

    @media (max-width: 768px) {
      .nav { padding: 0.75rem 1rem; }
      .nav-links { gap: 0.4rem 0.8rem; }
      .nav-links a { font-size: 0.8rem; }
    }

    /* Print */
    @media print {
      :root { color-scheme: light; }
      .nav, .toc, .skip-link, .next-section, .search-dialog, .nav-tools { display: none !important; }
      body { background: #fff; color: #111; }
      .hero { min-height: auto; padding: 0 0 1.5rem; page-break-after: avoid; }
      .hero::before, .hero::after { display: none !important; }
      .section-title { page-break-after: avoid; }
      a { color: inherit; text-decoration: underline; }
      main a[href^="/"]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #555; }
      table, figure, pre { page-break-inside: avoid; }
      .footer { border-top: 1px solid #ccc; color: #555; }
    }
