/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    overflow: hidden;
    background: #0a0a0a;
    color: #e0e0e0;
}

/* Map Container */
#map {
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

/* Legend Panel */
.legend-panel {
    position: fixed;
    bottom: 52px;
    left: 20px;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px 20px;
    z-index: 1000;
    min-width: 180px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.legend-panel h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #888;
    margin-bottom: 10px;
}

.legend-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #666;
    transition: background 0.3s ease;
}

.status-dot.live {
    background: #4caf50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
    animation: pulse-dot 2s infinite;
}

.status-dot.offline {
    background: #666;
}

.legend-viewers {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.legend-viewers-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 2px;
}

.legend-divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin: 10px 0;
}

.legend-icons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.legend-icon-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #e0e0e0;
}

.legend-icon-entry img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Offline Overlay */
.offline-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.offline-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.offline-content {
    text-align: center;
    max-width: 480px;
    padding: 40px;
}

.offline-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.offline-title {
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.offline-subtitle {
    font-size: 16px;
    color: #999;
    line-height: 1.5;
}

.offline-subtitle a {
    color: #9146ff;
    text-decoration: none;
}

.offline-subtitle a:hover {
    text-decoration: underline;
}

/* Announcement Overlay */
.announcement-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1500;
    pointer-events: none;
}

.announcement {
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 16px;
    padding: 16px 28px;
    text-align: center;
    pointer-events: auto;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 215, 0, 0.1);
}

.announcement::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 18px;
    border: 2px solid transparent;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.4), transparent, rgba(255, 215, 0, 0.2)) border-box;
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
    animation: ring-pulse 2s ease-in-out infinite;
}

.announcement-text {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}

.announcement-text .emoji {
    margin-right: 6px;
}

.announcement-text .username {
    color: #ffd700;
}

.announcement-text .location {
    color: #aaa;
    font-weight: 400;
}

/* Branding Footer */
.branding {
    position: fixed;
    bottom: 42px;
    right: 12px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.5px;
    z-index: 1000;
    pointer-events: none;
    user-select: none;
}

/* Stream Links Footer */
.stream-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(10, 10, 10, 0.75);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 900;
    font-size: 13px;
    letter-spacing: 0.3px;
}

.stream-footer a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.2s ease;
}

.stream-footer a:hover {
    color: #9146ff;
    text-decoration: underline;
}

.stream-footer-divider {
    color: rgba(255, 255, 255, 0.25);
    user-select: none;
}

/* Confetti */
.confetti-particle {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    pointer-events: none;
    z-index: 3000;
}

/* No-config message */
.config-message {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2500;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

.config-message-content {
    text-align: center;
    max-width: 500px;
    padding: 40px;
}

.config-message-content h2 {
    font-size: 24px;
    color: #fff;
    margin-bottom: 12px;
}

.config-message-content p {
    font-size: 14px;
    color: #999;
    line-height: 1.6;
}

.config-message-content code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 13px;
    color: #ffd700;
}

/* Aggregated Marker Badge */
.aggregated-marker-wrapper {
    background: none !important;
    border: none !important;
}

.aggregated-marker {
    position: relative;
    width: 32px;
    height: 32px;
}

.aggregated-marker img {
    display: block;
}

.aggregated-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: #ffd700;
    color: #1a1a1a;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.4);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    padding: 0 3px;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 600px) {
    .legend-panel {
        bottom: 48px;
        left: 12px;
        padding: 12px 16px;
        min-width: 150px;
    }

    .legend-viewers {
        font-size: 20px;
    }

    .offline-title {
        font-size: 24px;
    }

    .offline-icon {
        font-size: 48px;
    }

    .announcement {
        padding: 12px 20px;
        max-width: 90vw;
    }

    .announcement-text {
        font-size: 15px;
    }

    .branding {
        font-size: 10px;
        bottom: 38px;
    }

    .stream-footer {
        font-size: 11px;
        gap: 8px;
        padding: 6px 12px;
    }
}
