/* The look of BibTeX Tools (Ostpopcorn/bibtex-tools), with a teal accent */

:root {
  color-scheme: light;
  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-2: #f6f8f8;
  --surface-3: #eceff1;
  --border: #e1e6e8;
  --border-strong: #cdd5d8;
  --text: #182326;
  --muted: #65747a;
  --faint: #9eaab0;
  --accent: #0e7c70;
  --accent-hover: #0a665c;
  --accent-soft: #e0f2ef;
  --accent-text: #ffffff;
  --chg-bg: #fff3cf;
  --chg-bar: #d4a72c;
  --rm-bg: #fde8ea;
  --rm-bar: #e5484d;
  --rm-text: #b4232a;
  --cut-bg: rgba(229, 72, 77, .18);
  --kept-bg: #f1eafe;
  --kept-bar: #8250df;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
  --radius: 10px;
  --ui-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --code-font: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1213;
    --surface: #151b1d;
    --surface-2: #1a2123;
    --surface-3: #222b2e;
    --border: #253033;
    --border-strong: #344245;
    --text: #e2e9ea;
    --muted: #93a3a7;
    --faint: #5a6a6e;
    --accent: #3cc4b0;
    --accent-hover: #62d3c2;
    --accent-soft: rgba(60, 196, 176, .15);
    --accent-text: #0d1213;
    --chg-bg: rgba(210, 153, 34, .17);
    --chg-bar: #d29922;
    --rm-bg: rgba(248, 81, 73, .15);
    --rm-bar: #f85149;
    --rm-text: #ff8b84;
    --cut-bg: rgba(248, 81, 73, .28);
    --kept-bg: rgba(163, 113, 247, .15);
    --kept-bar: #a371f7;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1213;
  --surface: #151b1d;
  --surface-2: #1a2123;
  --surface-3: #222b2e;
  --border: #253033;
  --border-strong: #344245;
  --text: #e2e9ea;
  --muted: #93a3a7;
  --faint: #5a6a6e;
  --accent: #3cc4b0;
  --accent-hover: #62d3c2;
  --accent-soft: rgba(60, 196, 176, .15);
  --accent-text: #0d1213;
  --chg-bg: rgba(210, 153, 34, .17);
  --chg-bar: #d29922;
  --rm-bg: rgba(248, 81, 73, .15);
  --rm-bar: #f85149;
  --rm-text: #ff8b84;
  --cut-bg: rgba(248, 81, 73, .28);
  --kept-bg: rgba(163, 113, 247, .15);
  --kept-bar: #a371f7;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
}

@font-face {
  font-family: "Parisienne";
  src: url("fonts/parisienne.woff2") format("woff2");
  font-display: swap;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--ui-font);
  -webkit-font-smoothing: antialiased;
}

code { font-family: var(--code-font); font-size: .92em; }

svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

h1, h2, h3 { margin: 0; }

