:root {
    --bg-color: #1a0b2e;
    /* Deep Purple */
    --card-bg: rgba(255, 255, 255, 0.1);
    --text-color: #e0e0e0;
    --accent-gold: #ffd700;
    --accent-jade: #00a86b;
    --accent-purple: #9b59b6;
    --line-color: rgba(255, 255, 255, 0.3);
    --font-family: 'Helvetica Neue', Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    background-image: radial-gradient(circle at 50% 50%, #2c1e3e 0%, #1a0b2e 100%);
    min-height: 100vh;
}

header {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--line-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

h1 {
    margin: 0;
    font-size: 2rem;
    color: var(--accent-gold);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 2px;
}

nav {
    margin-top: 15px;
}

nav a {
    color: var(--text-color);
    text-decoration: none;
    margin: 0 15px;
    font-size: 1.1rem;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

nav a:hover,
nav a.active {
    background: var(--accent-jade);
    color: white;
    box-shadow: 0 0 10px var(--accent-jade);
}

main {
    padding: 40px 20px;
    position: relative;
    min-height: 80vh;
    display: flex;
    justify-content: center;
}

/* Container for the correlation chart */
#chart-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    height: 800px;
    /* Adjust based on content */
    /* border: 1px dashed rgba(255,255,255,0.1); Debugging border */
}

/* Character Card Styles */
.character-card {
    position: absolute;
    width: 120px;
    background: var(--card-bg);
    backdrop-filter: blur(5px);
    border: 1px solid var(--accent-gold);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.character-card:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px var(--accent-gold);
    z-index: 20;
}

.character-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 8px;
    border: 2px solid var(--accent-jade);
    background-color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: #888;
    overflow: hidden;
    margin-left: auto;
    margin-right: auto;
}

.character-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.character-name {
    font-weight: bold;
    font-size: 1rem;
    color: var(--accent-gold);
    margin-bottom: 4px;
}

.character-role {
    font-size: 0.8rem;
    color: #ccc;
}

/* SVG Line Styles */
svg#connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #2c1e3e;
    margin: 10% auto;
    padding: 30px;
    border: 2px solid var(--accent-gold);
    width: 80%;
    max-width: 500px;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
    text-align: center;
    position: relative;
    animation: fadeIn 0.3s ease-out;
    color: var(--text-color);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
    cursor: pointer;
    transition: color 0.3s;
}

.close-button:hover,
.close-button:focus {
    color: var(--accent-gold);
    text-decoration: none;
    cursor: pointer;
}

.modal-img-container {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 20px;
    border: 3px solid var(--accent-jade);
    box-shadow: 0 0 15px var(--accent-jade);
}

.modal-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-name {
    font-size: 1.8rem;
    color: var(--accent-gold);
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.modal-role {
    font-size: 1.2rem;
    color: var(--accent-purple);
    margin-bottom: 20px;
    font-weight: bold;
}

.modal-desc {
    font-size: 1rem;
    line-height: 1.6;
    text-align: left;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .character-card {
        width: 100px;
        padding: 5px;
    }

    .character-img {
        width: 60px;
        height: 60px;
        font-size: 18px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .modal-content {
        margin: 20% auto;
        width: 90%;
    }
}