:root{
  --bg: #16342A;
  --bg-panel: #1F4739;
  --paper: #F6EFDD;
  --paper-edge: #E7DBB8;
  --ink: #22281F;
  --muted: #6E7A6A;
  --gold: #C79A3D;
  --gold-soft: #E4C784;
  --maroon: #7A2E2E;
  --line: rgba(199,154,61,0.55);
}
*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  background: radial-gradient(120% 140% at 50% -10%, #1F4739 0%, #16342A 55%, #0F281F 100%);
  color: var(--paper);
  font-family: 'Inter', sans-serif;
  min-height:100vh;
}
a{color:inherit;}

header{
  padding: 48px 24px 32px;
  text-align:center;
  border-bottom: 1px solid rgba(231,219,184,0.15);
  position:relative;
}
.brand-eyebrow{
  font-family:'Fraunces', serif;
  font-style:italic;
  font-size:15px;
  color: var(--gold-soft);
  letter-spacing:0.02em;
  margin-bottom:6px;
}
h1{
  font-family:'Fraunces', serif;
  font-weight:600;
  font-size: clamp(32px, 5vw, 54px);
  margin: 0 0 12px;
  line-height:1.05;
}
header p.sub{
  color: rgba(246,239,221,0.75);
  max-width: 520px;
  margin: 0 auto;
  font-size:15px;
  line-height:1.5;
}
.account-bar{
  position:absolute;
  top:24px; right:24px;
  display:flex; gap:10px; align-items:center;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.account-bar .who{
  font-size:13px;
  color: rgba(246,239,221,0.75);
  margin-right:4px;
}

button, .btn{
  font-family:'Inter', sans-serif;
  font-size:13.5px;
  font-weight:600;
  border-radius:6px;
  padding:9px 16px;
  border:1px solid transparent;
  cursor:pointer;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
button:active{ transform: scale(0.97); }
.btn-gold{ background:var(--gold); color:#20281B; }
.btn-gold:hover{ background:var(--gold-soft); }
.btn-outline{ background:transparent; color:var(--paper); border-color:rgba(246,239,221,0.35); }
.btn-outline:hover{ border-color:var(--gold-soft); color:var(--gold-soft); }
.btn-text{ background:transparent; color:rgba(246,239,221,0.7); border:none; padding:6px 8px; }
.btn-text:hover{ color:var(--gold-soft); }
.btn-danger{ background:transparent; color:#D98686; border:1px solid rgba(217,134,134,0.4); }
.btn-danger:hover{ background:rgba(217,134,134,0.12); }

main{
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 120px;
}
#tree-wrap{
  position:relative;
  padding: 20px 0;
}
#connector-svg{
  position:absolute;
  top:0; left:0;
  width:100%; height:100%;
  pointer-events:none;
  z-index:0;
}
.generation{
  display:flex;
  justify-content:center;
  gap: 28px;
  flex-wrap:wrap;
  margin-bottom: 78px;
  position:relative;
  z-index:1;
}
.couple-group{
  display:flex;
  align-items:center;
  gap:22px;
}
.card{
  background: var(--paper);
  color: var(--ink);
  border-radius: 3px;
  width: 190px;
  padding: 16px 16px 14px;
  border: 1px solid var(--paper-edge);
  box-shadow: 0 10px 22px rgba(0,0,0,0.28);
  cursor:pointer;
  position:relative;
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover{ transform: translateY(-3px); box-shadow: 0 14px 26px rgba(0,0,0,0.35); }
.card .dot{
  width:8px;height:8px;border-radius:50%;
  background: var(--gold);
  margin-bottom:10px;
}
.card .dot.deceased{ background: var(--muted); }
.card h3{
  font-family:'Fraunces', serif;
  font-weight:600;
  font-size:17px;
  margin:0 0 4px;
  line-height:1.2;
}
.card .years{
  font-size:12px;
  color: var(--muted);
  margin-bottom:8px;
}
.card .bio-peek{
  font-size:12px;
  color:#4B5545;
  line-height:1.4;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

.empty-state{
  text-align:center;
  padding: 90px 20px;
  color: rgba(246,239,221,0.6);
}
.empty-state h2{
  font-family:'Fraunces', serif;
  font-weight:500;
  font-style:italic;
  font-size:26px;
  color: var(--gold-soft);
  margin-bottom:10px;
}

.fab{
  position:fixed;
  right:28px; bottom:28px;
  z-index:40;
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

.overlay{
  position:fixed; inset:0;
  background: rgba(10,20,15,0.6);
  backdrop-filter: blur(2px);
  display:none;
  align-items:center; justify-content:center;
  z-index:100;
  padding: 20px;
}
.overlay.open{ display:flex; }
.modal{
  background: var(--paper);
  color: var(--ink);
  width: 100%;
  max-width: 440px;
  max-height: 88vh;
  overflow-y:auto;
  border-radius:6px;
  padding: 28px 26px 24px;
  position:relative;
}
.modal h2{
  font-family:'Fraunces', serif;
  font-weight:600;
  font-size:22px;
  margin:0 0 4px;
}
.modal .modal-sub{
  font-size:13px;
  color: var(--muted);
  margin-bottom:18px;
}
.modal .close{
  position:absolute; top:16px; right:16px;
  background:none; border:none; color: var(--muted);
  font-size:20px; cursor:pointer; padding:4px;
}
label{
  display:block;
  font-size:12.5px;
  font-weight:600;
  margin: 14px 0 5px;
  color:#3B4536;
}
label.first{ margin-top:0; }
input[type=text], input[type=password], input[type=number], textarea, select{
  width:100%;
  font-family:'Inter', sans-serif;
  font-size:14px;
  padding: 9px 10px;
  border: 1px solid #D9CBA0;
  border-radius:4px;
  background:#FCF9F0;
  color: var(--ink);
}
textarea{ min-height:72px; resize:vertical; }
.field-row{ display:flex; gap:10px; }
.field-row > div{ flex:1; }
.form-actions{
  display:flex; justify-content:flex-end; gap:10px;
  margin-top:22px;
}
.error-msg{
  background:#F5DFDA; color:#7A2E2E;
  font-size:12.5px; padding:8px 10px;
  border-radius:4px; margin-top:12px;
  display:none;
}
.error-msg.show{ display:block; }
.switch-line{
  font-size:12.5px; color:var(--muted); margin-top:16px; text-align:center;
}
.switch-line a{ color: var(--maroon); font-weight:600; cursor:pointer; text-decoration:underline; }

.detail-body p{ font-size:14px; line-height:1.6; color:#3B4536; }
.detail-meta{ font-size:13px; color:var(--muted); margin-bottom:14px; }
.rel-list{ font-size:13px; color:#3B4536; margin: 4px 0 14px; }
.rel-list b{ color:var(--ink); }

footer{
  text-align:center;
  padding: 30px 20px 50px;
  font-size:12px;
  color: rgba(246,239,221,0.35);
}

@media (max-width:600px){
  .account-bar{ position:static; justify-content:center; margin-top:18px; }
  header{ padding:32px 16px 24px; }
  .card{ width: 155px; }
}
