<div class='page-title-container'>
  <h2 class='world-detail-title'>%%WORLD_DISPLAY_NAME_PAGE%%</h2>
</div>

<div class="close-button-container">
    <a href="worlds.html" class="close-button" title="Zurück zur Weltenübersicht"><b>X</b></a>
</div>

<div class="responsive-nav">
    <button id="burger-menu-toggle" class="burger-menu" aria-label="Menü öffnen/schließen">
        <span></span>
        <span></span>
        <span></span>
    </button>

    <div class='page-nav-buttons' id="page-nav-buttons-container-%%current_world_key%%">
        <a href='#server-info' class='button'>Server-Info</a> 
        <a href='#server-verbindung' class='button'>Verbindung</a> 
        <a href='#welt-admin' class='button'>Admin</a> 
        <a href='#beschreibung' class='button'>Beschreibung</a>
        <a href='#spielregeln' class='button'>Spielregeln</a>
        <a href='#weltradar' class='button'>Radar</a> 
        <a href='#mods' class='button'>Mods</a> 
        <a href='#spielerliste' class='button'>Spielerliste</a>
    </div>
</div>


<div id='server-info' class='info-box server-details'>
  <h3>Server-Info</h3>
  <p><strong>Status:</strong> <span class='status-dot' id='status-dot-%%current_world_key%%'></span><span id='world-status-%%current_world_key%%' class='status-text status-loading'>%%STATUS_TEXT_FALLBACK_PAGE%%</span></p>
  <p><strong>Spiel:</strong> <a href='https://content.luanti.org/packages/?type=game&q=%%MT_GAMEID%%' target='_blank' rel='noopener noreferrer'>%%MT_GAMEID%%</a></p>
  <p><strong>Kreativmodus:</strong> <span class='status-text-colored %%creative_text_class%%'>%%creative_text%%</span></p>
  <p><strong>Schaden:</strong> <span class='status-text-colored %%damage_text_class%%'>%%damage_text%%</span></p>
</div>

<div id='server-verbindung' class='info-box server-details'>
  <h3>Server-Verbindung</h3>
  <p><strong>Adresse:</strong> <span id='addr-%%current_world_key%%'>%%SERVER_ADDRESS_PAGE%%</span><button title='Adresse kopieren' class='copy-button' onclick='copyToClipboard("addr-%%current_world_key%%")'>📋</button></p>
  <p><strong>Port:</strong> <span id='port-%%current_world_key%%'>%%SERVER_PORT_PAGE%%</span><button title='Port kopieren' class='copy-button' onclick='copyToClipboard("port-%%current_world_key%%")'>📋</button></p>
  <p><strong>Passwort:</strong> <span id='pass-%%current_world_key%%'>%%SERVER_ACCESS_INFO_PAGE%%</span><button title='Info kopieren' class='copy-button' onclick='copyToClipboard("pass-%%current_world_key%%")'>📋</button></p>
</div>

<div id='welt-admin' class='admin-section'>
  <h3>Welt-Admin</h3>
  <div class='admin-grid'>
    %%ADMIN_BOXES_HTML%%
  </div>
</div>

<script>
// === Globale Variablen für Spielerliste und Karte ===
let map_%%current_world_key%%;
let playerMarkers_%%current_world_key%% = {};
let masterPlayerData_%%current_world_key%% = {};
let playerFilters_%%current_world_key%% = {
    activeOnly: false,
    privileges: new Set()
};

// === Hilfsfunktionen ===
function copyToClipboard(elementId) { const el = document.getElementById(elementId); if(el) { navigator.clipboard.writeText(el.innerText || el.textContent).then(() => { const btn = el.nextElementSibling; if(btn && btn.classList.contains('copy-button')) { const orig_btn_text = btn.innerHTML; btn.innerHTML = '✓'; setTimeout(() => { btn.innerHTML = orig_btn_text; }, 1500); } else { alert('Kopiert: ' + el.innerText); } }).catch(err => console.error('Fehler Kopieren: ', err));}}
function formatTimestampForDisplay(epochSeconds) { if (!epochSeconds || epochSeconds == 0) return 'unbekannt'; const date = new Date(epochSeconds * 1000); return date.toLocaleString('de-DE', { day: '2-digit', month: '2-digit', year: 'numeric', hour: '2-digit', minute: '2-digit', second: '2-digit'}) + ' Uhr';}

