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

html {
    min-height: 100dvh;
}

body {
    color: #202020;
    font-family:
        Mulish,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    background: #ededed;
}

.page {
    min-height: 100%;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.header {
    max-width: 840px;
    padding: 1.25rem 1rem 1rem;
}

.header h1 {
    margin: 0 0 0.35rem;
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    line-height: 1.05;
}

.header p {
    max-width: 680px;
    margin: 0;
    color: #555;
    line-height: 1.45;
}

.header p a {
    color: #1e293b;
    font-weight: 700;
    text-decoration-color: rgba(30, 41, 59, 0.35);
    text-underline-offset: 0.18em;
}

.header p a:hover {
    color: #ee3377;
    text-decoration-color: currentColor;
}

.map-wrapper {
    position: relative;
    flex: 1 1 70vh;
    min-height: 70vh;
}

#map {
    position: absolute;
    inset: 0;
}

.popup {
    width: max-content;
    max-width: 100%;
    color: #475569;
    font-size: 13px;
    line-height: 1.35;
}

.popup-title {
    margin: 0 0 0.7rem;
    color: #111827;
    font-size: 15px;
    line-height: 1.25;
}

.popup-title span {
    color: #6b7280;
    font-weight: 700;
}

.popup-details {
    display: grid;
    gap: 0.35rem;
}

.popup-row {
    display: grid;
    grid-template-columns: 104px 1fr;
    column-gap: 10px;
    align-items: baseline;
}

.popup-row span {
    color: #6b7280;
}

.popup-row strong {
    min-width: 0;
    justify-self: start;
    color: #374151;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.popup-row code {
    color: #111827;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
}

.popup-coords {
    position: relative;
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    gap: 0.45rem;
    align-items: center;
    padding: 0.25rem 0.35rem 0.25rem 0.45rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #f3f4f6;
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.popup-coords code {
    display: flex;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: all;
    white-space: nowrap;
}

.popup-coords code span + span::before {
    content: "";
}

.popup-coords:hover,
.popup-coords:focus-visible {
    border-color: #9ca3af;
    background: #e5e7eb;
}

.popup-copy-icon {
    position: relative;
    flex: 0 0 auto;
    width: 13px;
    height: 13px;
    opacity: 0.65;
}

.popup-copy-icon::before,
.popup-copy-icon::after {
    position: absolute;
    width: 8px;
    height: 9px;
    border: 1.5px solid #4b5563;
    border-radius: 2px;
    content: "";
}

.popup-copy-icon::before {
    top: 3px;
    left: 1px;
}

.popup-copy-icon::after {
    top: 0;
    right: 1px;
    background: #f3f4f6;
}

.popup-coords:hover .popup-copy-icon::after,
.popup-coords:focus-visible .popup-copy-icon::after {
    background: #e5e7eb;
}

.popup-copy-status {
    position: absolute;
    right: 0;
    bottom: calc(100% + 5px);
    padding: 0.18rem 0.38rem;
    border-radius: 4px;
    background: #111827;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    opacity: 0;
    pointer-events: none;
    transform: translateY(2px);
    transition: opacity 120ms ease, transform 120ms ease;
    white-space: nowrap;
}

.popup-coords.is-copied .popup-copy-status,
.popup-coords.is-copy-failed .popup-copy-status {
    opacity: 1;
    transform: translateY(0);
}

.popup-divider {
    height: 1px;
    margin: 0.75rem 0 0.6rem;
    background: #e5e7eb;
}

.popup-section-title {
    margin-bottom: 0.35rem;
    color: #111827;
    font-size: 13px;
    font-weight: 700;
}

.maplibregl-popup-content {
    width: max-content;
    max-width: min(330px, calc(100vw - 48px));
    box-sizing: border-box;
    padding: 0.9rem 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.22);
}

.maplibregl-popup-close-button {
    font-size: 0;
}

.maplibregl-popup-close-button::before {
    color: #4b5563;
    content: "\f00d";
    font-family: "Font Awesome 6 Free";
    font-size: 14px;
    font-weight: 900;
}

.maplibregl-popup-close-button:hover::before {
    color: #111827;
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    padding: 0.85rem 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(255, 255, 255, 0.9);
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.4;
}

.site-footer a {
    color: #1e293b;
    font-weight: 700;
    text-decoration-color: rgba(30, 41, 59, 0.35);
    text-underline-offset: 0.18em;
}

.site-footer a:hover {
    color: #ee3377;
    text-decoration-color: currentColor;
}

