/* h6082 — Obsidian dark. Colours, sizes and the font are CSS variables
   generated from content/config.toml (see <style>:root{…}</style> in the HTML and /themes.css). */

@font-face { font-family: "JetBrains Mono"; src: url(/static/fonts/JetBrainsMono-Regular.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(/static/fonts/JetBrainsMono-Bold.woff2) format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(/static/fonts/JetBrainsMono-Italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(/static/fonts/JetBrainsMono-BoldItalic.woff2) format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: var(--scheme, dark); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-family);
  font-size: var(--font-size);
  line-height: var(--line-height);
  -webkit-font-smoothing: antialiased;
}
main { max-width: var(--page-max); margin: 0 auto; padding: var(--pad); }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

/* ---- top bar: header | tabs ……… hidden | about | live ------------------ */
header.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin: 0 0 var(--gap);
  padding: 5px 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.brand { white-space: nowrap; color: var(--muted); }
.brand:has(+ nav.tabs) { padding-right: 12px; border-right: 1px solid var(--border); }
nav.tabs, .topbar .right { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.topbar .right { margin-left: auto; }
.tab {
  padding: 1px 10px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
}
.tab:hover { color: var(--text); text-decoration: none; border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.tab.active { color: var(--text); background: color-mix(in srgb, var(--accent) 16%, var(--bg)); border-color: var(--accent); }
.tab.sub { border-style: dashed; }
.tab.about { font-weight: 700; color: var(--h2); }
.tab.gear { display: inline-grid; place-items: center; padding: 0 2px; color: var(--muted);
  border: 0; background: none; line-height: 1; }
.tab.gear:hover, .tab.gear.active { background: none; }
.tab.gear svg { display: block; transition: transform .4s ease; }
.tab.gear:hover { color: var(--text); }
.tab.gear:hover svg { transform: rotate(45deg); }
/* {{gear}}: the same gear inside text (only the icon) */
.gear-inline { display: inline-block; vertical-align: -.22em; color: var(--muted); line-height: 1; }
.gear-inline svg { display: block; }
.tab.about.gear.active { color: var(--accent); }
.tab.about.active { color: var(--text); }
select.pick {
  font: inherit; color: var(--muted); background: var(--bg);
  border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px);
  padding: 0 4px; cursor: pointer;
}
select.pick:hover, select.pick:focus { color: var(--text); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.live { display: inline-grid; place-items: center; height: 17px; margin-left: 2px; font-size: .7em; line-height: 1;
  color: var(--border); cursor: default; transition: color .3s; }
.live.on { color: color-mix(in srgb, var(--callout-tip) 70%, var(--muted)); }

/* preview in the editor (iframe ?embed=1) */
body.embed main { padding: 8px; max-width: none; }

/* ---- columns (#) and cards (##) ----------------------------------------- */
.grid { display: grid; grid-template-columns: var(--grid-cols); gap: var(--gap); align-items: start; }
.col { display: flex; flex-direction: column; gap: var(--block-gap); min-width: 0; }
/* a tab: rows of columns (`---` starts a new row, [layout] row_gap below the previous one). A column's
   relative width --g comes from its marker (#+ 1.5, #++ 1.75, #- .5, #-- .25, #1.2 …). Columns that do
   not fit wrap to the next line and stretch over the free width. */
.rows { display: flex; flex-direction: column; gap: var(--row-gap); }
.cols { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: flex-start; }
/* --g = the column's weight, --w = its share of the free width (the row's weights scaled so the smallest
   is >= 1). Widths follow the ratio of the weights; a column needs --g × column_min_width before the row wraps. */
.cols > .col {
  --g: 1; --w: var(--g);
  flex: var(--w) 1 calc(var(--gap) * (var(--w) - 1));
  min-width: min(100%, calc(var(--col-basis) * var(--g) + var(--gap) * (var(--g) - 1)));
}
.cols > .col.fixed { flex: 0 0 var(--fw); min-width: 0; max-width: 100%; }   /* #60px */
.col-gap { flex: none; }

.block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--block-pad);
  min-width: 0;
  overflow-wrap: anywhere;   /* long links / words wrap instead of leaving a narrow card (anywhere also lets flex items shrink) */
}
.block > h2 {
  margin: 0 0 4px;
  padding-bottom: 3px;
  font-size: 1em;
  font-weight: 700;
  line-height: 1.3;
  text-transform: var(--block-title-transform);
  letter-spacing: .02em;
  color: var(--h2);
  border-bottom: 1px solid color-mix(in srgb, var(--h2) 30%, transparent);
}
.block > h2:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
/* ## Title {.fill}: the card stretches down to the height of the tallest column in its row */
.cols > .col:has(> .block.fill) { align-self: stretch; }
.block.fill { flex: 1; }
/* ##- / ##+ Title: a click on the title folds the card (▾ open, ▸ folded) */
.block.fold > h2 { cursor: pointer; user-select: none; }
.block.fold > h2::before { content: "▾"; display: inline-block; width: 1.1em; color: var(--muted); }
.block.fold.folded > h2::before { content: "▸"; }
.block.fold.folded > h2 { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.block.fold.folded > :not(h2) { display: none; }
.block.fold > h2:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
/* {{countdown …}} and task due dates (@2026-11-20): the browser writes the text */
time.countdown { font-weight: 700; }
time.due {
  display: inline-block; margin-left: .4em; padding: 0 .45em; border-radius: 999px; font-size: .85em; line-height: 1.5;
  color: var(--muted); background: color-mix(in srgb, var(--muted) 14%, transparent);
}
time.due.soon { color: var(--callout-warning); background: color-mix(in srgb, var(--callout-warning) 16%, transparent); }
time.due.over { color: var(--callout-danger); background: color-mix(in srgb, var(--callout-danger) 16%, transparent); }
.task-list-item:has(> input:checked) > time.due, .task-list-item:has(> p > input:checked) time.due {
  color: var(--muted); background: none;
}
/* ##. Title: a card without frame and background (a column heading, or text straight on the page) */
.block.plain { background: none; border-color: transparent; padding-top: 0; padding-bottom: 0; }
/* a card that is only an image (a banner): no frame, the image keeps the rounded corners */
.block.image-only { background: none; border-color: transparent; padding: 0; }
.block.image-only img { margin: 0 !important; border-radius: var(--radius) !important; }
.block-body > :first-child { margin-top: 0; }
.block-body > :last-child { margin-bottom: 0; }

/* {.mobile} / {.desktop} on a card (## Title {.mobile}) or any element ({: .mobile }): shown only on phones /
   only on larger screens; the same 640px limit at which columns stack */
@media (min-width: 641px) { main .mobile { display: none !important; } }
@media (max-width: 640px) { main .desktop { display: none !important; } }
@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  .cols > .col { flex-basis: 100%; min-width: 0; }
  .cols > .col.fixed { flex-basis: 100%; }   /* #25% / #120px too: one column per line, as documented */
}

/* ---- subheadings (###, ####) ------------------------------------------- */
h3, h4, h5, h6 { line-height: 1.3; font-weight: 700; }
h3 { font-size: .95em; color: var(--h3); margin: 6px 0 1px var(--h3-indent); }
.block-body > section.s3:first-child > h3 { margin-top: 2px; }
.b3 { padding-left: var(--content-indent); }
h4 { font-size: .9em; color: var(--muted); margin: 4px 0 1px; }
h5, h6 { font-size: .85em; color: var(--muted); margin: 3px 0 0; font-weight: 400; }

/* ---- text -------------------------------------------------------------- */
p { margin: 2px 0; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; text-underline-offset: 2px; }
strong { color: var(--text); }
em { color: color-mix(in srgb, var(--text) 85%, var(--accent)); }
del { color: var(--muted); }
mark { background: var(--mark-bg); color: inherit; padding: 0 .15em; border-radius: 2px; }
abbr[title] { text-decoration: underline dotted var(--muted); cursor: help; }
small { color: var(--muted); }
sup, sub { line-height: 0; }
img { max-width: 100%; height: auto; vertical-align: middle; }
hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }

