@import url('https://fonts.googleapis.com/css2?family=Trade+Winds&display=swap');

/*** Initial load screen (hidden after window load + map/trails ready) ***/
#page-loader {
    transition: opacity 0.45s ease, visibility 0.45s ease;
}
.page-loader-lottie {
    width: 88px;
    height: 88px;
    max-width: 24vmin;
    max-height: 24vmin;
}
html.dom-ready #page-loader {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/*** Session welcome overlay (first visit per tab session) ***/

:root {
    --legacy-panel-inner-bg: #323238;
    --legacy-panel-inner-bg-image: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.07) 0%,
        rgba(255, 255, 255, 0.02) 100%
    );
    --legacy-panel-font: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    --legacy-panel-text: #f0f0f0;
    --legacy-panel-title: #ffffff;
    --legacy-panel-radius-outer: 10px;
    --legacy-panel-radius-inner: 8px;
    --legacy-panel-padding: 22px 26px;
    --legacy-panel-popup-padding: 12px 14px 14px;
    --legacy-panel-border-gradient: linear-gradient(
        135deg,
        #3a3a42 0%,
        #00b9fe 35%,
        #d4a72c 65%,
        #3a3a42 100%
    );
    --legacy-panel-accent-box-bg: linear-gradient(180deg, rgba(0, 185, 254, 0.14), rgba(255, 255, 255, 0.04));
    --legacy-panel-accent-box-border: 1px dashed rgba(255, 255, 255, 0.22);
    --legacy-panel-frame-shadow:
        0 4px 18px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

@keyframes trailsWelcomeBorder {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Shared gradient frame (welcome, legend, popup wrapper, start/end tips) */
.legacy-panel-frame,
.trails-welcome-frame,
.trailPopupClass .leaflet-popup-content-wrapper,
.leaflet-tooltip.pt_labels {
    position: relative;
    padding: 3px;
    border-radius: var(--legacy-panel-radius-outer);
    background: var(--legacy-panel-border-gradient);
    background-size: 200% 200%;
    animation: trailsWelcomeBorder 8s ease infinite;
    box-shadow: var(--legacy-panel-frame-shadow);
    overflow: visible;
}

.trails-welcome-frame::before,
.trails-welcome-frame::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    pointer-events: none;
    z-index: 2;
    opacity: 0.85;
}

.trails-welcome-frame::before {
    top: 10px;
    left: 10px;
    border-top: 2px solid rgba(212, 167, 44, 0.9);
    border-left: 2px solid rgba(212, 167, 44, 0.9);
    border-radius: 4px 0 0 0;
}

.trails-welcome-frame::after {
    bottom: 10px;
    right: 10px;
    border-bottom: 2px solid rgba(212, 167, 44, 0.9);
    border-right: 2px solid rgba(212, 167, 44, 0.9);
    border-radius: 0 0 4px 0;
}

.legacy-panel-inner,
.trails-welcome-box,
.pt_labels .legacy-panel-inner {
    position: relative;
    width: 100%;
    border-radius: var(--legacy-panel-radius-inner);
    font-family: var(--legacy-panel-font);
    color: var(--legacy-panel-text);
    line-height: 1.45;
    background-color: var(--legacy-panel-inner-bg);
    background-image: var(--legacy-panel-inner-bg-image);
    mask-image: linear-gradient(#000, #000);
    -webkit-mask-image: linear-gradient(#000, #000);
}

.legacy-panel-inner::before,
.trails-welcome-box::before,
.pt_labels .legacy-panel-inner::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--legacy-panel-radius-inner);
    padding: 1px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(0, 185, 254, 0.12));
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask-composite: exclude;
    pointer-events: none;
}

.trails-welcome-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background:
        radial-gradient(ellipse 80% 60% at 50% 40%, rgba(45, 106, 79, 0.18), transparent 70%),
        rgba(10, 18, 14, 0.55);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    opacity: 1;
    visibility: visible;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.trails-welcome-overlay.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.trails-welcome-overlay[hidden] {
    display: none;
}

.trails-welcome-overlay:not(.is-hidden):not([hidden]) {
    display: flex;
}

html.legacy-welcome-open [id^="kofi-widget-overlay-"],
html.legacy-welcome-open .floating-chat-kofi-popup-iframe,
html.legacy-welcome-open .floating-chat-kofi-popup-iframe-mobi,
html.legacy-kofi-open [id^="kofi-widget-overlay-"],
html.legacy-kofi-open .floating-chat-kofi-popup-iframe,
html.legacy-kofi-open .floating-chat-kofi-popup-iframe-mobi {
    visibility: hidden !important;
    pointer-events: none !important;
    opacity: 0 !important;
}

