.task-source-editor {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  min-width: 0;
  height: 174px;
  min-height: 112px;
  max-height: 80vh;
  overflow: hidden;
  resize: vertical;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--panel);
}

.task-source-editor:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.task-source-editor :is(.task-source-gutter, .task-source-body, .task-source-backdrop) {
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.task-source-editor .task-source-gutter {
  border-right: 1px solid var(--border);
  background: var(--panel-muted);
  color: var(--muted);
  text-align: right;
  user-select: none;
}

#contest-task-editor .task-source-editor :is(pre, textarea) {
  margin: 0;
  border: 0;
  border-radius: 0;
  font: 13px/20px var(--font-mono);
  font-variant-ligatures: none;
  letter-spacing: normal;
  tab-size: 4;
  white-space: pre;
  text-align: start;
}

#contest-task-editor .task-source-editor .task-source-numbers {
  min-width: calc(var(--task-source-digits, 1) * 1ch + 18px);
  padding: 10px 9px;
  text-align: right;
}

#contest-task-editor .task-source-editor :is(.task-source-code, textarea) {
  padding: 10px 12px;
}

.task-source-editor .task-source-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: var(--ink);
}

#contest-task-editor .task-source-editor textarea {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  resize: none;
  outline: 0;
  box-shadow: none;
  background: transparent;
  color: transparent;
  caret-color: var(--ink);
}

.task-source-editor textarea::placeholder {color: var(--muted)}
.task-source-editor textarea::selection {background: var(--brand-soft);color: var(--ink)}
#contest-task-editor .task-source-plain textarea {color: var(--ink)}
.task-source-code .tok-keyword {color: light-dark(#84245f, #f3a5d8)}
.task-source-code :is(.tok-string, .tok-string2, .tok-regexp) {color: light-dark(#20613f, #9de5b4)}
.task-source-code :is(.tok-number, .tok-bool, .tok-atom) {color: light-dark(#844513, #f5b981)}
.task-source-code .tok-comment {color: var(--muted)}
.task-source-code :is(.tok-typeName, .tok-className, .tok-function.tok-variableName, .tok-propertyName) {color: light-dark(#235886, #a1d1fa)}
body.theme-dark .task-source-editor {color-scheme: dark}

#contest-task-editor #task-editor-statement {
  resize: vertical;
  max-height: 80vh;
}

@media (forced-colors: active) {
  #contest-task-editor .task-source-editor textarea {color: CanvasText;background: Canvas;caret-color: CanvasText}
  .task-source-editor .task-source-backdrop {visibility: hidden}
}
