:root {
    color-scheme: dark light;
}

* {
    box-sizing: border-box;
}

/* Hide scrollbars but keep scroll functionality */
* {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

*::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #1f2933;
    background: #f8fafc;
}

body.controls-modal-open {
    overflow: hidden;
}

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0.75rem clamp(1.5rem, 4vw, 3rem);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(11, 17, 32, 0.95) 100%);
    backdrop-filter: blur(12px);
    color: #f9fafb;
    text-align: center;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    min-height: 70px;
    height: auto;
}

.app-header.header-hidden {
    transform: translateY(-100%);
}

/* Compact header for mobile scroll */
@media (max-width: 720px) {
    .app-header.header-compact {
        min-height: 60px;
        padding: 0.5rem 1rem;
    }
    
    .app-header.header-compact .header-inner {
        gap: 0.75rem;
    }
    
    .app-header.header-compact .header-icon-image {
        width: 36px;
        height: 36px;
    }
    
    .app-header.header-compact .header-content {
        gap: 0.5rem;
    }
    
    .app-header.header-compact .header-meta {
        display: none;
    }
    
    .app-header.header-compact .header-title {
        font-size: 1.5rem;
    }
    
    .app-header.header-compact .header-subtitle {
        font-size: 0.75rem;
    }
    
    body:not(.header-hidden) main {
        padding-top: 70px;
        transition: padding-top 0.3s ease;
    }
    
    body.header-compact:not(.header-hidden) main {
        padding-top: 60px;
    }
}

.header-home-button {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.95), #0b1120 65%);
    color: #f9fafb;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, transform 0.3s ease, box-shadow 0.15s ease;
    font-size: 1.5rem;
    line-height: 1;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    overflow: visible;
    text-decoration: none;
}

.header-home-button:hover,
.header-home-button:focus-visible {
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.98), #0b1120 75%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transform: translateX(-2px);
}

.header-home-hint {
    position: absolute;
    left: calc(100% + 0.75rem);
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(249, 250, 252, 0.9);
    background: rgba(15, 23, 42, 0.95);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.header-home-button:hover .header-home-hint,
.header-home-button:focus-visible .header-home-hint {
    opacity: 1;
}

.header-home-icon {
    transition: transform 0.15s ease;
}

.header-home-button:hover .header-home-icon,
.header-home-button:focus-visible .header-home-icon {
    transform: translateX(-2px);
}

.header-toggle-button {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1001;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.95), #0b1120 65%);
    color: #f9fafb;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, transform 0.3s ease, box-shadow 0.15s ease;
    font-size: 1.5rem;
    line-height: 1;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    overflow: visible;
}

.header-toggle-hint {
    position: absolute;
    right: calc(100% + 0.75rem);
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(249, 250, 252, 0.9);
    background: rgba(15, 23, 42, 0.95);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.header-toggle-button:hover .header-toggle-hint,
.header-toggle-button:focus-visible .header-toggle-hint {
    opacity: 1;
}


.header-toggle-button:hover,
.header-toggle-button:focus-visible {
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.98), #0b1120 75%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.header-toggle-button[aria-expanded="false"] {
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.95), #0b1120 65%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.header-toggle-button[aria-expanded="false"]:hover,
.header-toggle-button[aria-expanded="false"]:focus-visible {
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.98), #0b1120 75%);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.header-toggle-button[aria-expanded="false"] .header-toggle-icon {
    transform: rotate(180deg);
}

.header-toggle-icon {
    transition: transform 0.3s ease;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: min(1200px, 96vw);
    max-width: 100%;
}

.header-icon-button {
    border: none;
    background: transparent;
    border-radius: 24px;
    padding: 0;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.header-icon-button:focus-visible,
.header-icon-button:hover {
    transform: translateY(-1px) scale(1.03);
}

.header-icon-image {
    display: block;
    height: 48px;
    width: 48px;
    object-fit: contain;
    flex-shrink: 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    flex: 1;
    min-width: 0;
}

.header-main {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-shrink: 0;
}

.header-meta {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
    min-width: 0;
    text-align: right;
}



.header-title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: #f9fafb;
}

