
      :root {
        --bg: #0b1220;
        --panel: #0f172a;
        --muted: #9aa4b2;
        --text: #e6edf3;
        --accent: #60a5fa;
        --accent-2: #34d399;
        --border: #1f2937;
        --code-bg: #0a0f1a;
        --warning: #fbbf24;
        --danger: #f87171;
        --ok: #22c55e;
      }
      :root.light {
        --bg: #f8fafc;
        --panel: #ffffff;
        --muted: #4b5563;
        --text: #0f172a;
        --accent: #2563eb;
        --accent-2: #059669;
        --border: #e5e7eb;
        --code-bg: #0f172a10;
        --warning: #b45309;
        --danger: #b91c1c;
        --ok: #15803d;
      }
      * {
        box-sizing: border-box;
      }
      html,
      body {
        height: 100%;
      }
      body {
        margin: 0;
        color: var(--text);
        background: var(--bg);
        font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell,
          "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
        scrollbar-gutter: stable both-edges;
      }
      a {
        color: var(--accent);
      }
      code,
      pre {
        font-family:
          ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
          "Liberation Mono", "Courier New", monospace;
      }

      .topbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 50;
        background: color-mix(in srgb, var(--panel) 92%, transparent);
        border-bottom: 1px solid var(--border);
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
      }
      .topbar-inner {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        width: 100%;
        margin: 0;
        padding: 0.75rem 1rem;
      }
      .brand {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-weight: 700;
      }
      .brand .logo {
        width: 28px;
        height: 28px;
        display: grid;
        place-items: center;
        border-radius: 6px;
        font-size: 16px;
      }
      .spacer {
        flex: 1;
      }
      .btn {
        appearance: none;
        border: 1px solid var(--border);
        background: var(--panel);
        color: var(--text);
        padding: 0.5rem 0.75rem;
        border-radius: 8px;
        cursor: pointer;
      }
      .btn:hover {
        border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
      }
      .btn-ghost {
        background: transparent;
      }
      .btn.btn-icon {
        width: 36px;
        height: 36px;
        padding: 0;
        display: grid;
        place-items: center;
        border: none;
        background: transparent;
      }

      .progress {
        height: 3px;
        width: 100%;
        background: linear-gradient(90deg, var(--accent), var(--accent-2));
        transform-origin: left center;
        transform: scaleX(0);
      }

      .layout {
        max-width: 100%;
        width: 100%;
        margin: 0 auto;
        padding: 1rem;
        display: grid;
        grid-template-columns: 1fr;
        gap: 1rem;
      }
      @media (min-width: 1024px) {
        /* Nav will be fixed, so keep content as a single column */
        .layout {
          grid-template-columns: 1fr;
        }
      }

      /* Default: sticky (non-destructive) */
      .nav {
        position: sticky;
        top: calc(var(--header-h, 64px) + 2px);
        align-self: start;
        border: 1px solid var(--border);
        background: var(--panel);
        border-radius: 12px;
        max-height: calc(100vh - var(--header-h, 64px) - 2px - 2rem);
        overflow: auto;
      }
      /* Large screens: convert nav to a fixed left sidebar and offset the content */
      @media (min-width: 1024px) {
        .nav {
          position: fixed;
          left: 1rem;
          top: calc(var(--header-h, 64px) + 2px);
          width: 260px;
          height: calc(100vh - var(--header-h, 64px) - 2px - 2rem);
          max-height: none;
          overflow: auto;
        }
        .content {
          margin-left: 260px; /* equals sidebar width */
        }
      }
      .nav h3 {
        margin: 0;
        padding: 0.85rem 1rem;
        border-bottom: 1px solid var(--border);
      }
      .nav a {
        display: block;
        padding: 0.6rem 1rem;
        text-decoration: none;
        color: var(--text);
        border-bottom: 1px dashed var(--border);
        font-size: 0.95rem;
      }
      .nav a:last-child {
        border-bottom: none;
      }
      .nav a.active {
        background: color-mix(in srgb, var(--accent) 12%, transparent);
      }

      .content {
        display: flex;
        flex-direction: column;
        gap: 1rem;
      }
      section {
        border: 1px solid var(--border);
        background: var(--panel);
        border-radius: 12px;
        padding: 1rem;
        scroll-margin-top: calc(var(--header-h, 64px) + 2px);
      }
      section h2 {
        margin: 0.2rem 0 0.5rem;
      }
      section p {
        color: var(--muted);
        line-height: 1.6;
      }

      .callout {
        border-left: 4px solid var(--accent);
        background: color-mix(in srgb, var(--accent) 6%, transparent);
        padding: 0.75rem 0.9rem;
        border-radius: 8px;
      }
      .callout.warn {
        border-left-color: var(--warning);
      }
      .callout.danger {
        border-left-color: var(--danger);
      }
      .callout.ok {
        border-left-color: var(--ok);
      }

      pre {
        position: relative;
        margin: 0.75rem 0;
        background: var(--code-bg);
        border: 1px solid var(--border);
        padding: 0.75rem;
        border-radius: 10px;
        overflow: auto;
      }
      pre .copy {
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
        border: 1px solid var(--border);
        background: var(--panel);
        color: var(--text);
        width: 28px;
        height: 28px;
        padding: 0;
        display: grid;
        place-items: center;
        border-radius: 8px;
        cursor: pointer;
      }
      pre .copy svg {
        width: 16px;
        height: 16px;
      }
      pre .copy.ok {
        background: color-mix(in srgb, var(--ok) 30%, var(--panel));
      }
      .mermaid {
        background: var(--code-bg);
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 0.75rem;
        overflow: auto;
        margin: 0.75rem 0;
      }
      .mermaid svg {
        width: 100%;
        height: auto;
      }

      /* Tooltip */
      #tooltip {
        position: fixed;
        z-index: 60;
        pointer-events: none;
        background: var(--panel);
        color: var(--text);
        border: 1px solid var(--border);
        padding: 0.4rem 0.6rem;
        border-radius: 8px;
        font-size: 0.9rem;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
        display: none;
        max-width: 280px;
      }

      .grid {
        display: grid;
        gap: 0.75rem;
      }
      @media (min-width: 700px) {
        .grid.cols-2 {
          grid-template-columns: 1fr 1fr;
        }
      }

      .step {
        display: flex;
        gap: 0.5rem;
        align-items: flex-start;
      }
      .step-num {
        min-width: 28px;
        height: 28px;
        border-radius: 999px;
        background: var(--accent);
        color: #fff;
        display: grid;
        place-items: center;
        font-weight: 700;
      }

      .actions {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
        margin-top: 0.5rem;
      }
      .nextprev {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
        margin-top: 1rem;
      }

      .footer {
        opacity: 0.75;
        text-align: center;
        padding: 1.5rem 0;
      }
      .logo {
        width: 28px;
        height: 28px;
        display: grid;
        place-items: center;
        border-radius: 6px;
        overflow: hidden; /* clip image to rounded corners */
      }
      .logo img {
        width: 100%;
        height: 100%;
        object-fit: cover; /* fill the square nicely */
        display: block;
        background-color:transparent;
      }