:root {
  color-scheme: light dark;
  --bg: #fafaf9;
  --panel: #fff;
  --control: #f3f3f1;
  --fg: #232422;
  --muted: #5e605c;
  --line: #d1d2cd;
  --edge: #878982;
  --accent: #4e6953;
  --warning: #9e332b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1c1b;
    --panel: #222322;
    --control: #303130;
    --fg: #eeeeeb;
    --muted: #b9bbb6;
    --line: #454742;
    --edge: #83867f;
    --accent: #9bb79b;
    --warning: #ffaaa0;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--fg);
  background: var(--bg);
  font: 15px/1.55 system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
.wrap { width: min(calc(100% - 40px), 960px); margin-inline: auto; }
header { border-bottom: 1px solid var(--line); background: var(--panel); }
header .wrap { padding-block: 9px; }
a { color: inherit; text-underline-offset: 3px; }
header a { font-weight: 650; text-decoration: none; }
header a:hover { text-decoration: underline; }
main { padding-block: 22px 36px; }
h1 { margin: 0 0 16px; font-size: 1.55rem; line-height: 1.35; }
.directory { list-style: none; padding: 0; border-top: 1px solid var(--line); }
.directory li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.directory a { font-weight: 600; }
.directory p, .notes p { margin: 5px 0; }
.directory p, .notes, .presets, .targets { color: var(--muted); font-size: .84rem; }
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0;
  border-block: 1px solid var(--line);
  background: var(--panel);
}
.stats div { padding: 8px 16px; }
.stats div + div { border-inline-start: 1px solid var(--line); }
.stats dt { color: var(--muted); font-size: .81rem; }
.stats dd { margin: 0; font-size: 1.65rem; font-weight: 600; line-height: 1.35; }
.settings { margin-block: 17px 12px; }
.controls, .presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.controls label { display: inline-flex; align-items: center; gap: 7px; }
button, select, input, textarea { font: inherit; color: inherit; }
button, select, #limit, textarea { border: 1px solid var(--edge); border-radius: 3px; }
button, select, #limit { min-height: 32px; padding: 3px 9px; }
button, select { background-color: var(--control); }
button, summary { cursor: pointer; }
button:hover, select:hover { border-color: var(--fg); }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
#limit { width: 7rem; background: var(--panel); }
#limit[aria-invalid="true"] { border-color: var(--warning); }
.error, .over { color: var(--warning); }
.error { margin: 4px 0; font-size: .85rem; }
.presets { margin-top: 8px; gap: 4px; }
.presets span { margin-right: 4px; }
.presets button { min-height: 27px; padding: 2px 9px; }
.presets button[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.progress { margin-bottom: 16px; }
.progress-label { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px; }
.progress-label strong { margin-left: 5px; font-size: 1.4rem; }
#remaining, .targets { overflow-wrap: anywhere; }
.track { position: relative; margin-block: 4px; height: 27px; }
progress {
  display: block;
  width: 100%;
  height: 8px;
  border: 0;
  appearance: none;
  background: var(--line);
  color: var(--accent);
  --fill: var(--accent);
}
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--fill); }
progress::-moz-progress-bar { background: var(--fill); }
.over progress { --fill: var(--warning); }
.mark {
  position: absolute;
  top: 0;
  transform: translateX(-100%);
  color: var(--muted);
  font-size: 10px;
  padding-top: 10px;
}
.mark::before { content: ""; position: absolute; right: 0; top: 0; height: 10px; border-right: 1px solid var(--fg); }
.m80 { left: 80%; }
.m90 { left: 90%; }
.m100 { left: 100%; }
.targets { line-height: 1.6; }
.editor-label { display: block; margin-bottom: 5px; font-weight: 600; }
textarea {
  display: block;
  width: 100%;
  min-height: 260px;
  height: clamp(320px, 43vh, 620px);
  padding: 12px;
  resize: vertical;
  background: var(--panel);
  font-size: 1rem;
  line-height: 1.7;
}
.bottom { margin-top: 9px; gap: 7px; }
.bottom label { margin-left: auto; }
.bottom input { margin: 0; }
#status { font-size: .84rem; margin-top: 4px; }
.notes { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 6px; }
summary { width: fit-content; }
@media (max-width: 600px) {
  .wrap { width: calc(100% - 28px); }
  main { padding-top: 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats div { padding: 6px 10px; }
  .stats div:nth-child(3) { border-inline-start: 0; }
  .stats div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .controls select, #limit { font-size: 1rem; }
  .presets button { min-height: 32px; }
  .bottom label { margin-left: 0; }
  textarea { height: 36vh; }
}