.header-subtitle {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(226, 232, 240, 0.75);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.header-description {
    margin: 0;
    font-size: 0.8125rem;
    color: rgba(226, 232, 240, 0.8);
    line-height: 1.4;
}

.header-disclaimer {
    margin: 0;
    font-size: 0.75rem;
    color: rgba(148, 163, 184, 0.7);
    line-height: 1.3;
}

.header-disclaimer a {
    color: #c084fc;
    text-decoration: none;
    font-weight: 500;
}

.header-disclaimer a:hover,
.header-disclaimer a:focus-visible {
    text-decoration: underline;
}

@media (max-width: 1024px) {
    .app-header {
        padding: 0.75rem 1.5rem;
    }

    .header-inner {
        flex-direction: column;
        gap: 0.75rem;
    }

    .header-content {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
        width: 100%;
    }

    .header-main {
        align-items: center;
    }

    .header-meta {
        text-align: center;
    }

    .header-icon-button {
        order: -1;
    }
}

@media (max-width: 640px) {
    .app-header {
        padding: 0.625rem 1rem;
    }

    .header-content {
        flex-direction: column;
        gap: 0.5rem;
    }

    .header-meta {
        text-align: center;
    }

    .header-title {
        font-size: 1.5rem;
    }

    .header-subtitle {
        font-size: 0.8125rem;
    }

    .header-description {
        font-size: 0.75rem;
    }

    .header-disclaimer {
        font-size: 0.6875rem;
    }
}

main {
    position: relative;
    height: 100vh;
    padding: 0;
    padding-top: 0;
    transition: padding-top 0.3s ease;
}

body:not(.header-hidden) main {
    padding-top: 70px;
    min-height: calc(100vh - 70px);
}

body.header-hidden main {
    padding-top: 0;
    height: 100vh;
}

body.header-hidden .app-header {
    transform: translateY(-100%);
}

#map {
    width: 100%;
    height: 100%;
    position: relative;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#map.map-visible {
    opacity: 1;
    pointer-events: auto;
}

/* Hide Leaflet attribution overlay */
.leaflet-control-attribution {
    display: none !important;
}

/* Hide Leaflet default controls */
.leaflet-control-zoom,
.leaflet-bar,
.leaflet-control {
    display: none !important;
}

.map-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0;
    z-index: 400;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.2);
}

.control-tile {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    color: rgba(249, 250, 252, 0.94);
    text-align: center;
    min-height: 60px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    transition: background-color 0.15s ease;
}

.control-tile:last-child {
    border-right: none;
}

.control-tile-status {
    background: transparent;
    cursor: default;
}

.control-tile-button {
    background: transparent;
    border: none;
    cursor: pointer;
}

.control-tile-button:hover:not(:disabled),
.control-tile-button:focus-visible:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
}

.control-tile-button:active:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
}

.control-tile-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.control-tile-button.loading {
    position: relative;
    color: transparent;
}

#current-location-button[data-location-status="go"] {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.4);
    color: rgba(34, 197, 94, 0.95);
}

#current-location-button[data-location-status="go"]:hover:not(:disabled) {
    background: rgba(34, 197, 94, 0.3);
    border-color: rgba(34, 197, 94, 0.5);
}

#current-location-button[data-location-status="no-go"] {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: rgba(239, 68, 68, 0.95);
}

#current-location-button[data-location-status="no-go"]:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
}

#current-location-button[data-location-status="error"] {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: rgba(239, 68, 68, 0.9);
}

.control-tile-button.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(249, 250, 252, 0.3);
    border-top-color: rgba(249, 250, 252, 0.94);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.state-checking-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    vertical-align: middle;
    border: 2px solid rgba(249, 250, 252, 0.3);
    border-top-color: rgba(249, 250, 252, 0.94);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.control-tile-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.control-tile-text a {
    color: rgba(59, 130, 246, 0.9);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s ease;
    white-space: normal;
}

.control-tile-text a:hover {
    color: rgba(96, 165, 250, 1);
}


.location-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1;
    background: rgba(17, 24, 39, 0.78);
    color: rgba(249, 250, 252, 0.94);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.location-button:hover:not(:disabled),
