/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    --bg-color: #0a192f;
    --text-color: #ccd6f6;
    --accent-color: #64ffda;
    --card-color: #112240;
    --border-color: #233554;
    --font-family: 'Poppins', sans-serif;

    font-size: 14px;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    line-height: 1.6;
}

/* =========================================
   2. LAYOUT & HEADER
   ========================================= */
.container {
    width: 80%;
    margin: 0 auto;
    padding: 0.75rem;
}

header {
    position: sticky;
    top: 0;
    z-index: 9999;
    background-color: rgba(17, 34, 64, 0.95);
    backdrop-filter: blur(0.75rem);
    border-bottom: 0.0625rem solid var(--border-color);
    padding: 0.625rem 0;
    box-shadow: 0 0.75rem 2rem -0.75rem rgba(2, 12, 27, 0.7);
}



.logo {
    display: inline-block; /* Stellt sicher, dass der Link die Bildgröße annimmt */
}

/* NEUE Regel für das Bild im Logo */
.logo img {
    height: 4rem;      /* Passe diese Höhe an, bis es gut aussieht */
    width: auto;       /* Behält das Seitenverhältnis bei */
    vertical-align: middle; /* Zentriert das Bild vertikal, falls der Link Padding hat */
}

/* --- Existing Navbar Styles --- */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 90%;
    max-width: 90rem;
    margin: 0 auto;
    padding: 0 1.25rem;
    position: relative; /* Added relative positioning context for the dropdown */
}

nav ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

nav ul li {
    margin-left: 1.25rem;
}

nav a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

nav a:hover {
    color: var(--accent-color);
}

/* --- Hamburger Icon Styles --- */
.nav-toggle {
    display: none; /* Hidden on Desktop */
    cursor: pointer;
    background: transparent;
    border: 0;
    padding: 0.5em;
    z-index: 1001; /* Ensure button stays on top */
}

.hamburger,
.hamburger::before,
.hamburger::after {
    content: '';
    display: block;
    width: 2rem;
    height: 0.2rem;
    background: var(--accent-color);
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    border-radius: 3px;
}

.hamburger { position: relative; }
.hamburger::before { position: absolute; bottom: 0.6rem; } /* Adjusted spacing slightly */
.hamburger::after { position: absolute; top: 0.6rem; }

/* =========================================
   3. MAIN DASHBOARD STRUCTURE
   ========================================= */
.user-info {
    text-align: center;
    margin-bottom: 0.75rem;
    font-size: 1.1em;
    background-color: var(--card-color);
    padding: 0.25rem;
    border-radius: 0.5rem;
    border: 0.0625rem solid var(--border-color);
}

.user-info span {
    color: var(--accent-color);
    font-weight: 600;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.stats-bar {
    display: flex;
    justify-content: space-around;
    margin-bottom: 0.9375rem;
    font-size: 1.2em;
}

.stats-bar span {
    color: var(--accent-color);
    font-weight: 600;
}


/* =========================================
   NEW: Server Dropdown Styling
   ========================================= */

/* --- The Dropdown Itself --- */
#serverSelect {
    /* 1. Reset browser default appearance */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;

    /* 2. Style for permanent visibility with a distinct background */
    background-color: rgba(166, 187, 255, 0.425); /* NEW: Faint accent background */
    border: 1px solid var(--border-color); /* Standard border, always visible */
    border-radius: 0.25rem;
    
    /* 3. Text and Font styling */
    color: var(--accent-color); /* Matches the other highlighted spans */
    font-family: inherit;
    font-size: inherit;
    font-weight: 600; /* Match the font-weight of the spans it replaced */

    /* 4. Spacing and Interactivity */
    padding: 0.2rem 2.2rem 0.2rem 0.8rem; /* T/B, Right (for arrow), Left */
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    
    /* 5. Custom arrow using an embedded SVG */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364ffda' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 1em;
}

