body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.karten-container {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
}

#map {
    width: 100%;
    height: 100%;
}

#map.css-sky-fallback {
    background: linear-gradient(180deg, #87CEEB 0%, #c7e8f9 26%, #ffffff 48%, #ffffff 100%);
}

/* Custom override cursors for Mapbox GL Draw interaction */
#map.draw-cursor-default canvas,
#map.draw-cursor-default .maplibregl-canvas-container,
#map.draw-cursor-default .mapboxgl-canvas-container,
#map.draw-cursor-default .maplibregl-canvas,
#map.draw-cursor-default .mapboxgl-canvas {
    cursor: default !important;
}

#map.draw-cursor-move canvas,
#map.draw-cursor-move .maplibregl-canvas-container,
#map.draw-cursor-move .mapboxgl-canvas-container,
#map.draw-cursor-move .maplibregl-canvas,
#map.draw-cursor-move .mapboxgl-canvas {
    cursor: move !important;
}

#map.draw-cursor-pointer canvas,
#map.draw-cursor-pointer .maplibregl-canvas-container,
#map.draw-cursor-pointer .mapboxgl-canvas-container,
#map.draw-cursor-pointer .maplibregl-canvas,
#map.draw-cursor-pointer .mapboxgl-canvas {
    cursor: pointer !important;
}

#map.draw-cursor-grab canvas,
#map.draw-cursor-grab .maplibregl-canvas-container,
#map.draw-cursor-grab .mapboxgl-canvas-container,
#map.draw-cursor-grab .maplibregl-canvas,
#map.draw-cursor-grab .mapboxgl-canvas {
    cursor: grab !important;
}

#map.draw-cursor-grabbing canvas,
#map.draw-cursor-grabbing .maplibregl-canvas-container,
#map.draw-cursor-grabbing .mapboxgl-canvas-container,
#map.draw-cursor-grabbing .maplibregl-canvas,
#map.draw-cursor-grabbing .mapboxgl-canvas {
    cursor: grabbing !important;
}

.overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 15px 6px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    width: 300px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.overlay.collapsed {
    width: auto;
    max-height: 48px;
    padding: 8px 14px;
    border-radius: 25px;
    overflow: hidden;
}

#main-menu-content {
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

/* Custom narrow scrollbar for WebKit */
#main-menu-content::-webkit-scrollbar {
    width: 6px;
}

#main-menu-content::-webkit-scrollbar-track {
    background: transparent;
}

#main-menu-content::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}

#main-menu-content::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

.overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding-bottom: 10px;
}

.overlay.collapsed .overlay-header {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.overlay.collapsed #main-menu-content {
    display: none;
}

h1 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #333;
}

p {
    margin: 0;
    font-size: 14px;
    color: #666;
}

.status {
    margin-top: 10px;
    font-weight: bold;
}

.btn-add {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 15px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    text-align: center;
}

.btn-add:hover {
    background: #1d4ed8;
}

.btn-add:active {
    transform: scale(0.98);
}

.btn-add:disabled {
    background: #94a3b8 !important;
    color: #e2e8f0 !important;
    cursor: not-allowed !important;
    opacity: 0.7;
    transform: none !important;
}

/* Carousel Menu Styles */
.carousel-tab {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-grow: 1;
    text-align: center;
    outline: none;
}

.carousel-tab.active {
    background: #2563eb;
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.carousel-tab:hover:not(.active) {
    color: #0f172a;
    background: #f1f5f9;
}

.carousel-nav-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 8px;
}

.carousel-nav-4 .carousel-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 2px;
    border-radius: 10px;
    font-size: 10.5px;
    line-height: 1.15;
    min-width: 0;
}

.carousel-tab-icon {
    font-size: 14px;
    line-height: 1;
}

.carousel-tab-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.menu-section-title {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 6px;
}

.menu-accordion {
    margin-top: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    overflow: hidden;
}

.menu-accordion > summary {
    list-style: none;
    cursor: pointer;
    padding: 7px 9px;
    font-size: 11.5px;
    font-weight: 700;
    color: #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    background: rgba(241, 245, 249, 0.7);
}

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

.menu-accordion > summary::after {
    content: '▸';
    font-size: 11px;
    color: #64748b;
    transition: transform 0.15s ease;
}

.menu-accordion[open] > summary::after {
    transform: rotate(90deg);
}

.menu-accordion-body {
    padding: 8px 9px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    border-top: 1px solid #e2e8f0;
}

.export-submode-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 3px;
    background: #e2e8f0;
    border-radius: 8px;
    margin-bottom: 10px;
}

.export-submode-btn {
    border: none;
    background: transparent;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    padding: 6px 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.export-submode-btn.active {
    background: #ffffff;
    color: #1d4ed8;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.tool-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}

.tool-quick-btn.active {
    outline: 2px solid #0f172a;
    outline-offset: 1px;
}

@media (hover: none), (pointer: coarse) {
    .desktop-only-hint {
        display: none !important;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1100;
    animation: fadeIn 0.3s ease;
}

.modal {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 16px;
    width: 400px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* Purpose Selection Modal Styles ("Wofür nutzt du dachmap heute?") */
.purpose-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.25);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2200;
    padding: 12px;
    box-sizing: border-box;
    animation: purposeFadeIn 0.2s ease-out;
}

@keyframes purposeFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.purpose-modal-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22), 0 0 1px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 720px;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: relative;
    box-sizing: border-box;
    padding: 16px 20px 14px 20px;
    text-align: center;
    animation: purposeScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes purposeScaleIn {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.purpose-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.purpose-close-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.purpose-close-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
}

.purpose-header {
    margin-bottom: 12px;
    padding: 0 20px;
}

.purpose-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 4px 0;
    line-height: 1.25;
}

.purpose-subtitle {
    font-size: 12.5px;
    color: #64748b;
    margin: 0;
    line-height: 1.35;
}

.purpose-tiles-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.purpose-tile {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    outline: none;
    user-select: none;
    min-height: 68px;
    box-sizing: border-box;
}

.purpose-tile:hover {
    background: #eff6ff;
    border-color: #3b82f6;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.1);
}

.purpose-tile:active {
    transform: scale(0.98);
}

.purpose-tile:focus-visible {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.purpose-tile-svg {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.purpose-tile-label {
    font-size: 11.5px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.2;
    text-align: center;
}

.purpose-sonstiges-wrap {
    margin-bottom: 6px;
}

.purpose-sonstiges-bar {
    width: 100%;
    box-sizing: border-box;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 9px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.purpose-sonstiges-bar:hover {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
}

.purpose-sonstiges-bar:focus-visible {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.purpose-sonstiges-form {
    display: none;
    width: 100%;
    box-sizing: border-box;
    gap: 6px;
}

.purpose-sonstiges-input {
    flex-grow: 1;
    padding: 8px 12px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    color: #0f172a;
    outline: none;
    box-sizing: border-box;
}

.purpose-sonstiges-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.purpose-sonstiges-submit {
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
    white-space: nowrap;
}

.purpose-sonstiges-submit:hover {
    background: #1d4ed8;
}

.purpose-sonstiges-submit:focus-visible {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.purpose-skip-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 12.5px;
    text-decoration: underline;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.15s ease;
}

.purpose-skip-btn:hover {
    color: #0f172a;
}

.purpose-skip-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
}

.purpose-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #0f172a;
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 2300;
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.purpose-toast.show {
    opacity: 1;
    transform: translateY(0);
}

@keyframes purposePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
        outline: 3px solid #2563eb;
    }
    50% {
        box-shadow: 0 0 0 8px rgba(37, 99, 235, 0);
        outline: 3px solid #3b82f6;
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
        outline: 3px solid #2563eb;
    }
}

.purpose-highlight {
    animation: purposePulse 0.9s ease-in-out infinite alternate !important;
    outline: 3px solid #2563eb !important;
    outline-offset: 2px !important;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.purpose-tip-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: #1e293b;
    color: #ffffff;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    z-index: 2500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    max-width: 90vw;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
    line-height: 1.4;
}

.purpose-tip-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.route-error-toast {
    background: #991b1b;
    border: 1px solid rgba(254, 202, 202, 0.55);
    cursor: pointer;
    z-index: 2550;
}

.purpose-tip-wish-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}