.location-button:focus-visible:not(:disabled) {
    background: rgba(30, 41, 59, 0.85);
    transform: translateY(-1px);
}

.location-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.location-button.loading {
    position: relative;
    color: transparent;
}

.location-button.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(249, 250, 252, 0.3);
    border-top-color: rgba(249, 250, 252, 0.94);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.location-button-icon {
    font-size: 1rem;
    line-height: 1;
}

.location-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1rem;
    min-width: 13.5rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
    transition: all 0.3s ease;
}

.location-status[aria-hidden="true"] {
    display: none;
}

.location-status[data-status="go"] {
    background: rgba(22, 163, 74, 0.9);
    color: #ffffff;
    border-color: rgba(22, 163, 74, 0.5);
}

.location-status[data-status="no-go"] {
    background: rgba(239, 68, 68, 0.9);
    color: #ffffff;
    border-color: rgba(239, 68, 68, 0.5);
}

.location-status[data-status="error"] {
    background: rgba(239, 68, 68, 0.9);
    color: #ffffff;
    border-color: rgba(239, 68, 68, 0.5);
}

.location-status[data-status="unknown"] {
    background: rgba(156, 163, 175, 0.9);
    color: #ffffff;
    border-color: rgba(156, 163, 175, 0.5);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#map {
    width: 100%;
    height: 100%;
    position: relative;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#map.map-visible {
    opacity: 1;
    pointer-events: auto;
}

.quick-access-panel {
    position: absolute;
    bottom: calc(1.25rem + 20px);
    left: 1.25rem;
    z-index: 400;
    background: rgba(17, 24, 39, 0.78);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
    min-width: 200px;
    overflow: hidden;
}

.quick-access-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.5);
}

.quick-access-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(249, 250, 252, 0.94);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.quick-access-toggles {
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    gap: 0.25rem;
}

.quick-access-item {
    display: flex;
    flex-direction: column;
}

.quick-access-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
    border: 1px solid transparent;
    background: transparent;
    color: rgba(249, 250, 252, 0.94);
    font-size: 0.875rem;
    text-align: left;
    width: 100%;
}

.quick-access-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
}

.quick-access-toggle:active {
    background: rgba(255, 255, 255, 0.12);
}

.quick-access-toggle.inactive {
    opacity: 0.5;
}

.quick-access-toggle-icon {
    font-size: 1.25rem;
    line-height: 1;
    min-width: 1.5rem;
    text-align: center;
}

.quick-access-toggle-label {
    flex: 1;
    font-weight: 500;
}

.quick-access-distance {
    font-size: 0.75rem;
    opacity: 0.7;
    font-weight: 400;
    margin-left: auto;
    padding-left: 0.5rem;
}

.quick-access-adjust {
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: rgba(249, 250, 252, 0.94);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    margin-left: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.quick-access-adjust:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.quick-access-adjust:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.6);
    outline-offset: 2px;
}

.quick-access-distance-controls {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 0.75rem;
}

.quick-access-item.expanded .quick-access-distance-controls {
    max-height: 500px;
    padding: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 0.25rem;
}

.distance-controls-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.distance-controls-inputs {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.distance-control-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.distance-control-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.distance-control-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.distance-control-number {
    width: 80px;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(15, 23, 42, 0.6);
    color: rgba(249, 250, 252, 0.94);
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
}

.distance-control-number:focus {
    outline: 2px solid rgba(59, 130, 246, 0.6);
    outline-offset: -2px;
}

.distance-controls-hint {
    font-size: 0.75rem;
    color: rgba(249, 250, 252, 0.7);
    line-height: 1.5;
}

.distance-controls-hint p {
    margin: 0 0 0.5rem 0;
}

.distance-controls-statute {
    color: #60a5fa;
    text-decoration: none;
    font-weight: 500;
}

.distance-controls-statute:hover {
    text-decoration: underline;
}

.reference-layers-panel {
    position: absolute;
    bottom: calc(1.25rem + 20px);
    right: 1.25rem;
    z-index: 400;
    background: rgba(17, 24, 39, 0.78);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
    min-width: 200px;
    overflow: hidden;
}

.reference-layers-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.5);
}

