html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Icons', 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    background-color: #f5f5f5;
    color: #1c1c1c;
    position: relative;
    height: 100vh;
    overflow: auto; /* Allow normal scrolling */
}

body.dark-theme {
    background-color: #1c1c1c;
    color: #f5f5f5;
}

/* Fix map container styling */
#map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh !important; /* Force height */
    z-index: 0;
    background: #fff;
}

/* Remove or modify dark theme for map */
#map.dark-theme {
    filter: none;
}

/* Make loading overlay more visible but ensure it can be hidden */
#loading {
    position: fixed; /* Change to fixed for better visibility */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999; /* Make sure it's above everything else */
    background-color: rgba(255, 255, 255, 0.9);
    padding: 20px 30px;
    border-radius: 10px;
    font-size: 1.2em;
    color: #333;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#loading.active {
    display: block !important;
}

#loading.dark-theme {
    background-color: rgba(50, 50, 50, 0.85);
    color: #f5f5f5;
}

#start-point {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background-color: #007AFF;
    border: 2px solid white;
    border-radius: 50%;
    z-index: 9999;
    cursor: pointer;
    animation: pulsate 2s infinite;
    box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.7);
}

#instructions {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    color: #000000;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    max-width: 80%;
    text-align: center;
    border: 0.5px solid rgba(0, 0, 0, 0.1);
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
    font-weight: 400;
}

#instructions.dark-theme {
    background: rgba(40, 40, 40, 0.8);
    color: #ffffff;
    border: 0.5px solid rgba(255, 255, 255, 0.1);
}

footer {
    position: fixed;
    bottom: 20px; /* Changed from 10px to 20px */
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 0.9em;
    color: #555;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 10px 0;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    z-index: 120;
}

footer.dark-theme {
    background-color: rgba(50, 50, 50, 0.85);
    color: #f5f5f5;
}

footer a {
    color: #007AFF;
    text-decoration: none;
    font-weight: 600;
}

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

.leaflet-top {
    top: 20px;
}

.leaflet-left {
    left: 20px;
}

/* Styles for the distance options */
#distance-options {
    position: fixed; /* Change from absolute */
    z-index: 9998;   /* Higher than the map */
    top: 50%;
    left: calc(50% + 60px);
    transform: translate(0, -50%);
    display: none;
    flex-direction: column;
    gap: 10px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 8px;
    border-radius: 8px;
    border: 0.5px solid rgba(0, 0, 0, 0.1);
}

#distance-options.dark-theme {
    background-color: rgba(50, 50, 50, 0.85);
    display: none;
    gap: 10px; /* Remove spacing between buttons in dark mode */
    background: rgba(40, 40, 40, 0.8);
    border: 0.5px solid rgba(255, 255, 255, 0.1);
}