.language-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    white-space: nowrap;
}

.language-switcher span {
    font-weight: 700;
}

.language-toggle {
    display: inline-flex;
    padding: 2px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #e2e8f0;
}

.language-toggle button {
    min-width: 42px;
    padding: 0.25rem 0.55rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #475569;
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
    transition: background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.language-toggle button:hover,
.language-toggle button:focus-visible {
    color: #1e293b;
}

.language-toggle button.is-active {
    background: #1e293b;
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
}

.basemap-switcher {
    position: absolute;
    top: 86px;
    left: 10px;
    z-index: 10;
    width: 100px;
    padding: 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    color: #1e293b;
    font-size: 12px;
}

.basemap-switcher-title {
    display: block;
    width: 100%;
    margin: 0 0 6px;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 0;
    text-align: left;
}

.basemap-options {
    display: grid;
    gap: 5px;
}

.basemap-toggle {
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #ffffff;
    color: #475569;
    cursor: pointer;
    font: inherit;
    padding: 4px 6px;
    text-align: left;
}

.basemap-toggle:hover,
.basemap-toggle.is-active {
    border-color: #64748b;
    background: #f1f5f9;
    color: #1e293b;
}

.basemap-toggle.is-active {
    font-weight: 700;
}

/* Legend panel */
.legend-panel {
    position: absolute;
    top: 10px;
    right: 50px;
    background: rgba(255, 255, 255, 0.95);
    padding: 14px 18px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    z-index: 10;
    font-family:
        Mulish,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    font-size: 13px;
    color: #1e293b;
    width: 220px;
    max-height: calc(100% - 20px);
    box-sizing: border-box;
    overflow-y: auto;
}

.legend-panel-title {
    display: none;
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 0;
    text-align: left;
}

.legend-section {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.legend-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.legend-title {
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 8px;
    color: #1e293b;
}

.legend-row {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    font-size: 12px;
    line-height: 1.3;
}

.legend-filter {
    width: 100%;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    padding: 2px 4px;
    text-align: left;
}

.legend-filter:hover,
.legend-filter.is-active {
    background: rgba(238, 51, 119, 0.1);
}

.legend-filter.is-active {
    font-weight: 700;
}

.checkbox-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1.3;
}

.checkbox-toggle input {
    margin: 0;
}

.color-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.color-toggle {
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #ffffff;
    color: #475569;
    cursor: pointer;
    font: inherit;
    font-size: 11px;
    line-height: 1.2;
    padding: 4px 8px;
}

.color-toggle:hover,
.color-toggle.is-active {
    border-color: #ee3377;
    background: rgba(238, 51, 119, 0.1);
    color: #1e293b;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
    border: 1.5px solid #ffffff;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
}

.legend-ring {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
    border: 2.875px solid;
    background: #e2e8f0;
    box-sizing: border-box;
}

.size-legend-wrap {
    position: relative;
    height: 52px;
    margin-top: 2px;
}

.size-circle {
    position: absolute;
    bottom: 5px;
    left: 20px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: rgba(203, 213, 225, 0.4);
    border: 1px solid #64748b;
    box-sizing: border-box;
}

.size-circle-xl {
    width: 28px;
    height: 28px;
}

.size-circle-lg {
    width: 20px;
    height: 20px;
}

.size-circle-md {
    width: 12px;
    height: 12px;
}

.size-lines {
    position: absolute;
    bottom: 5px;
    left: 20px;
    overflow: visible;
}

.size-lines line {
    stroke: #94a3b8;
    stroke-width: 1;
    stroke-dasharray: 2 2;
}

.size-label {
    position: absolute;
    left: 52px;
    font-size: 11px;
    color: #1e293b;
    line-height: 1;
    white-space: nowrap;
}

.size-label-xl {
    bottom: 30px;
}

.size-label-lg {
    bottom: 18px;
}

.size-label-md {
    bottom: 6px;
}


.changelog-content {
    flex: 1;
    width: min(840px, calc(100% - 2rem));
    margin: 0 1rem 2rem;
    box-sizing: border-box;
}

.content-panel {
    flex: 1;
    width: calc(100% - 2rem);
    margin: 0 1rem 2rem;
    box-sizing: border-box;
}

.back-link {
    margin: 0 0 1rem;
}

.back-link a,
.version a,
.content-panel a {
    color: #1e293b;
    font-weight: 700;
    text-decoration-color: rgba(30, 41, 59, 0.35);
    text-underline-offset: 0.18em;
}

.back-link a:hover,
.version a:hover,
.content-panel a:hover {
    color: #ee3377;
    text-decoration-color: currentColor;
}

.version,
.content-panel {
    padding: 1rem 1.15rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.version h2,
.content-panel h2 {
    margin: 0 0 0.75rem;
    color: #1e293b;
    font-size: 1.1rem;
    line-height: 1.3;
}

.version ul {
    margin: 0;
    padding-left: 1.25rem;
    color: #475569;
    line-height: 1.45;
}

.content-panel p {
    margin: 0 0 0.85rem;
    color: #475569;
    line-height: 1.45;
}

.content-panel p:last-child {
    margin-bottom: 0;
}

/* Responsive: keep controls compact and floating on small screens. */
@media (max-width: 600px) {
    .header {
        padding: 0.75rem 1rem 0.65rem;
    }

    .header p {
        font-size: 0.9rem;
        line-height: 1.35;
    }

    .map-wrapper {
        flex: 1 1 auto;
        min-height: 68dvh;
    }

    .basemap-switcher {
        top: auto;
        bottom: 34px;
        left: 10px;
        width: 124px;
        box-sizing: border-box;
        padding: 7px;
    }

    .basemap-switcher-title::after,
    .legend-panel-title::after {
        width: 1em;
        margin-left: auto;
        content: "\f078";
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        text-align: center;
    }

    .basemap-switcher:not(.is-expanded) .basemap-switcher-title,
    .legend-panel:not(.is-expanded) .legend-panel-title {
        margin-bottom: 0;
    }

    .basemap-switcher:not(.is-expanded) .basemap-switcher-title::after,
    .legend-panel:not(.is-expanded) .legend-panel-title::after {
        content: "\f054";
    }

    .basemap-switcher-title,
    .legend-panel-title {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .basemap-switcher:not(.is-expanded) .basemap-options {
        display: none;
    }

    .basemap-options {
        display: grid;
        grid-template-columns: 1fr;
    }

    .basemap-toggle {
        min-height: 30px;
        padding: 5px 6px;
    }

    .legend-panel {
        top: 10px;
        right: 10px;
        bottom: auto;
        width: min(220px, calc(100vw - 20px));
        max-height: 42dvh;
        padding: 8px 10px;
        border-radius: 8px;
    }

    .legend-panel-title {
        display: flex;
        margin-bottom: 5px;
    }

    .legend-panel:not(.is-expanded) {
        max-height: none;
        overflow: hidden;
    }

    .legend-panel:not(.is-expanded) .legend-section:not(:first-child) {
        display: none;
    }

    .legend-panel:not(.is-expanded) .legend-section:first-child {
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: 0;
    }

    .legend-section {
        margin-bottom: 6px;
        padding-bottom: 6px;
    }

    .legend-title {
        margin-bottom: 5px;
    }

    .legend-row {
        margin-bottom: 2px;
    }

    .color-toggles {
        gap: 3px;
    }

    .color-toggle {
        font-size: 10px;
        padding: 3px 6px;
    }

    .legend-row,
    .checkbox-toggle {
        font-size: 11px;
    }

    .legend-filter,
    .color-toggle,
    .checkbox-toggle {
        min-height: 26px;
    }

    .legend-dot,
    .legend-ring {
        margin-right: 6px;
    }

    .maplibregl-popup {
        max-width: calc(100vw - 52px) !important;
    }

    .maplibregl-popup-content {
        max-width: calc(100vw - 52px);
        padding: 0.75rem 0.85rem;
    }

    .popup-row {
        grid-template-columns: 88px 1fr;
        column-gap: 8px;
    }

    .popup-coords {
        gap: 0.3rem;
        padding: 0.2rem 0.28rem 0.2rem 0.35rem;
    }

    .popup-coords code {
        font-size: 11px;
        line-height: 1.25;
    }

    .popup-copy-icon {
        width: 11px;
        height: 11px;
    }

    .popup-copy-icon::before,
    .popup-copy-icon::after {
        width: 7px;
        height: 8px;
    }

    .site-footer {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.9rem 1rem;
    }
}

@media (max-width: 420px) {
    .map-wrapper {
        min-height: 66dvh;
    }

    .basemap-switcher {
        bottom: 28px;
    }
}

@media (max-height: 520px) and (orientation: landscape) {
    .header p {
        display: none;
    }

    .map-wrapper {
        min-height: 65dvh;
    }

    .legend-panel {
        max-height: calc(100% - 20px);
    }
}
