:root {
  --bg: #faf8f4; --surface: #ffffff; --text: #1e1b16; --muted: #6b645a;
  --border: #e6dfd3; --accent: #8a5a2b; --accent-soft: #f3e8d8;
  --male: #2f6f6a; --female: #9c4a6b; --radius: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.topbar { background: #1e1b16; color: #faf8f4; padding: 28px 0 24px; }
.topbar h1 { margin: 0; font-size: 28px; letter-spacing: -0.02em; }
.subtitle { margin: 6px 0 0; color: #cfc6b8; font-size: 16px; }
.tabs { display: flex; gap: 8px; padding: 16px 16px 0; overflow-x: auto; }
.tab { flex: 1; min-height: 44px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); font-size: 16px; cursor: pointer; white-space: nowrap; padding: 0 16px; }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.search-row { display: flex; gap: 12px; align-items: center; margin: 16px 0; flex-wrap: wrap; }
.search-row input { flex: 1; min-width: 200px; min-height: 44px; font-size: 16px;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; background: var(--surface); }
.count { color: var(--muted); margin: 0; font-size: 15px; }
.view { padding-bottom: 24px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; }
.card h2, .card h3 { margin-top: 0; }
.muted { color: var(--muted); }
.generation { margin-bottom: 20px; }
.generation > h2 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 10px; }
.person-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .person-grid { grid-template-columns: 1fr 1fr; } }
.person { display: flex; gap: 14px; align-items: center; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; min-height: 88px; cursor: pointer; font-size: 16px; }
.person:hover { border-color: var(--accent); }
.avatar { width: 64px; height: 64px; border-radius: 50%; flex: none; object-fit: cover;
  display: flex; align-items: center; justify-content: center; font-size: 30px; color: #fff; }
.avatar.male { background: var(--male); }
.avatar.female { background: var(--female); }
.avatar.unknown { background: var(--muted); }
.person .name { font-weight: 700; font-size: 17px; margin: 0; }
.person .meta { color: var(--muted); margin: 2px 0 0; font-size: 15px; }
.tag { display: inline-block; background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; padding: 2px 10px; font-size: 13px; margin-top: 6px; }
.timeline-item { display: flex; gap: 14px; }
.timeline-item .year { font-weight: 700; min-width: 64px; }
[hidden] { display: none !important; }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex;
  align-items: flex-end; justify-content: center; z-index: 10; }
.sheet-card { background: var(--surface); border-radius: 20px 20px 0 0; width: 100%; max-width: 640px;
  max-height: 88vh; overflow-y: auto; padding: 20px 20px 32px; position: relative; }
@media (min-width: 640px) { .sheet { align-items: center; padding: 20px; } .sheet-card { border-radius: 20px; } }
.close { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); font-size: 18px; cursor: pointer; }
.detail-head { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.detail-head .avatar { width: 88px; height: 88px; font-size: 40px; }
.detail-head h2 { margin: 0; font-size: 22px; }
dl { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 12px 0; font-size: 16px; }
dt { color: var(--muted); } dd { margin: 0; }
.footer { color: var(--muted); font-size: 14px; padding-bottom: 32px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.empty { color: var(--muted); padding: 24px 0; }
/* Interactive map — pan / zoom node graph */
.map-wrap { position: relative; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); overflow: hidden; height: 62vh; min-height: 420px;
  touch-action: none; }
.map-hint { position: absolute; top: 10px; left: 10px; z-index: 3; margin: 0;
  background: rgba(255,255,255,0.92); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 12px; font-size: 14px; color: var(--muted); pointer-events: none; }
.map-controls { position: absolute; right: 10px; top: 10px; z-index: 3; display: flex; flex-direction: column; gap: 8px; }
.map-controls button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); font-size: 22px; line-height: 1; cursor: pointer; }
.map-canvas { position: absolute; top: 0; left: 0; transform-origin: 0 0; will-change: transform; }
.map-canvas svg { position: absolute; top: 0; left: 0; overflow: visible; }
.map-node { position: absolute; width: 156px; min-height: 92px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); padding: 10px; cursor: pointer;
  display: flex; gap: 10px; align-items: center; text-align: left; font-size: 16px; }
.map-node:hover { border-color: var(--accent); }
.map-node .avatar { width: 48px; height: 48px; font-size: 24px; }
.map-node .name { font-weight: 700; font-size: 15px; line-height: 1.25; display: block; }
.map-node .meta { color: var(--muted); font-size: 13px; display: block; margin-top: 2px; }
.map-node.you { border: 2px solid var(--accent); }
.map-gen-label { position: absolute; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); font-weight: 700; }