// === Status- und Datenabruf ===
function fetchWorldStatus_%%current_world_key%%() {
    const statusTextEl = document.getElementById('world-status-%%current_world_key%%');
    const statusDotEl = document.getElementById('status-dot-%%current_world_key%%');
    if (!statusTextEl || !statusDotEl) return;
    const onlineStatusUrl = '/%%web_online_status_rel_path%%?v=%%CACHE_BUSTER%%&t=' + new Date().getTime();
    const lastUpdateUrl = '/%%web_last_update_rel_path%%?v=%%CACHE_BUSTER%%&t=' + new Date().getTime();
    Promise.all([
        fetch(onlineStatusUrl).then(res => res.text()),
        fetch(lastUpdateUrl).then(res => res.text())
    ]).then(([onlineStatusContent, lastUpdateContent]) => {
        const dateObject = new Date(lastUpdateContent.trim());
        const lastUpdateEpoch = !isNaN(dateObject.getTime()) ? Math.floor(dateObject.getTime() / 1000) : NaN;
        const nowInSeconds = Math.floor(Date.now() / 1000);
        if (!isNaN(lastUpdateEpoch) && (nowInSeconds - lastUpdateEpoch > 900)) {
            statusDotEl.className = 'status-dot unknown';
            statusTextEl.className = 'status-text status-unknown';
            const formattedTime = formatTimestampForDisplay(lastUpdateEpoch);
            statusTextEl.textContent = 'Unbekannt (seit: ' + formattedTime + ')';
            return; 
        }
        const onlineStatusParts = onlineStatusContent.split(' - ');
        const currentStatus = onlineStatusParts[0].trim();
        if (currentStatus === 'online') {
            statusDotEl.className = 'status-dot online';
            statusTextEl.className = 'status-text status-online';
            statusTextEl.textContent = 'Online';
        } else {
            const offlineSince = onlineStatusParts.length > 1 ? onlineStatusParts.slice(1).join(' - ').trim() : 'unbekannt';
            statusDotEl.className = 'status-dot offline';
            statusTextEl.className = 'status-text status-offline';
            statusTextEl.textContent = 'Offline (seit: ' + offlineSince + ')';
        }
    }).catch(error => {
        console.error('Fehler beim Abrufen des Welt-Status (%%current_world_key%%):', error);
        statusDotEl.className = 'status-dot offline';
        statusTextEl.className = 'status-text status-offline';
        statusTextEl.textContent = 'Status nicht abrufbar';
    });
}

function fetchDataForElement(elementId, filePath, isRawText, prefixText, suffixText, isJsonPlayerList) {
    const el = document.getElementById(elementId);
    if (!el) { return; }
    fetch('/' + filePath + '?v=%%CACHE_BUSTER%%&t=' + new Date().getTime())
    .then(r => { if (!r.ok) throw new Error('Datei ' + filePath + ' nicht erreichbar (' + r.status + ')'); return r.text(); })
    .then(t => {
        let content = "";
        if (t.trim() === "") {
            content = (elementId.startsWith("map-last-update") ? "<em>unbekannt</em>" : "<em>Keine Daten verfügbar.</em>");
            if (isJsonPlayerList) {
                masterPlayerData_%%current_world_key%% = {};
                updatePlayerMarkers_%%current_world_key%%(masterPlayerData_%%current_world_key%%);
                applyPlayerFiltersAndRender_%%current_world_key%%();
            }
        } else {
            if (isJsonPlayerList) {
                try {
                    masterPlayerData_%%current_world_key%% = JSON.parse(t);
                    updatePlayerMarkers_%%current_world_key%%(masterPlayerData_%%current_world_key%%);
                    applyPlayerFiltersAndRender_%%current_world_key%%();
                } catch (e) {
                    console.error("Fehler beim Parsen der Spielerdaten:", e);
                }
                return;
            } else if (isRawText) {
                const dv = document.createElement('div');
                dv.textContent = t;
                content = dv.innerHTML.replace(/\n|\r\n|\r/g, '<br>');
            } else {
                content = t.replace(/\n|\r\n|\r/g, '<br>');
            }
        }
        el.innerHTML = (prefixText ? prefixText : '') + content + (suffixText ? suffixText : '');
    }).catch(e => {
        console.error('Fehler Laden ' + filePath + ':', e);
        el.innerHTML = (prefixText ? prefixText : '') + '<em>nicht abrufbar</em>' + (suffixText ? suffixText : '');
    });
}