kbd {
  display: inline-block;
  padding: 0 .35em;
  font: inherit;
  font-size: .88em;
  line-height: 1.35;
  color: var(--text);
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 3px;
}
.keys { white-space: nowrap; }

/* [?](hint) / [★](?hint): an icon with a hint on hover or focus (also on touch: tap = focus) */
.tip { position: relative; display: inline-block; cursor: help; line-height: 1; outline: none; }
.tip:is(:hover, :focus, .ld-show)::after {
  content: attr(data-tip);
  position: absolute; left: 50%; bottom: calc(100% + 5px); transform: translateX(-50%); z-index: 20;
  width: max-content; max-width: min(280px, 80vw); padding: 3px 7px;
  font-size: var(--font-size); font-weight: 400; font-style: normal; line-height: 1.35; white-space: pre-line;
  text-align: left;
  color: var(--text); background: var(--panel);
  border: 1px solid var(--border); border-radius: 4px;
  box-shadow: 0 2px 8px rgb(0 0 0 / .25);
  pointer-events: none;
}
.keys > span { margin: 0 .1em; color: var(--muted); }

/* paragraphs inside lists, quotes, callouts and tables: no gap at the edges */
:is(li, dd, blockquote, .callout, .admonition, details, td, th) > p:first-child { margin-top: 0; }
:is(li, dd, blockquote, .callout, .admonition, details, td, th) > p:last-child { margin-bottom: 0; }

/* a line with keys: the key boxes are taller than text, give them room so lines don't touch */
:is(p, li, td):has(> kbd) { line-height: 1.9; }

/* ---- lists ------------------------------------------------------------- */
ul, ol { margin: 2px 0; padding-left: var(--list-indent, 1.6em); }
/* markers sit left of the padding: a numbered list takes [style.list] indent, or more when its widest number
   needs it ("10. " = 2 digits + dot + space; --ol-digits comes from the renderer), so numbers never leave the card */
ol { --ol-digits: 1; padding-left: max(var(--list-indent, 1.6em), calc(var(--ol-digits) * 1ch + 2ch)); }
li { margin: 0; }
li > ul, li > ol { margin: 0; }
ul > li::marker { content: "› "; color: var(--muted); }
ol > li::marker { color: var(--muted); }
ul > li.task-list-item { list-style: none; }
ul > li.task-list-item::marker { content: ""; }
li.task-list-item > input[type="checkbox"] {
  margin: 0 .45em 0 -1.15em;
  vertical-align: -1px;
  accent-color: var(--accent);
  width: .95em; height: .95em;
}

dl { margin: 2px 0; }
dt { color: var(--h3); font-weight: 700; }
dd { margin: 0 0 2px 1em; }