/* --- Interactive States --- */
#serverSelect:hover {
    background-color: rgba(100, 255, 218, 0.15); /* A slightly stronger accent background */
    border-color: var(--accent-color); /* Highlight border on hover */
}

#serverSelect:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(100, 255, 218, 0.2); /* Accessibility focus ring */
}

/* --- Styling the Dropdown List Items --- */
#serverSelect option {
    background: var(--card-color); /* Dark background for the options list */
    color: var(--text-color);
    font-weight: 400; /* Normal font weight for options */
}

/* Style for the initial "Loading..." or other disabled options */
#serverSelect option:disabled {
    color: #8892b0; /* Use your theme's muted text color */
}

/* =========================================
   4. CHART SECTION
   ========================================= */
.chart-container {
    background-color: var(--card-color);
    padding: 0.25rem; 
    border-radius: 0.5rem; 
    border: 0.0625rem solid var(--border-color);
    height: 25rem; 
    display: flex;          
    flex-direction: column; 
    gap: 0.5rem;
    position: relative; /* Anchor for watermarks/absolute elements */

}

.chart-container.capturing {
    background-color: #1e1e2e;
}

.canvas-wrapper {
    position: relative; /* Required for absolute positioning of range buttons */
    display: flex;          
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
    width: 100%;
}

/* --- Range Selector Group --- */
.range-selector {
    z-index: 20; /* Ensures buttons sit above the canvas */
    width: fit-content;
    gap: 0.25rem;
    background-color: rgba(17, 34, 64, 0.85); /* Semi-transparent card color */
    backdrop-filter: blur(4px); /* Blurs the chart line behind the buttons slightly */
    padding: 0.25rem;
    border-radius: 0.35rem;
    border: 0.0625rem solid var(--border-color);
    margin-left: auto;
}

/* --- Individual Buttons --- */
.range-btn {
    background: transparent;
    border: 0.0625rem solid transparent;
    color: #8892b0; /* Muted text color (non-dominant) */
    font-family: var(--font-family);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.03rem;
    line-height: 1;
}

/* Hover State */
.range-btn:hover {
    color: var(--text-color);
    background-color: rgba(255, 255, 255, 0.05);
}

/* Active/Selected State */
.range-btn.active {
    color: var(--accent-color); /* Your site's teal/green */
    background-color: rgba(100, 255, 218, 0.1); /* Very faint teal background */
    border-color: rgba(100, 255, 218, 0.3);
    box-shadow: 0 0 0.5rem rgba(100, 255, 218, 0.05);
}

.chart-view {
    position: relative;
    flex-grow: 1;
    width: 100%;
    overflow: hidden;
}

.chart-view canvas {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    height: 100% !important;
}

.permanent-watermark {
    position: absolute; /* Take it out of the normal flow */
    bottom: 0.9375rem;  /* Anchor to the bottom */
    right: 1rem;        

    bottom: 0.9375rem;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: rgb(88, 174, 255);
    pointer-events: none; 
    z-index: 10;
    margin-left: auto;
}

.btn-back-to-live {
    display: none; /* Toggled by JS */
    position: absolute;
    bottom: 0rem;
    right: 3.2rem;
    z-index: 10;
    padding: 0.4rem 0.8rem;
    background: rgba(82, 206, 255, 0.9);
    border: none;
    border-radius: 0.25rem;
    color: #0a192f;
    font-weight: bold;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 0.9rem;
    box-shadow: 0 0.2rem 0.5rem rgba(0,0,0,0.3);
    transition: background 0.2s;
}

.btn-back-to-live:hover {
    background: rgba(100, 255, 218, 1);
}

/* --- Range Scrubber Styling --- */
#chartScrubber {
    -webkit-appearance: none;
    appearance: none;
    width: 94%;
    display: block;
    margin: 0.25rem auto 0 auto;
    height: 1.25rem; 
    background: transparent;
    cursor: pointer;
    flex-shrink: 0; 
    z-index: 5;
}
#chartScrubber:focus { outline: none; }