.trails-welcome-overlay:not(.is-hidden):not([hidden]) .trails-welcome-frame {
    animation: trailsWelcomeIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes trailsWelcomeIn {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.94);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.trails-welcome-frame {
    width: min(88vw, 360px);
    max-height: 88dvh;
}

.trails-welcome-box {
    max-height: calc(88dvh - 6px);
    overflow-y: auto;
    padding: 12px 18px 14px;
    font-size: clamp(13px, 1vw, 16px);
    font-weight: 600;
    line-height: 1.3;
    scrollbar-width: thin;
    scrollbar-color: #5a5a64 #2a2a30;
}

.trails-welcome-head {
    display: grid;
    grid-template-columns: 1fr minmax(52px, 26%);
    align-items: stretch;
    margin-top:8px;
    padding-left:4px;
}

.trails-welcome-head-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: 0;
    gap: 8px;
}

.trails-welcome-head-line {
    display: block;
    font-family: 'Trade Winds', cursive;
    font-size: clamp(14px, 5.5vw, 24px);
    letter-spacing: 0.06em;
    color: #c4c4c4;
    line-height: 1.05;
    text-shadow: 2px 2px 0 #000;
    text-transform: uppercase;
} 

.trails-welcome-head-divider {
    display: none;
}

.trails-welcome-head-gem {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(14px, 5.5vw, 24px); /* match .trails-welcome-head-line */
    line-height: 1;
    padding: 0;
}

.trails-welcome-head-gem-img {
    height: 2em;
    width: auto;
    object-fit: contain;
    display: block;
}

.trails-welcome-box h3 {
    font-size: clamp(14px, 1.2vw, 18px);
    margin: 4px 0 10px;
    color: var(--legacy-panel-title);
    font-weight: 700;
}

.trails-welcome-count {
    margin: 0;
    color: var(--legacy-panel-text);
    font-weight: 500;
}

.trails-welcome-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0 0;
    padding: 9px 12px;
    border-radius: 8px;
    background: var(--legacy-panel-accent-box-bg);
    border: var(--legacy-panel-accent-box-border);
}

.trails-welcome-feature-badge {
    flex: 0 0 auto;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #0b1220;
    background: #00b9fe;
}

.trails-welcome-feature-text {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--legacy-panel-title);
}

.trails-welcome-box > p {
    margin: 0 0 5px;
    font-weight: 500;
}

.trails-welcome-box .legacy-panel-rule {
    margin: 14px 0;
}

.legacy-panel-rule {
    height: 1px;
    margin: 14px 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(45, 106, 79, 0.35) 15%,
        rgba(0, 185, 254, 0.5) 50%,
        rgba(45, 106, 79, 0.35) 85%,
        transparent
    );
    position: relative;
}

.legacy-panel-rule::after {
    content: '◆';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 9px;
    color: #d4a72c;
    background: var(--legacy-panel-inner-bg);
    padding: 0 8px;
    line-height: 1;
}

.trails-welcome-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.trails-welcome-list li {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin-bottom: 4px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.trails-welcome-list li.trails-welcome-item {
    cursor: pointer;
}

.trails-welcome-list li.trails-welcome-item:hover {
    border-color: rgba(0, 185, 254, 0.55);
    background: linear-gradient(90deg, rgba(0, 185, 254, 0.16), rgba(255, 255, 255, 0.06));
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.trails-welcome-list li.trails-welcome-item:active {
    background: rgba(0, 185, 254, 0.2);
}

.trails-welcome-list li.trails-welcome-item:focus-visible {
    outline: 2px solid rgba(0, 185, 254, 0.55);
    outline-offset: 2px;
}

.trails-welcome-list li:last-child {
    margin-bottom: 0;
}

.trails-welcome-tap {
    flex-shrink: 0;
    font-size: 1.05em;
    line-height: 1;
}

.trails-welcome-name {
    flex: 1;
    min-width: 0;
    line-height: 1.25;
    color: var(--legacy-panel-title);
    font-weight: 600;
}

.legacy-panel-close,
.trailPopupClass a.leaflet-popup-close-button.legacy-panel-close {
    position: absolute;
    top: -9px;
    right: -9px;
    z-index: 20;
    width: 26px;
    height: 26px;
    border: 3px solid rgba(255, 255, 255, 0.55);
    background-color: #2a2a30;
    font-size: 16px;
    line-height: 1;
    color: #f0f0f0;
    cursor: pointer;
    border-radius: 50%;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    opacity: 1;
    box-sizing: border-box;
    display: flex !important;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: normal;
}

.legacy-panel-close span,
.trailPopupClass a.leaflet-popup-close-button.legacy-panel-close span {
    display: block;
    line-height: 1;
    font-size: 1em;
    transform: translateY(0.04em);
}

.legacy-panel-close:hover,
.legacy-panel-close:focus-visible,
.trailPopupClass a.leaflet-popup-close-button.legacy-panel-close:hover,
.trailPopupClass a.leaflet-popup-close-button.legacy-panel-close:focus-visible {
    color: #ffffff;
    background-color: #3a3a42;
    border-color: #00b9fe;
    opacity: 1;
    outline: none;
}

.legacy-panel-close:active,
.trailPopupClass a.leaflet-popup-close-button.legacy-panel-close:active {
    background-color: #111114;
}

.trails-welcome-donate {
    margin-top: 0;
    text-align: center;
    padding: 8px 10px 6px;
    border-radius: 8px;
    background: var(--legacy-panel-accent-box-bg);
    border: var(--legacy-panel-accent-box-border);
}

.trails-welcome-donate-text {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--legacy-panel-text);
}

.legacy-action-btn,
.legacy-action-btn:hover,
.legacy-action-btn:focus,
.legacy-action-btn:focus-visible,
.legacy-action-btn:visited,
.legacy-action-btn:active {
    text-decoration: none;
}

.legacy-action-btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    font-family: var(--legacy-panel-font);
    font-size: clamp(15px, 1.35vw, 19px);
    text-align: center;
    border-radius: 8px;
    background: var(--legacy-panel-accent-box-bg);
    border: var(--legacy-panel-accent-box-border);
    padding: 12px 14px;
    word-break: break-word;
    margin-top: 8px;
    color: #ffb4b4;
    font-weight: bold;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.legacy-action-btn:hover,
.legacy-action-btn:focus-visible {
    background: linear-gradient(180deg, rgba(0, 185, 254, 0.22), rgba(255, 255, 255, 0.06));
    border-color: rgba(0, 185, 254, 0.55);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    color: #ffffff;
    outline: none;
}

.trails-welcome-donate .legacy-action-btn {
    margin-top: 0;
    padding: 10px 12px;
}

.trailPopupClass .legacy-action-btn {
    font-size: 15px;
    margin-top: 4px;
    padding: 8px 10px;
}

.trailPopupClass .trail-popup-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    align-items: stretch;
}

