:root {
  color-scheme: light;
  --bg: #f1f4f8;
  --paper: #fff;
  --ink: #18283d;
  --muted: #475b75;
  --line: #d3dde9;
  --accent: #254b79;
  --soft: #edf3fa;
  font-family: 'Avenir Next', system-ui, sans-serif;
  font-size: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
[hidden] { display: none !important; }
a { color: var(--accent); }
.site-header, footer { display: flex; align-items: center; gap: 1rem; padding: .85rem max(1.1rem, calc((100vw - 1140px) / 2)); background: var(--paper); }
.site-header { justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: .6rem; align-items: center; font-weight: 700; text-decoration: none; color: var(--ink); }
main { max-width: 1180px; margin: auto; padding: 2rem 1.25rem; }
h1 { font-size: clamp(1.9rem, 4.2vw, 2.9rem); line-height: 1.1; margin: 0 0 .55rem; letter-spacing: -.04em; }
h2 { font-size: 1.15rem; margin: 0; }
p { line-height: 1.55; }
.intro p, #summary, #status { color: var(--muted); margin: .3rem 0 0; }
.workspace, .results, .info section { background: var(--paper); border: 1px solid var(--line); border-radius: .85rem; padding: 1rem; margin-top: 1.1rem; }
.drafts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .9rem; }
.draft-title, .result-header { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.draft-title { margin-bottom: .55rem; font-weight: 700; }
textarea, button, select, .file-button { font: inherit; color: inherit; }
textarea { display: block; width: 100%; min-height: 10rem; resize: vertical; padding: .8rem; border: 1px solid var(--line); border-radius: .45rem; background: #fbfcfe; line-height: 1.55; }
button, select, .file-button { border: 1px solid #b9c8db; border-radius: .42rem; background: #fff; padding: .55rem .7rem; }
button, select, .file-button, input[type="checkbox"] { cursor: pointer; }
button:hover, .file-button:hover { background: var(--soft); }
button.primary { margin-left: auto; background: var(--accent); color: white; border-color: var(--accent); font-weight: 700; }
button.primary:hover { background: #1a3b66; }
.file-button { position: relative; overflow: hidden; font-weight: 500; }
.file-button input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.file-button:focus-within, :focus-visible { outline: 3px solid #477ab7; outline-offset: 2px; }
.settings { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; margin-top: .9rem; }
.mode-label, .toggle { display: flex; align-items: center; gap: .42rem; }
.toggle { margin-right: .35rem; }
.quiet { background: #f8fafd; }
.legend { display: flex; flex-wrap: wrap; gap: .65rem; color: var(--muted); font-size: .9rem; margin-top: .8rem; }
#status:empty { display: none; }
#status[data-error] { color: #972e24; }
#output { margin: .75rem 0 0; padding: .8rem; border: 1px solid var(--line); border-radius: .4rem; background: #f8fafd; line-height: 1.7; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
ins { background: #c8efd8; color: #095b30; }
del { background: #ffe0dc; color: #922622; }
del + ins, ins + del { margin-inline-start: .14em; }
.line-changes :is(ins, del) { display: block; margin: 0; }
footer { border-top: 1px solid var(--line); font-size: .9rem; }
.info { max-width: 800px; }
.info section { scroll-margin-top: .8rem; }
@media (max-width: 670px) {
  main { padding: 1.25rem .8rem; }
  .drafts { grid-template-columns: minmax(0, 1fr); }
  .workspace, .results { padding: .75rem; }
  textarea { min-height: 7rem; }
  button.primary { margin-left: 0; }
}