.purpose-tip-wish-row.appended {
    display: flex;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    font-size: 12.5px;
}

.purpose-tip-wish-btn {
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 999px;
    padding: 4px 11px;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.purpose-tip-wish-btn:hover {
    background: #1d4ed8;
}

/* Mobile Layout (< 600px) */
@media (max-width: 600px) {
    .purpose-modal-card {
        padding: 12px 10px 10px 10px;
        border-radius: 14px;
        max-width: 380px;
        max-height: calc(100dvh - 16px);
        overflow-y: auto;
    }
    .purpose-title {
        font-size: 16px;
        margin-bottom: 2px;
    }
    .purpose-subtitle {
        font-size: 11.5px;
    }
    .purpose-header {
        margin-bottom: 8px;
        padding: 0 16px;
    }
    .purpose-tiles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 5px;
        margin-bottom: 5px;
    }
    .purpose-tile {
        min-height: 58px;
        padding: 5px 4px;
        gap: 2px;
    }
    .purpose-tile-svg {
        width: 26px;
        height: 26px;
    }
    .purpose-tile-label {
        font-size: 11.5px;
        line-height: 1.15;
    }
    .purpose-sonstiges-bar {
        padding: 6px 10px;
        font-size: 13px;
    }
    .purpose-skip-btn {
        font-size: 12px;
        padding: 2px 6px;
    }
    .purpose-tip-toast {
        top: 12px;
        padding: 8px 12px;
        font-size: 12px;
        max-width: calc(100vw - 24px);
    }
}

/* Short Viewports / Landscape on Mobile (< 500px height) */
@media (max-height: 500px) {
    .purpose-modal-card {
        padding: 10px 14px 8px 14px;
        max-height: calc(100dvh - 12px);
        overflow-y: auto;
    }
    .purpose-header {
        margin-bottom: 6px;
    }
    .purpose-title {
        font-size: 15px;
        margin-bottom: 1px;
    }
    .purpose-subtitle {
        font-size: 11px;
    }
    .purpose-tiles-grid {
        gap: 4px;
        margin-bottom: 4px;
    }
    .purpose-tile {
        min-height: 50px;
        padding: 4px 2px;
    }
    .purpose-tile-svg {
        width: 22px;
        height: 22px;
    }
    .purpose-tile-label {
        font-size: 10.5px;
    }
}

.drop-zone {
    border: 2px dashed #cbd5e1;
    padding: 40px 20px;
    border-radius: 12px;
    margin: 20px 0;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.drop-zone.active {
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.05);
}

.privacy-note {
    font-size: 12px;
    color: #ef4444;
    background: #fee2e2;
    padding: 8px;
    border-radius: 6px;
    margin-top: 10px;
    font-weight: 600;
}

/* Unified Route List & Flight Controls */
.track-list {
    margin-top: 8px;
    max-height: 240px;
    overflow-y: auto;
}

.track-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: rgba(255, 255, 255, 0.72);
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 12px;
    border: 1px solid #e2e8f0;
    transition: opacity 0.2s, border-color 0.2s;
}

.track-item.route-item-hidden {
    opacity: 0.55;
    background: rgba(241, 245, 249, 0.7);
}

.route-item-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 999px;
    flex-shrink: 0;
}

.route-item-badge.planned {
    background: #dbeafe;
    color: #1d4ed8;
}

.route-item-badge.gpx {
    background: #ecfdf5;
    color: #047857;
}

.track-name {
    flex-grow: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 6px;
    cursor: pointer;
}

.track-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
    min-width: 0;
    max-width: 100%;
}

/* Breite/Farbe-Zeile in "Meine Routen": Schieberegler darf schrumpfen, Farbfeld bleibt sichtbar */
.track-item input[type="range"] {
    min-width: 0;
}

.track-item input[type="color"] {
    flex-shrink: 0;
}

.track-actions button {
    background: rgba(248, 250, 252, 0.9);
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    cursor: pointer;
    padding: 2px 5px;
    font-size: 11px;
    color: #475569;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.track-actions button:hover {
    background: #eef2ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.track-actions button.route-btn-danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

.track-actions button.route-btn-flying {
    background: #ef4444;
    border-color: #dc2626;
    color: #ffffff;
}

.route-action-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
    margin-bottom: 8px;
}

.route-planner-hint {
    font-size: 11px;
    line-height: 1.35;
    color: #475569;
    background: rgba(241, 245, 249, 0.9);
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 8px;
    margin-bottom: 8px;
}

.flight-duration-box {
    background: rgba(241, 245, 249, 0.85);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 7px 8px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.flight-preset-row {
    display: flex;
    gap: 4px;
    margin-top: 5px;
}

.flight-preset-btn {
    flex: 1;
    padding: 3px 4px;
    font-size: 10.5px;
    font-weight: 600;
    border-radius: 5px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
}

.flight-preset-btn:hover {
    border-color: #8b5cf6;
    color: #6d28d9;
}

.flight-preset-btn.active {
    background: #ede9fe;
    border-color: #7c3aed;
    color: #5b21b6;
}

/* Context Menu */
#context-menu {
    position: absolute;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    display: none;
    padding: 5px 0;
    min-width: 150px;
}

.menu-item {
    padding: 8px 15px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background 0.2s;
}

.menu-item:hover {
    background: #f1f5f9;
    color: #2563eb;
}

/* Elevation Profile Window */
#profile-window {
    position: absolute;
    bottom: 20px;
    right: 20px;
    /* border-box: style.width/height entsprechen der gemessenen Groesse inkl. Rahmen,
       sonst waechst das Fenster beim Verschieben um 2 px je Mausbewegung */
    box-sizing: border-box;
    width: 540px;
    height: 390px;
    background: rgba(15, 23, 42, 0.90); /* Premium glassmorphism dark mode */
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    z-index: 1260;
    display: none;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.15);
    user-select: none;
    overflow: hidden;
    min-width: 340px;
    min-height: 340px;
    max-width: 95vw;
    max-height: 62vh;
    color: #f8fafc;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, border-radius 0.2s ease;
}

#profile-window.gpx-edit-active {
    min-height: 410px;
    max-height: 75vh;
}

#profile-window.gpx-edit-active #profile-controls,
#profile-window.gpx-edit-active #profile-surface-container,
#profile-window.gpx-edit-active #profile-climbs-bar,
#profile-window.gpx-edit-active #profile-selection-bar {
    display: none !important;
}

#profile-window.profile-docked {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    border-radius: 14px 14px 0 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    z-index: 1265;
}

#profile-window.profile-docked .profile-resize-w,
#profile-window.profile-docked .profile-resize-e,
#profile-window.profile-docked .profile-resize-nw,
#profile-window.profile-docked .profile-resize-se {
    display: none !important;
}

#profile-window.profile-docked #profile-header {
    border-radius: 14px 14px 0 0;
    cursor: default;
}

#profile-window.profile-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    z-index: 1650 !important;
    background: rgba(15, 23, 42, 0.98) !important;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
    box-shadow: none !important;
}

#profile-window.profile-fullscreen .profile-resize-handle {
    display: none !important;
}

#profile-window.profile-fullscreen #profile-header {
    border-radius: 0;
    cursor: default;
    padding: 12px 16px;
    flex-wrap: wrap;
}

#profile-window.profile-fullscreen #profile-grade-legend {
    display: flex !important;
}

#profile-window.profile-fullscreen #profile-content {
    min-height: 200px;
    padding: 14px 18px 10px;
}

#profile-window.profile-fullscreen #profile-controls {
    display: flex !important;
    padding: 10px 16px 14px;
    gap: 10px 14px;
}

.profile-back-to-map-btn {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 13px;
    min-height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(56, 189, 248, 0.55);
    background: linear-gradient(135deg, #2563eb, #0284c7);
    color: #ffffff;
    font-size: 12.5px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
    transition: transform 0.15s ease, filter 0.15s ease;
    flex-shrink: 0;
}

.profile-back-to-map-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

#profile-window.profile-fullscreen .profile-back-to-map-btn {
    display: inline-flex;
}

.profile-sheet-grabber {
    display: none;
    width: 100%;
    padding: 7px 0 3px;
    justify-content: center;
    align-items: center;
    cursor: ns-resize;
    touch-action: none;
    background: rgba(30, 41, 59, 0.65);
    flex-shrink: 0;
}