/* Buttons and inputs */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: 500 13px var(--ui-font);
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--faint); }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, input:focus-visible, .code:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--surface-3); border-color: transparent; }
.btn.large { height: 40px; padding: 0 18px; font-size: 14px; }
.btn.small { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.small svg { width: 14px; height: 14px; }
.btn.tiny { height: 24px; padding: 0 8px; font-size: 12px; }
.btn.icon-btn { padding: 0; width: 32px; justify-content: center; font-size: 18px; line-height: 1; }
.btn.tiny.icon-btn { width: 24px; font-size: 16px; }

.check {
  display: inline-flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.check input { flex: none; margin: 2px 0 0; accent-color: var(--accent); width: 14px; height: 14px; }
.check.compact { align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.check.compact input { margin: 0; }
.check.compact:has(input:checked) { color: var(--text); font-weight: 550; }
.muted { color: var(--muted); }

/* Top bar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; line-height: 1; letter-spacing: -.01em; white-space: nowrap; }
/* The TeX logo with the lowered E */
.tex { letter-spacing: 0; }
.tex-e { display: inline-block; margin: 0 -.12em 0 -.16em; text-transform: uppercase; transform: translateY(.22em); }
.brand .tagline {
  margin-left: 3px;
  font: 400 21px "Parisienne", "Segoe Script", cursive;
  letter-spacing: 0;
  color: var(--accent);
}
.actions { display: flex; align-items: center; gap: 6px; }
.btn.toggle[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* The views: the original, both side by side, or the result, like in PDF
   Splitter, and folding the unchanged lines */
.view-controls { display: flex; align-items: center; gap: 6px; }
body:not(.has-files) .view-controls { display: none; }
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface-2);
}
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 6px;
  color: var(--muted);
  font: 500 12.5px var(--ui-font);
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.segmented label:hover span { color: var(--text); }
.segmented input:checked + span { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.views svg { width: 14px; height: 14px; }
/* The main download is always the last button */
.actions .btn.primary { order: 1; }

/* Layout: the settings on the left of the panes, like in BibTeX Tools */

.layout { flex: 1; min-height: 0; display: flex; }

.sidebar {
  display: none;
  flex: none;
  flex-direction: column;
  width: 348px;
  min-height: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
body.settings-shown .sidebar { display: flex; }
/* The whole head hides the panel, like the bar shows it */
.sidebar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
.sidebar-head:hover { background: var(--surface-2); }
.sidebar-head h2 { flex: 1; font-size: 14px; font-weight: 650; }
.sidebar-head .icon-btn { color: var(--muted); }
.sidebar-head:hover .icon-btn { color: var(--text); }
/* The files at the top of the panel, which stand out from the settings */
.files-area {
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
}
.files-area .sec { border-bottom: 0; }
.files-area .sec h3 { color: var(--accent); }
.files-area .sec-head .btn { margin-right: -8px; color: var(--muted); }
.files-area .sec-head .btn:hover { color: var(--text); }
.file-row { display: flex; align-items: center; gap: 6px; }
.file-row.wide .btn { flex: 1; justify-content: center; }
/* The open files, and the archives with their .tex files. Clicking a file
   shows it in the panes. */
.file-list { display: flex; flex-direction: column; gap: 4px; }
.file-list[hidden] { display: none; }
.file-field {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
}
.file-field.archive { flex-direction: column; align-items: stretch; }
.file-head { display: flex; align-items: center; gap: 8px; min-width: 0; padding-left: 7px; }
.file-head > svg, .file-open > svg { width: 14px; height: 14px; color: var(--muted); }
.file-open {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 24px;
  padding: 0 6px 0 7px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--text);
  font: 500 12.5px var(--ui-font);
  text-align: left;
  cursor: pointer;
}
.file-open:hover { background: var(--surface-2); }
.file-open:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.file-open[aria-current="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.file-open[aria-current="true"] > svg, .file-open[aria-current="true"] .file-count { color: var(--accent); }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: inherit; }
.file-head .file-name { font-weight: 500; }
.file-count { font-size: 12px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.file-count.excluded { font-style: italic; }
/* The .tex files of an archive, scrolling after 8 of them */
.file-members {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 202px;
  margin: 2px 0 0 13px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
  overflow-y: auto;
}
.file-note { margin: 3px 0 2px 21px; font-size: 12px; color: var(--muted); }
/* `0px`, not `0%`, so that the settings never make the page taller: they
   scroll by themselves, also in short windows */
.sidebar-body { flex: 1 1 0px; min-height: 0; overflow-y: auto; }
.backdrop { display: none; position: fixed; inset: 0; z-index: 29; background: rgba(10, 14, 22, .35); }

/* The hidden settings: a bar on the left, which opens them */
.rail {
  display: none;
  flex: none;
  width: 44px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  cursor: pointer;
}
body:not(.settings-shown) .rail { display: block; }
.rail:hover { background: var(--surface-2); }
.rail-button {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: 600 12.5px var(--ui-font);
  cursor: pointer;
}
.rail:hover .rail-button { color: var(--text); }
.rail-button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.rail-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
}
.rail:hover .rail-icon { border-color: var(--accent); color: var(--accent); }
.rail-label { writing-mode: vertical-rl; transform: rotate(180deg); letter-spacing: .02em; }

/* Settings */

.sec { display: flex; flex-direction: column; gap: 7px; padding: 12px 18px 14px; border-bottom: 1px solid var(--border); }
.sec:last-child { border-bottom: 0; }
.sec-head { display: flex; align-items: center; gap: 8px; min-height: 20px; }
.sec h3 { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.sec .sum { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.sec .check { display: flex; }
/* A setting with an example below it */
.opt { display: flex; flex-direction: column; gap: 1px; }
.opt .hint { padding-left: 21px; }
/* All rules of the settings with why */
.rules { margin: 4px 0 0 21px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); font-size: 12px; }
.rules summary {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  color: var(--accent);
  font-weight: 550;
  cursor: pointer;
  list-style: none;
}
.rules summary::-webkit-details-marker { display: none; }
.rules summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 8px; }
.rules .chev { width: 13px; height: 13px; transition: transform .15s; }
.rules[open] .chev { transform: rotate(90deg); }
.rules[open] summary { border-bottom: 1px solid var(--border); }
.rules-body { display: flex; flex-direction: column; gap: 8px; max-height: 380px; padding: 8px 10px 10px; overflow-y: auto; }
.rules-body p { margin: 0; }
.rules-note { color: var(--text); }
.rules ul { display: flex; flex-direction: column; gap: 7px; margin: 0; padding: 0; list-style: none; }
.rule-change { color: var(--text); }
.rule-why { color: var(--muted); }
.rules code { font-size: 11px; }
/* The lists of macros, like the fields in BibTeX Tools */
.opt .tags { margin: 5px 0 1px 21px; }
.tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  cursor: text;
}
.tags:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 22px;
  padding: 0 2px 0 8px;
  border-radius: 6px;
  background: var(--surface-3);
  font: 12px var(--code-font);
}
.tag button { border: 0; background: none; color: inherit; opacity: .6; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 4px; }
.tag button:hover { opacity: 1; }
.tags input { flex: 1; min-width: 90px; height: 22px; border: 0; outline: 0; background: transparent; color: var(--text); font: 12.5px var(--ui-font); }
.tags input:focus-visible { outline: 0; }
.tags .tags-reset { color: var(--muted); }
/* The list of a setting that is off */
.opt:has(> .check input:not(:checked)) .tags { opacity: .65; }
.opt:has(> .check input:not(:checked)) .tags:focus-within { opacity: 1; }
/* Macros that color their text, which are found in the files */
.opt .suggestions { margin-top: 4px; line-height: 26px; }
.suggestion {
  margin-left: 5px;
  padding: 0 7px;
  height: 22px;
  border: 1px dashed color-mix(in srgb, var(--accent) 60%, var(--border));
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 12px var(--code-font);
  cursor: pointer;
}
.suggestion:hover { border-style: solid; }
.hint { margin: 0; font-size: 12px; color: var(--muted); }
.hint code { font-size: 11.5px; }

/* Workspace */

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 6px;
  padding: 12px 16px 10px;
}
body.view-original .workspace, body.view-result .workspace { grid-template-columns: minmax(0, 1fr); }
body.view-original #pane-result, body.view-result #pane-original,
body.view-original .gutter, body.view-result .gutter { display: none; }

/* Between the panes: the toggle for linked scrolling */
.gutter { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.gutter::before, .gutter::after { content: ""; flex: 1; width: 1px; background: var(--border); }
.gutter.linked::before, .gutter.linked::after { background: color-mix(in srgb, var(--accent) 45%, var(--border)); }
body:not(.has-files) .gutter { display: none; }
.gutter-toggle {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all .12s;
}
.gutter-toggle:hover { color: var(--text); border-color: var(--accent); }
.gutter-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gutter-toggle[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
#link-scroll[aria-pressed="true"] .icon-unlinked,
#link-scroll[aria-pressed="false"] .icon-linked { display: none; }

.pane {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.pane-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.pane-head h2 { font-size: 13px; font-weight: 650; }
.file-select {
  min-width: 0;
  max-width: 55%;
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: 500 12.5px var(--ui-font);
  text-overflow: ellipsis;
  cursor: pointer;
}
.file-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pane-head .meta { flex: 1; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 4px; }
.sw.chg { background: var(--chg-bar); }
.sw.rm { background: var(--rm-bar); }
.sw.kept { background: var(--kept-bar); }
.sw.del, .del {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 7px;
  border-color: transparent transparent transparent var(--rm-bar);
  border-radius: 0;
}

.code {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overflow-anchor: none;
  position: relative;
  padding: 6px 0 24px;
  font: 12.5px/1.6 var(--code-font);
  tab-size: 4;
}

.l { position: relative; display: flex; padding-right: 12px; border-left: 3px solid transparent; }
.l .n {
  flex: none;
  width: 3.6em;
  padding-right: 1.1em;
  text-align: right;
  color: var(--faint);
  user-select: none;
}
.l .t { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.l.kept { background: var(--kept-bg); border-left-color: var(--kept-bar); }
.l.chg { background: var(--chg-bg); border-left-color: var(--chg-bar); }
.l.rm { background: var(--rm-bg); border-left-color: var(--rm-bar); }
.l.rm .t { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--rm-bar) 60%, transparent); }
/* Where whole lines were removed in the result: a triangle on the edge
   between two lines, like git in VS Code, on top of the line above it */
.l > .del { position: absolute; top: -5px; left: -3px; cursor: help; }
.l > .del.end { top: auto; bottom: -5px; }
/* A larger area to hover */
.l > .del::before { content: ""; position: absolute; top: -8px; left: -10px; width: 16px; height: 16px; }
/* The removed end of a changed line */
.cut {
  border-radius: 3px;
  background: var(--cut-bg);
  color: var(--rm-text);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--rm-bar) 60%, transparent);
}
.l .t.empty-note { color: var(--muted); font-family: var(--ui-font); font-size: 12.5px; }

/* Unchanged lines that are folded, in the same place in both panes. A fold
   is three lines high, so that it stands out from the lines. */
.l.fold {
  align-items: center;
  height: 4.8em;
  border-block: 2px solid var(--surface);
  background: var(--surface-3);
  background-clip: padding-box;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.l.fold .n { display: flex; justify-content: flex-end; color: inherit; }
.l.fold .n svg { width: 14px; height: 14px; }
.l.fold .t { font: 500 12px var(--ui-font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l.fold:hover { background: color-mix(in srgb, var(--surface-3) 55%, var(--border-strong)); color: var(--text); }
.l.fold:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Badges move to a row below the text when they do not fit next to it */
.l.has-badges { flex-wrap: wrap; }
.l.has-badges .t { flex: 1 1 auto; max-width: calc(100% - 3.6em); }
.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-self: flex-start;
  gap: 4px;
  margin: 2px 0 0 auto;
  padding-left: 8px;
}
.badge {
  flex: none;
  padding: 0 7px;
  border-radius: 999px;
  font: 600 10.5px/17px var(--ui-font);
  letter-spacing: .01em;
  white-space: nowrap;
}
.badge.kept { background: var(--kept-bar); color: #fff; }
.badge.warn { background: var(--chg-bar); color: #1b1300; }

.overlay {
  position: absolute;
  inset: 41px 0 0 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(1px);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 20px;
}
.overlay.show { display: flex; }
.overlay.error { color: var(--rm-text); }
.overlay.error .spinner { display: none; }
.overlay p { margin: 0; max-width: 460px; white-space: pre-wrap; }
.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pane.busy .pane-head h2::after {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 8px;
  vertical-align: -1px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* Empty state */

.empty { display: none; grid-column: 1 / -1; place-items: center; padding: 10px; overflow: auto; }
body:not(.has-files) .empty { display: grid; }
body:not(.has-files) .pane { display: none; }
.drop-card {
  max-width: 560px;
  width: 100%;
  padding: 44px 36px;
  text-align: center;
  background: var(--surface);
  border: 2px dashed var(--border-strong);
  border-radius: 16px;
  transition: border-color .15s, background .15s;
}
body.dragging .drop-card { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { width: 44px; height: 44px; color: var(--accent); stroke-width: 1.6; margin-bottom: 12px; }
.drop-card h1 { font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.drop-card > p { margin: 8px auto 0; color: var(--muted); max-width: 400px; }
.drop-actions { display: flex; justify-content: center; gap: 10px; margin-top: 22px; }
.paste-hint { margin: 14px 0 0 !important; font-size: 12.5px; }
kbd {
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  font: 11.5px var(--code-font);
}
.privacy { display: inline-flex; align-items: center; gap: 6px; margin-top: 22px !important; font-size: 12px; }
.privacy svg { width: 14px; height: 14px; }

body.has-files.dragging .workspace { outline: 2px dashed var(--accent); outline-offset: -6px; border-radius: 14px; }

/* Status bar */

.status {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 34px;
  padding: 6px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--muted);
}
.status-left { white-space: nowrap; }
.status-left strong { color: var(--text); font-weight: 600; }
.status-messages { flex: 1; min-width: 0; display: flex; gap: 14px; overflow: hidden; }
.msg { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg.warning { color: var(--chg-bar); }
.msg.error { color: var(--rm-text); }
.msg svg { width: 14px; height: 14px; }
.credits { display: flex; align-items: center; gap: 6px; flex: none; white-space: nowrap; font-size: 12px; }
.about-small a, .credit-link span {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 2px;
}
.about-small a { color: inherit; }
.about-small a:hover, .credit-link:hover { color: var(--accent); }
.credit-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.credit-link svg { width: 13px; height: 13px; }
svg.icon-fill { fill: currentColor; stroke: none; }
.status-right { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--chg-bar); }
.dot.ready { background: var(--accent); }
.dot.error { background: var(--rm-bar); }

/* Dialogs */

.dialog {
  width: min(1100px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.dialog[open] { display: flex; flex-direction: column; }
.dialog::backdrop { background: rgba(10, 14, 16, .45); }
.dialog-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 6px 20px; }
.dialog-head h2 { font-size: 16px; font-weight: 650; }
.dialog-head .meta { flex: 1; color: var(--muted); font-size: 13px; }
.dialog-foot { display: flex; align-items: center; gap: 8px; padding: 14px 20px 18px; }
.dialog-foot .hint { margin: 0; font-size: 12px; color: var(--rm-text); }
.about-dialog { width: min(580px, calc(100vw - 32px)); }
.about-body { display: flex; flex-direction: column; gap: 14px; padding: 6px 20px 22px; overflow: auto; }
.about-body p { margin: 0; }
.about-links { display: grid; gap: 8px; }
.about-link {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  transition: border-color .12s, background .12s;
}
.about-link:hover { border-color: var(--accent); background: var(--accent-soft); }
.about-link svg { width: 20px; height: 20px; margin-top: 1px; color: var(--accent); }
.about-link strong { display: block; font: 600 13px var(--code-font); }
.about-link small { display: block; font-size: 12.5px; color: var(--muted); }
.about-small { font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.paste-dialog { width: min(820px, calc(100vw - 32px)); }
.paste-dialog .dialog-head { flex-wrap: wrap; row-gap: 2px; }
.paste-dialog .dialog-head .meta { order: 3; flex-basis: 100%; }
.paste-dialog .dialog-head .icon-btn { margin-left: auto; }
#paste-text {
  display: block;
  width: calc(100% - 40px);
  height: min(52vh, 460px);
  margin: 8px 20px 0;
  padding: 10px 12px;
  resize: vertical;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font: 12.5px/1.55 var(--code-font);
  tab-size: 4;
}
#paste-text:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.spacer { flex: 1; }

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 52px;
  transform: translate(-50%, 12px);
  max-width: min(520px, calc(100vw - 32px));
  padding: 9px 14px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 10;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Smaller screens */

/* The settings open over the panes, with the bar on the left, and the views
   show only their icons */
@media (max-width: 1100px) {
  .segmented.views span { gap: 0; font-size: 0; padding: 5px 10px; }
  .rail { display: block; }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    width: min(360px, 100vw);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-body { overscroll-behavior: contain; }
  body.settings-overlay .backdrop { display: block; }
  .legend { display: none; }
}
/* Small windows scroll the page instead of squeezing the panes */
@media (max-width: 1100px), (max-height: 760px) {
  body { height: auto; min-height: 100%; }
  .layout { flex: 1 0 auto; }
  .pane { height: max(420px, calc(100vh - 110px)); }
  .empty { padding-bottom: 24px; }
}
@media (max-width: 900px) {
  .status { flex-wrap: wrap; row-gap: 2px; }
  .credits { order: 3; flex-basis: 100%; }
  .topbar { flex-wrap: wrap; }
  .actions { margin-left: auto; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .gutter { flex-direction: row; }
  .gutter::before, .gutter::after { width: auto; height: 1px; }
  .pane { height: max(360px, 75vh); }
}
@media (max-width: 700px) {
  .actions .btn:not(.primary):not(.icon-btn) { padding: 0 8px; }
  /* The counts wrap instead of making the page wider */
  .status-left { flex: 1 1 auto; min-width: 0; white-space: normal; }
  .pane-head { flex-wrap: wrap; row-gap: 4px; }
  .drop-card { padding: 32px 20px; }
  .drop-actions { flex-direction: column; }
  .drop-actions .btn { justify-content: center; }
}
@media (max-width: 480px) {
  .brand .tagline { display: none; }
  #copy { display: none; }
}
