body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overflow: hidden;
}

#map {
    height: 100vh; /* fallback for browsers without dvh support */
    height: 100dvh; /* mobile Chrome: track the visible viewport as the URL bar shows/hides */
    width: 100%;
}

/* --- CONTROL PANEL --- */
#controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 2000;
    width: 340px;
    background: rgba(255, 255, 255, 0.5);
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 10px;
    backdrop-filter: blur(5px);
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
}

@media (max-width: 600px) {
    #controls {
        width: auto;
        left: 10px;
        right: 10px;
        top: 10px;
    }

    .live-height-box {
        display: none;
    }
}

#controls.minimized #controls-content {
    display: none;
}

#controls.minimized {
    overflow: hidden;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
}

.header-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
    white-space: nowrap;
}

.toggle-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #555;
    padding: 0 5px;
    line-height: 1;
}

/* BUTTONS IN HEADER (INFO & LANGUAGE) */
.circle-btn {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #999;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s;
    overflow: hidden;
}

.circle-btn:hover {
    background: #fff;
    border-color: #555;
}

.info-btn {
    font-size: 14px;
    font-family: serif;
    font-weight: bold;
    font-style: italic;
    color: #555;
}

.share-circle-btn {
    color: #1565C0;
    font-size: 13px;
    transform: translateY(-1px);
}

/* FLAG IMAGE */
.flag-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

/* MODAL (COMMON DESIGN) */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #fff;
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.modal-content h4 {
    margin-top: 0;
    color: #333;
    margin-bottom: 10px;
    font-size: 18px;
}

.modal-content p {
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    margin-bottom: 15px;
}

.modal-content a {
    color: #007bff;
    text-decoration: none;
    font-weight: bold;
}

.modal-content input {
    width: 90%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-family: monospace;
}

.modal-btns {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.save-btn {
    background-color: #28a745;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.cancel-btn {
    background-color: #6c757d;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.save-btn:hover {
    background-color: #218838;
}

/* OTHER DESIGN */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    transform: translate(-50%, -50%);
    z-index: 900;
    pointer-events: none;
    display: none;
}

#crosshair::before,
#crosshair::after {
    content: '';
    position: absolute;
    background: #333;
}

#crosshair::before {
    top: 9px;
    left: 0;
    width: 20px;
    height: 2px;
}

#crosshair::after {
    top: 0;
    left: 9px;
    width: 2px;
    height: 20px;
}

.live-height-box {
    background-color: #e3f2fd;
    border: 1px solid #90caf9;
    color: #1565c0;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 5px;
}

#controls.minimized .live-height-box {
    background-color: rgba(227, 242, 253, 0.6);
    border: 1px solid rgba(144, 202, 249, 0.4);
    backdrop-filter: blur(2px);
}

.live-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
    display: block;
    margin-bottom: 2px;
    color: #555;
}

.live-value {
    font-size: 24px;
    font-weight: 800;
    font-family: monospace;
}

.gold-icon {
    filter: hue-rotate(140deg) saturate(3) brightness(1.1);
}

button {
    cursor: pointer;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    transition: background 0.2s;
}

.action-btn {
    background-color: #d9534f;
    color: white;
    padding: 12px;
    font-size: 14px;
    width: 100%;
    margin-top: 5px;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background-color: #c9302c;
}

.action-btn:disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
}

.climb-btn {
    background-color: #e67e22;
    color: white;
    padding: 12px;
    font-size: 14px;
    width: 100%;
    margin-top: 5px;
    transition: all 0.3s ease;
}

.climb-btn:hover {
    background-color: #d35400;
}

.climb-btn:disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
}

.climb-mode-toggle-row {
    display: flex;
    gap: 6px;
    margin-top: 5px;
}

.climb-mode-btn {
    flex: 1;
    width: auto;
    margin-top: 0;
    padding: 10px;
    font-size: 13px;
}

.slope-btn {
    background-color: #8E24AA;
    color: white;
    padding: 12px;
    font-size: 14px;
    width: 100%;
    margin-top: 5px;
    transition: all 0.3s ease;
}

.slope-btn:hover {
    background-color: #6A1B9A;
}

.slope-btn:disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
}

/* --- COLLAPSIBLE SECTIONS --- */
.section-group {
    border-top: 1px solid #e0e0e0;
    padding-top: 6px;
    margin-top: 4px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 4px 0;
    user-select: none;
}

.section-header:hover {
    opacity: 0.75;
}

.section-header span:first-child {
    font-size: 14px;
    font-weight: 700;
    color: #333;
}

.section-toggle {
    font-size: 16px;
    color: #555;
    line-height: 1;
    opacity: 0.45;
}

