
  :root {
    --bg: #0d0f12; --fg: #c8d0d8; --dim: #6b7683; --accent: #5ec98a;
    --accent-dim: #3a7d55; --link: #6cb6ff; --link-hl: #1c3350; --rule: #1e242b; --sel-bg: #5ec98a; --sel-fg: #0d0f12;
    --code-bg: #14181d; --code-comment: #6b7683; --code-string: #98c379;
    --code-keyword: #c678dd; --code-number: #d19a66; --code-func: #61afef;
  }
  html[data-theme="light"] {
    --bg: #f7f8f8; --fg: #232a31; --dim: #7c8792; --accent: #1f8f4e;
    --accent-dim: #6bbd8c; --link: #1a66c9; --link-hl: #d6e6fb; --rule: #e0e4e8; --sel-bg: #1f8f4e; --sel-fg: #f7f8f8;
    --code-bg: #eef1f3; --code-comment: #8a94a0; --code-string: #4a8f3c;
    --code-keyword: #a626a4; --code-number: #b06000; --code-func: #3572b0;
  }
  * { box-sizing: border-box; }
  html, body {
    margin: 0; padding: 0; background: var(--bg); color: var(--fg);
    font-family: "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
    font-size: 15px; line-height: 1.7; -webkit-font-smoothing: antialiased;
  }
  ::selection { background: var(--sel-bg); color: var(--sel-fg); }
  a { color: var(--link); text-decoration: none; }
  a:hover { background: var(--link-hl); box-shadow: 0 0 0 2px var(--link-hl); border-radius: 2px; }
  .wrap { max-width: 720px; margin: 0 auto; padding: 32px 22px 80px; }
  .wrap.wide { max-width: 1100px; }
  .topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
  .prompt-user { color: var(--accent); }
  .prompt-path { color: var(--dim); }
  .cmd { color: var(--fg); }
  .promptline.nav { cursor: pointer; }
  .promptline.nav:hover { background: var(--link-hl); box-shadow: 0 0 0 2px var(--link-hl); border-radius: 2px; }
  .grep-input {
    background: none; border: none; outline: none; font: inherit;
    color: var(--accent); caret-color: transparent; padding: 0; vertical-align: baseline;
  }
  .grep-input::placeholder { color: var(--dim); }
  .promptline { word-break: break-word; }
  .output { color: var(--fg); margin: 0 0 18px; }
  .groups-out { word-spacing: 1em; }
  .second-prompt { margin: 0 0 8px; cursor: pointer; width: fit-content; }
  .second-prompt:hover { background: var(--link-hl); box-shadow: 0 0 0 2px var(--link-hl); border-radius: 2px; }
  #moreOut.collapsed { display: none; }
  .cursor {
    display: inline-block; width: 8px; height: 1em; background: var(--accent);
    vertical-align: text-bottom; animation: blink 1.1s steps(1) infinite; margin-left: 2px;
  }
  @keyframes blink { 50% { opacity: 0; } }
  .theme-btn {
    flex: 0 0 auto; background: none; border: 1px solid var(--rule); color: var(--dim);
    padding: 6px; border-radius: 4px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; line-height: 0;
  }
  .theme-btn:hover { color: var(--fg); border-color: var(--dim); }
  .theme-btn .icon { width: 17px; height: 17px; display: block; }
  html[data-theme="dark"] .icon-sun { display: none; }
  html[data-theme="light"] .icon-moon { display: none; }
  .meta-val { color: var(--fg); }
  .meta-list { margin: 2px 0 14px; padding: 0; list-style: none; }
  .meta-list li { padding-left: 16px; position: relative; color: var(--fg); }
  .meta-list li::before { content: "-"; position: absolute; left: 0; color: var(--dim); }
  .meta-list li .yr { color: var(--dim); }
  .talk-list .nolink { display: flex; gap: 10px; padding: 3px 0; color: var(--dim); cursor: default; }
  .talk-list .nolink .ptitle { color: var(--fg); }
  hr.divider { border: none; border-top: 1px dashed var(--rule); margin: 26px 0 18px; }
  .section-title { color: var(--dim); font-size: 13px; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 10px; }
  .postlist { list-style: none; margin: 0; padding: 0; }
  .postlist li { margin: 0 0 4px; }
  .postlist a { display: flex; gap: 10px; padding: 3px 0; color: var(--fg); }
  .postlist a:hover { text-decoration: none; color: var(--accent); background: none; box-shadow: none; }
  .postlist a:hover .arrow { color: var(--accent); }
  .arrow { color: var(--accent-dim); flex: 0 0 auto; }
  .ptitle { flex: 1 1 auto; }
  .pdate { color: var(--dim); flex: 0 0 auto; font-size: 13px; }
  /* posts as ls -l rows */
  #postlist { overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
  #postlist::-webkit-scrollbar { height: 6px; }
  #postlist::-webkit-scrollbar-track { background: transparent; }
  #postlist::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }
  #postlist::-webkit-scrollbar-thumb:hover { background: var(--dim); }
  #postlist a { display: block; white-space: pre; color: var(--fg); font-size: 13px; padding: 2px 0; }
  #postlist a:hover { color: var(--accent); background: none; box-shadow: none; }
  #postlist li.posts-head { display: block; white-space: pre; color: var(--dim); font-size: 13px; padding: 2px 0 5px; border-bottom: 1px solid var(--rule); margin-bottom: 5px; cursor: default; }
  .back { display: inline-flex; gap: 8px; align-items: center; color: var(--dim); margin-bottom: 22px; cursor: pointer; }
  .back:hover { color: var(--accent); text-decoration: none; }
  .back .arrow { color: var(--accent-dim); }
  article h1 { font-size: 22px; margin: 0 0 4px; color: var(--fg); }
  article .articlemeta { color: var(--dim); font-size: 13px; margin-bottom: 24px; }
  article h2 { font-size: 18px; color: var(--accent); margin: 30px 0 8px; }
  article h3 { font-size: 16px; color: var(--accent); margin: 24px 0 6px; }
  article h4 { font-size: 15px; color: var(--fg); margin: 20px 0 6px; }
  article h5 { font-size: 15px; color: var(--dim); margin: 18px 0 6px; text-transform: uppercase; letter-spacing: .05em; }
  article h6 { font-size: 15px; color: var(--dim); margin: 16px 0 6px; text-transform: uppercase; letter-spacing: .05em; font-weight: 500; }
  article p { margin: 0 0 16px; }
  article ul, article ol { padding-left: 20px; }
  article a { color: var(--link); }
  /* images sit as blocks with a blank line above and below (the caption is inside the figure,
     so the trailing space lands after it) */
  article img { max-width: 100%; height: auto; border-radius: 6px; display: block; margin: 24px 0; }
  article p img { display: inline; margin: 0; vertical-align: middle; } /* images inside a sentence stay inline */
  article figure { width: fit-content; max-width: 100%; margin: 24px 0; }
  article figure img { display: block; margin: 0; } /* the figure owns the spacing */
  article figcaption { color: var(--dim); font-size: 13px; margin-top: 6px; text-align: center; }
  /* alignment blocks: ::: center | right | left ... ::: */
  article .md-center { text-align: center; }
  article .md-right { text-align: right; }
  article .md-left { text-align: left; }
  article .md-center figure, article .md-center img { margin-left: auto; margin-right: auto; }
  article .md-right figure, article .md-right img { margin-left: auto; margin-right: 0; }
  /* tl;dr callout ( ::: tldr ... ::: ) */
  article .tldr { background: var(--code-bg); border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: 6px; padding: 12px 16px; margin: 0 0 26px; font-size: 14px; }
  article .tldr-label { color: var(--accent); text-transform: uppercase; font-size: 11px; letter-spacing: .08em; margin-bottom: 6px; }
  article .tldr > :last-child { margin-bottom: 0; }
  /* post layout with table-of-contents sidebar */
  .post-wrap { display: grid; grid-template-columns: 190px minmax(0, 720px); gap: 40px; justify-content: center; align-items: start; }
  .post-wrap.no-toc { grid-template-columns: minmax(0, 720px); }
  .toc { position: sticky; top: 24px; align-self: start; max-height: calc(100vh - 48px); overflow-y: auto; font-size: 13px; }
  .toc-title { color: var(--dim); text-transform: uppercase; font-size: 12px; letter-spacing: .05em; margin-bottom: 10px; }
  .toc ul { list-style: none; margin: 0; padding: 0; }
  .toc li { margin: 0; }
  .toc a { display: block; color: var(--dim); text-decoration: none; padding: 3px 0 3px 10px; border-left: 2px solid var(--rule); line-height: 1.4; }
  .toc a:hover { color: var(--accent); border-left-color: var(--accent); background: none; box-shadow: none; }
  .toc a.lvl-3 { padding-left: 24px; }
  .toc a.lvl-4 { padding-left: 38px; font-size: 12px; }
  @media (max-width: 900px) {
    .post-wrap { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .toc { position: static; max-height: none; margin-bottom: 24px; border-bottom: 1px dashed var(--rule); padding-bottom: 14px; }
  }
  /* tables */
  article table { border-collapse: collapse; margin: 0 0 16px; font-size: 14px; }
  article th, article td { border: 1px solid var(--rule); padding: 6px 12px; }
  article th { background: var(--rule); text-align: left; font-weight: 600; }
  /* task lists */
  article li.task-item { list-style: none; margin-left: -1.15em; }
  article .task input { margin: 0 7px 0 0; vertical-align: -1px; }
  /* autolinked bare urls */
  article a.autolink { text-decoration: underline dotted; text-underline-offset: 2px; }
  /* footnotes / references */
  article sup.fn-ref { line-height: 0; font-size: 11px; }
  article sup.fn-ref a { color: var(--link); text-decoration: none; padding: 0 1px; }
  article hr.fn-rule { border: none; border-top: 1px dashed var(--rule); margin: 32px 0 14px; }
  article ol.footnotes { color: var(--dim); font-size: 13px; padding-left: 20px; }
  article ol.footnotes li { margin-bottom: 6px; }
  article ol.footnotes li::marker { color: var(--dim); }
  article .fn-back { color: var(--dim); text-decoration: none; margin-left: 5px; }
  article code { background: var(--rule); padding: 1px 5px; border-radius: 3px; font-size: 13px; }
  article pre { background: var(--code-bg); border: 1px solid var(--rule); padding: 14px 16px; border-radius: 6px; overflow-x: auto; font-size: 13px; line-height: 1.55; }
  article pre code { background: none; padding: 0; }
  article .tok-c { color: var(--code-comment); font-style: italic; }
  article .tok-s { color: var(--code-string); }
  article .tok-n { color: var(--code-number); }
  article .tok-k { color: var(--code-keyword); }
  article .tok-f { color: var(--code-func); }
  article blockquote { margin: 0 0 16px; padding-left: 14px; border-left: 2px solid var(--accent-dim); color: var(--dim); }
  .hidden { display: none; }

  /* ---- admin editor ---- */
  .editbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
  .ed-input {
    background: var(--rule); border: 1px solid var(--rule); color: var(--fg);
    font-family: inherit; font-size: 14px; padding: 6px 10px; border-radius: 4px; outline: none;
  }
  .ed-input:focus { border-color: var(--accent-dim); }
  .ed-title { flex: 1 1 240px; }
  .ed-cats { flex: 0 1 220px; }
  .ed-btn {
    background: none; border: 1px solid var(--accent-dim); color: var(--accent);
    font-family: inherit; font-size: 13px; padding: 6px 14px; border-radius: 4px; cursor: pointer;
  }
  .ed-btn:hover { background: var(--accent-dim); color: var(--sel-fg); }
  .ed-del { border-color: var(--dim); color: var(--dim); }
  .ed-del:hover { background: #b33; border-color: #b33; color: #fff; }
  .ed-publish { background: var(--accent-dim); color: var(--sel-fg); }
  .ed-publish:hover { background: var(--accent); }
  .ed-secondary { border-color: var(--dim); color: var(--dim); }
  .ed-secondary:hover { background: var(--dim); color: var(--sel-fg); }
  .draft-tag { color: var(--dim); border: 1px solid var(--rule); font-size: 11px; padding: 0 5px; border-radius: 3px; margin-left: 6px; }
  .ed-status { color: var(--dim); font-size: 13px; }
  .ed-dates { color: var(--dim); font-size: 12px; margin: -6px 0 14px; }
  .ed-confirm { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: -4px 0 16px; }
  .ed-confirm:empty { display: none; }
  .ed-confirm-label { color: var(--dim); font-size: 13px; }
  .ed-pass { flex: 0 0 200px; }
  .posts-prompt { margin: 0 0 12px; }
  .new-btn {
    text-transform: none; color: var(--accent); cursor: pointer; font-size: 12px; margin-left: 12px;
    letter-spacing: 0; border: 1px solid var(--accent-dim); padding: 1px 8px; border-radius: 4px; user-select: none;
  }
  .new-btn:hover { background: var(--accent-dim); color: var(--sel-fg); }
  .editor-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
  .ed-body {
    width: 100%; min-height: 65vh; background: var(--rule); color: var(--fg);
    border: 1px solid var(--rule); border-radius: 6px; padding: 14px;
    font-family: inherit; font-size: 13px; line-height: 1.6; resize: vertical; outline: none;
  }
  .ed-body:focus { border-color: var(--accent-dim); }
  .ed-body.drop { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
  .preview { min-height: 65vh; border: 1px solid var(--rule); border-radius: 6px; padding: 14px 18px; overflow-x: auto; }
  .preview > :first-child { margin-top: 0; }

  /* ---- login ---- */
  .login { margin-top: 10px; }
  .login-line { color: var(--fg); }
  .pass-wrap { display: flex; align-items: center; margin-top: 4px; }
  .pass-input {
    background: none; border: none; color: var(--fg); font-family: inherit;
    font-size: 15px; outline: none; padding: 0; min-width: 240px; caret-color: var(--accent);
  }
  .login-msg { color: #e06c75; margin-top: 16px; min-height: 1.3em; }

  @media (max-width: 700px) { .editor-wrap { grid-template-columns: 1fr; } }
  @media (max-width: 560px) {
    body { font-size: 14px; }
    .wrap { padding: 22px 16px 64px; }
    .postlist a { flex-wrap: wrap; }
    .pdate { flex-basis: 100%; padding-left: 26px; }
  }
