:root {
  --bg: #faf8f3; --fg: #1f1d1a; --muted: #6b655c; --line: #e4ddd0; --card: #ffffff;
  --accent: #2f5d50; --accent-2: #8a5a2b; --mark: #fff1b8;
  --b: #2f5d50; --m: #8a5a2b; --d: #5b5f6b;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #171614; --fg: #ece8e1; --muted: #a39d93; --line: #34312c; --card: #201f1c;
          --accent: #8cc2b0; --accent-2: #d7a774; --mark: #5a4a12; --b: #8cc2b0; --m: #d7a774; --d: #a9adb8; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); line-height: 1.5; font-size: 16px; }
a { color: var(--accent); }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }
.top { border-bottom: 1px solid var(--line); background: var(--card); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 16px; }
.brand { font-weight: 700; font-size: 20px; text-decoration: none; color: var(--fg); white-space: nowrap; }
nav { white-space: nowrap; }
[hidden] { display: none !important; }
.brand span { color: var(--accent-2); font-weight: 500; }
nav a { margin-left: 18px; text-decoration: none; color: var(--muted); }
nav a[aria-current] { color: var(--fg); font-weight: 600; }
.hero h1 { font-size: clamp(24px, 4vw, 34px); line-height: 1.2; margin: 28px 0 8px; }
.lead { color: var(--muted); margin: 0 0 20px; }
.search { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.search .row { display: flex; gap: 8px; }
.search input[type=search] { flex: 1; min-width: 0; font-size: 17px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
.search button { font-size: 16px; padding: 10px 18px; border: 0; border-radius: 8px; background: var(--accent); color: var(--bg); cursor: pointer; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 10px; color: var(--muted); font-size: 14px; align-items: center; }
.filters input[type=number] { width: 72px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); }
.parts label { margin-right: 10px; }
.status { color: var(--muted); margin: 16px 0 8px; min-height: 1.5em; }
.results { list-style: none; padding: 0; margin: 0; }
.rec { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--b); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.rec.M { border-left-color: var(--m); } .rec.D { border-left-color: var(--d); }
.rec h3 { margin: 0 0 4px; font-size: 18px; }
.rec .meta { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.rec .kind { font-weight: 600; color: var(--b); } .rec.M .kind { color: var(--m); } .rec.D .kind { color: var(--d); }
.rec dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 0; font-size: 15px; }
.rec dt { color: var(--muted); }
.rec dd { margin: 0; }
.rec .src { font-size: 12px; color: var(--muted); margin-top: 8px; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }
.more { display: block; margin: 8px auto 24px; padding: 10px 20px; border: 1px solid var(--line); background: var(--card); color: var(--fg); border-radius: 8px; cursor: pointer; font-size: 15px; }
.help { margin: 28px 0; color: var(--muted); font-size: 15px; }
.help h2 { font-size: 18px; color: var(--fg); }
.foot { border-top: 1px solid var(--line); margin-top: 40px; padding: 16px 0 28px; color: var(--muted); font-size: 13px; }
table.cov { border-collapse: collapse; font-size: 14px; margin: 8px 0 16px; }
table.cov th, table.cov td { border-bottom: 1px solid var(--line); padding: 3px 10px; text-align: right; }
table.cov th:first-child, table.cov td:first-child { text-align: left; }
.prose { max-width: 720px; }
.prose h1 { font-size: 28px; margin-top: 28px; }
@media (max-width: 560px) {
  .rec dl { grid-template-columns: 1fr; } .rec dt { margin-top: 4px; }
}
/* відео */
.channels { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px 10px; margin-bottom: 18px; }
.channels h2 { font-size: 17px; margin: 12px 0 6px; }
.channels ul { margin: 0; padding-left: 18px; }
.channels li { margin: 4px 0; color: var(--muted); }
.channels li a { color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.chips button { border: 1px solid var(--line); background: var(--card); color: var(--fg); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 14px; }
.chips button span { color: var(--muted); margin-left: 4px; }
.chips button[aria-selected=true] { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.chips button[aria-selected=true] span { color: var(--bg); opacity: .8; }
.vgrid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.vcard { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.thumb { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; padding: 0; background: #000; cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb iframe { width: 100%; height: 100%; border: 0; display: block; }
.thumb .dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.75); color: #fff; font-size: 12px; padding: 1px 5px; border-radius: 4px; }
.thumb .play { position: absolute; inset: 0; display: grid; place-items: center; font-size: 40px; color: rgba(255,255,255,.9); text-shadow: 0 2px 8px rgba(0,0,0,.6); opacity: .85; }
.thumb:hover .play { opacity: 1; }
.vbody { padding: 10px 12px 12px; }
.vmeta { font-size: 12px; color: var(--muted); }
.vcat { color: var(--accent-2); font-weight: 600; }
.vbody h3 { font-size: 16px; margin: 4px 0 2px; line-height: 1.3; }
.vbody h3 a { color: var(--fg); text-decoration: none; }
.vbody h3 a:hover { text-decoration: underline; }
.vch { font-size: 13px; color: var(--muted); }
.vdesc { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.note { color: var(--muted); font-size: 14px; margin: 20px 0; }
/* головна */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 22px 0; }
.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; text-decoration: none; color: var(--fg); }
.card:hover { border-color: var(--accent); }
.card h2 { font-size: 18px; margin: 0 0 6px; color: var(--accent); }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.village h2 { font-size: 21px; margin-top: 28px; }
.facts, .timeline { padding-left: 18px; }
.facts li, .timeline li { margin: 6px 0; }
.src { color: var(--muted); font-size: 13px; }
/* ревізії */
.rec.R { border-left-color: var(--accent-2); }
.rec.R .kind { color: var(--accent-2); }
table.fam { width: 100%; border-collapse: collapse; font-size: 15px; margin-top: 4px; }
table.fam th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); padding: 2px 6px 2px 0; }
table.fam td { border-bottom: 1px solid var(--line); padding: 4px 8px 4px 0; vertical-align: top; }
table.fam tr:last-child td { border-bottom: 0; }
table.fam td.age { white-space: nowrap; color: var(--muted); font-size: 14px; }
table.fam td.left { color: var(--muted); font-size: 14px; }
table.fam tr.f td:first-child { padding-left: 10px; }
table.fam tr.hit td { background: color-mix(in srgb, var(--mark) 45%, transparent); }
table.fam .rel { font-size: 13px; color: var(--muted); }
.unsure { color: var(--accent-2); font-weight: 600; cursor: help; }
@media (max-width: 560px) { table.fam td.left { font-size: 13px; } }
/* шапка на вузьких екранах: бренд зверху, меню рядком під ним (гортається вбік) */
@media (max-width: 720px) {
  .top .wrap { height: auto; flex-direction: column; align-items: flex-start; gap: 2px; padding-top: 10px; padding-bottom: 4px; }
  nav { display: flex; gap: 18px; width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  nav::-webkit-scrollbar { display: none; }
  nav a { margin-left: 0; padding: 6px 0 8px; font-size: 16px; }
  nav a[aria-current] { box-shadow: inset 0 -2px 0 var(--accent); }
}
/* публікації */
.biblio ol, .biblio ul { padding-left: 22px; }
.biblio li { margin: 10px 0; }
.biblio li p { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.biblio h2 { margin-top: 30px; }
.timeline ul { margin: 6px 0 2px; padding-left: 18px; }
.src-list { font-size: 14px; color: var(--muted); }

.photo{margin:1.5rem 0}
.photo img{display:block;width:100%;height:auto;border-radius:6px}
.photo figcaption{font-size:.9rem;opacity:.75;margin-top:.4rem}
.photo-pair{display:grid;grid-template-columns:1fr 1fr;gap:1rem;align-items:start}
.photo-pair .photo{margin:1.5rem 0 0}
@media (max-width:720px){.photo-pair{grid-template-columns:1fr}}
.photo-pair img{aspect-ratio:4/3;object-fit:cover}
.hero-photo{margin:1.2rem 0 .5rem}
.hero-photo img{display:block;width:100%;height:auto;aspect-ratio:16/9;object-fit:cover;object-position:60% 0%;border-radius:8px}
.hero-photo figcaption{font-size:.85rem;opacity:.7;margin-top:.35rem}
@media (max-width:720px){.hero-photo img{aspect-ratio:4/3}}
.photo-pair.maps img{aspect-ratio:auto;object-fit:contain}
.mem h2{font-size:1.15rem;margin:1.6rem 0 .2rem}
.mem .cnt{font-size:.85rem;opacity:.65;font-weight:400;margin-left:.3rem}
.mem .src{font-size:.85rem;opacity:.7;margin:0 0 .6rem}
.memlist{padding-left:1.4rem;margin:0}
.memlist li{margin:.35rem 0;line-height:1.45}
.memlist .rel{font-size:.85rem;opacity:.7}
.memlist .pg{font-size:.8rem;opacity:.55;margin-left:.5rem;white-space:nowrap}
.contact{display:grid;gap:.9rem;max-width:640px;margin:1.2rem 0}
.contact label{display:grid;gap:.3rem;font-weight:600}
.contact .opt{font-weight:400;opacity:.6}
.contact input,.contact textarea{font:inherit;padding:.6rem .7rem;border-radius:8px;border:1px solid var(--line, #444);background:var(--card, transparent);color:inherit}
.contact textarea{resize:vertical}
.contact button{justify-self:start}
.contact .hp{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}
.contact button{font-size:16px;padding:10px 22px;border:0;border-radius:8px;background:var(--accent);color:var(--bg);cursor:pointer}
.contact button:disabled{opacity:.6;cursor:default}
.contact label .opt{display:inline}
.contact label{grid-template-columns:1fr}
.contact label>span.opt{grid-row:1}
.photo-pair.three{grid-template-columns:repeat(3,1fr)}
@media (max-width:720px){.photo-pair.three{grid-template-columns:1fr 1fr}}
.photo-pair.wide21{grid-template-columns:2fr 1fr;align-items:end}
@media (max-width:720px){.photo-pair.wide21{grid-template-columns:1fr}}