.trailPopupClass .trail-popup-actions .legacy-action-btn {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    margin-top: 0;
    padding: 8px 6px;
    font-size: 13px;
}

/*** General ***/

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
}

/* Allow selection on controls and real links only */
a, button, input, textarea, select, option,
[href],
[role="button"],
[contenteditable="true"] {
    -webkit-user-select: auto;
    user-select: auto;
}

body {
    padding-top: 0;
    min-width: 350px;
    display: flex;
    flex-direction: column;
    height: 100vh; /* Fallback for older browsers */
    height: -webkit-fill-available; /* Safari fallback */
    height: 100dvh; /* Dynamic viewport height for mobile browsers - adjusts when address bar shows/hides */
    margin: 0;
}

header {
    position: fixed;
    top: 0px;
    left: 0px;
    right: 0px;
    bottom: auto;
    z-index: 1001;
    background: rgba(50, 50, 56, 0.9);
    padding-left: 10px;
    padding-bottom: 5px;
    padding-top: 10px;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 0.4s ease, visibility 0.4s ease, transform 0.4s ease;
}

html.legacy-header-visible header {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

header h1 {
    font-family: 'Trade Winds', cursive;
    font-size: clamp(35px, 5.2vw, 65px);
    letter-spacing: 0.2em;
    line-height: 1.3;
    color: #fff;
    margin: 0;
    padding: 5px;
    overflow:visible;
    text-shadow: 
        3px 3px 0 #000;
    display: inline-block;
}

.header-gem {
    height: 1em;
    width: auto;
    vertical-align: -0.28em;
    display: inline-block;
    margin-right: 0.15em;
}

@media (max-width: 480px) and (orientation: portrait) {
    header h1 {
        font-size: clamp(38px, 4.5vw, 50px);
    }
}

main {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh; /* Fallback for older browsers */
    height: -webkit-fill-available; /* Safari fallback */
    height: 100dvh; /* Dynamic viewport height for mobile browsers - adjusts when address bar shows/hides */
    margin: 0;
    padding: 0;
    overflow: hidden;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    margin: 0;
    padding: 0;
}

/* Mapbox 3D overlay — above map panes, below Leaflet controls (z-index 1000) */
#map-3d.legacy-map-3d {
    position: absolute;
    inset: 0;
    z-index: 450;
    display: none;
    pointer-events: none;
}

/* Hidden but laid out so Mapbox can init/preload at full size */
#map-3d.legacy-map-3d.is-preloading {
    display: block;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#map-3d.legacy-map-3d.is-active {
    display: block;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#map-3d.legacy-map-3d.is-pending {
    display: block;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#map-3d.legacy-map-3d .mapboxgl-ctrl-bottom-right {
    margin: 0;
    right: 0;
    bottom: 0;
}

#map-3d.legacy-map-3d .mapboxgl-ctrl-bottom-right > .mapboxgl-ctrl-group {
    margin: 0 8px 8px 0;
}

#map-3d.legacy-map-3d .mapboxgl-ctrl-group {
    background: #1e1e22;
    border: 2px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

#map-3d.legacy-map-3d .mapboxgl-ctrl-group button {
    background-color: #1e1e22;
}

#map-3d.legacy-map-3d .mapboxgl-ctrl-group button:hover {
    background-color: #2a2a30;
}