/* ---- code -------------------------------------------------------------- */
code {
  font-family: inherit;
  font-size: .95em;
  color: var(--code-fg);
  background: var(--code-bg);
  padding: 0 .3em;
  border-radius: 3px;
}
/* `code` in a heading: just the code colour, no box (beats [style.code] by specificity) */
main .block :is(h2, h3, h4, h5, h6) code:not(.highlight) {
  padding: 0; background: none; border: 0; border-radius: 0;
  font-size: inherit; font-weight: inherit; color: var(--code-fg);
}
.highlight { margin: 4px 0; border-radius: 4px; overflow-x: auto; border: 1px solid var(--border); }
/* copy button: top right corner, appears on hover / keyboard focus (always faintly on touch screens) */
div.highlight { position: relative; }
.copy-btn {
  position: absolute; top: 4px; right: 4px; z-index: 2;
  display: grid; place-items: center; width: 24px; height: 22px; padding: 0;
  color: var(--muted); background: color-mix(in srgb, var(--code-bg) 85%, var(--panel));
  border: 1px solid var(--border); border-radius: 4px;
  opacity: 0; transition: opacity .15s, color .15s;
}
div.highlight:hover > .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { color: var(--text); border-color: var(--accent); }
.copy-btn.done { opacity: 1; color: var(--callout-tip); border-color: var(--callout-tip); }
.copy-btn.fail { opacity: 1; color: var(--callout-danger); border-color: var(--callout-danger); }
@media (hover: none) { .copy-btn { opacity: .7; } }
.highlight, .highlight pre, .highlighttable { background: var(--code-bg) !important; }
.highlight pre { margin: 0; padding: 5px 8px; line-height: 1.35; white-space: var(--code-ws); overflow-wrap: anywhere; }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.highlight code, pre code { background: none; color: inherit; padding: 0; font-size: .95em; }
code.highlight { border: 0; display: inline; padding: 0 .3em; }
.highlight .hll { background: color-mix(in srgb, var(--accent) 18%, transparent); display: block; }
.highlighttable { border-collapse: collapse; width: 100%; margin: 0; }
.highlighttable td { border: 0; padding: 0; }
.highlighttable .linenos { color: var(--muted); opacity: .6; user-select: none; padding-right: 0; }
.highlighttable .linenos pre { padding-right: 4px; }

/* ---- tables ------------------------------------------------------------ */
table { border-collapse: collapse; width: 100%; margin: 4px 0; font-size: .95em; overflow-wrap: normal; }
th, td { border: 1px solid var(--border); padding: 1px 6px; text-align: left; vertical-align: top; }
th { background: var(--code-bg); color: var(--h3); font-weight: 700; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bg) 40%, transparent); }

/* ---- quotes, callouts, admonitions, details ---------------------------- */
blockquote {
  margin: 4px 0;
  padding: 1px 8px;
  border-left: 3px solid var(--quote-border);
  color: var(--muted);
}

.callout, .admonition, details:not(.pick-dd) {
  --c: var(--callout-note);
  margin: 4px 0;
  padding: 3px 8px;
  border-left: 3px solid var(--c);
  border-radius: 3px;
  background: color-mix(in srgb, var(--c) 10%, transparent);
}
.callout-title, .admonition-title, details:not(.pick-dd) > summary {
  margin: 0;
  color: var(--c);
  font-weight: 700;
}
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details:not(.pick-dd) > summary::before { content: "▸ "; }
details:not(.pick-dd)[open] > summary::before { content: "▾ "; }

.callout-tip,     .admonition:is(.tip, .hint, .important, .success, .check, .done),     details:is(.tip, .hint, .important, .success, .check, .done)     { --c: var(--callout-tip); }
.callout-info,    .admonition:is(.info, .todo, .question, .help, .faq),                  details:is(.info, .todo, .question, .help, .faq)                  { --c: var(--callout-info); }
.callout-warning, .admonition:is(.warning, .caution, .attention),                        details:is(.warning, .caution, .attention)                        { --c: var(--callout-warning); }
.callout-danger,  .admonition:is(.danger, .error, .bug, .failure, .fail, .missing),      details:is(.danger, .error, .bug, .failure, .fail, .missing)      { --c: var(--callout-danger); }

/* ---- footnotes --------------------------------------------------------- */
.footnote { margin-top: 6px; font-size: .85em; color: var(--muted); }
.footnote hr { margin: 4px 0; }
.footnote-ref a, .footnote-backref { color: var(--accent); }

/* ---- forms ------------------------------------------------------------- */
button, input {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 1px 8px;
}
button { cursor: pointer; }
button:hover { border-color: var(--accent); }
input:focus, button:focus-visible, textarea:focus { outline: 1px solid var(--accent); outline-offset: -1px; }
form.newfile { display: flex; align-items: center; gap: 4px; margin: 4px 0; }
form.newfile input { flex: 1; min-width: 0; }
form.newfile span { color: var(--muted); }

