:root {
  color-scheme: light dark;
  --paper: light-dark(#f8f7fb, #1e1a26);
  --surface: light-dark(#fff, #292435);
  --ink: light-dark(#211940, #f0e9ff);
  --muted: light-dark(#655d76, #bcb0cc);
  --edge: light-dark(#dcd6e8, #494154);
  --accent: light-dark(#4934a4, #c5b2ff);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
header, main { padding: 16px; }
header { border-bottom: 1px solid var(--edge); background: var(--surface); }
header .file-button, header button { margin: 0 4px 4px 0; }
h1 { margin: 0 0 12px; font-size: 1.25rem; }
button, input, textarea { font: inherit; color: inherit; }
button, .file-button, input[type="search"] {
  min-height: 44px;
  border: 1px solid var(--edge);
  border-radius: 9px;
  background: var(--surface);
}
.file-button, button { padding: 0 11px; color: var(--accent); }
.file-button { position: relative; display: inline-flex; align-items: center; }
.file-button input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.file-button:focus-within, button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="search"] { width: 100%; padding: 0 10px; margin-top: 4px; }
.clipboard { margin-bottom: 14px; }
.clipboard label { display: block; margin-bottom: 4px; font-weight: 600; }
textarea { width: 100%; padding: 8px; margin-bottom: 4px; border: 1px solid var(--edge); border-radius: 9px; background: var(--surface); }
#status, .source { color: var(--muted); overflow-wrap: anywhere; }
ul { list-style: none; padding: 0; margin: 0; }
li { margin-bottom: 8px; padding: 10px; border: 1px solid var(--edge); border-radius: 10px; background: var(--surface); }
.formula-header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; overflow-wrap: anywhere; }
.number { flex: 0 0 auto; font-family: "Times New Roman", serif; }
.source { margin: 5px 0 8px; font-family: ui-monospace, monospace; font-size: .85rem; overflow: hidden; max-height: 3em; }
.preview { overflow: auto; padding: 8px 2px; text-align: center; min-height: 42px; }
.preview math { font-size: 19px; }
.formula-actions { display: flex; flex-wrap: wrap; gap: 6px; }
button.primary { background: var(--accent); color: var(--surface); }
button:disabled, input:disabled { opacity: .55; cursor: default; }