.profile-sheet-grabber-bar {
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.55);
}

#profile-window.profile-fullscreen .profile-sheet-grabber {
    display: none !important;
}

.profile-mobile-options-btn {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(30, 41, 59, 0.8);
    color: #e2e8f0;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    margin-left: auto;
}

.profile-mobile-options-btn[aria-expanded="true"] {
    border-color: #38bdf8;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.16);
}

#profile-window.profile-fullscreen .profile-mobile-options-btn {
    display: none !important;
}

#mobile-menu-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.34);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1290;
    touch-action: none;
}

body.has-profile-fullscreen #active-mode-banner,
body.has-profile-fullscreen #route-assistant-panel,
body.has-profile-fullscreen #bottom-tabs-container,
body.has-profile-fullscreen .backlog-overlay,
body.has-profile-fullscreen #flight-hud,
body.has-profile-fullscreen #measure-result-panel {
    display: none !important;
}

#profile-window.profile-window--narrow #profile-grade-legend {
    display: none;
}

.profile-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.profile-header-btn {
    cursor: pointer;
    color: #94a3b8;
    font-size: 15px;
    line-height: 1;
    transition: all 0.2s ease-in-out;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
    border: none;
    padding: 0;
}

.profile-header-btn:hover {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.16);
}

.profile-header-export-btn {
    cursor: pointer;
    color: #cbd5e1;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    padding: 3px 6px;
    border-radius: 5px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(30, 41, 59, 0.72);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.profile-header-export-btn:hover {
    color: #ffffff;
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.22);
}

.profile-fly-here-btn {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 6px;
    border: 1px solid rgba(139, 92, 246, 0.55);
    background: rgba(109, 40, 217, 0.35);
    color: #ede9fe;
    font-size: 10.5px;
    font-weight: 600;
    font-family: inherit;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.profile-fly-here-btn:hover {
    background: rgba(124, 58, 237, 0.65);
    border-color: #a78bfa;
    color: #ffffff;
}

#flight-hud {
    position: fixed;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1500;
    display: none;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(148, 163, 184, 0.28);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    color: #f8fafc;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    max-width: calc(100vw - 24px);
    overflow-x: auto;
}

.flight-hud-grade {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    color: #0f172a;
    background: #22c55e;
}

.flight-hud-stop {
    cursor: pointer;
    border: 1px solid rgba(248, 113, 113, 0.5);
    background: rgba(239, 68, 68, 0.22);
    color: #fecaca;
    border-radius: 999px;
    padding: 2px 9px;
    font-size: 11px;
    font-weight: 700;
    font-family: inherit;
}

.flight-hud-stop:hover {
    background: rgba(239, 68, 68, 0.45);
    color: #ffffff;
}

/* --- KI-Kartenassistent (Reiter in der unteren Leiste + aufklappbares Panel darüber) --- */
#assistant-chatgpt-banner {
    position: fixed;
    bottom: 32px;
    left: 332px;
    z-index: 1220;
    display: none;
    max-width: 340px;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #f8fafc;
    border: 1px solid rgba(56, 189, 248, 0.42);
    border-radius: 12px;
    padding: 10px 12px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
    font-size: 12px;
    line-height: 1.45;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.assistant-banner-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}

.assistant-banner-cta {
    background: linear-gradient(135deg, #2563eb, #0284c7);
    color: #ffffff;
    border: none;
    border-radius: 7px;
    padding: 5px 10px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
}

.assistant-banner-dismiss {
    background: transparent;
    color: #94a3b8;
    border: none;
    font-size: 11.5px;
    cursor: pointer;
    padding: 3px 6px;
}

.assistant-banner-dismiss:hover {
    color: #ffffff;
}

#btn-map-assistant-toggle {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #0f172a;
    border: 1px solid rgba(37, 99, 235, 0.28);
    border-bottom: none;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

#btn-map-assistant-toggle:hover,
#btn-map-assistant-toggle[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.99);
    color: #2563eb;
    border-color: rgba(37, 99, 235, 0.55);
}

#map-assistant-panel {
    position: fixed;
    bottom: 32px;
    left: 332px;
    width: 370px;
    max-width: calc(100vw - 352px);
    max-height: min(460px, calc(100dvh - 80px));
    z-index: 1230;
    display: none;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    color: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 14px;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

#map-assistant-panel.is-minimized #assistant-messages,
#map-assistant-panel.is-minimized #assistant-status-bar,
#map-assistant-panel.is-minimized #assistant-form,
#map-assistant-panel.is-minimized #assistant-inline-chatgpt {
    display: none !important;
}

.assistant-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(30, 41, 59, 0.72);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.assistant-header-title {
    font-size: 13px;
    font-weight: 700;
    color: #f8fafc;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.assistant-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.assistant-icon-btn {
    background: transparent;
    color: #94a3b8;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 3px 7px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.assistant-icon-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

#assistant-inline-chatgpt {
    display: none;
    padding: 8px 12px;
    background: rgba(14, 165, 233, 0.14);
    border-bottom: 1px solid rgba(56, 189, 248, 0.25);
    font-size: 11.5px;
    color: #e0f2fe;
    line-height: 1.4;
}

#assistant-messages {
    flex: 1;
    min-height: 140px;
    max-height: 290px;
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12.5px;
    line-height: 1.45;
}

.assistant-msg {
    padding: 8px 10px;
    border-radius: 10px;
    max-width: 92%;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.assistant-msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
}

.assistant-msg-bot {
    align-self: flex-start;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #f1f5f9;
}

.assistant-msg-step {
    align-self: flex-start;
    font-size: 11.5px;
    padding: 5px 9px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #a7f3d0;
}

.assistant-msg-error {
    align-self: flex-start;
    font-size: 11.5px;
    padding: 6px 9px;
    border-radius: 8px;
    background: rgba(127, 29, 29, 0.45);
    border: 1px solid rgba(248, 113, 113, 0.45);
    color: #fecaca;
}

.assistant-wish-card {
    align-self: flex-start;
    max-width: 94%;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(30, 58, 138, 0.38);
    border: 1px solid rgba(96, 165, 250, 0.42);
    color: #e0f2fe;
    font-size: 11.5px;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.assistant-wish-btn {
    align-self: flex-start;
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 7px;
    padding: 5px 10px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease;
}

.assistant-wish-btn:hover {
    background: #1d4ed8;
}

#assistant-status-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(30, 41, 59, 0.75);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 11.5px;
    color: #bae6fd;
}

#btn-assistant-cancel {
    background: rgba(239, 68, 68, 0.22);
    color: #fecaca;
    border: 1px solid rgba(248, 113, 113, 0.45);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

#btn-assistant-cancel:hover {
    background: rgba(239, 68, 68, 0.45);
    color: #ffffff;
}

#assistant-form {
    display: flex;
    gap: 6px;
    padding: 9px 10px;
    background: rgba(15, 23, 42, 0.85);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#assistant-input {
    flex: 1;
    min-width: 0;
    background: rgba(30, 41, 59, 0.9);
    color: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 12.5px;
    font-family: inherit;
    outline: none;
}

#assistant-input:focus {
    border-color: #38bdf8;
}

#btn-assistant-send {
    background: linear-gradient(135deg, #2563eb, #0284c7);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    flex-shrink: 0;
}

#btn-assistant-send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    #assistant-chatgpt-banner {
        left: 12px;
        right: 12px;
        bottom: 32px;
        max-width: none;
    }
    #map-assistant-panel {
        top: auto;
        bottom: 34px;
        left: 10px;
        right: 10px;
        width: auto;
        max-width: none;
        max-height: 55dvh;
    }
}

/* Custom visible & touch-friendly pointer resize handles */
.profile-resize-handle {
    position: absolute;
    z-index: 20;
    touch-action: none;
}

.profile-resize-n {
    top: 0;
    left: 18px;
    right: 18px;
    height: 8px;
    cursor: ns-resize;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-resize-n::after {
    content: '';
    width: 34px;
    height: 3px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.45);
    transition: background 0.15s ease, width 0.15s ease;
}

.profile-resize-n:hover::after {
    background: rgba(56, 189, 248, 0.9);
    width: 48px;
}