#map-3d.legacy-map-3d .mapboxgl-ctrl-icon {
    filter: invert(1);
}

#map-3d.legacy-map-3d .mapboxgl-ctrl-bottom-right > .mapboxgl-ctrl-attrib,
#map-3d.legacy-map-3d .mapboxgl-ctrl-attrib {
    margin: 0 !important;
    position: relative;
    background: rgba(30, 30, 34, 0.82);
    color: rgba(240, 240, 240, 0.85);
    font-size: clamp(9px, 2.5vw, 11px);
    line-height: 1.35;
}

#map-3d.legacy-map-3d .mapboxgl-ctrl-attrib a {
    color: #7dd3fc;
}

#map-3d.legacy-map-3d .mapboxgl-ctrl-attrib.mapboxgl-compact {
    min-height: 0;
}

.legacy-3d-trail-tip .mapboxgl-popup-content {
    padding: 3px;
    border-radius: var(--legacy-panel-radius-outer);
    overflow: visible;
    box-shadow: var(--legacy-panel-frame-shadow);
    background: var(--legacy-panel-border-gradient);
    background-size: 200% 200%;
    animation: trailsWelcomeBorder 8s ease infinite;
    color: var(--legacy-panel-text);
    font-family: var(--legacy-panel-font);
}

.legacy-3d-trail-tip .mapboxgl-popup-tip {
    display: none !important;
}

.legacy-3d-trail-tip-body {
    position: relative;
    padding: var(--legacy-panel-popup-padding);
    max-width: 260px;
    border-radius: var(--legacy-panel-radius-inner);
    background-color: var(--legacy-panel-inner-bg);
    background-image: var(--legacy-panel-inner-bg-image);
    color: var(--legacy-panel-text);
}

.legacy-3d-trail-tip-text {
    margin: 0 18px 14px 0;
    font-size: 14px;
    line-height: 1.45;
    font-weight: 500;
    color: var(--legacy-panel-text);
}

.legacy-3d-tip-2d-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    border: none;
    border-radius: 6px;
    padding: 10px 12px;
    cursor: pointer;
    background: #00b9fe;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.legacy-3d-tip-2d-btn:hover,
.legacy-3d-tip-2d-btn:focus-visible {
    background: #0099d6;
    outline: none;
}

.legacy-3d-tip-2d-btn:active {
    transform: scale(0.98);
}

.legacy-3d-tip-2d-btn i {
    font-size: 13px;
}

.legacy-3d-trail-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
    cursor: pointer;
    line-height: 1;
}

.legacy-3d-trail-label-box {
    padding: 2px;
    border-radius: 6px;
    background: linear-gradient(
        135deg,
        rgba(0, 185, 254, 0.55),
        rgba(45, 106, 79, 0.55) 50%,
        rgba(0, 185, 254, 0.45)
    );
    box-shadow: var(--legacy-panel-frame-shadow);
}

.legacy-3d-trail-label-inner {
    padding: 3px 7px;
    border-radius: 4px;
    background-color: var(--legacy-panel-inner-bg);
    background-image: var(--legacy-panel-inner-bg-image);
    color: var(--legacy-panel-text);
    font-family: var(--legacy-panel-font);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.legacy-3d-trail-label-pin {
    width: 7px;
    height: 7px;
    margin-top: 3px;
    border-radius: 50%;
    background: #FF5F1F;
    border: 1.5px solid #1a1a1a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

/* Spinner over 2D while 3D prepares camera */
html.legacy-3d-loading #map::after {
    content: '3D wird geladen…';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 460;
    padding: 12px 18px;
    border-radius: var(--legacy-panel-radius-outer);
    border: 2px solid transparent;
    background:
        linear-gradient(var(--legacy-panel-inner-bg), var(--legacy-panel-inner-bg)) padding-box,
        var(--legacy-panel-border-gradient) border-box;
    background-size: auto, 200% 200%;
    animation: trailsWelcomeBorder 8s ease infinite;
    box-shadow: var(--legacy-panel-frame-shadow);
    color: var(--legacy-panel-text);
    font-family: var(--legacy-panel-font);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    pointer-events: none;
}

.legacy-map-toast {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    z-index: 470;
    padding: 12px 18px;
    border-radius: var(--legacy-panel-radius-outer);
    border: 2px solid transparent;
    background:
        linear-gradient(var(--legacy-panel-inner-bg), var(--legacy-panel-inner-bg)) padding-box,
        var(--legacy-panel-border-gradient) border-box;
    background-size: auto, 200% 200%;
    animation: trailsWelcomeBorder 8s ease infinite;
    box-shadow: var(--legacy-panel-frame-shadow);
    color: var(--legacy-panel-text);
    font-family: var(--legacy-panel-font);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    max-width: min(90vw, 320px);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.legacy-map-toast.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* Hide Leaflet 2D attribution while 3D overlay is active */
html.legacy-3d-active .leaflet-control-attribution {
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Hide 2D map chrome (zoom / GPS / basemap / Digitize / GPX) in 3D; keep cube + center.
   display:none (not visibility) so the remaining controls stack with no empty gaps. */
html.legacy-3d-active .leaflet-top.leaflet-right > .leaflet-control:not(.legacy-3d-toggle):not(.legacy-center-view),
html.legacy-3d-loading .leaflet-top.leaflet-right > .leaflet-control:not(.legacy-3d-toggle):not(.legacy-center-view) {
    display: none !important;
}

/* 3D: cube + center fall onto the same lower-right stack as Mapbox zoom/tilt/compass */
html.legacy-3d-active #map .leaflet-top.leaflet-right,
html.legacy-3d-loading #map .leaflet-top.leaflet-right {
    top: auto !important;
    bottom: 0 !important;
    right: 0;
    /* 8px = Mapbox group margin; ~118px clears nav (×3) + attrib strip */
    margin: 0 8px 118px 0 !important;
    z-index: 1000;
}

html.legacy-3d-active #map .leaflet-top.leaflet-right > .leaflet-control,
html.legacy-3d-loading #map .leaflet-top.leaflet-right > .leaflet-control {
    margin-top: 8px !important;
    margin-right: 0 !important;
    margin-bottom: 0 !important;
}

/* Ko-fi floating button: ~25% smaller, nudged up */
.floatingchat-container-wrap,
.floatingchat-container-wrap-mobi {
    transform: scale(0.75) translateY(-22px);
    transform-origin: bottom left;
}

/* Hidden checkbox for CSS-only toggle */
#info-toggle {
    display: none;
}

