body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f9f9f9;
    color: #333;
}

header {
    text-align: center;
    padding: 20px;
    background-color: #4CAF50;
    color: white;
}

nav {
    text-align: center;
    margin: 20px 0;
}

button {
    padding: 10px 20px;
    margin: 0 10px;
    border: none;
    background-color: #4CAF50;
    color: white;
    cursor: pointer;
    border-radius: 5px;
}

button:hover {
    background-color: #45a049;
}

button.active {
    background-color: #2e7d32;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

button:focus {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

main {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

section {
    margin-bottom: 20px;
}

section h2 {
    color: #2e7d32;
    border-bottom: 2px solid #4CAF50;
    padding-bottom: 5px;
    margin-bottom: 20px;
}

.hidden {
    display: none;
}

#tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    pointer-events: auto; /* Allow interaction with tooltip */
    z-index: 10;
    display: none;
    transition: opacity 0.3s ease-in-out; /* Increased duration */
    max-width: 250px;
    font-size: 12px;
    line-height: 1.4;
}

#tooltip:hover {
    opacity: 1 !important; /* Keep tooltip visible when hovering over it */
}

#venn-diagram, #knowledge-graph {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    min-height: 400px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#venn-diagram svg, #knowledge-graph svg {
    display: block;
    margin: 0 auto;
    border-radius: 4px;
    overflow: visible; /* Allow text to extend beyond SVG bounds if needed */
}

.venn-circle {
    /* fill-opacity: 0.3; */ /* Controlled by JS */
    /* stroke-width: 2; */ /* Controlled by JS */
    /* stroke-opacity: 0.8; */ /* Controlled by JS */
}

.venn-circle:hover {
    /* fill-opacity: 0.5; */ /* Controlled by JS */
    /* transition: fill-opacity 0.2s ease; */ /* Transitions can be kept if desired */
}

.venn-intersection {
    /* fill-opacity: 0.4; */ /* Controlled by JS */
}

.venn-intersection:hover {
    /* fill-opacity: 0.6; */ /* Controlled by JS */
    /* transition: fill-opacity 0.2s ease; */ /* Transitions can be kept if desired */
}

.venn-circle path, .venn-intersection path { /* General path styling, can be overridden by JS */
    stroke: #333;
    stroke-width: 1px;
}

.venn-circle:hover path, .venn-intersection:hover path { /* Enhanced hover, JS provides more specific control */
    stroke-width: 2px;
    stroke: #000;
}

.venn-area text { /* Ensure text is visible and well-styled */
    font-size: 14px;
    font-weight: bold;
    fill: #333;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: auto; /* Enable interaction with text */
    cursor: pointer;
}

label {
    display: block;
    margin: 10px 0;
    font-weight: bold;
}

#node-count {
    color: #4CAF50;
    font-weight: bold;
}

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading-spinner::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    background-color: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid #c62828;
    margin: 20px 0;
}

.legend {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.venn-legend {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ddd;
}

@media (max-width: 768px) {
    main {
        padding: 10px;
    }

    button {
        margin: 5px 0;
        width: 90%;
    }
}

input[type="range"] {
    width: 100%;
    margin: 10px 0;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 15px;
    height: 15px;
    background: #4CAF50;
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 15px;
    height: 15px;
    background: #4CAF50;
    border-radius: 50%;
    cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.controls {
    margin: 15px 0;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 5px;
    border: 1px solid #ddd;
}

svg {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.venn-area text {
    font-size: 14px;
    font-weight: bold;
    fill: #333;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: auto; /* Enable interaction with text */
    cursor: pointer;
}

svg text tspan {
    pointer-events: inherit; /* Inherit pointer events from parent text element */
}

footer {
    margin-top: 40px;
    padding: 20px;
    background-color: #f1f1f1;
    border-top: 1px solid #ddd;
}

footer h2 {
    color: #2e7d32;
    margin-bottom: 10px;
}

footer p, footer ol, footer ul {
    color: #333;
    line-height: 1.6;
    margin: 10px 0;
}

footer ol, footer ul {
    padding-left: 20px;
}

footer li {
    margin-bottom: 5px;
}

footer #data-sources ul {
    list-style-type: disc;
    margin-left: 20px;
}

footer #data-sources li {
    margin-bottom: 5px;
    line-height: 1.6;
}
