:root {
  --ink: #1f2330;
  --muted: #5d6272;
  --paper: #ffffff;
  --panel: #f5f6f9;
  --line: #d9dce4;
  --accent: #3f51b5;
  --accent-ink: #ffffff;
  --warn: #fff4d6;
  --warn-line: #e0b54a;
  --bad: #b3261e;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e3e5ec;
    --muted: #a1a6b5;
    --paper: #1e2129;
    --panel: #262a34;
    --line: #3a3f4c;
    --accent: #8c9eff;
    --accent-ink: #10131a;
    --warn: #3a3320;
    --warn-line: #a88a3a;
    --bad: #ff8a80;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

header, main, footer {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 16px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

header .home { font-weight: 700; text-decoration: none; color: var(--ink); }
header nav a { margin-left: 1rem; }

h1 { font-size: 1.8rem; margin: 1.5rem 0 0.5rem; }
h2 { font-size: 1.2rem; margin: 2rem 0 0.5rem; display: flex; align-items: center; gap: 0.75rem; }

.lede { color: var(--muted); max-width: 44rem; }
.hint { color: var(--muted); font-size: 0.875rem; font-weight: 400; }

#status {
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--line);
  background: var(--panel);
}
#status[data-state="ready"] { border-color: var(--accent); }
#status[data-state="failed"] { border-color: var(--bad); color: var(--bad); }

form label { display: block; font-weight: 600; margin-top: 1rem; }

textarea, input[type="url"] {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

textarea { min-height: 14rem; resize: vertical; }

textarea:focus, input:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.row { display: flex; flex-wrap: wrap; gap: 0 1.5rem; }
.grow { flex: 1 1 20rem; }
label.check { font-weight: 400; display: flex; align-items: center; gap: 0.4rem; }
.buttons { margin-top: 1.25rem; gap: 0.75rem; }

button {
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button[type="submit"] { background: var(--accent); color: var(--accent-ink); }
button:disabled { opacity: 0.5; cursor: progress; }
button.small { padding: 0.15rem 0.6rem; font-size: 0.8rem; font-weight: 500; }

.scroll { overflow-x: auto; }

table { border-collapse: collapse; width: 100%; font-size: 0.925rem; }
th, td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
td { overflow-wrap: anywhere; }
td:first-child { white-space: nowrap; font-weight: 600; }
td:last-child { color: var(--muted); font-size: 0.85rem; }
tr.conflict td { background: var(--warn); }
tr.conflict td:first-child { box-shadow: inset 3px 0 0 var(--warn-line); }

pre {
  max-height: 32rem;
  overflow: auto;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  font: 12.5px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

#failed pre { color: var(--bad); }

footer {
  margin-top: 3rem;
  padding-top: 1rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}