.reference-layers-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(249, 250, 252, 0.94);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.reference-layers-content {
    padding: 0.5rem;
}

.reference-layers-panel .overlay-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    color: rgba(249, 250, 252, 0.94) !important;
    font-size: 0.875rem;
    background: transparent;
}

.reference-layers-panel .overlay-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
}

.reference-layers-panel .overlay-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.reference-layers-panel .overlay-label {
    font-weight: 500;
    color: rgba(249, 250, 252, 0.94);
}

.reference-layers-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 5000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.reference-layers-modal[aria-hidden="false"] {
    display: block;
    pointer-events: auto;
    opacity: 1;
}

.reference-layers-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
}

.reference-layers-modal__panel {
    position: absolute;
    inset: 0;
    margin: auto;
    width: min(420px, calc(100% - 2.5rem));
    max-height: min(90vh, 500px);
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 35px 70px rgba(15, 23, 42, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overflow-y: auto;
}

.reference-layers-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.35rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.5);
}

.reference-layers-modal__header .reference-layers-title {
    margin: 0;
    font-size: 1.15rem;
    letter-spacing: 0.01em;
    color: rgba(249, 250, 252, 0.94);
}

.reference-layers-modal__close {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent;
    color: rgba(249, 250, 252, 0.94);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease;
    line-height: 1;
}

.reference-layers-modal__close:hover,
.reference-layers-modal__close:focus-visible {
    background: rgba(255, 255, 255, 0.1);
}

/* Disclaimer Modal */
.disclaimer-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.disclaimer-modal[aria-hidden="false"] {
    display: block;
    pointer-events: auto;
    opacity: 1;
}

.disclaimer-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
}