.section-content {
    display: none;
    padding-top: 6px;
}

.gpx-btn {
    background-color: #00897B;
    color: white;
    padding: 12px;
    font-size: 14px;
    width: 100%;
    margin-top: 5px;
    transition: all 0.3s ease;
}

.gpx-btn:hover {
    background-color: #00695C;
}

.gpx-clear-btn {
    display: none;
    background-color: #78909C;
    color: white;
    padding: 8px;
    font-size: 13px;
    width: 100%;
    margin-top: 5px;
    transition: all 0.3s ease;
}

.gpx-clear-btn:hover {
    background-color: #546E7A;
}

.gpx-track-info {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 8px 10px;
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.6;
    color: #444;
}

.gpx-track-info span {
    font-weight: 600;
}

.gpx-km-label {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid #666;
    border-radius: 3px;
    padding: 2px 5px;
    font-size: 10px;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
    line-height: normal;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.gpx-elev-label {
    background: rgba(255, 255, 255, 0.92);
    border: 2px solid #D32F2F;
    border-radius: 5px;
    padding: 3px 6px;
    font-size: 11px;
    font-weight: 800;
    color: #B71C1C;
    white-space: nowrap;
    line-height: normal;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.gpx-elev-label.min-elev {
    border-color: #1565C0;
    color: #0D47A1;
}

.gpx-waypoint-label {
    background: rgba(255, 255, 255, 0.92);
    border: 2px solid #2E7D32;
    border-radius: 5px;
    padding: 3px 6px;
    font-size: 11px;
    font-weight: 800;
    color: #1B5E20;
    white-space: nowrap;
    line-height: normal;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.gpx-start-end-label {
    background: rgba(40, 40, 40, 0.88);
    border: 2px solid #fff;
    border-radius: 5px;
    padding: 3px 6px;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    line-height: normal;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.slope-legend {
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-size: 12px;
    line-height: 1.6;
}

.slope-legend-title {
    font-weight: bold;
    margin-bottom: 4px;
}

.slope-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.slope-legend-color {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.15);
    display: inline-block;
}

/* While the route-names legend is shown, hide the zoom controls so the legend
   occupies the bottom-right corner on its own. The legend stays below the
   right-docked controls panel (#controls, z-index 2000), which is always on top. */
body.route-legend-on .maplibregl-ctrl-bottom-right .maplibregl-ctrl-group {
    display: none;
}

.route-legend {
    pointer-events: auto; /* the bottom-right ctrl container is none; re-enable so the refresh button is clickable */
    margin: 0 10px 10px 0; /* match the zoom controls' inset from the map edges */
    background: rgba(255, 255, 255, 0.92);
    padding: 8px 10px;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    font-size: 12px;
    line-height: 1.5;
    max-height: 40vh;
    max-height: 40dvh;
    max-width: 220px;
    overflow-y: auto;
}

.route-legend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
    cursor: pointer;
}

.route-legend-title {
    font-weight: 600;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.route-legend-title .route-legend-color,
.route-legend-title .route-legend-symbol {
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

.route-legend-count {
    font-weight: 400;
}

.route-legend-refresh {
    display: none;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 22px;
    flex: 0 0 24px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: #43a047;
    color: #fff;
    cursor: pointer;
}

.route-legend-refresh:hover {
    background: #2e7d32;
}

.route-legend-refresh svg {
    width: 14px;
    height: 14px;
    display: block;
}

.route-legend.stale .route-legend-refresh {
    display: inline-flex;
}

.route-legend-collapse {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #555;
    cursor: pointer;
}

.route-legend-collapse:hover {
    background: rgba(0, 0, 0, 0.06);
}

.route-legend-collapse svg {
    width: 16px;
    height: 16px;
    display: block;
    transition: transform 0.15s ease;
}

/* Caret points up when expanded (click to collapse), down when collapsed. */
.route-legend.collapsed .route-legend-collapse svg {
    transform: rotate(180deg);
}

.route-legend.collapsed .route-legend-header {
    margin-bottom: 0;
}

.route-legend.collapsed .route-legend-body {
    display: none;
}

.route-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 2px 0;
    padding: 1px 3px;
    border-radius: 4px;
    cursor: pointer;
}

.route-legend-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

.route-legend-item.active {
    background: rgba(21, 101, 192, 0.15);
    font-weight: 600;
}

.route-legend.isolated .route-legend-item:not(.active) {
    opacity: 0.45;
}

.route-legend-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.route-legend-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.25);
    flex: 0 0 10px;
}

.route-legend-symbol {
    width: 24px;
    height: 18px;
    flex: 0 0 24px;
    object-fit: contain;
    object-position: center;
}

.route-legend-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.route-legend-msg {
    color: #555;
    font-style: italic;
    margin: 2px 0;
}

.route-legend-footer {
    margin-top: 6px;
    font-size: 10px;
    color: #666;
}

.route-legend-footer a {
    color: inherit;
}

.clear-btn {
    background-color: #6c757d;
    color: white;
    padding: 8px;
    font-size: 13px;
    width: 100%;
    margin-top: 10px;
}

.clear-btn:hover {
    background-color: #5a6268;
}

.icon-btn {
    background: #f8f9fa;
    border: 1px solid #ced4da;
    padding: 0;
    width: 32px;
    height: 32px;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    margin: 0;
}

.icon-btn:hover {
    background: #e2e6ea;
}

.icon-btn svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* 3D toggle: light-blue filled cube with a blue outline when off;
   outline turns white and the fill drops away when active (3D on). */
#enable3dBtn { color: #1565c0; }
#enable3dBtn .cube-face { fill: #e3f2fd; }
#enable3dBtn.active { color: #fff; }
#enable3dBtn.active .cube-face { fill: none; }

.icon-btn.active {
    background: #1565c0;
    border-color: #1565c0;
    color: #fff;
}

.icon-btn.active:hover {
    background: #0d47a1;
}

.search-group {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
    align-items: center;
}

#searchInput {
    flex-grow: 1;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    line-height: normal;
    outline: none;
    box-sizing: border-box;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
}

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.control-label {
    font-size: 14px;
    font-weight: 600;
    color: #444;
}