/* ---- editor ------------------------------------------------------------ */
body.editing main { max-width: none; height: 100vh; display: flex; flex-direction: column; }
.editor { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.ed-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.ed-name { color: var(--h2); font-weight: 700; }
.ed-right { margin-left: auto; display: flex; gap: 4px; }
#conflict { display: inline-flex; gap: 4px; }
#conflict[hidden] { display: none; }
.st { color: var(--muted); font-size: .9em; }
.st.ok { color: var(--callout-tip); }
.st.pending { color: var(--muted); }
.st.warn { color: var(--callout-warning); }
.st.err { color: var(--callout-danger); font-weight: 700; }
.ed-panes { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, var(--ed-left, 1fr)) var(--gap) minmax(0, 1fr); }
.ed-panes > :only-child, .ed-panes.no-preview > .ed-src { grid-column: 1 / -1; }
.ed-panes.no-preview > .ed-split, .ed-panes.no-preview > iframe { display: none; }
/* the divider between the editor and the preview: drag, double-click, arrow keys */
.ed-split { position: relative; cursor: col-resize; touch-action: none; }
.ed-split::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px;
  border-radius: 1px; background: transparent; transition: background .15s;
}
.ed-split:hover::after, .ed-split:focus-visible::after, .ed-panes.dragging .ed-split::after { background: var(--accent); }
.ed-split:focus { outline: none; }
.ed-panes.dragging { cursor: col-resize; user-select: none; }
.ed-panes.dragging iframe { pointer-events: none; }
.ed-acts, .ed-langs { display: flex; gap: 4px; }
.ed-langs .tab.active { cursor: default; }
button.tab.danger:hover { color: var(--callout-danger); border-color: var(--callout-danger); }
button.tab { padding: 1px 10px; color: var(--muted); }
button.tab:hover { color: var(--text); }
button.tab[aria-pressed="true"] { color: var(--text); background: color-mix(in srgb, var(--accent) 16%, var(--bg)); border-color: var(--accent); }
.ed-panes iframe {
  width: 100%; height: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
/* source: the coloured <pre> under a textarea with transparent text — identical metrics */
.ed-src { position: relative; min-width: 0; min-height: 0; height: 100%; }
.ed-src > textarea, .ed-src > pre {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
  padding: 8px 10px;
  font: inherit; font-weight: 400; font-style: normal; line-height: 1.5; letter-spacing: normal;
  tab-size: 4; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal;
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: auto; scrollbar-gutter: stable;
}
.ed-src > pre { overflow: hidden; background: var(--panel); color: var(--text); pointer-events: none; }
.ed-src > textarea {
  z-index: 1; resize: none; background: transparent;
  color: transparent; -webkit-text-fill-color: transparent; caret-color: var(--text);
}
.ed-src > textarea.plain { color: var(--text); -webkit-text-fill-color: currentColor; background: var(--panel); }
.ed-src > textarea::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
.ed-src > textarea:disabled { cursor: progress; }
/* line numbers (the button in the bar): a gutter inside both layers; each number sits at the start of
   its source line (absolute with a static top), wrapped continuation lines get none */
.ed-src.nums > textarea, .ed-src.nums > pre { padding-left: calc(10px + 3.4em); }
.ed-src.nums > pre { counter-reset: ln; }
.ed-src.nums > pre .ln::before {
  counter-increment: ln; content: counter(ln); position: absolute; left: 0; width: 3em;
  text-align: right; color: var(--muted); opacity: .55; font-style: normal; font-weight: 400;
}
/* icon buttons in the editor bar (rename, delete, line numbers) */
button.tab.icon { display: inline-grid; place-items: center; padding: 1px 7px; }
button.tab.icon svg { display: block; }
/* editor: tab hidden from the bar ([tabs] hidden) — crossed eye, highlighted; open eye = shown in the bar */
#hide .i-on, #hide[aria-pressed="true"] .i-off { display: none; }
#hide[aria-pressed="true"] .i-on { display: block; }
#hide[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.ed-hl .h-col     { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.ed-hl .h-h2      { color: var(--h2); }
.ed-hl .h-h3      { color: var(--h3); }
.ed-hl .h-comment, .ed-hl .h-gap, .ed-hl .h-fence, .ed-hl .h-hr, .ed-hl .h-punct, .ed-hl .h-html, .ed-hl .h-attr { color: var(--muted); }
.ed-hl .h-comment { opacity: .75; }
.ed-hl .h-code, .ed-hl .h-kbd, .ed-hl .h-str { color: var(--code-fg); }
.ed-hl .h-b       { color: var(--text); background: color-mix(in srgb, var(--text) 8%, transparent); }
.ed-hl .h-i       { color: color-mix(in srgb, var(--text) 70%, var(--accent)); }
.ed-hl .h-s       { color: var(--muted); text-decoration: line-through; }
.ed-hl .h-mark    { background: var(--mark-bg); }
.ed-hl .h-link, .ed-hl .h-tip { color: var(--link); }
.ed-hl .h-url     { color: var(--muted); }
.ed-hl .h-li, .ed-hl .h-task { color: var(--h3); }
.ed-hl .h-key { color: var(--link); }
.ed-hl .h-quote   { color: var(--quote-border); }
.ed-hl .h-callout { color: var(--callout-note); }
.ed-hl .h-sc      { color: var(--callout-info); }
.ed-hl .h-num     { color: var(--callout-warning); }
.ed-panes iframe { background: var(--bg); }
@media (max-width: 900px) {
  body.editing main { height: auto; }
  .ed-panes { grid-template-columns: 1fr; gap: var(--gap); }
  .ed-panes > .ed-split { display: none; }
  .ed-panes .ed-src { height: 60vh; }
  .ed-panes iframe { height: 60vh; }
}

/* ---- service status (links with {.check} / {check="tcp://…"}) ---------- */
a[data-check]::before {
  content: "●";
  display: inline-block;
  width: 1.1em;
  font-size: .8em;
  color: var(--border);
  transition: color .3s;
}
a[data-check][data-state="up"]::before   { color: var(--callout-tip); }
a[data-check][data-state="warn"]::before { color: var(--callout-warning); }
a[data-check][data-state="down"]::before { color: var(--callout-danger); }
/* a list item that starts with a status dot: the dot is its bullet (no › right next to it) */
li:has(> a[data-check]:first-child) { list-style: none; }
li:has(> a[data-check]:first-child)::marker { content: ""; }
li:has(> a[data-check]:first-child) > a[data-check]:first-child::before { margin-left: -1.1em; }

/* ---- RSS --------------------------------------------------------------- */
.rss-list li small { color: var(--muted); }
/* the age and 💬 stay together at the end of the title */
.rss-list li small, .rss-list a.rss-c { white-space: nowrap; }
.rss-list a.rss-c { color: var(--muted); }
.rss-list a.rss-c:hover { color: var(--link-hover); text-decoration: none; }
.rss-err { color: var(--callout-danger); }

/* ---- file list ({{files}}): name, then view / edit buttons ------------- */
.files { display: flex; flex-direction: column; margin: 4px 0; }
.file-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; border-bottom: 1px dashed color-mix(in srgb, var(--border) 60%, transparent); }
.file-row:last-child { border-bottom: 0; }
.file-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.file-name small { color: var(--muted); margin-left: 4px; }
.file-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.file-btns .tab { padding: 0 8px; font-size: .85em; }
.file-desc { display: block; margin: 1px 0 0; color: var(--muted); font-size: .85em; }
.file-name small.file-desc { margin-left: 0; }
/* several line shortcodes on one line ({{lang}} {{theme}}): side by side, wrapping on narrow screens */
.sc-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 16px; }
.sc-cell { min-width: 0; }
/* {{sys auto}} / {{history auto}} with the feature off: a note under the sample data */
.sample-note { display: block; margin-top: 4px; color: var(--muted); }
/* the system list (documentation, configuration, markdown): bigger, easier to hit */
.files-system .file-row { padding: 10px 0; gap: 12px; }
.file-row[hidden] { display: none; }   /* demo: a page deleted in the visitor's browser */
.files-system .file-name { font-size: 1.45em; font-weight: 700; line-height: 1.2; color: var(--text); }
.files-system .file-desc { margin-top: 2px; font-size: .58em; font-weight: 400; line-height: 1.3; }
.files-system .file-btns { flex-wrap: nowrap; }
.files-system .file-btns .tab { font-size: 1.3em; padding: 3px 14px; white-space: nowrap; }

