/* Shared repository-style source presentation; no remote font dependency. */
:root {
  --code-font: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --code-bg: #191721;
  --code-toolbar: #262330;
  --code-text: #f1edf8;
  --code-muted: #c1bbd1;
  --code-border: #454052;
}

.repo-code, .repo-diff pre, .code-editor, .code-highlight, .live-code-output {
  font-family: var(--code-font);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: normal;
  font-variant-ligatures: none;
  tab-size: 2;
  background: var(--code-bg);
  color: var(--code-text);
  color-scheme: dark;
}

.repo-file, .repo-diff, .code-area, .live-code-panel {
  background: var(--code-bg);
  color: var(--code-text);
  border-color: var(--code-border);
}

.repo-file-heading, .code-file, .live-code-heading {
  font-family: var(--code-font);
  font-size: 12px;
  background: var(--code-toolbar);
  color: var(--code-muted);
  border-color: var(--code-border);
}
.repo-file-heading strong, .code-file>span:first-child,
.live-code-heading>span:first-child { color: var(--code-text); }
.live-code-heading>span:last-child { color: var(--code-muted); }

.code-actions, .live-code-actions, .live-progress-row {
  background: var(--code-toolbar);
  border-color: var(--code-border);
  color: var(--code-muted);
}
.live-code-note { color: var(--code-muted); }
.live-progress-row progress, .live-progress-row progress::-webkit-progress-bar {
  background: var(--code-border);
}
.code-editor { caret-color: var(--code-text); }
.code-editor:focus-visible, .live-code-output:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: -3px;
}
.repo-code::selection, .repo-diff pre span::selection,
.code-editor::selection, .live-code-output::selection {
  background: #554676;
  color: #ffffff;
}
.repo-diff .diff-add { background: #30321d; color: #d8e7a3; }
.repo-diff .diff-remove { background: #43231c; color: #ffc4aa; }

@media(max-width:700px) {
  .repo-code, .repo-diff pre, .code-editor, .code-highlight, .live-code-output { font-size: 12px; }
}

/* B4U syntax: yellow keywords, lilac properties and lime strings on graphite. */
.syntax-tag, .syntax-keyword, .syntax-heading { color:#ffdf75; }
.syntax-property { color:#cab9ff; }
.syntax-string, .syntax-entity { color:#dcf59b; }
.syntax-number { color:#ffcb91; }
.syntax-comment { color:#b7aebf; font-style:italic; }
.syntax-punctuation { color:#c7bfd5; }

.repo-file-heading .diff-count-add { color:#d8e7a3; font-weight:500; }
.repo-file-heading .diff-count-remove { color:#ffc4aa; font-weight:500; }
.repo-diff pre>.diff-line { display:grid; grid-template-columns:4ch 3ch minmax(0,1fr); padding:0 12px 0 0; border-left:3px solid transparent; }
.repo-diff pre>.diff-add { border-left-color:#d0d88b; }
.repo-diff pre>.diff-remove { border-left-color:#ed9979; }
.diff-number { text-align:right; padding-right:8px; color:var(--code-muted); user-select:none; border-right:1px solid var(--code-border); }
.diff-sign { text-align:center; font-weight:700; }
.diff-source { white-space:pre-wrap; overflow-wrap:anywhere; }

/* Keep the native textarea as the only editable and accessible source. */
.code-editor-stack { position:relative; min-height:420px; height:480px; resize:vertical; overflow:hidden; background:var(--code-bg); }
.code-editor-stack .code-editor, .code-editor-stack .code-highlight {
  position:absolute; inset:0; width:100%; height:100%; min-height:0; margin:0;
  padding:19px; border:0; border-radius:0; box-sizing:border-box;
  white-space:pre; overflow:auto; overflow-wrap:normal; resize:none;
}
.code-editor-stack .code-highlight { pointer-events:none; }
.code-editor-stack .code-editor { background:transparent; color:transparent; -webkit-text-fill-color:transparent; caret-color:#ffdf75; }
.code-editor-stack .code-editor::selection { background:#765022; color:transparent; -webkit-text-fill-color:transparent; }
@media(forced-colors:active) {
  .code-editor-stack .code-highlight { display:none; }
  .code-editor-stack .code-editor { color:CanvasText; -webkit-text-fill-color:CanvasText; background:Canvas; caret-color:CanvasText; }
}