.info-wrapper {
    position: absolute;
    top: 18vh;
    left: 10px;
    z-index: 1000;
    width: clamp(300px, 32vw, 400px);
    transition: transform 0.3s ease;
    transform: translateX(-100%);
    will-change: transform;
}

.info-panel-frame {
    height: 70dvh;
    height: 70vh;
    max-height: 70dvh;
    max-height: 70vh;
}

#info-div.legacy-panel-inner {
    height: 100%;
    max-height: calc(70dvh - 6px);
    max-height: calc(70vh - 6px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 18px 20px 50px;
    font-size: clamp(12px, 1vw, 16px);
    scrollbar-width: thin;
    scrollbar-color: #5a5a64 #2a2a30;
    word-wrap: break-word;
    overflow-wrap: break-word;
    pointer-events: auto;
}

/* Scrollport + absolute inset ::before = floating inner radius cutting mid-content */
#info-div.legacy-panel-inner::before {
    content: none;
}

/* Show info-wrapper when checkbox is checked */
#info-toggle:checked ~ main .info-wrapper {
    transform: translateX(0);
}

#info-div th, #info-div td {
	padding-right: 10px;
}

.legend-label {
    position: absolute;
    left: calc(100% + 4px);
    right: auto;
    bottom: 100px;
    margin: 0;
    padding: 8px 4px;
    border: 2px solid transparent;
    border-radius: 999px;
    font-family: 'Trade Winds', cursive;
    font-size: clamp(13px, 1vw, 16px);
    font-weight: bold;
    color: var(--legacy-panel-title);
    white-space: nowrap;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    z-index: 1001;
    cursor: pointer;
    outline: none;
    background:
        linear-gradient(var(--legacy-panel-inner-bg), var(--legacy-panel-inner-bg)) padding-box,
        var(--legacy-panel-border-gradient) border-box;
    background-size: auto, 200% 200%;
    animation: trailsWelcomeBorder 8s ease infinite;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.15) inset,
        0 4px 14px rgba(0, 0, 0, 0.2);
    transition: box-shadow 0.2s ease, filter 0.2s ease;
}

.legend-label:hover {
    filter: brightness(1.05);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.2) inset,
        0 6px 18px rgba(0, 0, 0, 0.24);
}

.leaflet-control-zoom {
    margin-top: 18vh !important;
}

/* Mobile: whole 2D control stack → lower right (thumb zone).
   Keep container class .leaflet-top.leaflet-right so 3D hide rules still match. */
@media (max-width: 768px) {
    #map .leaflet-top.leaflet-right {
        top: auto !important;
        bottom: 28px;
        right: 0;
        margin: 0;
        z-index: 1000;
    }

    #map .leaflet-control-zoom {
        margin-top: 0 !important;
    }

    /* Sit above elevation chart when a trail is selected */
    #map:has(.legacy-elevation-frame) .leaflet-top.leaflet-right {
        bottom: min(52vw, 220px);
    }
}

.leaflet-bottom.leaflet-right .leaflet-control-attribution {
    margin: 0 !important;
}

.leaflet-control-attribution {
    font-size: clamp(9px, 2.5vw, 11px);
    line-height: 1.35;
    background: rgba(30, 30, 34, 0.82) !important;
    color: rgba(240, 240, 240, 0.85);
    margin: 0 !important;
}

.leaflet-control-attribution a {
    color: #7dd3fc;
}

.legacy-attribution-version {
    opacity: 0.85;
    white-space: nowrap;
}

