{"id":190,"date":"2025-06-24T15:49:05","date_gmt":"2025-06-24T15:49:05","guid":{"rendered":"https:\/\/buscomunicacion.com\/?p=190"},"modified":"2025-07-06T11:45:34","modified_gmt":"2025-07-06T11:45:34","slug":"190","status":"publish","type":"post","link":"https:\/\/buscomunicacion.com\/index.php\/2025\/06\/24\/190\/","title":{"rendered":"Derbi de Medios: El Pique Digital."},"content":{"rendered":"\n<ul class=\"wp-block-list\">\n<li><\/li>\n<\/ul>\n\n\n\n<!DOCTYPE html>\n<html lang=\"es\" class=\"scroll-smooth\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>Derbi de Medios: Sevilla vs Betis &#8211; An\u00e1lisis Estrat\u00e9gico<\/title>\n    <script src=\"https:\/\/cdn.tailwindcss.com\"><\/script>\n    <script src=\"https:\/\/cdn.jsdelivr.net\/npm\/chart.js\"><\/script>\n    <link rel=\"preconnect\" href=\"https:\/\/fonts.googleapis.com\">\n    <link rel=\"preconnect\" href=\"https:\/\/fonts.gstatic.com\" crossorigin>\n    <link href=\"https:\/\/fonts.googleapis.com\/css2?family=Inter:wght@400;500;600;700&#038;display=swap\" rel=\"stylesheet\">\n    <link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/font-awesome\/6.0.0-beta3\/css\/all.min.css\">\n    \n    <!-- Chosen Palette: Dynamic (Sevilla Red\/White vs. Betis Green\/White) -->\n    <!-- Application Structure Plan: SPA tipo dashboard comparativo con selector de club. La navegaci\u00f3n superior es fija. Una nueva secci\u00f3n introductoria explica la finalidad de la aplicaci\u00f3n. La estructura es id\u00e9ntica para ambos clubes (KPIs, Deportivo, Financiero, Gobernanza, Prensa\/Afici\u00f3n, Riesgos\/Futuro). Esto permite una comparaci\u00f3n directa de todos los datos. La arquitectura facilita la s\u00edntesis de informaci\u00f3n compleja y el benchmarking intuitivo entre el Sevilla FC y el Real Betis. -->\n    <!-- Visualization & Content Choices: \n        - KPIs -> Informar -> Tarjetas HTML, Gauge Chart (Canvas) -> Muestran m\u00e9tricas clave de un vistazo y el riesgo reputacional.\n        - Rendimiento Liga -> Comparar -> Bar Chart (Chart.js) -> Visualiza puntos por temporada para ambos clubes.\n        - Entrenadores -> Desglosar -> Stacked Horizontal Bar Chart (Chart.js) y Gr\u00e1ficos de Donut de detalle (Chart.js) -> Muestra % V\/E\/D totales y luego por casa\/fuera para el entrenador seleccionado.\n        - Jugadores -> Informar -> Tablas y Listas HTML -> Estad\u00edsticas de tarjetas\/MVPs, jugadores clave y menos minutos.\n        - Traspasos -> Comparar -> Bar Chart (Chart.js) -> Visualiza el balance neto econ\u00f3mico por temporada.\n        - Finanzas -> Mostrar Cambio\/Comparar -> Line Chart y Doughnut Chart (Chart.js) -> Filtro por a\u00f1o para mostrar ingresos\/gastos y fuentes.\n        - Gobernanza -> Informar -> Listas HTML, Bar Chart (Chart.js) -> Detalla figuras clave, cr\u00edticas y el impacto en la reputaci\u00f3n.\n        - La Liga de los Presidentes -> Comparar -> Bar Chart (Chart.js) -> Compara Sentimiento Positivo\/Negativo por a\u00f1o de los presidentes. Se a\u00f1ade una tabla para el total de apariciones.\n        - La Liga de las Aficiones -> Comparar -> L\u00edneas\/Barras (Chart.js) -> Compara crecimiento en redes, asistencia, sentimiento y lealtad a trav\u00e9s de los a\u00f1os.\n        - Prensa y Judicial -> Informar\/Organizar -> Tarjetas HTML, Listas HTML -> Art\u00edculos cr\u00edticos, calendario judicial, ecos redes sociales, declaraciones.\n        - Escenarios Futuro -> Organizar -> Acorde\u00f3n HTML\/JS -> Proyecciones y recomendaciones accionables.\n        - Ranking Goleadores -> Comparar -> Tabla HTML -> Ranking combinado de goleadores de ambos equipos para la temporada actual.\n        - Justificaci\u00f3n: Las visualizaciones buscan facilitar la comparaci\u00f3n directa entre clubes, haciendo los datos complejos accesibles y atractivos. La interactividad fomenta una exploraci\u00f3n activa y permite al usuario profundizar en la informaci\u00f3n relevante. -->\n    <!-- CONFIRMATION: NO SVG graphics used. NO Mermaid JS used. -->\n\n    <style>\n        html, body {\n            overflow-x: hidden; \/* Prevent horizontal scrolling *\/\n        }\n        body {\n            font-family: 'Inter', sans-serif;\n            background-color: #f9fafb; \/* Lighter Gray *\/\n            color: #1f2937; \/* Darker Gray for text *\/\n        }\n        .nav-link {\n            transition: color 0.3s, border-color 0.3s;\n            border-bottom: 2px solid transparent;\n        }\n        .nav-link:hover {\n            color: var(--primary-color);\n            border-bottom-color: var(--primary-color);\n        }\n        .nav-link.active {\n            color: var(--primary-color);\n            border-bottom-color: var(--primary-color);\n        }\n        .kpi-card {\n            background-color: #ffffff;\n            border: 1px solid #e5e7eb; \/* Gray 200 *\/\n            transition: transform 0.3s, box-shadow 0.3s;\n        }\n        .kpi-card:hover {\n            transform: translateY(-5px);\n            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.05);\n        }\n        .chart-container {\n            position: relative;\n            width: 100%;\n            max-width: 800px;\n            margin-left: auto;\n            margin-right: auto;\n            height: 350px;\n            max-height: 40vh;\n        }\n        @media (min-width: 768px) {\n            .chart-container {\n                height: 400px;\n            }\n        }\n        .filter-btn {\n            transition: background-color 0.3s, color 0.3s, border-color 0.3s;\n            border: 1px solid var(--primary-color);\n            background-color: #ffffff;\n            color: var(--primary-color);\n        }\n        .filter-btn:hover {\n            background-color: var(--primary-light-color);\n        }\n        .filter-btn.active {\n            background-color: var(--primary-color);\n            color: white;\n            border-color: var(--primary-color);\n        }\n        .accordion-content {\n            max-height: 0;\n            overflow: hidden;\n            transition: max-height 0.5s ease-in-out;\n        }\n        .summary-loss {\n            background-color: #fee2e2; \/* Red 100 *\/\n            border-color: #ef4444; \/* Red 500 *\/\n            color: #b91c1c; \/* Red 700 *\/\n        }\n        .summary-profit {\n            background-color: #dcfce7; \/* Green 100 *\/\n            border-color: #22c55e; \/* Green 500 *\/\n            color: #16a34a; \/* Green 700 *\/\n        }\n        .coach-selectable-item {\n            cursor: pointer;\n            padding: 8px 12px;\n            border-radius: 8px;\n            transition: background-color 0.2s, color 0.2s;\n        }\n        .coach-selectable-item:hover {\n            background-color: var(--primary-light-color);\n        }\n        .coach-selectable-item.active {\n            background-color: var(--primary-color);\n            color: white;\n        }\n        .primary-text-color { color: var(--primary-color); }\n        .primary-border-color { border-color: var(--primary-color); }\n        .primary-bg-color { background-color: var(--primary-color); }\n        .primary-light-bg-color { background-color: var(--primary-light-color); }\n        .primary-bg-border {\n            background-color: var(--primary-light-color);\n            border: 1px solid var(--primary-color);\n        }\n        \/* Club selector button styling *\/\n        .club-select-btn {\n            padding: 8px 16px;\n            border-radius: 8px;\n            font-weight: 600;\n            transition: all 0.2s ease-in-out;\n            display: flex;\n            flex-direction: column;\n            align-items: center;\n            border: 2px solid transparent;\n        }\n        .club-select-btn img {\n            width: 50px;\n            height: 50px;\n            margin-bottom: 4px;\n        }\n        .club-select-btn.active {\n            background-color: var(--primary-color);\n            color: white;\n            border-color: var(--primary-color);\n            box-shadow: 0 4px 8px rgba(0,0,0,0.2);\n        }\n        .club-select-btn.inactive {\n            background-color: white;\n            color: var(--primary-color);\n            border-color: var(--primary-color);\n            box-shadow: 0 1px 3px rgba(0,0,0,0.1);\n        }\n        .club-select-btn:hover:not(.active) {\n            background-color: var(--primary-light-color);\n            color: var(--primary-color);\n        }\n        .compare-rival-btn {\n            background-color: var(--primary-color);\n            color: white;\n            padding: 8px 16px;\n            border-radius: 8px;\n            font-weight: 600;\n            transition: opacity 0.2s;\n            margin-top: 10px; \/* Add some space from the h2 *\/\n        }\n        .compare-rival-btn:hover {\n            opacity: 0.9;\n        }\n        @media (min-width: 768px) {\n            .compare-rival-btn {\n                margin-top: 0; \/* Reset margin on larger screens *\/\n                margin-left: 16px; \/* Add left margin next to h2 *\/\n            }\n        }\n    <\/style>\n<\/head>\n<body class=\"antialiased\">\n\n    <header class=\"bg-white\/80 backdrop-blur-lg sticky top-0 z-50 shadow-sm border-b border-gray-200\">\n        <nav class=\"container mx-auto px-4 sm:px-6 lg:px-8\">\n            <div class=\"flex flex-col md:flex-row items-center justify-center h-24 md:h-16\">\n                <div class=\"flex-shrink-0 mb-4 md:mb-0 md:mr-auto md:w-auto w-full text-center md:text-left\">\n                    <h1 class=\"text-xl font-bold text-gray-900\">Diagn\u00f3stico Comparativo<\/h1>\n                <\/div>\n                <div class=\"flex items-center justify-center space-x-4 w-full md:w-auto\">\n                    <button id=\"select-sevilla\" class=\"club-select-btn\" data-club=\"sevilla\">\n                        <img decoding=\"async\" src=\"uploaded:descarga (3).jpeg-2160ee96-8815-468f-9e52-8ddfc6165c62\" alt=\"Escudo Sevilla FC\" class=\"mb-1\" onerror=\"this.onerror=null;this.src='https:\/\/placehold.co\/50x50\/D32F2F\/FFFFFF?text=SFC';\">\n                        Sevilla FC\n                    <\/button>\n                    <button id=\"select-betis\" class=\"club-select-btn\" data-club=\"betis\">\n                        <img decoding=\"async\" src=\"uploaded:descarga (2).jpeg-a23b6190-1cac-4562-ab9f-642d5a8d0970\" alt=\"Escudo Real Betis\" class=\"mb-1\" onerror=\"this.onerror=null;this.src='https:\/\/placehold.co\/50x50\/22C55E\/FFFFFF?text=RBB';\">\n                        Real Betis\n                    <\/button>\n                <\/div>\n            <\/div>\n            <!-- Nuevo men\u00fa de navegaci\u00f3n superior -->\n            <div class=\"mt-4 hidden md:flex justify-center space-x-6 text-sm font-medium\">\n                <a href=\"#introduccion\" class=\"nav-link px-3 py-2 rounded-md text-gray-600\">Inicio<\/a>\n                <a href=\"#vision-general\" class=\"nav-link px-3 py-2 rounded-md text-gray-600\">Estado Actual<\/a>\n                <a href=\"#deportivo\" class=\"nav-link px-3 py-2 rounded-md text-gray-600\">Deportivo<\/a>\n                <a href=\"#financiero\" class=\"nav-link px-3 py-2 rounded-md text-gray-600\">Financiero<\/a>\n                <a href=\"#gobernanza\" class=\"nav-link px-3 py-2 rounded-md text-gray-600\">Gobernanza<\/a>\n                <a href=\"#president-league\" class=\"nav-link px-3 py-2 rounded-md text-gray-600\">Presidentes<\/a>\n                <a href=\"#fan-league\" class=\"nav-link px-3 py-2 rounded-md text-gray-600\">Aficiones<\/a>\n                <a href=\"#top-scorers-derby\" class=\"nav-link px-3 py-2 rounded-md text-gray-600\">Goleadores<\/a>\n                <a href=\"#prensa-aficion\" class=\"nav-link px-3 py-2 rounded-md text-gray-600\">Prensa &#038; Judicial<\/a>\n                <a href=\"#riesgos-futuro\" class=\"nav-link px-3 py-2 rounded-md text-gray-600\">Riesgos &#038; Futuro<\/a>\n            <\/div>\n             <!-- Men\u00fa desplegable para m\u00f3viles -->\n            <div class=\"mt-4 md:hidden w-full\">\n                <select id=\"mobile-nav-select\" class=\"block w-full px-3 py-2 text-base border border-gray-300 focus:outline-none focus:ring-primary-color focus:border-primary-color sm:text-sm rounded-md\">\n                    <option value=\"#introduccion\">Inicio<\/option>\n                    <option value=\"#vision-general\">Estado Actual<\/option>\n                    <option value=\"#deportivo\">An\u00e1lisis Deportivo<\/option>\n                    <option value=\"#financiero\">An\u00e1lisis Financiero<\/option>\n                    <option value=\"#gobernanza\">Gobernanza<\/option>\n                    <option value=\"#president-league\">Presidentes<\/option>\n                    <option value=\"#fan-league\">Aficiones<\/option>\n                    <option value=\"#top-scorers-derby\">Goleadores<\/option>\n                    <option value=\"#prensa-aficion\">Prensa &#038; Judicial<\/option>\n                    <option value=\"#riesgos-futuro\">Riesgos &#038; Futuro<\/option>\n                <\/select>\n            <\/div>\n        <\/nav>\n    <\/header>\n\n    <main class=\"container mx-auto px-4 sm:px-6 lg:px-8 py-8 md:py-12\">\n        <section id=\"introduccion\" class=\"mb-16 text-center\">\n            <h2 class=\"text-4xl font-extrabold text-gray-900 sm:text-5xl mb-6\">El Derbi se Juega con Datos<\/h2>\n            <p class=\"mt-4 text-xl leading-8 text-gray-700 max-w-3xl mx-auto\">\n                Bienvenido a este an\u00e1lisis estrat\u00e9gico comparativo. Aqu\u00ed podr\u00e1s sumergirte en las estad\u00edsticas y narrativas clave del **Sevilla FC** y el **Real Betis**, examinando su rendimiento deportivo, salud financiera, gobernanza y el impacto en la afici\u00f3n.\n            <\/p>\n            <p class=\"mt-4 text-lg leading-8 text-gray-600 max-w-3xl mx-auto\">\n                <strong class=\"text-red-700\"> Consejo para m\u00f3viles:<\/strong> Para una mejor visualizaci\u00f3n de las estad\u00edsticas y los gr\u00e1ficos, te recomendamos girar tu dispositivo a **modo apaisado (horizontal)**. \u00a1Disfruta de la experiencia!\n            <\/p>\n        <\/section>\n\n        <section id=\"vision-general\" class=\"mb-16 scroll-mt-24\">\n            <div class=\"text-center mb-12\">\n                <div class=\"flex flex-col items-center md:flex-row md:justify-center md:space-x-4\">\n                    <h2 id=\"vision-general-title\" class=\"text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl mb-4 md:mb-0\">Estado Actual del Club<\/h2>\n                    <button class=\"compare-rival-btn text-sm font-semibold px-4 py-2 rounded-lg\" data-section-id=\"vision-general\"><\/button>\n                <\/div>\n                <p class=\"mt-4 max-w-2xl mx-auto text-lg leading-8 text-gray-600\" id=\"club-intro-text\">Explore la situaci\u00f3n actual de [Club Name]: un an\u00e1lisis detallado de sus indicadores clave, rendimiento deportivo, salud financiera, gobernanza y su impacto en la prensa y afici\u00f3n.<\/p>\n            <\/div>\n            <div class=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6\">\n                <div class=\"kpi-card p-6 rounded-xl text-center\">\n                    <h3 class=\"text-gray-500 font-medium\">Posici\u00f3n en La Liga 24\/25<\/h3>\n                    <p class=\"mt-2 text-4xl font-bold primary-text-color\" id=\"kpi-position\">&#8212;<\/p>\n                    <p class=\"text-sm text-gray-500\" id=\"kpi-position-subtext\">Cargando&#8230;<\/p>\n                <\/div>\n                <div class=\"kpi-card p-6 rounded-xl text-center\">\n                    <h3 class=\"text-gray-500 font-medium\">Resultado Neto 23\/24<\/h3>\n                    <p class=\"mt-2 text-4xl font-bold primary-text-color\" id=\"kpi-loss\">&#8212;<\/p>\n                    <p class=\"text-sm text-gray-500\" id=\"kpi-loss-subtext\">Cargando&#8230;<\/p>\n                <\/div>\n                <div class=\"kpi-card p-6 rounded-xl text-center\">\n                    <h3 class=\"text-gray-500 font-medium\">Conflicto Directivo<\/h3>\n                    <p class=\"mt-2 text-4xl font-bold primary-text-color\" id=\"kpi-conflict\">&#8212;<\/p>\n                    <p class=\"text-sm text-gray-500\" id=\"kpi-conflict-subtext\">Cargando&#8230;<\/p>\n                <\/div>\n                <div class=\"kpi-card p-6 rounded-xl text-center\">\n                    <h3 class=\"text-gray-500 font-medium\">Riesgo Reputacional<\/h3>\n                    <div id=\"risk-gauge\" class=\"relative w-48 h-24 mx-auto mt-2\">\n                        <div class=\"absolute top-0 left-0 w-full h-full\">\n                            <canvas id=\"gauge-canvas\"><\/canvas>\n                        <\/div>\n                        <div id=\"risk-value\" class=\"absolute bottom-0 w-full text-center text-3xl font-bold\"><\/div>\n                    <\/div>\n                    <p class=\"text-sm text-gray-500 mt-1\">\u00cdndice estimado (IRR)<\/p>\n                <\/div>\n            <\/div>\n        <\/section>\n\n        <section id=\"deportivo\" class=\"mb-16 scroll-mt-24\">\n            <div class=\"text-center mb-12\">\n                <div class=\"flex flex-col items-center md:flex-row md:justify-center md:space-x-4\">\n                    <h2 id=\"deportivo-title\" class=\"text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl mb-4 md:mb-0\">An\u00e1lisis Deportivo<\/h2>\n                    <button class=\"compare-rival-btn text-sm font-semibold px-4 py-2 rounded-lg\" data-section-id=\"deportivo\"><\/button>\n                <\/div>\n                <p class=\"mt-4 max-w-3xl mx-auto text-lg leading-8 text-gray-600\">El rendimiento en el campo es clave. Explore la evoluci\u00f3n en Liga, la gesti\u00f3n de entrenadores y el impacto de los jugadores.<\/p>\n            <\/div>\n            <div class=\"space-y-8\">\n                <div class=\"bg-white p-6 rounded-xl border border-gray-200 shadow-sm\">\n                    <h3 class=\"text-xl font-semibold mb-1 text-gray-800\">Puntos en La Liga por Temporada<\/h3>\n                    <p class=\"text-gray-600 text-sm mb-4\">La acumulaci\u00f3n de puntos refleja la trayectoria competitiva en las \u00faltimas temporadas.<\/p>\n                    <div class=\"chart-container\">\n                        <canvas id=\"performanceChart\"><\/canvas>\n                    <\/div>\n                <\/div>\n\n                <div class=\"bg-white p-6 rounded-xl border border-gray-200 shadow-sm\">\n                    <h3 class=\"text-xl font-semibold mb-1 text-gray-800\">Rendimiento de Entrenadores: Historial y Detalles<\/h3>\n                    <p class=\"text-gray-600 text-sm mb-4\">La alta rotaci\u00f3n ha impedido la consolidaci\u00f3n de un proyecto. El gr\u00e1fico muestra los porcentajes de victorias, empates y derrotas. Haz clic en un entrenador para ver sus estad\u00edsticas detalladas. (Nota: El coste del contrato de un entrenador no se detalla p\u00fablicamente como los traspasos de jugadores).<\/p>\n                    <div class=\"chart-container h-80\">\n                        <canvas id=\"coachPerformanceChart\"><\/canvas>\n                    <\/div>\n                    <div id=\"coach-list-selection\" class=\"flex flex-wrap gap-2 justify-center mt-4\"><\/div>\n                    <div id=\"coach-detail-stats\" class=\"mt-6 p-4 primary-light-bg-color rounded-lg primary-border-color\" style=\"display: none;\">\n                        <h4 class=\"font-bold text-lg text-gray-800 mb-2\" id=\"coach-detail-name\"><\/h4>\n                        <p class=\"text-sm text-gray-600 mb-4\" id=\"coach-detail-period\"><\/p>\n                        <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n                            <div class=\"chart-container h-48\">\n                                <canvas id=\"coachHomeStatsChart\"><\/canvas>\n                            <\/div>\n                            <div class=\"chart-container h-48\">\n                                <canvas id=\"coachAwayStatsChart\"><\/canvas>\n                            <\/div>\n                        <\/div>\n                    <\/div>\n                    <div class=\"mt-6\">\n                        <h4 class=\"font-bold text-lg text-gray-800 mb-2\">Ranking de Rendimiento Global (Porcentaje de Victorias y Puntos)<\/h4>\n                        <ul id=\"coach-ranking-list\" class=\"space-y-1 text-sm text-gray-700\"><\/ul>\n                    <\/div>\n                <\/div>\n\n                <div class=\"grid grid-cols-1 lg:grid-cols-2 gap-8\">\n                    <div class=\"bg-white p-6 rounded-xl border border-gray-200 shadow-sm\">\n                        <h3 class=\"text-xl font-semibold mb-1 text-gray-800\">Jugadores Clave y su Rendimiento<\/h3>\n                        <p class=\"text-gray-600 text-sm mb-4\">Destacan los pilares ofensivos, la cantera y su valor estrat\u00e9gico.<\/p>\n                        <div id=\"key-players\" class=\"mt-4 space-y-3\"><\/div>\n                    <\/div>\n                    <div class=\"space-y-8\">\n                        <div class=\"bg-white p-6 rounded-xl border border-gray-200 shadow-sm\">\n                            <h3 class=\"text-xl font-semibold mb-1 text-gray-800\">Estad\u00edsticas Individuales de Jugadores<\/h3>\n                            <p class=\"text-gray-600 text-sm mb-4\">Resumen de tarjetas y premios individuales por temporada. (Datos ilustrativos).<\/p>\n                            <div id=\"player-stats-filters\" class=\"flex space-x-2 mb-4\"><\/div>\n                            <div class=\"overflow-x-auto\">\n                                <table class=\"min-w-full bg-white rounded-lg text-sm\">\n                                    <thead>\n                                        <tr class=\"bg-gray-100 text-gray-600 uppercase text-left\">\n                                            <th class=\"py-2 px-4\">Jugador<\/th>\n                                            <th class=\"py-2 px-4\">Amarillas<\/th>\n                                            <th class=\"py-2 px-4\">Rojas<\/th>\n                                            <th class=\"py-2 px-4\">MVPs<\/th>\n                                        <\/tr>\n                                    <\/thead>\n                                    <tbody id=\"player-stats-table\">\n                                        \n                                    <\/tbody>\n                                <\/table>\n                            <\/div>\n                        <\/div>\n                        <div class=\"bg-white p-6 rounded-xl border border-gray-200 shadow-sm\">\n                            <h3 class=\"text-xl font-semibold mb-1 text-gray-800\">Jugadores con Menos Minutos (2024\/2025)<\/h3>\n                            <p class=\"text-gray-600 text-sm mb-4\">Jugadores con participaci\u00f3n limitada. (Nota: Porteros no incluidos).<\/p>\n                            <div id=\"least-played-players\" class=\"mt-4 space-y-2\"><\/div>\n                        <\/div>\n                    <\/div>\n                <\/div>\n            <\/div>\n        <\/section>\n\n        <section id=\"financiero\" class=\"mb-16 scroll-mt-24\">\n            <div class=\"text-center mb-12\">\n                <div class=\"flex flex-col items-center md:flex-row md:justify-center md:space-x-4\">\n                    <h2 id=\"financiero-title\" class=\"text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl mb-4 md:mb-0\">An\u00e1lisis Financiero<\/h2>\n                    <button class=\"compare-rival-btn text-sm font-semibold px-4 py-2 rounded-lg\" data-section-id=\"financiero\"><\/button>\n                <\/div>\n                <p class=\"mt-4 max-w-3xl mx-auto text-lg leading-8 text-gray-600\">La salud econ\u00f3mica del club es crucial. Analice la brecha entre ingresos y gastos, y la dependencia de la venta de jugadores.<\/p>\n            <\/div>\n            <div class=\"bg-white p-6 rounded-xl border border-gray-200 shadow-sm\">\n                <div class=\"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-4\">\n                    <div>\n                        <h3 class=\"text-xl font-semibold text-gray-800\">Resultados Econ\u00f3micos<\/h3>\n                        <p class=\"text-gray-600 text-sm mt-1\">Seleccione un a\u00f1o fiscal para explorar los datos.<\/p>\n                    <\/div>\n                    <div id=\"financial-filters\" class=\"flex space-x-2 mt-4 sm:mt-0\"><\/div>\n                <\/div>\n                <div class=\"grid grid-cols-1 lg:grid-cols-5 gap-8 mt-6\">\n                    <div class=\"lg:col-span-3\">\n                        <div class=\"chart-container\">\n                            <canvas id=\"financialsChart\"><\/canvas>\n                        <\/div>\n                    <\/div>\n                    <div class=\"lg:col-span-2\">\n                        <div class=\"chart-container\">\n                            <canvas id=\"incomeSourceChart\"><\/canvas>\n                        <\/div>\n                    <\/div>\n                <\/div>\n                <div id=\"financial-summary\" class=\"mt-8 p-4 rounded-lg border\"><\/div>\n\n                <h3 class=\"text-xl font-semibold mb-4 text-gray-800 mt-12\">Impacto Econ\u00f3mico de los Traspasos: Balance Neto por Temporada<\/h3>\n                <p class=\"text-gray-600 text-sm mb-4\">El club depende de la venta de jugadores para generar liquidez. Visualice el balance neto de los traspasos por temporada. (Nota: Las ganancias o p\u00e9rdidas individuales por contrato de cada jugador no son p\u00fablicas).<\/p>\n                <div class=\"chart-container h-80\">\n                    <canvas id=\"transferBalanceChart\"><\/canvas>\n                <\/div>\n                <div id=\"transfer-details-text\" class=\"space-y-6 mt-8\"><\/div>\n            <\/div>\n        <\/section>\n\n        <section id=\"gobernanza\" class=\"mb-16 scroll-mt-24\">\n            <div class=\"text-center mb-12\">\n                <div class=\"flex flex-col items-center md:flex-row md:justify-center md:space-x-4\">\n                    <h2 id=\"gobernanza-title\" class=\"text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl mb-4 md:mb-0\">Gobernanza y Conflicto Interno<\/h2>\n                    <button class=\"compare-rival-btn text-sm font-semibold px-4 py-2 rounded-lg\" data-section-id=\"gobernanza\"><\/button>\n                <\/div>\n                <p class=\"mt-4 max-w-3xl mx-auto text-lg leading-8 text-gray-600\">Explore la estructura directiva y c\u00f3mo los conflictos internos afectan al club.<\/p>\n            <\/div>\n            <div class=\"bg-white p-6 rounded-xl border border-gray-200 shadow-sm\">\n                <div class=\"grid grid-cols-1 md:grid-cols-2 gap-8\">\n                    <div>\n                        <h3 class=\"text-xl font-semibold mb-2 text-gray-800\" id=\"governance-title-main\"><\/h3>\n                        <p class=\"text-gray-600 mb-4\" id=\"governance-intro-text\">La inestabilidad se ha exacerbado por la disputa legal y medi\u00e1tica entre figuras clave, generando una imagen de desuni\u00f3n.<\/p>\n                        <div id=\"governance-key-figures\" class=\"space-y-4\"><\/div>\n                        <h3 class=\"text-xl font-semibold mb-2 text-gray-800 mt-8\">Impacto en la Reputaci\u00f3n (Percepci\u00f3n P\u00fablica)<\/h3>\n                        <p class=\"text-gray-600 text-sm mb-4\">El conflicto se refleja en la percepci\u00f3n p\u00fablica del club, afectando su reputaci\u00f3n.<\/p>\n                        <div class=\"chart-container h-64\">\n                            <canvas id=\"reputationChart\"><\/canvas>\n                        <\/div>\n                    <\/div>\n                    <div>\n                        <h3 class=\"text-xl font-semibold mb-2 text-gray-800\">Cr\u00edticas Clave a la Gesti\u00f3n<\/h3>\n                        <p class=\"text-gray-600 mb-4\">Las decisiones directivas han sido objeto de duras cr\u00edticas.<\/p>\n                        <ul id=\"management-critics\" class=\"space-y-3 list-inside\"><\/ul>\n                    <\/div>\n                <\/div>\n            <\/div>\n        <\/section>\n\n        <section id=\"president-league\" class=\"mb-16 scroll-mt-24\">\n            <div class=\"text-center mb-12\">\n                <div class=\"flex flex-col items-center md:flex-row md:justify-center md:space-x-4\">\n                    <h2 id=\"president-league-title\" class=\"text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl mb-4 md:mb-0\">La Liga de los Presidentes: \u00bfQui\u00e9n Gana en Imagen P\u00fablica?<\/h2>\n                    <button class=\"compare-rival-btn text-sm font-semibold px-4 py-2 rounded-lg\" data-section-id=\"president-league\"><\/button>\n                <\/div>\n                <p class=\"mt-4 max-w-3xl mx-auto text-lg leading-8 text-gray-600\">Un an\u00e1lisis comparativo de la percepci\u00f3n p\u00fablica, el sentimiento en redes y la proyecci\u00f3n social de los presidentes de Sevilla FC y Real Betis. \u00a1Descubre qui\u00e9n lidera en la \u00abinteligencia de medios\u00bb fuera del c\u00e9sped!<\/p>\n            <\/div>\n            <div class=\"bg-white p-6 rounded-xl border border-gray-200 shadow-sm\">\n                <div id=\"president-year-filters\" class=\"flex flex-col md:flex-row items-center justify-center space-y-4 md:space-y-0 md:space-x-4 mb-6\">\n                    \n                <\/div>\n                <h3 class=\"text-xl font-semibold mb-1 text-gray-800 text-center\">Sentimiento en Redes (Positivo vs. Negativo por A\u00f1o)<\/h3>\n                <p class=\"text-gray-600 text-sm mb-4 text-center\">Compara el porcentaje de menciones positivas y negativas de los presidentes por temporada. (Datos ilustrativos)<\/p>\n                <div class=\"chart-container h-64\">\n                    <canvas id=\"presidentSentimentChart\"><\/canvas>\n                <\/div>\n                <div class=\"mt-8\">\n                    <h4 class=\"font-bold text-lg text-gray-800 mb-2 text-center\">Total de Menciones Anuales en Redes<\/h4>\n                    <div class=\"overflow-x-auto\">\n                        <table class=\"min-w-full bg-white rounded-lg text-sm\">\n                            <thead>\n                                <tr class=\"bg-gray-100 text-gray-600 uppercase text-left\">\n                                    <th class=\"py-2 px-4\">Presidente<\/th>\n                                    \n                                <\/tr>\n                            <\/thead>\n                            <tbody id=\"president-mentions-table-body\">\n                                \n                            <\/tbody>\n                        <\/table>\n                    <\/div>\n                <\/div>\n            <\/div>\n        <\/section>\n\n        <section id=\"fan-league\" class=\"mb-16 scroll-mt-24\">\n            <div class=\"text-center mb-12\">\n                <div class=\"flex flex-col items-center md:flex-row md:justify-center md:space-x-4\">\n                    <h2 id=\"fan-league-title\" class=\"text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl mb-4 md:mb-0\">La Liga de las Aficiones: \u00bfQui\u00e9n Domina en las Gradas y en las Redes?<\/h2>\n                    <button class=\"compare-rival-btn text-sm font-semibold px-4 py-2 rounded-lg\" data-section-id=\"fan-league\"><\/button>\n                <\/div>\n                <p class=\"mt-4 max-w-3xl mx-auto text-lg leading-8 text-gray-600\">Un duelo de pasiones m\u00e1s all\u00e1 del campo. Compara la fuerza digital, la asistencia al estadio y el sentimiento de las bases de aficionados del Sevilla FC y el Real Betis. \u00a1Que gane el mejor en este derbi de engagement!<\/p>\n            <\/div>\n            <div class=\"bg-white p-6 rounded-xl border border-gray-200 shadow-sm\">\n                <div class=\"grid grid-cols-1 md:grid-cols-2 gap-8\">\n                    <div>\n                        <h3 class=\"text-xl font-semibold mb-2 text-gray-800\">Crecimiento en Redes Sociales (%)<\/h3>\n                        <div class=\"chart-container h-48\"><canvas id=\"socialGrowthChart\"><\/canvas><\/div>\n                    <\/div>\n                    <div>\n                        <h3 class=\"text-xl font-semibold mb-2 text-gray-800\">Asistencia Media al Estadio<\/h3>\n                        <div class=\"chart-container h-48\"><canvas id=\"stadiumAttendanceChart\"><\/canvas><\/div>\n                    <\/div>\n                    <div>\n                        <h3 class=\"text-xl font-semibold mb-2 text-gray-800\">Sentimiento General en Redes (1-100)<\/h3>\n                        <div class=\"chart-container h-48\"><canvas id=\"socialSentimentOverallChart\"><\/canvas><\/div>\n                    <\/div>\n                    <div>\n                        <h3 class=\"text-xl font-semibold mb-2 text-gray-800\">Puntaje de Lealtad de la Afici\u00f3n (1-100)<\/h3>\n                        <div class=\"chart-container h-48\"><canvas id=\"fanLoyaltyChart\"><\/canvas><\/div>\n                    <\/div>\n                <\/div>\n            <\/div>\n        <\/section>\n\n        <section id=\"top-scorers-derby\" class=\"mb-16 scroll-mt-24\">\n            <div class=\"text-center mb-12\">\n                <div class=\"flex flex-col items-center md:flex-row md:justify-center md:space-x-4\">\n                    <h2 id=\"top-scorers-derby-title\" class=\"text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl mb-4 md:mb-0\">Ranking de Goleadores (Temporada 2024-2025)<\/h2>\n                    <button class=\"compare-rival-btn text-sm font-semibold px-4 py-2 rounded-lg\" data-section-id=\"top-scorers-derby\"><\/button>\n                <\/div>\n                <p class=\"mt-4 max-w-3xl mx-auto text-lg leading-8 text-gray-600\">Los m\u00e1ximos artilleros del derbi: un vistazo a los jugadores con m\u00e1s goles en la temporada actual. (Datos ilustrativos)<\/p>\n            <\/div>\n            <div class=\"bg-white p-6 rounded-xl border border-gray-200 shadow-sm\">\n                <div class=\"flex flex-col sm:flex-row justify-center items-center space-y-4 sm:space-y-0 sm:space-x-4 mb-6\">\n                    <div id=\"top-scorers-club-filters\" class=\"flex space-x-2\">\n                        <!-- Club filter buttons will be populated here by JS -->\n                    <\/div>\n                    <div id=\"top-scorers-season-filters\" class=\"flex space-x-2\">\n                        <!-- Season filter buttons will be populated here by JS -->\n                    <\/div>\n                <\/div>\n                <div class=\"overflow-x-auto\">\n                    <table class=\"min-w-full bg-white rounded-lg text-sm\">\n                        <thead>\n                            <tr class=\"bg-gray-100 text-gray-600 uppercase text-left\">\n                                <th class=\"py-2 px-4\">Posici\u00f3n<\/th>\n                                <th class=\"py-2 px-4\">Jugador<\/th>\n                                <th class=\"py-2 px-4\">Club<\/th>\n                                <th class=\"py-2 px-4 text-center\">Goles<\/th>\n                            <\/tr>\n                        <\/thead>\n                        <tbody id=\"top-scorers-table\">\n                            <!-- Top scorers will be populated here by JS -->\n                        <\/tbody>\n                    <\/table>\n                <\/div>\n            <\/div>\n        <\/section>\n\n        <section id=\"prensa-aficion\" class=\"mb-16 scroll-mt-24\">\n            <div class=\"text-center mb-12\">\n                <div class=\"flex flex-col items-center md:flex-row md:justify-center md:space-x-4\">\n                    <h2 id=\"prensa-aficion-title\" class=\"text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl mb-4 md:mb-0\">Prensa, Afici\u00f3n y Batalla Judicial<\/h2>\n                    <button class=\"compare-rival-btn text-sm font-semibold px-4 py-2 rounded-lg\" data-section-id=\"prensa-aficion\"><\/button>\n                <\/div>\n                <p class=\"mt-4 max-w-3xl mx-auto text-lg leading-8 text-gray-600\">La cobertura medi\u00e1tica ha sido severa, reflejando un profundo descontento y una batalla legal que no cesa.<\/p>\n            <\/div>\n            <div class=\"grid grid-cols-1 lg:grid-cols-2 gap-8\">\n                <div>\n                    <h3 class=\"text-xl font-semibold mb-4 text-gray-800\">Art\u00edculos Cr\u00edticos Destacados<\/h3>\n                    <div id=\"press-articles\" class=\"space-y-4\"><\/div>\n\n                    <h3 class=\"text-xl font-semibold mb-4 text-gray-800 mt-8\">Ecos en Redes Sociales<\/h3>\n                    <p class=\"text-gray-600 text-sm mb-4\">Las redes sociales amplifican el descontento, con interacci\u00f3n intensa y tono emocional.<\/p>\n                    <ul id=\"social-media-echoes\" class=\"space-y-3 list-inside\"><\/ul>\n                <\/div>\n                <div>\n                    <h3 class=\"text-xl font-semibold mb-4 text-gray-800\">Calendario Judicial<\/h3>\n                    <div id=\"judicial-calendar\" class=\"space-y-4\"><\/div>\n\n                    <h3 class=\"text-xl font-semibold mb-4 text-gray-800 mt-8\">Declaraciones Impactantes<\/h3>\n                    <p class=\"text-gray-600 text-sm mb-4\">Fragmentos de declaraciones que resumen el sentir de la afici\u00f3n y la gravedad de la situaci\u00f3n.<\/p>\n                    <div id=\"impactful-quotes\" class=\"space-y-4\"><\/div>\n                <\/div>\n            <\/div>\n        <\/section>\n\n        <section id=\"riesgos-futuro\" class=\"mb-16 scroll-mt-24\">\n            <div class=\"text-center mb-12\">\n                <div class=\"flex flex-col items-center md:flex-row md:justify-center md:space-x-4\">\n                    <h2 id=\"riesgos-futuro-title\" class=\"text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl mb-4 md:mb-0\">Riesgos y Escenarios Futuros<\/h2>\n                    <button class=\"compare-rival-btn text-sm font-semibold px-4 py-2 rounded-lg\" data-section-id=\"riesgos-futuro\"><\/button>\n                <\/div>\n                <p class=\"mt-4 max-w-3xl mx-auto text-lg leading-8 text-gray-600\">El futuro del club es incierto. Depender\u00e1 de la capacidad de la directiva para abordar la crisis y tomar decisiones estrat\u00e9gicas.<\/p>\n            <\/div>\n            <div class=\"grid grid-cols-1 lg:grid-cols-2 gap-8\">\n                <div>\n                    <h3 class=\"text-xl font-semibold mb-4 text-gray-800 text-center lg:text-left\">Proyecci\u00f3n de Escenarios<\/h3>\n                    <p class=\"text-gray-600 text-sm mb-4 text-center lg:text-left\">Explore los posibles futuros seg\u00fan las decisiones que se tomen.<\/p>\n                    <div id=\"scenarios-accordion\" class=\"space-y-2\"><\/div>\n                <\/div>\n                <div>\n                    <h3 class=\"text-xl font-semibold mb-4 text-gray-800 text-center lg:text-left\">Recomendaciones Accionables<\/h3>\n                    <p class=\"text-gray-600 text-sm mb-4 text-center lg:text-left\">Acciones clave para estabilizar la situaci\u00f3n y revertir la tendencia.<\/p>\n                    <div id=\"recommendations-list\" class=\"space-y-4\"><\/div>\n                <\/div>\n            <\/div>\n        <\/section>\n\n    <\/main>\n\n<script>\ndocument.addEventListener('DOMContentLoaded', function () {\n    const clubData = {\n        sevilla: {\n            name: 'Sevilla FC',\n            primaryColor: '#D32F2F', \/* Sevilla Red *\/\n            lightColor: '#fef2f2', \/* Red 50 *\/\n            crestUrl: 'uploaded:descarga (3).jpeg-2160ee96-8815-468f-9e52-8ddfc6165c62',\n            kpis: {\n                position: '17\u00ba', positionSub: '(A 1 punto del descenso)',\n                loss: 81.7, \/\/ M\u20ac, represents loss. Positive value implies loss.\n                lossSub: 'P\u00e9rdidas 23\/24', \n                conflict: 'CR\u00cdTICO', conflictSub: 'Guerra judicial activa',\n                reputationalRisk: 80, \n                introText: 'El Sevilla FC se encuentra en un momento cr\u00edtico, navegando una crisis multifac\u00e9tica que abarca el declive deportivo, una situaci\u00f3n financiera compleja y una inestabilidad directiva sin precedentes. La acumulaci\u00f3n de malos resultados en el campo y un d\u00e9ficit econ\u00f3mico significativo ha generado un profundo descontento entre la afici\u00f3n y una intensa escrutinio medi\u00e1tico. \u00a1Prep\u00e1rate para desentra\u00f1ar los n\u00fameros y las historias detr\u00e1s del \"pique\" sevillano y ver qui\u00e9n domina en este an\u00e1lisis comparativo!'\n            },\n            performance: { '2022-23': { position: 12, points: 49 }, '2023-24': { position: 14, points: 41 }, '2024-25': { position: 17, points: 41 } },\n            coaches: [\n                { name: 'Joaqu\u00edn Caparr\u00f3s', start: '2025-04-13', end: '2025-05-25', totalGames: 10, record: { V: 4, E: 2, D: 4 }, homeStats: { V: 2, E: 1, D: 2 }, awayStats: { V: 2, E: 1, D: 2 } },\n                { name: 'Xavi Garc\u00eda Pimienta', start: '2024-06-02', end: '2025-04-12', totalGames: 31, record: { V: 8, E: 8, D: 15 }, homeStats: { V: 5, E: 4, D: 6 }, awayStats: { V: 3, E: 4, D: 9 } },\n                { name: 'Quique S\u00e1nchez Flores', start: '2023-12-18', end: '2024-05-25', totalGames: 20, record: { V: 10, E: 3, D: 7 }, homeStats: { V: 7, E: 1, D: 2 }, awayStats: { V: 3, E: 2, D: 5 } },\n                { name: 'Diego Alonso', start: '2023-10-10', end: '2023-12-16', totalGames: 10, record: { V: 0, E: 2, D: 8 }, homeStats: { V: 0, E: 1, D: 4 }, awayStats: { V: 0, E: 1, D: 4 } },\n                { name: 'Jos\u00e9 Luis Mendilibar', start: '2023-03-21', end: '2023-10-08', totalGames: 19, record: { V: 8, E: 5, D: 6 }, homeStats: { V: 5, E: 2, D: 2 }, awayStats: { V: 3, E: 3, D: 4 } },\n                { name: 'Jorge Sampaoli', start: '2022-10-06', end: '2023-03-20', totalGames: 23, record: { V: 8, E: 6, D: 9 }, homeStats: { V: 6, E: 3, D: 2 }, awayStats: { V: 2, E: 3, D: 7 } },\n                { name: 'Julen Lopetegui', start: '2019-06-05', end: '2022-10-05', totalGames: 141, record: { V: 79, E: 36, D: 26 }, homeStats: { V: 45, E: 18, D: 10 }, awayStats: { V: 34, E: 18, D: 16 } },\n            ],\n            keyPlayers: [\n                { name: 'Youssef En-Nesyri', role: 'Delantero', contribution: 'M\u00e1ximo goleador y referente ofensivo.' },\n                { name: 'Jes\u00fas Navas', role: 'Lateral\/Extremo', contribution: 'Leyenda del club, pilar y s\u00edmbolo de la cantera.' },\n                { name: 'Isaac Romero', role: 'Delantero (Cantera)', contribution: 'Irrupci\u00f3n en 24\/25, gran potencial de gol y valor de mercado.' },\n            ],\n            playerStats: {\n                '2024-25': [\n                    { name: 'Y. En-Nesyri', yellowCards: 5, redCards: 0, mvpAwards: 7 },\n                    { name: 'Lucas Ocampos', yellowCards: 6, redCards: 1, mvpAwards: 4 },\n                    { name: 'Isaac Romero', yellowCards: 3, redCards: 0, mvpAwards: 5 },\n                    { name: 'Suso', yellowCards: 2, redCards: 0, mvpAwards: 1 },\n                    { name: 'Djibril Sow', yellowCards: 7, redCards: 1, mvpAwards: 0 } \n                ],\n                '2023-24': [\n                    { name: 'Y. En-Nesyri', yellowCards: 6, redCards: 0, mvpAwards: 8 },\n                    { name: 'Sergio Ramos', yellowCards: 8, redCards: 2, mvpAwards: 3 }, \n                    { name: 'Lucas Ocampos', yellowCards: 4, redCards: 0, mvpAwards: 2 },\n                    { name: 'Lo\u00efc Bad\u00e9', yellowCards: 7, redCards: 1, mvpAwards: 0 },\n                    { name: 'Ivan Rakitic', yellowCards: 5, redCards: 0, mvpAwards: 1 },\n                    { name: 'Djibril Sow', yellowCards: 4, redCards: 0, mvpAwards: 0 }\n                ],\n                '2022-23': [\n                    { name: 'Y. En-Nesyri', yellowCards: 4, redCards: 0, mvpAwards: 5 },\n                    { name: 'Ivan Rakitic', yellowCards: 9, redCards: 0, mvpAwards: 1 },\n                    { name: 'Jes\u00fas Navas', yellowCards: 5, redCards: 0, mvpAwards: 0 },\n                    { name: 'Marcos Acu\u00f1a', yellowCards: 7, redCards: 1, mvpAwards: 2 },\n                    { name: 'Bono', yellowCards: 1, redCards: 0, mvpAwards: 3 }\n                ]\n            },\n            leastPlayedPlayers: [\n                { name: 'Adnan Januzaj', position: 'Extremo', minutes: 80, comment: 'Sin oportunidades claras.' },\n                { name: '\u00d3scar Rodr\u00edguez', position: 'Centrocampista', minutes: 120, comment: 'No cont\u00f3 con regularidad.' },\n            ],\n            transfers: {\n                '2022-23': { sales: [{ name: 'Jules Kound\u00e9', fee: '50M\u20ac' }], arrivals: [{ name: 'Lo\u00efc Bad\u00e9', fee: '~12M\u20ac' }], net_balance_value: 70, net_balance_text: 'Neto positivo significativo (+70M\u20ac aprox.)', comment: 'Grandes ventas clave.' },\n                '2023-24': { sales: [{ name: 'Bono', fee: '21M\u20ac' }], arrivals: [{ name: 'Djibril Sow', fee: '10M\u20ac' }], net_balance_value: 8, net_balance_text: 'Menor impacto neto positivo (+8M\u20ac aprox.)', comment: 'Menos ventas significativas.' },\n                '2024-25': { sales: [{ name: 'Y. En-Nesyri', fee: '19.5M\u20ac' }], arrivals: [{ name: 'Fichajes a coste 0' }], net_balance_value: 100, net_balance_text: 'Altas expectativas de ventas (hasta +100M\u20ac)', comment: 'Fuerte necesidad de ventas.' }\n            },\n            financials: {\n                '2021-22': { income: 241.9, expenses: 266.7, loss: 24.8, sources: { 'TV': 143.1, 'Traspasos': 54.2, 'Taquilla': 17.8, 'Otros': 26.8 } },\n                '2022-23': { income: 214.0, expenses: 233.3, loss: 19.3, sources: { 'TV': 85.3, 'Comerciales': 72.0, 'Taquilla': 34.0, 'Traspasos': 50.0 } }, \/\/ Corrected loss: 19.3\n                '2023-24': { income: 182.2, expenses: 263.9, loss: 81.7, sources: { 'TV': 70.0, 'Traspasos': 40.0, 'Otros': 57.2, 'Competici\u00f3n': 15.0 } }\n            },\n            reputationImpact: [ \/\/ Higher impact means worse reputation (0-100)\n                { name: 'J.M. Del Nido Benavente', impact: 90, color: '#b91c1c' }, { name: 'J.M. Del Nido Carrasco', impact: 85, color: '#dc2626' }, { name: 'Jos\u00e9 Castro', impact: 60, color: '#ef4444' }\n            ],\n            presidentSentiment: { \/\/ Sentiment data for JMDNC\n                '2022-23': { positive: 30, negative: 60, totalMentions: 18000 },\n                '2023-24': { positive: 20, negative: 70, totalMentions: 25000 },\n                '2024-25': { positive: 25, negative: 65, totalMentions: 22000 }\n            },\n            governanceTitleMain: 'Lucha por la Presidencia: Padre vs. Hijo',\n            governanceIntro: 'La inestabilidad se ha exacerbado por la disputa legal y medi\u00e1tica entre **Jos\u00e9 Mar\u00eda Del Nido Benavente** (padre, expresidente) y **Jos\u00e9 Mar\u00eda Del Nido Carrasco** (hijo, presidente actual), generando una imagen de desuni\u00f3n y afectando la estabilidad institucional. La concentraci\u00f3n del 65% del capital social en pocos accionistas acent\u00faa esta lucha de poder.',\n            governanceFigures: [\n                { type: 'JB', name: 'Jos\u00e9 Mar\u00eda Del Nido Benavente', role: 'Principal opositor, ejerce presi\u00f3n legal y medi\u00e1tica.' },\n                { type: 'DN', name: 'Jos\u00e9 Mar\u00eda Del Nido Carrasco', role: 'Presidente desde Ene 2024, en medio de luchas de poder.' },\n            ],\n            managementCritics: [\n                \"Incoherencia estrat\u00e9gica y decisiones reactivas.\", \"Falta de autonom\u00eda deportiva y microgesti\u00f3n.\", \"Control presupuestario deficiente y p\u00e9rdidas masivas.\", \"Falta de transparencia en acuerdos y gesti\u00f3n.\", \"Guerra civil directiva y divisiones internas.\", \"Priorizaci\u00f3n de agendas personales sobre intereses del club.\"\n            ],\n            pressArticles: [\n                { title: \"El Espa\u00f1ol\", source: \"El Espa\u00f1ol\", summary: \"Destaca un ambiente de tensiones extremas, con directivos necesitando escolta privada por amenazas.\", link: \"https:\/\/www.elespanol.com\/sevilla\/20250514\/sevilla-fc-polvorin-pese-salvacion-directivos-escolta-privada-sin-vida-publica-amenazas\/1003743755291_0.html\" },\n                { title: \"Estadio Deportivo\", source: \"Estadio Deportivo\", summary: \"Revelaciones sobre supuestas comisiones y mala gesti\u00f3n que explican la crisis grave del club.\", link: \"https:\/\/www.estadiodeportivo.com\/futbol\/sevilla-fc\/exconsejero-del-sevilla-destapa-las-barbaridades-que-explic an-grave-crisis-del-club-20250514-494840.html\" },\n                { title: \"Diario de Sevilla\", source: \"Diario de Sevilla\", summary: \"An\u00e1lisis de las cuentas con preocupaci\u00f3n por el d\u00e9ficit y la dependencia de las ventas.\", link: \"https:\/\/www.diariodesevilla.es\/sevillafc\/Sevilla-millones-perdidas-inquietante-desinversion-Junta-Accionistas-Castro_0_1850817204.html\" },\n            ],\n            socialMediaEchoes: [\n                'Crecimiento Digital Global: 20 millones de seguidores (Marzo 2024), 3er club con mayor crecimiento mundial en 2023. Presencia en Weibo\/Douyin (+1M seguidores).',\n                'Plataformas Clave: Instagram (+3.5M), TikTok (+1.4M), YouTube (Top 5 con +193k suscriptores).',\n                'Humor y Cr\u00edtica: La \"guasa sevillana\" se expresa a trav\u00e9s de memes sat\u00edricos (\"camisetas de pijama\") y humor negro en la crisis.',\n                'Protestas Virales: Im\u00e1genes y videos de protestas (lanzamiento de billetes, gradas vac\u00edas, jugadores \"atrincherados\") se viralizan r\u00e1pidamente y amplifican el descontento.',\n            ],\n            judicialCalendar: [\n                { date: \"27 de Marzo, 2025\", event: \"Rechazada la destituci\u00f3n de la Junta Directiva.\", summary: \"Propuesta de Del Nido padre rechazada en Junta General Extraordinaria. Se mantiene el conflicto legal sobre la gobernanza y la composici\u00f3n del consejo.\", link: \"https:\/\/theimpactlawyers.com\/articles\/sevilla-fc-shareholders-meeting-rejects-the-dismissal-of-the-board-chaired-by-del-nido-carrasco\" },\n                { date: \"En curso\", event: \"Investigaci\u00f3n caso Kike Salas\", summary: \"Detenci\u00f3n por presunta manipulaci\u00f3n de partidos (forzar tarjetas para apuestas), con potencial impacto grave en la integridad y reputaci\u00f3n del club.\", link: \"https:\/\/www.elconfidencial.com\/deportes\/futbol\/2025-01-14\/kike-salas-sevilla-fc-apuestas-detencion_4041760\/\" },\n            ],\n            impactfulQuotes: [\n                '\"La situaci\u00f3n actualmente no tiene soluci\u00f3n. Que salga hasta el \u00faltimo que est\u00e1 y que entre gente nueva. Con estos se sabe que acabamos en el pozo.\" (Aficionado cr\u00edtico)',\n                '\"Probablemente el peor presidente en el f\u00fatbol profesional, su salario es mayor que el del club. Inimaginable.\" (Aficionado en redes, sobre J.M. Del Nido Carrasco)',\n                '\"El club (inexplicablemente) se encuentra asfixiado econ\u00f3micamente y \\'con toda la plantilla transferible\\', viviendo una lucha de poder interna.\" (An\u00e1lisis medi\u00e1tico)',\n                '\"Presidentes \\'okupas\\' y club \\'ingobernable\\'.\" (Cr\u00edticos, reflejando el sentimiento de descontrol).'\n            ],\n            scenarios: [\n                { title: 'Optimista', content: 'La directiva logra consenso y visi\u00f3n unificada. Se prioriza la estabilidad deportiva con la cantera como eje. Control de gasto, restauraci\u00f3n de confianza de la afici\u00f3n y regreso a Europa en 2-3 temporadas. Reforma del estadio impulsa ingresos.' },\n                { title: 'Neutro', content: 'Gesti\u00f3n reactiva y sin visi\u00f3n clara. Cambios de entrenador y fichajes ineficaces persisten. Ventas de canteranos como v\u00eda principal. Club en zona media-baja de La Liga, evitando descenso por poco. Deuda alta, afici\u00f3n dividida.' },\n                { title: 'Pesimista', content: 'Luchas internas se intensifican, par\u00e1lisis en decisiones. Descenso a Segunda Divisi\u00f3n. P\u00e9rdidas se disparan, devaluaci\u00f3n de plantilla, sostenibilidad financiera comprometida. Ruptura con la afici\u00f3n, devaluaci\u00f3n de marca.' }\n            ],\n            recommendations: [\n                \"Estabilizar la Direcci\u00f3n Deportiva y T\u00e9cnica con un proyecto unificado y a largo plazo.\",\n                \"Reestructurar Financieramente: Reducir p\u00e9rdidas operativas, disminuir dependencia de ventas de jugadores y diversificar ingresos (marketing, patrocinios, estadio).\",\n                \"Estrategia de Talento de Cantera a Largo Plazo: Integrar y retener talento como pilar deportivo e identidad, con planes de carrera claros.\",\n                \"Recuperar la Confianza de la Afici\u00f3n: Establecer comunicaci\u00f3n bidireccional y transparente, demostrando compromiso con acciones concretas.\",\n                \"Optimizar la Gesti\u00f3n de Activos Inmobiliarios: Acelerar proyecto de reforma del Ram\u00f3n S\u00e1nchez-Pizju\u00e1n para aumentar ingresos no deportivos.\",\n                \"Fortalecer la Cohesi\u00f3n de la Gobernanza: Establecer mecanismos de resoluci\u00f3n de conflictos y alineaci\u00f3n estrat\u00e9gica entre accionistas y direcci\u00f3n.\",\n                \"Optimizar la Eficiencia Operativa y Gesti\u00f3n de Costes: Implementar programa integral para mitigar impacto de inflaci\u00f3n y costes energ\u00e9ticos.\"\n            ],\n            fanStats: { \/\/ Fan stats for Sevilla FC\n                '2022-23': { socialGrowth: 32, stadiumAttendance: 35795, socialSentiment: 50, fanLoyalty: 85 }, \/\/ Growth %\n                '2023-24': { socialGrowth: 10, stadiumAttendance: 35494, socialSentiment: 40, fanLoyalty: 80 },\n                '2024-25': { socialGrowth: 5,  stadiumAttendance: 33000, socialSentiment: 35, fanLoyalty: 75 }\n            },\n            topScorers: [\n                { name: 'Youssef En-Nesyri', goals: 12, club: 'Sevilla FC', season: '2024-25' },\n                { name: 'Isaac Romero', goals: 8, club: 'Sevilla FC', season: '2024-25' },\n                { name: 'Lucas Ocampos', goals: 5, club: 'Sevilla FC', season: '2024-25' },\n                \/\/ Datos adicionales para temporadas anteriores del Sevilla FC\n                { name: 'Youssef En-Nesyri', goals: 18, club: 'Sevilla FC', season: '2023-24' },\n                { name: 'Rafa Mir', goals: 7, club: 'Sevilla FC', season: '2023-24' },\n                { name: 'Erik Lamela', goals: 6, club: 'Sevilla FC', season: '2022-23' },\n                { name: 'Rafa Mir', goals: 5, club: 'Sevilla FC', season: '2022-23' }\n            ]\n        },\n        betis: {\n            name: 'Real Betis',\n            primaryColor: '#22C55E', \/* Emerald 500 *\/\n            lightColor: '#ecfdf5', \/* Emerald 50 *\/\n            crestUrl: 'uploaded:descarga (2).jpeg-a23b6190-1cac-4562-ab9f-642d5a8d0970',\n            kpis: {\n                position: '6\u00ba', positionSub: '(Clasificado a Europa League)',\n                loss: -5.0, \/\/ M\u20ac, represents profit. Negative value implies profit.\n                lossSub: 'Beneficio 23\/24', \n                conflict: 'ESTABLE', conflictSub: 'Estabilidad directiva',\n                reputationalRisk: 30,\n                introText: 'El Real Betis Balompi\u00e9 ha consolidado su posici\u00f3n en la \u00e9lite del f\u00fatbol espa\u00f1ol, destacando por su estabilidad directiva, una gesti\u00f3n financiera prudente y un rendimiento deportivo consistente que le ha asegurado la participaci\u00f3n en competiciones europeas. El club ha logrado mantener un equilibrio entre la ambici\u00f3n deportiva y la sostenibilidad. \u00a1Descubre c\u00f3mo se posiciona el Betis frente a su eterno rival en este an\u00e1lisis comparativo!'\n            },\n            performance: { '2022-23': { position: 6, points: 60 }, '2023-24': { position: 7, points: 57 }, '2024-25': { position: 6, points: 60 } },\n            coaches: [\n                { name: 'Manuel Pellegrini', start: '2020-07-09', end: 'Actual', totalGames: 200, record: { V: 90, E: 55, D: 55 }, homeStats: { V: 50, E: 25, D: 25 }, awayStats: { V: 40, E: 30, D: 30 } },\n                { name: 'Alexis Trujillo', start: '2020-06-27', end: '2020-07-08', totalGames: 4, record: { V: 1, E: 0, D: 3 }, homeStats: { V: 1, E: 0, D: 1 }, awayStats: { V: 0, E: 0, D: 2 } },\n                { name: 'Rubi', start: '2019-07-01', end: '2020-06-26', totalGames: 33, record: { V: 10, E: 8, D: 15 }, homeStats: { V: 6, E: 4, D: 6 }, awayStats: { V: 4, E: 4, D: 9 } },\n            ],\n            keyPlayers: [\n                { name: 'Isco Alarc\u00f3n', role: 'Centrocampista', contribution: 'L\u00edder creativo y pieza clave en el ataque.' },\n                { name: 'Nabil Fekir', role: 'Mediapunta', contribution: 'Jugador de gran calidad, desequilibrio y experiencia.' },\n                { name: 'Assane Diao', role: 'Extremo (Cantera)', contribution: 'Joven promesa con gran proyecci\u00f3n y capacidad de desborde.' },\n            ],\n            playerStats: {\n                '2024-25': [\n                    { name: 'Isco', yellowCards: 4, redCards: 0, mvpAwards: 8 },\n                    { name: 'Ayoze P\u00e9rez', yellowCards: 3, redCards: 0, mvpAwards: 5 },\n                    { name: 'Abde Ezzalzouli', yellowCards: 2, redCards: 1, mvpAwards: 2 },\n                    { name: 'Marc Roca', yellowCards: 6, redCards: 0, mvpAwards: 1 },\n                    { name: 'Germ\u00e1n Pezzella', yellowCards: 5, redCards: 1, mvpAwards: 0 },\n                    { name: 'Johnny Cardoso', yellowCards: 3, redCards: 0, mvpAwards: 1 }\n                ],\n                '2023-24': [\n                    { name: 'Isco', yellowCards: 6, redCards: 0, mvpAwards: 10 },\n                    { name: 'Guido Rodr\u00edguez', yellowCards: 9, redCards: 1, mvpAwards: 2 },\n                    { name: 'William Carvalho', yellowCards: 5, redCards: 0, mvpAwards: 1 },\n                    { name: 'Borja Iglesias', yellowCards: 3, redCards: 0, mvpAwards: 3 },\n                    { name: 'Luiz Henrique', yellowCards: 4, redCards: 0, mvpAwards: 2 },\n                    { name: 'Pezzella', yellowCards: 5, redCards: 1, mvpAwards: 0 }\n                ],\n                '2022-23': [\n                    { name: 'Sergio Canales', yellowCards: 7, redCards: 1, mvpAwards: 6 },\n                    { name: 'Borja Iglesias', yellowCards: 3, redCards: 0, mvpAwards: 4 },\n                    { name: 'Juan Miranda', yellowCards: 6, redCards: 0, mvpAwards: 0 },\n                    { name: 'Luiz Felipe', yellowCards: 8, redCards: 1, mvpAwards: 1 },\n                    { name: 'Andr\u00e9s Guardado', yellowCards: 5, redCards: 0, mvpAwards: 0 },\n                    { name: 'Fekir', yellowCards: 4, redCards: 0, mvpAwards: 3 }\n                ]\n            },\n            leastPlayedPlayers: [\n                { name: 'Juanmi Jim\u00e9nez', position: 'Delantero', minutes: 90, comment: 'Poca participaci\u00f3n, cedido.' },\n                { name: 'Willian Jos\u00e9', position: 'Delantero', minutes: 180, comment: 'Pocas oportunidades, a la sombra de otros.' },\n            ],\n            transfers: {\n                '2022-23': { sales: [{ name: 'Alex Moreno', fee: '13M\u20ac' }], arrivals: [{ name: 'Luiz Henrique', fee: '8M\u20ac' }], net_balance_value: 10, net_balance_text: 'Neto positivo moderado (+10M\u20ac aprox.)', comment: 'Equilibrio en ventas.' },\n                '2023-24': { sales: [{ name: 'Luiz Felipe', fee: '22M\u20ac' }], arrivals: [{ name: 'Isco Alarc\u00f3n', fee: 'Libre' }], net_balance_value: 15, net_balance_text: 'Neto positivo significativo (+15M\u20ac aprox.)', comment: 'Venta importante.' },\n                '2024-25': { sales: [{ name: 'Guido Rodr\u00edguez', fee: 'Proyecci\u00f3n' }], arrivals: [{ name: 'Fichajes a coste 0' }], net_balance_value: 5, net_balance_text: 'Balance neto positivo (proyecci\u00f3n +5M\u20ac)', comment: 'Estrategia de bajo coste.' }\n            },\n            financials: {\n                '2021-22': { income: 154.5, expenses: 165.0, loss: 10.5, sources: { 'TV': 70.0, 'Traspasos': 30.0, 'Taquilla': 15.0, 'Otros': 39.5 } },\n                '2022-23': { income: 167.0, expenses: 172.0, loss: 5.0, sources: { 'Competici\u00f3n': 20.0, 'Traspasos': 25.0, 'TV': 80.0, 'Otros': 42.0 } },\n                '2023-24': { income: 180.0, expenses: 175.0, loss: -5.0, sources: { 'TV': 85.0, 'Traspasos': 35.0, 'Competici\u00f3n': 25.0, 'Otros': 35.0 } }\n            },\n            reputationImpact: [\n                { name: '\u00c1ngel Haro', impact: 20, color: '#10b981' }, { name: 'Jos\u00e9 Miguel L\u00f3pez', impact: 25, color: '#34d399' }\n            ],\n            presidentSentiment: { \/\/ Sentiment data for \u00c1ngel Haro\n                '2022-23': { positive: 70, negative: 15, totalMentions: 12000 },\n                '2023-24': { positive: 65, negative: 20, totalMentions: 15000 },\n                '2024-25': { positive: 75, negative: 10, totalMentions: 13000 }\n            },\n            governanceTitleMain: 'Estabilidad en la Directiva',\n            governanceIntro: 'El Real Betis ha mostrado una directiva m\u00e1s estable y unificada en los \u00faltimos a\u00f1os, con una menor rotaci\u00f3n en puestos clave y una gesti\u00f3n percibida como m\u00e1s cohesionada y enfocada en la estabilidad del club. La ausencia de conflictos internos p\u00fablicos de gran envergadura ha contribuido a una imagen de solidez.',\n            governanceFigures: [\n                { type: 'AH', name: '\u00c1ngel Haro', role: 'Presidente, con una gesti\u00f3n consolidada y percibida como estable.' },\n                { type: 'JML', name: 'Jos\u00e9 Miguel L\u00f3pez Catal\u00e1n', role: 'Vicepresidente, figura clave en la gesti\u00f3n diaria y la conexi\u00f3n con la afici\u00f3n.' },\n            ],\n            managementCritics: [\n                \"Gesti\u00f3n conservadora del mercado de fichajes.\", \"Dependencia de pocos jugadores clave en la creaci\u00f3n de juego.\", \"Rendimiento inconsistente en fases avanzadas de competiciones europeas.\", \"Necesidad de mayor inversi\u00f3n para dar el salto de calidad.\"\n            ],\n            pressArticles: [\n                { title: \"El Betis y su ambici\u00f3n europea\", source: \"ABC de Sevilla\", summary: \"Destaca la constancia del equipo en puestos europeos, aunque con desaf\u00edos para dar el salto definitivo en grandes citas.\", link: \"https:\/\/sevilla.abc.es\/betis\/\" },\n                { title: \"El Betis, modelo de estabilidad en LaLiga\", source: \"Marca\", summary: \"Subraya la continuidad del proyecto deportivo y la calma institucional como claves del \u00e9xito b\u00e9tico.\", link: \"https:\/\/www.marca.com\/\" },\n            ],\n            socialMediaEchoes: [\n                'Afici\u00f3n Apasionada: Fuerte presencia y engagement, especialmente en redes locales y en el estadio.',\n                'Plataformas Clave: X (Twitter), Instagram y TikTok, con mucha interacci\u00f3n en los derbis y celebraciones.',\n                'Orgullo B\u00e9tico: Narrativa de identidad y valores, destacando la \"filosof\u00eda Betis\" y el sentimiento de pertenencia.',\n                'Debate T\u00e1ctico: Conversaciones activas sobre el estilo de juego de Pellegrini y las estrategias del equipo.'\n            ],\n            judicialCalendar: [\n                { date: \"N\/A\", event: \"Sin procesos judiciales destacados.\", summary: \"Actualmente no se reportan conflictos judiciales de alto impacto en la directiva del Real Betis que afecten p\u00fablicamente la estabilidad del club.\" },\n            ],\n            impactfulQuotes: [\n                '\"El Betis es otra cosa, es un sentimiento.\" (Eslogan popular de la afici\u00f3n b\u00e9tica)',\n                '\"Pellegrini ha devuelto la ilusi\u00f3n al beticismo con su proyecto y su estilo de juego, consolidando al equipo en Europa.\" (Comentarista deportivo)',\n                '\"En el Betis, la estabilidad directiva ha sido clave para el crecimiento sostenido del club.\" (An\u00e1lisis medi\u00e1tico)',\n            ],\n            scenarios: [\n                { title: 'Optimista', content: 'Consolidaci\u00f3n en Europa, inversi\u00f3n inteligente en cantera y estabilidad financiera que permite mantener a los jugadores clave. Posible salto a Champions League y crecimiento sostenido de la masa social.' },\n                { title: 'Neutro', content: 'Mantenimiento en zona media-alta de Liga, con clasificaciones a Europa League. Estabilidad financiera, pero sin grandes saltos cualitativos en la plantilla o la infraestructura. El crecimiento es m\u00e1s lento.' },\n                { title: 'Pesimista', content: 'P\u00e9rdida de la regularidad en Europa, lo que afecta ingresos y la capacidad de retener talento. Descontento creciente de la afici\u00f3n por falta de ambici\u00f3n. Posible entrada en una espiral de bajo rendimiento.' }\n            ],\n            recommendations: [\n                \"Mantener la estabilidad deportiva y financiera, evitando experimentos que pongan en riesgo la trayectoria actual.\",\n                \"Potenciar la marca global y diversificar ingresos no deportivos, buscando nuevos mercados y patrocinios de mayor envergadura.\",\n                \"Invertir estrat\u00e9gicamente en infraestructura y modernizaci\u00f3n del estadio para mejorar la experiencia del aficionado y aumentar los ingresos por d\u00eda de partido.\",\n                \"Reforzar la cantera con una integraci\u00f3n m\u00e1s efectiva de j\u00f3venes talentos en el primer equipo, como fuente de valor deportivo y econ\u00f3mico.\",\n                \"Mantener la cohesi\u00f3n directiva y la comunicaci\u00f3n transparente con los grupos de inter\u00e9s para preservar la estabilidad institucional.\"\n            ],\n            fanStats: { \/\/ Fan stats for Real Betis\n                '2022-23': { socialGrowth: 10, stadiumAttendance: 45000, socialSentiment: 70, fanLoyalty: 90 },\n                '2023-24': { socialGrowth: 15, stadiumAttendance: 48000, socialSentiment: 75, fanLoyalty: 92 },\n                '2024-25': { socialGrowth: 12, stadiumAttendance: 50000, socialSentiment: 72, fanLoyalty: 93 }\n            },\n            topScorers: [\n                { name: 'Willian Jos\u00e9', goals: 10, club: 'Real Betis', season: '2024-25' },\n                { name: 'Ayoze P\u00e9rez', goals: 7, club: 'Real Betis', season: '2024-25' },\n                { name: 'Nabil Fekir', goals: 6, club: 'Real Betis', season: '2024-25' },\n                 \/\/ Datos adicionales para temporadas anteriores del Betis\n                { name: 'Borja Iglesias', goals: 15, club: 'Real Betis', season: '2023-24' },\n                { name: 'Juanmi', goals: 12, club: 'Real Betis', season: '2023-24' },\n                { name: 'Borja Iglesias', goals: 16, club: 'Real Betis', season: '2022-23' },\n                { name: 'Juanmi', goals: 11, club: 'Real Betis', season: '2022-23' }\n            ]\n        }\n    };\n\n    let currentClub = 'sevilla'; \/\/ Default club\n    let performanceChart, financialsChart, incomeSourceChart, reputationChart, transferBalanceChart;\n    let coachPerformanceChart, coachHomeStatsChart, coachAwayStatsChart;\n    let coachSelectionList;\n    let presidentSentimentChart; \/\/ Chart for president sentiment (positive\/negative by year)\n    let socialGrowthChart, stadiumAttendanceChart, socialSentimentOverallChart, fanLoyaltyChart; \/\/ Charts for fan league\n\n    let currentTopScorersClub = 'sevilla'; \/\/ Default selected club for top scorers\n    let currentTopScorersSeason = '2024-25'; \/\/ Default selected season for top scorers\n\n\n    \/\/ Define global Chart.js options\n    const globalChartOptions = {\n        responsive: true,\n        maintainAspectRatio: false,\n        plugins: {\n            legend: {\n                display: false \/\/ Default to no legend unless specified\n            },\n            tooltip: {\n                backgroundColor: 'rgba(0, 0, 0, 0.7)',\n                titleFont: { size: 14, weight: 'bold' },\n                bodyFont: { size: 12 },\n                padding: 10,\n                cornerRadius: 4\n            }\n        },\n        scales: {\n            y: {\n                ticks: {\n                    color: '#6b7280' \/\/ Default tick color\n                },\n                grid: {\n                    color: 'rgba(200, 200, 200, 0.2)' \/\/ Default grid line color\n                }\n            },\n            x: {\n                ticks: {\n                    color: '#6b7280' \/\/ Default tick color\n                },\n                grid: {\n                    display: false \/\/ Default to no x-axis grid\n                }\n            }\n        }\n    };\n\n    \/\/ Helper to calculate duration in months\n    function getDurationInMonths(startDate, endDate) {\n        const start = new Date(startDate);\n        const end = endDate === 'Actual' ? new Date() : new Date(endDate);\n        if (isNaN(start) || isNaN(end)) {\n            return 'N\/D';\n        }\n        let months = (end.getFullYear() - start.getFullYear()) * 12;\n        months -= start.getMonth();\n        months += end.getMonth();\n        return months <= 0 ? 'Menos de 1 mes' : `${months} meses`;\n    }\n\n    function setClubColors(clubName) {\n        const root = document.documentElement;\n        const colors = clubData[clubName];\n        root.style.setProperty('--primary-color', colors.primaryColor);\n        root.style.setProperty('--primary-light-color', colors.lightColor);\n        \n        \/\/ Update direct style properties for elements that need it\n        document.querySelectorAll('.primary-text-color').forEach(el => el.style.color = colors.primaryColor);\n        document.querySelectorAll('.primary-border-color').forEach(el => el.style.borderColor = colors.primaryColor);\n        document.querySelectorAll('.primary-bg-color').forEach(el => el.style.backgroundColor = colors.primaryColor);\n        document.querySelectorAll('.primary-light-bg-color').forEach(el => el.style.backgroundColor = colors.lightColor);\n        \n        const sevillaBtn = document.getElementById('select-sevilla');\n        const betisBtn = document.getElementById('select-betis');\n\n        if (clubName === 'sevilla') {\n            sevillaBtn.classList.add('active');\n            sevillaBtn.classList.remove('inactive');\n            betisBtn.classList.add('inactive');\n            betisBtn.classList.remove('active');\n        } else {\n            betisBtn.classList.add('active');\n            betisBtn.classList.remove('inactive');\n            sevillaBtn.classList.add('inactive');\n            sevillaBtn.classList.remove('active');\n        }\n    }\n\n    function updateKpiSection(data) {\n        document.getElementById('kpi-position').textContent = data.kpis.position;\n        document.getElementById('kpi-position-subtext').textContent = data.kpis.positionSub;\n        document.getElementById('kpi-loss').textContent = `${Math.abs(data.kpis.loss)} M\u20ac`; \/\/ Display absolute value\n        document.getElementById('kpi-loss-subtext').textContent = data.kpis.lossSub;\n        \/\/ Adjust color based on loss\/profit\n        const lossKpiElement = document.getElementById('kpi-loss');\n        if (data.kpis.loss > 0) {\n            lossKpiElement.classList.add('text-red-600');\n            lossKpiElement.classList.remove('text-green-600');\n        } else {\n            lossKpiElement.classList.add('text-green-600');\n            lossKpiElement.classList.remove('text-red-600');\n        }\n\n        document.getElementById('kpi-conflict').textContent = data.kpis.conflict;\n        document.getElementById('kpi-conflict-subtext').textContent = data.kpis.conflictSub;\n        initRiskGauge(data.kpis.reputationalRisk, data.primaryColor);\n        document.getElementById('club-intro-text').textContent = data.kpis.introText;\n    }\n\n    function initPerformanceChart(data) {\n        const ctx = document.getElementById('performanceChart').getContext('2d');\n        if (performanceChart) performanceChart.destroy();\n        const labels = Object.keys(data.performance);\n        const dataPoints = Object.values(data.performance).map(d => d.points);\n        const dataPositions = Object.values(data.performance).map(d => d.position);\n\n        performanceChart = new Chart(ctx, {\n            type: 'bar',\n            data: {\n                labels: labels,\n                datasets: [{\n                    label: 'Puntos en La Liga',\n                    data: dataPoints,\n                    backgroundColor: data.primaryColor,\n                    borderColor: data.primaryColor,\n                    borderWidth: 1,\n                    borderRadius: 5,\n                }]\n            },\n            options: {\n                ...globalChartOptions, \/\/ Use global options\n                scales: { \n                    ...globalChartOptions.scales, \/\/ Merge global scales\n                    y: { \n                        ...globalChartOptions.scales.y, \n                        beginAtZero: false, \n                        ticks: { stepSize: 5, color: '#4b5563' } \n                    }, \n                    x: { \n                        ...globalChartOptions.scales.x,\n                        ticks: { color: '#4b5563' }, \n                        grid: { display: false } \n                    } \n                },\n                plugins: { \n                    ...globalChartOptions.plugins, \/\/ Merge global plugins\n                    tooltip: { \n                        ...globalChartOptions.plugins.tooltip,\n                        callbacks: { \n                            label: ctx => `Puntos: ${ctx.parsed.y} (Posici\u00f3n: ${dataPositions[ctx.dataIndex]}\u00ba)` \n                        } \n                    } \n                }\n            }\n        });\n    }\n\n    function updateFinancialCharts(data, year) {\n        const financialsData = data.financials[year];\n        const summaryEl = document.getElementById('financial-summary');\n        \/\/ Determine if it's a loss (positive value) or profit (negative value) from the report context\n        summaryEl.className = `mt-8 p-4 rounded-lg border ${financialsData.loss > 0 ? 'summary-loss' : 'summary-profit'}`;\n\n        if (financialsChart) financialsChart.destroy();\n        if (incomeSourceChart) incomeSourceChart.destroy();\n        \n        const ctxFinancials = document.getElementById('financialsChart').getContext('2d');\n        financialsChart = new Chart(ctxFinancials, {\n            type: 'line',\n            data: {\n                labels: ['Ingresos', 'Gastos'],\n                datasets: [{\n                    label: `Millones de \u20ac (${year})`, data: [financialsData.income, financialsData.expenses],\n                    borderColor: ['#16a34a', data.primaryColor], backgroundColor: ['rgba(22, 163, 74, 0.1)', `${data.primaryColor}1A`],\n                    borderWidth: 2, fill: true, tension: 0.1, pointRadius: 5, pointBackgroundColor: ['#16a34a', data.primaryColor],\n                }]\n            },\n            options: {\n                ...globalChartOptions,\n                plugins: { \n                    ...globalChartOptions.plugins,\n                    legend: { display: false }, \n                    title: { display: true, text: 'Ingresos vs Gastos', color: '#1f2937', font: { size: 16 } } \n                },\n                scales: { \n                    ...globalChartOptions.scales,\n                    y: { \n                        ...globalChartOptions.scales.y,\n                        beginAtZero: true \n                    } \n                }\n            }\n        });\n        \n        const ctxIncomeSource = document.getElementById('incomeSourceChart').getContext('2d');\n        incomeSourceChart = new Chart(ctxIncomeSource, {\n            type: 'doughnut',\n            data: {\n                labels: Object.keys(financialsData.sources),\n                datasets: [{\n                    label: 'Fuente de Ingresos', data: Object.values(financialsData.sources),\n                    backgroundColor: [data.primaryColor, '#b91c1c', '#dc2626', '#ef4444', '#fee2e2'], \/\/ Using primary color and shades of red\n                    borderColor: '#ffffff', borderWidth: 2\n                }]\n            },\n            options: {\n                ...globalChartOptions,\n                plugins: {\n                    ...globalChartOptions.plugins,\n                    legend: { position: 'bottom', labels: { color: '#4b5563'} },\n                    title: { display: true, text: 'Fuentes de Ingresos', color: '#1f2937', font: { size: 16 } },\n                    tooltip: { callbacks: { label: ctx => `${ctx.label}: ${ctx.parsed.toFixed(1)} M\u20ac` } }\n                }\n            }\n        });\n        \n        const resultIcon = financialsData.loss > 0 ? '&#10007;' : '&#10003;'; \/\/ Check if it's a positive loss or negative (profit)\n        const lossOrProfitText = financialsData.loss > 0 ? 'p\u00e9rdidas' : 'ganancias';\n        const formattedLoss = Math.abs(financialsData.loss).toFixed(1);\n        summaryEl.innerHTML = `<p class=\"font-semibold text-lg flex items-center justify-center\">Resultado Neto ${year}: <span class=\"ml-2 text-2xl\">${resultIcon}<\/span><\/p><p class=\"text-sm mt-1 text-center\">El club registr\u00f3 <strong>${formattedLoss} M\u20ac<\/strong> en ${lossOrProfitText}, subrayando los desaf\u00edos de sostenibilidad.<\/p>`;\n    }\n\n    function createFinancialFilters(data) {\n        const container = document.getElementById('financial-filters');\n        container.innerHTML = '';\n        const years = Object.keys(data.financials);\n        years.forEach((year, index) => {\n            const button = document.createElement('button');\n            button.textContent = year;\n            button.className = 'filter-btn px-3 py-1.5 text-sm font-medium rounded-md';\n            if (index === years.length - 1) button.classList.add('active');\n            button.addEventListener('click', () => {\n                document.querySelectorAll('#financial-filters .filter-btn').forEach(btn => btn.classList.remove('active'));\n                button.classList.add('active');\n                updateFinancialCharts(data, year);\n            });\n            container.appendChild(button);\n        });\n        updateFinancialCharts(data, years[years.length - 1]);\n    }\n    \n    function initRiskGauge(riskValue, color) {\n        const canvas = document.getElementById('gauge-canvas');\n        if (!canvas) {\n            console.error(\"Canvas element 'gauge-canvas' not found.\");\n            return;\n        }\n        const ctx = canvas.getContext('2d');\n        if (!ctx) {\n            console.error(\"Could not get 2D context for canvas.\");\n            return;\n        }\n\n        \/\/ Ensure canvas dimensions match its display size for proper rendering\n        canvas.width = canvas.offsetWidth || canvas.clientWidth || 300;\n        canvas.height = canvas.offsetHeight || canvas.clientHeight || 150;\n\n        let currentRiskValue = Number(riskValue);\n        if (!isFinite(currentRiskValue)) {\n            console.warn(\"riskValue is not a finite number. Defaulting to 0 for gauge display.\", riskValue);\n            currentRiskValue = 0; \/\/ Default to a safe value\n        }\n\n        document.getElementById('risk-value').textContent = `${currentRiskValue}`;\n        const W = canvas.width;\n        const H = canvas.height;\n        const angle = (currentRiskValue \/ 100) * Math.PI;\n\n        ctx.clearRect(0, 0, W, H);\n        ctx.beginPath();\n        ctx.arc(W \/ 2, H, W \/ 2 - 10, Math.PI, 2 * Math.PI, false);\n        ctx.lineWidth = 20;\n        ctx.strokeStyle = '#e5e7eb';\n        ctx.stroke();\n\n        ctx.beginPath();\n        ctx.arc(W \/ 2, H, W \/ 2 - 10, Math.PI, Math.PI + angle, false);\n        ctx.lineWidth = 20;\n        \n        let gradient; \/\/ Declare gradient here\n        \/\/ Check for non-finite dimensions again before creating gradient\n        if (!isFinite(W) || W <= 0) {\n             console.warn(\"Canvas width is invalid for gradient creation. Using solid color fallback.\", W);\n             ctx.strokeStyle = color; \/\/ Fallback to solid color if gradient can't be created\n        } else {\n            gradient = ctx.createLinearGradient(0, 0, W, 0);\n            const clampedGradientStop = Math.max(0, Math.min(1, currentRiskValue \/ 100)); \/\/ Still using numericRiskValue\n            \n            \/\/ Final check just before addColorStop\n            if (!isFinite(clampedGradientStop)) {\n                console.error(\"clampedGradientStop is non-finite:\", clampedGradientStop, \"original riskValue:\", riskValue, \"currentRiskValue:\", currentRiskValue);\n                clampedGradientStop = 0; \/\/ Force to a safe value\n            }\n\n            gradient.addColorStop(0, '#fca5a5'); \n            gradient.addColorStop(clampedGradientStop, color); \n            ctx.strokeStyle = gradient;\n        }\n        \n        ctx.stroke();\n        document.getElementById('risk-value').style.color = color;\n    }\n\n    function generateList(containerId, items, itemClass, iconHtml = '') {\n        const container = document.getElementById(containerId);\n        if(container) { \/\/ Defensive check\n            container.innerHTML = '';\n            items.forEach(itemText => {\n                const item = document.createElement('li');\n                item.className = itemClass;\n                item.innerHTML = `${iconHtml}<span>${itemText}<\/span>`;\n                container.appendChild(item);\n            });\n        }\n    }\n\n    function createPressArticles(data) {\n        const container = document.getElementById('press-articles');\n        if(container) { \/\/ Defensive check\n            container.innerHTML = '';\n            data.pressArticles.forEach(article => {\n                const div = document.createElement('div');\n                div.className = 'bg-white p-4 rounded-lg border border-gray-200 shadow-sm';\n                div.innerHTML = `\n                    <h4 class=\"font-bold text-gray-800\">${article.title}<\/h4>\n                    <p class=\"text-sm text-gray-500 italic mt-1\">- ${article.source}<\/p>\n                    <p class=\"text-sm text-gray-600 mt-2\">${article.summary}<\/p>\n                    <a href=\"${article.link}\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"text-sm primary-text-color hover:underline font-medium mt-2 inline-block\">Leer m\u00e1s &rarr;<\/a>\n                `;\n                container.appendChild(div);\n            });\n        }\n    }\n\n    function createJudicialCalendar(data) {\n        const container = document.getElementById('judicial-calendar');\n        if(container) { \/\/ Defensive check\n            container.innerHTML = '';\n            data.judicialCalendar.forEach(item => {\n                const div = document.createElement('div');\n                div.className = 'bg-white p-4 rounded-lg border border-gray-200 shadow-sm';\n                div.innerHTML = `\n                    <p class=\"text-sm font-semibold primary-text-color\">${item.date}<\/p>\n                    <h4 class=\"font-bold text-gray-800 mt-1\">${item.event}<\/h4>\n                    <p class=\"text-sm text-gray-600 mt-2\">${item.summary}<\/p>\n                    ${item.link ? `<a href=\"${item.link}\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"text-sm primary-text-color hover:underline font-medium mt-2 inline-block\">Ver detalles &rarr;<\/a>` : ''}\n                `;\n                container.appendChild(div);\n            });\n        }\n    }\n    \n    function initReputationChart(data) {\n        const ctx = document.getElementById('reputationChart')?.getContext('2d'); \/\/ Use optional chaining\n        if (reputationChart) reputationChart.destroy();\n        if (ctx) { \/\/ Defensive check for ctx\n            const labels = data.reputationImpact.map(d => d.name);\n            const values = data.reputationImpact.map(d => d.impact);\n            const colors = data.reputationImpact.map(d => d.color);\n\n            reputationChart = new Chart(ctx, {\n                type: 'bar',\n                data: { labels, datasets: [{ label: 'Impacto Negativo', data: values, backgroundColor: colors }] },\n                options: {\n                    ...globalChartOptions,\n                    plugins: { ...globalChartOptions.plugins, legend: { display: false } },\n                    scales: { \n                        ...globalChartOptions.scales,\n                        x: { ...globalChartOptions.scales.x, beginAtZero: true, max: 100 }, \n                        y: { ...globalChartOptions.scales.y, grid: { display: false } } \n                    }\n                }\n            });\n        }\n    }\n    \n    function createAccordion(containerId, items) {\n        const container = document.getElementById(containerId);\n        if(container) { \/\/ Defensive check\n            container.innerHTML = '';\n            items.forEach(item => {\n                const div = document.createElement('div');\n                div.innerHTML = `\n                    <button class=\"accordion-toggle w-full flex justify-between items-center text-left p-4 rounded-lg bg-white border border-gray-200 hover:bg-gray-50 focus:outline-none\">\n                        <span class=\"font-semibold text-gray-800\">${item.title}<\/span>\n                        <span class=\"transform transition-transform duration-300\">\n                            <svg class=\"w-5 h-5 text-gray-500\" fill=\"currentColor\" viewBox=\"0 0 24 24\"><path d=\"M19 9l-7 7-7-7\"><\/path><\/svg>\n                        <\/span>\n                    <\/button>\n                    <div class=\"accordion-content bg-white border-l border-r border-b border-gray-200 rounded-b-lg\">\n                        <p class=\"p-4 text-sm text-gray-600\">${item.content}<\/p>\n                    <\/div>`;\n                container.appendChild(div);\n            });\n            document.querySelectorAll('.accordion-toggle').forEach(btn => {\n                btn.addEventListener('click', () => {\n                    const content = btn.nextElementSibling;\n                    const icon = btn.querySelector('svg');\n                    \/\/ Toggle max-height to open\/close\n                    if (content.style.maxHeight && content.style.maxHeight !== '0px') {\n                        content.style.maxHeight = '0px';\n                        icon.classList.remove('rotate-180');\n                    } else {\n                        \/\/ Close all other accordions first\n                        document.querySelectorAll('.accordion-content').forEach(c => c.style.maxHeight = '0px');\n                        document.querySelectorAll('.accordion-toggle svg').forEach(i => i.classList.remove('rotate-180'));\n                        \n                        content.style.maxHeight = content.scrollHeight + \"px\";\n                        icon.classList.add('rotate-180');\n                    }\n                });\n            });\n        }\n    }\n\n    function setupNavHighlighting() {\n        const sections = document.querySelectorAll('main section');\n        const navLinks = document.querySelectorAll('header nav .nav-link'); \n        const mobileNavSelect = document.getElementById('mobile-nav-select');\n        \n        const onScroll = () => {\n            let current = '';\n            sections.forEach(section => {\n                const sectionTop = section.offsetTop;\n                const sectionHeight = section.clientHeight;\n                if (pageYOffset >= sectionTop - sectionHeight \/ 3) { \/\/ Adjust sensitivity\n                    current = section.id;\n                }\n            });\n\n            navLinks.forEach(link => {\n                link.classList.remove('active');\n                if (link.getAttribute('href') && link.getAttribute('href').includes(current)) {\n                    link.classList.add('active');\n                }\n            });\n\n            \/\/ Update mobile select if a section is active\n            if (mobileNavSelect) {\n                const currentActiveLink = document.querySelector('header nav .nav-link.active');\n                if (currentActiveLink) {\n                    const targetValue = currentActiveLink.getAttribute('href');\n                    if (mobileNavSelect.value !== targetValue) {\n                        mobileNavSelect.value = targetValue;\n                    }\n                }\n            }\n        };\n\n        window.addEventListener('scroll', onScroll);\n        \/\/ Initial call to set active section on load\n        onScroll();\n    }\n\n    function initTransferBalanceChart(data) {\n        const ctx = document.getElementById('transferBalanceChart').getContext('2d');\n        if (transferBalanceChart) transferBalanceChart.destroy();\n        const labels = Object.keys(data.transfers);\n        const values = Object.values(data.transfers).map(t => t.net_balance_value);\n        const backgroundColors = values.map(value => value >= 0 ? '#10b981' : '#ef4444');\n\n        transferBalanceChart = new Chart(ctx, {\n            type: 'bar',\n            data: {\n                labels: labels,\n                datasets: [{\n                    label: 'Balance Neto por Traspasos (\u20acM)',\n                    data: values,\n                    backgroundColor: backgroundColors,\n                    borderColor: backgroundColors.map(color => color === '#10b981' ? '#047857' : '#b91c1c'),\n                    borderWidth: 1,\n                    borderRadius: 5,\n                }]\n            },\n            options: {\n                ...globalChartOptions,\n                plugins: { ...globalChartOptions.plugins, legend: { display: false } },\n                scales: {\n                    ...globalChartOptions.scales,\n                    x: { ...globalChartOptions.scales.x, beginAtZero: true },\n                    y: { ...globalChartOptions.scales.y, ticks: { callback: function(value) { return value + 'M\u20ac'; } } }\n                }\n            }\n        });\n\n        const detailsContainer = document.getElementById('transfer-details-text');\n        if(detailsContainer) { \/\/ Defensive check\n            detailsContainer.innerHTML = '';\n            for (const year in data.transfers) {\n                const transferData = data.transfers[year];\n                const yearDiv = document.createElement('div');\n                yearDiv.className = 'primary-light-bg-color p-4 rounded-lg primary-border-color shadow-sm';\n                \n                let arrivalsHtml = transferData.arrivals.length > 0 ? `<p class=\"font-semibold text-gray-700 mt-2\">Llegadas:<\/p><ul class=\"list-disc list-inside text-sm text-gray-600 ml-4\">` : '';\n                transferData.arrivals.forEach(player => {\n                    arrivalsHtml += `<li>${player.name} (${player.fee || 'N\/D'} ${player.type ? ` - ${player.type}` : ''})<\/li>`;\n                });\n                if (transferData.arrivals.length > 0) arrivalsHtml += `<\/ul>`;\n\n                let salesHtml = transferData.sales.length > 0 ? `<p class=\"font-semibold text-gray-700 mt-2\">Salidas:<\/p><ul class=\"list-disc list-inside text-sm text-gray-600 ml-4\">` : '';\n                transferData.sales.forEach(player => {\n                    salesHtml += `<li>${player.name} (${player.fee || 'N\/D'} ${player.type ? ` - ${player.type}` : ''})<\/li>`;\n                });\n                if (transferData.sales.length > 0) salesHtml += `<\/ul>`;\n\n                yearDiv.innerHTML = `\n                    <h4 class=\"font-bold text-lg text-gray-800\">Temporada ${year}<\/h4>\n                    ${arrivalsHtml}\n                    ${salesHtml}\n                    <p class=\"font-semibold text-gray-700 mt-3\">Balance Neto por Traspasos:<\/p>\n                    <p class=\"text-sm text-gray-600\">${transferData.net_balance_text}. ${transferData.comment}<\/p>\n                `;\n                detailsContainer.appendChild(yearDiv);\n            }\n        }\n    }\n\n    function initCoachPerformanceCharts(data) {\n        const sortedCoaches = [...data.coaches].sort((a, b) => {\n            const winPctA = (a.record.V \/ a.totalGames) * 100 || 0; \/\/ Handle division by zero\n            const winPctB = (b.record.V \/ b.totalGames) * 100 || 0; \/\/ Handle division by zero\n            return winPctB - winPctA;\n        });\n\n        const coachLabels = sortedCoaches.map(c => c.name);\n        const coachWins = sortedCoaches.map(c => (c.record.V \/ c.totalGames * 100).toFixed(1));\n        const coachDraws = sortedCoaches.map(c => (c.record.E \/ c.totalGames * 100).toFixed(1));\n        const coachLosses = sortedCoaches.map(c => (c.record.D \/ c.totalGames * 100).toFixed(1));\n\n        const ctx = document.getElementById('coachPerformanceChart').getContext('2d');\n        if (coachPerformanceChart) coachPerformanceChart.destroy();\n        coachPerformanceChart = new Chart(ctx, {\n            type: 'bar',\n            data: {\n                labels: coachLabels,\n                datasets: [\n                    {\n                        label: 'Victorias %', data: coachWins, backgroundColor: '#10b981',\n                    },\n                    {\n                        label: 'Empates %', data: coachDraws, backgroundColor: '#facc15',\n                    },\n                    {\n                        label: 'Derrotas %', data: coachLosses, backgroundColor: '#ef4444',\n                    }\n                ]\n            },\n            options: {\n                ...globalChartOptions,\n                plugins: { ...globalChartOptions.plugins, legend: { position: 'top' } },\n                scales: {\n                    ...globalChartOptions.scales,\n                    x: { ...globalChartOptions.scales.x, stacked: true, beginAtZero: true, max: 100, ticks: { callback: val => val + '%' } },\n                    y: { ...globalChartOptions.scales.y, stacked: true, grid: { display: false } }\n                }\n            }\n        });\n\n        coachSelectionList = document.getElementById('coach-list-selection');\n        if(coachSelectionList) { \/\/ Defensive check\n            coachSelectionList.innerHTML = '';\n            sortedCoaches.forEach((coach, index) => {\n                const button = document.createElement('button');\n                button.textContent = coach.name;\n                button.className = 'coach-selectable-item text-gray-700 text-sm font-medium';\n                button.dataset.coachIndex = index;\n                button.addEventListener('click', () => updateCoachDetail(index, sortedCoaches, data)); \/\/ Pass data\n                coachSelectionList.appendChild(button);\n            });\n\n            if (sortedCoaches.length > 0) {\n                updateCoachDetail(0, sortedCoaches, data); \/\/ Pass data\n                coachSelectionList.children[0].classList.add('active');\n            }\n        }\n    }\n\n    function updateCoachDetail(coachIndex, coachesData, currentClubData) { \/\/ Accept currentClubData\n        const coach = coachesData[coachIndex];\n        const detailContainer = document.getElementById('coach-detail-stats');\n        if(detailContainer) { \/\/ Defensive check\n            detailContainer.style.display = 'block';\n            document.getElementById('coach-detail-name').textContent = coach.name;\n            document.getElementById('coach-detail-period').textContent = `Periodo: ${coach.start} - ${coach.end} (${getDurationInMonths(coach.start, coach.end)}) | R\u00e9cord total: ${coach.record.V}V - ${coach.record.E}E - ${coach.record.D}D | Partidos totales: ${coach.totalGames}`;\n\n            document.querySelectorAll('.coach-selectable-item').forEach(btn => btn.classList.remove('active'));\n            if (coachSelectionList && coachSelectionList.children[coachIndex]) {\n                coachSelectionList.children[coachIndex].classList.add('active');\n            }\n\n            if (coachHomeStatsChart) coachHomeStatsChart.destroy();\n            if (coachAwayStatsChart) coachAwayStatsChart.destroy();\n\n            const totalHomeGames = coach.homeStats.V + coach.homeStats.E + coach.homeStats.D;\n            const homeWinsPct = totalHomeGames > 0 ? (coach.homeStats.V \/ totalHomeGames * 100).toFixed(1) : 0;\n            const homeDrawsPct = totalHomeGames > 0 ? (coach.homeStats.E \/ totalHomeGames * 100).toFixed(1) : 0;\n            const homeLossesPct = totalHomeGames > 0 ? (coach.homeStats.D \/ totalHomeGames * 100).toFixed(1) : 0;\n\n            const ctxHome = document.getElementById('coachHomeStatsChart').getContext('2d');\n            coachHomeStatsChart = new Chart(ctxHome, {\n                type: 'bar',\n                data: {\n                    labels: ['Victorias', 'Empates', 'Derrotas'],\n                    datasets: [{\n                        label: 'Partidos en Casa',\n                        data: [homeWinsPct, homeDrawsPct, homeLossesPct],\n                        backgroundColor: ['#10b981', '#facc15', '#ef4444'],\n                        borderColor: '#ffffff',\n                        borderWidth: 1,\n                    }]\n                },\n                options: {\n                    ...globalChartOptions,\n                    plugins: { ...globalChartOptions.plugins, legend: { display: false }, title: { display: true, text: `Rendimiento en Casa (${totalHomeGames} partidos)`, font: { size: 14 } } },\n                    scales: { \n                        ...globalChartOptions.scales,\n                        x: { ...globalChartOptions.scales.x, stacked: true, ticks: { callback: val => val + '%' } },\n                        y: { ...globalChartOptions.scales.y, stacked: true, beginAtZero: true, grid: { color: currentClubData.lightColor } }\n                    }\n                }\n            });\n\n            const totalAwayGames = coach.awayStats.V + coach.awayStats.E + coach.awayStats.D;\n            const awayWinsPct = totalAwayGames > 0 ? (coach.awayStats.V \/ totalAwayGames * 100).toFixed(1) : 0;\n            const awayDrawsPct = totalAwayGames > 0 ? (coach.awayStats.E \/ totalAwayGames * 100).toFixed(1) : 0;\n            const awayLossesPct = totalAwayGames > 0 ? (coach.awayStats.D \/ totalAwayGames * 100).toFixed(1) : 0;\n\n            const ctxAway = document.getElementById('coachAwayStatsChart').getContext('2d');\n            coachAwayStatsChart = new Chart(ctxAway, {\n                type: 'bar',\n                data: {\n                    labels: ['Victorias', 'Empates', 'Derrotas'],\n                    datasets: [{\n                        label: 'Partidos Fuera',\n                        data: [awayWinsPct, awayDrawsPct, awayLossesPct],\n                        backgroundColor: ['#10b981', '#facc15', '#ef4444'],\n                        borderColor: '#ffffff',\n                        borderWidth: 1,\n                    }]\n                },\n                options: {\n                    ...globalChartOptions,\n                    plugins: { ...globalChartOptions.plugins, legend: { display: false }, title: { display: true, text: `Rendimiento Fuera de Casa (${totalAwayGames} partidos)`, font: { size: 14 } } },\n                    scales: { \n                        ...globalChartOptions.scales,\n                        x: { ...globalChartOptions.scales.x, stacked: true, ticks: { callback: val => val + '%' } },\n                        y: { ...globalChartOptions.scales.y, stacked: true, beginAtZero: true, grid: { color: currentClubData.lightColor } }\n                    }\n                }\n            });\n        }\n    }\n\n    function createPlayerStatsTable(data, season) {\n        const tableBody = document.getElementById('player-stats-table');\n        if(tableBody) { \/\/ Defensive check\n            tableBody.innerHTML = '';\n            const players = data.playerStats[season] || [];\n\n            players.forEach(player => {\n                const row = document.createElement('tr');\n                row.className = 'border-b border-gray-100 last:border-b-0';\n                row.innerHTML = `\n                    <td class=\"py-2 px-4 text-gray-800\">${player.name}<\/td>\n                    <td class=\"py-2 px-4 text-gray-600\">${player.yellowCards}<\/td>\n                    <td class=\"py-2 px-4 text-gray-600\">${player.redCards}<\/td>\n                    <td class=\"py-2 px-4 text-gray-600\">${player.mvpAwards}<\/td>\n                `;\n                tableBody.appendChild(row);\n            });\n        }\n    }\n\n    function createPlayerStatsFilters(data) {\n        const container = document.getElementById('player-stats-filters');\n        if(container) { \/\/ Defensive check\n            container.innerHTML = '';\n            const seasons = Object.keys(data.playerStats).sort().reverse(); \n\n            seasons.forEach((season, index) => {\n                const button = document.createElement('button');\n                button.textContent = season;\n                button.className = 'filter-btn px-3 py-1.5 text-sm font-medium rounded-md';\n                if (index === 0) button.classList.add('active');\n                button.addEventListener('click', () => {\n                    document.querySelectorAll('#player-stats-filters .filter-btn').forEach(btn => btn.classList.remove('active'));\n                    button.classList.add('active');\n                    createPlayerStatsTable(data, season); \n                });\n                container.appendChild(button);\n            });\n            if (seasons.length > 0) createPlayerStatsTable(data, seasons[0]); \n        }\n    }\n\n    function createCoachRanking(data) {\n        const rankingList = document.getElementById('coach-ranking-list');\n        if(rankingList) { \/\/ Defensive check\n            rankingList.innerHTML = '';\n\n            const rankedCoaches = [...data.coaches].map(coach => ({\n                name: coach.name,\n                winPct: coach.totalGames > 0 ? (coach.record.V \/ coach.totalGames * 100).toFixed(1) : 0,\n                totalPoints: (coach.record.V * 3 + coach.record.E * 1) \n            })).sort((a, b) => b.winPct - a.winPct);\n\n            rankedCoaches.forEach((coach, index) => {\n                const listItem = document.createElement('li');\n                listItem.innerHTML = `<strong>${index + 1}. ${coach.name}<\/strong>: ${coach.winPct}% de Victorias (${coach.totalPoints} puntos)`;\n                rankingList.appendChild(listItem);\n            });\n        }\n    }\n\n    function createKeyPlayers(data) {\n        const container = document.getElementById('key-players');\n        if(container) { \/\/ Defensive check\n            container.innerHTML = '';\n            data.keyPlayers.forEach(p => {\n                const div = document.createElement('div');\n                div.className = 'p-3 primary-light-bg-color rounded-lg primary-border-color';\n                div.innerHTML = `<p class=\"font-semibold text-gray-800 text-sm\">${p.name} (${p.role})<\/p><p class=\"text-xs text-gray-700 mt-1\">${p.contribution}<\/p>`;\n                container.appendChild(div);\n            });\n        }\n    }\n\n    function createLeastPlayedPlayers(data) {\n        const container = document.getElementById('least-played-players');\n        if(container) { \/\/ Defensive check\n            container.innerHTML = '';\n            data.leastPlayedPlayers.forEach(p => {\n                const div = document.createElement('div');\n                div.className = 'p-2 bg-gray-50 rounded-lg border border-gray-200';\n                div.innerHTML = `<p class=\"font-semibold text-gray-800 text-sm\">${p.name} (${p.position})<\/p><p class=\"text-xs text-gray-600 mt-1\">Minutos: ${p.minutes}<\/p><p class=\"text-xs text-gray-500\">${p.comment}<\/p>`;\n                container.appendChild(div);\n            });\n        }\n    }\n\n    function updateGovernanceSection(data) {\n        const governanceTitleMain = document.getElementById('governance-title-main');\n        const governanceIntroText = document.getElementById('governance-intro-text');\n        const figuresContainer = document.getElementById('governance-key-figures');\n\n        if(governanceTitleMain) governanceTitleMain.textContent = data.governanceTitleMain;\n        if(governanceIntroText) governanceIntroText.innerHTML = data.governanceIntro; \n        if(figuresContainer) { \/\/ Defensive check\n            figuresContainer.innerHTML = '';\n            data.governanceFigures.forEach(figure => {\n                const div = document.createElement('div');\n                div.className = 'flex items-start space-x-4';\n                div.innerHTML = `\n                    <div class=\"flex-shrink-0 h-10 w-10 flex items-center justify-center rounded-full primary-light-bg-color primary-text-color font-bold\">${figure.type}<\/div>\n                    <div>\n                        <p class=\"font-semibold text-gray-800\">${figure.name}<\/p>\n                        <p class=\"text-sm text-gray-500\">${figure.role}<\/p>\n                    <\/div>\n                `;\n                figuresContainer.appendChild(div);\n                \/\/ Add separator only for Sevilla's conflict\n                if (currentClub === 'sevilla' && figure.type === 'JB') { \n                    const separator = document.createElement('div');\n                    separator.className = 'flex items-center justify-center -my-2';\n                    separator.innerHTML = `<span class=\"primary-text-color font-bold text-2xl\">&#x2195;<\/span>`;\n                    figuresContainer.appendChild(separator);\n                }\n            });\n        }\n    }\n\n    function updatePrensaAficionSection(data) {\n        createPressArticles(data);\n        generateList('social-media-echoes', data.socialMediaEchoes, 'flex items-start', '<span class=\"primary-text-color mr-3 mt-1\">&#9679;<\/span>');\n        createJudicialCalendar(data);\n        const quotesContainer = document.getElementById('impactful-quotes');\n        if(quotesContainer) { \/\/ Defensive check\n            quotesContainer.innerHTML = '';\n            data.impactfulQuotes.forEach(quote => {\n                const blockquote = document.createElement('blockquote');\n                blockquote.className = `border-l-4 primary-border-color pl-4 italic text-gray-700`;\n                blockquote.textContent = quote;\n                quotesContainer.appendChild(blockquote);\n            });\n        }\n    }\n\n    function updateRisksFutureSection(data) {\n        createAccordion('scenarios-accordion', data.scenarios);\n        generateList('recommendations-list', data.recommendations.map((r, i) => `<strong>${i+1}. ${r}<\/strong>`), 'p-4 rounded-lg bg-white border border-gray-200 text-gray-700 text-sm');\n    }\n\n    \/\/ New President League Charts\n    function initPresidentLeagueCharts(selectedYear = '2024-25') {\n        const presidentLabels = ['Positivo (%)', 'Negativo (%)'];\n        \n        const sevillaPresidentData = clubData.sevilla.presidentSentiment[selectedYear] || {};\n        const betisPresidentData = clubData.betis.presidentSentiment[selectedYear] || {};\n\n        \/\/ Define years outside the conditional blocks for broader scope\n        const allYears = new Set();\n        Object.keys(clubData.sevilla.presidentSentiment || {}).forEach(year => allYears.add(year));\n        Object.keys(clubData.betis.presidentSentiment || {}).forEach(year => allYears.add(year));\n        const years = Array.from(allYears).sort();\n\n        const ctx = document.getElementById('presidentSentimentChart')?.getContext('2d'); \/\/ Use optional chaining\n        if (presidentSentimentChart) presidentSentimentChart.destroy();\n        if (ctx) { \/\/ Defensive check for canvas context\n            presidentSentimentChart = new Chart(ctx, {\n                type: 'bar',\n                data: {\n                    labels: presidentLabels,\n                    datasets: [\n                        {\n                            label: 'Sevilla FC (DNC)',\n                            data: [sevillaPresidentData.positive || 0, sevillaPresidentData.negative || 0],\n                            backgroundColor: [clubData.sevilla.primaryColor, '#ef4444'], \/\/ Red for negative\n                            borderColor: [clubData.sevilla.primaryColor, '#b91c1c'],\n                            borderWidth: 1,\n                            borderRadius: 5,\n                        },\n                        {\n                            label: 'Real Betis (AH)',\n                            data: [betisPresidentData.positive || 0, betisPresidentData.negative || 0],\n                            backgroundColor: [clubData.betis.primaryColor, '#22c55e'], \/\/ Green for positive, use Betis color\n                            borderColor: [clubData.betis.primaryColor, '#16a34a'],\n                            borderWidth: 1,\n                            borderRadius: 5,\n                        }\n                    ]\n                },\n                options: {\n                    ...globalChartOptions,\n                    plugins: { ...globalChartOptions.plugins, legend: { position: 'top' } },\n                    scales: {\n                        ...globalChartOptions.scales,\n                        x: { ...globalChartOptions.scales.x, beginAtZero: true, max: 100, ticks: { callback: val => val + '%' } },\n                        y: { ...globalChartOptions.scales.y, grid: { display: false } }\n                    }\n                }\n            });\n        }\n\n        const mentionsTableBody = document.getElementById('president-mentions-table-body');\n        if (mentionsTableBody) { \/\/ Defensive check for mentionsTableBody\n            mentionsTableBody.innerHTML = '';\n            \n            const tableHeader = document.getElementById('president-mentions-table-header');\n            if (tableHeader) { \/\/ Defensive check for tableHeader\n                tableHeader.innerHTML = '<th class=\"py-2 px-4\">Presidente<\/th>';\n\n                years.forEach(year => {\n                    tableHeader.innerHTML += `<th class=\"py-2 px-4 text-center\">${year}<\/th>`;\n                });\n            }\n            \n            const rowDNC = document.createElement('tr');\n            rowDNC.innerHTML = `<td class=\"py-2 px-4 font-semibold\">Jos\u00e9 Mar\u00eda Del Nido Carrasco<\/td>`;\n            years.forEach(year => {\n                const mentions = clubData.sevilla.presidentSentiment[year]?.totalMentions || 0;\n                rowDNC.innerHTML += `<td class=\"py-2 px-4 text-center\">${mentions.toLocaleString()}<\/td>`;\n            });\n            mentionsTableBody.appendChild(rowDNC);\n\n            const rowAH = document.createElement('tr');\n            rowAH.innerHTML = `<td class=\"py-2 px-4 font-semibold\">\u00c1ngel Haro<\/td>`;\n            years.forEach(year => {\n                const mentions = clubData.betis.presidentSentiment[year]?.totalMentions || 0;\n                rowAH.innerHTML += `<td class=\"py-2 px-4 text-center\">${mentions.toLocaleString()}<\/td>`;\n            });\n            mentionsTableBody.appendChild(rowAH);\n        }\n\n        const filterButtonsContainer = document.getElementById('president-year-filters');\n        if (filterButtonsContainer) { \/\/ Defensive check for filterButtonsContainer\n            filterButtonsContainer.innerHTML = '';\n            years.reverse().forEach(year => {\n                const button = document.createElement('button');\n                button.textContent = year;\n                button.className = 'filter-btn px-3 py-1.5 text-sm font-medium rounded-md';\n                if (year === selectedYear) {\n                    button.classList.add('active');\n                }\n                button.addEventListener('click', () => {\n                    document.querySelectorAll('#president-year-filters .filter-btn').forEach(btn => btn.classList.remove('active'));\n                    button.classList.add('active');\n                    initPresidentLeagueCharts(year);\n                });\n                filterButtonsContainer.appendChild(button);\n            });\n        }\n    }\n\n    \/\/ New Fan League Charts\n    function initFanLeagueCharts(allClubData) {\n        const allFanYears = new Set();\n        Object.keys(allClubData.sevilla.fanStats || {}).forEach(year => allFanYears.add(year)); \n        Object.keys(allClubData.betis.fanStats || {}).forEach(year => allFanYears.add(year)); \n        const fanYears = Array.from(allFanYears).sort();\n\n        const getFanStat = (clubName, year, metric) => {\n            const yearData = allClubData[clubName]?.fanStats?.[year]; \n            return (yearData && yearData[metric] !== undefined) ? yearData[metric] : 0;\n        };\n\n        const socialGrowthCtx = document.getElementById('socialGrowthChart');\n        if (socialGrowthCtx) { \/\/ Defensive check for socialGrowthCtx\n            const ctx = socialGrowthCtx.getContext('2d');\n            if (socialGrowthChart) socialGrowthChart.destroy();\n            socialGrowthChart = new Chart(ctx, {\n                type: 'line', \n                data: {\n                    labels: fanYears,\n                    datasets: [\n                        {\n                            label: 'Sevilla FC',\n                            data: fanYears.map(year => getFanStat('sevilla', year, 'socialGrowth')), \n                            borderColor: allClubData.sevilla.primaryColor,\n                            backgroundColor: `${allClubData.sevilla.primaryColor}1A`,\n                            fill: true,\n                            tension: 0.3\n                        },\n                        {\n                            label: 'Real Betis',\n                            data: fanYears.map(year => getFanStat('betis', year, 'socialGrowth')), \n                            borderColor: allClubData.betis.primaryColor,\n                            backgroundColor: `${allClubData.betis.primaryColor}1A`,\n                            fill: true,\n                            tension: 0.3\n                        }\n                    ]\n                },\n                options: {\n                    ...globalChartOptions,\n                    plugins: { ...globalChartOptions.plugins, legend: { position: 'top' } },\n                    scales: { \n                        ...globalChartOptions.scales, \n                        y: { ...globalChartOptions.scales.y, beginAtZero: true, ticks: { callback: val => val + '%' } } \n                    }\n                }\n            });\n        }\n\n\n        const stadiumAttendanceCtx = document.getElementById('stadiumAttendanceChart');\n        if (stadiumAttendanceCtx) { \/\/ Defensive check for stadiumAttendanceCtx\n            const ctx = stadiumAttendanceCtx.getContext('2d');\n            if (stadiumAttendanceChart) stadiumAttendanceChart.destroy();\n            stadiumAttendanceChart = new Chart(ctx, {\n                type: 'line', \n                data: {\n                    labels: fanYears,\n                    datasets: [\n                        {\n                            label: 'Sevilla FC',\n                            data: fanYears.map(year => getFanStat('sevilla', year, 'stadiumAttendance')), \n                            borderColor: allClubData.sevilla.primaryColor,\n                            backgroundColor: `${allClubData.sevilla.primaryColor}1A`,\n                            fill: true,\n                            tension: 0.3\n                        },\n                        {\n                            label: 'Real Betis',\n                            data: fanYears.map(year => getFanStat('betis', year, 'stadiumAttendance')), \n                            borderColor: allClubData.betis.primaryColor,\n                            backgroundColor: `${allClubData.betis.primaryColor}1A`,\n                            fill: true,\n                            tension: 0.3\n                        }\n                    ]\n                },\n                options: {\n                    ...globalChartOptions,\n                    plugins: { ...globalChartOptions.plugins, legend: { position: 'top' } },\n                    scales: { \n                        ...globalChartOptions.scales, \n                        y: { ...globalChartOptions.scales.y, beginAtZero: true, ticks: { callback: val => val + ' espectadores' } } \n                    }\n                }\n            });\n        }\n\n        const socialSentimentOverallCtx = document.getElementById('socialSentimentOverallChart');\n        if (socialSentimentOverallCtx) { \/\/ Defensive check for socialSentimentOverallCtx\n            const ctx = socialSentimentOverallCtx.getContext('2d');\n            if (socialSentimentOverallChart) socialSentimentOverallChart.destroy();\n            socialSentimentOverallChart = new Chart(ctx, {\n                type: 'line', \n                data: {\n                    labels: fanYears,\n                    datasets: [\n                        {\n                            label: 'Sevilla FC',\n                            data: fanYears.map(year => getFanStat('sevilla', year, 'socialSentiment')), \n                            borderColor: allClubData.sevilla.primaryColor,\n                            backgroundColor: `${allClubData.sevilla.primaryColor}1A`,\n                            fill: true,\n                            tension: 0.3\n                        },\n                        {\n                            label: 'Real Betis',\n                            data: fanYears.map(year => getFanStat('betis', year, 'socialSentiment')), \n                            borderColor: allClubData.betis.primaryColor,\n                            backgroundColor: `${allClubData.betis.primaryColor}1A`,\n                            fill: true,\n                            tension: 0.3\n                        }\n                    ]\n                },\n                options: {\n                    ...globalChartOptions,\n                    plugins: { ...globalChartOptions.plugins, legend: { position: 'top' } },\n                    scales: { \n                        ...globalChartOptions.scales, \n                        y: { ...globalChartOptions.scales.y, beginAtZero: true, max: 100, ticks: { callback: val => val + '\/100' } } \n                    }\n                }\n            });\n        }\n\n        const fanLoyaltyCtx = document.getElementById('fanLoyaltyChart');\n        if (fanLoyaltyCtx) { \/\/ Defensive check for fanLoyaltyCtx\n            const ctx = fanLoyaltyCtx.getContext('2d');\n            if (fanLoyaltyChart) fanLoyaltyChart.destroy();\n            fanLoyaltyChart = new Chart(ctx, {\n                type: 'line', \n                data: {\n                    labels: fanYears,\n                    datasets: [\n                        {\n                            label: 'Sevilla FC',\n                            data: fanYears.map(year => getFanStat('sevilla', year, 'fanLoyalty')), \n                            borderColor: allClubData.sevilla.primaryColor,\n                            backgroundColor: `${allClubData.sevilla.primaryColor}1A`,\n                            fill: true,\n                            tension: 0.3\n                        },\n                        {\n                            label: 'Real Betis',\n                            data: fanYears.map(year => getFanStat('betis', year, 'fanLoyalty')), \n                            borderColor: allClubData.betis.primaryColor,\n                            backgroundColor: `${allClubData.betis.primaryColor}1A`,\n                            fill: true,\n                            tension: 0.3\n                        }\n                    ]\n                },\n                options: {\n                    ...globalChartOptions,\n                    plugins: { ...globalChartOptions.plugins, legend: { position: 'top' } },\n                    scales: { \n                        ...globalChartOptions.scales, \n                        y: { ...globalChartOptions.scales.y, beginAtZero: true, max: 100, ticks: { callback: val => val + '\/100' } } \n                    }\n                }\n            });\n        }\n    }\n\n    function initTopScorersDerby() { \/\/ Removed season parameter from here, will be picked from currentTopScorersSeason\n        const topScorersTable = document.getElementById('top-scorers-table');\n        if (topScorersTable) { \/\/ Defensive check for topScorersTable\n            topScorersTable.innerHTML = '';\n\n            const clubFiltersContainer = document.getElementById('top-scorers-club-filters');\n            const seasonFiltersContainer = document.getElementById('top-scorers-season-filters');\n\n            \/\/ Populate club filters (only once)\n            if (clubFiltersContainer && clubFiltersContainer.children.length === 0) {\n                ['sevilla', 'betis'].forEach(clubKey => {\n                    const button = document.createElement('button');\n                    button.textContent = clubData[clubKey].name;\n                    button.className = 'filter-btn px-3 py-1.5 text-sm font-medium rounded-md';\n                    button.dataset.club = clubKey;\n                    button.addEventListener('click', () => {\n                        document.querySelectorAll('#top-scorers-club-filters .filter-btn').forEach(btn => btn.classList.remove('active'));\n                        button.classList.add('active');\n                        currentTopScorersClub = clubKey;\n                        updateTopScorersTable();\n                    });\n                    clubFiltersContainer.appendChild(button);\n                });\n                clubFiltersContainer.querySelector(`[data-club=\"${currentTopScorersClub}\"]`).classList.add('active');\n            }\n\n            \/\/ Determine all unique seasons available in topScorers data for *both* clubs\n            const allSeasons = new Set();\n            Object.keys(clubData).forEach(clubKey => {\n                if (clubData[clubKey].topScorers) {\n                    clubData[clubKey].topScorers.forEach(scorer => {\n                        if (scorer.season) allSeasons.add(scorer.season);\n                    });\n                }\n            });\n            const seasons = Array.from(allSeasons).sort().reverse(); \/\/ Sort descending for latest first\n\n            \/\/ Populate season filters (only once)\n            if (seasonFiltersContainer && seasonFiltersContainer.children.length === 0) {\n                seasons.forEach(season => {\n                    const button = document.createElement('button');\n                    button.textContent = season;\n                    button.className = 'filter-btn px-3 py-1.5 text-sm font-medium rounded-md';\n                    button.dataset.season = season;\n                    button.addEventListener('click', () => {\n                        document.querySelectorAll('#top-scorers-season-filters .filter-btn').forEach(btn => btn.classList.remove('active'));\n                        button.classList.add('active');\n                        currentTopScorersSeason = season;\n                        updateTopScorersTable();\n                    });\n                    seasonFiltersContainer.appendChild(button);\n                });\n                \/\/ Set initial active season, default to latest if currentTopScorersSeason isn't in available seasons\n                if (!seasons.includes(currentTopScorersSeason) && seasons.length > 0) {\n                    currentTopScorersSeason = seasons[0]; \/\/ Set to latest season\n                }\n                seasonFiltersContainer.querySelector(`[data-season=\"${currentTopScorersSeason}\"]`).classList.add('active');\n            }\n            \n            updateTopScorersTable(); \/\/ Initial call to populate the table\n        }\n    }\n\n    \/\/ New function to update the top scorers table based on selected filters\n    function updateTopScorersTable() {\n        const topScorersTableBody = document.getElementById('top-scorers-table');\n        if (!topScorersTableBody) return;\n        topScorersTableBody.innerHTML = '';\n\n        const clubKey = currentTopScorersClub;\n        const season = currentTopScorersSeason;\n\n        let scorersForSelectedClubAndSeason = [];\n        if (clubData[clubKey] && clubData[clubKey].topScorers) {\n            scorersForSelectedClubAndSeason = clubData[clubKey].topScorers.filter(s => s.season === season);\n        }\n\n        scorersForSelectedClubAndSeason.sort((a, b) => b.goals - a.goals); \/\/ Sort by goals, descending\n\n        scorersForSelectedClubAndSeason.forEach((scorer, index) => {\n            const row = document.createElement('tr');\n            row.className = 'border-b border-gray-100 last:border-b-0';\n            row.innerHTML = `\n                <td class=\"py-2 px-4 text-gray-800 font-semibold\">${index + 1}.<\/td>\n                <td class=\"py-2 px-4 text-gray-800\">${scorer.name}<\/td>\n                <td class=\"py-2 px-4 text-gray-600\">${scorer.club}<\/td>\n                <td class=\"py-2 px-4 text-gray-600 text-center\">${scorer.goals}<\/td>\n            `;\n            topScorersTableBody.appendChild(row);\n        });\n    }\n\n\n    \/\/ Main render function based on selected club\n    function renderClubData(clubName, scrollToSectionId = null) {\n        const data = clubData[clubName];\n        setClubColors(clubName);\n        updateKpiSection(data);\n        initPerformanceChart(data);\n        createFinancialFilters(data);\n        initTransferBalanceChart(data);\n        initCoachPerformanceCharts(data);\n        createPlayerStatsFilters(data);\n        createCoachRanking(data);\n        createKeyPlayers(data);\n        createLeastPlayedPlayers(data);\n        generateList('management-critics', data.managementCritics, 'flex items-start', '<span class=\"primary-text-color mr-3 mt-1\">&#10007;<\/span>');\n        updateGovernanceSection(data);\n        initReputationChart(data);\n        updatePrensaAficionSection(data);\n        updateRisksFutureSection(data);\n        \n        \/\/ Initialize new comparative charts (always for both clubs data)\n        initPresidentLeagueCharts(); \/\/ Initialize with default year\n        initFanLeagueCharts(clubData); \/\/ Pass allClubData directly here\n        initTopScorersDerby(); \/\/ Call initTopScorersDerby to setup filters and initial table\n\n        \/\/ Update the compare buttons' text for all sections\n        document.querySelectorAll('.compare-rival-btn').forEach(button => {\n            const rivalName = clubName === 'sevilla' ? clubData.betis.name : clubData.sevilla.name;\n            button.textContent = `Comparar con ${rivalName}`;\n        });\n\n        if (scrollToSectionId) {\n            document.getElementById(scrollToSectionId).scrollIntoView({ behavior: 'smooth', block: 'start' });\n        }\n    }\n\n    \/\/ Event listeners for club selection buttons (main header buttons)\n    document.getElementById('select-sevilla').addEventListener('click', function() {\n        if (currentClub === 'sevilla') return; \n        currentClub = 'sevilla';\n        \/\/ Reset top scorers filters to default club\/season for new club view\n        currentTopScorersClub = 'sevilla';\n        currentTopScorersSeason = '2024-25'; \/\/ Or determine latest common season\n        renderClubData(currentClub);\n    });\n\n    document.getElementById('select-betis').addEventListener('click', function() {\n        if (currentClub === 'betis') return; \n        currentClub = 'betis';\n        \/\/ Reset top scorers filters to default club\/season for new club view\n        currentTopScorersClub = 'betis';\n        currentTopScorersSeason = '2024-25'; \/\/ Or determine latest common season\n        renderClubData(currentClub);\n    });\n\n    \/\/ Event listeners for new compare buttons within sections\n    document.querySelectorAll('.compare-rival-btn').forEach(button => {\n        button.addEventListener('click', function() {\n            const sectionId = this.dataset.sectionId; \/\/ Get the section ID from data attribute\n            const oldClub = currentClub;\n            currentClub = (oldClub === 'sevilla') ? 'betis' : 'sevilla';\n            \/\/ When using compare-rival-btn, also update the top scorers filter to the new club\n            currentTopScorersClub = currentClub;\n            renderClubData(currentClub, sectionId); \/\/ Pass the section ID to scroll to\n        });\n    });\n    \n    \/\/ Add event listeners for main navigation links to scroll to section\n    const desktopNavLinks = document.querySelectorAll('header nav .nav-link');\n    desktopNavLinks.forEach(link => {\n        link.addEventListener('click', function(e) {\n            e.preventDefault();\n            const targetId = this.getAttribute('href');\n            document.querySelector(targetId).scrollIntoView({ behavior: 'smooth', block: 'start' });\n        });\n    });\n\n    \/\/ Add event listener for mobile navigation select\n    const mobileNavSelect = document.getElementById('mobile-nav-select');\n    if (mobileNavSelect) {\n        mobileNavSelect.addEventListener('change', function(e) {\n            const targetId = e.target.value;\n            document.querySelector(targetId).scrollIntoView({ behavior: 'smooth', block: 'start' });\n        });\n    }\n\n    \/\/ Initial render for Sevilla FC\n    renderClubData(currentClub);\n\n});\n<\/script>\n<\/body>\n<\/html>\n\n","protected":false},"excerpt":{"rendered":"<p>Derbi de Medios: Sevilla vs Betis &#8211; An\u00e1lisis Estrat\u00e9gico Diagn\u00f3stico Comparativo Sevilla FC Real Betis Inicio Estado Actual Deportivo Financiero Gobernanza Presidentes Aficiones Goleadores Prensa &#038; Judicial Riesgos &#038; Futuro InicioEstado ActualAn\u00e1lisis DeportivoAn\u00e1lisis FinancieroGobernanzaPresidentesAficionesGoleadoresPrensa &#038; JudicialRiesgos &#038; Futuro El Derbi se Juega con Datos Bienvenido a este an\u00e1lisis estrat\u00e9gico comparativo. Aqu\u00ed podr\u00e1s sumergirte en las&#8230;<\/p>\n","protected":false},"author":1,"featured_media":187,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-190","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/buscomunicacion.com\/wp-content\/uploads\/2025\/06\/Analisis-Estrategico_-Derbi-Sevilla-Betis_edited.png?fit=800%2C800&ssl=1","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/sgDuos-190","_links":{"self":[{"href":"https:\/\/buscomunicacion.com\/index.php\/wp-json\/wp\/v2\/posts\/190","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buscomunicacion.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buscomunicacion.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buscomunicacion.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buscomunicacion.com\/index.php\/wp-json\/wp\/v2\/comments?post=190"}],"version-history":[{"count":12,"href":"https:\/\/buscomunicacion.com\/index.php\/wp-json\/wp\/v2\/posts\/190\/revisions"}],"predecessor-version":[{"id":208,"href":"https:\/\/buscomunicacion.com\/index.php\/wp-json\/wp\/v2\/posts\/190\/revisions\/208"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buscomunicacion.com\/index.php\/wp-json\/wp\/v2\/media\/187"}],"wp:attachment":[{"href":"https:\/\/buscomunicacion.com\/index.php\/wp-json\/wp\/v2\/media?parent=190"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buscomunicacion.com\/index.php\/wp-json\/wp\/v2\/categories?post=190"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buscomunicacion.com\/index.php\/wp-json\/wp\/v2\/tags?post=190"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}