:root {
  --fg: #1d2330;
  --muted: #667085;
  --line: #d9dee7;
  --panel: #f6f8fb;
  --accent: #2459a8;
  --gt: #d62728;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: #fff;
}
header.top { padding: 12px 24px; border-bottom: 1px solid var(--line); }
header.top h1 { font-size: 17px; margin: 0; }
main { padding: 16px 24px 40px; max-width: 1200px; }
p.about { color: var(--muted); margin: 8px 0 16px; max-width: 820px; }
a { color: var(--accent); }

.controls { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; align-items: center; margin-bottom: 12px; }
.controls label { color: var(--muted); font-size: 13px; }
.seg { display: inline-flex; justify-self: start; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button {
  font: inherit; font-size: 14px;
  padding: 5px 12px;
  border: 0; border-right: 1px solid var(--line);
  background: #fff; color: var(--fg); cursor: pointer;
}
.seg button:last-child { border-right: 0; }
.seg button:hover:not(:disabled) { background: var(--panel); }
.seg button.on { background: var(--accent); color: #fff; }
.seg button:disabled { color: #b8bfcc; cursor: not-allowed; text-decoration: line-through; }

button.plain {
  font: inherit; font-size: 14px; padding: 4px 10px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer;
}
button.plain:hover:not(:disabled) { background: var(--panel); }
button.plain:disabled { color: #b8bfcc; cursor: default; }

.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: #fdecea; color: var(--gt); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
code, .mono { font-family: var(--mono); font-size: 13px; }

/* dataset explorer */
.layout { display: grid; grid-template-columns: 240px 1fr; gap: 20px; }
.sidebar input { width: 100%; font: inherit; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; }
.facts { list-style: none; margin: 8px 0 0; padding: 0; max-height: 72vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; }
.facts li { padding: 4px 10px; cursor: pointer; font-size: 14px; border-bottom: 1px solid #eef1f5; }
.facts li:last-child { border-bottom: 0; }
.facts li:hover { background: var(--panel); }
.facts li.on { background: var(--accent); color: #fff; }
table.kv { border-collapse: collapse; margin-bottom: 12px; }
table.kv td { padding: 2px 16px 2px 0; vertical-align: top; }
table.kv td:first-child { color: var(--muted); white-space: nowrap; }
h3 { font-size: 14px; margin: 18px 0 6px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.queries { margin: 0; padding-left: 18px; }
.queries li { margin-bottom: 4px; }
.queries .q { font-family: var(--mono); font-size: 13px; white-space: pre-wrap; }
.queries .a { font-family: var(--mono); font-size: 13px; color: var(--gt); font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stepper input { width: 60px; font: inherit; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; }
pre.doc {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 12px 14px; font-family: var(--mono); font-size: 13px; line-height: 1.45;
  white-space: pre-wrap; word-break: break-word; margin: 8px 0 0;
}
details summary { cursor: pointer; color: var(--muted); margin-top: 16px; }
.decoys { font-family: var(--mono); font-size: 13px; margin: 6px 0 0; padding-left: 18px; max-height: 280px; overflow-y: auto; }

/* F5 explorer */
.quad { display: grid; grid-template-columns: max-content 1fr 1fr; gap: 4px 14px; align-items: center; max-width: 1000px; }
.quad .colhead { text-align: center; font-weight: 600; font-size: 14px; }
.quad .rowhead { font-weight: 600; font-size: 14px; text-align: right; }
.quad svg { width: 100%; height: auto; display: block; background: #eef2f7; border-radius: 4px; }
.legend { display: flex; gap: 18px; font-size: 13px; margin: 6px 0 10px; }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 10px; margin-right: 6px; vertical-align: -1px; }
.legend .gt::before { background: rgba(214, 39, 40, 0.45); border: 1px solid var(--gt); }
.legend .other::before { background: rgba(115, 115, 115, 0.35); border: 1px solid #737373; }
#tip {
  position: fixed; pointer-events: none; display: none;
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 9px; font-size: 13px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.caption { max-width: 900px; color: var(--muted); font-size: 13px; margin-top: 14px; }
.missing { padding: 40px; color: var(--muted); border: 1px dashed var(--line); border-radius: 6px; max-width: 1000px; text-align: center; }

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .facts { max-height: 30vh; }
}
