:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    position: relative;
}

/* Background Dots Canvas */
#dots-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    opacity: 0.6;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 40px 20px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

.header-content {
    text-align: center;
}

.logo {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin-bottom: 20px;
    border: 4px solid white;
    background: white;
    object-fit: scale-down;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Section & Card */
.section {
    margin-bottom: 30px;
}

.card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* Forms */
.search-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 10px;
}

.input, .select {
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
    background: var(--bg-primary);
}

.input:focus, .select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-group {
    display: flex;
    gap: 10px;
}

.input-group .input {
    flex: 1;
}

/* Slider */
.slider {
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    border-radius: 4px;
    background: var(--border);
    outline: none;
    transition: all 0.2s;
}

.slider:hover {
    background: var(--text-tertiary);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: all 0.2s;
}

.slider::-webkit-slider-thumb:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.slider::-moz-range-thumb:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.1rem;
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Papers List */
.papers-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.paper-card {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    border: 2px solid var(--border);
    transition: all 0.2s;
    cursor: pointer;
}

.paper-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.paper-card.selected {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.paper-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.paper-authors {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.paper-abstract {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}

.paper-meta {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.paper-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.paper-link:hover {
    text-decoration: underline;
}

/* Analysis */
.analysis-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.analysis-results {
    margin-top: 20px;
}

.similarity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.similarity-card {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.similarity-score {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.concepts-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.concept-tag {
    background: var(--primary);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.summary-box {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--secondary);
    margin-top: 16px;
    line-height: 1.8;
}

/* Hints */
.hint {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.hint-small {
    color: var(--text-tertiary);
    font-size: 0.85rem;
    margin-top: 8px;
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

#loading-text {
    color: white;
    margin-top: 20px;
    font-size: 1.1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.success {
    border-left-color: var(--secondary);
}

.toast.warning {
    border-left-color: var(--warning);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Auth Section */
.auth-section {
    max-width: 500px;
    margin: 0 auto;
}

.auth-form {
    margin-top: 20px;
}

.auth-form .form-group:nth-child(2) label {
    margin-top: 10px;
}

#login-btn {
    margin-top: 10px;
}

#signup-btn {
    margin-top: 10px;
}

#discover-btn {
    margin-top: 30px;
}

.auth-switch {
    text-align: center;
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-switch a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* Pricing Card */
.pricing-card {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(16, 185, 129, 0.05) 100%);
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    margin: 24px 0;
}

.price {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 24px;
}

.period {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.features-list {
    list-style: none;
    padding: 0;
    margin: 24px 0;
    text-align: left;
}

.features-list li {
    padding: 12px 0;
    font-size: 1.05rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
}

.features-list li:last-child {
    border-bottom: none;
}

/* User Menu */
.user-menu {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.user-button {
    background: white;
    border: 2px solid var(--primary);
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-button:hover {
    background: var(--bg-secondary);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    display: none;
}

.user-dropdown.show {
    display: block;
}

.user-dropdown-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}

.user-dropdown-item:last-child {
    border-bottom: none;
}

.user-dropdown-item:hover {
    background: var(--bg-secondary);
}

.usage-indicator {
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.usage-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    margin-top: 8px;
    overflow: hidden;
}

.usage-bar-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

/* Domain Search */
.domain-search-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.domain-search-box {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    border: 2px solid var(--border);
}

.domain-search-box h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--primary);
}

.optional {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    font-weight: normal;
}

/* Papers by Domain */
.papers-by-domain {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.domain-papers-section {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.domain-papers-section h3 {
    margin-bottom: 16px;
    color: var(--primary);
}

.domain-papers-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mini-paper-card {
    background: var(--bg-primary);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-size: 0.9rem;
}

.mini-paper-card .paper-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.mini-paper-card .paper-authors {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* Connections */
.connections-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-top: 20px;
}

.connection-card {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(16, 185, 129, 0.05) 100%);
    padding: 24px;
    border-radius: 12px;
    border: 2px solid var(--primary);
    position: relative;
}

.connection-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.connection-strength {
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 1.1rem;
}

.connection-type {
    background: var(--secondary);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.9rem;
    font-weight: 600;
}

.connection-domains {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.domain-badge {
    background: var(--bg-primary);
    padding: 8px 16px;
    border-radius: 8px;
    border: 2px solid var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.analogy-explanation {
    background: var(--bg-primary);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    line-height: 1.8;
}

.analogy-explanation h4 {
    color: var(--primary);
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.mechanism-comparison {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    margin: 16px 0;
    align-items: center;
}

.mechanism-box {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.mechanism-box h5 {
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.arrow {
    font-size: 2rem;
    color: var(--primary);
}

.evidence-section {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 8px;
    margin-top: 16px;
}

.evidence-section h4 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 1rem;
}

.evidence-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.evidence-item {
    padding: 8px 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    border-left: 3px solid var(--secondary);
    font-size: 0.9rem;
}

.paper-reference {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.paper-reference:hover {
    text-decoration: underline;
}

/* Hypotheses */
.hypotheses-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.hypothesis-card {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, rgba(239, 68, 68, 0.05) 100%);
    padding: 24px;
    border-radius: 12px;
    border: 2px solid var(--warning);
}

.hypothesis-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.hypothesis-number {
    background: var(--warning);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
}

.hypothesis-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
}

.hypothesis-content {
    background: var(--bg-primary);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    line-height: 1.8;
}

.hypothesis-rationale {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid var(--warning);
    margin-bottom: 16px;
}

.hypothesis-rationale h4 {
    color: var(--warning);
    margin-bottom: 8px;
    font-size: 1rem;
}

.testable-predictions {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 8px;
}

.testable-predictions h4 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 1rem;
}

.predictions-list {
    list-style: none;
    padding: 0;
}

.predictions-list li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
}

.predictions-list li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--warning);
    font-weight: bold;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    gap: 40px;
    justify-content: center;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-buttons .btn {
    min-width: 200px;
}

/* Patterns */
.patterns-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.pattern-card {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(37, 99, 235, 0.05) 100%);
    padding: 24px;
    border-radius: 12px;
    border: 2px solid var(--secondary);
}

.pattern-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 12px;
}

.pattern-instances {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.pattern-instance {
    background: var(--bg-primary);
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid var(--secondary);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content {
    background: white;
    padding: 32px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-buttons .btn {
    flex: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        padding: 10px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .card {
        padding: 20px;
    }
    
    .domain-search-container {
        grid-template-columns: 1fr;
    }
    
    .mechanism-comparison {
        grid-template-columns: 1fr;
    }
    
    .arrow {
        transform: rotate(90deg);
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* Notebooks View */
.notebooks-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
}

.notebook-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s;
    cursor: pointer;
}

.notebook-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.notebook-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.notebook-header h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin: 0;
}

.notebook-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-tertiary);
}

.notebook-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state p:first-child {
    font-size: 3rem;
    margin-bottom: 16px;
}

.loading-text {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid var(--danger);
    border-radius: 8px;
    padding: 16px;
    color: var(--danger);
    text-align: center;
}

/* Tooltips */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    white-space: normal;
    width: 250px;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.3s ease;
}

.tooltip:hover::before {
    content: '';
    position: absolute;
    bottom: 92%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--text-primary);
    z-index: 1000;
}

/* Paper links */
.paper-link {
    color: var(--primary);
    text-decoration: none;
    margin-left: 8px;
    font-size: 16px;
    transition: all 0.2s ease;
}

.paper-link:hover {
    transform: scale(1.1);
    color: var(--primary-dark);
}

/* Connection header with chord icon - Override earlier definition */
.connection-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.connection-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.chord-icon {
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.chord-icon:hover {
    background: rgba(37, 99, 235, 0.1);
    transform: scale(1.1);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(5px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Chord Diagram Modal */
.chord-modal-content {
    max-width: min(90vw, 700px);
    max-height: 90vh;
    width: auto;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--danger);
}

#chord-diagram-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 15px 0;
}

.chord-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.domain-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid rgba(255,255,255,0.3);
}

.chord-description {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

/* Tooltip for chord diagram */
.chord-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    pointer-events: none;
    z-index: 10000;
    max-width: 350px;
    min-width: 200px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    line-height: 1.4;
}

.chord-tooltip em {
    font-style: italic;
    color: #e2e8f0;
}

/* Chord diagram styles */
.chord-group {
    cursor: pointer;
}

.chord-group:hover {
    opacity: 0.8;
}

.chord {
    fill-opacity: 0.67;
    stroke: #000;
    stroke-width: 0.5px;
}

.chord:hover {
    fill-opacity: 0.9;
}