#distance-options.dark-theme .distance-btn {
    background: linear-gradient(135deg, #333 0%, #555 100%);
    background: linear-gradient(180deg, #3a3a3a 0%, #2d2d2d 100%);
    color: #ffffff;
    border: 0.5px solid rgba(255, 255, 255, 0.1);
}

#distance-options.dark-theme .distance-btn:hover {
    background: linear-gradient(135deg, #444 0%, #222 100%);
    background: linear-gradient(180deg, #404040 0%, #333333 100%);
}

.distance-btn {
    background: linear-gradient(135deg, #81ecec 0%, #00cec9 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s, box-shadow 0.3s;
    background: linear-gradient(180deg, #ffffff 0%, #f7f7f7 100%);
    color: #000000;
    border: 0.5px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
    min-width: 80px;
    text-align: center;
}

.distance-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
    background: linear-gradient(180deg, #f7f7f7 0%, #f0f0f0 100%);
    transform: translateY(0);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.distance-btn:active {
    background: linear-gradient(180deg, #f0f0f0 0%, #e8e8e8 100%);
    transform: translateY(1px);
    box-shadow: 0 0 1px rgba(0, 0, 0, 0.1);
}

.distance-btn.dark-theme,
#distance-options.dark-theme .distance-btn {
    background: linear-gradient(180deg, #3a3a3a 0%, #2d2d2d 100%);
    color: #ffffff;
    border: 0.5px solid rgba(255, 255, 255, 0.1);
}

.distance-btn.dark-theme:hover,
#distance-options.dark-theme .distance-btn:hover {
    background: linear-gradient(180deg, #404040 0%, #333333 100%);
}

.distance-btn.dark-theme:active,
#distance-options.dark-theme .distance-btn:active {
    background: linear-gradient(180deg, #2d2d2d 0%, #262626 100%);
}

button:focus {
    outline: 2px solid #007AFF;
    outline-offset: 2px;
    outline: none;
    box-shadow: 0 0 0 2px #007AFF;
}

.export-buttons {
    position: absolute;
    bottom: 80px;
    right: 20px;
    display: none; /* Hide by default */
    flex-direction: column;
    gap: 12px;
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 0.5px solid rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.export-buttons.dark-theme {
    background: rgba(40, 40, 40, 0.8);
    border: 0.5px solid rgba(255, 255, 255, 0.1);
}

.export-btn {
    /* Remove display property or set to original value */
    /* Ensure buttons are styled correctly within the overlay */
    padding: 8px 16px;
    background: linear-gradient(180deg, #f7f7f7 0%, #e2e2e2 100%);
    color: #333;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 2px 5px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.2s, background-color 0.2s;
    display: flex; /* Ensure buttons are visible */
}

.export-btn.dark-theme {
    background-color: rgba(50, 50, 50, 0.85);
}

.export-btn:hover {
    background-color: #005BBB;
    box-shadow: inset 0 1px 0 rgba(224, 19, 19, 0.6), 0 2px 5px rgba(0, 0, 0, 0.2);
}

#arrow-keys-info {
    position: fixed;
    bottom: 180px; /* Increased to make room for export buttons */
    left: 20px;
    background-color: rgba(255, 255, 255, 0.85);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1em;
    color: #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 9999;
}

#arrow-keys-info.dark-theme {
    background-color: rgba(50, 50, 50, 0.85);
    color: #f5f5f5;
}

.emoji-toggle-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    background: linear-gradient(180deg, #ffffff 0%, #f7f7f7 100%);
    color: #000000;
    border: 0.5px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
    z-index: 9999;
    -webkit-font-smoothing: antialiased;
}

.emoji-toggle-btn:hover {
    background: linear-gradient(180deg, #f7f7f7 0%, #f0f0f0 100%);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.emoji-toggle-btn:active {
    background: linear-gradient(180deg, #f0f0f0 0%, #e8e8e8 100%);
    transform: translateY(1px);
    box-shadow: 0 0 1px rgba(0, 0, 0, 0.1);
}

.emoji-toggle-btn.dark-theme {
    background: linear-gradient(180deg, #3a3a3a 0%, #2d2d2d 100%);
    color: #ffffff;
    border: 0.5px solid rgba(255, 255, 255, 0.1);
}

.emoji-toggle-btn.dark-theme:hover {
    background: linear-gradient(180deg, #404040 0%, #333333 100%);
}

.emoji-toggle-btn.dark-theme:active {
    background: linear-gradient(180deg, #2d2d2d 0%, #262626 100%);
}

/* Create a pulsating animation */
@keyframes pulsate {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.5);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(0, 122, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 122, 255, 0);
    }
}

/* Click Me Label styles */
.click-me-label {
    position: fixed;
    top: calc(50% - 40px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    color: #007AFF;
    font-weight: 600;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: bounce 1.5s infinite;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 0.5px solid rgba(0, 122, 255, 0.2);
    pointer-events: none;
}

.click-me-label.dark-theme {
    background: rgba(40, 40, 40, 0.9);
    color: #fff;
    border: 0.5px solid rgba(255, 255, 255, 0.2);
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    40% {
        transform: translateX(-50%) translateY(-10px);
    }
    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

#weather-container {
    position: fixed;
    top: 80px;
    left: 20px;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 250px;
    font-size: 14px;
    border: 0.5px solid rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

#weather-container.dark-theme {
    background: rgba(40, 40, 40, 0.8);
    color: #f5f5f5;
    border: 0.5px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

#weather-header {
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

#weather-container.dark-theme #weather-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.weather-hour {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

#weather-container.dark-theme .weather-hour {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.weather-hour:last-child {
    border-bottom: none;
}

.weather-icon {
    width: 30px;
    height: 30px;
}

#weather-container.dark-theme .weather-icon {
    filter: brightness(1.2);
}