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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 50%, #4a5568 100%);
    color: #e2e8f0;
    line-height: 1.4;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

.hidden {
    display: none !important;
}

/* Header */
.header {
    background: rgba(26, 32, 44, 0.95);
    backdrop-filter: blur(10px);
    padding: 1.5rem 0;
    border-bottom: 2px solid #3182ce;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.header.collapsed {
    padding: 0.5rem 0;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.header.collapsed .collapse-header-btn {
    display: none;
}

.expand-header-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #3182ce, #2c5282);
    color: #ffffff;
    border: none;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(49, 130, 206, 0.3);
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

.expand-header-btn.visible {
    opacity: 1;
    pointer-events: all;
    transform: scale(1);
}

.expand-header-btn:hover {
    background: linear-gradient(135deg, #2c5282, #1a365d);
    transform: scale(1.1);
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
    text-align: center;
}



.logo {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #3182ce, #63b3ed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    color: #a0aec0;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

/* Header Controls */
.header-controls {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.game-mode-btn, .tutorial-btn, .achievements-btn, .collapse-header-btn {
    background: linear-gradient(135deg, #3182ce, #2c5282);
    color: #ffffff;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(49, 130, 206, 0.3);
    font-weight: 600;
}

.game-mode-btn:hover, .tutorial-btn:hover, .achievements-btn:hover, .collapse-header-btn:hover {
    background: linear-gradient(135deg, #2c5282, #1a365d);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(49, 130, 206, 0.4);
}

.game-mode-btn.active {
    background: linear-gradient(135deg, #38a169, #2f855a);
    box-shadow: 0 4px 15px rgba(56, 161, 105, 0.4);
}

/* Session Tracker */
.session-tracker {
    background: linear-gradient(135deg, #38a169, #2f855a);
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    margin: 1rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    box-shadow: 0 4px 15px rgba(56, 161, 105, 0.3);
    font-weight: 600;
    max-width: fit-content;
    width: fit-content;
}

.session-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.session-count {
    font-size: 1.2rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    min-width: 2rem;
    text-align: center;
}

/* Game Stats */
.game-stats {
    background: linear-gradient(135deg, #2d3748, #4a5568);
    padding: 1rem;
    border-bottom: 2px solid #3182ce;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-label {
    color: #a0aec0;
    font-size: 0.9rem;
    font-weight: 500;
}

.stat-value {
    font-weight: 700;
    color: #63b3ed;
    font-size: 1.1rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Filters Panel */
.filters-panel {
    background: #2d3748;
    padding: 1rem;
    border-bottom: 1px solid #4a5568;
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.8rem;
    color: #a0aec0;
    white-space: nowrap;
}

.filter-group select {
    padding: 0.25rem 0.5rem;
    border: 1px solid #4a5568;
    font-size: 0.8rem;
    background: #4a5568;
    color: #e2e8f0;
}

.checkbox-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    cursor: pointer;
    color: #e2e8f0;
}

.checkbox-group input[type="checkbox"] {
    margin: 0;
}



/* List Container */
.list-container {
    background: #2d3748;
    border: 1px solid #4a5568;
    margin: 1rem 0;
}

.list-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-bottom: 1px solid #4a5568;
}

.list-content {
    max-height: 500px;
    overflow-y: auto;
    padding: 1rem;
}

.list-item {
    padding: 0.75rem;
    border-bottom: 1px solid #4a5568;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.list-item:hover {
    background: #4a5568;
}

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

.list-item h4 {
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    color: #e2e8f0;
}

.list-item p {
    color: #a0aec0;
    font-size: 0.8rem;
    line-height: 1.3;
}

/* Achievements Panel */
.achievements-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    z-index: 1000;
}

.achievements-panel.visible {
    display: block;
}

.achievements-list {
    padding: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-bottom: 1px solid #4a5568;
    transition: background-color 0.2s ease;
}

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

.achievement-item.unlocked {
    background: #4a5568;
}

.achievement-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.achievement-item.unlocked .achievement-icon {
    background: #4CAF50;
    color: #ffffff;
}

.achievement-item.locked .achievement-icon {
    background: #4a5568;
    color: #718096;
}

.achievement-info h4 {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    color: #e2e8f0;
}

.achievement-info p {
    font-size: 0.8rem;
    color: #a0aec0;
}

/* Tutorial Overlay */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.tutorial-overlay.visible {
    display: flex;
}

.tutorial-content {
    background: #2d3748;
    border-radius: 8px;
    padding: 2rem;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.tutorial-step h3 {
    margin-bottom: 1rem;
    color: #e2e8f0;
}

.tutorial-step p {
    margin-bottom: 1.5rem;
    color: #a0aec0;
    line-height: 1.5;
}

.tutorial-next {
    background: #3182ce;
    color: #ffffff;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.tutorial-next:hover {
    background: #2c5282;
}

/* Welcome Features */
.welcome-features {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: #e2e8f0;
}

.feature i {
    font-size: 1.5rem;
    color: #63b3ed;
}

.feature span {
    font-size: 0.8rem;
}

/* Search Section */
.search-section {
    padding: 3rem 1rem;
    background: linear-gradient(135deg, #2d3748, #4a5568);
    position: relative;
    overflow: hidden;
}

.search-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.1)"/><circle cx="10" cy="60" r="0.5" fill="rgba(255,255,255,0.1)"/><circle cx="90" cy="40" r="0.5" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

.search-container {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.search-box {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50px;
    padding: 0.75rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.search-box:focus-within {
    transform: scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

#searchInput {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
    background: transparent;
    color: #2d3748;
    font-weight: 500;
}

#searchInput::placeholder {
    color: #a0aec0;
    font-weight: 400;
}

.search-btn {
    background: linear-gradient(135deg, #3182ce, #2c5282);
    color: #ffffff;
    border: none;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    cursor: pointer;
    white-space: nowrap;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(49, 130, 206, 0.3);
}

.search-btn:hover {
    background: linear-gradient(135deg, #2c5282, #1a365d);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(49, 130, 206, 0.4);
}

.search-suggestions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
    transition: all 0.3s ease;
}

.search-suggestions.hidden {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    margin: 0;
}

.suggestion-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.suggestion-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #2d3748;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    border-radius: 20px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.suggestion-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #a0aec0;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #4a5568;
    border-top: 2px solid #3182ce;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 0.5rem;
}

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

/* Main Content */
.main-content {
    display: flex;
    flex-direction: row;
    max-width: none;
    margin: 0;
    padding: 0;
    transition: all 0.3s ease;
    flex: 1;
    min-height: 0; /* Allow content to shrink */
    height: auto; /* Let content determine height */
    gap: 0;
    position: relative;
}

/* Left Panel - Network */
.left-panel {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    min-height: 400px; /* Reasonable minimum height */
}

/* Right Panel - Node Details */
.right-panel {
    width: 400px;
    min-width: 350px;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.3s ease;
}

/* When no nodes are loaded, collapse the right panel */
.right-panel.collapsed {
    width: 0;
    min-width: 0;
    overflow: hidden;
    opacity: 0;
}

/* When right panel is collapsed, left panel takes full width */
.left-panel.expanded {
    flex: 1 1 100%;
}

/* When right panel is collapsed, hide the resize divider */
.resize-divider.collapsed {
    width: 0;
    opacity: 0;
    pointer-events: none;
}

/* Resizable Divider */
.resize-divider {
    display: block; /* Show resizable divider on mobile */
    width: 100%;
    height: 16px; /* Increased height for better touch target */
    background: linear-gradient(90deg, #3182ce, #63b3ed);
    cursor: ns-resize;
    position: relative;
    flex-shrink: 0;
    border: none;
    margin: 0;
    touch-action: none; /* Prevent default touch actions */
    -webkit-tap-highlight-color: transparent;
    z-index: 1000; /* Ensure it's above other elements */
    box-shadow: 0 2px 8px rgba(49, 130, 206, 0.3);
}

.resize-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 6px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.resize-divider:hover {
    background: linear-gradient(135deg, #2b6cb0, #2c5282);
}

.resize-divider:active {
    background: linear-gradient(135deg, #2c5282, #1a365d);
}

.resize-handle {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 0.8rem;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.resize-divider:hover .resize-handle {
    opacity: 1;
}

.resize-divider:active .resize-handle {
    opacity: 1;
}

/* When header is collapsed, expand main content to fill the space */
.header.collapsed ~ .main-content {
    margin-top: 0;
    padding-top: 0;
    height: calc(100vh - 50px); /* Fixed height to account for expand button and minimal padding */
    max-width: none;
    margin: 0;
    padding: 0;
}

/* When header is collapsed and game stats are hidden, give more space */
.header.collapsed ~ .game-stats.hidden ~ .main-content {
    margin-top: 0;
    padding-top: 0;
    height: calc(100vh - 30px); /* Fixed height - even less space needed */
    max-width: none;
    margin: 0;
    padding: 0;
}

/* When header is collapsed and filters are hidden, give more space */
.header.collapsed ~ .filters-panel.hidden ~ .main-content {
    margin-top: 0;
    padding-top: 0;
    height: calc(100vh - 30px); /* Fixed height - even less space needed */
    max-width: none;
    margin: 0;
    padding: 0;
}

/* Network Container */
.network-container {
    background: rgba(45, 55, 72, 0.95);
    backdrop-filter: blur(10px);
    border: 2px solid #3182ce;
    border-radius: 15px;
    margin: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    height: 100%;
    min-height: 350px; /* Reasonable minimum height */
    flex: 1;
}

/* When header is collapsed, make network container fill the viewport */
.header.collapsed ~ .main-content .network-container {
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    min-height: calc(100vh - 50px);
    height: calc(100vh - 50px);
}

/* When header is collapsed and other panels are hidden, use even more space */
.header.collapsed ~ .game-stats.hidden ~ .filters-panel.hidden ~ .main-content .network-container {
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    min-height: calc(100vh - 30px);
    height: calc(100vh - 30px);
}

.network-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 2px solid #e53e3e;
    background: linear-gradient(135deg, #f7fafc, #edf2f7);
}

.control-btn {
    background: linear-gradient(135deg, #3182ce, #2b6cb0);
    color: #ffffff;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 20px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(49, 130, 206, 0.3);
}

.control-btn:hover {
    background: linear-gradient(135deg, #2b6cb0, #2c5282);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(49, 130, 206, 0.4);
}



.zoom-btn {
    background: linear-gradient(135deg, #38a169, #2f855a);
    color: #ffffff;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    border-radius: 50%;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(56, 161, 105, 0.3);
}

.zoom-btn:hover {
    background: linear-gradient(135deg, #2f855a, #276749);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(56, 161, 105, 0.4);
}

.network-canvas {
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    width: 100%;
    min-height: calc(100vh - 300px); /* Ensure minimum height */
    transition: all 0.3s ease;
    flex: 1;
}

/* When header is collapsed, expand network canvas to use more space */
.header.collapsed ~ .main-content .network-canvas {
    min-height: 600px;
    height: 600px;
}

/* When header is collapsed and other panels are hidden, use even more space */
.header.collapsed ~ .game-stats.hidden ~ .filters-panel.hidden ~ .main-content .network-canvas {
    min-height: calc(100vh - 100px); /* Account for controls only */
    height: calc(100vh - 100px);
}

/* When header is collapsed, expand network canvas to use more space */
.header.collapsed ~ .main-content .network-canvas {
    min-height: calc(100vh - 120px); /* Account for controls and padding */
    height: calc(100vh - 120px);
}

.network-canvas svg {
    width: 100%;
    height: 100%;
}

.node {
    cursor: pointer;
    transition: all 0.2s ease;
}

.node:hover circle {
    r: 12;
    stroke-width: 2;
}

.node:hover text {
    font-size: 11px;
    font-weight: 700;
    fill: #000000;
}

.node text {
    font-size: 10px;
    text-anchor: middle;
    pointer-events: none;
    fill: #333333;
    font-weight: 600;
    /* Prevent text from being affected by parent transform */
    transform: scale(1);
    transform-origin: center;
    /* Additional fixes for text stability */
    dominant-baseline: middle;
    text-rendering: optimizeLegibility;
    /* Ensure text doesn't move during hover */
    will-change: auto;
}

.link {
    stroke-opacity: 0.6;
    transition: stroke-opacity 0.2s ease;
}

.link:hover {
    stroke-opacity: 1;
}



.navigation-path {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: rgba(45, 55, 72, 0.95);
    border: 1px solid #4a5568;
    border-radius: 8px;
    padding: 15px;
    max-width: 300px;
    max-height: 400px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 100;
    transition: all 0.3s ease;
}

.navigation-path.minimized {
    max-height: 50px;
    overflow: hidden;
}

.navigation-path.minimized .path-content {
    display: none;
}

.navigation-path h4 {
    margin-bottom: 10px;
    font-size: 14px;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.minimize-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: #a0aec0;
    padding: 0;
}

.path-items {
    max-height: 300px;
    overflow-y: auto;
}

.path-item {
    padding: 8px;
    border-bottom: 1px solid #4a5568;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s ease;
    color: #e2e8f0;
}

.path-item:hover {
    background: #4a5568;
}

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

.title-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    max-width: 200px;
    word-wrap: break-word;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.node-details-panel {
    position: relative;
    background: rgba(45, 55, 72, 0.95);
    backdrop-filter: blur(10px);
    border: 2px solid #3182ce;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    height: 100%;
    min-height: 500px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.node-details-panel.minimized {
    height: auto;
    min-height: auto;
}

.node-details-panel.minimized .panel-content {
    display: none;
}

.node-details-panel.visible {
    display: block;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #4a5568;
    background: #4a5568;
    cursor: move;
    user-select: none;
}

.panel-title {
    font-weight: 600;
    color: #e2e8f0;
    font-size: 16px;
}

.panel-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.panel-btn {
    background: none;
    border: none;
    color: #a0aec0;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 14px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

.panel-header h3 {
    margin: 0;
    font-size: 16px;
    color: #2d3748;
}

.close-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #a0aec0;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.placeholder-text {
    color: #a0aec0;
    font-style: italic;
    text-align: center;
    margin-top: 2rem;
}

.node-title {
    margin: 0 0 16px 0;
    color: #e2e8f0;
    font-size: 24px;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    line-height: 1.2;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
    background: rgba(49, 130, 206, 0.9);
    padding: 12px 16px;
    border-radius: 8px;
    margin: -12px -16px 16px -16px;
}

.node-extract {
    margin-bottom: 15px;
    line-height: 1.5;
    color: #e2e8f0;
    font-size: 14px;
}

.node-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-btn {
    background: #4a5568;
    color: #e2e8f0;
    border: 1px solid #718096;
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: #718096;
    border-color: #a0aec0;
}

.action-btn.primary {
    background: #3182ce;
    color: #ffffff;
}

.action-btn.primary:hover {
    background: #2c5282;
}

/* When header is collapsed on mobile, expand main content */
.header.collapsed ~ .main-content {
    padding: 0;
    margin: 0;
    height: calc(100vh - 20px);
    max-width: none;
}

.network-controls {
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 5px;
}

.control-btn {
    padding: 0.5rem;
    font-size: 0.7rem;
    min-width: 60px;
}

.zoom-controls {
    margin-left: 0;
    margin-right: 0; /* Remove margin on mobile */
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem;
}

.zoom-btn {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
}

.network-canvas {
    height: 100%;
    min-height: 250px;
    max-height: none;
}

/* When header is collapsed on mobile, expand network container */
.header.collapsed ~ .main-content .network-container {
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    height: 100%;
    min-height: 0;
}

/* When header is collapsed on mobile, expand network canvas */
.header.collapsed ~ .main-content .network-canvas {
    height: 100%;
    min-height: 0;
}



.legend-section h4 {
    font-size: 10px;
}

.legend-item {
    font-size: 9px;
}

.node-details-panel {
    width: 100%;
    height: 100%;
    min-height: 200px;
    max-height: none;
    overflow-y: auto;
}

.panel-header {
    padding: 10px;
    position: sticky;
    top: 0;
    background: #2d3748 !important;
    z-index: 10;
    flex-shrink: 0;
}

.panel-header h3 {
    font-size: 14px;
    color: #f6ad55 !important;
    font-weight: bold;
}

.close-btn {
    width: 20px;
    height: 20px;
    font-size: 16px;
}

.panel-content {
    padding: 10px;
    height: calc(100% - 50px);
    overflow-y: auto;
}

.node-extract {
    font-size: 13px;
    line-height: 1.4;
}

.action-btn {
    padding: 8px 12px;
    font-size: 11px;
    margin: 2px;
}

.welcome-message {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
    color: #e2e8f0;
    background: rgba(45, 55, 72, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    margin: 2rem 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    border: 2px solid #3182ce;
}

.welcome-content {
    max-width: 600px;
    padding: 2rem;
}

.welcome-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #3182ce, #63b3ed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.welcome-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: #a0aec0;
    font-weight: 500;
    line-height: 1.6;
}

.footer {
    text-align: center;
    padding: 2rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    border-top: 2px solid #3182ce;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    font-weight: 500;
    flex-shrink: 0;
    margin-top: auto;
    position: relative;
    z-index: 10;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.footer-content p {
    margin: 0;
    line-height: 1.4;
}

.footer-content strong {
    color: #fff;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 0.5rem 0;
    }

    .header-content {
        padding: 0 0.5rem;
    }


    
    .logo {
        font-size: 1.2rem;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    .header-controls {
        gap: 0.25rem;
    }

    .game-mode-btn, .tutorial-btn, .achievements-btn, .collapse-header-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .session-tracker {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        margin: 0.5rem auto;
    }
    
    .session-label {
        font-size: 0.8rem;
    }
    
    .session-count {
        font-size: 1rem;
        padding: 0.2rem 0.5rem;
    }

    .game-stats {
        gap: 1rem;
        padding: 0.5rem;
    }

    .filters-panel {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
    }

    .checkbox-group {
        flex-direction: column;
        gap: 0.5rem;
    }

    .search-section {
        padding: 2rem 1rem;
    }

    .search-container {
        max-width: 100%;
        padding: 0;
    }

    .search-box {
        flex-direction: column;
        gap: 0.75rem;
        border-radius: 25px;
        padding: 1rem;
    }

    #searchInput {
        font-size: 16px;
        padding: 1rem;
        text-align: center;
    }

    .search-btn {
        padding: 1rem 2rem;
        font-size: 16px;
        border-radius: 25px;
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
    }

    .search-suggestions {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
    }

    .suggestion-label {
        font-size: 0.9rem;
        text-align: center;
        width: 100%;
    }

    .suggestion-btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
        border-radius: 20px;
        width: 100%;
        max-width: 250px;
        text-align: center;
    }

    .main-content {
        flex-direction: column;
        padding: 0;
        gap: 0;
        flex: 1 1 0;
        min-height: 0;
        height: 100vh;
        position: relative;
        overflow: hidden;
        max-width: 100vw;
    }

    .resize-divider {
        display: block; /* Show resizable divider on mobile */
        width: 100%;
        height: 20px; /* Increased height for better touch target */
        background: linear-gradient(90deg, #3182ce, #63b3ed);
        cursor: ns-resize;
        position: relative;
        flex-shrink: 0;
        border: none;
        margin: 0;
        touch-action: none; /* Prevent default touch actions */
        -webkit-tap-highlight-color: transparent;
        z-index: 1000; /* Ensure it's above other elements */
        box-shadow: 0 2px 8px rgba(49, 130, 206, 0.3);
        user-select: none;
        -webkit-user-select: none;
    }

    .resize-divider::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 80px;
        height: 8px;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 4px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }

    .resize-divider:hover {
        background: linear-gradient(90deg, #2563eb, #3b82f6);
        box-shadow: 0 4px 12px rgba(49, 130, 206, 0.4);
    }

    .resize-divider:active {
        background: linear-gradient(90deg, #1d4ed8, #2563eb);
        box-shadow: 0 6px 16px rgba(49, 130, 206, 0.5);
    }

    .left-panel {
        order: 1;
        flex: 1 1 0;
        min-height: 200px;
        max-height: 60vh;
        height: auto;
        display: flex;
        flex-direction: column;
        transition: height 0.3s ease;
        overflow-y: auto;
    }

    .right-panel {
        order: 2;
        flex: 1 1 0;
        min-width: 0;
        width: 100%;
        border-left: none;
        border-bottom: 2px solid #3182ce;
        min-height: 200px;
        max-height: 40vh;
        height: auto;
        display: flex;
        flex-direction: column;
        transition: height 0.3s ease;
        overflow-y: auto;
    }

    .right-panel.collapsed {
        height: 0;
        overflow: hidden;
        opacity: 0;
        border-bottom: none;
        min-height: 0;
        flex: 0 0 0;
    }

    .left-panel.expanded {
        height: 100%;
        order: 1;
    }

    .network-controls {
        flex-wrap: wrap;
        gap: 0.25rem;
        padding: 5px;
        justify-content: center;
    }

    .control-btn {
        padding: 0.5rem;
        font-size: 0.7rem;
        min-width: 60px;
        justify-content: center;
    }

    .zoom-controls {
        margin-left: 0;
        margin-right: 0; /* Remove margin on mobile */
        width: 100%;
        justify-content: center;
        margin-top: 0.5rem;
    }

    .zoom-btn {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .network-canvas {
        height: 100%;
        min-height: 250px;
        max-height: none;
        flex: 1;
    }

    .network-container {
        margin: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: none;
        height: 100%;
        min-height: 0;
        flex: 1;
    }

    .network-canvas {
        height: 100% !important;
        min-height: 0;
        flex: 1;
    }



    .legend-section h4 {
        font-size: 10px;
    }

    .legend-item {
        font-size: 9px;
    }

    .node-details-panel {
        width: 100%;
        height: 100%;
        min-height: 200px;
        max-height: none;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    .panel-header {
        padding: 10px;
        position: sticky;
        top: 0;
        background: #2d3748 !important;
        z-index: 10;
        flex-shrink: 0;
    }

    .panel-header h3 {
        font-size: 14px;
        color: #f6ad55 !important;
        font-weight: bold;
    }

    .close-btn {
        width: 20px;
        height: 20px;
        font-size: 16px;
    }

    .panel-content {
        padding: 10px;
        height: calc(100% - 50px);
        overflow-y: auto;
        flex: 1;
    }

    .node-extract {
        font-size: 13px;
        line-height: 1.4;
    }

    .action-btn {
        padding: 8px 12px;
        font-size: 11px;
        margin: 2px;
    }

    .welcome-content {
        padding: 0 1rem;
    }

    .welcome-content h2 {
        font-size: 20px;
    }

    .welcome-content p {
        font-size: 14px;
    }

    .welcome-features {
        gap: 1rem;
    }

    .feature i {
        font-size: 1.2rem;
    }

    .feature span {
        font-size: 0.7rem;
    }

    .footer {
        padding: 15px;
        font-size: 11px;
        margin-top: auto;
        position: relative;
        z-index: 10;
    }

    .loading-indicator {
        padding: 1rem;
    }

    .loading-spinner {
        width: 16px;
        height: 16px;
    }

    .loading-indicator p {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0.25rem 0;
    }

    .header-content {
        padding: 0 0.25rem;
    }

    .logo {
        font-size: 1rem;
    }

    .subtitle {
        font-size: 0.7rem;
    }

    .header-controls {
        flex-direction: column;
        gap: 0.5rem;
    }

    .game-mode-btn, .tutorial-btn, .achievements-btn, .collapse-header-btn {
        width: 100%;
        justify-content: center;
    }
    
    .session-tracker {
        padding: 0.4rem 0.8rem;
        font-size: 0.7rem;
        margin: 0.4rem auto;
        flex-direction: column;
        gap: 0.3rem;
        justify-content: center;
        width: fit-content;
    }
    
    .session-label {
        font-size: 0.7rem;
    }
    
    .session-count {
        font-size: 0.9rem;
        padding: 0.15rem 0.4rem;
    }

    .game-stats {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .search-section {
        padding: 1.5rem 0.5rem;
    }

    .search-container {
        max-width: 100%;
        padding: 0;
    }

    .search-box {
        flex-direction: column;
        gap: 0.75rem;
        border-radius: 20px;
        padding: 0.75rem;
    }

    #searchInput {
        font-size: 16px;
        padding: 0.75rem;
        text-align: center;
    }

    .search-btn {
        padding: 0.75rem 1.5rem;
        font-size: 16px;
        border-radius: 20px;
        width: 100%;
        max-width: 180px;
        margin: 0 auto;
    }

    .search-suggestions {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }

    .suggestion-label {
        font-size: 0.8rem;
        text-align: center;
        width: 100%;
    }

    .suggestion-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        border-radius: 15px;
        width: 100%;
        max-width: 200px;
        text-align: center;
    }

    .main-content {
        flex-direction: column;
        flex: 1 1 0;
        min-height: 0;
        height: 100vh;
        position: relative;
        overflow: hidden;
        max-width: 100vw;
    }

    .resize-divider {
        height: 10px; /* Increased height for better touch target */
        touch-action: none;
        -webkit-tap-highlight-color: transparent;
        z-index: 1000;
    }

    .resize-divider::before {
        width: 30px;
        height: 3px;
    }

    .left-panel {
        height: 45%;
        min-height: 200px;
    }

    .right-panel {
        height: 55%;
        min-height: 200px;
    }

    .network-container {
        margin: 0;
    }

    .network-controls {
        padding: 0.25rem;
        justify-content: center;
    }

    .control-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.6rem;
        justify-content: center;
    }

    .zoom-controls {
        margin-left: 0;
        margin-right: 0; /* Remove margin on small mobile */
        width: 100%;
        justify-content: center;
        margin-top: 0.5rem;
    }

    .zoom-btn {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }

    .network-canvas {
        height: 300px;
        min-height: 300px;
        flex: 1;
    }

    .network-container {
        margin: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: none;
        min-height: calc(100vh - 60px);
        height: calc(100vh - 60px);
        flex: 1;
    }

    .network-canvas {
        min-height: calc(100vh - 100px);
        height: calc(100vh - 100px);
        flex: 1;
    }



    .legend-section h4 {
        font-size: 9px;
    }

    .legend-item {
        font-size: 8px;
    }

    .panel-header {
        padding: 8px;
    }

    .panel-header h3 {
        font-size: 13px;
        color: #2d3748;
    }

    .close-btn {
        width: 18px;
        height: 18px;
        font-size: 14px;
    }

    .panel-content {
        padding: 8px;
    }

    .node-extract {
        font-size: 12px;
    }

    .action-btn {
        padding: 8px;
        font-size: 10px;
    }

    .welcome-content {
        padding: 0 0.5rem;
    }

    .welcome-content h2 {
        font-size: 18px;
    }

    .welcome-content p {
        font-size: 13px;
    }

    .welcome-features {
        flex-direction: column;
        gap: 0.5rem;
    }

    .feature {
        flex-direction: row;
        gap: 0.5rem;
    }

    .feature i {
        font-size: 1rem;
    }

    .feature span {
        font-size: 0.6rem;
    }

    .footer {
        padding: 10px;
        font-size: 10px;
        margin-top: auto;
        position: relative;
        z-index: 10;
    }

    .loading-indicator {
        padding: 0.5rem;
    }

    .loading-spinner {
        width: 14px;
        height: 14px;
    }

    .loading-indicator p {
        font-size: 12px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .control-btn,
    .action-btn,
    .suggestion-btn,
    .game-mode-btn,
    .tutorial-btn,
    .achievements-btn,
    .collapse-header-btn {
        min-height: 44px;
        min-width: 44px;
        padding: 12px;
    }

    .panel-content {
        padding: 20px;
    }

    .control-btn,
    .action-btn,
    .suggestion-btn,
    .game-mode-btn,
    .tutorial-btn,
    .achievements-btn {
        font-size: 16px;
        border-width: 2px;
    }

    .control-btn:focus,
    .action-btn:focus,
    .suggestion-btn:focus,
    .game-mode-btn:focus,
    .tutorial-btn:focus,
    .achievements-btn:focus {
        outline: 2px solid #007AFF;
        outline-offset: 2px;
    }

    /* Touch-friendly resize divider */
    .resize-divider {
        min-height: 44px;
        touch-action: none;
        -webkit-tap-highlight-color: transparent;
        z-index: 1000;
    }

    .resize-divider:active {
        background: linear-gradient(90deg, #2c5282, #3182ce);
    }

    .resize-divider:hover {
        background: linear-gradient(90deg, #2c5282, #3182ce);
    }
}

/* Notification Styles */
.points-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4CAF50;
    color: #ffffff;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 3000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.points-notification.show {
    transform: translateX(0);
}

.points-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.points-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.points-reason {
    font-size: 0.8rem;
    opacity: 0.9;
}

.achievement-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: #ffffff;
    border: 2px solid #4CAF50;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    z-index: 3000;
    opacity: 0;
    transition: all 0.3s ease;
}

.achievement-notification.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.achievement-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: left;
}

.achievement-content i {
    font-size: 2rem;
    color: #4CAF50;
}

.achievement-text h4 {
    margin: 0 0 0.25rem 0;
    color: #000000;
    font-size: 1rem;
}

.achievement-text p {
    margin: 0;
    color: #666666;
    font-size: 0.8rem;
}

.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: #333333;
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 3000;
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(-50%) translateY(0);
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .main-content {
        flex-direction: row;
        height: calc(100vh - 80px);
        gap: 10px;
        padding: 5px;
    }

    .left-panel {
        order: 1;
        height: 100%;
        flex: 2;
        min-height: 0;
    }

    .right-panel {
        order: 2;
        width: 300px;
        min-width: 250px;
        height: 100%;
        border-left: 2px solid #3182ce;
        border-bottom: none;
        flex: 1;
    }

    /* Mobile collapsed panel state in landscape */
    .right-panel.collapsed {
        width: 0;
        min-width: 0;
        overflow: hidden;
        opacity: 0;
        border-left: none;
    }

    .left-panel.expanded {
        flex: 1;
        order: 1;
    }

    .network-canvas {
        height: 100%;
        min-height: 200px;
    }

    .network-controls {
        padding: 8px;
        gap: 0.5rem;
        justify-content: center;
    }

    .control-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
        min-width: 50px;
        justify-content: center;
    }

    .zoom-controls {
        margin: 0;
        width: auto;
        justify-content: flex-end;
    }

    .zoom-btn {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }



    .legend-section h4 {
        font-size: 9px;
    }

    .legend-item {
        font-size: 8px;
    }

    .node-details-panel {
        height: 100%;
        min-height: 0;
    }

    .panel-header {
        padding: 8px;
    }

    .panel-header h3 {
        font-size: 12px;
        color: #2d3748;
    }

    .close-btn {
        width: 18px;
        height: 18px;
        font-size: 14px;
    }

    .panel-content {
        padding: 8px;
        height: calc(100% - 40px);
    }

    .node-extract {
        font-size: 11px;
        line-height: 1.3;
    }

    .action-btn {
        padding: 6px 10px;
        font-size: 10px;
        margin: 1px;
    }

    .welcome-content {
        padding: 0 0.5rem;
    }

    .welcome-content h2 {
        font-size: 16px;
    }

    .welcome-content p {
        font-size: 12px;
    }

    .search-section {
        padding: 0.5rem;
    }

    .search-box {
        padding: 0.5rem;
    }

    #searchInput {
        font-size: 14px;
    }

    .search-btn {
        padding: 0.5rem 1rem;
        font-size: 14px;
    }

    .search-suggestions {
        gap: 0.5rem;
    }

    .suggestion-btn {
        padding: 0.5rem 1rem;
        font-size: 12px;
    }

    .header {
        padding: 0.5rem;
    }

    .logo {
        font-size: 18px;
    }

    .subtitle {
        font-size: 12px;
    }
}

.node-info-section {
    margin-bottom: 15px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.node-info-section h4 {
    margin: 0 0 8px 0;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.node-info-section h4 i {
    color: #FFD700;
}

.info-content {
    color: #e0e0e0;
    font-size: 13px;
    line-height: 1.4;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    overflow-x: auto;
    max-width: 100%;
    padding: 4px 0;
}

.info-content .info-item {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 10px;
    margin: 2px 0;
    border-radius: 16px;
    font-size: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: fit-content;
}

.info-content .info-item.primary {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    font-weight: 600;
    border: 1px solid rgba(255, 215, 0, 0.5);
}

/* Prominent temporal and spatial information */
.prominent-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 12px 0;
    padding: 16px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.6), rgba(255, 165, 0, 0.6));
    border-radius: 12px;
    border: 4px solid rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.prominent-label {
    margin: 0 0 8px 0;
    color: #000000;
    font-size: 16px;
    font-weight: 900;
    text-shadow: 3px 3px 6px rgba(255, 255, 255, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 3px solid rgba(0, 0, 0, 0.8);
    padding-bottom: 8px;
    background: rgba(255, 215, 0, 1);
    padding: 10px 15px;
    border-radius: 10px;
    margin: -10px -15px 10px -15px;
    border: 3px solid rgba(0, 0, 0, 0.8);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.prominent-label i {
    color: #FFD700;
    font-size: 18px;
}

.prominent-content {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    max-width: 100%;
    overflow: hidden;
}

.prominent-temporal {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 800;
    color: #000000;
    text-shadow: 3px 3px 6px rgba(255, 255, 255, 1), 2px 2px 4px rgba(255, 255, 255, 1);
    background: rgba(255, 255, 255, 1);
    padding: 10px 15px;
    border-radius: 10px;
    border: 3px solid rgba(0, 0, 0, 0.8);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.prominent-spatial {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 800;
    color: #FF8C00;
    text-shadow: none;
    background: rgba(255, 255, 255, 1);
    padding: 10px 15px;
    border-radius: 10px;
    border: 3px solid rgba(0, 0, 0, 0.8);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    max-width: 100%;
}

.prominent-temporal i {
    color: #8B4513;
    font-size: 18px;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 1);
}

.prominent-spatial i {
    color: #1B5E20;
    font-size: 18px;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 1);
}

.prominent-item {
    display: inline-block;
    background: rgba(0, 0, 0, 0.9);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
    cursor: pointer;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    margin-right: 8px;
    margin-bottom: 6px;
    white-space: nowrap;
    max-width: 100%;
    box-sizing: border-box;
}

.prominent-item:last-child {
    margin-right: 0;
}

.prominent-item:hover {
    background: rgba(0, 0, 0, 1);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.7);
    border-color: #ffffff;
}

.prominent-item.primary {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    font-weight: 700;
    border: 2px solid rgba(255, 215, 0, 0.6);
    text-shadow: none;
}

.prominent-item.primary:hover {
    background: linear-gradient(135deg, #FFA500, #FF8C00);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 165, 0, 0.4);
    border-color: rgba(255, 215, 0, 0.8);
}

/* Clickable info items */
.info-item.clickable {
    cursor: pointer;
    transition: all 0.3s ease;
    color: #ffffff !important;
    font-weight: 600;
}

.info-item.clickable:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

/* Mobile responsive for prominent info */
@media (max-width: 768px) {
    .prominent-info {
        flex-direction: column;
        gap: 8px;
        padding: 10px;
    }
    
    .prominent-temporal {
        font-size: 13px;
        font-weight: 800;
        color: #000000;
        text-shadow: 3px 3px 6px rgba(255, 255, 255, 1), 2px 2px 4px rgba(255, 255, 255, 1);
        background: rgba(255, 255, 255, 1);
        padding: 8px 12px;
        border-radius: 8px;
        border: 3px solid rgba(0, 0, 0, 0.8);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    }
    
    .prominent-spatial {
        font-size: 13px;
        font-weight: 800;
        color: #FF8C00;
        text-shadow: none;
        background: rgba(255, 255, 255, 1);
        padding: 8px 12px;
        border-radius: 8px;
        border: 3px solid rgba(0, 0, 0, 0.8);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    }
    
    .prominent-item {
        padding: 5px 10px;
        font-size: 12px;
    }
}

/* Node label styles for time/place display */
.node-label-time,
.node-label-place {
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    font-weight: 600;
}

.node-label-time:hover,
.node-label-place:hover {
    opacity: 0.9;
    transform: scale(1.1);
}

/* Ensure labels are visible on all backgrounds */
.node-label-group {
    pointer-events: all;
}

/* Background rectangles for node labels */
.node-label-group rect {
    transition: all 0.2s ease;
    opacity: 0.9;
}

/* Improve spacing for node labels */
.node-label-group text {
    dominant-baseline: middle;
}

/* Infobox image styling for node details */
.infobox-image {
    text-align: center;
    margin: 1rem 0;
    padding: 0.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.infobox-img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease;
}

.infobox-img:hover {
    transform: scale(1.02);
}

/* Media info styling for node details */
.media-info {
    background: linear-gradient(135deg, #fffbe6 0%, #ffeaa7 100%);
    border: 1.5px solid #ffe082;
    border-radius: 10px;
    padding: 1rem;
    margin: 1.2rem 0 0.5rem 0;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.08);
}
.media-label {
    color: #b8860b;
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.7rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.media-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.media-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 12px;
    margin-bottom: 0.5rem;
}
.media-thumb {
    display: inline-block;
    margin: 4px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}
.media-thumb:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.media-thumb img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    display: block;
}
.media-videos-list {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}
.media-video-item {
    background: #fff8e1;
    border-radius: 6px;
    padding: 0.5rem 0.7rem;
    box-shadow: 0 1px 4px rgba(255, 193, 7, 0.07);
}
.media-video-link {
    color: #d63384;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.98rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.media-video-link:hover {
    color: #a61e4d;
    text-decoration: underline;
}
.media-video-desc {
    color: #6d4c00;
    font-size: 0.92rem;
    margin-top: 0.2rem;
    font-style: italic;
}
@media (max-width: 600px) {
    .media-info {
        padding: 0.7rem;
    }
    .media-images-grid {
        grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
        gap: 7px;
    }
    .media-thumb img {
        height: 48px;
    }
    .media-label {
        font-size: 0.95rem;
    }
}

/* Image Modal/Lightbox Styles */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.image-modal.hidden {
    display: none;
}

.image-modal.show {
    opacity: 1;
    visibility: visible;
}

.image-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.image-modal-content {
    position: relative;
    background-color: #fff;
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.image-modal.show .image-modal-content {
    transform: scale(1);
}

.image-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e0e0e0;
}

.image-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-modal-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
    position: relative;
}

.image-modal-image {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: opacity 0.3s ease, filter 0.3s ease;
}

.image-modal-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.image-modal-footer {
    display: flex;
    justify-content: center;
    padding: 16px 24px 20px;
    border-top: 1px solid #e0e0e0;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .image-modal-content {
        max-width: 95vw;
        max-height: 95vh;
        margin: 10px;
    }
    
    .image-modal-header {
        padding: 16px 20px 12px;
    }
    
    .image-modal-title {
        font-size: 16px;
    }
    
    .image-modal-body {
        padding: 16px;
    }
    
    .image-modal-image {
        max-height: 50vh;
    }
    
    .image-modal-footer {
        padding: 12px 20px 16px;
    }
}

/* Keyboard navigation support */
.image-modal:focus {
    outline: none;
}

/* Animation for modal entrance */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.image-modal.show .image-modal-content {
    animation: modalFadeIn 0.3s ease-out;
}

/* Relationship Summaries */
.relationship-summaries {
    margin-top: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f7fafc, #edf2f7);
    border-radius: 8px;
    border-left: 4px solid #3182ce;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.relationship-label {
    color: #2d3748;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.relationship-label i {
    color: #3182ce;
    font-size: 1.1rem;
}

.relationship-content {
    color: #4a5568;
    line-height: 1.6;
}

.relationship-loading {
    color: #718096;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.relationship-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #3182ce;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.relationship-summary {
    color: #2d3748;
    font-weight: 500;
    padding: 0.5rem 0;
    border-top: 1px solid #e2e8f0;
    margin-top: 0.5rem;
}

.relationship-error {
    color: #e53e3e;
    font-style: italic;
    padding: 0.5rem 0;
    border-top: 1px solid #fed7d7;
    margin-top: 0.5rem;
}

@media (max-width: 768px) {
    .relationship-summaries {
        margin-top: 1rem;
        padding: 0.75rem;
    }
    
    .relationship-label {
        font-size: 0.9rem;
    }
    
    .relationship-summary {
        font-size: 0.9rem;
    }
}

/* Little Known Connections Styles */
.little-known-connections {
    margin-top: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(240, 147, 251, 0.3);
    border-left: 4px solid #f093fb;
}

.connections-label {
    color: white;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.connections-label i {
    color: #ffd700;
    font-size: 1.1rem;
}

.connections-content {
    color: white;
    line-height: 1.6;
}

.connections-loading {
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.connections-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #ffd700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.connections-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.connection-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 0.75rem;
}

.connection-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.connection-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    display: block;
    transition: color 0.3s ease;
}

.connection-link:hover {
    color: #ffd700;
    text-decoration: none;
}

.connection-explanation {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    line-height: 1.4;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    border-left: 3px solid #ffd700;
    font-style: italic;
}

.connection-link.fallback {
    color: #ffd700;
    border-bottom: 1px dashed #ffd700;
}

.connection-link.fallback:hover {
    color: #fff;
    border-bottom-color: #fff;
}

.fallback-indicator {
    font-size: 0.8rem;
    opacity: 0.8;
    font-style: italic;
    margin-left: 0.5rem;
}

.connection-item.fallback-text {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.75rem;
    border-radius: 6px;
}

.connection-item.fallback-text .connection-title {
    color: #ffd700;
    font-weight: 600;
    font-size: 1rem;
    display: block;
    margin-bottom: 0.5rem;
}

.connection-item.fallback-text .connection-explanation {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.connection-item.fallback-text .fallback-indicator {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    margin-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 0.5rem;
}

.connections-empty {
    text-align: center;
    font-style: italic;
    opacity: 0.8;
    padding: 1rem;
}

.connections-error {
    background: rgba(255, 107, 107, 0.2);
    color: white;
    padding: 0.75rem;
    border-radius: 6px;
    text-align: center;
    border: 1px solid rgba(255, 107, 107, 0.3);
}

@media (max-width: 768px) {
    .little-known-connections {
        margin-top: 1rem;
        padding: 0.75rem;
    }
    
    .connections-label {
        font-size: 0.9rem;
    }
    
    .connection-item {
        padding: 0.4rem 0.6rem;
    }
}

/* Session Path Visualization */
.session-path {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    font-size: 1rem;
    font-weight: 500;
    margin-top: 0.15rem;
    color: #fff;
    max-width: 90vw;
    overflow-x: auto;
    white-space: normal;
}
.session-node {
    background: rgba(255,255,255,0.18);
    border-radius: 12px;
    padding: 0.15rem 0.7rem;
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.10);
    color: #fff;
    transition: background 0.2s;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.98em;
}
.session-node:hover {
    background: rgba(255,255,255,0.32);
}
.session-arrow {
    color: #fff;
    font-size: 1.1em;
    opacity: 0.6;
    margin: 0 0.1rem;
}

@media (max-width: 600px) {
    .session-path {
        font-size: 0.85rem;
        gap: 0.25rem;
        max-width: 98vw;
    }
    .session-node {
        padding: 0.12rem 0.5rem;
        font-size: 0.92em;
        max-width: 70px;
    }
    .session-arrow {
        font-size: 1em;
    }
}

/* --- DESKTOP LAYOUT FIXES --- */
@media (min-width: 769px) {
  .main-content {
    flex-direction: row !important;
    height: calc(100vh - 200px) !important; /* Account for header and search */
    min-height: 500px;
    align-items: stretch;
  }
  .left-panel {
    flex: 1 1 0; /* Equal flex basis for both panels */
    min-width: 300px;
    height: 100%;
    min-height: 400px;
    display: flex;
    flex-direction: column;
  }
  .right-panel {
    flex: 1 1 0; /* Equal flex basis for both panels */
    min-width: 300px;
    max-width: none; /* Remove max-width constraint */
    height: 100%;
    display: flex;
    flex-direction: column;
    border-left: none; /* Remove border since we have divider */
    border-bottom: none;
    background: #2d3748;
    color: #e2e8f0;
    box-shadow: none;
  }
  .resize-divider {
    width: 20px !important; /* Much wider divider */
    min-width: 20px;
    max-width: 30px;
    height: 100% !important;
    min-height: 0;
    background: linear-gradient(180deg, #3182ce, #63b3ed);
    cursor: ew-resize !important;
    position: relative;
    z-index: 1000;
    box-shadow: 0 0 15px rgba(49,130,206,0.4);
    display: block;
    border: none;
    margin: 0;
    touch-action: none;
  }
  .resize-divider::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(90deg);
    width: 80px;
    height: 8px;
    background: rgba(255,255,255,0.9);
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  }
  .resize-handle {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.2rem;
    opacity: 0.7;
  }
  .panel-header {
    background: #2d3748 !important;
    color: #f6ad55 !important;
    border-bottom: 1px solid #4a5568;
    font-weight: bold;
  }
  .panel-header h3, .panel-title {
    color: #f6ad55 !important;
    font-weight: bold;
    background: none;
  }
  .panel-content {
    color: #e2e8f0;
    background: none;
  }
  
  /* Ensure network container and canvas have consistent heights on desktop */
  .network-container {
    height: calc(100% - 60px) !important; /* Account for network controls */
    min-height: 350px;
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  
  .network-canvas {
    height: 100% !important;
    min-height: 300px;
    flex: 1;
  }
}

/* --- END DESKTOP LAYOUT FIXES --- */

.header-nav {
  margin-top: 0.5rem;
  text-align: center;
}
.howto-link {
  color: #3182ce;
  background: #f7fafc;
  border: 1px solid #3182ce;
  border-radius: 6px;
  padding: 0.25rem 0.9rem;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  margin-left: 1rem;
  transition: background 0.2s, color 0.2s, border 0.2s;
}
.howto-link:hover {
  background: #3182ce;
  color: #fff;
  border-color: #2b6cb0;
  text-decoration: none;
}
  