:root {
  color-scheme: light dark;
  --fg: #1d1d1f;
  --bg: #fdfdfc;
  --muted: #6b6b6b;
  --border: #d0d0cc;
  --redex: rgba(230, 160, 0, 0.35);
  --contractum: rgba(40, 170, 90, 0.3);
  --bad: #b3261e;
  --keyword: #a0249c;
  --class: #0b62a6;
  --comment: #858580;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e6e6e3;
    --bg: #161616;
    --muted: #9a9a96;
    --border: #3a3a38;
    --bad: #f2867f;
    --keyword: #d38ef0;
    --class: #6cb6ff;
    --comment: #7d7d78;
  }
}

body {
  margin: 8px;
  background: var(--bg);
  color: var(--fg);
}

main {
  max-width: 900px;
}

textarea, pre {
  font: 13px/1.5 ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

/* The textarea's own text is invisible; the highlighted #overlay underneath shows through. Both
   must lay text out identically: same font, padding, border width and no wrapping. */
.editor {
  position: relative;
  height: 340px;
  resize: vertical;
  overflow: hidden;
}

.editor textarea, .editor #overlay {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--border);
  white-space: pre;
  word-break: normal;
  overflow: auto;
  tab-size: 2;
}

.editor #overlay {
  overflow: hidden;
  pointer-events: none;
}

.editor textarea {
  resize: none;
  color: transparent;
  caret-color: var(--fg);
  background: transparent;
}

.editor textarea::placeholder { color: var(--muted); }

.tok-keyword { color: var(--keyword); }
.tok-class { color: var(--class); }
.tok-comment { color: var(--comment); font-style: italic; }

.controls {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0 24px;
}


.hint { color: var(--muted); }

pre {
  margin: 0;
  padding: 8px 10px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px solid var(--border);
}

mark { color: inherit; }
mark.redex { background: var(--redex); }
mark.contractum { background: var(--contractum); }

.status { margin: 0 0 16px; font-weight: 600; }
.bad { color: var(--bad); }

.stepper {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.label { margin: 12px 0 4px; }
.rule { margin: 8px 0; }
.rule code { font-weight: 600; }

ul.blamed { padding-left: 20px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

details { margin-top: 16px; }
summary { cursor: pointer; color: var(--muted); }
details pre { margin-top: 6px; }

ol.sequence { padding-left: 32px; font: 13px/1.6 ui-monospace, Menlo, Consolas, monospace; }
ol.sequence li { cursor: pointer; }
ol.sequence li.current { font-weight: 700; }
