latex-source-editor {
  position: relative;
  display: block;
  min-width: 0;
  width: 100%;
}

latex-source-editor > textarea {
  display: block;
  width: 100%;
}

latex-source-editor[data-ready] > textarea {
  color: transparent !important;
  -webkit-text-fill-color: transparent;
  caret-color: #1d1d1f;
}

@media (forced-colors: none) {
  latex-source-editor[data-ready] > textarea::selection { color: transparent; -webkit-text-fill-color: transparent; background: #cfe3ff; }
}
latex-source-editor > textarea::placeholder { color: #86868b; -webkit-text-fill-color: #86868b; }

.latex-source-editor__overlay {
  position: absolute;
  z-index: 1;
  display: none;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

latex-source-editor[data-ready] > .latex-source-editor__overlay {
  display: block;
}

.latex-source-editor__highlight {
  box-sizing: border-box;
  width: 100%;
  min-height: 100%;
  margin: 0;
  border: 0;
  color: #1d1d1f;
  background: transparent;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

latex-source-editor .latex-source-editor__highlight span {
  display: inline;
  margin: 0;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
}

.latex-source-editor__highlight .latex-token--keyword { color: #b315bf; }
.latex-source-editor__highlight .latex-token--command { color: #0077cc; }
.latex-source-editor__highlight .latex-token--environment { color: #446bea; }
.latex-source-editor__highlight .latex-token--math { color: #279144; }
.latex-source-editor__highlight .latex-token--number { color: #b96c00; }
.latex-source-editor__highlight .latex-token--argument { color: #36843d; }
.latex-source-editor__highlight .latex-token--punctuation { color: #666475; }
.latex-source-editor__highlight .latex-token--comment { color: #8b8b98; }

@media (forced-colors: active) {
  latex-source-editor[data-ready] > textarea {
    color: CanvasText !important;
    -webkit-text-fill-color: CanvasText;
  }
  latex-source-editor[data-ready] > .latex-source-editor__overlay { display: none; }
}
