    .force-graph-container .graph-tooltip {
      position: absolute;
      transform: translate(-50%, 25px);
      font-family: 'Merriweather', serif;
      font-size: 16px;
      padding: 0.3em 0.6em;
      border-radius: 6px;
      color: currentColor;
      background: rgba(0,0,0,0.75);
      visibility: hidden; /* by default */
      }

    .personinfo-modal {
      display: none;
      position: fixed;
      z-index: 1; 
      width: 100%;
      height: 100%;
      overflow: auto; 
      background-color: rgba(255, 255, 255, 0.1); 
    }

    .personinfo-content {
    background: rgba(15, 15, 15, 0.95); /* Slightly darker for better contrast */
    color: #eee;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    }

    /* Floating 'X' on top of the image */
    .personinfo-close {
        position: absolute;
        top: 8px;
        right: 12px;
        z-index: 10;
        cursor: pointer;
        font-size: 28px;
        color: white;
        text-shadow: 0 0 10px rgba(0,0,0,0.9); /* Makes it pop on light photos */
        transition: transform 0.2s ease;
    }

    .personinfo-close:hover, .personinfo-close:focus {
        opacity: 1;
        transform: scale(1.2);
        color: #ff4d4d;
    } 

    .modalportrait {
        display: none;
        width: auto;
        height: 100%; /* Fills the vertical height of the text column */
        max-width: 300px; /* Allows it to be wider for tall modals */
        min-width: 200px;
        object-fit: cover; /* This is key: it crops the photo to fill the area without stretching */
        margin: 0;
        /* Round the right corners to match the modal */
        border-radius: 0 8px 8px 0; 
    }

    .modallink{
      
      bottom: 10px;
      left: 10px;
    }
    #modalbirth, #modaldeath{
      font-size: 0.8em; 
    }
    #modalname{
      margin-bottom: 0.25rem;
    }

    #modalevents::-webkit-scrollbar {
      width: 6px;
    }
    #modalevents::-webkit-scrollbar-track {
      background: rgba(255, 255, 255, 0.05);
    }
    #modalevents::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.2);
      border-radius: 10px;
    }
    #modalevents::-webkit-scrollbar-thumb:hover {
      background: rgba(255, 215, 0, 0.4); /* Faint gold on hover */
    }

    #modalevents ul {
        padding-left: 18px; 
        margin-left: 0;
        margin-top: 10px;
    }

    #modalevents li {
        margin-bottom: 8px; 
    }

