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

:root {
    --primary-color: #ff9500;
    --secondary-color: #1a1a1a;
    --background: #0a0a0a;
    --surface: #1a1a1a;
    --border: #333;
    --text: #e0e0e0;
    --text-muted: #999;
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #f44336;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 40px 0;
    background: linear-gradient(135deg, var(--secondary-color), var(--background));
    border-radius: 12px;
    margin-bottom: 30px;
    border: 1px solid var(--border);
}

header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--primary-color), #ffc107);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.2em;
    color: var(--text-muted);
}

.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-item {
    background: var(--surface);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-value {
    display: block;
    font-size: 2em;
    font-weight: bold;
    color: var(--primary-color);
}

.controls {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    align-items: center;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #ff7700;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.select {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-size: 1em;
    cursor: pointer;
}

.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.switch input {
    display: none;
}

.slider {
    width: 50px;
    height: 26px;
    background: var(--border);
    border-radius: 13px;
    position: relative;
    transition: 0.3s;
}

.slider:before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    left: 3px;
    top: 3px;
    transition: 0.3s;
}

.switch input:checked+.slider {
    background: var(--primary-color);
}

.switch input:checked+.slider:before {
    transform: translateX(24px);
}

.switch-label {
    color: var(--text);
}

.map-container {
    position: relative;
    margin-bottom: 30px;
}

/* Map container styling */
#map {
    width: 100%;
    height: 800px;
    background: #000000;
    /* Black background for OSRS map */
    border: 2px solid var(--border);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

/* Override Leaflet styles for dark theme */
.leaflet-container {
    background: #000000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Ensure tiles render with pixelated (crisp) edges for retro OSRS look */
.leaflet-tile-loaded {
    visibility: inherit;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.leaflet-tile {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.leaflet-control-zoom a {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}

.leaflet-control-zoom a:hover {
    background: var(--primary-color);
    color: white;
}

.leaflet-control-attribution {
    background: rgba(26, 26, 26, 0.8);
    color: var(--text-muted);
}

.leaflet-control-attribution a {
    color: var(--primary-color);
}

.marker {
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: pointer;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.marker-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

.marker-dot.recent {
    background: var(--success);
}

.marker-dot.moderate {
    background: var(--warning);
}

.marker-dot.old {
    background: var(--danger);
}

/* Leaflet popup styling */
.leaflet-popup-content-wrapper {
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
}

.leaflet-popup-content {
    margin: 12px;
    font-size: 0.9em;
}

.leaflet-popup-content strong {
    color: var(--primary-color);
    font-size: 1.1em;
}

.leaflet-popup-tip {
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid var(--border);
}

.map-legend {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.map-legend h3 {
    margin-bottom: 10px;
    font-size: 1em;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    font-size: 0.9em;
}

.recent-sightings {
    background: var(--surface);
    padding: 30px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 30px;
}

.recent-sightings h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.sightings-list {
    display: grid;
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.sighting-item {
    background: var(--background);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 15px;
    align-items: center;
    transition: all 0.3s;
}

.sighting-item:hover {
    border-color: var(--primary-color);
    transform: translateX(5px);
}

.sighting-player {
    font-weight: bold;
    font-size: 1.1em;
}

.sighting-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.9em;
    color: var(--text-muted);
}

.sighting-time {
    color: var(--primary-color);
    font-size: 0.9em;
}

footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Scrollbar styling */
.sightings-list::-webkit-scrollbar {
    width: 8px;
}

.sightings-list::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 4px;
}

.sightings-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.sightings-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }

    #map {
        height: 500px;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .controls>* {
        width: 100%;
    }
}