.profile-resize-w {
    top: 18px;
    bottom: 18px;
    left: 0;
    width: 8px;
    cursor: ew-resize;
}

.profile-resize-e {
    top: 18px;
    bottom: 18px;
    right: 0;
    width: 8px;
    cursor: ew-resize;
}

.profile-resize-w:hover,
.profile-resize-e:hover {
    background: rgba(56, 189, 248, 0.18);
}

.profile-resize-nw {
    top: 0;
    left: 0;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
}

.profile-resize-nw::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    width: 7px;
    height: 7px;
    border-top: 2px solid rgba(148, 163, 184, 0.7);
    border-left: 2px solid rgba(148, 163, 184, 0.7);
    border-top-left-radius: 2px;
    transition: border-color 0.15s ease;
}

.profile-resize-nw:hover::after {
    border-color: #38bdf8;
}

.profile-resize-se {
    bottom: 0;
    right: 0;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
}

.profile-resize-se::after {
    content: '';
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 7px;
    height: 7px;
    border-bottom: 2px solid rgba(148, 163, 184, 0.55);
    border-right: 2px solid rgba(148, 163, 184, 0.55);
    border-bottom-right-radius: 2px;
    transition: border-color 0.15s ease;
}

.profile-resize-se:hover::after {
    border-color: #38bdf8;
}

.profile-pin {
    cursor: pointer;
}

.profile-pin:hover .profile-pin-badge {
    filter: brightness(1.18);
}

#profile-window:focus-within {
    border-color: rgba(6, 182, 212, 0.4);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 15px rgba(6, 182, 212, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

#profile-header {
    padding: 10px 16px;
    background: rgba(30, 41, 59, 0.65);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    cursor: move;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    flex-shrink: 0;
}

#profile-grade-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 9.5px;
    color: #cbd5e1;
    margin-left: auto;
    margin-right: 4px;
    flex-wrap: wrap;
}

.profile-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.profile-legend-swatch {
    width: 7px;
    height: 7px;
    border-radius: 2px;
    display: inline-block;
}

#profile-content {
    padding: 10px 16px 8px;
    flex: 1 1 120px;
    min-height: 110px;
    position: relative;
    cursor: crosshair;
    outline: none;
}

#profile-chart-container {
    touch-action: none;
}

#profile-selection-overlay {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(250, 204, 21, 0.18);
    border-left: 1.5px solid rgba(250, 204, 21, 0.85);
    border-right: 1.5px solid rgba(250, 204, 21, 0.85);
    display: none;
    pointer-events: none;
    z-index: 8;
}

#profile-selection-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 16px;
    background: rgba(250, 204, 21, 0.12);
    border-top: 1px solid rgba(250, 204, 21, 0.28);
    border-bottom: 1px solid rgba(250, 204, 21, 0.22);
    font-size: 10.5px;
    color: #fef08a;
    flex-shrink: 0;
}

#profile-selection-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.profile-sel-btn {
    background: rgba(250, 204, 21, 0.2);
    color: #fef9c3;
    border: 1px solid rgba(250, 204, 21, 0.45);
    border-radius: 6px;
    padding: 2px 7px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.3;
}

.profile-sel-btn:hover {
    background: rgba(250, 204, 21, 0.35);
}

.profile-title {
    font-weight: 600;
    color: #f1f5f9;
    font-size: 14px;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.close-profile {
    cursor: pointer;
    color: #94a3b8;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    /* Minimieren-Strich "_" etwas anheben, damit er mittig im Kreis sitzt */
    box-sizing: border-box;
    padding-bottom: 14px;
    transition: all 0.2s ease-in-out;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
    flex-shrink: 0;
}

/* Minimieren statt Schliessen: neutrale Hover-Farbe wie die anderen Kopfknoepfe */
.close-profile:hover {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.16);
}

#profile-info {
    padding: 4px 16px 6px;
    font-size: 11px;
    color: #cbd5e1;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    font-weight: 500;
    flex-shrink: 0;
}

#profile-climbs-bar {
    display: none;
    padding: 4px 14px 2px;
    gap: 6px;
    align-items: center;
    overflow-x: auto;
    /* Kein sichtbarer Laufbalken (Ralf 25.11.2026); scrollen per Mausrad, Wischen oder Shift+Rad */
    scrollbar-width: none;
    flex-shrink: 0;
}

#profile-climbs-bar::-webkit-scrollbar {
    display: none;
}

.profile-climb-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(30, 41, 59, 0.78);
    color: #e2e8f0;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
    flex-shrink: 0;
}

.profile-climb-chip:hover {
    background: rgba(51, 65, 85, 0.95);
    border-color: rgba(250, 204, 21, 0.55);
}

.profile-climb-chip.active {
    background: rgba(250, 204, 21, 0.22);
    border-color: #facc15;
    color: #fef08a;
}

.profile-climb-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

#profile-surface-container {
    display: none;
    padding: 0 14px 4px;
    flex-shrink: 0;
}

#profile-surface-bar {
    display: flex;
    width: 100%;
    height: 7px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-surface-seg {
    height: 100%;
    transition: opacity 0.15s ease, filter 0.15s ease;
    cursor: pointer;
}

#profile-surface-bar.has-hover .profile-surface-seg:not(.is-hovered) {
    opacity: 0.35;
}

.profile-surface-seg.is-hovered {
    filter: brightness(1.3);
}

#profile-surface-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 3px;
    font-size: 9.5px;
    color: #cbd5e1;
}

.profile-surface-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 1px 4px;
    border-radius: 4px;
    transition: background 0.15s ease, color 0.15s ease;
}

.profile-surface-chip:hover,
.profile-surface-chip.is-hovered {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.profile-surface-swatch {
    width: 7px;
    height: 7px;
    border-radius: 2px;
    flex-shrink: 0;
}

.profile-surface-seg.is-derived,
.profile-surface-swatch.is-derived {
    background-image: repeating-linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.42) 0px,
        rgba(255, 255, 255, 0.42) 2.5px,
        transparent 2.5px,
        transparent 5px
    );
}

.profile-surface-seg.is-unknown,
.profile-surface-swatch.is-unknown {
    opacity: 0.72;
}

#profile-controls {
    padding: 6px 16px 10px;
    font-size: 11px;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 2px;
    background: rgba(30, 41, 59, 0.3);
    flex-shrink: 0;
}

#profile-duration-mode {
    background: rgba(15, 23, 42, 0.85);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 10.5px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

#profile-duration-mode:hover,
#profile-duration-mode:focus {
    border-color: rgba(56, 189, 248, 0.6);
}

#fresnel-heights input {
    transition: all 0.2s ease;
}

#fresnel-heights input:hover, #fresnel-heights input:focus {
    border-color: rgba(6, 182, 212, 0.5) !important;
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.15);
    background: rgba(30, 41, 59, 0.9) !important;
}

#profile-marker-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #22d3ee;
    border: 2px solid #ffffff;
    border-radius: 50%;
    display: none;
    pointer-events: none;
    z-index: 11;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px #06b6d4, 0 0 4px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s ease;
}

#profile-marker-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(6, 182, 212, 0.4);
    border-left: 1px dashed #06b6d4;
    display: none;
    pointer-events: none;
    z-index: 9;
}

#profile-marker-line.is-pinned {
    width: 2px;
    background: rgba(245, 158, 11, 0.85);
    border-left: none;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

#profile-hover-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    border-left: 1px dashed rgba(148, 163, 184, 0.65);
    display: none;
    pointer-events: none;
    z-index: 8;
}

#profile-hover-label {
    position: absolute;
    top: 4px;
    background: rgba(15, 23, 42, 0.82);
    color: #e2e8f0;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    display: none;
    pointer-events: none;
    z-index: 9;
    white-space: nowrap;
    border: 1px solid rgba(148, 163, 184, 0.28);
}

.profile-pin-badge {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.18);
    border: 1px solid rgba(245, 158, 11, 0.55);
    color: #fde68a;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.profile-pin-badge:hover {
    background: rgba(245, 158, 11, 0.32);
    color: #ffffff;
}

#profile-marker-label {
    position: absolute;
    top: 24px;
    background: rgba(15, 23, 42, 0.95);
    color: #fff;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: bold;
    display: none;
    pointer-events: none;
    z-index: 10;
    white-space: nowrap;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Map Controls Glassmorphism */