/* Dark map controls (zoom, easyButton, locate) */
.leaflet-bar {
    border: 2px solid rgba(255, 255, 255, 0.55) !important;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4) !important;
    overflow: hidden;
}

.leaflet-bar a,
.leaflet-bar button,
.leaflet-bar .easy-button-button,
.leaflet-control-locate a {
    background-color: #1e1e22 !important;
    color: #f0f0f0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.22) !important;
}

.leaflet-bar a:last-child,
.leaflet-bar button:last-child,
.leaflet-bar .easy-button-button:last-child,
.leaflet-control-locate a:last-child {
    border-bottom: none !important;
}

.leaflet-bar a:hover,
.leaflet-bar button:hover,
.leaflet-bar .easy-button-button:hover,
.leaflet-control-locate a:hover,
.leaflet-bar a:focus,
.leaflet-bar button:focus,
.leaflet-bar .easy-button-button:focus {
    background-color: #2a2a30 !important;
    color: #ffffff !important;
}

.leaflet-bar a:active,
.leaflet-bar button:active,
.leaflet-bar .easy-button-button:active,
.leaflet-control-locate a:active,
.leaflet-bar a.legacy-ctrl-selected,
.leaflet-bar button.legacy-ctrl-selected,
.leaflet-bar .easy-button-button.legacy-ctrl-selected,
.leaflet-control-locate.active a,
.leaflet-control-locate.active.following a {
    background-color: #f0f0f0 !important;
    color: #1e1e22 !important;
}

.leaflet-bar a.leaflet-disabled,
.leaflet-bar button.leaflet-disabled {
    background-color: #161618 !important;
    color: rgba(240, 240, 240, 0.35) !important;
}

.leaflet-control-locate,
.leaflet-bar button {
   font-size: 12px;
   font-family: unset;
}

.custom-control {
    color: inherit;
}

.leaflet-popup-tip {
    display: none;
}

.trailPopupClass.leaflet-popup {
    overflow: visible !important;
}

.trailPopupClass .leaflet-popup-content-wrapper {
    text-align: left;
    border-radius: var(--legacy-panel-radius-outer) !important;
    width: min(92vw, 260px) !important;
    max-width: min(88vw, 260px);
    height: auto !important;
    padding: 2px;
}

@media (max-width: 540px) and (orientation: portrait) {
    .trailPopupClass .leaflet-popup-content-wrapper {
        width: min(84vw, 232px) !important;
        max-width: min(84vw, 232px);
    }
}

.trailPopupClass .leaflet-popup-content {
    position: relative;
    margin: 0;
    width: 100% !important;
    max-width: none !important;
    max-height: none !important;
    overflow: visible;
    line-height: 1.4;
    border-radius: var(--legacy-panel-radius-inner);
    padding: var(--legacy-panel-popup-padding);
    font-family: var(--legacy-panel-font);
    font-size: 14px;
    color: var(--legacy-panel-text);
    background-color: var(--legacy-panel-inner-bg);
    background-image: var(--legacy-panel-inner-bg-image);
    box-sizing: border-box;
}

.trailPopupClass .leaflet-popup-content p {
    margin: 0.2em 0;
}

.trailPopupClass .leaflet-popup-content p:first-child {
    margin-top: 0;
}

.trailPopupClass .leaflet-popup-content p:last-child {
    margin-bottom: 0;
}

.leaflet-popup-content {
    line-height: 1.45;
}

.leaflet-popup-content p {
    margin: 1em 0;
}

.leaflet-touch .leaflet-bar button {
    width: 30px;
    height: 30px;
    line-height: 30px;
}

.easy-button-button .button-state {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}
* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

.pop_cont_name {
    font-family: 'Trade Winds', cursive;
    font-weight: normal;
    font-size: clamp(22px, 5.5vw, 40px);
    letter-spacing: 0.06em;
    line-height: 1.25;
    color: var(--legacy-panel-title);
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.65);
    word-break: break-word;
    margin-bottom: 10px;
}

.trailPopupClass .pop_cont_name {
    font-size: clamp(17px, 4vw, 20px);
    letter-spacing: 0.04em;
    text-shadow:
        0 1px 0 rgba(0, 0, 0, 0.55),
        0 2px 8px rgba(0, 0, 0, 0.35);
}

.pop_cont_text {
    margin: 10px 0 12px;
    color: var(--legacy-panel-text);
    line-height: 1.4;
    font-size: clamp(12px, 1vw, 16px);
}

.trailPopupClass .pop_cont_text {
    margin: 2px 0 6px;
    font-size: 12px;
    line-height: 1.35;
    text-align: left;
}

.trailPopupClass .pop_cont_text pre {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.4;
    white-space: pre;
    tab-size: 3;
    -moz-tab-size: 3;
    text-align: left;
    margin: 0;
    max-width: 100%;
    overflow-x: auto;
}

/*** Shared action button (GPX download, support links) ***/

/* font awesome hack */
.fa {
    line-height: 30px!important;
}