.disclaimer-modal__panel {
    position: absolute;
    inset: 0;
    margin: auto;
    width: min(600px, calc(100% - 2.5rem));
    max-height: min(85vh, 500px);
    background: rgba(17, 24, 39, 0.98);
    backdrop-filter: blur(12px);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 35px 70px rgba(15, 23, 42, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.disclaimer-modal__header {
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.disclaimer-modal__title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: rgba(249, 250, 252, 0.94);
}

.disclaimer-modal__body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1.75rem;
    color: rgba(249, 250, 252, 0.85);
    line-height: 1.6;
    /* Show scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.5) rgba(15, 23, 42, 0.3);
}

.disclaimer-modal__body::-webkit-scrollbar {
    width: 8px;
}

.disclaimer-modal__body::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.3);
    border-radius: 4px;
}

.disclaimer-modal__body::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.5);
    border-radius: 4px;
}

.disclaimer-modal__body::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.7);
}

.disclaimer-modal__body p {
    margin: 0 0 1rem 0;
}

.disclaimer-modal__body p:last-child {
    margin-bottom: 0;
}

.disclaimer-modal__body a {
    color: rgba(59, 130, 246, 0.9);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.disclaimer-modal__body a:hover {
    color: rgba(96, 165, 250, 1);
}

.disclaimer-modal__body strong {
    color: rgba(249, 250, 252, 0.95);
    font-weight: 600;
}

.disclaimer-modal__footer {
    padding: 1.25rem 1.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
}

.disclaimer-modal__button {
    background: rgba(59, 130, 246, 0.9);
    color: #ffffff;
    border: 1px solid rgba(59, 130, 246, 0.5);
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
    opacity: 0;
    pointer-events: none;
}

.disclaimer-modal__button:hover:not(:disabled),
.disclaimer-modal__button:focus-visible:not(:disabled) {
    background: rgba(37, 99, 235, 1);
    transform: translateY(-1px);
}

.disclaimer-modal__button:active:not(:disabled) {
    transform: translateY(0);
}

.disclaimer-modal__button:disabled {
    background: rgba(59, 130, 246, 0.4);
    color: rgba(255, 255, 255, 0.6);
    cursor: not-allowed;
    opacity: 0;
    pointer-events: none;
}

.disclaimer-modal__button:not(:disabled) {
    opacity: 1;
    pointer-events: auto;
}

.disclaimer-modal__scroll-hint {
    margin: 0.75rem 0 0 0;
    font-size: 0.875rem;
    color: rgba(249, 250, 252, 0.6);
    text-align: center;
    font-style: italic;
    transition: opacity 0.3s ease;
    opacity: 1;
}

.disclaimer-modal__scroll-hint.hidden {
    opacity: 0;
    pointer-events: none;
}

.reference-layers-modal__body {
    flex: 1;
    overflow-y: auto;
    padding: 1.1rem 1.35rem;
}

.reference-layers-modal__body .reference-layers-content {
    padding: 0;
}

.reference-layers-modal__body .overlay-toggle {
    color: rgba(249, 250, 252, 0.94) !important;
    background: transparent;
}

.reference-layers-note {
    margin: 1.5rem 0 0;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: rgba(249, 250, 252, 0.7);
    font-style: italic;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
}

.toggle-layers-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 5000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.toggle-layers-modal[aria-hidden="false"] {
    display: block;
    pointer-events: auto;
    opacity: 1;
}

.toggle-layers-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
}

.toggle-layers-modal__panel {
    position: absolute;
    inset: 0;
    margin: auto;
    width: min(500px, calc(100% - 2.5rem));
    max-height: min(90vh, 600px);
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 35px 70px rgba(15, 23, 42, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overflow-y: auto;
}

.toggle-layers-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.35rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.5);
}

.toggle-layers-modal__header .quick-access-title {
    margin: 0;
    font-size: 1.15rem;
    letter-spacing: 0.01em;
    color: rgba(249, 250, 252, 0.94);
}

.toggle-layers-modal__close {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent;
    color: rgba(249, 250, 252, 0.94);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease;
    line-height: 1;
}

.toggle-layers-modal__close:hover,
.toggle-layers-modal__close:focus-visible {
    background: rgba(255, 255, 255, 0.1);
}

.toggle-layers-modal__body {
    flex: 1;
    overflow-y: auto;
    padding: 1.1rem 1.35rem;
}

.texas-recommendation {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.texas-recommendation-text {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.6;
    color: rgba(249, 250, 252, 0.85);
}

.texas-recommendation-text strong {
    color: rgba(249, 250, 252, 0.95);
    font-weight: 600;
}

.texas-recommendation-text a {
    color: rgba(59, 130, 246, 0.9);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s ease;
}

/* Burn Ban Button */
.burn-ban-button-container {
    margin: 10px;
}

.burn-ban-button {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    transition: all 0.2s ease;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    backdrop-filter: blur(8px);
}

.burn-ban-button:hover,
.burn-ban-button:focus-visible {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.5);
    border-color: rgba(255, 255, 255, 0.3);
}

.burn-ban-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* Burn Ban Modal */
.burn-ban-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 5000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    align-items: center;
    justify-content: center;
}

.burn-ban-modal[aria-hidden="false"] {
    display: flex;
    pointer-events: auto;
    opacity: 1;
}

.burn-ban-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
}

.burn-ban-modal__panel {
    position: relative;
    width: min(600px, calc(100% - 2.5rem));
    max-height: min(90vh, 700px);
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 35px 70px rgba(15, 23, 42, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 5001;
}

.burn-ban-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.35rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.5);
}

.burn-ban-modal__title {
    margin: 0;
    font-size: 1.15rem;
    letter-spacing: 0.01em;
    color: rgba(249, 250, 252, 0.94);
}

.burn-ban-modal__close {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent;
    color: rgba(249, 250, 252, 0.94);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease;
    line-height: 1;
}

.burn-ban-modal__close:hover,
.burn-ban-modal__close:focus-visible {
    background: rgba(255, 255, 255, 0.1);
}

.burn-ban-modal__body {
    flex: 1;
    overflow-y: auto;
    padding: 1.1rem 1.35rem;
    color: rgba(249, 250, 252, 0.94);
}

.burn-ban-modal__body h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1.1rem;
    color: rgba(249, 250, 252, 0.95);
}