.maplibregl-ctrl-group {
    background-color: rgba(255, 255, 255, 0.5) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
    border-radius: 12px !important;
    overflow: hidden;
}

.maplibregl-ctrl-group button {
    background-color: transparent !important;
    width: 36px !important;
    height: 36px !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
}

.maplibregl-ctrl-group button:last-child {
    border-bottom: none !important;
}

.maplibregl-ctrl-group button:hover {
    background-color: rgba(255, 255, 255, 0.3) !important;
}

.maplibregl-ctrl-icon {
    filter: grayscale(1) contrast(0.8);
}

/* Active / Tracking state for Geolocation Control */
.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon,
.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon {
    filter: none !important;
}

.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active {
    background-color: rgba(37, 99, 235, 0.15) !important;
}

#btn-search-geolocate:hover {
    color: #2563eb !important;
    background: rgba(37, 99, 235, 0.1) !important;
}

.maplibregl-ctrl-top-right {
    top: 75px !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Box Selection & Analysis Styles */
.boxdraw {
    background: rgba(56, 135, 190, 0.1);
    border: 2px solid #3887be;
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    z-index: 1000;
    pointer-events: none;
}

.selection-results {
    position: fixed;
    bottom: 30px;
    right: 320px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    border: 1px solid rgba(255, 255, 255, 0.4);
    font-family: inherit;
}

.selection-results h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #2563eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.selection-results ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.selection-results li {
    font-size: 11px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    color: #334155;
}

.selection-results li:last-child {
    border-bottom: none;
}

.selection-results b {
    color: #0f172a;
    font-weight: 600;
}

.btn-analyze-toggle {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 100;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: #334155;
}

.btn-analyze-toggle:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.05);
    color: #0f172a;
}

.btn-analyze-toggle.active {
    background: #2563eb !important;
    color: white !important;
    border-color: #1d4ed8 !important;
}

/* Community Backlog Flying Menu */
.backlog-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    padding: 16px;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    z-index: 1000;
    width: 320px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    display: flex;
    flex-direction: column;
    max-height: 480px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.backlog-overlay.collapsed {
    width: auto;
    padding: 8px 14px;
    border-radius: 25px;
}

.backlog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding-bottom: 10px;
    gap: 10px;
}

.backlog-overlay.collapsed .backlog-header {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.backlog-header h2 {
    margin: 0;
    font-size: 16px;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-toggle-menu {
    background: none;
    border: none;
    color: #1e293b;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
}

.btn-toggle-menu:hover {
    color: #2563eb;
}

.btn-toggle-pin {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-toggle-pin:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
}

.btn-toggle-pin.active {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    animation: pulsePinMode 1.5s infinite alternate;
}

@keyframes pulsePinMode {
    from {
        box-shadow: 0 0 4px rgba(239, 68, 68, 0.4);
    }

    to {
        box-shadow: 0 0 16px rgba(239, 68, 68, 0.8);
    }
}

.backlog-list {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}

.backlog-list::-webkit-scrollbar {
    width: 5px;
}

.backlog-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
}

.backlog-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

.backlog-item {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s, box-shadow 0.2s;
}

.backlog-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    border-color: #e2e8f0;
}

.backlog-item-content {
    flex-grow: 1;
    margin-right: 12px;
}

.backlog-item-title {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 4px;
    cursor: pointer;
}

.backlog-item-title:hover {
    color: #2563eb;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-proposed {
    background: #f1f5f9;
    color: #64748b;
}

.badge-progress {
    background: #eff6ff;
    color: #2563eb;
}

.badge-live {
    background: #f0fdf4;
    color: #16a34a;
}

.badge-rejected {
    background: #fef2f2;
    color: #b91c1c;
}

.idea-hp-field {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.upvote-btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    flex-shrink: 0;
}

.upvote-btn:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    transform: scale(1.08);
}

.upvote-btn:active {
    transform: scale(0.95);
}

.upvote-icon {
    font-size: 12px;
    line-height: 1;
    color: #64748b;
    transition: color 0.2s;
}

.upvote-btn:hover .upvote-icon {
    color: #2563eb;
}

.upvote-count {
    font-size: 11px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.1;
    margin-top: 1px;
}

/* Custom Marker Style */
.idea-pin-marker {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.45);
    border: 2px solid rgba(245, 158, 11, 0.88);
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55), 0 4px 12px rgba(245, 158, 11, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: floatPin 3s infinite ease-in-out;
    user-select: none;
}

.idea-pin-marker:hover {
    transform: scale(1.25) translateY(-4px);
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.75), 0 8px 20px rgba(245, 158, 11, 0.5);
    z-index: 1000;
}

@keyframes floatPin {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

.dachmap-style-ctrl {
    overflow: visible !important;
}
.dachmap-style-ctrl .dachmap-style-btn {
    width: 100% !important;
    height: auto !important;
    min-height: 28px !important;
    display: flex !important;
    padding: 6px 10px !important;
    box-sizing: border-box !important;
}

/* Idea Popup Form Styles */
.maplibregl-popup-content {
    border-radius: 16px !important;
    padding: 20px !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(8px);
}

.idea-form-popup h3 {
    margin: 0 0 10px 0;
    font-size: 15px;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 6px;
}

.idea-form-popup textarea {
    width: 220px;
    height: 80px;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    resize: none;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-bottom: 12px;
}

.idea-form-popup textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.idea-form-popup .actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.idea-form-popup .btn-cancel {
    background: #f1f5f9;
    color: #475569;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.idea-form-popup .btn-cancel:hover {
    background: #e2e8f0;
}

.idea-form-popup .btn-submit {
    background: #2563eb;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.idea-form-popup .btn-submit:hover {
    background: #1d4ed8;
}

.idea-form-popup .btn-submit:active {
    transform: scale(0.96);
}

/* Geocoder Search Styles */
#search-container {
    position: relative;
    width: 100%;
    margin-top: 10px;
    margin-bottom: 12px;
    z-index: 1001;
}

.overlay.collapsed #search-container {
    display: none !important;
}

#search-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
    font-family: inherit;
}

#search-input:focus {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    border-color: #2563eb;
}

#search-results {
    position: absolute;
    top: 42px;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    max-height: 250px;
    overflow-y: auto;
    display: none;
    border: 1px solid rgba(0, 0, 0, 0.06);
    padding: 5px 0;
    z-index: 1005;
}

.route-search-results {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08);
    max-height: 150px;
    overflow-y: auto;
    display: none;
    border: 1px solid rgba(0, 0, 0, 0.08);
    margin-top: 5px;
    padding: 4px 0;
}

.search-item {
    padding: 9px 12px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background 0.2s;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    text-align: left;
}

.search-item-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.search-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.search-item:hover {
    background: #f1f5f9;
}

.search-item.selected {
    background: #2563eb;
    color: white;
}

.search-item.selected .name {
    color: white;
}

.search-item.selected .details {
    color: rgba(255, 255, 255, 0.8);
}

.search-item .name {
    font-weight: 600;
    color: #1e293b;
}

.search-item .details {
    font-size: 11px;
    color: #64748b;
}

.solar-mode-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    color: #334155;
    font-weight: 500;
    transition: all 0.15s ease;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.solar-mode-label:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

.solar-mode-label.active {
    background: rgba(253, 141, 60, 0.08);
    border-color: rgba(253, 141, 60, 0.25);
    color: #bd0026;
}

#solar-control-panel.minimized {
    width: 42px !important;
    height: 42px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(253, 141, 60, 0.4) !important;
    box-shadow: 0 4px 15px rgba(253, 141, 60, 0.3) !important;
}

#solar-control-panel.minimized:hover {
    transform: scale(1.08);
    background: rgba(255, 255, 255, 1) !important;
}

/* Floating SEO Info Overlay */
.karten-info-overlay {
    position: absolute;
    bottom: 30px;
    left: 340px;
    z-index: 900;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    padding: 16px;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    width: 320px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    font-family: inherit;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.karten-info-overlay.collapsed {
    width: auto;
    max-width: 250px;
    padding: 8px 14px;
    border-radius: 25px;
}

.karten-info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding-bottom: 10px;
    gap: 10px;
}