/* Webkit Thumb */
#chartScrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 0.75rem; 
    width: 5rem;     
    background: #8892b0; 
    cursor: grab;
    margin-top: 0.0625rem; 
    border-radius: 0.125rem;
    box-shadow: none; 
}
#chartScrubber::-webkit-slider-thumb:hover { background: #aab4d3; }
#chartScrubber::-webkit-slider-thumb:active { background: #52ceff; cursor: grabbing; }

/* Mozilla Track & Thumb */
#chartScrubber::-moz-range-track {
    width: 100%;
    height: 0.875rem;
    cursor: pointer;
    background: #172a45;
    border-radius: 0;
    border: 0.0625rem solid #304766;
}
#chartScrubber::-moz-range-thumb {
    height: 0.75rem;
    width: 5rem;
    background: #8892b0;
    border: none;
    border-radius: 0.125rem;
    cursor: grab;
    box-shadow: none;
}
#chartScrubber::-moz-range-thumb:hover { background: #aab4d3; }
#chartScrubber::-moz-range-thumb:active { background: #52ceff; cursor: grabbing; }

/* =========================================
   5. METRICS SECTION
   ========================================= */
.metrics-container {
    display: flex;
    justify-content: space-around;
    text-align: center;
    margin-bottom: 0rem;
}

.metric-item {
    flex-basis: 80%;
}

.metric-label {
    font-size: 0.9em;
    font-weight: bold;
    color: #8892b0;
    letter-spacing: 0.09375rem;
    text-transform: uppercase;
}

.metric-value-main {
    font-size: 2.0rem;
    font-weight: bold;
    color: #ccd6f6;
    line-height: 1.0;
}

.metric-value-secondary {
    font-size: 0.9rem;
    color: #a8b2d1;
}

/* Tooltip Styles (Metrics) */
.label-with-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
}

.info-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    margin-left: 0.5rem;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    border: 0.0625rem solid var(--border-color);
    color: #8892b0;
    font-size: 1.4em;
    font-weight: bold;
    font-family: sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.tooltip-text {
    visibility: hidden;
    opacity: 0;
    width: 20rem;
    background-color: #184158;
    color: #ffffff;
    border: 0.1rem solid rgb(190, 190, 190);
    text-align: left;
    border-radius: 0.5rem;
    padding: 0.75rem;
    position: absolute;
    z-index: 10;
    bottom: 150%;
    left: 50%;
    transform: translateX(-50%);
    transition: opacity 0.3s ease;
    font-size: 1rem;
    line-height: 1.4;
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0.5rem;
    border-style: solid;
    border-color: #cfcfcf transparent transparent transparent;
}

.label-with-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* =========================================
   6. MAP SECTION
   ========================================= */
.map-container {
    height: 25rem;
    border-radius: 0.5rem;
    border: 0.0625rem solid var(--border-color);
}

.map-wrapper {
    position: relative;
}

.leaflet-container:focus { outline: none; }
.leaflet-container.is-highlighted {
    box-shadow: 0 0 0 0.14rem rgba(194, 255, 241, 0.842);
}

/* Map Attribution Dark Mode */
.leaflet-control-attribution {
    background: rgba(10, 25, 47, 0.85) !important;
    color: #ccd6f6;
    font-size: 0.7rem !important;
    border-radius: 0.21rem;
    padding: 0.14rem 0.43rem;
    text-shadow: none;
}
.leaflet-control-attribution a { color: #64ffda !important; }

/* Map Tooltips (Above markers) */
.map-marker-tooltip {
    background-color: rgba(10, 25, 47, 0.85);
    border: 0.07rem solid #64ffda;
    border-radius: 0.29rem;
    color: #ffffff;
    font-weight: bold;
    padding: 0.29rem 0.57rem;
    box-shadow: none;
}
.leaflet-tooltip-top.map-marker-tooltip::before {
    border-top-color: #64ffda;
}

.custom-marker-color {
    filter: hue-rotate(140deg) saturate(1.5);
}

/* Scroll Hint Overlay */
.map-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    background-color: rgba(50, 50, 50, 0.75);
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: bold;
    padding: 0.7rem 1.1rem;
    border: 0.14rem solid #ffffff;
    border-radius: 0.3rem;
    box-shadow: 0 0.14rem 0.5rem rgba(0, 0, 0, 0.5);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}