.burn-ban-title {
    margin: 0.5rem 0 1rem 0;
    font-size: 0.9rem;
    color: rgba(249, 250, 252, 0.8);
    font-weight: 500;
}

.burn-ban-count {
    margin: 0.75rem 0;
    font-size: 0.95rem;
    color: rgba(249, 250, 252, 0.9);
    font-weight: 600;
}

.burn-ban-list {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
    list-style-type: disc;
    color: rgba(249, 250, 252, 0.85);
    line-height: 1.8;
}

.burn-ban-list li {
    margin: 0.4rem 0;
}

.burn-ban-no-bans {
    margin: 1rem 0;
    font-size: 0.95rem;
    color: rgba(249, 250, 252, 0.8);
    font-style: italic;
}

.burn-ban-error {
    color: rgba(239, 68, 68, 0.9);
    font-size: 0.95rem;
    margin: 1rem 0;
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.texas-recommendation-text a:hover {
    color: rgba(96, 165, 250, 1);
}

.toggle-layers-modal__body .quick-access-toggles {
    padding: 0;
}

.control-tile-status[data-status="success"] {
    color: rgba(34, 197, 94, 0.95);
}

.control-tile-status[data-status="go"] {
    color: rgba(34, 197, 94, 0.95);
}

.control-tile-status[data-status="no-go"] {
    color: rgba(239, 68, 68, 0.95);
}

.control-tile-status[data-status="warning"] {
    color: rgba(251, 191, 36, 0.95);
}

.control-tile-status[data-status="error"] {
    color: rgba(239, 68, 68, 0.95);
}

.control-tile-status[data-status="info"] {
    color: rgba(249, 250, 252, 0.94);
}

@media (max-width: 720px) {
    main {
        height: calc(100vh - 120px);
    }

    .map-controls {
        flex-wrap: wrap;
        padding-bottom: 0;
    }

    .map-controls .control-tile {
        flex: 1 1 33.333%;
        font-size: 0.75rem;
        padding: 0.875rem 0.5rem;
        min-height: 56px;
    }

    .map-controls .control-tile-status {
        flex: 1 1 100%;
        border-right: none;
    }

    /* Hide desktop panels on mobile */
    .quick-access-panel,
    .reference-layers-panel {
        display: none;
    }

    .status-message {
        font-size: 0.75rem;
    }

    .quick-access-title {
        font-size: 0.75rem;
    }

    .quick-access-toggle {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    .quick-access-toggle-icon {
        font-size: 1.1rem;
        min-width: 1.25rem;
    }

    .reference-layers-title {
        font-size: 0.75rem;
    }

    .reference-layers-panel .overlay-toggle {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    .reference-layers-panel .overlay-icon {
        font-size: 1.1rem;
    }
}


#map {
    width: 100%;
    height: 100%;
    position: relative;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#map.map-visible {
    opacity: 1;
    pointer-events: auto;
}

.state-easter-egg {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    display: none;
    pointer-events: auto;
}

.state-easter-egg-content {
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    border: 2px solid #ef4444;
    border-radius: 16px;
    padding: 2rem 3rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 40px rgba(239, 68, 68, 0.3);
    text-align: center;
    min-width: 300px;
}

.state-easter-egg-text {
    font-size: clamp(1.5rem, 4vw, 3rem);
    font-weight: 900;
    color: #ef4444;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.5), 0 4px 8px rgba(0, 0, 0, 0.5);
    margin: 0 0 1.5rem 0;
    animation: pulse 2s ease-in-out infinite;
}

.state-easter-egg-button {
    background: #ef4444;
    color: #ffffff;
    border: 2px solid #dc2626;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.15s ease;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.state-easter-egg-button:hover {
    background: #dc2626;
    transform: scale(1.05);
}

.state-easter-egg-button:active {
    transform: scale(0.98);
}

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

.user-location-pulse {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3b82f6;
    border: 3px solid #ffffff;
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 1);
    animation: pulse-location 2s infinite;
}

@keyframes pulse-location {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

.share-pin-marker {
    background: transparent;
    border: none;
    cursor: pointer;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

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

.controls-toggle {
    padding: 0.55rem 0.95rem;
    border-radius: 999px;
    border: none;
    background: rgba(17, 24, 39, 0.85);
    color: #f9fafb;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.controls-toggle:hover,
.controls-toggle:focus-visible {
    background: rgba(17, 24, 39, 0.95);
    transform: translateY(-1px);
}

.controls-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 450;
}

.controls-modal.is-open {
    display: block;
}

.controls-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
}

.controls-modal__panel {
    position: absolute;
    inset: 0;
    margin: auto;
    width: min(420px, calc(100% - 2.5rem));
    max-height: min(90vh, 680px);
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 35px 70px rgba(15, 23, 42, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overflow-y: auto;
}

.controls-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.35rem 0.75rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.controls-modal__header h2 {
    margin: 0;
    font-size: 1.15rem;
    letter-spacing: 0.01em;
}

.controls-modal__close {
    border: none;
    background: transparent;
    font-size: 1.35rem;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 0.2rem 0.35rem;
    border-radius: 6px;
    transition: background 0.2s ease, color 0.2s ease;
}

.controls-modal__close:hover,
.controls-modal__close:focus-visible {
    background: rgba(17, 24, 39, 0.08);
    color: #111827;
}

.controls-modal__body {
    flex: 1;
    overflow-y: auto;
}

.controls-section {
    padding: 1.1rem 1.35rem;
}

.controls-section + .controls-section {
    border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.controls-section h3 {
    margin: 0 0 0.6rem;
    font-size: 1rem;
    color: #111827;
}

.legend-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.4rem;
}

.legend-list li {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.95rem;
}

.legend-swatch {
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.15);
}

.legend-swatch--fuel {
    background: #f59e0b;
}

.legend-swatch--hospital {
    background: #ef4444;
}

.legend-swatch--school {
    background: #3b82f6;
}

.legend-swatch--worship {
    background: #8b5cf6;
}

.right-click-tip {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(17, 24, 39, 0.95);
    color: #f8fafc;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-size: 0.875rem;
    max-width: 280px;
    animation: slideInRight 0.3s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.right-click-tip[aria-hidden="true"] {
    display: none;
}

.right-click-tip-text {
    flex: 1;
    line-height: 1.4;
}

.right-click-tip-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.right-click-tip-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 1);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@media (max-width: 720px) {
    .right-click-tip {
        bottom: 70px;
        right: 10px;
        left: 10px;
        max-width: none;
        font-size: 0.8rem;
        padding: 8px 12px;
    }
}

.status-message {
    margin: 0;
    padding: 0.55rem 0.85rem;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.85);
    color: #f8fafc;
    font-size: 0.85rem;
    font-weight: 500;
    backdrop-filter: blur(4px);
    box-shadow: 0 15px 30px rgba(15, 23, 42, 0.25);
}

.distance-control {
    display: grid;
    gap: 0.6rem;
    margin-bottom: 1.4rem;
}

.distance-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1f2933;
}

