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

:root {
    --sidebar-width-desktop: 320px;
    --safe-area-top: env(safe-area-inset-top);
    --safe-area-bottom: env(safe-area-inset-bottom);
    --safe-area-left: env(safe-area-inset-left);
    --safe-area-right: env(safe-area-inset-right);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
    overflow: hidden;
    /* Use dynamic viewport height for mobile Safari */
    min-height: 100dvh;
    min-height: -webkit-fill-available;
}

html {
    /* Prevent iOS Safari from shrinking on scroll */
    height: -webkit-fill-available;
}

.container {
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

header {
    background: #005BBB;
    color: white;
    padding: 0.75rem 2rem;
    padding-top: calc(0.75rem + var(--safe-area-top));
    padding-left: calc(2rem + var(--safe-area-left));
    padding-right: calc(2rem + var(--safe-area-right));
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    overflow: visible;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    position: relative;
    cursor: pointer;
}

.campus-dropdown {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
    min-width: 180px;
}

.campus-dropdown.active {
    display: flex;
}

.campus-option {
    padding: 0.75rem 1.5rem;
    border: none;
    background: white;
    color: #005BBB;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.campus-option:hover {
    background: #f0f8ff;
    color: #003d7a;
}

.campus-option:not(:last-child) {
    border-bottom: 1px solid #e0e0e0;
}

.logo-title {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 1.5rem;
    margin: 0;
}

.ub-logo {
    height: 35px;
    width: auto;
    object-fit: contain;
    background: white;
    padding: 4px 8px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.ubloop-logo {
    height: 45px;
    width: auto;
    object-fit: contain;
    margin-left: 0.5rem;
}

header h1 {
    font-size: 1.5rem;
    margin: 0;
}

header p {
    opacity: 0.9;
    font-size: 0.8rem;
    margin: 0;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.hamburger {
    position: absolute;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    z-index: 2000;
    background: transparent;
    border: none;
    width: 35px;
    height: 35px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    transition: all 0.3s;
}

.hamburger:hover {
    opacity: 0.8;
}

.hamburger span {
    width: 24px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.activity-sidebar {
    position: fixed;
    left: calc(-1 * var(--sidebar-width-desktop));
    top: 70px;
    width: var(--sidebar-width-desktop);
    height: calc(100vh - 70px);
    background: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease;
    z-index: 1500;
}

.activity-sidebar.open {
    left: 0;
}

.activity-header {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

.activity-header h2 {
    color: #005BBB;
    margin-bottom: 0.75rem;
}

.activity-header select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

#activityFeed {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.activity-item {
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid #ddd;
    background: #f9f9f9;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.25rem 0.5rem;
}

.activity-item:hover {
    background: #f0f0f0;
    transform: translateX(2px);
}

.activity-item.suspicious {
    border-left-color: #dc3545;
}

.activity-item.medical {
    border-left-color: #ff9800;
}

.activity-item.hazard {
    border-left-color: #ffc107;
}

.activity-item.other {
    border-left-color: #005BBB;
}

.activity-item.lost {
    border-left-color: #9c27b0;
}

.activity-item.found {
    border-left-color: #28a745;
}

.activity-type {
    font-weight: bold;
    text-transform: capitalize;
    font-size: 0.9rem;
    grid-column: 1;
    grid-row: 1;
}

.activity-location {
    font-weight: 500;
    color: #005BBB;
    font-size: 0.85rem;
    grid-column: 1;
    grid-row: 2;
}

.activity-time {
    font-size: 0.7rem;
    color: #666;
    grid-column: 2;
    grid-row: 1 / 3;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    text-align: right;
    white-space: nowrap;
}

.activity-votes {
    grid-column: 1 / 2;
    grid-row: 3;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.vote-btn {
    background: transparent;
    border: none;
    border-radius: 0;
    width: auto;
    height: auto;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #999;
}

.vote-btn:hover {
    color: #666;
    transform: scale(1.1);
}

.vote-btn:active {
    transform: scale(0.95);
}

.vote-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.vote-btn.vote-up.active {
    color: #28a745;
}

.vote-btn.vote-down.active {
    color: #dc3545;
}

.vote-count {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
    min-width: 24px;
    text-align: center;
}

.popup-votes {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #eee;
}

.vote-btn-popup {
    background: transparent;
    border: none;
    border-radius: 0;
    width: auto;
    height: auto;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #999;
}

.vote-btn-popup:hover {
    color: #666;
    transform: scale(1.15);
}

.vote-btn-popup:active {
    transform: scale(0.95);
}

.vote-btn-popup:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.vote-btn-popup.vote-up.active {
    color: #28a745;
}

.vote-btn-popup.vote-down.active {
    color: #dc3545;
}

.vote-count-popup {
    font-weight: 700;
    color: #333;
    font-size: 1rem;
    min-width: 28px;
    text-align: center;
}

.popup-content {
    min-width: 200px;
}

.no-alerts {
    text-align: center;
    color: #999;
    padding: 2rem 1rem;
}

.status-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 6px;
}

.status-badge.lost {
    background: rgba(156, 39, 176, 0.15);
    color: #9c27b0;
    border: 1px solid rgba(156, 39, 176, 0.3);
}

.status-badge.found {
    background: rgba(40, 167, 69, 0.15);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.found-toggle {
    grid-column: 1 / 3;
    grid-row: 3;
    margin-top: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.found-toggle:hover {
    background: #218838;
    transform: translateY(-1px);
}

.found-toggle:active {
    transform: translateY(0);
}

.found-toggle:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.filter-toggle {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.filter-toggle-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    display: block;
    margin-bottom: 0.5rem;
}

.toggle-buttons {
    display: flex;
    gap: 0.5rem;
}

.toggle-btn {
    flex: 1;
    padding: 0.4rem 0.6rem;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn:hover {
    background: #e8e8e8;
}

.toggle-btn.active {
    background: #005BBB;
    color: white;
    border-color: #005BBB;
}

#lostItemFields {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.map-section {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

.map-watermark {
    position: absolute;
    top: 10px;
    right: 10px;
    height: 40px;
    width: auto;
    opacity: 0.7;
    pointer-events: none;
    z-index: 500;
    transition: opacity 0.3s ease;
    filter: brightness(0) saturate(100%);
}

.map-watermark:hover {
    opacity: 0.9;
}

.map-legend {
    position: absolute;
    top: 60px;
    right: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 500;
    backdrop-filter: blur(10px);
}

.legend-title {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 8px;
    color: #005BBB;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 0.75rem;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.legend-label {
    color: #333;
}

.temp-marker {
    background: transparent;
    border: none;
}

.temp-marker-inner {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(0, 91, 187, 0.3);
    border: 3px solid #005BBB;
    box-shadow: 0 0 0 4px rgba(0, 91, 187, 0.2);
    animation: pulse-marker 1.5s ease-in-out infinite;
}

@keyframes pulse-marker {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* User location marker pulse animation */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(66, 133, 244, 0.7);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 15px rgba(66, 133, 244, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(66, 133, 244, 0);
    }
}

.user-location-marker {
    background: transparent;
    border: none;
}

.user-location-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4285F4;
    border: 3px solid #fff;
    box-shadow: 0 0 0 0 rgba(66, 133, 244, 0.7);
    animation: pulse 2s infinite;
    position: relative;
}

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background-color: rgba(0, 91, 187, 0.6);
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background-color: rgba(0, 91, 187, 0.9);
    color: white;
    font-weight: bold;
}

.leaflet-left {
    transition: left 0.3s ease;
}

.activity-sidebar.open ~ .map-section .leaflet-left {
    left: calc(var(--sidebar-width-desktop) + 10px);
}

.timeline-scrubber {
    position: absolute;
    bottom: calc(40px + var(--safe-area-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: none;
    background: rgba(255, 255, 255, 0.5);
    padding: 12px 25px;
    padding-bottom: calc(12px + var(--safe-area-bottom));
    border-radius: 16px;
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.25);
    z-index: 1000;
    transition: width 0.3s ease, left 0.3s ease, transform 0.3s ease;
}

.activity-sidebar.open ~ .map-section .timeline-scrubber {
    width: calc(100% - 40px - var(--sidebar-width-desktop));
    left: calc(50% + (var(--sidebar-width-desktop) / 2));
}

.scrubber-label {
    text-align: center;
    margin-bottom: 10px;
    display: inline-block;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    cursor: pointer;
}

.scrubber-label span {
    display: inline-block;
    background: linear-gradient(135deg, rgba(0, 91, 187, 0.95) 0%, rgba(0, 119, 221, 0.95) 100%);
    color: white;
    font-size: 0.8rem;
    padding: 6px 16px;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0, 91, 187, 0.25),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.scrubber-label:hover span {
    box-shadow: 0 6px 24px rgba(0, 91, 187, 0.35),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-2px) scale(1.02);
}

.scrubber-label strong {
    font-size: 0.9rem;
    color: white;
    font-weight: 700;
}

.scrubber-track {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 8px 0;
    position: relative;
}

.track-bar {
    width: 2px;
    height: 24px;
    background: linear-gradient(180deg, rgba(0, 91, 187, 0.8) 0%, rgba(0, 61, 122, 0.6) 100%);
    border-radius: 2px;
    box-shadow: 0 2px 8px rgba(0, 91, 187, 0.2);
    transition: all 0.3s ease;
}

.scrubber-track:hover .track-bar {
    height: 28px;
    box-shadow: 0 3px 12px rgba(0, 91, 187, 0.3);
}

#timeScrubber {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: transparent;
    border-radius: 3px;
    outline: none;
    margin: 0;
    position: relative;
    touch-action: pan-x; /* Allow only horizontal dragging on touch devices */
    cursor: pointer;
}

/* Track background with ticks */
#timeScrubber::-webkit-slider-runnable-track {
    height: 6px;
    background:
        repeating-linear-gradient(
            90deg,
            rgba(0, 0, 0, 0.2) 0px,
            rgba(0, 0, 0, 0.2) 2px,
            transparent 2px,
            transparent calc(100% / 12)
        ),
        linear-gradient(90deg, rgba(200, 200, 200, 0.35) 0%, rgba(180, 180, 180, 0.25) 100%);
    border-radius: 3px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

#timeScrubber::-moz-range-track {
    height: 6px;
    background: 
        repeating-linear-gradient(
            90deg,
            rgba(0, 0, 0, 0.2) 0px,
            rgba(0, 0, 0, 0.2) 2px,
            transparent 2px,
            transparent calc(100% / 12)
        ),
        linear-gradient(90deg, rgba(200, 200, 200, 0.35) 0%, rgba(180, 180, 180, 0.25) 100%);
    border-radius: 3px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

#timeScrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #005BBB 0%, #0088FF 100%);
    cursor: grab;
    box-shadow: 0 4px 12px rgba(0, 91, 187, 0.4),
                0 0 0 4px rgba(255, 255, 255, 0.8),
                0 0 0 5px rgba(0, 91, 187, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(255, 255, 255, 0.9);
}

#timeScrubber::-webkit-slider-thumb:hover {
    width: 24px;
    height: 24px;
    box-shadow: 0 6px 20px rgba(0, 91, 187, 0.5),
                0 0 0 5px rgba(255, 255, 255, 0.9),
                0 0 0 6px rgba(0, 91, 187, 0.15);
}

#timeScrubber::-webkit-slider-thumb:active {
    cursor: grabbing;
    width: 22px;
    height: 22px;
    box-shadow: 0 3px 10px rgba(0, 91, 187, 0.6),
                0 0 0 6px rgba(255, 255, 255, 0.95),
                0 0 0 7px rgba(0, 91, 187, 0.2);
}

#timeScrubber::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #005BBB 0%, #0088FF 100%);
    cursor: grab;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px rgba(0, 91, 187, 0.4),
                0 0 0 4px rgba(255, 255, 255, 0.8),
                0 0 0 5px rgba(0, 91, 187, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#timeScrubber::-moz-range-thumb:hover {
    width: 24px;
    height: 24px;
    box-shadow: 0 6px 20px rgba(0, 91, 187, 0.5),
                0 0 0 5px rgba(255, 255, 255, 0.9),
                0 0 0 6px rgba(0, 91, 187, 0.15);
}

#timeScrubber::-moz-range-thumb:active {
    cursor: grabbing;
    width: 22px;
    height: 22px;
    box-shadow: 0 3px 10px rgba(0, 91, 187, 0.6),
                0 0 0 6px rgba(255, 255, 255, 0.95),
                0 0 0 7px rgba(0, 91, 187, 0.2);
}

.scrubber-ends {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: rgba(0, 0, 0, 0.6);
    margin-top: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    width: 100%;
}

.scrubber-ends span {
    display: block;
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.modal.active {
    display: block;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    position: absolute;
    cursor: grab;
    user-select: none;
    overflow-y: auto;
}

.modal-content:active {
    cursor: grabbing;
}

.modal-content:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.close:hover {
    color: #000;
}

.modal-content h2 {
    color: #005BBB;
    margin-bottom: 1.5rem;
    cursor: grab;
    user-select: none;
}

.modal-content h2:active {
    cursor: grabbing;
}

.modal-content select,
.modal-content input,
.modal-content textarea {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
    cursor: auto;
    user-select: text;
}

.modal-content textarea {
    min-height: 80px;
    resize: vertical;
}

.modal-content button {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

.modal-content button[type="submit"] {
    background: #005BBB;
    color: white;
}

.modal-content button[type="submit"]:hover {
    background: #004499;
}

.modal-content button[type="button"] {
    background: #f0f0f0;
    color: #333;
}

.modal-content button[type="button"]:hover {
    background: #e0e0e0;
}

@media (max-width: 768px) {
    :root {
        --sidebar-width-mobile: clamp(220px, 80vw, 280px);
    }

    body {
        overflow: hidden;
    }

    header {
        padding: 0.5rem 1rem;
        min-height: 60px;
    }

    .ubloop-logo-header {
        right: -50px;
        height: 45px;
    }

    .logo-title {
        font-size: 1.1rem;
    }

    .ub-logo {
        height: 26px;
        padding: 3px 6px;
    }

    .ubloop-logo {
        height: 32px;
        margin-left: 0.3rem;
    }

    header p {
        font-size: 0.65rem;
    }

    .campus-dropdown {
        min-width: 160px;
        top: 65px;
    }

    .campus-option {
        padding: 0.65rem 1rem;
        font-size: 0.95rem;
    }

    .hamburger {
        width: 32px;
        height: 32px;
        left: 8px;
        top: 50%;
        transform: translateY(-50%);
        gap: 4px;
    }

    .hamburger span {
        width: 22px;
        height: 2.5px;
    }

    .hamburger.active span:nth-child(1) {
        transform: translateY(6.5px) rotate(45deg);
    }

    .hamburger.active span:nth-child(3) {
        transform: translateY(-6.5px) rotate(-45deg);
    }

    .activity-sidebar {
        width: var(--sidebar-width-mobile);
        left: calc(-1 * var(--sidebar-width-mobile));
        top: 60px;
        height: calc(100vh - 60px);
        height: calc(100dvh - 60px);
    }

    .activity-sidebar.open {
        left: 0;
    }

    .activity-header {
        padding: 1rem;
    }

    .activity-header h2 {
        font-size: 1.1rem;
    }

    .activity-item {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
        font-size: 0.85rem;
    }

    .activity-votes {
        gap: 0.4rem;
    }

    .vote-btn {
        font-size: 1.1rem;
    }

    .vote-count {
        font-size: 0.85rem;
        min-width: 20px;
    }

    .vote-btn-popup {
        font-size: 1.2rem;
    }

    .vote-count-popup {
        font-size: 0.95rem;
    }

    .timeline-scrubber {
        width: calc(100% - 16px - var(--safe-area-left) - var(--safe-area-right));
        padding: 12px 12px; /* Increased vertical padding for easier touch */
        padding-bottom: calc(12px + var(--safe-area-bottom));
        bottom: calc(8px + var(--safe-area-bottom));
        background: rgba(255, 255, 255, 0.5);
        left: calc(8px + var(--safe-area-left));
        transform: none;
    }

    .map-watermark {
        height: 30px;
        top: 10px;
        right: 8px;
    }

    .activity-sidebar.open ~ .map-section .timeline-scrubber {
        left: calc(8px + var(--sidebar-width-mobile, clamp(220px, 80vw, 280px)) + var(--safe-area-left));
        width: calc(100% - 16px - var(--sidebar-width-mobile, clamp(220px, 80vw, 280px)) - var(--safe-area-left) - var(--safe-area-right));
        transform: none;
    }

    .scrubber-label span {
        font-size: 0.65rem;
        padding: 4px 10px;
    }

    .scrubber-label strong {
        font-size: 0.75rem;
    }

    .scrubber-track {
        gap: 10px;
    }

    .track-bar {
        height: 18px;
    }

    .scrubber-track:hover .track-bar {
        height: 20px;
    }

    #timeScrubber {
        height: 6px;
        padding: 15px 0; /* Large invisible touch area */
    }

    #timeScrubber::-webkit-slider-runnable-track {
        height: 6px;
    }

    #timeScrubber::-moz-range-track {
        height: 6px;
    }

    #timeScrubber::-webkit-slider-thumb {
        width: 18px;
        height: 18px;
        margin-top: -6px;
        box-shadow: 0 4px 12px rgba(0, 91, 187, 0.4),
                    0 0 0 4px rgba(255, 255, 255, 0.9),
                    0 0 0 5px rgba(0, 91, 187, 0.1);
        /* No size change on mobile - prevents stuck state */
    }

    #timeScrubber::-moz-range-thumb {
        width: 18px;
        height: 18px;
        box-shadow: 0 4px 12px rgba(0, 91, 187, 0.4),
                    0 0 0 4px rgba(255, 255, 255, 0.9),
                    0 0 0 5px rgba(0, 91, 187, 0.1);
        /* No size change on mobile - prevents stuck state */
    }

    .scrubber-ends {
        font-size: 0.6rem;
        margin-top: 6px;
    }

    .leaflet-left {
        left: 8px !important;
    }

    .activity-sidebar.open ~ .map-section .leaflet-left {
        left: calc(8px + var(--sidebar-width-mobile, clamp(220px, 80vw, 280px))) !important;
    }

    .leaflet-control-zoom {
        margin-left: 0 !important;
        margin-top: 8px !important;
    }

    .modal-content {
        width: 90%;
        max-width: none;
        max-height: 85vh;
        padding: 1rem;
        overflow-y: auto;
    }

    .modal-content h2 {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }

    .modal-content select,
    .modal-content input,
    .modal-content textarea {
        padding: 0.65rem;
        font-size: 16px;
        margin-bottom: 0.5rem;
        -webkit-appearance: none;
        appearance: none;
    }

    .modal-content textarea {
        min-height: 80px;
        max-height: 120px;
    }

    .modal-content button {
        padding: 0.75rem;
        font-size: 1rem;
        margin-bottom: 0.5rem;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .map-legend {
        top: 50px;
        right: 8px;
        padding: 6px 8px;
    }

    .legend-title {
        font-size: 0.75rem;
        margin-bottom: 6px;
    }

    .legend-item {
        font-size: 0.7rem;
        gap: 6px;
        margin-bottom: 5px;
    }

    .legend-color {
        width: 12px;
        height: 12px;
    }
}

@media (max-width: 480px) {
    :root {
        --sidebar-width-mobile: clamp(190px, 82vw, 240px);
    }

    .ubloop-logo-header {
        right: -40px;
        height: 38px;
    }

    .logo-title {
        font-size: 0.95rem;
    }

    .ub-logo {
        height: 22px;
        padding: 2px 5px;
    }

    .ubloop-logo {
        height: 28px;
        margin-left: 0.25rem;
    }

    header p {
        font-size: 0.6rem;
    }

    .timeline-scrubber {
        padding: 6px 10px;
        bottom: 6px;
    }

    .scrubber-label span {
        font-size: 0.58rem;
        padding: 3px 8px;
    }

    .scrubber-track {
        gap: 8px;
    }

    .track-bar {
        height: 16px;
    }

    .activity-item {
        font-size: 0.8rem;
        padding: 0.6rem;
    }

    .modal-content {
        padding: 1rem;
        margin: 0.5rem;
    }
}