// === Spieler- und Marker-Logik ===
function convertMinetestToLeaflet_%%current_world_key%%(posX, posZ) {
    const mapWidth = %%MAP_WIDTH%%;
    const mapHeight = %%MAP_HEIGHT%%;
    const minX = %%MAP_EXTENT_MIN_X%%;
    const minZ = %%MAP_EXTENT_MIN_Z%%;
    const extentWidth = %%MAP_EXTENT_WIDTH%%;
    const extentHeight = %%MAP_EXTENT_HEIGHT%%;

    if (mapWidth === 0 || extentWidth === 0) return null;

    const percentX = (posX - minX) / extentWidth;
    const percentZ = (posZ - minZ) / extentHeight;

    const pixelX = percentX * mapWidth;
    const pixelY_from_bottom = percentZ * mapHeight;
    const pixelY_from_top = mapHeight - pixelY_from_bottom;

    return L.latLng(-pixelY_from_top, pixelX);
}

function updatePlayerMarkers_%%current_world_key%%(playerData) {
    if (!map_%%current_world_key%%) return;

    const adminIcon = L.icon({ iconUrl: 'https://cdn.rawgit.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-yellow.png', shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png', iconSize: [25, 41], iconAnchor: [12, 41], popupAnchor: [1, -34], shadowSize: [41, 41] });
    const playerIcon = L.icon({ iconUrl: 'https://cdn.rawgit.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-grey.png', shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png', iconSize: [25, 41], iconAnchor: [12, 41], popupAnchor: [1, -34], shadowSize: [41, 41] });
    const now_epoch = Math.floor(Date.now() / 1000);
    const twentyFourHoursInSeconds = 24 * 60 * 60;
    const playersOnMap = new Set();

    for (const id in playerData) {
        const p = playerData[id];
        playersOnMap.add(p.name);

        const latLng = convertMinetestToLeaflet_%%current_world_key%%(p.posX, p.posZ);
        if (!latLng) continue;

        const isAdmin = (p.privilege || '').includes('server');
        const icon = isAdmin ? adminIcon : playerIcon;

        let lastLoginFormatted = 'unbekannt';
        let statusDotClass = 'offline';
        if (p.last_login) {
            if ((now_epoch - p.last_login < twentyFourHoursInSeconds)) { statusDotClass = 'online'; }
            lastLoginFormatted = formatTimestampForDisplay(p.last_login);
        }

        const popupContent = `
            <div class='popup-player-box'>
                <div class="player-header">
                    <div class="player-identity">
                        <img src="/images/players/${encodeURIComponent(p.name)}.png?v=%%CACHE_BUSTER%%" class="player-icon" alt="${p.name}" onerror="this.onerror=null;this.src='/%%DEFAULT_PLAYER_SKIN_URL%%?v=%%CACHE_BUSTER%%';">
                        <span class="player-name-status">
                            <span class="status-dot ${statusDotClass}" title="Letzter Login: ${lastLoginFormatted}"></span>
                            <strong class="player-name">${p.name}</strong>
                        </span>
                    </div>
                </div>
                <hr class="privilege-separator">
                <div class="popup-player-vitals">
                    <span class="vital"><span class="icon">❤️</span> ${p.hp !== undefined ? p.hp : '?'}</span>
                    <span class="vital"><span class="icon">💨</span> ${p.breath !== undefined ? p.breath : '?'}</span>
                    <span class="vital"><span class="icon">🍖</span> ${p.stamina !== undefined ? p.stamina : '?'}</span>
                </div>
            </div>`;

        if (playerMarkers_%%current_world_key%%[p.name]) {
            const marker = playerMarkers_%%current_world_key%%[p.name];
            marker.setLatLng(latLng);
            marker.setIcon(icon);
            marker.setPopupContent(popupContent);
        } else {
            const newMarker = L.marker(latLng, { icon: icon }).bindPopup(popupContent, { minWidth: 240 });
            newMarker.addTo(map_%%current_world_key%%);
            playerMarkers_%%current_world_key%%[p.name] = newMarker;
        }
    }

    for (const name in playerMarkers_%%current_world_key%%) {
        if (!playersOnMap.has(name)) {
            map_%%current_world_key%%.removeLayer(playerMarkers_%%current_world_key%%[name]);
            delete playerMarkers_%%current_world_key%%[name];
        }
    }
}

function applyPlayerFiltersAndRender_%%current_world_key%%() {
    const filteredData = {};
    const now_epoch = Math.floor(Date.now() / 1000);
    const twentyFourHoursInSeconds = 24 * 60 * 60;
    for (const id in masterPlayerData_%%current_world_key%%) {
        const player = masterPlayerData_%%current_world_key%%[id];
        let passesFilter = true;
        if (playerFilters_%%current_world_key%%.activeOnly) {
            const isActive = player.last_login && (now_epoch - player.last_login < twentyFourHoursInSeconds);
            if (!isActive) { passesFilter = false; }
        }
        if (passesFilter && playerFilters_%%current_world_key%%.privileges.size > 0) {
            const playerPrivs = new Set(player.privilege ? player.privilege.toLowerCase().split(',') : []);
            for (const requiredPriv of playerFilters_%%current_world_key%%.privileges) {
                if (!playerPrivs.has(requiredPriv)) {
                    passesFilter = false;
                    break;
                }
            }
        }
        if (passesFilter) { filteredData[id] = player; }
    }
    const playerListContainer = document.getElementById('player-info-%%current_world_key%%');
    if(playerListContainer) { playerListContainer.innerHTML = renderPlayerListHTML_%%current_world_key%%(filteredData); }
}

function renderPlayerListHTML_%%current_world_key%%(playerData) {
    if (!playerData || Object.keys(playerData).length === 0) {
        return "<p><em>Keine Spieler entsprechen den aktuellen Filtereinstellungen.</em></p>";
    }
    let html = "<div class='player-list-grid'>";
    const now_epoch = Math.floor(Date.now() / 1000);
    const twentyFourHoursInSeconds = 24 * 60 * 60;
    for (const id in playerData) {
        const p = playerData[id];
        const privs = p.privilege ? p.privilege.toLowerCase().split(',') : [];
        const hasServerPriv = privs.includes("server");
        const playerBoxClass = "player-box" + (hasServerPriv ? " has-server-priv" : "");
        let statusDotClass = "offline";
        let lastLoginFormatted = 'unbekannt';
        if (p.last_login) {
            if ((now_epoch - p.last_login < twentyFourHoursInSeconds)) { statusDotClass = "online"; }
            lastLoginFormatted = formatTimestampForDisplay(p.last_login);
        }
        const hasInteract = privs.includes('interact'); const hasShout = privs.includes('shout'); const hasFast = privs.includes('fast'); const hasFly = privs.includes('fly'); const hasGive = privs.includes('give'); const hasTeleport = privs.includes('teleport'); const hasAreas = privs.includes('areas'); const hasNoclip = privs.includes('noclip'); const hasSettime = privs.includes('settime'); const hasWeather = privs.includes('weather');
        html += `
        <div class="${playerBoxClass}">
            <div class="player-header">
                <div class="player-identity">
                    <img src="/images/players/${encodeURIComponent(p.name)}.png?v=%%CACHE_BUSTER%%" class="player-icon" alt="${p.name}" onerror="this.onerror=null;this.src='/%%DEFAULT_PLAYER_SKIN_URL%%?v=%%CACHE_BUSTER%%';">
                    <span class="player-name-status">
                        <span class="status-dot ${statusDotClass}" data-title="Letzter Login: ${lastLoginFormatted}"></span>
                        <strong class="player-name">${p.name}</strong>
                    </span>
                </div>
                <div class="player-vitals">
                    <span class="icon" data-title="HP: ${p.hp !== undefined ? p.hp : '?'}">❤️</span>
                    <span class="icon" data-title="Atem: ${p.breath !== undefined ? p.breath : '?'}">💨</span>
                    <span class="icon" data-title="Ausdauer: ${p.stamina !== undefined ? p.stamina : '?'}">🍖</span>
                </div>
            </div>
            <hr class="privilege-separator">
            <div class="player-attributes">
                <span class="icon privilege ${hasInteract ? 'active' : ''}" data-title="Interagieren">🖐️</span>
                <span class="icon privilege ${hasShout ? 'active' : ''}" data-title="Rufen">📢</span>
                <span class="icon privilege ${hasFast ? 'active' : ''}" data-title="Schnelles Laufen">🏃</span>
                <span class="icon privilege ${hasFly ? 'active' : ''}" data-title="Fliegen">🕊️</span>
                <span class="icon privilege ${hasGive ? 'active' : ''}" data-title="Geben">🎁</span>
                <span class="icon privilege ${hasTeleport ? 'active' : ''}" data-title="Teleportieren">✨</span>
                <span class="icon privilege ${hasAreas ? 'active' : ''}" data-title="Bereiche">🗺️</span>
                <span class="icon privilege ${hasNoclip ? 'active' : ''}" data-title="Noclip">👻</span>
                <span class="icon privilege ${hasSettime ? 'active' : ''}" data-title="Zeit setzen">🕒</span>
                <span class="icon privilege ${hasWeather ? 'active' : ''}" data-title="Wetter">🌦️</span>
                <span class="icon privilege ${hasServerPriv ? 'active' : ''}" data-title="Server-Admin">🛠️</span>
            </div>
        </div>`;
    }
    html += "</div>";
    return html;
}

document.addEventListener('DOMContentLoaded', function() {
    // === Leaflet-Karten Initialisierung ===
    const mapContainer = document.getElementById('leaflet-map-container-%%current_world_key%%');
    if (mapContainer && typeof L !== 'undefined' && %%MAP_WIDTH%% > 0) {
        map_%%current_world_key%% = L.map(mapContainer, {
            crs: L.CRS.Simple,
            minZoom: -4, // Erlaubt sehr weites Herauszoomen
            fullscreenControl: true,
            fullscreenControlOptions: {
                position: 'topleft',
                title: 'Vollbild',
                titleCancel: 'Vollbild verlassen'
            }
        });

        const mapWidth = %%MAP_WIDTH%%;
        const mapHeight = %%MAP_HEIGHT%%;
        const bounds = [[-mapHeight, 0], [0, mapWidth]];
        const imageUrl = '/%%web_map_preview_rel_path%%?v=%%CACHE_BUSTER%%';

        L.imageOverlay(imageUrl, bounds).addTo(map_%%current_world_key%%);
        
        map_%%current_world_key%%.fitBounds(bounds);
        map_%%current_world_key%%.setMaxBounds(bounds);

    } else if (mapContainer) {
        if (%%MAP_WIDTH%% <= 0) {
            mapContainer.innerHTML = "<p><em>Dynamische Karte konnte nicht geladen werden (fehlende Kartendaten).</em></p>";
        }
    }

    // === Burger-Menü Logik ===
    const burgerToggle = document.getElementById('burger-menu-toggle');
    const navContainer = document.getElementById('page-nav-buttons-container-%%current_world_key%%');
    if (burgerToggle && navContainer) {
        burgerToggle.addEventListener('click', () => navContainer.classList.toggle('menu-open'));
        navContainer.addEventListener('click', e => { if (e.target.classList.contains('button')) { navContainer.classList.remove('menu-open'); }});
    }

    // === Live/Archiv Umschalter Logik ===
    const liveBtn = document.getElementById('toggle-live-btn-%%current_world_key%%');
    const archiveBtn = document.getElementById('toggle-archive-btn-%%current_world_key%%');
    const liveContainer = document.getElementById('live-map-container-%%current_world_key%%');
    const archiveContainer = document.getElementById('archive-view-container-%%current_world_key%%');
    if (liveBtn && archiveBtn && liveContainer && archiveContainer) {
        liveBtn.addEventListener('click', () => {
            liveBtn.classList.add('active'); archiveBtn.classList.remove('active');
            liveContainer.style.display = 'block'; archiveContainer.style.display = 'none';
            if (map_%%current_world_key%%) { setTimeout(() => map_%%current_world_key%%.invalidateSize(), 10); }
        });
        archiveBtn.addEventListener('click', () => {
            archiveBtn.classList.add('active'); liveBtn.classList.remove('active');
            archiveContainer.style.display = 'block'; liveContainer.style.display = 'none';
        });
    }

    // === Spieler-Filter Logik ===
    const filterBtn = document.getElementById('player-filter-toggle-btn-%%current_world_key%%');
    const filterDropdown = document.getElementById('player-filter-dropdown-%%current_world_key%%');
    if(filterBtn && filterDropdown) {
        filterBtn.addEventListener('click', (e) => { e.stopPropagation(); filterDropdown.classList.toggle('show'); });
        filterDropdown.addEventListener('change', (e) => {
            if (e.target.type === 'checkbox') {
                const filterType = e.target.dataset.filter; const filterValue = e.target.dataset.priv;
                if(filterType === 'active') { playerFilters_%%current_world_key%%.activeOnly = e.target.checked; } 
                else if(filterType === 'privilege') { if(e.target.checked) { playerFilters_%%current_world_key%%.privileges.add(filterValue); } else { playerFilters_%%current_world_key%%.privileges.delete(filterValue); } }
                applyPlayerFiltersAndRender_%%current_world_key%%();
            }
        });
    }
    window.addEventListener('click', (e) => { if (filterDropdown && !filterBtn.contains(e.target) && !filterDropdown.contains(e.target)) { filterDropdown.classList.remove('show'); }});

    // === "Weiterlesen"-Logik ===
    document.querySelectorAll('.read-more-link').forEach(link => {
        const targetId = link.dataset.target;
        const targetElement = document.getElementById(targetId);
        if (targetElement) {
            if (targetElement.scrollHeight <= targetElement.clientHeight) {
                link.parentElement.style.display = 'none';
            } else {
                link.addEventListener('click', function(e) {
                    e.preventDefault();
                    targetElement.classList.add('expanded');
                    link.parentElement.style.display = 'none';
                });
            }
        }
    });

    // === Initiale Daten-Ladeaufrufe ===
    fetchWorldStatus_%%current_world_key%%(); 
    fetchDataForElement('player-info-%%current_world_key%%', '%%web_players_txt_rel_path%%', false, '', '', true);
    fetchDataForElement('weather-info-%%current_world_key%%', '%%web_weather_txt_rel_path%%', true, '<p><strong>Wetter:</strong> ', '</p>');
    fetchDataForElement('map-last-update-text-%%current_world_key%%', '%%web_last_update_rel_path%%', true, '', ''); 
});

// === Periodische Updates ===
setInterval(fetchWorldStatus_%%current_world_key%%, 60000);
setInterval(() => fetchDataForElement('map-last-update-text-%%current_world_key%%', '%%web_last_update_rel_path%%', true, '', ''), 60000);
setInterval(() => fetchDataForElement('player-info-%%current_world_key%%', '%%web_players_txt_rel_path%%', false, '', '', true), 70000); 
setInterval(() => fetchDataForElement('weather-info-%%current_world_key%%', '%%web_weather_txt_rel_path%%', true, '<p><strong>Wetter:</strong> ', '</p>'), 300000);
</script>

<div id="description-text-wrapper">
    <h3 id='beschreibung'>Beschreibung</h3>
    <div id="description-text" class="collapsible-text">
        %%WORLD_LONG_DESCRIPTION_PAGE%%
    </div>
    <div class="read-more-container">
        <a href="#" class="read-more-link" data-target="description-text">weiterlesen</a>
    </div>
</div>

<div id="gamerules-section">
    <h3 id='spielregeln'>Spielregeln</h3>
    <div id="gamerules-text-wrapper">
        <div id="gamerules-text" class="collapsible-text">
            %%WORLD_GAME_RULES_PAGE%%
        </div>
        <div class="read-more-container">
            <a href="#" class="read-more-link" data-target="gamerules-text">weiterlesen</a>
        </div>
    </div>
</div>

<h3 id='weltradar' class="section-header-flex">
    <span>Weltradar</span>
    <div class="map-toggle-controls">
        <button id="toggle-live-btn-%%current_world_key%%" class="map-toggle-button active">Live</button>
        <button id="toggle-archive-btn-%%current_world_key%%" class="map-toggle-button">Archiv</button>
    </div>
</h3>

<div id="live-map-container-%%current_world_key%%">
    <div id="leaflet-map-container-%%current_world_key%%" class="leaflet-map">
        </div>
    <div class='map-sub-info'>
      %%map_sub_info_link%%
      <span class='map-last-update'>Letzte Kartenaktualisierung: <span id='map-last-update-text-%%current_world_key%%'><em>wird geladen...</em></span></span>
    </div>
</div>
<div id="archive-view-container-%%current_world_key%%" style="display: none;">
    %%ARCHIVE_HTML%%
</div>

<h3 id='mods'>Verwendete Mods</h3>
<div class='scrollable-mod-list'>%%MODS_HTML%%</div>

<h3 id='spielerliste' class="section-header-flex">
    <span>Spielerliste</span>
    <div class="filter-container">
        <button id="player-filter-toggle-btn-%%current_world_key%%" class="filter-dropdown-btn">Filter ▾</button>
        <div id="player-filter-dropdown-%%current_world_key%%" class="filter-dropdown">
            <label class="filter-option">
                <input type="checkbox" data-filter="active">
                <span class="status-dot online"></span>
                zuletzt aktiv
            </label>
            <hr class="privilege-separator">
            <label class="filter-option">
                <input type="checkbox" data-filter="privilege" data-priv="interact"> <span class="icon">🖐️</span> Interagieren
            </label>
            <label class="filter-option">
                <input type="checkbox" data-filter="privilege" data-priv="shout"> <span class="icon">📢</span> Rufen
            </label>
            <label class="filter-option">
                <input type="checkbox" data-filter="privilege" data-priv="fast"> <span class="icon">🏃</span> Schnell
            </label>
            <label class="filter-option">
                <input type="checkbox" data-filter="privilege" data-priv="fly"> <span class="icon">🕊️</span> Fliegen
            </label>
             <label class="filter-option">
                <input type="checkbox" data-filter="privilege" data-priv="give"> <span class="icon">🎁</span> Geben
            </label>
             <label class="filter-option">
                <input type="checkbox" data-filter="privilege" data-priv="teleport"> <span class="icon">✨</span> Teleportieren
            </label>
             <label class="filter-option">
                <input type="checkbox" data-filter="privilege" data-priv="areas"> <span class="icon">🗺️</span> Bereiche
            </label>
             <label class="filter-option">
                <input type="checkbox" data-filter="privilege" data-priv="noclip"> <span class="icon">👻</span> Noclip
            </label>
             <label class="filter-option">
                <input type="checkbox" data-filter="privilege" data-priv="settime"> <span class="icon">🕒</span> Zeit
            </label>
             <label class="filter-option">
                <input type="checkbox" data-filter="privilege" data-priv="weather"> <span class="icon">🌦️</span> Wetter
            </label>
            <label class="filter-option">
                <input type="checkbox" data-filter="privilege" data-priv="server"> <span class="icon">🛠️</span> Server
            </label>
        </div>
    </div>
</h3>
<div id='player-info-%%current_world_key%%' class='player-list-container'>
  <p><em>Spielerdaten werden geladen...</em></p>
</div>
