        :root {
            /* Light mode - Warm honey palette */
            --page-bg: #fef8f0;
            --content-bg: #ffffff;
            --bg-secondary: #fef3e7;
            --bg-accent: #fde9d3;
            --text-primary: #1a1008;
            --text-secondary: #5c4a36;
            --text-accent: #1a1008;
            --border-color: #e5d4c0;
            --shadow-color: rgba(26, 16, 8, 0.08);
            --citation-bg: #fef3e7;
            --citation-border: #cf903b;
            --citation-text: #8b5a1a;
            --citation-hover: #b96727;
            --citation-highlight: #fef8f0;
            --tooltip-bg: #ffffff;
            --tooltip-text: #1a1008;
            --progress-bg: linear-gradient(90deg, #d2933e, #b96727);
            --primary-color: #cf903b;
            --primary-dark: #b96727;
            --accent-gold: #d2933e;
            --accent-honey: #e8a84d;
            --warm-brown: #8b5a1a;
            --blood-red: #8b0000;
            --blood-red-dark: #6b0000;
            --blood-red-highlight: #a01010;
        }

        [data-theme="dark"] {
            /* Dark mode - Rich honey & dark chocolate palette */
            --page-bg: #0d0805;
            --content-bg: #1a1008;
            --bg-secondary: #241910;
            --bg-accent: #2f2418;
            --text-primary: #fef8f0;
            --text-secondary: #d4c4b0;
            --text-accent: #fef8f0;
            --border-color: #4a3c2c;
            --shadow-color: rgba(0, 0, 0, 0.5);
            --citation-bg: #241910;
            --citation-border: #d2933e;
            --citation-text: #e8a84d;
            --citation-hover: #cf903b;
            --citation-highlight: #2f2418;
            --tooltip-bg: #241910;
            --tooltip-text: #fef8f0;
            --progress-bg: linear-gradient(90deg, #d2933e, #b96727);
            --primary-color: #d2933e;
            --primary-dark: #b96727;
            --accent-gold: #cf903b;
            --accent-honey: #e8a84d;
            --warm-brown: #8b5a1a;
            --blood-red: #b91010;
            --blood-red-dark: #8b0000;
            --blood-red-highlight: #d41818;
        }

        body {
            font-family: 'Inter', sans-serif;
            line-height: 1.8;
            background-color: var(--page-bg);
            color: var(--text-primary);
            transition: all 0.3s ease;
            margin: 0;
            padding: 0;
            padding-top: 80px; /* Account for fixed nav */
            font-size: 16px;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }

        /* Splash Screen */
        .splash-screen {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: var(--page-bg);
            z-index: 9999;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 1;
            transition: opacity 0.5s ease-out;
        }

        .splash-screen.fade-out {
            opacity: 0;
        }

        .splash-content {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 2rem;
            animation: splash-fade-in 0.5s ease-out;
        }

        @keyframes splash-fade-in {
            from {
                opacity: 0;
                transform: scale(0.95);
            }
            to {
                opacity: 1;
                transform: scale(1);
            }
        }

        .splash-logo {
            width: 200px;
            height: auto;
            max-width: 80vw;
        }

        .splash-title {
            font-size: 2.5rem;
            font-weight: 700;
            color: var(--blood-red);
            text-transform: uppercase;
            letter-spacing: 2px;
            margin: 0;
            text-align: center;
            position: relative;
            min-height: 1.2em;
        }

        .splash-title::after {
            content: '|';
            animation: blink 0.8s infinite;
            margin-left: 2px;
        }

        @keyframes blink {
            0%, 50% {
                opacity: 1;
            }
            51%, 100% {
                opacity: 0;
            }
        }

        @media (max-width: 768px) {
            .splash-logo {
                width: 150px;
            }

            .splash-title {
                font-size: 1.75rem;
            }
        }

        /* Navigation Menu */
        .nav-menu {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 1000;
            background: var(--content-bg);
            border-bottom: 2px solid var(--border-color);
            box-shadow: 0 2px 8px var(--shadow-color);
        }

        .nav-menu-content {
            max-width: 1280px;
            margin: 0 auto;
            padding: 0.75rem 1rem;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 2rem;
        }

        .nav-menu-header {
            flex-shrink: 0;
        }

        .nav-menu-title {
            font-size: 1.5rem;
            font-weight: 900;
            color: var(--text-primary);
            margin: 0;
            line-height: 1.2;
        }

        .nav-menu-subtitle {
            font-size: 0.75rem;
            color: var(--text-secondary);
            margin: 0;
            line-height: 1.3;
        }

        .nav-menu-buttons {
            display: flex;
            gap: 0.5rem;
            flex-wrap: wrap;
            justify-content: flex-end;
        }

        .nav-btn {
            padding: 0.5rem 1rem;
            font-weight: 600;
            font-size: 0.875rem;
            border-radius: 6px;
            border: 1px solid var(--border-color);
            background: var(--bg-secondary);
            color: var(--text-secondary);
            cursor: pointer;
            transition: all 0.2s ease;
            white-space: nowrap;
        }

        .nav-btn-home {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.25rem 1rem 0.25rem 0.25rem;
            text-transform: uppercase;
        }

        .nav-btn-home span {
            color: var(--blood-red);
            font-weight: 700;
        }

        .nav-btn-home.active span {
            color: var(--blood-red);
        }

        .nav-btn-home:hover span {
            color: var(--blood-red-highlight);
        }

        .nav-btn-home-logo {
            height: 100%;
            width: auto;
            aspect-ratio: 1;
            object-fit: contain;
        }

        .nav-btn:hover {
            background: var(--bg-accent);
            color: var(--text-primary);
            border-color: var(--primary-color);
        }

        .nav-btn.active {
            background: var(--primary-color);
            color: #ffffff;
            border-color: var(--primary-color);
            font-weight: 700;
        }

        @media (max-width: 768px) {
            body {
                padding-top: 140px; /* More space for wrapped nav buttons */
            }

            .nav-menu-content {
                flex-direction: column;
                gap: 0.75rem;
                align-items: stretch;
            }

            .nav-menu-header {
                text-align: center;
            }

            .nav-menu-title {
                font-size: 1.25rem;
            }

            .nav-menu-subtitle {
                font-size: 0.7rem;
            }

            .nav-menu-buttons {
                justify-content: center;
                gap: 0.25rem;
            }

            .nav-btn {
                padding: 0.4rem 0.6rem;
                font-size: 0.75rem;
            }
        }
        
        .citation-link {
            color: var(--citation-text);
            font-weight: 600;
            text-decoration: none;
            transition: colors 0.2s ease;
            cursor: pointer;
        }
        
        .citation-link:hover {
            color: var(--citation-hover);
        }

        /* Modern Tab Styling */
        .tab-container {
            display: flex;
            background: var(--bg-secondary);
            border-radius: 12px 12px 0 0;
            padding: 4px;
            gap: 2px;
            box-shadow: 0 2px 8px var(--shadow-color);
            border: 1px solid var(--border-color);
            border-bottom: none;
            overflow-x: auto;
            flex-wrap: nowrap;
        }
        
        .tab-btn {
            flex: 1 1 0%;
            min-width: 0;
            padding: 14px 22px;
            font-weight: 700;
            border-radius: 8px 8px 0 0;
            transition: all 0.3s ease;
            text-align: center;
            cursor: pointer;
            border: 1px solid transparent;
            background: transparent;
            color: var(--text-secondary);
            font-size: 0.95rem;
            position: relative;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        
        .tab-btn.active {
            background: var(--content-bg);
            color: var(--citation-text);
            box-shadow: 0 -4px 12px var(--shadow-color);
            border: 1px solid var(--border-color);
            border-bottom: 1px solid var(--content-bg);
            margin-bottom: -1px;
            z-index: 10;
            font-weight: 700;
        }
        
        .tab-btn:not(.active):hover {
            background: var(--bg-accent);
            color: var(--text-primary);
            border-color: var(--border-color);
            transform: translateY(-2px);
            box-shadow: 0 2px 8px var(--shadow-color);
        }
        
        .tab-btn:focus {
            outline: 2px solid var(--citation-text);
            outline-offset: 2px;
        }
        
        .citation:focus {
            outline: 2px solid var(--citation-text);
            outline-offset: 2px;
        }
        
        .tab-content {
            background: var(--content-bg);
            border: 1px solid var(--border-color);
            border-top: none;
            border-radius: 0 0 12px 12px;
            box-shadow: 0 8px 32px var(--shadow-color);
            color: var(--text-primary);
            font-weight: 400;
            padding: 1.5rem;
            min-height: 500px;
        }
        
        .tab-content.hidden {
            display: none !important;
            visibility: hidden !important;
            overflow: hidden !important;
            position: absolute !important;
            left: -9999px !important;
        }
        
        /* Typography Improvements */
        h1, h2, h3, h4, h5, h6 {
            color: var(--text-accent);
            font-weight: 700;
            line-height: 1.3;
            margin-bottom: 0.8rem;
            margin-top: 1.2rem;
        }
        
        p {
            color: var(--text-primary) !important;
            font-size: 16px;
            line-height: 1.8;
            margin-bottom: 1.2rem;
            font-weight: 400;
        }
        
        /* Ensure all text in content areas has proper contrast */
        .tab-content p, 
        .tab-content div, 
        .tab-content span:not(.citation),
        .tab-content li,
        .tab-content {
            color: var(--text-primary) !important;
        }
        
        /* Strong contrast for all section text */
        .network-card,
        .network-card p,
        .network-card li,
        .timeline-content,
        .timeline-content p,
        .timeline-content li,
        .story-content-container,
        .story-content-container p,
        .references-content,
        .references-content li {
            color: var(--text-primary) !important;
        }
        
        /* Override any inline styles that might cause contrast issues */
        .citation, .citation * {
            color: var(--citation-text) !important;
        }
        
        .citation:hover, .citation:hover * {
            color: white !important;
        }
        
        /* Timeline date strong contrast */
        .timeline-date {
            color: white !important;
            text-shadow: 0 1px 2px rgba(0,0,0,0.5);
        }
        
        [data-theme="dark"] .timeline-date {
            color: #0f172a !important;
            text-shadow: none;
        }
        
        strong {
            color: var(--blood-red);
            font-weight: 700;
        }

        em, i {
            color: var(--blood-red-dark);
            font-style: italic;
        }

        mark {
            background-color: var(--blood-red-highlight);
            color: var(--content-bg);
            padding: 2px 4px;
            border-radius: 3px;
        }
        
        /* Citation Tooltip System */
        .citation {
            position: relative;
            display: inline-block;
            cursor: pointer;
            vertical-align: super;
            font-size: 0.8em;
            font-weight: 700;
            color: var(--citation-text);
            padding: 3px 7px;
            border-radius: 6px;
            transition: all 0.2s ease;
            margin: 0 2px;
            background: var(--citation-bg);
            border: 1px solid var(--citation-border);
            min-width: 20px;
            text-align: center;
            white-space: nowrap;
            text-decoration: none;
        }
        
        .citation:visited {
            color: var(--citation-text);
        }
        
        .citation:focus {
            outline: 2px solid var(--primary-color);
            outline-offset: 2px;
        }
        
        .citation::before {
            content: "??";
            font-size: 0.6em;
            margin-right: 2px;
            opacity: 0.7;
        }
        
        .citation:hover {
            background: var(--citation-text);
            color: white;
            border-color: var(--citation-text);
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        }
        
        a.citation:hover {
            text-decoration: none;
        }
        
        .citation-tooltip {
            position: absolute;
            bottom: calc(100% + 4px);
            left: 50%;
            transform: translateX(-50%);
            padding: 12px 16px;
            background: var(--tooltip-bg);
            border: 2px solid var(--border-color);
            border-radius: 8px;
            box-shadow: 0 8px 32px var(--shadow-color);
            color: var(--tooltip-text);
            font-size: 0.85rem;
            line-height: 1.4;
            white-space: normal;
            max-width: min(320px, calc(100vw - 40px));
            min-width: 200px;
            word-wrap: break-word;
            overflow-wrap: break-word;
            z-index: 1000;
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
            pointer-events: auto;
            font-weight: 400;
            display: inline-block;
        }
        
        /* Add invisible hover bridge */
        .citation::before {
            content: '';
            position: absolute;
            bottom: 100%;
            left: 50%;
            transform: translateX(-50%);
            width: 100%;
            height: 8px;
            z-index: 999;
        }
        

        
        /* Smart positioning to prevent overflow */
        .citation-tooltip.tooltip-right {
            left: 0;
            transform: translateX(0);
        }
        
        .citation-tooltip.tooltip-left {
            left: auto;
            right: 0;
            transform: translateX(0);
        }
        
        .citation-tooltip.tooltip-bottom {
            bottom: auto;
            top: calc(100% + 8px);
        }
        
        .citation:hover .citation-tooltip,
        .citation .citation-tooltip:hover {
            opacity: 1 !important;
            visibility: visible !important;
            transform: translateX(-50%) translateY(-4px);
        }
        
        .citation:hover .citation-tooltip.tooltip-right,
        .citation .citation-tooltip.tooltip-right:hover {
            opacity: 1 !important;
            visibility: visible !important;
            transform: translateX(0) translateY(-4px);
        }
        
        .citation:hover .citation-tooltip.tooltip-left,
        .citation .citation-tooltip.tooltip-left:hover {
            opacity: 1 !important;
            visibility: visible !important;
            transform: translateX(0) translateY(-4px);
        }
        
        .citation:hover .citation-tooltip.tooltip-bottom,
        .citation .citation-tooltip.tooltip-bottom:hover {
            opacity: 1 !important;
            visibility: visible !important;
            transform: translateX(-50%) translateY(4px);
        }
        
        .citation:hover .citation-tooltip.tooltip-bottom.tooltip-right,
        .citation .citation-tooltip.tooltip-bottom.tooltip-right:hover {
            opacity: 1 !important;
            visibility: visible !important;
            transform: translateX(0) translateY(4px);
        }
        
        .citation:hover .citation-tooltip.tooltip-bottom.tooltip-left,
        .citation .citation-tooltip.tooltip-bottom.tooltip-left:hover {
            opacity: 1 !important;
            visibility: visible !important;
            transform: translateX(0) translateY(4px);
        }
        
        .citation-tooltip::after {
            content: '';
            position: absolute;
            top: 100%;
            left: 50%;
            transform: translateX(-50%);
            border: 6px solid transparent;
            border-top-color: var(--tooltip-bg);
        }
        
        .citation-tooltip.tooltip-right::after {
            left: 20px;
        }
        
        .citation-tooltip.tooltip-left::after {
            left: auto;
            right: 20px;
            transform: translateX(50%);
        }
        
        .citation-tooltip.tooltip-bottom::after {
            top: -12px;
            border-top-color: transparent;
            border-bottom-color: var(--tooltip-bg);
        }
        
        .citation-tooltip.tooltip-bottom.tooltip-right::after {
            left: 20px;
        }
        
        .citation-tooltip.tooltip-bottom.tooltip-left::after {
            left: auto;
            right: 20px;
        }
        
        .citation-tooltip a {
            color: var(--primary-color);
            text-decoration: none;
            font-weight: 600;
            font-size: 1.1em;
            display: inline-flex;
            align-items: center;
            gap: 4px;
        }
        
        .citation-tooltip a:hover {
            color: var(--accent-color);
            transform: scale(1.15);
            transition: all 0.2s ease;
        }
        
        /* Mobile citation tooltip adjustments */
        @media (max-width: 768px) {
            /* Hide desktop tooltips completely on mobile */
            .citation-tooltip {
                display: none !important;
            }

            /* Mobile Citation Flyout */
            .mobile-citation-flyout {
                position: fixed;
                left: 0;
                right: 0;
                top: 0;
                min-height: 80px;
                max-height: 25vh;
                transform: translateY(-100%);
                z-index: 10001;
                background: #fbbf24;
                border-bottom: 3px solid var(--blood-red);
                box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
                transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
                overflow-y: auto;
                padding: 50px 20px 20px 20px;
                pointer-events: auto;
                cursor: pointer;
                display: flex;
                align-items: center;
                justify-content: center;
                gap: 15px;
            }

            [data-theme="dark"] .mobile-citation-flyout {
                background: #d2933e;
            }

            .mobile-citation-flyout.show {
                transform: translateY(0);
            }

            .mobile-citation-flyout-content {
                color: #1a1008;
                font-size: 0.9rem;
                line-height: 1.5;
                font-weight: 700;
                flex: 1;
                text-align: left;
            }

            [data-theme="dark"] .mobile-citation-flyout-content {
                color: #0d0805;
            }

            /* Create link icon with red circle */
            .mobile-citation-flyout::before {
                content: '🔗';
                font-size: 1.2rem;
                width: 40px;
                height: 40px;
                flex-shrink: 0;
                display: flex;
                align-items: center;
                justify-content: center;
                background: #ffffff;
                border: 3px solid var(--blood-red);
                border-radius: 50%;
                box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
            }

            [data-theme="dark"] .mobile-citation-flyout::before {
                background: #1a1008;
                border-color: #fbbf24;
            }

            .mobile-citation-close {
                position: absolute;
                top: 8px;
                right: 8px;
                width: 36px;
                height: 36px;
                border: 2px solid var(--blood-red);
                background: #ffffff;
                color: var(--blood-red);
                border-radius: 50%;
                font-size: 24px;
                font-weight: bold;
                display: flex;
                align-items: center;
                justify-content: center;
                cursor: pointer;
                z-index: 10002;
                box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
                transition: all 0.2s ease;
                pointer-events: auto;
            }

            .mobile-citation-close:hover,
            .mobile-citation-close:active {
                background: var(--blood-red);
                color: #ffffff;
                transform: scale(1.1);
            }

            [data-theme="dark"] .mobile-citation-close {
                background: #1a1008;
                color: #fbbf24;
                border-color: #fbbf24;
            }

            [data-theme="dark"] .mobile-citation-close:hover,
            [data-theme="dark"] .mobile-citation-close:active {
                background: #fbbf24;
                color: #1a1008;
            }

            .mobile-citation-backdrop {
                position: fixed;
                top: 0;
                left: 0;
                right: 0;
                bottom: 0;
                background: rgba(0, 0, 0, 0.4);
                z-index: 10000;
                opacity: 0;
                visibility: hidden;
                transition: opacity 0.3s ease, visibility 0.3s ease;
                pointer-events: none;
            }

            .mobile-citation-backdrop.show {
                opacity: 1;
                visibility: visible;
                pointer-events: auto;
            }

            /* Style links in mobile flyout */
            .mobile-citation-flyout-content a {
                color: var(--blood-red);
                text-decoration: underline;
                font-weight: 700;
            }

            .mobile-citation-flyout-content a:hover {
                color: var(--blood-red-dark);
            }

            [data-theme="dark"] .mobile-citation-flyout-content a {
                color: #8b0000;
            }

            [data-theme="dark"] .mobile-citation-flyout-content a:hover {
                color: #6b0000;
            }

            /* Style strong text in flyout */
            .mobile-citation-flyout-content strong {
                color: var(--blood-red-dark);
                font-weight: 900;
            }
        }
        
        /* Theme Toggle */
        .theme-toggle {
            position: fixed;
            top: 20px;
            right: 20px;
            z-index: 1001;
            background: var(--bg-secondary);
            border: 2px solid var(--border-color);
            border-radius: 50px;
            padding: 8px 16px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 0.9rem;
            color: var(--text-primary);
            box-shadow: 0 4px 12px var(--shadow-color);
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        
        .theme-toggle:hover {
            transform: scale(1.05);
            box-shadow: 0 6px 20px var(--shadow-color);
        }
        
        /* Desktop Only Theme Toggle */
        .nav-theme-toggle {
            border: 2px solid var(--border-color);
            border-radius: 50px;
            padding: 8px 14px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 0.85rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-weight: 600;
            flex-shrink: 0;
            margin-left: 0.5rem;
        }

        /* Light theme: button previews dark mode */
        :root .nav-theme-toggle {
            background: #1a1008;
            color: #e8a84d;
            border-color: #1a1008;
        }

        :root .nav-theme-toggle:hover {
            transform: scale(1.05);
            background: #0d0805;
            border-color: #d2933e;
        }

        /* Dark theme: button previews light mode */
        [data-theme="dark"] .nav-theme-toggle {
            background: #fef3e2;
            color: #b96727;
            border-color: #d2933e;
        }

        [data-theme="dark"] .nav-theme-toggle:hover {
            transform: scale(1.05);
            background: #ffffff;
            border-color: #cf903b;
        }
        
        /* Hide nav theme toggle on mobile */
        @media (max-width: 768px) {
            .nav-theme-toggle {
                display: none !important;
            }
        }
        
        /* Legacy desktop-theme-toggle (if still referenced) */
        .desktop-theme-toggle {
            position: fixed;
            top: 20px;
            right: 20px;
            z-index: 9999;
            background: #ffffff;
            border: 2px solid #e5e7eb;
            border-radius: 50px;
            padding: 10px 16px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 0.9rem;
            color: #374151;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-weight: 600;
        }
        
        .desktop-theme-toggle:hover {
            transform: scale(1.05);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
            background: #f9fafb;
        }
        
        /* Hide desktop theme toggle on mobile */
        @media (max-width: 768px) {
            .desktop-theme-toggle {
                display: none !important;
            }
        }
        
        /* Utility classes for layout */
        .justify-center {
            justify-content: center;
        }
        
        .mb-0 {
            margin-bottom: 0;
        }
        
        .grid {
            display: grid;
        }
        
        .grid-cols-1 {
            grid-template-columns: repeat(1, minmax(0, 1fr));
        }
        
        .gap-6 {
            gap: 1.5rem;
        }
        
        .flex {
            display: flex;
        }
        
        .flex-col {
            flex-direction: column;
        }
        
        .hidden {
            display: none;
        }
        
        /* Large screen grid layout */
        @media (min-width: 1024px) {
            .lg\:grid-cols-3 {
                grid-template-columns: repeat(3, minmax(0, 1fr));
            }
        }
        
        /* Responsive tooltip adjustments */
        @media (max-width: 768px) {
            .citation-tooltip {
                position: fixed !important;
                left: 10px !important;
                right: 10px !important;
                bottom: 60px !important;
                top: auto !important;
                transform: none !important;
                max-width: none !important;
                white-space: normal !important;
                border-radius: 12px;
            }
            
            .citation:hover .citation-tooltip,
            .citation:hover .citation-tooltip.tooltip-right,
            .citation:hover .citation-tooltip.tooltip-left {
                transform: none !important;
            }
            
            .citation-tooltip::after,
            .citation-tooltip.tooltip-right::after,
            .citation-tooltip.tooltip-left::after {
                display: none !important;
            }
            
            .tab-container {
                flex-wrap: wrap;
                gap: 1px;
            }
            
            .tab-btn {
                min-width: calc(50% - 1px);
                font-size: 0.85rem;
                padding: 10px 12px;
            }
        }
        
        /* Enhanced UI improvements */
        .story-content {
            scroll-behavior: smooth;
            padding: 2rem;
            background: var(--content-bg);
            color: var(--text-primary);
        }
        
        .story-content p {
            margin-bottom: 1.8rem;
            text-align: justify;
            hyphens: auto;
            color: var(--text-primary);
            line-height: 1.8;
        }
        
        .citation-info {
            background: var(--citation-bg);
            border: 1px solid var(--citation-border);
            border-radius: 12px;
            padding: 1.5rem;
            margin-bottom: 2rem;
            display: flex;
            align-items: flex-start;
            gap: 12px;
        }
        
        .citation-info-icon {
            font-size: 1.5rem;
            line-height: 1;
            margin-top: 2px;
        }
        
        .citation-info-text {
            flex: 1;
            color: var(--text-primary);
            font-size: 0.95rem;
            line-height: 1.5;
        }
        
        .citation-info strong {
            color: var(--citation-text);
        }
        
        /* Audio player styling */
        audio {
            border-radius: 12px;
            box-shadow: 0 8px 32px var(--shadow-color);
            background: var(--bg-secondary);
            width: 100%;
        }
        
        /* Reading progress indicator */
        .reading-progress {
            position: fixed;
            top: 0;
            left: 0;
            width: 0%;
            height: 3px;
            background: var(--progress-bg);
            z-index: 9999;
            transition: width 0.3s ease;
        }
        
        /* Story Content Styles */
        .story-content-container,
        .video-content-container {
            background: var(--bg-secondary);
            border-radius: 12px;
            box-shadow: 0 8px 32px var(--shadow-color);
            padding: 3rem;
            margin: 2rem;
            max-width: 1000px;
            margin-left: auto;
            margin-right: auto;
            color: var(--text-primary);
        }
        
        .citation-paragraph {
            font-size: 0.9rem !important;
            margin-top: 2rem;
            padding-top: 1rem;
            border-top: 2px solid var(--border-color);
            opacity: 0.8;
            text-align: center;
            line-height: 1.4 !important;
        }
        
        .story-content-container p {
            font-size: 1.1rem !important;
            line-height: 1.8 !important;
            margin-bottom: 1.5rem !important;
            color: var(--text-primary) !important;
        }
        
        .story-content-container .citation-info {
            font-size: 0.95rem;
            margin-bottom: 2rem;
        }
        
        h2.section-heading {
            font-size: 1.5rem !important;
            font-weight: 700 !important;
            color: var(--primary-color) !important;
            margin: 2.5rem 0 1rem 0 !important;
            padding-bottom: 0.5rem !important;
            border-bottom: 2px solid var(--border-color) !important;
        }
        
        /* Ensure section headings always maintain proper color */
        .story-content-container h2.section-heading {
            color: var(--primary-color) !important;
        }

        /* Main Header Styles */
        .main-header {
            text-align: center;
            margin: 3rem 0;
            padding: 2rem;
            background: var(--bg-secondary);
            border-radius: 16px;
            box-shadow: 0 8px 32px var(--shadow-color);
        }
        
        .main-title {
            font-size: clamp(2.5rem, 8vw, 4rem);
            font-weight: 900;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            color: var(--text-accent) !important;
            margin-bottom: 1rem;
            text-shadow: 2px 2px 4px var(--shadow-color);
        }
        
        .main-subtitle {
            font-size: clamp(1.25rem, 4vw, 1.75rem);
            font-weight: 300;
            color: var(--text-secondary) !important;
            margin-top: 1rem;
        }

        /* Audio Overview Styles */
        .audio-overview-title {
            font-size: 1.75rem;
            font-weight: 700;
            color: var(--citation-text);
            margin-bottom: 1.5rem;
            text-align: center;
            background: var(--bg-secondary);
            padding: 1rem 2rem;
            border-radius: 8px;
            border-left: 4px solid var(--citation-text);
        }

        /* References Section Styles */
        .references-content {
            background: var(--bg-secondary);
            border-radius: 12px;
            box-shadow: 0 8px 32px var(--shadow-color);
            padding: 3rem;
            margin: 2rem;
            max-width: 1000px;
            margin-left: auto;
            margin-right: auto;
        }

        .references-content h2 {
            color: var(--citation-text) !important;
            font-size: 2rem;
            font-weight: 700;
            text-align: center;
            margin-bottom: 2rem;
        }

        .references-content ol {
            color: var(--text-primary) !important;
        }

        /* Enhanced Timeline - Improved Version */
        .timeline-container {
            position: relative;
            max-width: 100%;

            background: var(--bg-secondary);
            border-radius: 12px;
            box-shadow: 0 8px 32px var(--shadow-color);
            overflow: hidden;
            contain: layout style paint;
        }
        
        .timeline-wrapper {
            position: relative;
            padding: 1rem 0;
            max-width: 900px;
            margin: 0 auto;
            overflow: hidden;
        }
        
        .timeline-center-line {
            position: absolute;
            left: 50%;
            top: 0;
            bottom: 0;
            width: 3px;
            background: var(--citation-text);
            transform: translateX(-50%);
            border-radius: 2px;
        }
        
        /* Timeline endcaps - solid dots at start and end */
        .timeline-center-line::before,
        .timeline-center-line::after {
            content: '';
            position: absolute;
            width: 12px;
            height: 12px;
            background: var(--citation-text);
            border-radius: 50%;
            left: 50%;
            transform: translateX(-50%);
            z-index: 10;
        }
        
        .timeline-center-line::before {
            top: -6px; /* Position at the top */
        }
        
        .timeline-center-line::after {
            bottom: -6px; /* Position at the bottom */
        }
        
        .timeline-item {
            position: relative;
            margin-bottom: 2rem;
            width: 100%;
            display: flex;
            align-items: flex-start;
        }
        
        .timeline-item:nth-child(odd) .timeline-content {
            margin-left: 0;
            margin-right: auto;
            width: calc(50% - 40px);
            text-align: left;
        }
        
        /* Add notch/pointer for odd items (left side) pointing to marker */
        .timeline-item:nth-child(odd) .timeline-content::after {
            content: '';
            position: absolute;
            right: -12px;
            top: 1rem;
            width: 0;
            height: 0;
            border-left: 12px solid var(--bg-secondary);
            border-top: 8px solid transparent;
            border-bottom: 8px solid transparent;
            z-index: 1;
        }
        
        .timeline-item:nth-child(odd) .timeline-content::before {
            content: '';
            position: absolute;
            right: -13px;
            top: 1rem;
            width: 0;
            height: 0;
            border-left: 13px solid var(--border-color);
            border-top: 9px solid transparent;
            border-bottom: 9px solid transparent;
            z-index: 0;
        }
        
        .timeline-item:nth-child(even) .timeline-content {
            margin-left: auto;
            margin-right: 0;
            width: calc(50% - 40px);
            text-align: left;
        }
        
        /* Add notch/pointer for even items (right side) pointing to marker */
        .timeline-item:nth-child(even) .timeline-content::after {
            content: '';
            position: absolute;
            left: -12px;
            top: 1rem;
            width: 0;
            height: 0;
            border-right: 12px solid var(--bg-secondary);
            border-top: 8px solid transparent;
            border-bottom: 8px solid transparent;
            z-index: 1;
        }
        
        .timeline-item:nth-child(even) .timeline-content::before {
            content: '';
            position: absolute;
            left: -13px;
            top: 1rem;
            width: 0;
            height: 0;
            border-right: 13px solid var(--border-color);
            border-top: 9px solid transparent;
            border-bottom: 9px solid transparent;
            z-index: 0;
        }
        
        .timeline-content {
            position: relative;
            padding: 1rem;
            background: var(--bg-secondary);
            border-radius: 8px;
            box-shadow: 0 2px 8px var(--shadow-color);
            border: 1px solid var(--border-color);
            transition: all 0.3s ease;
            word-wrap: break-word;
            overflow-wrap: break-word;
        }
        
        .timeline-content:hover {
            transform: translateY(-4px);
            box-shadow: 0 8px 32px var(--shadow-color);
            border-color: var(--citation-text);
        }
        
        /* Clickable timeline items */
        .timeline-item.timeline-clickable {
            cursor: pointer;
        }
        
        .timeline-item.timeline-clickable .timeline-content {
            transition: all 0.3s ease, background-color 0.3s ease;
        }
        
        .timeline-item.timeline-clickable:hover .timeline-content {
            background: var(--citation-highlight);
            transform: translateY(-6px);
            box-shadow: 0 12px 40px var(--shadow-color);
            border-color: var(--citation-text);
        }
        
        .timeline-item.timeline-clickable:active .timeline-content {
            transform: translateY(-2px);
        }
        
        /* Date badge inside the card */
        .timeline-date-badge {
            background: #f59e0b;
            color: #0f172a !important;
            padding: 6px 12px;
            border-radius: 12px;
            font-weight: 700;
            font-size: 0.8rem;
            white-space: nowrap;
            box-shadow: 0 2px 8px rgba(0,0,0,0.15);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            margin-bottom: 0.75rem;
            border: 2px solid rgba(15, 23, 42, 0.2);
        }
        
        .tab-content .timeline-date-badge,
        .tab-content .timeline-date-badge * {
            color: #0f172a !important;
        }
        
        [data-theme="dark"] .timeline-date-badge {
            background: var(--citation-text);
            color: #0f172a !important;
            border: 2px solid rgba(15, 23, 42, 0.3);
        }
        
        [data-theme="dark"] .tab-content .timeline-date-badge,
        [data-theme="dark"] .tab-content .timeline-date-badge * {
            color: #0f172a !important;
        }
        
        /* Ensure date connector and date text are high contrast in both modes */
        .date-start,
        .date-end {
            display: inline-block;
            color: #0f172a !important;
            font-weight: 700 !important;
            font-size: 0.8rem !important;
        }
        
        .date-connector {
            display: inline-block;
            width: 16px;
            height: 2px;
            background: #0f172a !important;
            position: relative;
            margin: 0 4px;
            vertical-align: middle;
        }
        
        .date-connector::after {
            content: '';
            position: absolute;
            right: -2px;
            top: 50%;
            transform: translateY(-50%);
            width: 0;
            height: 0;
            border-left: 4px solid #0f172a !important;
            border-top: 2.5px solid transparent;
            border-bottom: 2.5px solid transparent;
        }
        
        [data-theme="dark"] .date-connector {
            background: #0f172a !important;
        }
        
        [data-theme="dark"] .date-start,
        [data-theme="dark"] .date-end {
            color: #0f172a !important;
            font-weight: 700 !important;
        }
        
        [data-theme="dark"] .date-connector::after {
            border-left: 4px solid #0f172a !important;
        }
        
        /* Old timeline-date styles - kept for backwards compatibility but hidden */
        .timeline-date {
            display: none;
        }
        
        .timeline-marker {
            position: absolute;
            left: 50%;
            top: 1rem;
            transform: translateX(-50%);
            width: 16px;
            height: 16px;
            background: white;
            border: 3px solid #f59e0b;
            border-radius: 50%;
            z-index: 10;
            box-shadow: 0 2px 8px rgba(0,0,0,0.2);
        }
        
        [data-theme="dark"] .timeline-marker {
            background: #0f172a;
            border-color: var(--citation-text);
        }
        
        .timeline-icon {
            font-size: 1.2rem;
            margin-right: 0.25rem;
            vertical-align: middle;
        }
        
        .timeline-title {
            font-weight: 700;
            font-size: 1.1rem;
            color: var(--text-primary);
            margin-bottom: 0.5rem;
            display: flex;
            align-items: center;
        }
        
        .timeline-description {
            color: var(--text-secondary);
            line-height: 1.6;
            font-size: 0.95rem;
        }
        
        .timeline-category {
            display: inline-block;
            padding: 4px 12px;
            border-radius: 16px;
            font-size: 0.8rem;
            font-weight: 600;
            margin-top: 0.75rem;
        }
        
        .category-key {
            background: rgba(239, 68, 68, 0.1);
            color: #dc2626;
            border: 1px solid rgba(239, 68, 68, 0.3);
        }
        
        .category-context {
            background: rgba(99, 102, 241, 0.1);
            color: #4f46e5;
            border: 1px solid rgba(99, 102, 241, 0.3);
        }
        
        .category-relationship {
            background: rgba(5, 150, 105, 0.1);
            color: #059669;
            border: 1px solid rgba(5, 150, 105, 0.3);
        }
        
        .category-suspicious {
            background: rgba(220, 38, 38, 0.1);
            color: #b91c1c;
            border: 1px solid rgba(220, 38, 38, 0.3);
        }
        
        /* Relationship timeline item styling */
        .timeline-item.relationship .timeline-marker {
            border-color: #8b5cf6;
        }
        
        [data-theme="dark"] .timeline-item.relationship .timeline-marker {
            border-color: #a78bfa;
        }
        
        /* Mobile Timeline */
        @media (max-width: 768px) {
            .timeline-center-line {
                left: 30px;
            }
            
            /* Mobile timeline endcaps */
            .timeline-center-line::before,
            .timeline-center-line::after {
                width: 10px;
                height: 10px;
                left: 50%;
            }
            
            .timeline-center-line::before {
                top: -5px;
            }
            
            .timeline-center-line::after {
                bottom: -5px;
            }
            
            /* Fix timeline layout for mobile - stack vertically with flex-direction column */
            .timeline-item {
                display: flex !important;
                flex-direction: column !important;
                align-items: stretch !important;
                margin-bottom: 1.5rem !important;
                width: 100% !important;
            }
            
            .timeline-item:nth-child(odd) .timeline-content,
            .timeline-item:nth-child(even) .timeline-content {
                position: static !important;
                left: auto !important;
                right: auto !important;
                width: 100% !important;
                margin: 0 !important;
                text-align: left;
            }
            
            /* Hide notches on mobile */
            .timeline-item:nth-child(odd) .timeline-content::after,
            .timeline-item:nth-child(odd) .timeline-content::before,
            .timeline-item:nth-child(even) .timeline-content::after,
            .timeline-item:nth-child(even) .timeline-content::before {
                display: none !important;
            }
            
            /* Hide old timeline-date and marker on mobile */
            .timeline-date {
                display: none !important;
            }
            
            .timeline-marker {
                position: static !important;
                left: auto !important;
                transform: none !important;
                margin: 0 auto 0.75rem !important;
                order: -1;
            }
            
            .timeline-center-line {
                display: none;
            }
            
            /* Maximize usable space - minimal padding on tab content */
            .tab-content {
                overflow-x: hidden !important;
                overflow-y: auto !important;
                padding: 0.25rem !important;
            }
            
            /* Mobile optimizations for content containers - minimize margins */
            .story-content-container,
            .video-content-container,
            .network-map-container {
                padding: 0.5rem !important;
                margin: 0 !important;
                border-radius: 8px;
                max-width: 100% !important;
                overflow-x: hidden;
            }
            
            .story-content-container p {
                font-size: 1rem !important;
                line-height: 1.6 !important;
            }
            
            .main-header {
                padding: 1rem 0.5rem;
            }
            
            .main-title {
                font-size: 1.75rem;
            }
            
            .main-subtitle {
                font-size: 0.9rem;
            }
            
            /* Timeline mobile adjustments - reduce padding */
            .timeline-content {
                padding: 0.25rem !important;
                width: 100% !important;
                max-width: 100% !important;
                margin: 0 !important;
                box-sizing: border-box;
                word-break: break-word;
            }
            
            .timeline-item {
                overflow: visible;
                margin-bottom: 0.75rem !important;
                padding: 0 !important;
                width: 100% !important;
                box-sizing: border-box;
            }

            .timeline-content h3,
            .timeline-content p,
            .timeline-content div {
            
            }
            
            /* Ensure citations don't overflow */
            .citation-tooltip {
                max-width: calc(100vw - 20px) !important;
                box-sizing: border-box;
            }
            

            
            /* References mobile adjustments - reduce padding */
            .references-content {
                padding: 0.5rem;
                overflow-x: hidden;
                word-break: break-word;
            }
            
            .references-content li {
                font-size: 0.9rem;
                margin-bottom: 0.5rem;
            }
            
            /* Hide mobile controls on desktop by default */
            .mobile-controls-container {
                display: none !important;
            }
        }
        
        /* Desktop only - hide mobile controls */
        @media (min-width: 769px) {
            .mobile-controls-container,
            .mobile-citation-toggle,
            .mobile-theme-toggle {
                display: none !important;
                visibility: hidden !important;
            }
            
            /* Ensure desktop theme toggle is visible */
            .theme-toggle {
                display: flex !important;
                visibility: visible !important;
                position: fixed !important;
                top: 20px !important;
                right: 20px !important;
                z-index: 9999 !important;
                background: #f1f5f9 !important;
                border: 2px solid #d1d5db !important;
                border-radius: 50px !important;
                padding: 8px 16px !important;
                cursor: pointer !important;
                font-size: 0.9rem !important;
                color: #0f172a !important;
                box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2) !important;
                align-items: center !important;
                gap: 0.5rem !important;
                opacity: 1 !important;
                pointer-events: auto !important;
            }
        }
            
            /* Mobile citation toggle in bottom bar */
            .mobile-citation-toggle {
                background: var(--bg-secondary, #f1f5f9) !important;
                border: 2px solid var(--border-color, #d1d5db) !important;
                border-radius: 25px;
                padding: 8px 12px;
                box-shadow: 0 4px 12px var(--shadow-color, rgba(15, 23, 42, 0.1)) !important;
                flex: 0 1 auto; /* Don't expand to fill space */
                display: none; /* Initially hidden */
                align-items: center;
                justify-content: center;
                transition: opacity 0.3s ease;
                min-width: 0; /* Allow shrinking */
            }
            
            .mobile-citation-toggle .citation-toggle-label {
                font-size: 0.8rem;
                gap: 0.5rem;
                margin: 0;
                color: var(--text-primary);
            }
            
            .mobile-citation-toggle .citation-toggle-switch {
                width: 40px;
                height: 22px;
            }
            
            .mobile-citation-toggle .citation-toggle-slider:before {
                height: 16px;
                width: 16px;
            }
            
            .mobile-citation-toggle .citation-toggle-input:checked + .citation-toggle-slider:before {
                transform: translateX(18px);
            }
            
            /* Mobile theme toggle in bottom bar - inverted colors to preview theme */
            .mobile-theme-toggle {
                border: 2px solid var(--border-color, #d1d5db) !important;
                border-radius: 25px;
                padding: 8px 12px;
                cursor: pointer;
                box-shadow: 0 4px 12px var(--shadow-color, rgba(15, 23, 42, 0.1)) !important;
                font-size: 0.8rem;
                white-space: nowrap;
                flex: 0 0 auto; /* Fixed size, don't shrink or grow */
                pointer-events: auto; /* Ensure it's clickable */
                z-index: 1001; /* Above other elements */
                position: relative;
                display: block !important; /* Override desktop hide rule */
            }

            /* Light theme: button previews dark mode */
            :root .mobile-theme-toggle {
                background: #1a1008 !important;
                color: #e8a84d !important;
                border-color: #1a1008 !important;
            }

            /* Dark theme: button previews light mode */
            [data-theme="dark"] .mobile-theme-toggle {
                background: #fef3e2 !important;
                color: #b96727 !important;
                border-color: #d2933e !important;
            }
            
            /* Hide desktop theme toggle on mobile */
            .theme-toggle {
                display: none !important;
            }
        }
        
        /* Citation Toggle Sticky Container */
        .citation-toggle-sticky-container {
            position: fixed !important;
            top: 80px !important; /* Right below the fixed nav menu */
            left: 0 !important;
            right: 0 !important;
            z-index: 500 !important; /* High z-index but below nav (1000) */
            margin-bottom: 2rem;
            display: block;
            transition: opacity 0.3s ease;
            background: var(--page-bg); /* Add background so it covers content */
            padding: 1rem 0;
            box-shadow: 0 2px 8px var(--shadow-color);
        }
        
        .citation-toggle-wrapper {
            display: flex;
            justify-content: center;
            padding: 1rem;
            background: var(--content-bg);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            box-shadow: 0 4px 20px var(--shadow-color);
            backdrop-filter: blur(10px);
        }
        
        /* Toggle Switch Styles */
        .citation-toggle-label {
            display: flex;
            align-items: center;
            gap: 1rem;
            cursor: pointer;
            user-select: none;
            font-weight: 600;
            color: var(--text-primary);
            font-size: 0.95rem;
        }
        
        .citation-toggle-switch {
            position: relative;
            display: inline-block;
            width: 60px;
            height: 32px;
        }
        
        .citation-toggle-input {
            opacity: 0;
            width: 0;
            height: 0;
        }
        
        .citation-toggle-slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: #ccc;
            transition: 0.3s ease;
            border-radius: 32px;
            border: 2px solid var(--border-color);
        }
        
        .citation-toggle-slider:before {
            position: absolute;
            content: "";
            height: 24px;
            width: 24px;
            left: 2px;
            bottom: 2px;
            background: white;
            transition: 0.3s ease;
            border-radius: 50%;
            box-shadow: 0 2px 4px rgba(0,0,0,0.2);
        }
        
        .citation-toggle-input:checked + .citation-toggle-slider {
            background: var(--citation-text);
            border-color: var(--citation-border);
        }
        
        .citation-toggle-input:focus + .citation-toggle-slider {
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
        }
        
        .citation-toggle-input:checked + .citation-toggle-slider:before {
            transform: translateX(28px);
        }
        
        /* Hover effects */
        .citation-toggle-label:hover .citation-toggle-slider {
            box-shadow: 0 2px 8px var(--shadow-color);
        }
        
        .citation-toggle-label:hover {
            color: var(--citation-text);
        }
        
        /* Hidden citations state */
        .citations-hidden .citation {
            display: none !important;
        }

        /* Scroll to Top Button */
        .scroll-to-top-btn {
            position: fixed;
            bottom: 20px;
            right: 20px;
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background: #fbbf24;
            color: var(--blood-red);
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            visibility: hidden;
            transform: translateY(20px);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            box-shadow: 0 4px 12px rgba(251, 191, 36, 0.6);
            z-index: 1000;
        }
        
        /* Adjust scroll button position when citation toggle is visible */
        .scroll-to-top-btn.with-citation-toggle {
            right: 80px;
        }

        .scroll-to-top-btn.visible {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
        }

        .scroll-to-top-btn:hover {
            background: #f59e0b;
            box-shadow: 0 6px 20px rgba(251, 191, 36, 0.8);
            transform: translateY(-2px);
        }

        .scroll-to-top-btn:active {
            transform: translateY(0);
        }

        /* Dark mode styles for back-to-top button */
        [data-theme="dark"] .scroll-to-top-btn {
            background: var(--blood-red);
            color: #e8a84d;
            box-shadow: 0 4px 12px rgba(232, 168, 77, 0.4), 0 0 20px rgba(232, 168, 77, 0.3);
        }

        [data-theme="dark"] .scroll-to-top-btn:hover {
            background: var(--blood-red-highlight);
            color: #d2933e;
            box-shadow: 0 6px 20px rgba(232, 168, 77, 0.6), 0 0 30px rgba(232, 168, 77, 0.5);
        }

        /* Mobile adjustments */
        @media (max-width: 768px) {
            .scroll-to-top-btn {
                bottom: 15px;
                right: 15px;
                width: 45px;
                height: 45px;
            }
            
            /* Hide desktop citation toggle on mobile */
            .citation-toggle-sticky-container {
                display: none !important;
            }
            
            /* Reset scroll button position on mobile */
            .scroll-to-top-btn.with-citation-toggle {
                right: 15px !important;
            }
            
            /* Mobile Sticky Bottom Controls */
            .mobile-controls-container {
                position: fixed !important;
                bottom: 15px !important;
                left: 15px !important;
                right: 80px !important; /* Leave space for scroll-to-top button */
                display: flex !important;
                gap: 10px;
                z-index: 1000;
                align-items: center;
                justify-content: flex-start;
                flex-wrap: nowrap;
            }
            
            .mobile-citation-toggle,
            .mobile-theme-toggle {
                display: block !important;
            }
        }
        
        /* Mindmap Styles */
        .mindmap-container {
            position: relative;
            width: 100%;
            height: calc(100vh - 80px - 104px); /* Full viewport minus nav (80px) and controls (~104px) */
            min-height: 600px;
        }
        
        /* Players List View */
        .players-list-container {
            padding: 2rem;
            max-width: 1200px;
            margin: 0 auto;
        }
        
        .players-list-content {
            display: flex;
            flex-direction: column;
            gap: 2rem;
        }
        
        .players-list-group {
            background: var(--bg-secondary);
            border-radius: 12px;
            padding: 1.5rem;
            border: 2px solid var(--border-color);
            box-shadow: 0 2px 8px var(--shadow-color);
        }
        
        .players-list-group-header {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            margin-bottom: 1.5rem;
            padding-bottom: 0.75rem;
            border-bottom: 2px solid var(--border-color);
            cursor: pointer;
            user-select: none;
            transition: all 0.2s ease;
        }

        .players-list-group-header:hover {
            opacity: 0.8;
        }

        .players-list-collapse-icon {
            font-size: 0.8rem;
            color: var(--text-secondary);
            transition: transform 0.2s ease;
            flex-shrink: 0;
        }
        
        .players-list-group-icon {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            font-size: 24px;
        }
        
        .players-list-group-title {
            font-size: 1.5rem;
            font-weight: 700;
            margin: 0;
            color: var(--text-primary);
        }
        
        .players-list-group-count {
            margin-left: auto;
            font-size: 0.875rem;
            color: var(--text-secondary);
            background: var(--bg-accent);
            padding: 0.25rem 0.75rem;
            border-radius: 12px;
        }
        
        .players-list-items {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
            gap: 1rem;
            transition: all 0.3s ease;
            overflow: hidden;
        }

        .players-list-items.collapsed {
            display: none;
        }
        
        .players-list-item {
            background: var(--content-bg);
            border: 2px solid var(--border-color);
            border-radius: 8px;
            padding: 1rem;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: flex-start;
            gap: 0.75rem;
        }
        
        .players-list-item:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px var(--shadow-color);
            border-color: var(--citation-text);
            background: var(--citation-highlight);
        }
        
        .players-list-item-icon {
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            font-size: 20px;
        }
        
        .players-list-item-content {
            flex: 1;
            min-width: 0;
        }
        
        .players-list-item-name {
            font-weight: 600;
            font-size: 1rem;
            margin: 0 0 0.25rem 0;
            color: var(--text-primary);
        }
        
        .players-list-item-description {
            font-size: 0.875rem;
            color: var(--text-secondary);
            margin: 0;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
            text-overflow: ellipsis;
            line-height: 1.4;
        }

        
        .mindmap-controls {
            background: var(--page-bg);
            padding: 1rem;
            position: sticky;
            top: 90px; /* Stick under fixed nav: 80px body padding + ~10px extra for nav border/shadow */
            z-index: 100;
        }
        
        @media (max-width: 768px) {
            .mindmap-controls {
                display: none !important;
            }
            
            .mindmap-container {
                height: calc(100vh - 140px - 104px); /* Adjust for mobile nav height */
            }
            
            /* Show list view only on mobile, hide mindmap */
            #mindmap-view {
                display: none !important;
            }
            
            #list-view {
                display: block !important;
            }
            
            /* Hide view toggle button on mobile since list is the only view */
            #toggleView,
            .view-toggle-btn {
                display: none !important;
            }
            
            .players-list-container {
                padding: 1rem;
            }
            
            .players-list-items {
                grid-template-columns: 1fr;
            }

            /* Collapsed state - no bottom margin when collapsed */
            .players-list-group-header {
                margin-bottom: 0;
                flex-wrap: wrap;
                gap: 0.5rem;
            }

            .players-list-group-title {
                font-size: 1.25rem;
                flex: 1 1 auto;
                min-width: 0;
            }

            .players-list-group-count {
                font-size: 0.75rem;
                padding: 0.2rem 0.5rem;
                white-space: nowrap;
                flex-shrink: 0;
            }

            .players-list-group-icon {
                width: 32px;
                height: 32px;
                font-size: 18px;
            }

            .players-list-items:not(.collapsed) + .players-list-group-header,
            .players-list-group-header:has(+ .players-list-items:not([style*="display: none"])) {
                margin-bottom: 1.5rem;
            }
        }
        
        .filter-checkboxes {
            display: flex;
            justify-content: center;
            gap: 1.5rem;
            flex-wrap: wrap;
        }
        
        .checkbox-item {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            cursor: pointer;
            padding: 0.5rem 0.75rem;
            border-radius: 6px;
            transition: background-color 0.2s;
        }
        
        .checkbox-item:hover {
            background-color: var(--bg-secondary);
        }
        
        .checkbox-item input[type="checkbox"] {
            width: 1.2rem;
            height: 1.2rem;
            cursor: pointer;
        }
        
        .checkbox-item label {
            cursor: pointer;
            font-weight: 500;
            color: var(--text-secondary);
        }
        
        .entity-icon-circle {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            font-size: 14px;
            color: white;
            margin-right: 0.5rem;
        }
        
        .mobile-preview {
            position: fixed;
            bottom: 20px;
            left: 20px;
            right: 20px;
            background: var(--content-bg);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            padding: 1rem;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
            z-index: 1000;
            transform: translateY(100%);
            transition: transform 0.3s ease;
        }
        
        .mobile-preview.show {
            transform: translateY(0);
        }
        
        .mobile-preview-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 0.75rem;
        }
        
        .mobile-preview-close {
            background: none;
            border: none;
            font-size: 1.5rem;
            cursor: pointer;
            color: var(--text-secondary);
            padding: 0;
            line-height: 1;
        }
        
        .mobile-preview-title {
            font-weight: 600;
            color: var(--citation-text);
            margin: 0;
            flex: 1;
            margin-right: 1rem;
        }
        
        .mobile-preview-type {
            font-size: 0.875rem;
            color: var(--text-secondary);
            font-style: italic;
            margin-bottom: 0.5rem;
        }
        
        .mobile-preview-content {
            font-size: 0.9rem;
            line-height: 1.4;
            color: var(--text-primary);
            margin-bottom: 1rem;
        }
        
        .mobile-preview-actions {
            display: flex;
            justify-content: flex-end;
        }
        
        .mobile-more-button {
            background: var(--citation-highlight);
            color: white;
            border: none;
            padding: 0.5rem 1rem;
            border-radius: 6px;
            font-size: 0.875rem;
            cursor: pointer;
            font-weight: 500;
        }
        
        .mobile-more-button:hover {
            background: var(--citation-text);
        }

        /* Loading Indicator Styles */
        .mindmap-loading {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(var(--bg-rgb), 0.9);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 100;
            backdrop-filter: blur(2px);
        }

        .loading-spinner {
            width: 50px;
            height: 50px;
            border: 4px solid var(--border-color);
            border-top: 4px solid var(--citation-highlight);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin-bottom: 1rem;
        }

        .loading-text {
            color: var(--text-secondary);
            font-size: 1rem;
            font-weight: 500;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        
        /* Only show mobile preview on mobile devices */
        @media (min-width: 768px) {
            .mobile-preview {
                display: none;
            }
        }
        
        .entity-connections {
            margin-top: 1.5rem;
            border-top: 1px solid var(--citation-border);
            padding-top: 1rem;
        }
        
        .connection-link {
            display: inline-block;
            background: var(--bg-secondary);
            color: var(--citation-text);
            text-decoration: none;
            padding: 0.25rem 0.5rem;
            margin: 0.25rem 0.5rem 0.25rem 0;
            border-radius: 4px;
            font-size: 0.875rem;
            border: 1px solid var(--border-color);
            cursor: pointer;
            transition: background-color 0.2s;
            width: 100%;
        }
        
        /* Light mode hover - red background */
        :root .connection-link:hover {
            background: var(--blood-red);
            color: #ffffff;
        }

        /* Dark mode hover - red background */
        [data-theme="dark"] .connection-link:hover {
            background: var(--blood-red-dark);
            color: #ffffff;
        }
        
        .focused-entity {
            stroke: #f59e0b !important;
            stroke-width: 6px !important;
            filter: drop-shadow(0 0 10px #f59e0b);
        }
        
        .connected-entity {
            stroke: #3b82f6 !important;
            stroke-width: 4px !important;
            filter: drop-shadow(0 0 8px #3b82f6);
            opacity: 1 !important;
        }
        
        .timeline-d3-container {
            padding: 2rem;
        }
        
        .timeline-d3-controls {
            background: var(--content-bg);
            padding: 1rem;
            border-radius: 8px;
            border: 1px solid var(--border-color);
            margin-bottom: 1rem;
        }
        
        #timeline-d3-svg-container {
            position: relative;
            overflow: hidden;
            width: 100%;
            height: 800px;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            background: var(--content-bg);
            min-height: 600px;
        }
        
        #mindmap-svg-container {
            position: relative;
            overflow: hidden;
            width: 100%;
            height: 100%; /* Fill the mindmap-container */
            border: 1px solid var(--border-color);
            border-radius: 8px;
            background: var(--content-bg);
        }
        
        .mindmap-node {
            cursor: pointer;
            transition: all 0.2s ease;
        }
        
        .mindmap-node:hover {
            stroke-width: 3px;
        }
        
        .mindmap-link {
            stroke: var(--border-color);
            stroke-opacity: 0.6;
            fill: none;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        
        .mindmap-link:hover {
            stroke-opacity: 1;
            stroke-width: 3px;
        }
        
        .mindmap-label {
            font-family: 'Inter', sans-serif;
            font-size: 12px;
            fill: var(--text-primary);
            text-anchor: middle;
            pointer-events: none;
        }
        
        .mindmap-tooltip {
            position: absolute;
            background: var(--content-bg);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 12px;
            font-size: 14px;
            color: var(--text-primary);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            pointer-events: none;
            z-index: 1000;
            max-width: 300px;
        }
        
        .mindmap-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            z-index: 2000;
            display: none;
            justify-content: center;
            align-items: center;
        }
        
        .mindmap-modal-content {
            background: var(--content-bg);
            border-radius: 12px;
            max-width: 600px;
            max-height: 80vh;
            overflow: hidden;
            color: var(--text-primary);
            display: flex;
            flex-direction: column;
            position: relative;
        }

        .mindmap-modal-header {
            padding: 1.5rem 2rem 0 2rem;
            position: sticky;
            top: 0;
            background: var(--content-bg);
            z-index: 10;
            border-bottom: 1px solid var(--border-color);
        }

        .mindmap-modal-body {
            padding: 1.5rem 2rem;
            overflow-y: auto;
            flex: 1;
            /* Hide scrollbar */
            scrollbar-width: none;
            -ms-overflow-style: none;
        }

        .mindmap-modal-body::-webkit-scrollbar {
            display: none;
        }

        .mindmap-scroll-indicator {
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            width: 50px;
            height: 40px;
            background: var(--blood-red);
            border: 2px solid var(--content-bg);
            border-radius: 25px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 20px;
            color: var(--content-bg);
            font-weight: bold;
            transition: all 0.3s ease;
            z-index: 20;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
            animation: pulse-scroll 2s infinite;
        }

        @keyframes pulse-scroll {
            0%, 100% {
                box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
                transform: translateX(-50%) scale(1);
            }
            50% {
                box-shadow: 0 4px 24px rgba(139, 0, 0, 0.6);
                transform: translateX(-50%) scale(1.05);
            }
        }

        .mindmap-scroll-indicator:hover {
            background: var(--blood-red-highlight);
            color: var(--content-bg);
            transform: translateX(-50%) scale(1.15);
            box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
            animation: none;
        }

        .mindmap-scroll-up {
            top: 80px;
        }

        .mindmap-scroll-down {
            bottom: 20px;
        }

        .mindmap-scroll-indicator.hidden {
            opacity: 0;
            pointer-events: none;
        }

        /* Dark mode styles for scroll indicators */
        [data-theme="dark"] .mindmap-scroll-indicator {
            border-color: #e8a84d;
            color: #e8a84d;
            box-shadow: 0 4px 16px rgba(232, 168, 77, 0.3), 0 0 20px rgba(232, 168, 77, 0.2);
        }

        @keyframes pulse-scroll-dark {
            0%, 100% {
                box-shadow: 0 4px 16px rgba(232, 168, 77, 0.3), 0 0 20px rgba(232, 168, 77, 0.2);
                transform: translateX(-50%) scale(1);
            }
            50% {
                box-shadow: 0 4px 24px rgba(232, 168, 77, 0.5), 0 0 30px rgba(232, 168, 77, 0.4);
                transform: translateX(-50%) scale(1.05);
            }
        }

        [data-theme="dark"] .mindmap-scroll-indicator {
            animation: pulse-scroll-dark 2s infinite;
        }

        [data-theme="dark"] .mindmap-scroll-indicator:hover {
            border-color: #d2933e;
            color: #d2933e;
            box-shadow: 0 6px 24px rgba(232, 168, 77, 0.6), 0 0 40px rgba(232, 168, 77, 0.5);
        }
        
        .mindmap-modal-close {
            position: absolute;
            top: 1rem;
            right: 1rem;
            background: var(--blood-red);
            border: 2px solid var(--blood-red-dark);
            border-radius: 50%;
            width: 35px;
            height: 35px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
            cursor: pointer;
            color: #ffffff;
            z-index: 30;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
            transition: all 0.2s ease;
        }

        .mindmap-modal-close:hover {
            background: var(--blood-red-dark);
            border-color: var(--blood-red-highlight);
            color: #ffffff;
            transform: scale(1.1);
            box-shadow: 0 4px 12px rgba(139, 0, 0, 0.4);
        }
        
        @media (max-width: 768px) {
            .mindmap-container {
                padding: 1rem;
            }
            
            #mindmap-svg-container {
                height: 600px !important;
            }
            
            .mindmap-controls {
                text-align: center;
            }
            
            .mindmap-controls .flex {
                flex-direction: column;
                gap: 0.5rem;
            }
        }

        /* References Tab Styles */
        .reference-card {
            display: block;
            margin-bottom: 0.5rem;
            padding: 0.6rem 1rem;
            background: rgba(245, 158, 11, 0.08);
            border-radius: 8px;
            border: 2px solid rgba(245, 158, 11, 0.3);
            border-left: 4px solid var(--citation-highlight);
            text-decoration: none;
            cursor: pointer;
            transition: all 0.25s ease;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
            overflow: hidden;
        }

        .reference-card:hover {
            background: rgba(245, 158, 11, 0.18);
            border-color: var(--citation-highlight);
            border-width: 3px;
            border-left-width: 6px;
            box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4), 0 0 30px rgba(245, 158, 11, 0.2);
            transform: translateY(-3px) scale(1.01);
            padding: 0.75rem 1rem;
        }

        .reference-badge {
            display: inline-block;
            background: var(--citation-highlight);
            color: #000;
            font-weight: 700;
            font-size: 0.7rem;
            padding: 0.15rem 0.4rem;
            border-radius: 3px;
            margin-right: 0.5rem;
            vertical-align: middle;
        }

        .reference-title {
            font-weight: 600;
            color: var(--primary-color);
            font-size: 0.9rem;
            vertical-align: middle;
        }

        .reference-title-row {
            margin-bottom: 0;
        }

        .reference-card:hover .reference-title-row {
            margin-bottom: 0.4rem;
        }

        .reference-description {
            color: var(--text-secondary);
            font-size: 0.8rem;
            line-height: 1.4;
            margin-bottom: 0.35rem;
            padding-left: 1.5rem;
            max-height: 0;
            opacity: 0;
            transition: all 0.25s ease;
            overflow: hidden;
        }

        .reference-card:hover .reference-description {
            max-height: 200px;
            opacity: 1;
            margin-top: 0.4rem;
        }

        .reference-url {
            color: var(--citation-highlight);
            font-size: 0.75rem;
            display: flex;
            align-items: center;
            gap: 0.3rem;
            padding-left: 1.5rem;
            max-height: 0;
            opacity: 0;
            transition: all 0.25s ease;
            overflow: hidden;
        }

        .reference-card:hover .reference-url {
            max-height: 50px;
            opacity: 0.95;
        }

        .reference-url span {
            font-family: monospace;
            font-size: 0.7rem;
        }

        /* Modal Reference Items (collapsible like main references) */
        .modal-reference-item {
            display: block;
            margin-bottom: 0.5rem;
            padding: 0.6rem 1rem;
            background: rgba(245, 158, 11, 0.08);
            border-radius: 8px;
            border: 2px solid rgba(245, 158, 11, 0.3);
            border-left: 4px solid var(--citation-highlight);
            text-decoration: none;
            cursor: pointer;
            transition: all 0.25s ease;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
            overflow: hidden;
        }

        .modal-reference-item:hover {
            background: rgba(245, 158, 11, 0.18);
            border-color: var(--citation-highlight);
            border-width: 3px;
            border-left-width: 6px;
            box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4), 0 0 30px rgba(245, 158, 11, 0.2);
            transform: translateY(-3px) scale(1.01);
            padding: 0.75rem 1rem;
        }

        .modal-ref-title-row {
            margin-bottom: 0;
        }

        .modal-reference-item:hover .modal-ref-title-row {
            margin-bottom: 0.4rem;
        }

        .modal-ref-badge {
            display: inline-block;
            font-weight: 700;
            font-size: 0.7rem;
            padding: 0.15rem 0.4rem;
            border-radius: 3px;
            margin-right: 0.5rem;
            vertical-align: middle;
        }

        /* Ensure good contrast in light mode */
        :root .modal-ref-badge {
            background: #b96727;
            color: #ffffff;
        }

        /* Dark mode styling */
        [data-theme="dark"] .modal-ref-badge {
            background: #e8a84d;
            color: #0d0805;
        }

        .modal-ref-title {
            font-weight: 600;
            color: var(--primary-color);
            font-size: 0.9rem;
            vertical-align: middle;
            text-decoration: none;
        }

        .modal-ref-title:hover {
            text-decoration: underline;
        }

        .modal-ref-description {
            color: var(--text-secondary);
            font-size: 0.8rem;
            line-height: 1.4;
            margin-bottom: 0.35rem;
            padding-left: 1.5rem;
            max-height: 0;
            opacity: 0;
            transition: all 0.25s ease;
            overflow: hidden;
        }

        .modal-reference-item:hover .modal-ref-description {
            max-height: 200px;
            opacity: 1;
            margin-top: 0.4rem;
        }

        .modal-ref-url {
            color: var(--citation-highlight);
            font-size: 0.75rem;
            display: flex;
            align-items: center;
            gap: 0.3rem;
            padding-left: 1.5rem;
            max-height: 0;
            opacity: 0;
            transition: all 0.25s ease;
            overflow: hidden;
        }

        .modal-reference-item:hover .modal-ref-url {
            max-height: 50px;
            opacity: 0.95;
        }

        .modal-ref-url span {
            font-family: monospace;
            font-size: 0.7rem;
        }

