pre.tree-sitter {
  background: #f8f8f8;
  border-left: 0.25rem solid #ddd;
  overflow-x: auto;
  padding: 0.75rem 1rem;
}
pre.tree-sitter code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  white-space: pre;
}
.ts-keyword,
.ts-operator {
  color: #204a87;
  font-weight: 700;
}
.ts-string,
.ts-string-special,
.ts-string-special-key,
.ts-string-regexp {
  color: #4e9a06;
}
.ts-string-escape,
.ts-escape {
  color: #ad7fa8;
}
.ts-comment,
.ts-comment-documentation,
.ts-doc {
  color: #8f5902;
  font-style: italic;
}
.ts-function,
.ts-function-builtin,
.ts-function-method,
.ts-function-macro,
.ts-constructor,
.ts-definition-function,
.ts-definition-method,
.ts-definition-macro {
  color: #5c3566;
}

/* Lace policy roles shared by Interlang and Lacegram. */
.ts-predicate-profile,
.ts-predicate-local {
  color: #005a9c;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.14em;
}
.ts-predicate-helper {
  color: #7a3e9d;
  font-weight: 650;
}
.ts-type,
.ts-type-builtin,
.ts-definition-class,
.ts-definition-interface,
.ts-definition-module,
.ts-module,
.ts-tag,
.ts-tag-error {
  color: #204a87;
}
.ts-property,
.ts-property-builtin,
.ts-attribute,
.ts-variable-parameter {
  color: #ce5c00;
}
/* Lace records distinguish generic application fields from structural framing. */
pre.tree-sitter.lace-record .ts-record-glyph,
pre.tree-sitter.lace-record .ts-record-hash,
pre.tree-sitter.lace-record .ts-record-mark,
pre.tree-sitter.lace-record .ts-record-metadata {
  color: #85888c;
}
pre.tree-sitter.lace-record .ts-record-by {
  color: #2e7d32;
  font-weight: 600;
}
pre.tree-sitter.lace-record .ts-record-field-structural {
  color: #174f78;
  font-weight: 750;
}
pre.tree-sitter.lace-record .ts-record-field-name {
  color: #bf4b00;
  font-weight: 600;
}
pre.tree-sitter.lace-record .ts-record-kind-blob {
  color: #367a43;
  font-weight: 750;
}
pre.tree-sitter.lace-record .ts-record-kind-plex {
  color: #3465a4;
  font-weight: 750;
}
pre.tree-sitter.lace-record .ts-record-kind-seal {
  color: #9a6418;
  font-weight: 750;
}
.ts-variable,
.ts-variable-builtin,
.ts-constant,
.ts-constant-builtin,
.ts-label,
.ts-reference-call,
.ts-reference-class,
.ts-reference-implementation {
  color: #000000;
}

/* Record-reference variables are intentionally the strongest variable style. */
.ts-variable-record,
.ts-variable-special {
  background: #fff0f7;
  border: 1px solid #e8a4c8;
  border-radius: 0.18em;
  color: #9c005d;
  font-weight: 800;
  padding: 0 0.12em;
}
.ts-variable-text {
  color: #006b5b;
  font-style: italic;
}
.ts-number,
.ts-boolean {
  color: #0000cf;
}
.ts-punctuation,
.ts-punctuation-bracket,
.ts-punctuation-delimiter,
.ts-punctuation-special {
  color: #555753;
}
.ts-embedded,
.ts-glimmer,
.ts-import,
.ts-keyframes,
.ts-media,
.ts-namespace,
.ts-supports,
.ts-charset {
  color: #3465a4;
}

/* Make Interlang field names and exact hashes easy to scan. */
pre.tree-sitter.interlang .ts-string-special {
  color: #2e7d32;
  font-weight: 600;
}
pre.tree-sitter.interlang .ts-property {
  color: #bf4b00;
  font-weight: 600;
}
/* Injected Interlang inside JavaScript template strings is nested inside JS string spans. */
pre.tree-sitter.javascript .ts-string .ts-keyword,
pre.tree-sitter.javascript .ts-string .ts-operator {
  color: #8f3f00;
  font-weight: 700;
}
pre.tree-sitter.javascript .ts-string .ts-property,
pre.tree-sitter.javascript .ts-string .ts-function,
pre.tree-sitter.javascript .ts-string .ts-variable,
pre.tree-sitter.javascript .ts-string .ts-string-special {
  color: #7a3e9d;
}

