/* diff.qft.org — base.css: tokens, page layout, inputs */

:root {
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;
  --bg: #f4f5f7;
  --surface: #fff;
  --surface-2: #f7f8fa;
  --line: #dfe2e8;
  --line-strong: #c5cad3;
  --text: #171a1f;
  --muted: #5d6673;
  --faint: #8a93a0;
  --accent: #3657e0;
  --accent-ink: #fff;
  --accent-soft: #e9edfd;
  --del: #c92a36;
  --del-bg: #ffeded;
  --del-gut: #ffdcdc;
  --del-x: #ffb5b8;
  --ins: #18794a;
  --ins-bg: #e8f8ee;
  --ins-gut: #cff1da;
  --ins-x: #a0e3b6;
  --empty: #f0f1f4;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --pop: 0 12px 32px rgba(16, 24, 40, .16);
  --radius: 10px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0e1116;
  --surface: #161a21;
  --surface-2: #1b2029;
  --line: #2a303b;
  --line-strong: #3d4553;
  --text: #e7eaf0;
  --muted: #9ba5b3;
  --faint: #6c7786;
  --accent: #7f99ff;
  --accent-ink: #0b1020;
  --accent-soft: #1c2545;
  --del: #ff8389;
  --del-bg: #3a1c21;
  --del-gut: #4b2229;
  --del-x: #80303a;
  --ins: #5fd591;
  --ins-bg: #162f1f;
  --ins-gut: #1b3b26;
  --ins-x: #2a6b41;
  --empty: #11151b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --pop: 0 12px 32px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button, summary, label { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
kbd {
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font: 11px var(--font-ui);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.ico {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- header ---------- */
.top { display: flex; align-items: center; gap: 14px; padding: 14px 20px 6px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font: 600 17px/1 var(--font-mono);
  letter-spacing: -.02em;
}
.brand-name span { color: var(--faint); font-weight: 500; }
.logo { width: 26px; height: 26px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 4px 12px 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
}
.pill .ico { color: var(--ins); }
.pill b { color: var(--text); font-weight: 600; }
.top-actions { display: flex; gap: 2px; margin-left: auto; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--line); color: var(--text); }
.icon-btn:disabled { opacity: .4; pointer-events: none; }
:root[data-theme="dark"] .sun, :root:not([data-theme="dark"]) .moon { display: none; }

main { max-width: 1800px; margin: 0 auto; padding: 10px 20px 40px; }

/* ---------- inputs ---------- */
.inputs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; }
.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.pane:focus-within { border-color: var(--line-strong); }
.pane.drag { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pane-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.tag { flex: none; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; }
.tag-del { background: var(--del-bg); color: var(--del); }
.tag-ins { background: var(--ins-bg); color: var(--ins); }
.pane-name {
  flex: 1;
  min-width: 40px;
  padding: 3px 5px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--muted);
  font: 12.5px var(--font-mono);
  text-overflow: ellipsis;
}
.pane-name::placeholder { color: var(--faint); }
.pane-name:hover, .pane-name:focus { background: var(--surface); color: var(--text); }
.pane-tools { display: flex; gap: 2px; }
.tool {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
}
.tool:hover { background: var(--line); color: var(--text); }
.pane-body { position: relative; display: flex; flex: 1; }
.pane-body textarea {
  flex: 1;
  width: 100%;
  height: 34vh;
  min-height: 150px;
  max-height: 85vh;
  padding: 10px 12px;
  border: 0;
  outline: 0;
  background: none;
  font: 12.5px/20px var(--font-mono);
  tab-size: 4;
  resize: vertical;
}
.pane-body textarea::placeholder { color: var(--faint); }
.filecard {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 20px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}
.filecard strong { color: var(--text); font: 600 14px var(--font-mono); overflow-wrap: anywhere; }
.filecard small { color: var(--faint); }
.dropmask {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  pointer-events: none;
}
.pane.drag .dropmask { display: grid; }
.pane-foot {
  min-height: 28px;
  padding: 5px 12px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.swap { align-self: center; }

/* ---------- actions ---------- */
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 12px 0 18px; }
.grow { flex: 1; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.btn:hover { border-color: var(--line-strong); background: var(--surface-2); }
.btn .ico { width: 14px; height: 14px; color: var(--faint); }
.btn.primary {
  height: 38px;
  padding: 0 16px 0 18px;
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(54, 87, 224, .35);
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.primary kbd { margin-left: 4px; border-color: currentColor; opacity: .7; }
.btn.primary.busy { pointer-events: none; }
.btn.primary.busy kbd {
  width: 14px;
  height: 14px;
  padding: 0;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  font-size: 0;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.switch { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; cursor: pointer; user-select: none; }
input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }

/* ---------- about, footer, toast ---------- */
.about { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 44px; }
.about article { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.about h2 { margin: 0 0 6px; font-size: 14px; }
.about p { margin: 0; color: var(--muted); font-size: 13px; }
.about code { padding: 1px 4px; border-radius: 4px; background: var(--surface-2); font: 12px var(--font-mono); }
.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  max-width: 1800px;
  margin: 0 auto;
  padding: 8px 20px 28px;
  color: var(--faint);
  font-size: 12.5px;
}
.foot a { color: var(--muted); }
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 60;
  max-width: min(560px, calc(100vw - 32px));
  padding: 9px 14px;
  border-radius: 9px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  box-shadow: var(--pop);
  transform: translateX(-50%);
}
.toast button {
  margin-left: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

@media (max-width: 760px) {
  .top { flex-wrap: wrap; padding: 12px 14px 4px; }
  .pill { order: 3; width: 100%; justify-content: center; }
  main { padding: 8px 12px 32px; }
  .inputs { grid-template-columns: minmax(0, 1fr); }
  .swap { justify-self: center; transform: rotate(90deg); }
  .pane-body textarea { height: 22vh; }
  .tool span { display: none; }
  .about { grid-template-columns: minmax(0, 1fr); margin-top: 28px; }
  .foot { padding-inline: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .top, .inputs, .actions, .about, .foot, .toast, .rbar-tools, .hscroll { display: none !important; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
