:root{
  --bg:#d1d1d1;
  --card:#fff9bc;
  --ink:#151515;
  --line:#1b1b1b;
  --mac:#f0f7ff;
  --heir:#fff2a8;
  --shadow:rgba(0,0,0,.18);
}

*{
  box-sizing:border-box;
}

body{
  margin:0;
  background:var(--bg);
  font-family:Georgia,'Times New Roman',serif;
  color:var(--ink);
}

.page{
  min-width:1600px;
  padding:128px 34px 44px;
}

.viewport-controls{
  position:fixed;
  top:0;
  left:0;
  right:0;
  z-index:10;
  width:100vw;
  margin-left:0;
  padding:18px 34px 12px;
  background:linear-gradient(to bottom, rgba(209,209,209,.97), rgba(209,209,209,.9));
}

header{
  text-align:center;
  margin-bottom:10px;
}

h1{
  margin:0;
  font-size:34px;
}

header p{
  margin:6px 0 0;
  font-size:16px;
}

.tree-toolbar{
  display:flex;
  align-items:center;
  justify-content:center;
  flex-wrap:wrap;
  gap:8px;
  width:min(100%, 760px);
  margin:0 auto;
  padding:8px 10px;
  background:rgba(255,255,255,.82);
  border:1px solid rgba(0,0,0,.12);
  box-shadow:0 6px 14px rgba(0,0,0,.12);
}

.tree-toolbar button{
  min-width:36px;
  height:32px;
  border:1px solid rgba(0,0,0,.2);
  background:#fff;
  color:var(--ink);
  font:700 15px Georgia,'Times New Roman',serif;
  cursor:pointer;
}

.tree-toolbar button:hover{
  background:#f0f7ff;
}

.search-box{
  display:flex;
  align-items:center;
  gap:6px;
  font-size:12.5px;
}

.search-box input{
  width:180px;
  height:32px;
  border:1px solid rgba(0,0,0,.22);
  background:#fff;
  color:var(--ink);
  padding:5px 8px;
  font:13px Georgia,'Times New Roman',serif;
}

.search-count{
  min-width:72px;
  font-size:12.5px;
  text-align:left;
}

.toolbar-divider{
  width:1px;
  height:24px;
  background:rgba(0,0,0,.18);
}

.zoom-label{
  min-width:54px;
  text-align:center;
  font-size:12.5px;
}

.tree{
  position:relative;
  width:1540px;
  height:1000px;
  margin:18px auto 0;
}

.tree-lines{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  overflow:visible;
  pointer-events:none;
  z-index:0;
}

.tree-lines path,
.tree-lines line{
  fill:none;
  stroke:var(--line);
  stroke-width:3;
  stroke-linecap:square;
  stroke-linejoin:miter;
}

.person{
  position:absolute;
  z-index:1;
  width:222px;
  min-height:104px;
  background:var(--card);
  border:1px solid rgba(0,0,0,.08);
  box-shadow:0 8px 18px var(--shadow);
  padding:10px 12px;
  text-align:center;
  display:flex;
  flex-direction:column;
  justify-content:center;
  transition:background-color .18s ease, border-color .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.person h2{
  font-size:17px;
  line-height:1.15;
  margin:0 0 6px;
  font-weight:600;
}

.person p{
  font-size:12.5px;
  line-height:1.28;
  margin:2px 0;
}

.person small{
  font-size:11px;
}

.unknown{
  visibility:visible;
}

.mac{
  background:var(--mac);
}

.heir{
  outline:3px solid rgba(180,143,0,.28);
}

.monarch{
  background:#fff2a8;
  border-color:rgba(180,143,0,.35);
  box-shadow:0 8px 18px var(--shadow), inset 0 0 0 3px rgba(180,143,0,.18);
}

.current-heir{
  background:#dff3d1;
  border-color:rgba(66,116,45,.45);
  box-shadow:0 8px 18px var(--shadow), inset 0 0 0 3px rgba(66,116,45,.22);
}

.child{
  width:238px;
}

.marriage{
  position:absolute;
  z-index:2;
  width:34px;
  height:34px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:34px;
  line-height:1;
  color:#111;
}

.mac h2{
  font-size:16.5px;
}

.tree.has-hover .person{
  opacity:.45;
}

.tree.has-hover .person.hover-source{
  opacity:1;
  background:#f8e8b4;
  border-color:#9d741f;
}

.tree.has-hover .person.descendant-highlight{
  opacity:1;
  background:#c8e4f8;
  border-color:#94a0b4;
  box-shadow:0 9px 20px rgba(48,83,120,.26);
}

.tree-lines path.descendant-line{
  stroke:#94a0b4;
  stroke-width:4;
}

.person.search-match{
  box-shadow:0 0 0 3px rgba(90,122,165,.34), 0 8px 18px var(--shadow);
}

.person.search-active{
  background:#f8e8b4;
  border-color:#9d741f;
  box-shadow:0 0 0 4px rgba(157,116,31,.35), 0 9px 20px rgba(0,0,0,.22);
}

@media print{
  body{
    background:white;
  }

  .person{
    box-shadow:none;
  }

  .page{
    padding:10px;
  }

  .tree{
    transform:scale(.78);
    transform-origin:top center;
  }
}