.distance-accordion {
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 10px;
    background: #f9fafb;
    padding: 0.2rem 0.6rem 0.6rem;
}

.distance-accordion summary {
    cursor: pointer;
    font-weight: 600;
    color: #1f2933;
    padding: 0.35rem 0.1rem;
    border-radius: 6px;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.distance-accordion summary::before {
    content: "➤";
    font-size: 0.75rem;
    color: #2563eb;
    transition: transform 0.2s ease;
}

.distance-accordion[open] summary::before {
    transform: rotate(90deg);
}

.distance-accordion summary::-webkit-details-marker {
    display: none;
}

.distance-groups {
    display: grid;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.distance-group {
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: 10px;
    padding: 0.75rem;
    background: #f8fafc;
}

.distance-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.distance-group-label {
    font-weight: 600;
    color: #1f2933;
}

.distance-group-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2563eb;
}

.distance-group-inputs {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.6rem;
}

.distance-group-inputs input[type="range"] {
    flex: 1;
}

.distance-group-inputs input[type="number"] {
    width: 90px;
    padding: 0.4rem 0.55rem;
    border-radius: 6px;
    border: 1px solid rgba(15, 23, 42, 0.15);
    font-size: 0.9rem;
}

.distance-group-inputs input[type="number"]:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.6);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.distance-group-hint {
    margin: 0.5rem 0 0;
    font-size: 0.8rem;
    color: #6b7280;
}