/* ---- theme picker ({{theme}}) ------------------------------------------ */
.themes-pick { display: flex; flex-direction: column; gap: 6px; margin: 4px 0; }
/* {{theme}} / {{lang}} as drop-downs: the closed box shows the current choice, the list opens over the page */
details.pick-dd { position: relative; display: inline-block; margin: 2px 0; }
details.pick-dd > summary { list-style: none; cursor: pointer; padding: 3px 22px 3px 6px; margin: 0; position: relative; font-weight: normal; }
details.pick-dd > summary::-webkit-details-marker { display: none; }
details.pick-dd > summary::after { content: "▾"; position: absolute; right: 7px; opacity: .7; }
details.pick-dd[open] > summary::after { content: "▴"; }
details.theme-dd > summary { min-width: 190px; color: var(--sw-text); }
details.lang-dd > summary { min-width: 120px; padding-left: 12px; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px); }
details.lang-dd > summary:hover, details.lang-dd[open] > summary { border-color: var(--accent); }
.pick-list { position: absolute; z-index: 30; left: 0; top: calc(100% + 4px); margin: 0; max-width: calc(100vw - 32px);
  max-height: min(70vh, 460px); overflow: auto; padding: 8px; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgb(0 0 0 / .35); }
.pick-list.to-left { left: auto; right: 0; }
/* themes: Auto on top, then two columns, dark | light */
.theme-dd .pick-list { width: 400px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; align-items: start; }
.theme-dd .pick-list > .swatch.auto { grid-column: 1 / -1; }
.theme-dd .pick-list .sw-grid { grid-template-columns: 1fr; }
.theme-dd .pick-list { max-height: min(80vh, 640px); }/* languages: one per line */
.lang-dd .pick-list { display: flex; flex-direction: column; gap: 4px; min-width: 100%; }
.lang-dd .pick-list .lang-btn { text-align: left; }
/* in the top bar of the settings page: a bit smaller, the lists open towards the page */
.top-pickers { display: inline-flex; align-items: center; gap: 6px; }
.top-pickers details.pick-dd { margin: 0; }
.top-pickers details.theme-dd > summary { min-width: 150px; font-size: .85em; }
.top-pickers details.lang-dd > summary { min-width: 96px; font-size: .85em; padding-top: 2px; padding-bottom: 2px; }
.top-pickers .pick-list { left: auto; right: 0; text-align: left; }
.top-pickers details.pick-dd > summary { text-align: left; }
.sw-group > small { display: block; margin-bottom: 2px; }
.sw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 4px; }
.swatch {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 6px;
  text-align: left;
  font-size: .9em;
  color: var(--sw-text);
  background: var(--sw-bg);
  border: 1px solid color-mix(in srgb, var(--sw-text) 20%, var(--sw-bg));
  border-radius: calc(var(--radius) - 2px);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.swatch.auto { width: max-content;
  --sw-bg: var(--swd-bg); --sw-panel: var(--swd-panel); --sw-text: var(--swd-text); --sw-accent: var(--swd-accent); --sw-link: var(--swd-link); }
@media (prefers-color-scheme: light) {   /* auto looks like the theme it shows right now */
  .swatch.auto { --sw-bg: var(--swl-bg); --sw-panel: var(--swl-panel); --sw-text: var(--swl-text); --sw-accent: var(--swl-accent); --sw-link: var(--swl-link); }
}
/* the dots: dark accent · light accent · the other scheme's background */
.swatch.auto .sw-dots i:nth-child(1) { background: var(--swd-accent); }
.swatch.auto .sw-dots i:nth-child(2) { background: var(--swl-accent); }
.swatch.auto .sw-dots i:nth-child(3) { background: var(--swl-bg); }
@media (prefers-color-scheme: light) { .swatch.auto .sw-dots i:nth-child(3) { background: var(--swd-bg); } }
.swatch:hover { border-color: var(--sw-accent); }
.swatch.active { outline: 2px solid var(--accent); outline-offset: 1px; }
.sw-dots { display: inline-flex; gap: 2px; flex: none; }
.sw-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--sw-accent); }
.sw-dots i:nth-child(2) { background: var(--sw-link); }
.sw-dots i:nth-child(3) { background: var(--sw-panel); border: 1px solid color-mix(in srgb, var(--sw-text) 30%, transparent); }