.map-overlay.is-visible { opacity: 1; }

/* Map Ping Labels & Badges */
.ping-map-label-wrapper {
    background: transparent;
    border: none;
}

.ping-map-badge {
    background-color: rgba(10, 25, 47, 0.9);
    color: var(--text-color);
    padding: 0.15rem 0.45rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-family: monospace;
    border: 0.0625rem solid #8892b0;
    white-space: nowrap;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0.15rem 0.3rem rgba(0,0,0,0.6);
    transition: color 0.3s ease, border-color 0.3s ease;
}

.ping-map-badge.main {
    border-color: var(--accent-color);
    color: var(--accent-color);
    font-weight: bold;
    background-color: rgba(10, 25, 47, 0.98);
    z-index: 1001;
    box-shadow: 0 0 0.5rem rgba(100, 255, 218, 0.2);
}

/* Map Legend */
.server-legend-container {
    background-color: rgba(17, 34, 64, 0.95);
    border: 0.0625rem solid var(--border-color);
    border-radius: 0.3rem;
    padding: 0.6rem;
    color: var(--text-color);
    font-family: var(--font-family);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.3);
    width: 14rem;
    margin-top: 0.6rem;
    margin-right: 0.6rem;
}

.server-legend-container h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    color: #8892b0;
    border-bottom: 0.1rem solid rgba(255,255,255,0.1);
    padding-bottom: 0.3rem;
    text-align: center; 
}

.server-legend-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 12rem;
    overflow-y: auto;
    
}

.legend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
    font-size: 0.8rem;
    border-bottom: 0.1rem solid rgba(255,255,255,0.05);
}
.legend-item:last-child { border-bottom: none; }

.legend-item.active-server {
    color: var(--accent-color);
    font-weight: bold;
}
.legend-item.active-server .server-name::before {
    content: "●";
    margin-right: 0.4rem;
    font-size: 0.7rem;
}

.server-ping {
    font-family: monospace;
    font-weight: 600;
    transition: color 0.3s ease;
}

