:root {
  --ink: #2b2620;
  --muted: #6d6458;
  --paper: #faf7f0;
  --line: #ddd4c4;
  --accent: #8a3b12;
  --panel-w: 380px;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--paper); }
body { display: grid; grid-template-columns: var(--panel-w) 1fr; grid-template-rows: 1fr auto; }

#panel { grid-row: 1 / span 2; overflow-y: auto; border-right: 1px solid var(--line); background: var(--paper); padding: 16px 18px 40px; }
#map { grid-column: 2; grid-row: 1; }
#timebar { grid-column: 2; grid-row: 2; border-top: 1px solid var(--line); padding: 8px 16px 6px; background: var(--paper); }

h1 { font: 600 22px/1.2 Georgia, "Iowan Old Style", serif; margin: 0 0 6px; letter-spacing: .01em; }
h2 { font: 600 12px/1 system-ui, sans-serif; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 0 8px; }
h2 small { text-transform: none; letter-spacing: 0; font-weight: 400; }
h3 { font: 600 17px/1.25 Georgia, serif; margin: 4px 0 8px; }
a { color: var(--accent); }
.lede { margin: 0 0 12px; color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 -18px 4px; padding: 0 12px; position: sticky; top: -16px; background: var(--paper); z-index: 2; }
.tabs button { font: inherit; border: 0; background: none; padding: 8px 10px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

.row { display: flex; align-items: center; gap: 8px; margin: 4px 0; cursor: pointer; }
.row select { font: inherit; margin-left: auto; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; margin: 4px 0 8px 24px; font-size: 13px; }
.legend span, .swatch { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,.35); flex: none; }
.count { color: var(--muted); font-variant-numeric: tabular-nums; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.chips button { font: inherit; font-size: 12px; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 2px 9px; cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

#hyp-list { list-style: none; padding: 0; margin: 0; }
#hyp-list li { border: 1px solid var(--line); border-radius: 6px; background: #fff; margin-bottom: 6px; }
#hyp-list li > button { all: unset; display: grid; grid-template-columns: 1fr auto; gap: 8px; width: 100%; box-sizing: border-box; padding: 8px 10px; cursor: pointer; }
#hyp-list li > button:focus-visible { outline: 2px solid var(--accent); }
#hyp-list li.open { border-color: var(--ink); }
.hyp-name { font-weight: 600; }
.hyp-group { color: var(--muted); font-size: 12px; }
.verdict { font-size: 12px; padding: 1px 8px; border-radius: 10px; align-self: start; white-space: nowrap; }
.v-consistent { background: #dcefe3; color: #1f5c36; }
.v-mixed { background: #f4ecd2; color: #6b5414; }
.v-contradicted { background: #f6dcd6; color: #7d2614; }
.v-pending { background: #eee; color: #666; }
.hyp-body { padding: 0 10px 10px; font-size: 13px; }
.hyp-body table { width: 100%; border-collapse: collapse; }
.hyp-body td, .hyp-body th { text-align: left; padding: 4px 4px; border-top: 1px solid var(--line); vertical-align: top; }
.hyp-body th { font-weight: 600; color: var(--muted); font-size: 12px; }
.agree-yes { color: #1f5c36; } .agree-no { color: #7d2614; } .agree-na { color: #888; }

#object-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; margin: 8px 0; }
#object-card dt { color: var(--muted); }
#object-card dd { margin: 0; }
#object-card img { max-width: 100%; border-radius: 4px; border: 1px solid var(--line); }
#object-card .sources { font-size: 12px; word-break: break-all; padding-left: 18px; }

.chart { width: 100%; height: auto; display: block; margin: 8px 0; background: #fff; border: 1px solid var(--line); border-radius: 4px; }
.chart text { font: 10px system-ui, sans-serif; fill: var(--muted); }
.chart .pt { cursor: pointer; }
.chart .pt.hl { stroke: #000; stroke-width: 2; }

.timebar-row { display: flex; align-items: center; gap: 14px; }
.timebar-row input[type=range] { flex: 1; }
#year-out { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 6em; display: inline-block; }
#events { position: relative; height: 28px; margin: 0 0 0 0; font-size: 11px; color: var(--muted); }
#events span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
#events span.lo { top: 13px; }
#events span::before { content: ""; position: absolute; left: 50%; top: -4px; height: 4px; border-left: 1px solid var(--muted); }
#timebar .hint { margin: 0; font-size: 12px; }

.maplibregl-popup-content { font: 13px/1.4 system-ui, sans-serif; padding: 8px 10px; }

@media (max-width: 800px) {
  body { grid-template-columns: 1fr; grid-template-rows: 55vh auto 1fr; overflow: auto; }
  html, body { overflow: auto; }
  #map { grid-column: 1; grid-row: 1; }
  #timebar { grid-column: 1; grid-row: 2; }
  #panel { grid-row: 3; border-right: 0; }
  .tabs { top: 0; }
}
.hyp-body details { margin-top: 8px; }
.hyp-body summary { cursor: pointer; color: var(--accent); }
.hyp-body ul.obs { padding-left: 16px; margin: 6px 0; }
.hyp-body ul.obs li { margin-bottom: 6px; }