/* ---- server stats ({{sys}}) -------------------------------------------- */
/* one shared grid for all rows: label | bar | value (so all bars have the same length) */
.sys { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2px 8px; margin: 2px 0; }
.sys-row { display: contents; }
.sys-row:not(:has(.sys-bar)) .sys-v { grid-column: span 2; }
.sys-l { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sys-v { white-space: nowrap; font-variant-numeric: tabular-nums; }
.sys-row:not(:has(.sys-bar)) .sys-v { white-space: normal; }
.sys-bar { height: 6px; background: var(--code-bg); border: 1px solid var(--border); border-radius: 3px; overflow: hidden; }
.sys-bar i { display: block; height: 100%; background: var(--accent); transition: width .6s; }
.sys-bar.high i { background: var(--callout-warning); }
.sys-bar.crit i { background: var(--callout-danger); }

/* ---- change history ---------------------------------------------------- */
/* in a card {{history}} is an ordinary list (same indent and bullet as RSS and other lists);
   the version list on the history page is plain: no bullet, no indent */
.grid.hist .hist-list { list-style: none; padding-left: 0; }
.grid.hist .hist-list.hist-list > li::marker { content: ""; }
.hist-list li.cur { background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 3px; }
.hist-list small, .hist-list time { color: var(--muted); }
.h-add { color: var(--callout-tip); }
.h-del { color: var(--callout-danger); }
.grid.hist { grid-template-columns: minmax(220px, 1fr) minmax(0, 2.5fr); }
@media (max-width: 800px) { .grid.hist { grid-template-columns: 1fr; } }
.hist-nav { margin: 0 0 8px; }
pre.diff {
  margin: 4px 0;
  padding: 6px 8px;
  overflow-x: auto;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  line-height: 1.35;
  white-space: var(--code-ws);
  overflow-wrap: anywhere;
}
pre.diff span { display: block; }
pre.diff .dh { color: var(--muted); }
pre.diff .hk { color: var(--callout-info); }
pre.diff .da { color: var(--callout-tip); background: color-mix(in srgb, var(--callout-tip) 10%, transparent); }
pre.diff .dd { color: var(--callout-danger); background: color-mix(in srgb, var(--callout-danger) 10%, transparent); }

/* ---- note ({{note}}) --------------------------------------------------- */
.note-box { margin: 2px 0; }
textarea.note-area {
  display: block;
  width: 100%;
  min-height: 3.2em;
  resize: none;            /* grows downwards only, with its content (JS) */
  overflow: hidden;
  padding: 4px 6px;
  font: inherit;
  line-height: var(--line-height);
  color: var(--text);
  background: color-mix(in srgb, var(--bg) 60%, var(--panel));
  border: 1px solid transparent;
  border-radius: 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
textarea.note-area:hover { border-color: var(--border); }
textarea.note-area:focus { border-color: var(--accent); outline: none; }
textarea.note-area[readonly] { cursor: default; }
.note-st { display: block; min-height: 1em; font-size: .8em; color: var(--muted); text-align: right; }
.note-st.ok { color: var(--callout-tip); }
.note-st.err { color: var(--callout-danger); }

/* ---- editable tasks ---------------------------------------------------- */
li.task-list-item { position: relative; }
li.task-list-item > input.task { cursor: pointer; }
button.task-del {
  position: absolute; right: 0; top: 0;
  padding: 0 4px;
  font-size: .75em;
  line-height: 1.5;
  color: var(--muted);
  background: transparent;
  border: 0;
  opacity: 0;
  transition: opacity .15s;
}
li.task-list-item:hover > button.task-del, button.task-del:focus { opacity: 1; }
button.task-del:hover { color: var(--callout-danger); }
ul > li.task-add, ol > li.task-add { list-style: none; }
ul > li.task-add::marker, ol > li.task-add::marker { content: ""; }
form.task-add input {
  width: 100%;
  margin: 1px 0 0 -2px;
  padding: 0 4px;
  font-size: .95em;
  color: var(--text);
  background: transparent;
  border: 1px dashed transparent;
}
form.task-add input:hover { border-color: var(--border); }
form.task-add input:focus { border-color: var(--accent); border-style: solid; }
form.task-add input::placeholder { color: var(--muted); opacity: .7; }

/* ---- images in cards --------------------------------------------------- */
/* an image alone in a paragraph = full card width (hero, banner, screenshot) */
.block-body p > img:only-child:not([width]) { display: block; width: 100%; border-radius: 4px; margin: 2px 0 6px; }

/* ---- language picker ({{lang}}) ---------------------------------------- */
.lang-pick { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.lang-btn { padding: 2px 12px; }
.lang-btn.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--bg)); color: var(--text); }

/* ---- links to http:// (unencrypted) ------------------------------------ */
a.insecure::after {
  content: "⚠";
  margin-left: .2em;
  font-size: .8em;
  color: var(--callout-warning);
}

/* ---- author card (h6082 page) ------------------------------------------ */
.author { display: flex; align-items: center; gap: 12px; margin: 2px 0 8px; }
.author-avatar {
  flex: none; width: 52px; height: 52px; border-radius: 50%; overflow: hidden;
  background: linear-gradient(135deg, var(--accent), var(--h3));
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px color-mix(in srgb, var(--accent) 45%, transparent);
}
.author-avatar img, .author-avatar p { display: block; width: 100%; height: 100%; margin: 0; }
.author-avatar img { object-fit: cover; }
.author-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.author-body p { margin: 0; }
.author-name { display: block; font-size: 1.15em; font-weight: 700; line-height: 1.2; color: var(--text); }
.author-role { display: block; color: var(--muted); font-size: .9em; line-height: 1.2; }
.author-body br { display: none; }
.author-links { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.author-links > p { display: contents; }
.author-links a {
  padding: 0 8px; font-size: .9em; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; background: var(--bg);
}
.author-links a:hover { color: var(--text); text-decoration: none; border-color: var(--accent); }
.license { color: var(--muted); font-size: .9em; }
.license strong { color: var(--text); }

/* ---- ##* cards edited in place ------------------------------------------- */
.block.editable { position: relative; }
.block.editable > h2 { padding-right: 26px; }
.block-edit {
  position: absolute; top: 4px; right: 6px; z-index: 2;
  display: grid; place-items: center; width: 22px; height: 20px; padding: 0;
  color: var(--muted); background: var(--panel); border: 1px solid transparent; border-radius: 4px;
  opacity: 0; transition: opacity .15s, color .15s;
}
.block.editable:hover > .block-edit, .block-edit:focus-visible { opacity: 1; }
.block-edit:hover { color: var(--text); border-color: var(--accent); }
.block.editing > .block-edit { display: none; }
@media (hover: none) { .block-edit { opacity: .6; } }
.block-form { margin-top: 2px; }
textarea.block-src {
  display: block; width: 100%; min-height: 4.5em; resize: vertical; overflow: hidden;
  padding: 6px 8px; font: inherit; line-height: 1.5; tab-size: 4; white-space: pre-wrap;
  color: var(--text); background: var(--bg);
  border: 1px solid color-mix(in srgb, var(--accent) 60%, var(--border)); border-radius: 4px;
}
textarea.block-src:focus { outline: none; border-color: var(--accent); }
.block-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 5px; }
.block-bar small { margin-right: auto; }
.block-bar button.primary { color: var(--text); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--bg)); }