input[type="number"] {
    width: 40px;
    height: 32px;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 0;
    border-left: none;
    border-right: none;
    text-align: center;
    -moz-appearance: textfield;
    appearance: textfield;
    box-sizing: border-box;
    margin: 0;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.number-input-group {
    display: flex;
    align-items: center;
}

.num-btn {
    width: 30px;
    height: 32px;
    background: #f8f9fa;
    border: 1px solid #ccc;
    color: #333;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    box-sizing: border-box;
    margin: 0;
}

.num-btn:hover {
    background: #e2e6ea;
}

.num-btn:first-child {
    border-radius: 6px 0 0 6px;
}

.num-btn:last-child {
    border-radius: 0 6px 6px 0;
}

.select-container {
    display: flex;
    gap: 5px;
    width: 100%;
}

.layer-row {
    margin-bottom: 0;
    gap: 8px;
    justify-content: flex-start;
}

.layer-row .control-label {
    flex: 0 0 110px;
    white-space: nowrap;
}

.layer-row .select-container {
    width: auto;
    flex: 1 1 0;
    min-width: 0;
}

.layer-row select {
    min-width: 0;
    flex: 1 1 0;
    box-sizing: border-box;
}

select {
    flex-grow: 1;
    padding: 8px 28px 8px 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
    background-color: #fff;
    margin-top: 2px;
}

#edit-key-btn {
    display: none;
    padding: 0 8px;
    font-size: 14px;
    margin-top: 2px;
}

.checkbox-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
}

.checkbox-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.checkbox-row label {
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

#extra-layer-row {
    margin-bottom: 10px;
}

.zoom-badge {
    color: #495057;
    padding: 0;
    font-size: 11px;
    font-weight: bold;
    font-family: monospace;
}

#status {
    font-size: 13px;
    font-weight: 500;
    color: #444;
}

#analysis-canvas,
#single-point-canvas {
    display: none;
}

.coord-box {
    margin-top: 6px;
    background: #f1f3f5;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 4px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: monospace;
    font-size: 12px;
    gap: 8px;
}

.copy-btn {
    background: white;
    border: 1px solid #ced4da;
    border-radius: 3px;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 12px;
}

.popup-header {
    font-weight: bold;
    font-size: 14px;
    display: block;
    margin-bottom: 2px;
}

.popup-height {
    font-size: 18px;
    color: #d9534f;
    font-weight: 800;
    display: block;
    white-space: nowrap;
    margin-bottom: 2px;
}

.popup-meta {
    font-size: 11px;
    color: #666;
    display: block;
    margin-bottom: 1px;
}

.maplibregl-popup.result-popup .maplibregl-popup-content {
    padding: 14px 16px 12px;
    border-radius: 14px;
    border: none;
    background: #fff;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.maplibregl-popup.result-popup .maplibregl-popup-tip {
    border-top-color: #fff;
    border-bottom-color: #fff;
}

.maplibregl-popup.result-popup .maplibregl-popup-close-button {
    color: #777;
    font-size: 18px;
    line-height: 1;
    padding: 6px 8px 0 0;
}