.server-legend-list::-webkit-scrollbar { width: 0.3rem; }
.server-legend-list::-webkit-scrollbar-thumb { background: #8892b0; border-radius: 0.2rem; }
.server-legend-list::-webkit-scrollbar-track { background: transparent; }

/* =========================================
   7. CONTROLS & BUTTONS
   ========================================= */
.controls {
    margin-top: 0;
    display: flex;
    justify-content: center;
    gap: 0.9375rem; 
    font-size: 1rem; 
    flex-shrink: 0;
    padding-bottom: 0.5rem;
}

button, .button-link {
    background-color: transparent;
    color: var(--accent-color);
    border: 0.0625rem solid var(--accent-color);
    padding: 0.625rem 1.25rem;
    border-radius: 0.3125rem;
    font-family: var(--font-family);
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.3s ease, color 0.3s ease;
    display: inline-block; /* For .button-link */
}

button:hover, .button-link:hover {
    background-color: rgba(100, 255, 218, 0.1);
}

/* Delete (Trash) Button */
.btn-delete {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #888;
    padding: 0.57rem;
    border-radius: 0.29rem;
    transition: all 0.2s ease;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-delete svg { width: 1.43rem; height: 1.43rem; pointer-events: none; }
.btn-delete:hover { color: #ff4444; background-color: rgba(255, 68, 68, 0.1); }
.btn-delete:active { transform: scale(0.95); }

/* Delete Button Tooltip */
.btn-delete::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-0.36rem);
    background-color: #333;
    color: #fff;
    white-space: nowrap;
    font-size: 0.86rem;
    padding: 0.36rem 0.71rem;
    border-radius: 0.29rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    z-index: 10;
}
.btn-delete::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(0.36rem);
    border-style: solid;
    border-width: 0.36rem;
    border-color: #333 transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    z-index: 10;
}
.btn-delete:hover::before,
.btn-delete:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* "Clear History" Text Button */
.btn-text-danger {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #ff4444 !important;
    font-family: var(--font-family);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.36rem 0.71rem;
    border-radius: 0.29rem;
    transition: all 0.2s ease;
    position: relative;
}
.btn-text-danger:hover {
    background-color: rgba(255, 68, 68, 0.1) !important;
    color: #ff6666 !important;
    text-decoration: none;
}
.btn-text-danger:active { transform: scale(0.98); }
.btn-text-danger:disabled {
    color: #555 !important;
    cursor: not-allowed;
    background: transparent !important;
    pointer-events: none;
}
.btn-text-danger.confirming {
    font-weight: bold;
    text-decoration: underline;
    animation: pulse-red 2s infinite;
}
@keyframes pulse-red {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Delete Confirmation Popup */
.delete-wrapper { position: relative; display: inline-block; }

.confirm-popup {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.71rem;
    width: 16rem;
    background-color: #112240;
    border: 0.0625rem solid #233554;
    border-radius: 0.36rem;
    padding: 1rem;
    box-shadow: 0 0.36rem 1.07rem rgba(0,0,0,0.5);
    z-index: 100;
    text-align: center;
}
.confirm-popup.show { display: block; animation: fadeIn 0.2s ease-out; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-0.36rem); }
    to { opacity: 1; transform: translateY(0); }
}

.confirm-popup p { color: #ccd6f6; font-size: 0.9rem; margin-bottom: 1rem; }

.confirm-actions { display: flex; justify-content: space-between; gap: 0.71rem; }

.btn-confirm-yes, .btn-confirm-no {
    flex: 1;
    padding: 0.43rem 0;
    border-radius: 0.29rem;
    font-size: 0.86rem;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}
.btn-confirm-yes {
    background-color: rgba(255, 68, 68, 0.2);
    color: #ff4444;
    border: 0.1rem solid rgba(255, 68, 68, 0.3);
}
.btn-confirm-yes:hover { background-color: rgba(255, 68, 68, 0.4); }

.btn-confirm-no {
    background-color: transparent;
    color: #8892b0;
    border: 0.1rem solid #8892b0;
}
.btn-confirm-no:hover { background-color: rgba(136, 146, 176, 0.1); color: #ccd6f6; }

.popup-arrow {
    position: absolute;
    top: -0.36rem;
    right: 1.5rem;
    width: 0.71rem;
    height: 0.71rem;
    background-color: #112240;
    border-left: 0.0625rem solid #233554;
    border-top: 0.0625rem solid #233554;
    transform: rotate(45deg);
}

/* =========================================
   8. HISTORY SECTION
   ========================================= */
.history-section {
    background-color: var(--card-color);
    padding: 1.25rem;
    border-radius: 0.5rem;
    border: 0.0625rem solid var(--border-color);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.07rem;
}
.history-header h2 { margin-bottom: 0 !important; color: var(--accent-color); }

.history-scroll-container {
    max-height: 35rem; 
    overflow-y: auto; 
    border-top: 0.0625rem solid var(--border-color);
    scrollbar-width: thin;
    scrollbar-color: #8892b0 var(--card-color);
}
.history-scroll-container::-webkit-scrollbar { width: 0.5rem; }
.history-scroll-container::-webkit-scrollbar-track { background: var(--card-color); }
.history-scroll-container::-webkit-scrollbar-thumb { background-color: #8892b0; border-radius: 0.25rem; }

#historyTable { width: 100%; border-collapse: collapse; }
#historyTable th, #historyTable td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 0.0625rem solid var(--border-color);
}
#historyTable th {
    font-weight: 600;
    position: sticky;
    top: 0;
    background-color: var(--card-color); 
    z-index: 2; 
    box-shadow: 0 0.2rem 0.2rem -0.1rem rgba(0, 0, 0, 0.4);
}

/* =========================================
   9. CONTENT PAGES & STATIC
   ========================================= */
.content-section, 
.result-explanation {
    width: 100%;
    max-width: 100%;
    margin: 0.75rem auto;
    background-color: var(--card-color);
    border: 0.0625rem solid var(--border-color);
    border-radius: 0.5rem;
    padding: 2.5rem;
    color: var(--text-color);
    box-sizing: border-box;
}

.content-section .text-wrapper {
    margin: 0 auto;
}

.content-section h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #e6f1ff;
    line-height: 1.2;
    text-align: center;
}