/* ---- helper classes for {: .class } attributes in md ------------------------ */
main .center { text-align: center; }
main .right { text-align: right; }
/* sizes win over the heading sizes from [style.h2] … (the card title rule comes later in <head>) */
main :is(.big, .block > .big) { font-size: 1.3em; line-height: 1.35; }
main :is(.huge, .block > .huge) { font-size: 1.6em; line-height: 1.3; }
main :is(.small, .block > .small) { font-size: .85em; }
main .muted { color: var(--muted); }

/* ---- demo mode (H6082_DEMO) ------------------------------------------------ */
.demo-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 var(--gap); padding: 5px 10px;
  font-size: .9em; color: var(--bg); background: var(--accent);
  border: 1px solid var(--accent); border-radius: var(--radius);
}
.demo-bar strong { font-weight: 700; }
.demo-bar .demo-count { opacity: .85; }
.demo-bar button {
  margin-left: auto; color: var(--bg); background: transparent; border: 1px solid var(--bg);
  border-radius: 4px; padding: 2px 10px; cursor: pointer; font: inherit;
}
.demo-bar button:hover { background: color-mix(in srgb, var(--bg) 20%, transparent); }
[data-demo-off] { opacity: .45; cursor: not-allowed; }
[data-demo-off] :is(input, button) { cursor: not-allowed; }
.demo-note {   /* a floating notice (demo: config.toml is read-only) */
  position: fixed; z-index: 70; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; max-width: min(520px, calc(100vw - 32px)); padding: 8px 8px 8px 14px;
  color: var(--text); background: var(--panel); border: 1px solid var(--callout-warning);
  border-left-width: 4px; border-radius: var(--radius); box-shadow: 0 4px 16px rgb(0 0 0 / .3);
}
.demo-note button { margin-left: auto; padding: 0 8px; font: inherit; font-size: 1.2em; line-height: 1.4;
  color: var(--muted); background: transparent; border: 0; cursor: pointer; }
.demo-note button:hover { color: var(--text); }
.demo-tip {
  position: fixed; z-index: 70; max-width: min(280px, 80vw); padding: 3px 8px; pointer-events: none;
  font-size: .9em; color: var(--text); background: var(--panel); border: 1px solid var(--callout-warning);
  border-radius: 4px; box-shadow: 0 2px 8px rgb(0 0 0 / .25);
}

/* ---- {{livedemo}}: an editor window writing markdown, a mouse editing the page below ---- */
.livedemo { display: flex; flex-direction: column; gap: 12px; margin: 4px 0; }
.ld-win {
  position: relative; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  background: var(--panel); box-shadow: 0 8px 26px rgb(0 0 0 / .18); transition: box-shadow .3s, border-color .3s;
}
/* the time line of the demo at the bottom of the window: click = jump there */
.ld-prog { position: relative; height: 12px; margin-top: -12px; z-index: 2; cursor: pointer; }
.ld-prog::before, .ld-prog > i { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; transition: height .15s; }
.ld-prog::before { right: 0; background: color-mix(in srgb, var(--border) 70%, transparent); }
.ld-prog > i { width: 0; background: var(--accent); }
.ld-prog:hover::before, .ld-prog:hover > i { height: 6px; }
.livedemo { cursor: pointer; }
/* the window icon: the demo as a floating card over the page (editor | preview), the page dimmed but
   still a little visible around it; ✕, Esc or a click beside it closes */