.karten-info-overlay.collapsed .karten-info-header {
    border-bottom: none;
    padding-bottom: 0;
}

.info-content {
    display: block;
    transition: max-height 0.3s ease;
}

.info-content h2 {
    margin: 0 0 10px 0;
    font-size: 15px;
    color: #1e293b;
    font-weight: 700;
}

.info-content p {
    margin: 0 0 10px 0;
    font-size: 12.5px;
    color: #475569;
    line-height: 1.5;
}

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

@media (max-width: 768px) {
    body.mobile-menu-open #mobile-menu-backdrop {
        display: block;
    }

    .overlay {
        top: max(10px, env(safe-area-inset-top, 0px));
        left: 10px;
        right: 10px;
        width: auto;
        max-width: 420px;
        max-height: calc(100dvh - 20px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        z-index: 1350;
        padding: 12px 10px;
        border-radius: 16px;
        box-shadow: 0 16px 42px rgba(15, 23, 42, 0.28);
    }

    .overlay.collapsed {
        right: auto;
        width: auto;
        max-width: none;
        max-height: 48px;
        padding: 5px;
        border-radius: 999px;
        z-index: 1060;
    }

    #btn-toggle-main-menu {
        width: 36px !important;
        height: 36px !important;
        font-size: 18px !important;
    }

    /* Prevent iOS Safari auto-zoom on focus & improve touch comfort */
    #search-input,
    #route-start-input,
    #route-end-input,
    #assistant-input {
        font-size: 16px !important;
        min-height: 40px;
    }

    .carousel-nav-4 .carousel-tab {
        min-height: 44px;
        padding: 6px 4px;
        font-size: 11px;
    }

    .quick-profile-btn {
        min-height: 42px;
        font-size: 18px;
    }

    .btn-add {
        min-height: 38px;
    }

    .modal {
        width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        max-height: calc(100dvh - 24px);
        overflow-y: auto;
        padding: 18px !important;
        box-sizing: border-box;
    }

    /* Elevation Profile: Clean Mobile Bottom Sheet */
    #profile-window:not(.profile-fullscreen) {
        position: fixed;
        min-width: 0 !important;
        min-height: 205px;
        width: 100vw !important;
        max-width: 100vw !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        bottom: 0 !important;
        height: clamp(230px, 38dvh, 330px);
        max-height: 76dvh;
        border-radius: 18px 18px 0 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-sizing: border-box;
    }

    #profile-window:not(.profile-fullscreen) .profile-sheet-grabber {
        display: flex;
    }

    #profile-window:not(.profile-fullscreen) #profile-header {
        padding: 6px 12px 8px;
        border-radius: 0;
        cursor: grab;
    }

    #profile-window:not(.profile-fullscreen) #profile-content {
        padding: 6px 10px 4px;
    }

    #profile-window:not(.profile-fullscreen) #profile-info {
        padding: 4px 12px 8px;
        align-items: center;
        font-size: 11px;
    }

    #profile-window:not(.profile-fullscreen) .profile-mobile-options-btn {
        display: inline-flex;
    }

    #profile-window:not(.profile-fullscreen):not(.profile-controls-open) #profile-controls {
        display: none;
    }

    #profile-window:not(.profile-fullscreen).profile-controls-open {
        height: clamp(310px, 52dvh, 420px);
    }

    #profile-window:not(.profile-fullscreen).profile-controls-open #profile-controls {
        display: flex;
        max-height: 150px;
        overflow-y: auto;
        padding: 8px 12px 10px;
    }

    #profile-window .profile-header-btn,
    #profile-window .close-profile {
        width: 34px;
        height: 34px;
        font-size: 17px;
    }

    #profile-window:not(.profile-fullscreen) .profile-header-export-btn,
    #profile-window #btn-toggle-profile-dock {
        display: none;
    }

    #profile-window.profile-fullscreen .profile-header-export-btn {
        display: inline-flex;
        padding: 5px 9px;
        font-size: 11px;
    }

    .profile-resize-w,
    .profile-resize-e,
    .profile-resize-nw,
    .profile-resize-se,
    .profile-resize-n {
        display: none;
    }

    .selection-results {
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        bottom: max(56px, calc(48px + env(safe-area-inset-bottom, 0px))) !important;
        max-height: 55dvh !important;
    }

    .karten-info-overlay {
        top: auto;
        bottom: max(56px, calc(48px + env(safe-area-inset-bottom, 0px)));
        left: 10px;
        right: 10px;
        width: auto;
        max-width: none;
        box-sizing: border-box;
    }

    .info-content {
        display: none;
    }

    .info-content.is-open {
        display: block;
    }

    /* Unified Mobile Bottom Pill Dock */
    #bottom-tabs-container {
        left: 10px !important;
        right: 10px !important;
        bottom: max(18px, calc(12px + env(safe-area-inset-bottom, 0px))) !important;
        gap: 6px !important;
        z-index: 1020 !important;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        padding: 2px 0;
    }

    #bottom-tabs-container::-webkit-scrollbar {
        display: none;
    }

    #bottom-tabs-container > * {
        flex-shrink: 0;
        border-radius: 999px !important;
        border-bottom: 1px solid rgba(15, 23, 42, 0.14) !important;
        padding: 7px 12px !important;
        font-size: 12px !important;
        min-height: 36px;
        box-sizing: border-box;
        box-shadow: 0 6px 18px rgba(15, 23, 42, 0.16);
        display: inline-flex;
        align-items: center;
        gap: 5px;
    }

    body.has-profile-open #bottom-tabs-container,
    body.has-profile-open .backlog-overlay.collapsed {
        display: none !important;
    }

    .backlog-overlay.collapsed {
        top: auto;
        bottom: max(62px, calc(56px + env(safe-area-inset-bottom, 0px)));
        left: 10px;
        right: auto;
        width: auto;
        max-width: calc(100vw - 20px);
        padding: 6px 12px;
        z-index: 1010;
    }

    .backlog-overlay:not(.collapsed) {
        top: max(10px, env(safe-area-inset-top, 0px));
        left: 10px;
        right: 10px;
        width: auto;
        max-height: calc(100dvh - 20px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        z-index: 1360;
    }

    #measure-result-panel {
        top: max(58px, calc(54px + env(safe-area-inset-top, 0px)));
        right: 54px;
        left: 10px;
        padding: 7px 10px;
        font-size: 12px;
    }

    #mouse-position-tracker {
        display: none !important;
    }

    .custom-attribution {
        bottom: 0 !important;
        right: 0 !important;
        z-index: 8 !important;
        border-bottom-left-radius: 0 !important;
        border-top-left-radius: 6px !important;
        font-size: 9px !important;
        padding: 1px 6px !important;
    }

    #map-assistant-panel {
        bottom: max(12px, env(safe-area-inset-bottom, 0px));
        left: 10px;
        right: 10px;
        width: auto;
        max-width: none;
        max-height: 62dvh;
        z-index: 1370;
    }

    #assistant-chatgpt-banner {
        bottom: max(60px, calc(54px + env(safe-area-inset-bottom, 0px)));
    }
}

/* Side Info Drawer (Iframe overlay) */
.side-info-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 480px;
    max-width: 100%;
    background: rgba(255, 255, 255, 0.90);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1500;
    /* Above normal overlays, below context menu if needed */
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.side-info-overlay.open {
    transform: translateX(0);
}

.side-info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.side-info-header h2 {
    margin: 0;
    font-size: 16px;
    color: #1e293b;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.side-info-header-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.side-info-btn {
    background: none;
    border: none;
    font-size: 14px;
    color: #64748b;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-family: inherit;
}

.side-info-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1e293b;
}

.side-info-btn.back-btn {
    border: 1px solid rgba(37, 99, 235, 0.15);
    background: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    color: #2563eb;
}

.side-info-btn.back-btn:hover {
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    border-color: rgba(37, 99, 235, 0.2);
}

.side-info-body {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #fff;
}

.side-info-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

@media (max-width: 768px) {
    .side-info-overlay {
        width: 100%;
    }
}

/* Quick profile selection styling */
#route-details-scroll-box:focus {
    outline: 2px solid rgba(37, 99, 235, 0.35);
    outline-offset: 1px;
}

.route-detail-row {
    cursor: pointer;
    transition: background-color 0.12s ease;
}