/* Dark mode: the same roles in softer, lighter tones. */
@media (prefers-color-scheme: dark) {
  pre.tree-sitter { background: #232321; border-left-color: #3a3935; }
  /* Pandoc highlights C blocks rather than Tree-sitter. */
  pre:not(.tree-sitter) code span { color: inherit; }
  pre:not(.tree-sitter) code :is(.kw, .cf, .dt, .op, .ot, .bu, .im) { color: #8fb0d9; }
  pre:not(.tree-sitter) code :is(.st, .ch, .sc, .ss, .vs) { color: #a3c48a; }
  pre:not(.tree-sitter) code :is(.co, .an, .cv, .do, .in) { color: #b09a74; }
  pre:not(.tree-sitter) code :is(.bn, .dv, .fl, .cn) { color: #a6a6f0; }
  pre:not(.tree-sitter) code .fu { color: #c4a3d6; }
  pre:not(.tree-sitter) code :is(.at, .pp) { color: #e0a070; }
  pre:not(.tree-sitter) code :is(.al, .er, .wa) { color: #e0a0a0; }
  .ts-keyword, .ts-operator, .ts-type, .ts-type-builtin, .ts-definition-class, .ts-definition-interface,
  .ts-definition-module, .ts-module, .ts-tag, .ts-tag-error { color: #8fb0d9; }
  .ts-string, .ts-string-special, .ts-string-special-key, .ts-string-regexp { color: #a3c48a; }
  .ts-string-escape, .ts-escape { color: #c9a3c4; }
  .ts-comment, .ts-comment-documentation, .ts-doc { color: #b09a74; }
  .ts-function, .ts-function-builtin, .ts-function-method, .ts-function-macro, .ts-constructor,
  .ts-definition-function, .ts-definition-method, .ts-definition-macro { color: #c4a3d6; }
  .ts-predicate-profile, .ts-predicate-local { color: #84b8e0; }
  .ts-predicate-helper { color: #c4a3d6; }
  .ts-property, .ts-property-builtin, .ts-attribute, .ts-variable-parameter { color: #e0a070; }
  pre.tree-sitter.lace-record .ts-record-glyph, pre.tree-sitter.lace-record .ts-record-hash,
  pre.tree-sitter.lace-record .ts-record-mark, pre.tree-sitter.lace-record .ts-record-metadata { color: #8d8f92; }
  pre.tree-sitter.lace-record .ts-record-by, pre.tree-sitter.interlang .ts-string-special { color: #9cc79a; }
  pre.tree-sitter.lace-record .ts-record-field-structural { color: #8fb0d9; }
  pre.tree-sitter.lace-record .ts-record-field-name, pre.tree-sitter.interlang .ts-property { color: #e0a070; }
  pre.tree-sitter.lace-record .ts-record-kind-blob { color: #9cc79a; }
  pre.tree-sitter.lace-record .ts-record-kind-plex { color: #8fb0d9; }
  pre.tree-sitter.lace-record .ts-record-kind-seal { color: #d4ad6a; }
  .ts-variable, .ts-variable-builtin, .ts-constant, .ts-constant-builtin, .ts-label, .ts-reference-call,
  .ts-reference-class, .ts-reference-implementation { color: #d9d7d0; }
  .ts-variable-record, .ts-variable-special { background: #3a2431; border-color: #7a4a63; color: #f0a8cf; }
  .ts-variable-text { color: #7cc4b4; }
  .ts-number, .ts-boolean { color: #a6a6f0; }
  .ts-punctuation, .ts-punctuation-bracket, .ts-punctuation-delimiter, .ts-punctuation-special { color: #9c9a92; }
  .ts-embedded, .ts-glimmer, .ts-import, .ts-keyframes, .ts-media, .ts-namespace, .ts-supports,
  .ts-charset { color: #8fb0d9; }
  pre.tree-sitter.javascript .ts-string .ts-keyword, pre.tree-sitter.javascript .ts-string .ts-operator { color: #e0a070; }
  pre.tree-sitter.javascript .ts-string .ts-property, pre.tree-sitter.javascript .ts-string .ts-function,
  pre.tree-sitter.javascript .ts-string .ts-variable,
  pre.tree-sitter.javascript .ts-string .ts-string-special { color: #c4a3d6; }
}
