:root {
  --primary: #190B9D;
  --bg: #FBF5F3;
  --accent: #E28413;
  --alert: #C42847;
  --ink: #1d1b2b;
  --muted: #5d5a6e;
  --line: #e2d8d4;
  --card: #ffffff;
  --serif-title: "Lora", Georgia, serif;
  --serif-body: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif-body);
  line-height: 1.55;
}
h1, h2, h3 { font-family: var(--serif-title); font-weight: 600; margin: 0; }
a { color: var(--primary); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* header */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--primary);
  color: var(--bg);
}
.wordmark { font-size: 1.4rem; font-weight: 700; letter-spacing: 0.01em; }
.conn { display: flex; align-items: center; gap: 0.9rem; font-size: 0.9rem; }
.status::before { content: ""; display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%; margin-right: 0.45rem; background: var(--accent); }
.status.ok::before { background: #6fcf8f; }
.status.bad::before { background: var(--alert); box-shadow: 0 0 0 2px var(--bg); }
.top .link { color: var(--bg); }
button.link { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; }

/* layout */
.layout { display: grid; grid-template-columns: 20rem minmax(0, 1fr); gap: 2rem; max-width: 76rem; margin: 0 auto; padding: 1.5rem; }
.filters { align-self: start; position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; }
.filters summary { font-family: var(--serif-title); font-weight: 600; font-size: 1.1rem; cursor: pointer; margin-bottom: 0.8rem; list-style: none; }
.filters summary::-webkit-details-marker { display: none; }
.badge { background: var(--alert); color: #fff; font: 600 0.75rem var(--serif-body); padding: 0.1rem 0.5rem; border-radius: 1rem; margin-left: 0.4rem; vertical-align: middle; }
.f { margin-bottom: 1.25rem; position: relative; }
.f h2 { font-size: 0.95rem; margin-bottom: 0.4rem; display: flex; align-items: center; gap: 0.4rem; }
.f h2 label { cursor: pointer; }

/* inputs */
select, input[type="search"], input[type="url"], input[type="password"], textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 4px; padding: 0.5rem 0.6rem;
}
textarea { resize: vertical; }
select:focus-visible, input:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
input[type="range"] { width: 100%; accent-color: var(--primary); }
.slider { display: flex; align-items: center; gap: 0.75rem; }
.slider output { min-width: 4.2rem; font-size: 0.9rem; color: var(--muted); text-align: right; }

.checks { display: flex; flex-direction: column; gap: 0.15rem; }
.checks.scroll { max-height: 11rem; overflow: auto; margin-top: 0.4rem; border: 1px solid var(--line); border-radius: 4px; background: var(--card); padding: 0.3rem 0.5rem; }
.checks label { display: flex; gap: 0.5rem; align-items: baseline; font-size: 0.93rem; cursor: pointer; padding: 0.1rem 0; }
.checks input { accent-color: var(--primary); }
.checks .n { margin-left: auto; color: var(--muted); font-size: 0.8rem; }
.checks .dim { color: var(--muted); }
.empty-note { color: var(--muted); font-size: 0.88rem; padding: 0.3rem 0; }

/* tooltip */
.tip {
  width: 1.25rem; height: 1.25rem; border-radius: 50%; border: 1px solid var(--primary);
  background: transparent; color: var(--primary); font: 600 0.75rem var(--serif-body); cursor: help; padding: 0; line-height: 1;
}
.tipbox {
  display: none; position: absolute; left: 0; right: 0; top: 1.7rem; z-index: 5;
  background: var(--ink); color: var(--bg); font: 400 0.85rem/1.4 var(--serif-body);
  padding: 0.6rem 0.75rem; border-radius: 4px;
}
.tip:hover + .tipbox, .tip:focus + .tipbox, .tip[aria-expanded="true"] + .tipbox { display: block; }

/* buttons */
button, .btn {
  font: 600 0.95rem var(--serif-body); padding: 0.5rem 1.1rem; border-radius: 4px; cursor: pointer;
  background: var(--primary); color: #fff; border: 1px solid var(--primary);
}
button:hover { background: #12077a; }
button.secondary { background: transparent; color: var(--primary); }
button.secondary:hover { background: rgba(25, 11, 157, 0.07); }
button:disabled { opacity: 0.55; cursor: default; }

/* main */
.ask { margin-bottom: 1.25rem; }
.ask .row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 0.6rem; flex-wrap: wrap; }
.inline { font-size: 0.93rem; display: flex; gap: 0.5rem; align-items: center; }
.inline input { accent-color: var(--primary); }
.msg { border-left: 4px solid var(--alert); background: var(--card); padding: 0.7rem 1rem; margin-bottom: 1rem; }
.msg.info { border-color: var(--accent); }
.answer { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--primary); border-radius: 4px; padding: 1rem 1.25rem; margin-bottom: 1.5rem; }
.answer h2 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.answer p { margin: 0 0 0.75rem; }
.answer a.cite { font-size: 0.85em; text-decoration: none; border-bottom: 1px solid var(--accent); }

.hit { background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 1rem 1.25rem; margin-bottom: 1rem; scroll-margin-top: 1rem; }
.hit:target { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.hit h3 { font-size: 1rem; color: var(--primary); }
.hit .sub { color: var(--muted); font-size: 0.88rem; margin: 0.2rem 0 0.6rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.6rem; }
.tag { font-size: 0.78rem; border: 1px solid var(--line); border-radius: 3px; padding: 0.05rem 0.45rem; color: var(--muted); }
.tag.flag { border-color: var(--alert); color: var(--alert); }
.gist { font-size: 0.93rem; margin: 0 0 0.6rem; color: var(--muted); }
.text { white-space: pre-wrap; font-size: 0.95rem; max-height: 9rem; overflow: hidden; position: relative; }
.text.open { max-height: none; }
.hit .more { margin-top: 0.4rem; }

dialog { border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); max-width: 28rem; width: calc(100% - 2rem); }
dialog::backdrop { background: rgba(29, 27, 43, 0.45); }
dialog h2 { margin-bottom: 0.5rem; }
dialog label { display: block; margin: 0.8rem 0; font-size: 0.93rem; }
dialog label input { margin-top: 0.25rem; }
dialog .row { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1rem; }
.note { color: var(--muted); font-size: 0.9rem; }

@media (max-width: 52rem) {
  .layout { grid-template-columns: 1fr; padding: 1rem; gap: 1rem; }
  .filters { position: static; max-height: none; }
  .top { padding: 0.8rem 1rem; }
}