.route-detail-row:hover {
    background-color: #f1f5f9;
}

.route-detail-row.is-active {
    background-color: #dbeafe !important;
    box-shadow: inset 3px 0 0 #2563eb;
}

.route-detail-row.is-active td {
    color: #1e3a8a !important;
    font-weight: 700;
}

.route-detail-nav-btn {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    border-radius: 5px;
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    cursor: pointer;
}

.route-detail-nav-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.quick-profile-btn {
    flex: 1;
    padding: 8px 0;
    font-size: 16px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(4px);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.quick-profile-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.quick-profile-btn.active {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border-color: transparent;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.route-pos-symbol-svg {
    width: 22px;
    height: 22px;
    display: block;
    overflow: visible;
    pointer-events: none;
}

.route-position-marker .route-pos-symbol-svg {
    width: 26px;
    height: 26px;
}

.route-pos-runner-svg {
    filter: drop-shadow(0 0 1.4px rgba(255, 255, 255, 0.95)) drop-shadow(0 1px 1.5px rgba(15, 23, 42, 0.35));
}

.route-pos-runner-svg .runner-torso {
    animation: runnerBounce 0.3s ease-in-out infinite;
    transform-box: view-box;
    transform-origin: 16px 16px;
}

.route-pos-runner-svg .runner-leg-front {
    animation: runnerLegFront 0.6s ease-in-out infinite;
    transform-box: view-box;
    transform-origin: 15px 17px;
}

.route-pos-runner-svg .runner-leg-back {
    animation: runnerLegBack 0.6s ease-in-out infinite;
    transform-box: view-box;
    transform-origin: 15px 17px;
}

.route-pos-runner-svg .runner-arm-front {
    animation: runnerArmFront 0.6s ease-in-out infinite;
    transform-box: view-box;
    transform-origin: 17.4px 11.8px;
}

.route-pos-runner-svg .runner-arm-back {
    animation: runnerArmBack 0.6s ease-in-out infinite;
    transform-box: view-box;
    transform-origin: 17.4px 11.8px;
}

@keyframes runnerBounce {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-1.7px); }
}

@keyframes runnerLegFront {
    0%, 100% { transform: rotate(-28deg); }
    50% { transform: rotate(32deg); }
}

@keyframes runnerLegBack {
    0%, 100% { transform: rotate(30deg); }
    50% { transform: rotate(-30deg); }
}

@keyframes runnerArmFront {
    0%, 100% { transform: rotate(28deg); }
    50% { transform: rotate(-28deg); }
}

@keyframes runnerArmBack {
    0%, 100% { transform: rotate(-28deg); }
    50% { transform: rotate(28deg); }
}

@media (prefers-reduced-motion: reduce) {
    .route-pos-runner-svg .runner-torso,
    .route-pos-runner-svg .runner-leg-front,
    .route-pos-runner-svg .runner-leg-back,
    .route-pos-runner-svg .runner-arm-front,
    .route-pos-runner-svg .runner-arm-back {
        animation: none;
    }
}

.route-pos-symbol-lock-row {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: flex-start;
    gap: 7px;
    font-size: 12px;
    line-height: 1.3;
    color: #334155;
    cursor: pointer;
    user-select: none;
}

.route-pos-symbol-lock-row input[type="checkbox"] {
    margin: 2px 0 0 0;
    cursor: pointer;
    accent-color: #2563eb;
    flex-shrink: 0;
}

.route-pos-symbol-lock-hint {
    display: block;
    font-size: 10.5px;
    color: #64748b;
    margin-top: 2px;
}

.carousel-container {
    overflow: clip !important;
    overflow-x: clip !important;
    overflow-y: clip !important;
}

.carousel-wrapper {
    width: 100% !important;
    align-items: flex-start !important;
}

.carousel-slide {
    width: 100% !important;
    flex: 0 0 100% !important;
}

.carousel-slide.slide-collapsed {
    height: 0 !important;
    overflow: hidden !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    pointer-events: none !important;
}

#active-mode-banner {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #f8fafc;
    padding: 6px 10px;
    border-radius: 999px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.18);
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    max-width: calc(100vw - 120px);
    white-space: nowrap;
    pointer-events: auto;
    transition: all 0.2s ease;
}

#active-mode-banner-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

#active-mode-banner .mode-banner-btn {
    border: none;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.1s ease, background 0.15s ease;
    flex-shrink: 0;
}

#active-mode-banner .mode-banner-btn:hover {
    opacity: 0.92;
}

#active-mode-banner .mode-banner-toggle {
    background: rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    border: none;
    border-radius: 999px;
    width: 24px;
    height: 24px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
}

#active-mode-banner .mode-banner-toggle:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

#active-mode-banner.is-minimized {
    padding: 5px 9px;
    gap: 5px;
}

#active-mode-banner.is-minimized #active-mode-banner-text,
#active-mode-banner.is-minimized #active-mode-banner-secondary,
#active-mode-banner.is-minimized #active-mode-banner-exit {
    display: none !important;
}

#active-mode-banner-mini-label {
    display: none;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    padding: 0 2px;
}

#active-mode-banner.is-minimized #active-mode-banner-mini-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

@media (max-width: 768px) {
    #active-mode-banner {
        top: max(10px, env(safe-area-inset-top, 0px));
        bottom: auto;
        left: 62px;
        right: 54px;
        transform: none;
        font-size: 11.5px;
        padding: 5px 8px;
        gap: 6px;
        max-width: none;
        justify-content: space-between;
    }

    #active-mode-banner.is-minimized {
        right: auto;
        width: auto;
    }

    #active-mode-banner .mode-banner-btn {
        padding: 5px 9px;
        min-height: 28px;
        font-size: 11px;
    }
}

/* Interactive Guided Route Planning Assistant */
#route-assistant-panel {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1055;
    display: none;
    flex-direction: column;
    width: min(440px, calc(100vw - 120px));
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #f8fafc;
    border-radius: 14px;
    border: 1px solid rgba(56, 189, 248, 0.35);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.42);
    pointer-events: auto;
    overflow: hidden;
    font-size: 12px;
}

#route-assistant-panel.is-minimized {
    width: auto;
    max-width: calc(100vw - 120px);
    border-radius: 999px;
}

#route-assistant-panel .ra-mini-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px 5px 12px;
}

#route-assistant-panel .ra-mini-expand {
    background: transparent;
    border: none;
    color: #f8fafc;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

#route-assistant-panel .ra-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px 7px 12px;
    background: rgba(30, 41, 59, 0.72);
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

#route-assistant-panel .ra-brand {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #f8fafc;
}

#route-assistant-panel .ra-badge {
    background: rgba(56, 189, 248, 0.18);
    color: #7dd3fc;
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 10.5px;
    font-weight: 700;
}

#route-assistant-panel .ra-header-controls {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

#route-assistant-panel .ra-icon-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    border: none;
    border-radius: 999px;
    width: 24px;
    height: 24px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
}

#route-assistant-panel .ra-icon-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

#route-assistant-panel .ra-steps {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: rgba(15, 23, 42, 0.55);
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    overflow-x: auto;
}

#route-assistant-panel .ra-step-dot {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 3px 5px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(30, 41, 59, 0.6);
    color: #94a3b8;
    font-size: 10.5px;
    font-weight: 600;
    cursor: default;
    white-space: nowrap;
}

#route-assistant-panel .ra-step-dot.is-clickable {
    cursor: pointer;
}

#route-assistant-panel .ra-step-dot.is-done {
    background: rgba(16, 185, 129, 0.18);
    border-color: rgba(16, 185, 129, 0.45);
    color: #6ee7b7;
}

#route-assistant-panel .ra-step-dot.is-current {
    background: rgba(59, 130, 246, 0.28);
    border-color: rgba(96, 165, 250, 0.75);
    color: #ffffff;
    font-weight: 700;
}

#route-assistant-panel .ra-body {
    padding: 10px 12px 9px 12px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

#route-assistant-panel .ra-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.25;
}

#route-assistant-panel .ra-desc {
    font-size: 12px;
    color: #e2e8f0;
    line-height: 1.42;
}

#route-assistant-panel .ra-hint {
    font-size: 11px;
    color: #93c5fd;
    background: rgba(30, 58, 138, 0.28);
    border: 1px solid rgba(96, 165, 250, 0.24);
    border-radius: 8px;
    padding: 5px 8px;
    line-height: 1.35;
}