.content-section h2, 
.result-explanation h2 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-top: 3.5rem;
    margin-bottom: 1.5rem;
    color: var(--accent-color);
    display: flex;
    align-items: center;
    border-bottom: 0.1rem solid var(--border-color);
    padding-bottom: 0.5rem;
}
/* Result explanation specific h2 adjustment */
.result-explanation h2 {
    color: #e6f1ff;
    text-align: center;
    margin-top: 0;
    padding-bottom: 1rem;
    display: block; /* Override flex from grouped selector */
}

.content-section h2::before {
    content: '::';
    margin-right: 0.5rem;
    color: #8892b0;
    font-weight: 400;
}

.content-section h3,
.result-explanation h3 {
    font-size: 1.3rem;
    margin-top: 2rem;
    margin-bottom: 0.8rem;
    color: #e6f1ff;
}
.result-explanation h3 { font-size: 1.4rem; color: var(--accent-color); margin-top: 2.5rem; margin-bottom: 1rem; }

.result-explanation h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: #e6f1ff;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
}

.content-section p,
.result-explanation p {
    margin-bottom: 1.2rem;
    font-size: 1.05rem;
}
.result-explanation p { opacity: 0.9; }

.lead-text {
    font-size: 1.25rem !important;
    color: var(--text-color) !important;
    line-height: 1.7;
    margin-bottom: 2.5rem !important;
    border-left: 0.22rem solid var(--accent-color);
    padding-left: 1.5rem;
    background: rgba(100, 255, 218, 0.05);
    padding: 1rem 1.5rem;
    border-radius: 0 0.5rem 0.5rem 0;
}