.fa-info-circle {
    color: #313131;  /* or any color you want */
}

.noselect {
  -webkit-touch-callout: none; /* iOS Safari */
    -webkit-user-select: none; /* Safari */
     -khtml-user-select: none; /* Konqueror HTML */
       -moz-user-select: none; /* Old versions of Firefox */
        -ms-user-select: none; /* Internet Explorer/Edge */
            user-select: none; /* Non-prefixed version, currently
                                  supported by Chrome, Opera and Firefox */
}

/*** popup contents ***/

.elevation.lime-theme.leaflet-control,
.elevation.lime-theme.leaflet-control .axis text,
.elevation.lime-theme.leaflet-control .mouse-focus-label-x,
.elevation.lime-theme.leaflet-control .mouse-focus-label-y {
    font-size: clamp(10px, 2.8vw, 12px);
    fill: #f0f0f0;
    color: #f0f0f0;
}

.legacy-elevation-frame.leaflet-control.elevation {
	padding: 3px;
	overflow: visible;
	box-sizing: border-box;
	line-height: 0;
}

.legacy-elevation-frame.leaflet-control.elevation .elevation-toggle {
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-radius: 50%;
	background: #2a2a30;
	color: #f0f0f0;
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
}

.legacy-elevation-inner.legacy-panel-inner {
	padding: 0;
	overflow: hidden;
	line-height: 0;
	width: fit-content;
	max-width: 100%;
}

.legacy-elevation-inner svg.background {
	display: block;
	vertical-align: top;
	border-radius: var(--legacy-panel-radius-inner);
}

.legacy-elevation-frame.lime-theme.leaflet-control svg.background {
	background-color: var(--legacy-panel-inner-bg);
}

.legacy-elevation-frame.lime-theme.leaflet-control .area {
    fill: rgba(0, 185, 254, 0.35);
}

.legacy-elevation-frame.lime-theme.leaflet-control .axis line,
.legacy-elevation-frame.lime-theme.leaflet-control .axis path {
    stroke: rgba(240, 240, 240, 0.45);
}

.legacy-elevation-frame.lime-theme.leaflet-control .axis text {
    fill: #f0f0f0 !important;
}

.legacy-elevation-frame.lime-theme.leaflet-control .mouse-focus-label-x,
.legacy-elevation-frame.lime-theme.leaflet-control .mouse-focus-label-y {
    fill: #ffffff !important;
    color: #ffffff !important;
}

.legacy-elevation-frame.lime-theme.leaflet-control .mouse-drag {
    fill: rgba(0, 185, 254, 0.2);
}

.legacy-elevation-frame.lime-theme.leaflet-control .mouse-focus-line {
    stroke: #7dd3fc;
}

.legacy-elevation-frame.lime-theme.height-focus {
    stroke: #00b9fe;
    fill: #00b9fe;
}

.trailPopupClass .kofi_reminder {
    padding: clamp(12px, 3.5vw, 22px) clamp(12px, 4vw, 26px);
    font-family: var(--legacy-panel-font);
    font-size: clamp(12px, 3.4vw, 16px);
    font-weight: 600;
    line-height: 1.4;
    border-radius: var(--legacy-panel-radius-inner);
    transition: opacity 0.3s ease, visibility 0.3s ease;
    opacity: 0;
    visibility: hidden;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(50, 50, 56, 0.97);
    color: var(--legacy-panel-text);
    box-sizing: border-box;
}

.trailPopupClass .kofi_reminder p {
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    color: var(--legacy-panel-text);
}

@keyframes kofi-support-pulse {
    0%, 100% {
        background: linear-gradient(180deg, rgba(0, 185, 254, 0.18), rgba(212, 167, 44, 0.1));
        border-color: rgba(0, 185, 254, 0.45);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        color: #ffffff;
    }
    50% {
        background: linear-gradient(180deg, rgba(0, 185, 254, 0.28), rgba(212, 167, 44, 0.16));
        border-color: rgba(212, 167, 44, 0.65);
        box-shadow: 0 3px 12px rgba(0, 185, 254, 0.2);
        color: #ffffff;
    }
}

.trailPopupClass .kofi_reminder .legacy-action-btn,
.trails-welcome-donate .legacy-action-btn {
    font-size: clamp(13px, 3.6vw, 16px);
    font-weight: 800;
    padding: clamp(8px, 2.4vw, 12px) clamp(10px, 2.8vw, 14px);
    margin-top: clamp(6px, 2vw, 10px);
    letter-spacing: -0.02em;
    border-width: 2px;
    border-style: solid;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    animation: kofi-support-pulse 2.6s ease-in-out infinite;
}

