* { -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior-y: none; }
body { background-color: #f3f4f6; }
.dark body { background-color: #0f172a; }

.leaflet-container { z-index: 10; }
#sidebar { z-index: 1000; transition: transform 0.3s ease-in-out; padding-bottom: env(safe-area-inset-bottom); }
.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 4px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.dark .custom-scrollbar::-webkit-scrollbar-track { background: #1e293b; }
.dark .custom-scrollbar::-webkit-scrollbar-thumb { background: #475569; }
.dark .custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #64748b; }

#loading-overlay { z-index: 9999; }
.touch-handle-area { touch-action: none; }

.leaflet-tooltip {
    padding: 0 !important;
    border-radius: 12px !important;
    border: none !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15) !important;
}

.pulse-dot { animation: pulse 1.6s infinite; }

.timeline {
    position: relative;
    margin-top: 8px;
}
.timeline::before {
    content: "";
    position: absolute;
    left: 18px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, #e2e8f0, #cbd5e1);
    border-radius: 999px;
}
.dark .timeline::before {
    background: linear-gradient(to bottom, #334155, #475569);
}
.timeline-entry {
    position: relative;
    padding-left: 52px;
    margin-bottom: 18px;
}
.timeline-entry:last-child { margin-bottom: 0; }
.timeline-dot {
    position: absolute;
    left: 8px;
    top: 10px;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 3px solid #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
    z-index: 2;
}
.dark .timeline-dot { border-color: #0f172a; }
.timeline-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.04);
}
.dark .timeline-card {
    background: #111827;
    border-color: #334155;
    box-shadow: 0 3px 10px rgba(0,0,0,0.25);
}
.timeline-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}
.timeline-title { font-size: 13px; font-weight: 700; }
.timeline-date { font-size: 11px; color: #94a3b8; white-space: nowrap; }
.timeline-meta { font-size: 11px; color: #2563eb; font-weight: 600; margin-bottom: 8px; }
.timeline-comment { font-size: 14px; color: #374151; line-height: 1.4; }
.dark .timeline-comment { color: #d1d5db; }
.timeline-author { font-size: 11px; color: #9ca3af; margin-top: 8px; }
.timeline-empty {
    font-size: 14px;
    color: #9ca3af;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    padding: 14px;
    text-align: center;
}
.dark .timeline-empty {
    background: #111827;
    border-color: #334155;
    color: #94a3b8;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    70% { transform: scale(1.18); opacity: .7; }
    100% { transform: scale(1); opacity: 1; }
}

/* Zunifikowana i zsynchronizowana animacja pulsowania dla mapy */
@keyframes sync-pulse-anim {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.25); opacity: 0.85; }
    100% { transform: scale(1); opacity: 1; }
}

.sync-pulse {
    animation: sync-pulse-anim 1.5s infinite ease-in-out;
}

/* Small floating legend */
#map-legend-box {
    max-width: min(210px, calc(100vw - 32px));
}
.legend-mini-row {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12px;
    color: #334155;
    line-height: 1.2;
}
.dark .legend-mini-row {
    color: #e2e8f0;
}
.legend-mini-dot {
    width: 11px;
    height: 11px;
    border-radius: 999px;
    flex: 0 0 auto;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.85);
}
.dark .legend-mini-dot {
    box-shadow: 0 0 0 3px rgba(15,23,42,0.95);
}
.legend-mini-emoji {
    width: 14px;
    text-align: center;
    flex: 0 0 auto;
}
.legend-green { background: #16a34a; }
.legend-red { background: #dc2626; }
.legend-yellow { background: #eab308; }
.legend-gray { background: #d1d5db; }

@media (max-width: 767px) {
    #map-legend-box {
        width: 190px;
    }
}