.distance-group-statute {
    display: inline-block;
    margin-top: 0.2rem;
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
}

.distance-group-statute:hover,
.distance-group-statute:focus-visible {
    text-decoration: underline;
}

.distance-helper {
    margin: 0;
    font-size: 0.85rem;
    color: #6b7280;
}

.amenity-controls {
    display: grid;
    gap: 0.6rem;
    margin: 0;
    padding: 0;
}

.overlay-controls {
    margin-top: 1.25rem;
    display: grid;
    gap: 0.75rem;
}

.overlay-controls h3 {
    margin: 0;
    font-size: 1.05rem;
}

.overlay-toggle {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 8px;
    background: #f0fdf4;
    font-size: 0.95rem;
}

.overlay-toggle input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: #16a34a;
}

.overlay-icon {
    font-size: 1.1rem;
}

.overlay-label {
    font-weight: 600;
}

.amenity-toggle {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid rgba(37, 99, 235, 0.25);
    border-radius: 8px;
    background: #f8fafc;
    color: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.amenity-toggle.active {
    border-color: rgba(37, 99, 235, 0.65);
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.amenity-toggle:hover {
    border-color: rgba(37, 99, 235, 0.5);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.1);
}

.amenity-toggle input {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: #2563eb;
}

.amenity-toggle .amenity-icon {
    font-size: 1.1rem;
}

.amenity-toggle .amenity-label {
    font-weight: 600;
}

.status-message {
    margin-top: 1.25rem;
    font-size: 0.95rem;
    color: #4b5563;
}

.status-message[data-status="success"] {
    color: #047857;
}

.status-message[data-status="warning"] {
    color: #d97706;
}

.status-message[data-status="error"] {
    color: #dc2626;
}

.popup-line {
    margin-top: 0.4rem;
    font-size: 0.95rem;
}

.popup-id {
    font-size: 0.85rem;
    color: #1d4ed8;
}

.popup-id code {
    font-family: "Fira Code", "Source Code Pro", ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.85em;
    background: rgba(37, 99, 235, 0.1);
    padding: 0.1rem 0.3rem;
    border-radius: 6px;
    font-weight: 600;
}

.popup-details {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    display: block;
    width: 100%;
}

.popup-details summary {
    cursor: pointer;
    color: #2563eb;
    font-weight: 600;
    padding: 0.35rem 0.2rem;
    border-radius: 6px;
    transition: background 0.15s ease;
    list-style: none;
}

.popup-details summary::marker {
    display: none;
}

.popup-details[open] summary {
    background: rgba(37, 99, 235, 0.08);
}

.popup-details summary::-webkit-details-marker {
    display: none;
}

.popup-details summary::before {
    content: "⯈";
    display: inline-block;
    margin-right: 0.5rem;
    transition: transform 0.2s ease;
}

.popup-details[open] summary::before {
    transform: rotate(90deg);
}

.leaflet-popup {
    max-width: 1220px !important;
}

.leaflet-popup-content-wrapper {
    min-width: 360px;
    max-width: 1200px;
}

.leaflet-popup-content {
    margin: 0.45rem 0.6rem;
    min-width: 340px;
    max-width: 1180px;
}

.popup-detail-grid {
    margin-top: 0.7rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 0.7rem;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 0.35rem;
}

.popup-detail-row {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.5rem 0.55rem;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.045);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.popup-detail-key {
    font-weight: 600;
    color: #1f2933;
    white-space: nowrap;
}

.popup-detail-value {
    color: #374151;
    word-break: break-word;
    white-space: normal;
}

.leaflet-popup-tip {
    width: 18px;
    height: 12px;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    transition: width 0.2s ease, max-width 0.2s ease;
}

@media (min-width: 960px) {
    main {
        grid-template-columns: 2fr 1fr;
        align-items: start;
    }

    .map-wrapper {
        height: min(70vh, 720px);
    }
}