.trailPopupClass .kofi_reminder .legacy-action-btn:hover,
.trailPopupClass .kofi_reminder .legacy-action-btn:focus-visible,
.trails-welcome-donate .legacy-action-btn:hover,
.trails-welcome-donate .legacy-action-btn:focus-visible {
    animation-play-state: paused;
    background: linear-gradient(180deg, rgba(0, 185, 254, 0.35), rgba(212, 167, 44, 0.18));
    border-color: rgba(0, 185, 254, 0.85);
    box-shadow: 0 3px 12px rgba(0, 185, 254, 0.28);
    color: #ffffff;
    outline: none;
}


.leaflet-tooltip.pt_labels {
    border: none;
    color: var(--legacy-panel-text);
    font-family: var(--legacy-panel-font);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.leaflet-tooltip.pt_labels::before {
    display: none !important;
    border: none !important;
}

.pt_labels .legacy-panel-inner {
    padding: 6px 10px;
    font-size: 11px;
    line-height: 1.35;
    white-space: nowrap;
}

.pt_labels .legacy-panel-inner strong {
    color: var(--legacy-panel-title);
    font-weight: 700;
}

#gallery {
    display: none;
}

.trails-in-view {
    margin-top: 35px;
    margin-bottom: 15px;
}

.trails-list {
    margin-top: 10px;
}

.legend-filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin: 0 0 8px;
    font-size: 13px;
}

.legend-filter-reset {
    font-family: var(--legacy-panel-font);
    font-size: 13px;
    font-weight: 600;
    color: var(--legacy-panel-title);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
}

.legend-filter-reset:hover,
.legend-filter-reset:focus-visible {
    border-color: rgba(0, 185, 254, 0.55);
    background: rgba(0, 185, 254, 0.12);
    outline: none;
}

.legend-filter-count {
    color: var(--legacy-panel-text);
    font-weight: 600;
}

.legend-filter-table {
    user-select: none;
    -webkit-user-select: none;
    direction: rtl; /* radio column → visual right */
    table-layout: fixed;
    width: 100%;
}

#info-div figure.table {
    margin: 12px 0;
}

.legend-filter-table td,
.legend-filter-table th {
    -webkit-tap-highlight-color: transparent;
    outline: none;
    direction: ltr;
    text-align: left;
}

.legend-filter-table .legend-filter-cell {
    width: 1.5em;
    padding-left: 8px;
    padding-right: 0;
    vertical-align: middle;
    text-align: center;
}

.legend-filter-table input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    margin: 0;
    cursor: pointer;
    vertical-align: middle;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.32);
    background: #141418;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.55);
}

.legend-filter-table input[type="radio"]:hover {
    border-color: rgba(255, 255, 255, 0.5);
}

.legend-filter-table input[type="radio"]:checked {
    border-color: #00b9fe;
    background:
        radial-gradient(circle at center, #00b9fe 0 38%, transparent 40%),
        #141418;
}

.legend-filter-table input[type="radio"]:focus-visible {
    outline: 2px solid rgba(0, 185, 254, 0.65);
    outline-offset: 2px;
}

.trail-item {
    padding: 10px 10px 10px 20px;
    cursor: pointer;
    border-radius: 5px;
    border: 1px solid transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.trail-item:last-child {
    border-bottom: none;
}

.trail-item:hover {
    border-color: rgba(0, 185, 254, 0.55);
    background: linear-gradient(90deg, rgba(0, 185, 254, 0.16), rgba(255, 255, 255, 0.06));
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.trail-item:active {
    background: rgba(0, 185, 254, 0.22);
    border-color: rgba(0, 185, 254, 0.7);
}

.trail-item h3 {
    font-size: clamp(14px, 1.3vw, 18px);
    color: #FF5F1F;
    word-break: break-word;
    font-weight: bold;
}

.trail-item p {
    margin: 0;
    font-size: clamp(12px, 1.1vw, 14px);
    color: rgba(240, 240, 240, 0.72);
    word-break: break-word;
}

.trail-item.no-trails {
    color: rgba(240, 240, 240, 0.55);
    font-style: italic;
    cursor: default;
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

/* Webkit browsers (Chrome, Safari) */
#info-div::-webkit-scrollbar {
    width: 8px;
}

#info-div::-webkit-scrollbar-track {
    background: #2a2a30;
}

#info-div::-webkit-scrollbar-thumb {
    background: #5a5a64;
    border-radius: 4px;
}

#info-div::-webkit-scrollbar-thumb:hover {
    background: #7a7a86;
}

/* Firefox scrollbar — covered by #info-div.legacy-panel-inner */

#info-div .legend-content h2,
#info-div .trails-list h2 {
    padding-top: 25px;
    margin-top: 0;
    font-family: 'Trade Winds', cursive;
    font-weight: normal;
    font-size: clamp(18px, 2.2vw, 26px) !important;
    letter-spacing: 0.06em;
    line-height: 1.25;
    color: var(--legacy-panel-title);
    text-shadow:
        0 1px 0 rgba(0, 0, 0, 0.55),
        0 2px 8px rgba(0, 0, 0, 0.35);
}

.legend-content h3 {
    font-size: clamp(16px, 1.4vw, 20px);
    margin-top: 20px;
    margin-bottom: 10px;
}
     