#route-assistant-panel .ra-flash {
    font-size: 11.5px;
    font-weight: 600;
    color: #a7f3d0;
    background: rgba(6, 95, 70, 0.38);
    border: 1px solid rgba(16, 185, 129, 0.45);
    border-radius: 8px;
    padding: 5px 8px;
}

#route-assistant-panel .ra-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

#route-assistant-panel .ra-actions-split {
    justify-content: space-between;
    align-items: center;
}

#route-assistant-panel .ra-btn {
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s ease, background 0.15s ease, opacity 0.15s ease;
    white-space: nowrap;
}

#route-assistant-panel .ra-btn:hover {
    opacity: 0.94;
    transform: translateY(-0.5px);
}

#route-assistant-panel .ra-btn-xs {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 999px;
}

#route-assistant-panel .ra-btn-primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #ffffff;
}

#route-assistant-panel .ra-btn-emerald {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
}

#route-assistant-panel .ra-btn-secondary {
    background: rgba(30, 41, 59, 0.92);
    border-color: rgba(148, 163, 184, 0.35);
    color: #e2e8f0;
}

#route-assistant-panel .ra-btn-ghost {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
}

#route-assistant-panel .ra-btn-danger {
    background: #ef4444;
    color: #ffffff;
}

#route-assistant-panel .ra-prof-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

#route-assistant-panel .ra-prof-chip {
    border: 1px solid rgba(148, 163, 184, 0.32);
    background: rgba(30, 41, 59, 0.85);
    color: #e2e8f0;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

#route-assistant-panel .ra-prof-chip.is-active {
    background: #2563eb;
    border-color: #60a5fa;
    color: #ffffff;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

#route-assistant-panel .ra-compare-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 2px;
}

#route-assistant-panel .ra-compare-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    text-align: left;
    padding: 5px 9px;
    border-radius: 8px;
    background: rgba(30, 41, 59, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.24);
    color: #e2e8f0;
    font-size: 11.5px;
    cursor: pointer;
}

#route-assistant-panel .ra-compare-pill.is-active {
    background: rgba(37, 99, 235, 0.26);
    border-color: rgba(96, 165, 250, 0.75);
    color: #ffffff;
}

#route-assistant-panel .ra-compare-name {
    font-weight: 700;
    white-space: nowrap;
}

#route-assistant-panel .ra-compare-vals {
    color: #bae6fd;
    font-weight: 600;
    white-space: nowrap;
}

#route-assistant-panel .ra-compare-empty {
    font-size: 11px;
    color: #cbd5e1;
    background: rgba(30, 41, 59, 0.55);
    border: 1px dashed rgba(148, 163, 184, 0.35);
    border-radius: 8px;
    padding: 6px 8px;
    line-height: 1.35;
}

#route-assistant-panel .ra-footer {
    padding: 6px 12px 7px 12px;
    background: rgba(15, 23, 42, 0.7);
    border-top: 1px solid rgba(148, 163, 184, 0.14);
}

#route-assistant-panel .ra-auto-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #94a3b8;
    cursor: pointer;
    user-select: none;
}

#route-assistant-panel .ra-auto-label input {
    accent-color: #38bdf8;
    cursor: pointer;
    margin: 0;
}

#btn-route-assistant-help {
    width: 34px;
    flex-shrink: 0;
    margin-top: 0;
    margin-bottom: 6px;
    padding: 0;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    font-weight: 800;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#btn-route-assistant-help.is-active {
    background: #1d4ed8;
    color: #ffffff;
    border-color: #1d4ed8;
}

@keyframes routeAssistantPulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.78); }
    70% { box-shadow: 0 0 0 14px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.route-point-marker.route-assistant-pulse > div {
    animation: routeAssistantPulse 1.5s infinite;
}

#route-profile-quickselect.route-assistant-highlight-box {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.55);
    border-radius: 8px;
    padding: 2px;
}

@media (max-width: 768px) {
    #route-assistant-panel {
        top: max(10px, env(safe-area-inset-top, 0px));
        left: 56px;
        right: 10px;
        transform: none;
        width: auto;
        max-width: none;
        font-size: 11.5px;
    }

    #route-assistant-panel .ra-step-lbl {
        display: none;
    }

    #route-assistant-panel .ra-mini-expand {
        max-width: 190px;
    }
}

/* Measurement Tool Styles */
#measure-result-panel {
    position: absolute;
    top: 20px;
    right: 80px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 10px 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    align-items: center;
    gap: 12px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    pointer-events: auto;
}

#measure-result-panel .measure-val {
    font-weight: 700;
    color: #7c3aed;
    /* Violet */
}

#measure-result-panel .btn-clear-measure {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #94a3b8;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#measure-result-panel .btn-clear-measure:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.measure-marker {
    width: 15px;
    height: 15px;
    background: rgba(139, 92, 246, 0.22);
    border: 2px solid rgba(124, 58, 237, 0.88);
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.65), 0 2px 6px rgba(139, 92, 246, 0.35);
    transition: transform 0.1s ease, background 0.15s ease;
}

.measure-marker:hover {
    transform: scale(1.25);
    background: rgba(124, 58, 237, 0.36);
}

.measure-marker.first-point {
    width: 17px;
    height: 17px;
    background: rgba(16, 185, 129, 0.24);
    border-color: rgba(5, 150, 105, 0.90);
    box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.65), 0 2px 6px rgba(16, 185, 129, 0.35);
    cursor: pointer;
}

.measure-marker.first-point:hover {
    background: rgba(5, 150, 105, 0.38);
    transform: scale(1.3);
}

#g7-bluezone-panel {
    display: none;
    position: absolute;
    top: 15px;
    left: 95px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    padding: 8px 14px;
    flex-direction: column;
    gap: 6px;
    font-family: 'Inter', sans-serif;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), top 0.3s ease, border-radius 0.2s ease, padding 0.2s ease;
}

#g7-bluezone-panel.collapsed {
    border-radius: 18px;
    padding: 6px 12px;
}

#solar-layers-panel {
    display: none;
    position: absolute;
    top: 15px;
    left: 95px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    padding: 8px 14px;
    flex-direction: column;
    gap: 6px;
    font-family: 'Inter', sans-serif;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), top 0.3s ease, border-radius 0.2s ease, padding 0.2s ease;
}

#solar-layers-panel.collapsed {
    border-radius: 18px;
    padding: 6px 12px;
}

#eu-layers-panel {
    display: none;
    position: absolute;
    top: 15px;
    left: 95px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    padding: 8px 14px;
    flex-direction: column;
    gap: 6px;
    font-family: 'Inter', sans-serif;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), top 0.3s ease, border-radius 0.2s ease, padding 0.2s ease;
}

#eu-layers-panel.collapsed {
    border-radius: 18px;
    padding: 6px 12px;
}

/* Responsive styles for G7 panels on mobile */
@media (max-width: 768px) {
    #g7-header-panel {
        top: 8px !important;
        padding: 6px 12px !important;
        gap: 10px !important;
    }

    #g7-logo-container {
        width: 32px !important;
        height: 32px !important;
    }

    #g7-logo-container svg {
        width: 28px !important;
        height: 28px !important;
    }

    #g7-header-title {
        font-size: 13px !important;
    }

    #g7-header-subtitle {
        font-size: 9px !important;
    }

    #g7-bluezone-panel {
        top: 75px !important;
        left: 15px !important;
        transform: none !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
        padding: 8px 12px !important;
        width: auto !important;
        max-width: 250px !important;
    }

    #g7-bluezone-panel.collapsed {
        padding: 6px 12px !important;
    }

    #solar-layers-panel {
        top: 75px !important;
        left: 15px !important;
        transform: none !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
        padding: 8px 12px !important;
        width: auto !important;
        max-width: 250px !important;
    }

    #solar-layers-panel.collapsed {
        padding: 6px 12px !important;
    }

    #eu-layers-panel {
        top: 75px !important;
        left: 15px !important;
        transform: none !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
        padding: 8px 12px !important;
        width: auto !important;
        max-width: 250px !important;
    }

    #eu-layers-panel.collapsed {
        padding: 6px 12px !important;
    }
}

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