/* Result Header */
.result-header {
    text-align: center;
    margin-bottom: 1.25rem;
}
.result-header h1 { color: var(--accent-color); margin-bottom: 0.3125rem; }
.result-header p { font-size: 1.1rem; color: #a8b2d1; }

.badge {
    display: inline-block;
    background: #e0e0e0;
    padding: 0.33rem 0.8rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    margin-bottom: 0.66rem;
    color: #555;
}
.timestamp { color: #777; font-size: 0.93rem; }

/* Lists (Common & Feature Boxes) */
.feature-list,
.result-explanation ul {
    list-style: none;
    padding-left: 1rem;
    margin-bottom: 2rem;
}
.result-explanation ul { padding-left: 0.5rem; margin-bottom: 1.5rem; }

.feature-list li,
.result-explanation li {
    margin-bottom: 0.8rem;
    position: relative;
    padding-left: 1.5rem;
}
.result-explanation li { margin-bottom: 0.6rem; opacity: 0.9; font-size: 0.95rem; }

.feature-list li::before,
.result-explanation li::before {
    content: "▹";
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-size: 1.2rem;
    line-height: 1.1rem;
}
.feature-list strong, .result-explanation li strong { color: #e6f1ff; font-weight: 600; }

.result-explanation hr {
    border: 0;
    border-top: 0.1rem solid var(--border-color);
    opacity: 0.5;
    margin: 2.5rem 0;
}

/* Feature Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); 
    gap: 1.5rem;
    margin: 2.5rem 0;
}

.feature-box {
    background-color: var(--card-color);
    border: 0.0625rem solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.75rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.feature-box:hover {
    transform: translateY(-0.3rem);
    box-shadow: 0 0.75rem 2rem -1rem rgba(2, 12, 27, 0.7);
    border-color: var(--accent-color);
}
.feature-box h3 {
    margin-top: 0;
    font-size: 1.15rem;
    color: var(--accent-color);
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
.feature-box .icon { font-size: 1.6rem; }
.feature-box p { font-size: 0.95rem; margin-bottom: 0; color: #a8b2d1; }

.feature-box .feature-list {
    margin-top: 1rem;
    padding-left: 0;
    list-style: none;
}
.feature-box .feature-list li {
    position: relative;
    padding-left: 1.2rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #8892b0;
}
.feature-box .feature-list li::before {
    content: "▹";
    position: absolute;
    left: 0;
    color: var(--accent-color);
}

/* FAQ Items */
.faq-item {
    background-color: rgba(17, 34, 64, 0.5);
    border-left: 0.2rem solid var(--border-color);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 0 0.5rem 0.5rem 0;
}
.faq-item:hover { border-left-color: var(--accent-color); background-color: var(--card-color); }
.faq-item h3 { margin-top: 0; font-size: 1.1rem; color: #e6f1ff; }
.faq-item p { margin-bottom: 0; font-size: 0.95rem; }

/* Legal/Privacy Docs */
.legal-doc h1 { text-align: center; margin-bottom: 0.5rem; }
.legal-doc h4 { color: #e6f1ff; font-size: 1.1rem; margin-top: 1.5rem; margin-bottom: 0.5rem; }
.legal-doc a { color: var(--accent-color); text-decoration: underline; }
.legal-doc a:hover { opacity: 0.8; text-decoration: none; }
.legal-doc .last-updated {
    display: block;
    text-align: center;
    color: #8892b0;
    font-size: 0.9rem;
    margin-bottom: 2rem;
    border-bottom: 0.1rem solid rgba(136, 146, 176, 0.2);
    padding-bottom: 2rem;
}
.legal-doc ul { padding-left: 2rem; margin-bottom: 1.5rem; list-style-type: disc; }
.legal-doc li { margin-bottom: 0.5rem; color: var(--text-color); opacity: 0.9; }

/* Static Pages Generic */
.static-page {
    background-color: var(--card-color);
    padding: 1.875rem;
    border-radius: 0.5rem;
    border: 0.0625rem solid var(--border-color);
}
.static-page h1 { margin-bottom: 1rem; color: var(--accent-color); }
.static-page h3 { margin-top: 1.5rem; margin-bottom: 0.5rem; }

/* =========================================
   10. FOOTER & UTILS
   ========================================= */
footer {
    text-align: center;
    padding: 1.25rem;
    margin-top: 1.875rem;
    color: #8892b0;
    font-size: 0.9em;
}

.custom-tooltip {
    position: fixed;
    top: 1.25rem;
    left: 50%;
    transform: translate(-50%, -3.125rem);
    background-color: var(--card-color);
    color: var(--text-color);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: 0.0625rem solid var(--accent-color);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}
.custom-tooltip.show { opacity: 1; transform: translate(-50%, 0); }

/* =========================================
   11. MEDIA QUERIES (KEPT EXACTLY AS REQUESTED)
   ========================================= */

/* Range 2: Screens from 768px to 1199px wide */
@media (max-width: 768px) {

    :root {
        font-size: 14px;
    }
    .container {
        width: 100%;

    }

        /* Show the hamburger button */
    .nav-toggle {
        display: block;
    }

    /* Hide the menu items by default */
    nav ul {
        position: absolute;
        top: 100%; /* Push it exactly below the nav bar */
        left: 0;
        width: 100%;
        flex-direction: column; /* Stack items vertically */
        background-color: #1e1e2e; /* Matches your theme-color in HTML */
        box-shadow: 0 10px 15px rgba(0,0,0,0.3);
        padding: 1rem 0;
        
        /* Hiding mechanism */
        opacity: 0;
        visibility: hidden;
        transform: translateY(-20px);
        transition: all 0.3s ease-in-out;
        z-index: 1000;
    }

    nav ul li {
        margin: 0;
        width: 100%;
        text-align: center;
    }

    nav ul li a {
        display: block;
        padding: 1rem;
        width: 100%;
    }

    /* --- The 'nav-open' State (Triggered by JS) --- */
    
    /* 1. Show the Menu */
    nav.nav-open ul {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    /* 2. Animate Hamburger into an 'X' */
    nav.nav-open .hamburger {
        background: transparent; /* Hide middle line */
    }

    nav.nav-open .hamburger::before {
        bottom: 0;
        transform: rotate(45deg);
    }

    nav.nav-open .hamburger::after {
        top: 0;
        transform: rotate(-45deg);
    }
  
    /* Make the history table horizontally scrollable */
    .history-section {
        overflow-x: auto;
    }

    #historyTable {
        min-width: 31.25rem; /* 500px / 16 */
    }
   
    .stats-bar {
        gap: 1.5rem;
    }

    .controls {
        margin-top: 0;
        display: flex;
        justify-content: center;
        gap: 0.5rem; 
        font-size: 0.7rem; 
        flex-shrink: 0;
        padding-bottom: 0.1rem;
    }

    button, .button-link {
        padding: 0.325rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .metric-label {
        font-size: 0.7rem;
    }

    .metric-value-main {
        font-size: 1.6rem;
        line-height: 1rem;
    }

    .metric-value-secondary {
        font-size: 0.8rem;
    }
    .info-icon {
        font-size: 1.1rem;
    }

    .permanent-watermark {
        position: relative;
        font-size: 0.8rem;
        bottom: 0rem;  /* Anchor to the bottom */
        right: 0rem;     
    }

    .leaflet-control.server-legend-container {
        padding: 0.25rem;
        width: 10rem;
        
        /* These will now work correctly! */
        margin-top: 0.2rem; 
        margin-right: 0.2rem;
    }

    .server-legend-container h4 {
        margin: 0 0 0.2rem 0;
        font-size: 0.65rem;
        padding-bottom: 0.2rem;
    }

    .server-legend-list {
        max-height: 12rem;
        overflow-y: auto;
    }

    .legend-item {
        padding: 0.2rem 0;
        font-size: 0.6rem;
    }

    .legend-item.active-server .server-name::before {
        content: "●";
        margin-right: 0.2rem;
        font-size: 0.6rem;
    }

   
}

/* Range 3: Screens from 1200px to 1999px wide */
@media (min-width: 769px) and (max-width: 1399px) {
    :root {
        font-size: 14px; /* Ideal for 1080p and 1440p displays */
    }
}

/* Range 4: Screens from 2000px to 2999px wide */
@media (min-width: 1400px) and (max-width: 2000px) {
    :root {
        font-size: 15px; /* For 4K displays */
    }
}

/* Range 5: Screens 3000px and wider */
@media (min-width: 2001px) and (max-width: 3000px) {
    :root {
        font-size: 20px; /* For ultra-wide and larger displays */
    }
}

/* Range 6: Screens 3000px and wider */
@media (min-width: 3001px) {
    :root {
        font-size: 30px; /* For ultra-wide and larger displays */
    }
}