.node rect {
  fill: #fff;
  stroke: #0369a1;
  stroke-width: 1px;
  rx: 6;
  ry: 6;
}

.node text {
  font-size: 12px;
  pointer-events: none;
}

.link {
  fill: none;
  stroke: #9AAFC4;
  stroke-width: 1.2;
}

.ftpro-container {
  width: 100%;
  height: 640px;            /* initial; the renderer sizes the drawing area itself */
  border: 1px solid #e6edf3;
  position: relative;
  background: #f9fbfd;
  font-family: 'Segoe UI', 'Arial', sans-serif;
  overflow: hidden; /* Prevents SVG from spilling out of bounds */
  box-sizing: border-box;
  max-width: 100%;
  /* NOTE: no touch-action here — the control panel inside the container must
     still let the page scroll. Only the drawing area captures touch. */
}

/* Drawing area: pan / pinch go to D3, not the page */
.ftpro-svg-area {
  position: relative;
  width: 100%;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: contain;
}

/* Fixes Safari height computation bugs and ensures touch actions route to D3 */
.ftpro-container svg {
  display: block; 
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Crisper thin lines / text when the tree is scaled down */
.ftpro-container svg text { text-rendering: optimizeLegibility; }

@media (max-width: 768px), (max-height: 500px) and (max-width: 1024px) {
  .ftpro-container { border-left: 0; border-right: 0; }
  .ft-context-menu { font-size: 14px; }
}

.ftpro-tooltip {
  position: absolute;
  padding: 8px 12px;
  background: rgba(0,0,0,0.90);
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  pointer-events: none;
  z-index: 9999;
  max-width: 240px;
  box-shadow: 0 2px 8px rgba(18,33,66,0.14);
}

.ftpro-svg .ft-node rect {
  fill: #fff;
  stroke: #0369a1;
  stroke-width: 1.3px;
  rx: 8;
  ry: 8;
  filter: drop-shadow(0 1px 2px rgba(3,105,161,0.08));
  transition: fill 0.18s;
}

.ftpro-svg .ft-node:hover rect {
  fill: #e0f2fe;
  stroke: #0ea5e9;
}

.ftpro-svg .ft-node text {
  font-size: 12px;
  pointer-events: none;
  font-weight: 600;
}

.ftpro-svg .ft-link {
  fill: none;
  stroke: #9AAFC4;
  stroke-width: 1.2;
}

.ftpro-svg .ft-link.spouse-link {
  stroke-dasharray: 4 4;
  stroke: #3b82f6;
}

.ftpro-svg .ft-node[role="Spouse"] rect {
  fill: #e0e7ef;
}

.ftpro-svg .ft-node[role="Sibling"] rect {
  fill: #f1f5f9;
}

.ftpro-svg .ft-node[role="Root"] rect {
  fill: #f0f9ff;
  stroke: #0284c7;
  stroke-width: 2;
}

.ftpro-context-menu {
  position: absolute;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 10000;
  min-width: 160px;
  font-size: 14px;
}

.ftpro-menu-item {
  padding: 8px 12px;
  cursor: pointer;
}

.ftpro-menu-item:hover {
  background: #f0f0f0;
}

/* ---------- Family Tree Hint Bar ---------- */
.ft-top-hint {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: #ffffff;
  padding: 8px 14px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  z-index: 100000;
  font-size: 13px;
  color: #0f172a;
  font-weight: 600;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 92%;
  white-space: nowrap;
}

.ft-top-hint span strong {
  font-weight: 800;
}

.ft-hint-close {
  margin-left: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  color: #64748b;
  transition: color 0.2s ease;
}

.ft-hint-close:hover {
  color: #000;
}

/* Responsive: shift slightly down on small screens */
@media (max-width: 600px) {
  .ft-top-hint {
    top: 8px;
    font-size: 12px;
    padding: 6px 10px;
    white-space: normal;
  }
}