.maplibregl-popup.result-popup .maplibregl-popup-close-button:hover {
    background: transparent;
    color: #333;
}

/* CHANGELOG ACCORDION */
details summary:hover {
    color: #007bff !important;
}

details[open] summary {
    margin-bottom: 5px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

/* --- UPDATE NOTIFICATION --- */
.notification-snackbar {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%) translateY(150%);
    background: rgba(33, 33, 33, 0.95);
    color: white;
    padding: 12px 20px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    width: max-content;
    max-width: 90vw;
}

.notification-snackbar.show {
    transform: translateX(-50%) translateY(0);
}

.notification-snackbar span {
    font-size: 14px;
    font-weight: 500;
}

.notification-snackbar button {
    background-color: #2196F3;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.notification-snackbar button:hover {
    background-color: #1976D2;
}

/* --- INSTALL BUTTON --- */
#install-app-btn {
    display: none;
    width: 100%;
    background-color: #2196F3;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    margin: 10px 0;
}

#install-app-btn:hover {
    background-color: #1976D2;
}

/* --- MOBILE INSTALL BAR dismiss button --- */
#mobile-install-dismiss {
    background: transparent !important;
    color: rgba(255, 255, 255, 0.7) !important;
    padding: 2px 6px !important;
    font-size: 15px !important;
    border-radius: 50% !important;
    line-height: 1;
}

#mobile-install-dismiss:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
}
/* --- TUTORIAL SPOTLIGHT --- */
#tutorial-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 5000;
    pointer-events: none;
}

#tutorial-spotlight,
#tutorial-spotlight-secondary {
    position: absolute;
    border-radius: 10px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
    transition: all 0.4s ease;
    pointer-events: none;
}

#tutorial-tooltip {
    position: absolute;
    background: white;
    border-radius: 12px;
    padding: 20px;
    max-width: 320px;
    width: 90vw;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    z-index: 5001;
    transition: all 0.4s ease;
}

#tutorial-tooltip h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #333;
}

#tutorial-tooltip p {
    margin: 0 0 15px 0;
    font-size: 13px;
    color: #555;
    line-height: 1.6;
    white-space: pre-line;
}

.tutorial-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.tutorial-nav-btn {
    background: #2196F3;
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.tutorial-nav-btn:hover {
    background: #1976D2;
}

#tutorial-progress {
    font-size: 12px;
    color: #999;
    font-weight: 600;
}

#tutorial-prev {
    background: #e0e0e0;
    color: #333;
}

#tutorial-prev:hover {
    background: #bdbdbd;
}

/* --- RESET NORTH COMPASS CONTROL --- */
.reset-north-control {
    display: none;
}

.reset-north-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: white !important;
    cursor: pointer;
}

.reset-north-btn:hover {
    background: #f4f4f4 !important;
}

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

/* ── Manual Climb ────────────────────────────────────────────────── */
.manual-climb-toggle-btn {
    background-color: #1565C0;
    color: white;
    padding: 10px;
    font-size: 14px;
    width: 100%;
    transition: background 0.2s;
}

.manual-climb-toggle-btn:hover {
    background-color: #0d47a1;
}

.manual-climb-toggle-btn.active {
    background-color: #0d47a1;
    outline: 2px solid #82b1ff;
}

.manual-climb-toggle-btn:disabled {
    background-color: #ccc;
    color: #666;
    cursor: not-allowed;
}

.manual-climb-hint {
    font-size: 12px;
    color: #555;
    margin: 0 0 4px;
    line-height: 1.4;
}

.manual-climb-count {
    font-size: 12px;
    font-weight: 600;
    color: #1565C0;
    margin: 0 0 8px;
}

.manual-climb-btns {
    display: flex;
    gap: 6px;
    align-items: center;
}

.manual-climb-calc {
    flex: 1;
    margin: 0;
    padding: 8px;
    font-size: 13px;
    background-color: #1565C0;
}

.manual-climb-calc:hover {
    background-color: #0d47a1;
}

.manual-climb-calc:disabled {
    background-color: #ccc;
    color: #666;
    cursor: not-allowed;
}

.manual-climb-cancel-btn {
    padding: 8px 12px;
}

/* Crosshair cursor while placing points */
#map.manual-climb-active .maplibregl-canvas {
    cursor: crosshair !important;
}

/* Waypoint dot markers shown during point selection */
.manual-climb-dot {
    width: 12px;
    height: 12px;
    background: #1565C0;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
    pointer-events: none;
}

.manual-climb-dot.first {
    background: #2AAD27;
}