.ld-max-btn { padding: 0 8px; color: var(--muted); background: none; display: inline-grid; place-items: center; align-self: stretch; }
.ld-max-btn:hover { color: var(--text); }
.ld-max-btn[hidden] { display: none; }
.ld-max-btn svg { display: block; }
.ld-max-btn .i-unmax, .livedemo.ld-max .ld-max-btn .i-max { display: none; }
.livedemo.ld-max .ld-max-btn .i-unmax { display: block; }
.livedemo.ld-max {
  position: fixed; inset: 6vh 5vw; z-index: 1000; margin: 0; padding: 14px; background: var(--bg);
  border: 1px solid var(--border); border-radius: calc(var(--radius) * 2);
  box-shadow: 0 24px 70px rgb(0 0 0 / .55);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; font-size: 1rem;
}
body.ld-max-open::after {
  content: ""; position: fixed; inset: 0; z-index: 999; background: rgb(0 0 0 / .5); backdrop-filter: blur(2px);
}
.livedemo.ld-max .ld-win { display: flex; flex-direction: column; min-height: 0; }
.livedemo.ld-max .ld-src { display: block; flex: 1; height: auto; }
.livedemo.ld-max .ld-stage { min-height: 0; }
.livedemo.ld-max .ld-preview { height: 100%; max-height: none; }
body.ld-max-open { overflow: hidden; }
@media (max-width: 640px) {
  .livedemo.ld-max { inset: 3vh 3vw; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 2fr) minmax(0, 3fr); }
}
.ld-missing { color: var(--callout-warning); font-size: .9em; }
/* {{examples}} (markdown page header): a button to /examples and the switch for its tab in the bar */
.examples-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
/* markdown page: the examples tab and its switch, tied together by a soft dashed frame */
.ex-group { display: inline-flex; align-items: center; gap: 8px; padding: 1px 8px 1px 1px;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent); border-radius: var(--radius); }
.ex-group .examples-switch { font-size: .9em; }
.ex-group:not(:has(input:checked)) > a.tab { opacity: .55; }
.examples-switch { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; }
.examples-switch input { accent-color: var(--accent); cursor: pointer; }
.examples-switch[aria-disabled="true"], .examples-switch:has(input:disabled) { opacity: .6; cursor: default; }
/* ```md live: a mini demo right under a code example, small and with a fixed size */
.livedemo.mini { gap: 6px; margin: 2px 0 8px; font-size: .85em; }
/* small: only the preview, no buttons; a click anywhere enlarges it to the floating card */
.livedemo.mini:not(.ld-max) .ld-win { display: none; }
.livedemo.mini:not(.ld-max) { cursor: zoom-in; }
.livedemo.mini:not(.ld-max) .ld-preview { height: 13em; padding: 8px; }
/* [text](#scene:file.md): a link that plays a scene; the one playing now is marked */
a[href^="#scene:"].ld-cur { color: var(--accent); font-weight: 700; }
.livedemo.ld-paused .ld-caret { animation: none; }
.ld-win.ld-sync { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent), 0 8px 26px rgb(0 0 0 / .18); }
.ld-bar {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px;
  background: color-mix(in srgb, var(--border) 45%, var(--panel)); color: var(--muted); font-size: .85em;
}
.ld-bar i { width: 10px; height: 10px; border-radius: 50%; background: #ff5f57; }
.ld-bar i:nth-child(2) { background: #febc2e; }
.ld-bar i:nth-child(3) { background: #28c840; }
.ld-file { margin-left: 6px; }
.ld-saved { margin-left: 12px; font-style: normal; color: var(--accent); opacity: 0; transition: opacity .3s; }
.ld-saved.on { opacity: 1; }
.ld-toggle, .ld-skip, .ld-loop { padding: 0 8px; font-size: .85em; color: var(--muted); background: none; }
.ld-loop { margin-left: auto; }
.ld-skip, .ld-loop { display: inline-grid; place-items: center; align-self: stretch; }
.ld-skip svg, .ld-loop svg { display: block; }
.ld-skip:hover, .ld-toggle:hover, .ld-loop:hover { color: var(--text); }
.ld-loop[aria-pressed="true"] { color: var(--accent); }
.ld-skip[hidden], .ld-loop[hidden] { display: none; }
.ld-src {
  position: relative; margin: 0; height: max(8em, 28vh); height: max(8em, 28svh); overflow: hidden; padding: 10px 12px;
  font: inherit; line-height: 1.5; white-space: pre-wrap; overflow-wrap: break-word; color: var(--text);
}
.ld-chg { background: color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 3px; animation: ld-in 1.2s ease; }
.ld-caret {
  display: inline-block; width: .55em; height: 1.15em; margin-left: 1px; vertical-align: -.2em;
  background: var(--accent); animation: ld-blink 1s steps(1) infinite;
}
@keyframes ld-blink { 50% { opacity: 0; } }
.ld-stage { position: relative; }
.ld-preview {
  --col-basis: 150px; padding: 12px; font-size: .9em;
  /* window + preview fit the browser height; the preview scrolls (by itself to where something happens) */
  height: max(12em, 44vh); height: max(12em, 44svh); overflow-y: auto; overscroll-behavior: contain;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: var(--radius);
  background: var(--bg);
}
.ld-preview { --gap: 10px; }   /* columns in the preview: a smaller gap, the width maths uses the same */
/* rows (---) in the preview: the same space as between its columns */
.ld-view:has(> .cols) { display: flex; flex-direction: column; gap: 10px; }
.ld-preview .block { animation: ld-in .35s ease; }
.ld-preview input[type=checkbox]:disabled { opacity: 1; }
.ld-preview .block-edit { opacity: .45; }
.ld-preview div.highlight.ld-hover > .copy-btn { opacity: 1; }
.ld-preview .block.ld-hover > .block-edit { opacity: 1; border-color: var(--accent); color: var(--text); }
.ld-preview textarea { field-sizing: content; }
.ld-preview textarea.ld-focus, .ld-preview input.ld-focus { border-color: var(--accent); }
.ld-mouse {
  position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; opacity: 0;
  translate: 60% 90%; transition: translate calc(.8s / var(--ld-speed, 1)) cubic-bezier(.45, .05, .25, 1), opacity .3s;   /* not transform: scale must not move it */
  fill: var(--text); stroke: var(--bg); stroke-width: 1.5; filter: drop-shadow(0 2px 3px rgb(0 0 0 / .35));
}
.ld-mouse.on { opacity: 1; }
.ld-mouse.down { scale: .85; }
.ld-ripple {
  position: absolute; left: -14px; top: -14px; width: 28px; height: 28px; border-radius: 50%; z-index: 2;
  pointer-events: none; border: 2px solid var(--accent); animation: ld-ripple .6s ease-out forwards;
}
@keyframes ld-ripple { from { opacity: .9; scale: .3; } to { opacity: 0; scale: 1.6; } }
@keyframes ld-in { from { opacity: .4; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ld-caret, .ld-preview .block, .ld-chg { animation: none; } }

/* ---- editor suggestions: a list under the caret (Enter / Tab confirm, Esc closes) ------------- */
.sg-box {
  position: fixed; z-index: 60; min-width: 240px; max-width: min(460px, 92vw); max-height: 260px; overflow-y: auto;
  padding: 3px; font-size: .9em; background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 6px 20px rgb(0 0 0 / .28);
}
.sg-item { display: flex; align-items: baseline; gap: 12px; padding: 3px 8px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.sg-item code { background: none; padding: 0; color: var(--text); }
.sg-item small { margin-left: auto; color: var(--muted); }
.sg-item.on { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.sg-item.on code { color: var(--accent); }
.ld-sg { position: absolute; min-width: 0; max-width: 92%; font-size: .85em; pointer-events: none; }