/* Radius controls injected inside an analysis section */
.section-content > #radius-controls {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-bottom: 0;
    margin-bottom: 0;
}

/* --- GPX MODAL & UPLOADED FILES --- */
.gpx-modal-content {
    max-width: 520px;
    text-align: left;
}

.gpx-modal-content h4,
.gpx-modal-content p {
    text-align: left;
}

.gpx-modal-actions {
    margin: 12px 0;
}

.gpx-modal-actions .gpx-btn,
#gpx-modal-close {
    margin-top: 0;
}

.gpx-modal-panel {
    margin-top: 0;
    margin-bottom: 14px;
}

.gpx-auth {
    margin: 12px 0;
    padding: 12px;
    border-radius: 8px;
    background: rgba(236, 239, 241, 0.6);
    border: 1px solid rgba(120, 144, 156, 0.35);
}

.gpx-auth-desc {
    font-size: 12px;
    color: #455A64;
    margin: 0 0 8px 0;
}

.google-signin-btn {
    display: flex;
    min-height: 40px;
}

.gpx-auth-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gpx-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    background: #CFD8DC;
}

.gpx-user-email {
    font-size: 13px;
    font-weight: 600;
    color: #263238;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.gpx-signout-btn {
    flex-shrink: 0;
    margin: 0;
}

.secondary-btn {
    background-color: #ECEFF1;
    color: #37474F;
    padding: 7px 10px;
    font-size: 12px;
    line-height: 1.2;
}

.secondary-btn:hover {
    background-color: #CFD8DC;
}

.danger-btn {
    background-color: #FDECEA;
    color: #B42318;
    padding: 7px 10px;
    font-size: 12px;
    line-height: 1.2;
}

.danger-btn:hover {
    background-color: #FCDAD7;
}

.uploaded-gpx-panel {
    margin-top: 8px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(120, 144, 156, 0.35);
}

.gpx-modal-panel .uploaded-gpx-list {
    max-height: 280px;
    overflow-y: auto;
    padding-right: 2px;
}

.uploaded-gpx-title {
    font-size: 12px;
    font-weight: 700;
    color: #37474F;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.uploaded-gpx-empty {
    font-size: 12px;
    color: #607D8B;
}

.uploaded-gpx-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.uploaded-gpx-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px;
    border-radius: 8px;
    background: rgba(236, 239, 241, 0.9);
}

.uploaded-gpx-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}

.uploaded-gpx-name {
    font-size: 13px;
    font-weight: 700;
    color: #263238;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.uploaded-gpx-date {
    font-size: 11px;
    color: #607D8B;
}

.uploaded-gpx-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.uploaded-gpx-actions button {
    white-space: nowrap;
}

@media (max-width: 600px) {
    .uploaded-gpx-item {
        flex-direction: column;
        align-items: stretch;
    }

    .uploaded-gpx-actions {
        width: 100%;
    }

    .uploaded-gpx-actions .secondary-btn,
    .uploaded-gpx-actions .danger-btn {
        flex: 1;
    }
}

/* --- ELEVATION PROFILE BAR --- */
.elevation-profile {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    transition: none;
}

.elevation-profile-body {
    position: relative;
    height: 130px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(5px);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.2);
    transition: height 0.3s ease;
}

.elevation-profile.minimized .elevation-profile-body {
    height: 26px;
}

@media (min-width: 600px) {
    .elevation-profile-body {
        height: 150px;
    }
}

.elevation-profile-overlay {
    position: absolute;
    top: 0;
    left: 52px;
    right: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 4px;
    min-height: 24px;
    pointer-events: none;
    user-select: none;
    z-index: 1;
}

@media (max-width: 600px) {
    .elevation-profile-overlay {
        pointer-events: auto;
        cursor: pointer;
        left: 0;
        right: 0;
        padding: 4px 10px;
    }
}

.elevation-profile-overlay > * {
    pointer-events: auto;
}

.elevation-profile-label {
    font-size: 11px;
    font-weight: 700;
    color: #555;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 3px;
    padding: 1px 5px;
}

.elevation-profile-info {
    font-size: 11px;
    color: #333;
    font-weight: 600;
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 8px;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 3px;
    margin: 0 4px;
}

.elevation-profile-info:empty {
    display: none;
}

.elevation-profile-toggle {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #bbb;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    color: #555;
    padding: 1px 6px;
    line-height: 1;
    transition: transform 0.3s ease;
}

.elevation-profile-toggle:hover {
    background: #fff;
    border-color: #888;
}

.elevation-profile.minimized .elevation-profile-toggle {
    transform: rotate(180deg);
}

#elevation-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

.elevation-profile.minimized #elevation-canvas {
    display: none;
}
