/* === DARK THEME REDESIGN === */

/* === Color Variables === */
:root {
    --bg-primary: #0f0f23;
    --bg-secondary: #0087a266;
    --bg-tertiary: #16213e;
    --bg-card: rgba(26, 32, 46, 1);
    --bg-card-hover: rgba(36, 42, 56, 0.95);
    
    --accent-primary: #443648;
    --accent-secondary: #7c3aed;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-opposite: #32323f;
    --text-black: #000000;
    
    --border-color: rgba(93, 233, 248, 0.382);
    --border-hover: #00d5ff66;
    
    --highlight-color: #decb33;

    --stars-community-color: #b89e10;
    --stars-own-color: var(--border-hover);
    --stars-own-outline-color: rgba(1, 49, 59, 0);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.3);

    --climbed-bg-start: rgba(0, 212, 255, 0.15);
    --climbed-bg-end: rgba(124, 58, 237, 0.15);

    --bottombar-bg-start: rgba(0, 0, 0, 0.5);
    --bottombar-bg-end: rgba(0, 0, 0, 0.9);
    --bottombar-shadow: 0 -4px 20px rgba(0, 0, 0, 0.8);
}

/* === Light Theme === */
[data-theme="light"] {
    --bg-primary: #eef2f7;
    --bg-secondary: rgb(223, 224, 232);
    --bg-tertiary: rgb(234, 234, 237);
    --bg-card: rgba(179, 173, 179, 0.63);
    --bg-card-hover: rgba(255, 240, 255, 0.98);

    --accent-primary: #bcb7b7;
    --accent-secondary: #b28cf4;
    --accent-success: #059669;
    --accent-warning: #d97706;
    --accent-danger: #dc2626;

    --text-primary: #12151a;
    --text-secondary: #170517;
    --text-tertiary: #3b2a44;
    --text-opposite: #f0e9f5;
    --text-black: #000000;

    --border-color: rgba(36, 54, 71, 0.692);
    --border-hover: rgba(1, 49, 59, 0.5);

    --highlight-color: #0e1d92;

    --stars-community-color: #af9500;
    --stars-own-color: var(--highlight-color);
    --stars-own-outline-color: rgba(1, 49, 59, 0);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
    --shadow-glow: 0 0 20px rgba(0, 135, 162, 0.2);

    --climbed-bg-start: rgba(0, 135, 162, 0.08);
    --climbed-bg-end: rgba(124, 58, 237, 0.08);

    --bottombar-bg-start: rgba(230, 238, 248, 0.85);
    --bottombar-bg-end: rgba(215, 228, 242, 0.97);
    --bottombar-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}



/* === 1. Ortungs-Button === */
.locate-btn {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--bg-primary) 100%, var(--bg-secondary) 10%);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    backdrop-filter: blur(10px);
}

.locate-btn:hover {
    background: linear-gradient(135deg, var(--bg-primary) 90%, var(--bg-tertiary) 10%);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.locate-btn:active {
    transform: translateY(0) scale(0.95);
}

.locate-btn.locating {
    animation: pulse 1s infinite;
}

.locate-btn.located {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.2) 100%);
    border-color: var(--accent-success);
}

.locate-btn.located svg circle,
.locate-btn.located svg path {
    fill: var(--accent-success);
    stroke: var(--accent-success);
}

.locate-btn.tracking-active {
    background: linear-gradient(135deg, rgba(239, 71, 87, 0.3) 0%, rgba(220, 38, 38, 0.3) 100%);
    border-color: #ff4757;
    animation: pulse-tracking 2s infinite;
}

.locate-btn.tracking-active svg circle,
.locate-btn.tracking-active svg path {
    fill: #ff4757;
    stroke: #1d0b0c;
}

@keyframes pulse-tracking {
    0%, 100% { 
        opacity: 1; 
        box-shadow: 0 0 0 0 rgba(239, 71, 87, 0.7);
    }
    50% { 
        opacity: 0.9; 
        box-shadow: 0 0 0 10px rgba(239, 71, 87, 0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: var(--shadow-md); }
    50% { opacity: 0.7; box-shadow: var(--shadow-glow); }
}

/* === 2. Grading & Modal Buttons === */
.grading-btn {
    display: block; 
    opacity: 0.9;
    min-width: 30px; 
    padding: 4px 6px; 
    height: 30px; 
    border-radius: 8px;
    border: 1px solid var(--border-color);
    color: var(--text-opposite);
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    z-index: 10;
}

.grading-btn[data-bgcolor] {
    background: var(--bg-tertiary) !important;
    color: #222 !important;
}

.grading-btn:hover {
    opacity: 1;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.grading-btn:not(.is-interactive) {
    cursor: default;
}

.grading-btn:not(.is-interactive):hover {
    opacity: 0.9;
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
    transform: none;
}

.grading-btn:active {
    transform: translateY(0);
}

.closeModal {
    position: fixed;
    top: 15px;
    right: 15px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}
.closeModal:hover {
    transform: translateY(-2px);
}

/* === 3. Title Elements === */
#addRouteTitle.area-name {
    width: 80%;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15) 0%, rgba(124, 58, 237, 0.15) 100%);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    padding: 10px 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    color: var(--text-primary);
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 10px;
    backdrop-filter: blur(8px);
}

#addRouteTitle.area-name:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.25) 0%, rgba(124, 58, 237, 0.25) 100%);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.routeNameTitle.area-name {
    width: 80%;
    font-size: 14px;
    font-weight: 500;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 6px 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    margin-bottom: 4px;
    backdrop-filter: blur(8px);
}

.routeNameTitle.area-name:hover {
    transform: translateY(-1px);
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}


/* === 4. Globales Reset & Grundlayout === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
    overflow: hidden;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    background: var(--bg-primary);
    color: var(--text-primary);
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
    overscroll-behavior: none !important;
    position: fixed;
    width: 100%;
}

#main-container {
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    position: relative;
    touch-action: pan-x pan-y !important;
    z-index: 1 !important;
    overflow: hidden;
}

#map-container {
    height: 100%;
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    position: relative;
    z-index: 2 !important;
}

#map {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2 !important;
    filter: brightness(0.85) contrast(1.1);
    user-select: none;
    -webkit-user-select: none;
}

/* Maptab-Wrapper (topoMaptab/sessionMaptab/historyMaptab) — je ein eigenständiger, unabhängiger
   Träger für Höhe/Position/Transform, Kinder von #map-container (rutscht mit dessen Transform beim
   Menü-Übergang synchron mit). Gleiche Rolle wie früher #content-container, jetzt dreifach. */
.maptab-wrapper {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 0%;
    display: flex;
    flex-direction: column;
    /* transform bewusst NICHT hier: wird paarweise per JS in transitionForms gesetzt/zurückgesetzt
       (exakt wie bei #map-container/_tc beim Menü-Übergang) — sonst würde jede Höhenänderung
       versehentlich auch die Horizontal-Position mit-animieren. */
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3 !important;
    /* Der Wrapper selbst nimmt sonst auch im Peek-Bereich (oberhalb des Panels, wo nur der
       pointer-events:none-Spacer sitzt) Klicks entgegen und blockiert damit die Karte darunter.
       Das Panel selbst (.content-container) reaktiviert pointer-events wieder. */
    pointer-events: none;
}

/* Ruheposition beim ersten Laden: nur topoMaptab sichtbar (Default-Tab 'topo', jetzt erster Eintrag
   in tabOrder). session/map/history stehen alle rechts von Topo in der Bottom-Bar bereit, stehen
   daher auch alle ausserhalb rechts bereit. transitionForms setzt/verschiebt ab dann alles explizit
   per JS. visibility:hidden zusätzlich zur Position: alle drei starten mit identischem Transform-
   Betrag — bei einem Full-Mode-Übergang (map-container bekommt selbst ein Transform) kann sich das
   sonst mit dessen Wert zu 0 aufheben, bevor überhaupt je zu diesem Maptab gewechselt wurde. */
#mapMaptab, #sessionMaptab, #historyMaptab { transform: translateX(100%); visibility: hidden; }

/* Individuelle Content-Container (Kinder des Wrappers) — hier sitzt der Floating-Karten-Look (Default).
   top:0/bottom:calc(...) statt height:100%, damit die Höhe korrekt aus dem Abstand berechnet wird
   (height:100% eines fixed-Vorfahren ignoriert den bottom-Versatz und würde oben überstehen). */
.content-container {
    top: 0;
    bottom: calc(var(--sticky-cat-title-bottom, 0px) + 10px);
    height: auto;
    width: auto;
    left: 10px;
    right: 10px;
    transform: translateX(0);
    touch-action: auto !important;
    pointer-events: auto;
    background: var(--bg-primary);
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.5);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    position: absolute;
    flex-shrink: 0;
    display: none;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Panel-Style "flush": MaptabPanel randlos, kein Karten-Abstand mehr zur Kante.
   (Alter Look mit eigenen top/bottom/background/border-Overrides entfernt —
   Panel-Style steuert jetzt nur noch Margin + Höhe + Bottom-Bar-Spacer, siehe unten.) */
html[data-panel-style="flush"] #topoMaptabPanel,
html[data-panel-style="flush"] #sessionMaptabPanel,
html[data-panel-style="flush"] #historyMaptabPanel {
    margin-left: 0;
    margin-right: 0;
    height: 100%;
}

/* Drag-Indikator für Content-Container */
.content-container::before {
    content: '';
    position: sticky;
    top: 5px;
    display: block;
    width: 20%;
    height: 4px;
    background: rgba(148, 163, 184, 0.5);
    border-radius: 2px;
    z-index: 10;
    pointer-events: none;
    margin: 5px auto 0;
}

.content-container.active {
    display: flex;
}

#mapcontent-container {
    /* Inherits all styles from .content-container */
    overflow-y: auto;
    overflow-x: hidden;
}

.content {
    width: 100%;
    padding: 15px;
    font-size: 15px;
    line-height: 1.6;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
}

.contentForm {
    width: 100%;
    margin: 15px 0 0;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-tertiary) 100%);
    backdrop-filter: blur(16px);
    padding: 10px 5px;
    border: none;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    overflow-y: visible;
    overflow-x: clip;
    position: absolute;
    transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
    will-change: transform;
    -webkit-overflow-scrolling: touch;
}

/* ── Per-Form-Scroll-Architektur ──────────────────────────────────────────
   Die drei Maptab-Panels scrollen selbst nicht mehr — jede Form hat einen
   eigenen .form-scroll-body als Scroll-Container. (overflow:hidden kommt
   bereits von der .content-container-Klasse, die alle drei Panels tragen.) */

/* Jede Form füllt den Panel vollständig aus (Basis für height:100% im Scroll-Body) */
.contentForm:not(.full-form) {
    height: 100%;
    margin: 0;
}

/* Der eigentliche Scroll-Container innerhalb jeder Form */
.form-scroll-body {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* position:sticky im form-scroll-body braucht keine overflow-visible-Kette mehr —
   der Scroll-Kontext liegt jetzt im .form-scroll-body selbst. */
#topoMaptabPanel > .content,
#sessionMaptabPanel > .content,
#historyMaptabPanel > .content {
    overflow-y: visible;
    overflow-x: clip;
}

#areaForm,
#sectorForm,
#multipitchForm,
#routeForm {
    overflow-x: clip;
    border-top: none;
    border-radius: 0 0 10px 10px;
    margin: 0;
}

#routeForm {
    padding: 5px 0;
}

/* Alle contentForms transparent – Optik liegt auf *FormBody */
#areaForm,
#sectorForm,
#multipitchForm,
#routeForm,
#parkingForm,
#newForm,
#areasList,
#sessionForm,
#historyForm {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
}

.contentForm.full-form {
    position: fixed;
    top: 0;
    left: 50%;
    width: 100%;
    height: 100dvh;
    z-index: 5;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: var(--bg-primary);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
}

#sessionForm,
#historyForm {
    margin: 0;
}

/* .sticky-filter-container: gemeinsame Basis für #historyFilterContainer (im .form-sticky-header)
   sowie #areaFormFilterContainer/#sectorFormFilterContainer (in der jeweiligen Routes-Tab-Pane,
   siehe die spezifischen Regeln weiter unten für deren position:sticky-Sonderfall). */
.sticky-filter-container {
    margin: 25px -1px 0px -1px;
}

/* #historyFilterContainer: transparenter Hintergrund (bewusst, kein Sonderfall wie bei
   area/sectorFormFilterContainer, die solide sein müssen um darunter scrollende Routen
   abzudecken — historyFilterContainer braucht das nicht). */
#historyFilterContainer {
    margin-top: 0;
    background: transparent;
}

/* areaFormFilterContainer/sectorFormFilterContainer/areaFormAllRoutesFilterContainer leben nicht
   mehr im .form-sticky-header, sondern innerhalb der jeweiligen Routes-Tab-Pane (areaFormTab3/
   sectorFormTab2/areaFormTab4, siehe index.php) — dadurch gleiten sie beim Tab-Wechsel mit dem Pane
   mit, bleiben aber per position:sticky oben in dessen eigenem Scroll-Body (.form-scroll-body)
   fixiert, während die Routenliste darunter scrollt. Brauchen einen soliden Hintergrund, da darunter
   scrollende Routen sonst durchscheinen würden — background/backdrop-filter direkt hier auf dem
   position:sticky-Element, analog zu .form-sticky-header (dort funktioniert diese Kombination in
   Firefox nachweislich; ein früherer Workaround, der das auf ein Kind-Element auslagerte, war
   unnötig und hat den Blur komplett verhindert). */
#areaFormFilterContainer,
#sectorFormFilterContainer,
#areaFormAllRoutesFilterContainer {
    margin: 0;
    position: sticky;
    top: 0;
    z-index: 5;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* #sectorFormRouteBarFooter (render.js _buildSectorRouteBarFooter): sticky Footer im Routes-Tab
   des Sektor-Formulars, analog zu #sectorFormFilterContainer oben, aber unten fixiert statt oben
   — gleicher solider Hintergrund nötig, da die Routenliste dahinter durchscrollt. Kein eigener
   background hier (siehe Kommentar oben bei #areaFormFilterContainer/#sectorFormFilterContainer),
   deckend kommt vom ererbten var(--bg-primary) aus #sectorFormBody. */
.route-bar-footer {
    position: sticky;
    bottom: 0;
    width: 100%;
    height: 37.5px;
    display: flex;
    align-items: flex-end;
    z-index: 5;
    /* Clippt den riesigen Box-Shadow-Spread von .route-bar-footer-shadow (Spotlight-Trick) auf
       die Footer-Grenzen, sonst würde der Schatten optisch über den Footer hinausbluten. */
    overflow: hidden;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* #sectorFormRouteBarFooter bleedet 5px über den Rand des Sektor-Formulars auf beiden Seiten
   hinaus (breiter als der umgebende Content), statt bündig mit dessen Padding abzuschliessen. */
#sectorFormRouteBarFooter {
    margin-left: -5px;
    margin-right: -5px;
    width: calc(100% + 10px);
}

.route-bar-footer-bar {
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

/* Obere Hälfte: Grad-Farbe (wie bisher). Untere Hälfte: Farbe des besten geloggten
   Climbed-Status (render.js _buildSectorRouteBarFooter). */
.route-bar-footer-bar-grade {
    width: 100%;
    height: 50%;
    border-radius: 2px 2px 0 0;
}

.route-bar-footer-bar-climbed {
    width: 100%;
    height: 50%;
}

/* Viewport-Schatten (render.js _buildSectorRouteBarFooter/_updateRouteBarFooterShadow/
   _wireRouteBarFooterShadowDrag): liegt über den Balken der Routen, die gerade in der
   Routenliste sichtbar sind. .route-bar-footer (position:sticky oben) ist bereits ein gültiger
   Containing Block für position:absolute-Kinder, kein zusätzliches position:relative nötig. Per
   Touch/Pointer horizontal verschiebbar — scrollt die Routenliste proportional mit. */
.route-bar-footer-shadow {
    position: absolute;
    top: 0;
    bottom: 0;
    background: transparent;
    /* Spotlight-Trick: die Zone selbst bleibt hell/transparent (zeigt die Balken darunter in
       voller Farbe), der riesige Spread dieses box-shadow deckt stattdessen alles AUSSERHALB der
       Zone dunkel ab (geclippt von .route-bar-footer's overflow:hidden). */
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
    border-left: 1px solid rgba(255, 255, 255, 0.5);
    border-right: 1px solid rgba(255, 255, 255, 0.5);
    touch-action: none;
    cursor: grab;
    z-index: 2;
    display: none;
}

/* Verhindert Scroll-Anchoring: Browser würden sonst scrollTop automatisch "korrigieren", wenn
   sich die Höhe von #area/sectorFormFilterContainer ändert (Klick zum Auf-/Einklappen,
   render.js _wireFilterScrollCollapse) — dieser Auto-Scroll wird sonst fälschlich als echter
   User-Scroll interpretiert und killt/kollidiert mit der laufenden Höhenänderung (sichtbares
   kurzes Zittern statt sauberem Auf-/Zuklappen). */
#areaFormTab3,
#areaFormTab4,
#sectorFormTab2 {
    overflow-anchor: none;
}


#sessionFormStickyHeader {
    width: 100%;
}

#historyContent {
    margin: 5px !important;
}

/* routeFormBody darf über den routeForm-Container hinausragen */
#routeForm {
    overflow-x: visible !important;
}

#routeFormBody {
    margin-top: 0;
}


#parkingFormBody,
#newFormBody,
#historyFormBody {
    top: 0;
    bottom: 0;
    height: auto;
    margin: 0;
    border: none;
    border-radius: 0;
    background: var(--bg-primary);
    box-shadow: none;
    padding: 0;
}

/* #areaFormBody / #sectorFormBody / #areasListBody / #routeFormBody / #multipitchFormBody /
   #sessionFormBody: Formulare mit eigenem Tab-Viewport (siehe #areaFormViewport/
   #sectorFormViewport/#areasListViewport/#routeFormViewport/#multipitchFormViewport/
   #sessionFormViewport) statt einem einzelnen .form-scroll-body — flex column, damit der
   .form-sticky-header seine natürliche Höhe behält und der Viewport darunter den Rest ausfüllt. */
#areaFormBody,
#sectorFormBody,
#areasListBody,
#routeFormBody,
#multipitchFormBody,
#sessionFormBody {
    top: 0;
    bottom: 0;
    height: 100%;
    margin: 0;
    border: none;
    border-radius: 0;
    background: var(--bg-primary);
    box-shadow: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* #areaFormViewport / #sectorFormViewport / #areasListViewport / #routeFormViewport /
   #multipitchFormViewport / #sessionFormViewport: sichtbarer Ausschnitt unterhalb des
   Headers (Geschwister von .form-sticky-header, flex column) — schneidet die Tab-Panes ab, die
   position:absolute übereinander liegen. flex:1 statt height:100%, da sich Viewport und Header den
   Platz teilen; min-height:0 nötig, damit overflow im Flex-Item greift. */
#areaFormViewport,
#sectorFormViewport,
#areasListViewport,
#routeFormViewport,
#multipitchFormViewport,
#sessionFormViewport {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

/* .tab-pane: jeder Tab (z.B. areasListTab1/2 = Areas/Recent Routes, areaFormTab1-3 =
   Info/Sectors/Routes) füllt seinen Viewport vollständig aus und wird per transitionTabs()
   (map.js, analog zu transitionForms) einzeln ein-/ausgeschoben — dadurch rauschen bei mehr als
   2 Tabs keine dazwischenliegenden Panes durch, das Ziel wird immer direkt hereingeschoben. Jeder
   Pane bleibt eigener .form-scroll-body-Kontext, Scroll-Position bleibt pro Tab unabhängig erhalten. */
.tab-pane {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    will-change: transform;
}

/* Formtabs (areaForm: Info/Sectors/Routes; sectorForm: Info/Routes) — nicht areasListTab1/2
   (Areas/Recent Routes), die sind kein "Formtab" im engeren Sinn.
   Pane 20px je Seite breiter (left/right:-20px statt 0, width:auto statt 100%), vollständig durch
   padding-left/right:20px ausgeglichen — Inhalt bleibt exakt an ursprünglicher Position, nur die
   Box selbst ist größer (Overlap-Reserve fürs Ziehen, siehe touch.js TAB_DRAG_GAP). Kein outline
   mehr (siehe vorherige Versuche) — kein extra Viewport-Padding nötig. */
#areaFormTab1,
#areaFormTab2,
#areaFormTab3,
#areaFormTab4,
#sectorFormTab1,
#sectorFormTab2,
#routeFormTab1,
#routeFormTab2,
#multipitchFormTab1,
#multipitchFormTab2,
#sessionFormTab0,
#sessionFormTab1,
#sessionFormTab2,
#sessionFormTab3,
#sessionFormTab4,
#sessionFormTab5 {
    left: -15px;
    right: -15px;
    width: auto;
    box-sizing: border-box;
    padding-left: 20px;
    padding-right: 20px;
    background: color-mix(in srgb, var(--bg-tertiary) 50%, transparent);
}

#MenuForm {
    top: 0;
    bottom: 0;
    height: auto;
    margin: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

#MenuBody {
    width: 100%;
}

#MenuBody .content {
    padding: 16px;
    display: flex;
    justify-content: center;
}

#profileFormBody,
#statsFormBody,
#themeFormBody,
#settingsFormBody,
#partnersFormBody,
#partnerDetailFormBody,
#partnerOffersFormBody {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-tertiary) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 0;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0 0 10px 10px;
    box-shadow: var(--shadow-lg);
    overflow-x: clip;
}

/* Partners-Fenster (partners.js): nicht das Form selbst scrollen lassen, sondern den Body darin.
   btn_panelclose wird in die aktive MenuForm-Familie-Form eingehängt (main.js updateScrollBtn) und
   ist wegen deren transform nur relativ zur Form "fixed" — scrollt die Form selbst
   (.contentForm.full-form overflow-y:auto), scrollt der Button mit. Unten Platz für den Button. */
#partnersForm,
#partnerDetailForm,
#partnerOffersForm {
    overflow-y: hidden;
}
#partnersFormBody,
#partnerDetailFormBody,
#partnerOffersFormBody {
    max-height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    padding-bottom: 72px;
}

/* Badge für offene Inbox-Einträge (partners.js updateCommunityBadges) — an .bottom-bar-item
   (position:relative) bzw. .prof-menu-tile. */
.community-badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 22px);
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    box-sizing: border-box;
    border-radius: 9px;
    background: #e53935;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    pointer-events: none;
    z-index: 3;
}
.prof-menu-tile {
    position: relative;
}
.prof-menu-tile > .community-badge {
    top: 8px;
    right: 10px;
}

/* History-Tab: Umschalter "Mine | Friends" + Feed der Freunde (partners.js, Phase 5). Im Friends-Modus
   sind Filterleiste und eigene History ausgeblendet, statt sie umzubauen. */
.history-mode-bar {
    display: flex;
    justify-content: center;
    gap: 0;
    padding: 4px 16px 0;
}
.history-mode-btn {
    flex: 0 1 120px;
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.history-mode-btn:first-child { border-radius: 14px 0 0 14px; }
.history-mode-btn:last-child  { border-radius: 0 14px 14px 0; border-left: none; }
.history-mode-btn.active {
    background: var(--text-primary);
    color: var(--bg-primary);
    border-color: var(--text-primary);
}
#historyFeedContent { display: none; padding: 8px 12px 90px; }
#historyForm.history-mode-friends #historyFilterContainer,
#historyForm.history-mode-friends .historycontent { display: none !important; }
#historyForm.history-mode-friends #historyFeedContent { display: block; }

.form-sticky-header {
    position: sticky;
    top: 0;
    z-index: 5;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    width: 100%;
    padding: 0;
    border-radius: 0;
    /* Verhindert Margin-Collapsing zwischen Kindern (z.B. .maptab-footer-spacer margin-bottom
       mit #routeSelfPreview/#multipitchSelfPreview margin-top, wenn dazwischen nur versteckte
       Elemente wie #multipitchTitle/#routeTitle liegen) — ohne das würden sich angrenzende
       vertikale Margins zum Maximum statt zur Summe verschmelzen, teils nur bei einer der beiden
       Formen sichtbar je nachdem was gerade versteckt ist. */
    display: flow-root;
}

.maptab-footer-spacer {
    display: block;
    height: 48px;
    background: var(--bg-primary);
    flex-shrink: 0;
    pointer-events: none;
}

/* newForm braucht keinen Abstand zum Maptab-Footer wie die anderen Forms. */
#newForm .maptab-footer-spacer {
    height: 0;
}

.form-sticky-header::after {
    content: '';
    position: absolute;
    bottom: -18px;
    left: 0;
    right: 0;
    height: 18px;
    background: linear-gradient(to bottom, var(--bg-card) 0%, transparent 100%);
    pointer-events: none;
}

/* form-sticky-footer lebt jetzt in #TopoTabHeader (Geschwister von .content, siehe index.php) —
   nicht mehr sticky innerhalb der scrollenden FormBody, sondern absolut am oberen Panelrand
   (ehem. unten, siehe index.php-Kommentar), damit areaForm/sectorForm-Breadcrumb unabhängig
   von den einzelnen .contentForm animiert/gedockt werden kann (main.js,
   _dockSectorFooterTrail/_undockSectorFooterTrail). */


.form-sticky-footer {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    z-index: 5;
    padding: 10px 15px;
    transform: translateX(100%);
}

/* areaFooterTrailItem/_h, areaTitleFooter/_h, sectorFooterTrailItem/_h: eine Regel pro
   Eigenschaftsgruppe, gültig für Topo-Tab (#TopoTabHeader) und History-Tab (#HistoryTabHeader,
   _h-Suffix) gleichermaßen — keine separaten _h-Only-Blöcke mehr. Getrennte IDs bleiben nötig,
   da main.js (Topo) und history.js (History, _dockSectorFooterTrail_h etc.) unabhängig
   voneinander per getElementById auf die jeweilige Variante zugreifen. */
#areaFooterTrailItem,
#areaFooterTrailItem_h {
    background: var(--bg-primary);
    transform: translateX(0);
    bottom: 3px;
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 0px;
    padding-right: 50px;
    cursor: pointer;
}

#areaTitleFooter,
#areaTitleFooter_h {
    margin-top: 0;
    width: auto;
    max-width: 250px;
}

#sectorFooterTrailItem,
#sectorFooterTrailItem_h {
    background: var(--bg-primary);
    top: 2px;
    bottom: 0;
    margin-bottom: 7px;
    margin-left: 0px;
    border-bottom: 0px;
    padding: 0;
}

/* Sector-Namen-Band: alle Sektoren der Area als endlos durchziehbares Band (wie die Monats-Chips
   im Sun-Simulator, siehe render.js openSunSimulator/_mTrack) — main.js _renderSectorFooterBand
   klont den Inhalt 3-fach in .sector-band-track, Klick zentriert statt umzusortieren. */
.sector-footer-band {
    overflow: hidden;
    flex: 1;
    min-width: 0;
    /* Reservierter Platz für .sector-band-arrow (siehe dort) — Flex-Inhalt wächst dank Padding gar
       nicht erst in diese Fläche hinein, der Pfeil (position:absolute; right:0) sitzt sichtbar
       darin statt Text zu überlagern oder ausserhalb geclippt zu werden. */
    padding-right: 30px;
    position: relative;
    cursor: grab;
    touch-action: pan-y;
    user-select: none;
}

.sector-band-track {
    display: flex;
    align-items: center;
    width: max-content;
    will-change: transform;
}

.sector-footer-band-item {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    margin-right: 16px;
}

.sector-footer-band-item.active {
    color: var(--highlight-color);
    font-weight: 700;
}

.sector-footer-band.sector-band-static {
    cursor: default;
    touch-action: auto;
}

.sector-band-seam {
    flex-shrink: 0;
    align-self: stretch;
    width: 1px;
    margin-right: 16px;
    background: var(--border-color);
    opacity: 0.6;
}

/* Scroll-Pfeil rechts im Sector-Namen-Band — nur sichtbar, wenn das Band überläuft
   (sector-band-static fehlt dann, siehe main.js/history.js _renderSectorFooterBand[_h]).
   Dreieck per klassischem CSS-Border-Trick, analog zu .filter-collapse-handle::before,
   nur seitlich (border-left statt border-bottom) statt gedreht. Klick/Touch schiebt das
   Band um einen festen Betrag nach links (siehe _nudge in main.js/history.js). Sitzt im
   per padding-right reservierten Streifen von .sector-footer-band (siehe dort) — dahin
   wächst kein Text hinein, und da es innerhalb der Padding-Box liegt, clippt das Band
   (overflow:hidden) den Pfeil auch nicht weg. */
.sector-band-arrow {
    display: none;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 26px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sector-band-arrow::before {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 6px solid var(--text-primary);
}

.sector-footer-band:not(.sector-band-static) .sector-band-arrow {
    display: flex;
}

.form-cap {
    height: 14px;
    margin: 0;
    border-radius: 7px 7px 0 0;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-cap::before {
    content: '';
    display: block;
    width: 20%;
    height: 4px;
    background: rgba(148, 163, 184, 0.5);
    border-radius: 2px;
}

/* sessionForm auf einem Nicht-Start-Tab (Klasse .session-nomap-tab, siehe map.js
   _wireSessionFormTabs _sessionFormTabSideEffects): kein Form-Cap-Drag möglich (render.js
   _isCapDragBlocked) — der Griff-Indikator würde eine Drag-Interaktion suggerieren, die es hier
   nicht gibt. Auf Tab0 ("Start") normal sichtbar wie bei jedem anderen SmallMapPeek-Form. */
#sessionForm.session-nomap-tab .form-cap::before {
    display: none;
}

/* Deckt die margin-top:25px von .sticky-filter-container (siehe #historyFilterContainer,
   index.php) mit bg-primary ab, statt den .form-sticky-header-Hintergrund durchscheinen zu
   lassen — sitzt zwischen .form-cap und dem Filter-Container. */
.filter-container-cap {
    height: 37px;
    background: var(--bg-primary);
}

/* Collapse-Handle für .sticky-filter-container (historyFilterContainer im .form-sticky-header;
   areaFormFilterContainer/sectorFormFilterContainer jeweils in ihrer Routes-Tab-Pane, siehe
   index.php und history.js initHistoryFilters / render.js _renderRouteListInto) — nur unten am
   Filter-Container,
   nicht am Formular oben (daher kein border-top, border-radius nur unten). Klick faltet die
   Filter-Leisten ein, das Handle selbst bleibt sichtbar zum Wiederaufklappen. */
.filter-collapse-handle {
    height: 20px;
    width:100%;
    margin: 0px;
    border-left: 0ch solid var(--border-color);
    border-right: 0px solid var(--border-color);
    border-bottom: 0px solid var(--border-color);
    border-radius: 0 0 10px 10px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Pfeil zeigt uncollapsed (Standard) nach oben — border-bottom statt border-top gefärbt, siehe
   klassischer CSS-Dreieck-Trick. Rotation (statt zwei verschiedener Formen) sorgt für eine
   animierte Drehung beim Auf-/Zuklappen. */
.filter-collapse-handle::before {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid var(--text-primary);
    transition: transform 0.3s ease;
}

/* Collapsed: Pfeil dreht auf "nach unten". */
.sticky-filter-container.collapsed .filter-collapse-handle::before {
    transform: rotate(180deg);
}

.sticky-filter-container.collapsed .filter-collapse-handle {
    height: 30px;
}

/* Collapse-Animation: .filter-collapse-outer (grid, siehe history.js initHistoryFilters /
   render.js _renderRouteListInto) ist der einzige Grid-Track — grid-template-rows 1fr->0fr
   animiert dessen Höhe unabhängig von der tatsächlichen Inhaltshöhe sauber auf 0 (klassischer
   CSS-Grid-Accordion-Trick), .filter-collapse-inner (der eigentliche Filter-Inhalt) clippt per
   overflow:hidden während der Animation. */
.filter-collapse-outer {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.3s ease;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

.filter-collapse-inner {
    overflow: hidden;
    min-height: 0;
}

.sticky-filter-container.collapsed .filter-collapse-outer {
    grid-template-rows: 0fr;
}

/* Panel-Drag-Indikator ausblenden wenn ein contentForm aktiv — form-cap::before übernimmt */
#mapMaptabPanel:has(.contentForm[style*="block"])::before,
#topoMaptabPanel:has(.contentForm[style*="block"])::before,
#sessionMaptabPanel:has(.contentForm[style*="block"])::before,
#historyMaptabPanel:has(.contentForm[style*="block"])::before {
    display: none;
}

/* routeForm: Höhe und Transition werden per JS gesetzt (containerup) */

/* Maptab-Spacer: hält oben 20% für die Map frei, indem er das Panel nach unten schiebt
   (Panel bleibt solide/undurchsichtig, wird nur verschoben statt transparent). Alle drei
   Maptabs verhalten sich hier identisch (SmallMapscroll/SmallMapfixed sind vereinheitlicht) —
   deshalb unconditional, kein data-panel-mode-Gating mehr nötig. */
.maptab-spacer {
    display: block;
    height: 20vh;
    height: 20dvh;
    flex-shrink: 0;
    pointer-events: none;
}

#mapMaptabPanel, #topoMaptabPanel, #sessionMaptabPanel, #historyMaptabPanel {
    top: 20vh;
    top: 20dvh;
    left: 0;
    right: 0;
    width: auto;
    height: auto;
    margin-left: 10px;
    margin-right: 10px;
}

/* sessionMaptabPanel teilt sich die 20vh-CSS-Default-Ruheposition mit map-/topo-/
   historyMaptabPanel (Regel oben) — gilt für sessionForm ganz normal auf Tab0 ("Start", normales
   SmallMapPeek, siehe main.js FORM_MODE). Für die übrigen Tabs (Session/Route/Record/Rate/Beta)
   erzwingt die Tab-Aktivierung selbst top:10px (siehe map.js _wireSessionFormTabs
   _sessionFormTabSideEffects / main.js _isSessionFormNonStartTabActive), unabhängig von
   transitionForms()/containerup(), die sessionForm ansonsten wie jedes andere SmallMapPeek-Form
   behandeln. */

#sectorDropdownRow {
    border: 0;
    border-radius: 10px 10px 0 0;
    background: var(--bg-card);
    margin: 0px;
    padding: 6px 5px;
}

#routesContainerMultipitch {
    padding: 5px;
}

/* Full-panel forms: history & profile tabs fill the whole content area */

.headline1 {
    outline: none;
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 20px;
    margin-left: 10px;
}

.headline2 {
    outline: none;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    margin-top: 20px;
    margin-left: 10px;
}


.content-title-row {
    display: flex;
    align-items: center;
    gap: 0px;
    margin-bottom: 0;
    margin-top: 0;
    padding: 5px 5px 0 5px;
    background-color: var(--bg-primary);
}

/* .form-sticky-footer (areaFooterTrailItem/sectorFooterTrailItem, Topo-/HistoryTabHeader) liegt
   als position:absolute-Overlay über der ganzen Panel-Breite, während die darunterliegende
   .form-scroll-body wegen der sichtbaren Scrollbar (siehe ::-webkit-scrollbar, 8px) schmaler ist —
   ohne zusätzliches Padding würde .content-title-row hier in den Scrollbar-Bereich hineinragen. */
.form-sticky-footer .content-title-row {
    margin-right: 40px;
}

.content-name {
    width: calc(100% - 90px);
    border-radius: 7px;
    padding: 0px 0px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 18px;
    transition: all 0.3s ease;
    margin-top: -5px;
    margin-left: 5px;
}

/* sessionTitle (gemeinsamer Titel für Start-Tab und die übrigen Session-Tabs, ehem. eigenes
   startSessionTitle): anders als areaTitle/sectorTitle nicht im Edit-Mode mit eigenem
   Border/Padding, daher hier ohne Gegenkorrektur zum negativen .content-name margin-top —
   Titel stand dadurch sichtbar höher als der Marker. Analog zu #areaTitleFooter/_h
   auf margin-top: 0 gesetzt, damit er wie in der Area-Breadcrumb vertikal zentriert ist. */
#sessionTitle {
    margin-top: 0;
}

#startSessionContent {
    padding: 20px 5px 0 5px;
}

/* .session-info-box: abgesetzte Karte für zusammengehörige Session-Info-Blöcke — genutzt für
   Datum/Partner/Beschreibung/Add-Route (sessionFormTab1, siehe index.php), dieselbe Optik wie die
   "Session today"/Start-Buttons-Boxen in session.js renderStartSessionContent() (dort noch inline,
   siehe dortige Kommentare). */
.session-info-box {
    background: rgba(93, 128, 164, 0.1);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Alle Buttons im Session-Tab (vor und während einer Session) begrenzt auf 200px und zentriert —
   verhindert zu breite Buttons auf grossen Bildschirmen; margin:auto zentriert sie innerhalb ihres
   flex:1-Slots, statt links anzuschlagen. */
#startSessionContent button,
#startSessionContent .area_sectorlist,
#sessionFormTab1 button,
#sessionFormTab1 .area_sectorlist {
    max-width: 200px;
    margin-left: auto;
    margin-right: auto;
}

/* .form-tab-bar: generische Tab-Leiste für Formulare mit mehreren nebeneinanderliegenden Tabs
   (areasList: Areas/Recent Routes; areaForm: Info/Sectors/Routes) — bewusst NICHT über
   .content-title-row gestylt (eigene flex/gap/padding-Basis), da z.B.
   "#areaForm:not([data-edit-mode=true]) .content-title-row { display:none }" sonst auch die
   Tab-Leiste mit ausblenden würde. */
.form-tab-bar {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 5px 0 0;
    padding-left: 0;
}

.form-tab {
    width: auto;
    flex: 1;
    /* Flex-Items haben per Default min-width:auto (= Inhaltsbreite als Untergrenze) — bei
       nowrap-Text aus .content-name (siehe dort) verhindert das ein Schrumpfen unter die volle
       Textbreite. Bei langen Labels (z.B. "All Routes") und wenigen Tabs (weniger Konkurrenz um
       den fairen Flex-Anteil) sprengt das die Tab-Leiste nach rechts, statt zu ellipsen. */
    min-width: 0;
    text-align: center;
    cursor: pointer;
    opacity: 0.55;
    font-size: 16px;
    padding: 0;
    margin-left: 0px;
    border-bottom-color: var(--accent-primary);
}

.form-tab.active {
    opacity: 1;
    color: var(--text-primary);
    border-radius: 10px 10px 0 0;
    border-left: 2px solid var(--text-primary);
    border-right: 2px solid var(--text-primary);
    border-top: 2px solid var(--text-primary);
}

.form-tab:not(.active) {
    border-bottom: 2px solid var(--accent-primary);
    border-radius: 0px;
}

/* Tab-Icons nur im Session-Formular (sessionForm) — bewusst scoped, damit areaForm/
   sectorForm/multipitchForm/areasList (ebenfalls .form-tab-bar) ohne Icons unverändert bleiben.
   .form-tab ist bereits ein Flex-Item (flex:1) der Bar, wird hier zusätzlich selbst zum Flex-
   Container (Icon über Label). */
#sessionForm .form-tab-bar .form-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

/* Kein Rahmen — anders als areaForm/sectorForm/multipitchForm/areasList (dieselbe
   .form-tab-bar/.form-tab-Basis), die weiterhin einen Rahmen zeigen. Überschreibt die generischen
   .form-tab.active/.form-tab:not(.active)-Rahmenregeln oben per höherer Spezifität. */
#sessionForm .form-tab-bar .form-tab.active,
#sessionForm .form-tab-bar .form-tab:not(.active) {
    border: none;
    border-radius: 0;
}

/* routeForm (0.44, seit dem 3. Tab "Challenge"): Tabs sollen nur ihre tatsächlich benötigte Breite
   einnehmen statt sich gleichmässig über die volle Leistenbreite zu strecken (generisches
   .form-tab { flex:1 } oben) — areaForm/sectorForm/multipitchForm/areasList bleiben bei der
   gleichmässigen Aufteilung unverändert. flex-shrink bleibt erlaubt (0 statt 1 0 0), damit die Tabs
   bei wenig Platz trotzdem nicht überlaufen. */
#routeForm .form-tab-bar .form-tab {
    flex: 0 1 auto;
    padding: 0 14px;
}

#sessionForm .form-tab-icon {
    width: 40px;
    height: 40px;
    display: block;
    color: #888;
}

/* Session-Tab-Icon (Area-Marker-Hexagon, fill="currentColor") färbt sich je nach Session-Status —
   Klassen werden in session.js rendersession() gesetzt: grün = eine bestehende Session ist
   geöffnet/ausgewählt, rot = es ist die aktuell laufende Live-Session (überschreibt grün). */
#sessionTabIcon.session-selected {
    color: var(--accent-success);
}

#sessionTabIcon.session-live {
    color: var(--accent-danger);
}

/* Orange: sessionEditMode auf einer nicht-live (bereits abgeschlossenen) Session — überschreibt
   Grün, siehe rendersession()/_isEditingNonLive in session.js. */
#sessionTabIcon.session-editing {
    color: #ff9800;
}

/* Route-Tab-Icon (Sector-Marker-Dreieck) / Rate-Tab-Icon (Kletterer) / Beta-Tab-Icon
   (Topo-Silhouette): orange sobald im Add-Route-Tab eine Route ausgewählt ist (bleibt auch nach
   Abschluss eines Live-Recordings gesetzt, da selectedRouteId_s dabei nicht geleert wird — oder
   sessionEditMode auf nicht-live Session), bzw. sofort beim Klick auf "Add Route" (siehe main.js) —
   siehe _updateSessionClimbTab() in session.js. */
#sessionRouteTabIcon.route-selected,
#sessionRateTabIcon.route-selected,
#sessionBetaTabIcon.route-selected {
    color: #ff9800;
}

/* Session-Tab-Icon: dieselbe orange Markierung wie oben (Add-Route aktiv/Route ausgewählt) —
   nach .session-live/.session-editing platziert, damit sie diese bei Bedarf per Kaskaden-
   Reihenfolge überschreibt (gleiche Spezifität, später gewinnt). */
#sessionTabIcon.route-selected {
    color: #ff9800;
}

/* Route-Tab-Icon: rot statt orange, wenn ein bereits bestehender Climb direkt angeklickt wurde
   (sessionRoutesContainer -> Rate-Tab, siehe _openInClimbedMode in session.js) — nach
   .route-selected platziert, damit es dessen orange bei gleicher Spezifität überschreibt. Wird von
   _updateSessionClimbTab() wieder entfernt, sobald der Route-Kontext neu berechnet wird. */
#sessionRouteTabIcon.route-viewing {
    color: var(--accent-danger);
}

/* Record-Tab-Icon (Kreis): rot während die Aufnahme läuft, grün sobald sie fertig ist — beides nur
   im Live-Modus farbig, siehe rendersession()/_updateSessionClimbTab() in session.js. */
#sessionRecordTabIcon.record-live {
    color: var(--accent-danger);
    animation: pulse-record-icon 1.4s infinite;
}
#sessionRecordTabIcon.record-finished {
    color: var(--accent-success);
}

@keyframes pulse-record-icon {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

.multipitch-toggle-container {
    margin-top: 10px;
    margin-left: 5px;
}

.title-marker-circle {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.35);
    transform: translate(-50%, -50%);
    z-index: 20;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 11px;
}

/* Sechseck statt Kreis, wie der Area-Marker auf der Karte (map.js addMarkerToMap, SVG-Polygon
   50,4 93,26 93,74 50,96 7,74 7,26 in 100x100-viewBox → als Prozent-Koordinaten übernommen).
   border/box-shadow aus .title-marker-circle folgen clip-path NICHT (werden weiterhin am
   rechteckigen Kasten gerendert) — daher hier deaktiviert: filter:drop-shadow ersetzt den
   Schatten (folgt der geclippten Form korrekt). Element selbst = weisses Sechseck (Rand), ::before
   = rotes, nach innen versetztes Sechseck darüber (Pseudo-Elemente malen per Default-Stacking
   IMMER über den eigenen Hintergrund des Elements — ein negatives z-index auf dem ::before hätte
   das Rot fälschlich hinter statt vor das Weiss gelegt, siehe vorherigen Versuch). */
.area-title-marker-circle {
    background-color: white;
    border: none;
    border-radius: 0;
    width: 20px;
    height: 20px;
    box-shadow: none;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
    -webkit-clip-path: polygon(50% 4%, 93% 26%, 93% 74%, 50% 96%, 7% 74%, 7% 26%);
    clip-path: polygon(50% 4%, 93% 26%, 93% 74%, 50% 96%, 7% 74%, 7% 26%);
}

.area-title-marker-circle::before {
    content: '';
    position: absolute;
    inset: 2px;
    background: #ff4757;
    -webkit-clip-path: polygon(50% 4%, 93% 26%, 93% 74%, 50% 96%, 7% 74%, 7% 26%);
    clip-path: polygon(50% 4%, 93% 26%, 93% 74%, 50% 96%, 7% 74%, 7% 26%);
}

/* Dreieck statt Kreis, wie der Sektor-Marker auf der Karte (map.js addSectorMarkerToMap,
   SVG-Path M50,8 93,90 7,90 Z in 100x100-viewBox → als Prozent-Koordinaten übernommen).
   Gleiche clip-path-Technik wie .area-title-marker-circle (border/box-shadow folgen der
   geclippten Form nicht). ::after bildet das kleine weisse Akzent-Dreieck an der Spitze
   aus der Karten-SVG nach (polygon 50,8 63.6,34 36.4,34) — malt dank Pseudo-Element-
   Stacking automatisch über dem ::before, kein z-index nötig. */
.sector-title-marker-circle {
    background-color: white;
    border: none;
    border-radius: 0;
    box-shadow: none;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
    -webkit-clip-path: polygon(50% 8%, 93% 90%, 7% 90%);
    clip-path: polygon(50% 8%, 93% 90%, 7% 90%);
}

.sector-title-marker-circle::before {
    content: '';
    position: absolute;
    inset: 2px;
    background: #ff9800;
    -webkit-clip-path: polygon(50% 8%, 93% 90%, 7% 90%);
    clip-path: polygon(50% 8%, 93% 90%, 7% 90%);
}

.sector-title-marker-circle::after {
    content: '';
    position: absolute;
    inset: 2px;
    background: white;
    -webkit-clip-path: polygon(50% 8%, 63.6% 34%, 36.4% 34%);
    clip-path: polygon(50% 8%, 63.6% 34%, 36.4% 34%);
}

.parking-title-marker-circle {
    background-color: #4a9eff;
}


.content-desc {
    width: 100%;
    max-height: 160px;
    overflow-y: auto;
    background: var(--bg-tertiary);
    opacity: 0.9;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    padding: 7px 16px;
    white-space: pre-wrap;
    word-break: break-word;
    display: inline-block;
    color: var(--text-primary);
    min-height: 48px;
    line-height: 1.5;
    font-size: 13px;
}

.content-empty {
    color: var(--text-tertiary);
    font-style: italic;
}

/* Markierte Route im Edit-Modus (orange) */
.route-marked-for-edit {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.3) 0%, rgba(251, 140, 0, 0.3) 100%) !important;
    border: 2px solid #ff9800 !important;
    box-shadow: 0 0 15px rgba(255, 152, 0, 0.5) !important;
    transform: scale(1.02);
    transition: all 0.3s ease;
}

/* Route markiert für Löschung (rot + halbtransparent) */
.route-marked-for-deletion {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.4) 0%, rgba(185, 28, 28, 0.4) 100%) !important;
    border: 2px solid #dc3545 !important;
    box-shadow: 0 0 20px rgba(220, 53, 69, 0.6) !important;
    opacity: 0.6;
    transform: scale(1.02);
    transition: all 0.3s ease;
}

.editor-click {
    transition: all 0.3s ease;
}

/* Editor-Click nur im Edit-Mode aktiv */
.contentForm[data-edit-mode="true"] .editor-click {
    cursor: pointer !important;
    touch-action: manipulation !important;
    z-index: 200 !important;
}

.contentForm[data-edit-mode="true"] .editor-click:hover {
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--accent-primary) 15%, transparent) 0%,
        color-mix(in srgb, var(--accent-secondary) 15%, transparent) 100%);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

#multipitchForm #multipitchTitle {
    display: none;
}

#multipitchForm[data-edit-mode="true"] #multipitchTitle {
    display: block;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0px 10px;
    outline: none;
    margin-top: 4px;
}

#routeForm[data-edit-mode="true"] #routeTitle {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0px 10px;
    outline: none;
    margin-top: 4px;
}

#multipitchSelfPreview,
#routeSelfPreview {
    padding: 0;
    margin: 5px 5px 15px 5px;
    /* Erzwingt eine eigene Compositing-Ebene — ohne das können position:sticky-Nachbarn (wie
       .form-tab-bar) beim iOS-Overscroll/Bounce "hinterherhängen" bzw. sich sichtbar mitbewegen,
       während andere Elemente im selben .form-sticky-header stehen bleiben. */
    transform: translateZ(0);
    will-change: transform;
}

#routeForm[data-edit-mode="true"] #routeSelfPreview,
#routeForm[data-edit-mode="true"] #climbSelfPreview,
#multipitchForm[data-edit-mode="true"] #multipitchSelfPreview {
    display: none;
}

#routeForm[data-mode="climbed"] #routeSelfPreview,
#routeForm:not([data-mode="climbed"]) #climbSelfPreview {
    display: none;
}

#routeForm:not([data-edit-mode="true"]) #routeTitle,
#routeForm:not([data-mode="climbed"]):not([data-edit-mode="true"]) #routeFormStickyHeader .recording-category-items {
    display: none;
}

/* sectorForm-Header (Marker+Titel) nur im Admin-/Edit-Mode zeigen, dort als editierbares
   Textfeld — analog zu #routeTitle in routeForm. */
#sectorForm:not([data-edit-mode="true"]) .content-title-row {
    display: none;
}

#sectorForm[data-edit-mode="true"] #sectorTitle {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0px 10px;
    outline: none;
    margin-top: 4px;
}

/* areaForm-Header (Marker+Titel): gleiche Regel wie bei sectorForm. */
#areaForm:not([data-edit-mode="true"]) .content-title-row {
    display: none;
}

#areaForm[data-edit-mode="true"] #areaTitle {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0px 10px;
    outline: none;
    margin-top: 4px;
}

/* multipitchParentRow nur im Admin-/Edit-Mode zeigen — render.js/main.js setzen display:flex/none
   inline je nachdem ob ein Parent existiert, daher hier !important nötig um das zu überstimmen. */
#multipitchForm:not([data-edit-mode="true"]) #multipitchParentRow {
    display: none !important;
}

/* sectorDropdownRow (routeForm) nur im Admin-/Edit-Mode zeigen — render.js setzt display:flex/none
   inline je nachdem ob die Route bereits einem Sektor zugeordnet ist, daher !important nötig. */
#routeForm:not([data-edit-mode="true"]) #sectorDropdownRow {
    display: none !important;
}

.coords-info {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    padding: 16px;
    margin: 0px -1px 20px -1px;
    font-size: 13px;
    color: var(--text-secondary);
    backdrop-filter: blur(8px);
}

#infoboxRoute {
    margin-bottom: 500px;
}

.parking-nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.nav-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(74, 158, 255, 0.12);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 20px;
    color: var(--accent-blue, #4a9eff);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.nav-link-btn:hover,
.nav-link-btn:focus {
    background: rgba(74, 158, 255, 0.25);
    border-color: rgba(74, 158, 255, 0.6);
    outline: none;
}

.sun-info {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    padding: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    backdrop-filter: blur(8px);
}

.sun-info h4 {
    margin: 0 0 10px 0;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
}

.sun-season {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 3px;
    padding: 8px;
    background: rgba(15, 15, 35, 0.4);
    border-radius: 8px;
}

.sun-season-label {
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 65px;
}

.sun-season-times {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-opposite);
}

.sun-season-times input[type="time"] {
    background: rgba(26, 32, 46, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-opposite);
    padding: 4px 8px;
    font-size: 13px;
    min-width: 65px;
    transition: all 0.3s ease;
}

.sun-season-times input[type="time"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

/* Nur im Edit-Mode bearbeitbar */
.contentForm[data-edit-mode="false"] .sun-season-times input[type="time"] {
    pointer-events: none;
    background: transparent;
    border: none;
    padding: 0;
}

.button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Nur im Edit-Mode sichtbar */
.contentForm[data-edit-mode="false"] .edit-only {
    display: none !important;
}

.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-right: 10px;
}

.section-header-row .headline2 {
    margin-bottom: 0;
    margin-right: 0;
}

.btn-add {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 400;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

/* Für die (aktuell 4) .btn-Instanzen, die zusätzlich zum Text ein Icon zeigen
   (addRouteFromSession/sessionRouteTabChangeBtn/sessionRouteTabDeleteClimbBtn/pickRouteFromTopoBtn,
   siehe index.php — bisher je einzeln per Inline-Style dasselbe display:flex;align-items:center;
   justify-content:center;gap:6px dupliziert) — feste Höhe statt natürlicher Inhaltshöhe, damit sie
   nebeneinander (z.B. sessionRouteTabChangeBtn/-DeleteClimbBtn) garantiert gleich hoch sind,
   unabhängig von Text-/Icon-Feinheiten. */
.btn--icon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 44px;
}

.btn {
    flex: 1;
    padding: 12px 18px;
    margin: 2px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-sm);
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #0ea5e9 100%);
    color: var(--bg-primary);
    border-color: var(--accent-primary);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0ea5e9 0%, var(--accent-primary) 100%);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.btn-secondary {
    margin-top: 5px;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    color: white;
    border-color: var(--accent-danger);
}

.btn-danger:hover {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
    transform: translateY(-2px);
}

/* Weiss auf dem hellen .btn-danger-Hintergrund (bg-tertiary/bg-secondary, im Light-Theme selbst
   hell) ist kaum lesbar — dort stattdessen die normale Textfarbe. */
[data-theme="light"] .btn-danger {
    color: var(--text-primary);
}

/* #id statt Klasse, damit es .btn-danger's color:white überschreibt — als Stylesheet-Regel statt
   Inline-Style, damit der "Löschen bestätigen?"-Reset in main.js (element.style.color = '' nach
   3s Timeout, siehe deleteClimb-Action) wieder hierauf zurückfällt statt auf weiss. */
#sessionRouteTabDeleteClimbBtn {
    color: var(--text-primary);
}

/* margin-top:5px explizit für beide statt nur für sessionRouteTabChangeBtn über .btn-secondary
   (das dort zufällig mitkommt, .btn-danger hat es nicht) — sonst stehen sie nebeneinander
   unterschiedlich hoch an. */
#sessionRouteTabChangeBtn,
#sessionRouteTabDeleteClimbBtn {
    margin-top: 5px;
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-success) 0%, #059669 100%);
    color: white;
    border: none;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
}

.btn_closeForm {
    display: none !important;
}

/* ===== Floating Form Action Panel ============================= */
#formActionPanel {
    position: fixed;
    right: 16px;
    bottom: calc(10vh + 18px);
    transition: bottom 0.4s ease;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: all;
}

#formActionPanel button {
    position: static !important;
    width: 48px !important;
    height: 48px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #1a7a7a 0%, #0f5252 100%);
    border: 2px solid #23a0a0 !important;
    color: #e0f4f4;
    box-shadow: 0 2px 12px rgba(26,122,122,0.5);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s, box-shadow 0.2s, opacity 0.22s ease;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    aspect-ratio: 1 / 1;
}

/* Scroll/close button is always visible when panel is open */
#btn_panelclose {
    display: flex;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
    /* initial rotation set by JS (rotate(0deg) = ↓, 180deg = ↑, 90deg = ←) */
    /* Grundform (Kreis-Button) hier statt nur über "#formActionPanel button" — letzteres greift
       per Abstammungs-Selektor nur, solange der Button dort drin hängt; bei aktiver MenuForm-
       Familie wird er aber in die jeweilige Form umgehängt (siehe main.js updateScrollBtn), wo
       diese Regel nicht mehr matcht. Ohne diese unscoped Basis verlor der Button dabei Form/Grösse. */
    width: 48px;
    height: 48px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(26,122,122,0.5);
}

/* btn_panelclose ist jetzt nur noch innerhalb von MenuForm + dessen Unterseiten sichtbar (siehe
   main.js updateScrollBtn/MENU_FORM_FAMILY) — dort klinkt es sich aus der #formActionPanel-Spalte
   (rechts, position:static) aus und sitzt stattdessen unten auf Höhe der Bottom-Bar (.bottom-bar:
   bottom:10px). ID-Selektor nötig, um die höhere Spezifität von "#formActionPanel button" (position/
   bottom: ... !important) zu überstimmen. */
#btn_panelclose.panelclose-menuform {
    position: fixed !important;
    right: 20px !important;
    left: auto !important;
    bottom: 10px !important;
    /* Schwarz/Weiss statt der türkisen formActionPanel-Farbe — --text-primary ist in dark/light
       Theme jeweils fast weiss/fast schwarz, --bg-primary das jeweilige Gegenstück, siehe :root. */
    background: var(--text-primary);
    border: 2px solid var(--text-primary) !important;
    color: var(--bg-primary);
}
/* _chevronSvg (main.js) hat den Strich fest auf #e0f4f4 gesetzt (passend zur türkisen
   formActionPanel-Farbe anderswo) — hier gezielt überschrieben statt currentColor global
   einzuführen, damit die übrigen (Overlay-)Verwendungen von btn_panelclose unangetastet bleiben. */
#btn_panelclose.panelclose-menuform svg * {
    stroke: var(--bg-primary);
}

@keyframes fp-record-pulse {
    0%, 100% { box-shadow: 0 2px 12px rgba(26,122,122,0.5), 0 0 0 0 rgba(239,68,68,0.55); }
    55%       { box-shadow: 0 2px 12px rgba(26,122,122,0.5), 0 0 0 9px rgba(239,68,68,0); }
}
#btn_printrecord {
    animation: fp-record-pulse 1.5s infinite;
}

#formActionPanel button:hover {
    background: linear-gradient(135deg, #23a0a0 0%, #1a7a7a 100%);
    box-shadow: 0 4px 20px rgba(26,122,122,0.7);
}

/* Save button: edit-active = checkmark / green */
#formActionPanel #btn_panelsave.edit-active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    border-color: rgba(16, 185, 129, 0.5) !important;
}

/* Save button: unsaved changes = orange pulse */
#formActionPanel #btn_panelsave.save-btn-changed {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    border-color: rgba(245, 158, 11, 0.5) !important;
    animation: pulse-warning 2s infinite !important;
}

/* Recording button pulse is applied via JS only when actively recording (red state) */

/* Wieder sichtbar (2026-09-26, auf Nutzerwunsch) — war zeitweise per !important immer ausgeblendet
   (Admin-/Vote-Edit-Mode-Toggle leben zusätzlich als feste Buttons unten im areaForm-Info-Tab,
   #btn_adminEditMode/#btn_voteEditMode, für sector-/route-/multipitch-/parkingForm gibt es aber
   keine eigenen — die erben den globalen Edit-Mode nur, ohne eigenen sichtbaren Auslöser/Save-Status).
   updateFormActionPanel() (main.js) regelt Sichtbarkeit/Icon vollständig selbst (Topo-Tab, Climbed-
   Mode, aktive Session) — keine weitere CSS-Regel hier nötig, das Element startet inline
   display:none;opacity:0 (index.php) bis JS es aktiv zeigt. */

#btn_adminEditMode.edit-active,
#btn_voteEditMode.edit-active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    border-color: rgba(16, 185, 129, 0.5) !important;
    color: #fff !important;
}

.save-btn {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: #fff;
    right: 52px;
    top: 4px;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid rgba(107, 114, 128, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.save-btn:hover {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 0 20px rgba(107, 114, 128, 0.5);
}

/* Save-Button im Edit-Mode (grün mit Häkchen) */
.contentForm[data-edit-mode="true"] .save-btn {
    background: linear-gradient(135deg, var(--accent-success) 0%, #059669 100%);
    border-color: rgba(16, 185, 129, 0.5);
}

.contentForm[data-edit-mode="true"] .save-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
}

/* Änderungen vorhanden - Orange Highlight */
.save-btn-changed,
.contentForm[data-edit-mode="true"] .save-btn-changed {
    background: linear-gradient(135deg, var(--accent-warning) 0%, #d97706 100%) !important;
    border-color: rgba(245, 158, 11, 0.5) !important;
    animation: pulse-warning 2s infinite;
}

.save-btn-changed:hover,
.contentForm[data-edit-mode="true"] .save-btn-changed:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%) !important;
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.6) !important;
}

@keyframes pulse-warning {
    0%, 100% { box-shadow: 0 0 20px rgba(245, 158, 11, 0.4); }
    50% { box-shadow: 0 0 30px rgba(245, 158, 11, 0.6); }
}

.recording-btn {
    position: absolute;
    top: 55px;
    right: 20px;
    width: 55px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background-color: #dc3545;
    border: 2px solid rgba(220, 53, 69, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 0 20px rgba(220, 53, 69, 0.5);
    animation: pulse-recording 2s infinite;
}

@keyframes pulse-recording {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(220, 53, 69, 0.5);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 30px rgba(220, 53, 69, 0.8);
        transform: scale(1.05);
    }
}

/* === Stopwatch & Digital Font === */
.digital-text {
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    letter-spacing: 2px;
    color: var(--text-primary);
    box-shadow: 5px 5px 20px rgba(220, 53, 69, 0.5);
}

#stopwatchDisplay {
    position: absolute;
    top: 30px;
    right: 10px;
    width: 75px;
    text-align: center;
    font-size: 16px;
    pointer-events: none;
    display: none;
    z-index: 100;
    color: #dc3545;
    text-shadow: 0 0 8px rgba(220, 53, 69, 0.7);
}

.climb-time-badge {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(220, 53, 69, 0.12);
    color: var(--text-primary);
    margin-right: 6px;
    white-space: nowrap;
}

/* === 5. Bottom Editor === */
.bottom-editor {
    position: fixed;
    left: 0;
    right: 0;
    /* top/height statt bottom:0 — direkt an visualViewport.offsetTop/.height gebunden (editor.js
       _applyEditorViewport), damit die Box exakt den tatsächlich sichtbaren Bereich abdeckt statt
       eine Differenz zu einer Layout-Viewport-Referenz (window.innerHeight/clientHeight) zu
       berechnen. Die Differenz-Berechnung erzeugte auf Firefox Android eine Lücke zwischen Editor
       und Tastatur, weil Firefox dort eine eigene Adressleiste über der Tastatur einblendet, die
       in keiner der beiden Referenzen konsistent auftauchte. Fallback 0/100vh für Browser ohne
       Visual-Viewport-Support (Variablen dann ungesetzt). */
    top: var(--editor-vv-top, 0px);
    height: var(--editor-vv-height, 100vh);
    transform: translateY(110%);
    transition: transform 350ms cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.bottom-editor.open {
    transform: translateY(0);
    pointer-events: auto;
    align-items: flex-end;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.bottom-editor-inner {
    position: relative;
    width: 100%;
    max-width: 900px;
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-tertiary) 100%);
    backdrop-filter: blur(20px);
    border-top-left-radius: 7px;
    border-top-right-radius: 7px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    border-bottom: none;
    padding: 20px;
    display: flex;
    gap: 14px;
    align-items: center;
}

.bottom-editor-inner textarea {
    flex: 1;
    padding: 14px 16px;
    background: color-mix(in srgb, var(--bg-primary) 60%, transparent);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    font-size: 15px;
    color: var(--text-primary);
    resize: none;
    min-height: 52px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.bottom-editor-inner textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    background: color-mix(in srgb, var(--bg-primary) 80%, transparent);
}

.bottom-editor-inner textarea::placeholder {
    color: var(--text-tertiary);
}

.bottom-editor-inner textarea.single-line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 52px;
}

.bottom-editor.open.desc-mode {
    align-items: stretch;
}

.bottom-editor.open.route-mode {
    align-items: stretch;
}

.bottom-editor.open.desc-mode .bottom-editor-inner {
    height: 100%;
    max-height: none;
    border-radius: 0;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
}

.bottom-editor.open.route-mode .bottom-editor-inner {
    height: 100%;
    max-height: none;
    border-radius: 0;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
}

.bottom-editor.open.desc-mode .bottom-editor-inner textarea {
    flex: 1;
    min-height: 80px;
    overflow-y: auto;
    resize: none;
    white-space: pre-wrap;
}

.bottom-editor.open.route-mode .bottom-editor-inner textarea {
    flex: 1;
    min-height: 80px;
    overflow-y: auto;
    resize: none;
    white-space: pre-wrap;
}

.bottom-editor-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.editor-close-btn {
    display: none;
    position: fixed;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--bg-card) 90%, transparent);
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 1;
    flex-shrink: 0;
}

.bottom-editor.open .editor-close-btn {
    display: flex;
}

.editor-format-btns {
    display: none;
    gap: 6px;
}

.bottom-editor.open.desc-mode .bottom-editor-actions {
    justify-content: space-between;
    align-items: center;
}

.bottom-editor.open.route-mode .bottom-editor-actions {
    justify-content: space-between;
    align-items: center;
}

.bottom-editor.open.desc-mode .editor-format-btns {
    display: flex;
}

.editor-route-legend {
    display: none;
    flex-direction: row;
    gap: 6px;
    padding: 0 0 8px;
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.editor-route-legend::-webkit-scrollbar { display: none; }

.bottom-editor.open.route-mode .editor-route-legend {
    display: flex;
}

.erl-chip {
    font-size: 13px;
    font-family: monospace;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--accent-primary) 12%, transparent);
    color: var(--accent-primary);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.erl-chip:active {
    background: color-mix(in srgb, var(--accent-primary) 25%, transparent);
}

.editor-ocr-prompt-btn {
    display: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--bg-primary) 60%, transparent);
    color: var(--text-secondary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bottom-editor.open.route-mode .editor-ocr-prompt-btn {
    display: flex;
}

.editor-ocr-prompt-btn.copied {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* Ersetzt das frühere editorAddRouteBtn ("+", nur in route-mode sichtbar) — löst statt eines
   Anlegen-Buttons für eine bereits mehrzeilige Eingabe jetzt vorab den Wechsel in den Mehrzeilen-
   Modus aus (dasselbe wie ein Paste mit Zeilenumbruch, siehe editor.js _activateRouteMode). Nur
   sichtbar solange NOCH NICHT im Mehrzeilen-Modus — danach übernimmt editorSaveBtn dessen
   Funktion (siehe main.js _editorSaveHandler). Nur im Edit-Mode (edit-mode-active, siehe
   editor.js openEditor — #bottom-editor liegt ausserhalb aller .contentForm, die generische
   .edit-only-Klasse greift hier nicht) und nur beim Bearbeiten eines Routennamens (new-route-mode).
   Sitzt direkt im Textarea-Flow (index.php, unmittelbar nach #editorInput) statt in
   .bottom-editor-actions — dockt dadurch direkt rechts am Textfeld an; align-self: stretch
   übernimmt automatisch dessen tatsächliche (variable) Höhe statt eines festen Werts. */
.editor-expand-btn {
    display: none;
    width: 38px;
    align-self: stretch;
    border-radius: 7px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bottom-editor.open.new-route-mode.edit-mode-active:not(.route-mode) .editor-expand-btn {
    display: flex;
}

.fmt-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: rgba(22, 33, 62, 0.8);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.fmt-btn:hover, .fmt-btn:active {
    border-color: var(--accent-primary);
    background: rgba(68, 54, 72, 0.6);
    box-shadow: var(--shadow-glow);
}

/* === 6. Routen & Sektoren === */
#contentRoutes {
    margin-top: 8px;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 700;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}


.area_routeslist {
    width: 100%;
    min-height: 36px;
    font-size: 15px;
    font-weight: 600;
    background: linear-gradient(135deg, color-mix(in srgb, var(--bg-card) 65%, transparent) 0%, color-mix(in srgb, var(--bg-tertiary) 65%, transparent) 100%);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    padding: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0 0 -1px;
    cursor: pointer;
}

.area_routeslist:hover {
    transform: translateX(4px);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15) 0%, rgba(124, 58, 237, 0.15) 100%);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

/* Route Grade, Length and Style Divs */
.area_sectorlist .grade-div,
.area_sectorlist .length-div {
    position: relative;
    min-width: 38px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    font-weight: bold;
    font-size: 13px;
    display: inline-block;
    color: var(--text-opposite);
    border-radius: 4px;
}

/* .area_routeslist: 25% weniger Höhe (wie .climbs_routelist) — eigener Block statt geteilter
   Selektor mit .area_sectorlist, damit nur diese Zeile betroffen ist. #routesContainerSector
   wurde bewusst entfernt (siehe eachroute()): Routen-Karten dort tragen ebenfalls .area_routeslist,
   die ID hätte als Selektor sonst per höherer Spezifität diese Regel überstimmt. */
.area_routeslist .grade-div,
.area_routeslist .length-div {
    position: relative;
    min-width: 38px;
    height: 22.5px;
    line-height: 22.5px;
    text-align: center;
    font-weight: bold;
    font-size: 13px;
    display: inline-block;
    color: var(--text-black);
    border-radius: 4px;
}

.area_routeslist .style-div {
    min-width: 24px;
    height: 22.5px;
    line-height: 22.5px;
    padding: 0 6px;
    text-align: center;
    font-weight: bold;
    font-size: 12px;
    display: inline-block;
    color: var(--text-black);
    border-radius: 4px 0 0 4px;
    margin-left: 4px;
    flex-shrink: 0;
}

.area_routeslist .climbed-div {
    min-width: 24px;
    height: 22.5px;
    line-height: 22.5px;
    padding: 0 6px;
    text-align: center;
    font-weight: bold;
    font-size: 12px;
    display: inline-block;
    color: var(--text-black);
    border-radius: 0 4px 4px 0;
    flex-shrink: 0;
}

.area_routeslist .count-div {
    height: 22.5px;
    line-height: 22.5px;
    padding: 0 6px;
    text-align: center;
    font-weight: bold;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    color: var(--text-primary);
    border-radius: 4px;
    flex-shrink: 0;
}

.area_sectorlist {
    width: 100%;
    font-size: 15px;
    font-weight: 600;
    background: linear-gradient(135deg, color-mix(in srgb, var(--bg-card) 65%, transparent) 0%, color-mix(in srgb, var(--bg-tertiary) 65%, transparent) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 12px 16px;
    padding-top: 12px;
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    cursor: pointer;
}

.area_sectorlist:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2) 0%, rgba(124, 58, 237, 0.2) 100%);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.climbs_routelist {
    width: 100%;
    min-height: 36px;
    font-size: 15px;
    font-weight: 600;
    background: linear-gradient(135deg, color-mix(in srgb, var(--bg-card) 65%, transparent) 0%, color-mix(in srgb, var(--bg-tertiary) 65%, transparent) 100%);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    padding: 0;
    white-space: normal;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0 0 -1px;
    cursor: pointer;
}

.climbs-name-row {
    margin-top: 0;
}

.climbs-stars-badge {
    height: 24px;
    border-radius: 5px 0px 0px 5px;
    padding-top: 0px;
    padding-left: 2px;
    padding-right: 2px;
    padding-bottom: 2px;
    font-size: 15px;
}

.climbs-bottom-left,
.climbs-bottom-right {
    padding: 0;
}

.climbs_routelist:hover {
    transform: translateX(4px);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15) 0%, rgba(124, 58, 237, 0.15) 100%);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

/* climb-row-body: climbbuttons/climbDesc werden hier reingehängt, solange dieser Climb ausgewählt
   ist (render.js _attachClimbFieldsTo/renderClimbs) — einfache max-height-Cap-Transition statt der
   pin-to-actual-height-Mechanik der anderen Kategorien, bewusst simpel gehalten. */
.climb-row-body {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    padding: 0 12px;
    transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
}

.climb-row-body--open {
    max-height: 2000px;
    opacity: 1;
    padding-left: 0px;
    padding-right: 0px;
    padding-bottom: 0px;
    padding-top: 10px;
    transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
}

.climb-row-open:hover {
    transform: none;
}

.climbs_routelist .grade-div,
.climbs_routelist .length-div {
    position: relative;
    min-width: 38px;
    height: 22.5px;
    line-height: 22.5px;
    text-align: center;
    font-weight: bold;
    font-size: 13px;
    display: inline-block;
    color: var(--text-opposite);
    border-radius: 4px;
}

.climbs_routelist .style-div {
    min-width: 24px;
    height: 22.5px;
    line-height: 22.5px;
    padding: 0 6px;
    text-align: center;
    font-weight: bold;
    font-size: 12px;
    display: inline-block;
    color: var(--text-opposite);
    border-radius: 4px 0 0 4px;
    margin-left: 4px;
    flex-shrink: 0;
}

.climbs_routelist .climbed-div {
    min-width: 24px;
    height: 22.5px;
    line-height: 22.5px;
    padding: 0 6px;
    text-align: center;
    font-weight: bold;
    font-size: 12px;
    display: inline-block;
    color: var(--text-opposite);
    border-radius: 0 4px 4px 0;
    flex-shrink: 0;
}

/* Kinder setzen ihre Textfarbe individuell inline (render.js) — hier pauschal auf schwarz
   überschrieben, daher !important nötig gegen die Inline-Styles. */
.climbs-bottom-row {
    margin: 0;
}

.climbs-bottom-row,
.climbs-bottom-row *,
#yourClimbedLabelsRow,
#yourClimbedLabelsRow * {
    color: var(--text-black) !important;
}

/* .climbs-bottom-center hat keine farbigen Badge-Hintergründe wie climbed-div/grade-div/style-div
   (die das schwarz oben wegen Kontrast brauchen) — höhere Spezifität, um die pauschale Regel
   gezielt nur hier zu übersteuern. */
.climbs-bottom-row .climbs-bottom-center,
.climbs-bottom-row .climbs-bottom-center * {
    color: var(--text-primary) !important;
}

/* Area-Activity-Log (Phase 1 Community-Layer, siehe Doku/06_Community/Konzept_Community_Layer.md) */
.area-activity-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px 10px 10px;
}

.area-activity-empty,
.area-activity-loading {
    color: var(--text-tertiary);
    font-size: 13px;
    padding: 4px 0;
}

.area-activity-row {
    font-size: 13px;
    padding: 6px 8px;
    border-radius: 6px;
    background: var(--bg-tertiary);
}

.area-activity-row-main {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
}

.area-activity-user {
    font-weight: 600;
    color: var(--text-primary);
}

.area-activity-action {
    color: var(--text-secondary);
}

.area-activity-entity {
    color: var(--accent-primary);
}

.area-activity-migrated {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 4px;
}

.area-activity-date {
    margin-left: auto;
    color: var(--text-tertiary);
    font-size: 11px;
}

.area-activity-diff {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.area-activity-diff-old {
    text-decoration: line-through;
    opacity: 0.7;
}

.area-activity-diff-new {
    color: var(--text-primary);
    font-weight: 600;
}

/* Recording Category Cards */
.recording-category {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    backdrop-filter: blur(8px);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    transition: padding 2s ease;
    margin: 0px -1px -1px -1px;
    padding: 5px;
}

/* Routes-Liste (#routesCategorySector/#routesCategory) liegt direkt hinter dem sticky
   Filter-Container (#areaFormFilterContainer/#sectorFormFilterContainer, siehe .filter-collapse-
   outer) — zwei benachbarte backdrop-filter blockieren sich gegenseitig (Firefox + Chromium
   gleichermaßen), daher hier gezielt deaktiviert, damit der Filter-Blur durchgreift. Nur diese
   beiden IDs, .recording-category bleibt sonst (Area Info, Conditions etc.) unverändert. */
#routesCategorySector,
#routesCategory {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.recording-category--collapsed {
    overflow: hidden;
    padding: 5px 10px 10px 0px;
}

.recording-category--climbed:not(.recording-category--collapsed) {
    background: linear-gradient(135deg, var(--climbed-bg-start) 0%, var(--climbed-bg-end) 100%);
    padding-bottom: 30px;
}

.recording-category-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0px 10px;
    margin: 0 0 0px 0;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;

}

.recording-category-title::after {
    content: '▼';
    font-size: 15px;
    display: inline-block;
    order: 2;
    margin-left: auto;
    transition: transform 0.22s ease;
    transform: rotate(0deg);
    opacity: 0.7;
}


.recording-category--collapsed .recording-category-title {
    margin-bottom: 0;
    opacity: 0.8;
}

.recording-category--collapsed .recording-category-title::after {
    transform: rotate(-90deg);
}

.recording-category-community-stats {
    overflow: hidden;
    max-height: 1000px;
    opacity: 1;
    transition: max-height 2s ease, opacity 0.2s ease;
}

.recording-category--collapsed > .recording-category-community-stats {
    max-height: 0 !important;
    opacity: 0;
    transition: opacity 0.2s ease, max-height 0.4s ease 0.5s;
}

.recording-category-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0px;
    align-items: center;
    padding: 5px;
    overflow: hidden;
    max-height: 1000px;
    opacity: 1;
    transition: max-height 2s ease, opacity 0.2s ease, padding 0.2s ease;
}

.recording-category--climbed .recording-category-items {
    max-height: 800px;
    transition: max-height 2s ease, opacity 0.2s ease, padding 0.2s ease;
}

.recording-category--collapsed .recording-category-items,
.recording-category--collapsed .recording-tag-container,
.recording-category--collapsed .crux-cards-container {
    max-height: 0 !important;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, max-height 0.4s ease 0.5s, padding 0.4s ease 0.5s;
}

/* climbCategory ist wie yourClimbsSummaryCategory kein Teil der Collapsible-Accordion-Gruppe mehr
   (render.js renderRoute()) — Inhalt lebt inzwischen ohnehin meist inline in der climb-row-body
   der ausgewählten Climb-Zeile (siehe _attachClimbFieldsTo), climbCategory selbst bleibt fix
   offen. Pfeil-Icon + Pointer-Cursor entfernt, da der Titel nicht mehr interaktiv ist. */
#climbCategory > .recording-category-title {
    cursor: default;
}
#climbCategory > .recording-category-title::after {
    display: none;
}

/* yourClimbsSummaryCategory ist kein Teil der Collapsible-Accordion-Gruppe mehr (render.js
   renderRoute()) — lebt seit dem routeForm-Tab-Umbau allein in seinem eigenen "Your Climbs"-Tab,
   kollabiert dort nie mehr mit/durch andere Kategorien. Pfeil-Icon + Pointer-Cursor entfernt,
   da der Titel dadurch nicht mehr interaktiv ist. */
#yourClimbsSummaryCategory > .recording-category-title {
    cursor: default;
}
#yourClimbsSummaryCategory > .recording-category-title::after {
    display: none;
}
/* Der max-height:1000px-Deckel der Basisklasse diente nur der Collapse-Animation, die es hier
   nicht mehr gibt — schneidet sonst den Inhalt ab, sobald die Climb-Liste (+ eine offene Zeile)
   zusammen über 1000px hoch wird. */
#yourClimbsSummaryCategory > .recording-category-items {
    max-height: none;
    overflow: visible;
}

/* .recording-category selbst hat schon backdrop-filter:blur(8px) (siehe oben) — verschachtelte
   backdrop-filter blockieren sich gegenseitig (Firefox + Chromium, gleiches Problem wie bei
   #routesCategorySector/#routesCategory oben), daher hier deaktiviert, damit der eigene Blur
   des sticky Titels (unten) durchgreift. */
#routeForm .recording-category {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Alle Category-Titel: immer sticky */
#routeForm .recording-category > .recording-category-title {
    position: sticky;
    bottom: var(--sticky-cat-title-bottom, 0px);
    z-index: 3;
}

/* Aufgeklappte Titel: sticky von oben + Hintergrund — top:0, da #routeFormStickyHeader seit dem
   Tab-Umbau (Info/Your Climbs) nicht mehr im selben Scroll-Container liegt wie die Category-Titel
   (siehe routeFormTab1/routeFormTab2); deren Scroll-Container beginnt bereits direkt unterhalb
   des Headers, keine Höhen-Kompensation mehr nötig. */
#routeForm .recording-category:not(.recording-category--collapsed) > .recording-category-title {
    top: 0px;
        background: linear-gradient(135deg,
        color-mix(in srgb, var(--accent-primary) 85%, transparent) 0%,
        color-mix(in srgb, var(--accent-secondary) 85%, transparent) 100%);
        backdrop-filter: blur(101px);
        -webkit-backdrop-filter:blur(41px);
    padding: 0px 10px;
    margin: -5px -10px 10px -5px;
    border-radius: 7px 7px 0 0;
}

/* yourClimbsSummaryCategory: kein sticky Titel — lebt allein in seinem eigenen "Your Climbs"-Tab
   (kein Nebeneinander mit anderen Kategorien wie im Info-Tab), sticky ist hier nicht nötig. */
#yourClimbsSummaryCategory > .recording-category-title {
    position: static;
}

/* Climbed-Modus: Gradient-Hintergrund */
#routeForm .recording-category--climbed:not(.recording-category--collapsed) > .recording-category-title {
    background: linear-gradient(135deg, var(--climbed-bg-start) 0%, var(--climbed-bg-end) 100%), var(--bg-card);
}

.recording-subcategory-title {
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    padding: 6px 4px;
    display: flex;
    align-items: center;
    gap: 5px;
    user-select: none;
}

.recording-subcategory-title::after {
    content: '▼';
    font-size: 11px;
    display: inline-block;
    transition: transform 0.22s ease;
    opacity: 0.7;
}

.recording-subcategory--collapsed .recording-subcategory-title::after {
    transform: rotate(-90deg);
}

.recording-subcategory-items {
    overflow: hidden;
    max-height: 2000px;
    transition: max-height 0.4s ease, opacity 0.2s ease;
    opacity: 1;
}

.recording-subcategory--collapsed .recording-subcategory-items {
    max-height: 0 !important;
    opacity: 0;
    transition: max-height 0.4s ease 0.1s, opacity 0.2s ease;
}

.recording-category-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 14px;
    height: 38px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    user-select: none;
}

.recording-category-toggle:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.recording-category-toggle:active {
    transform: translateY(0);
}

/* History Category (history tab) */
.history-category {
    background: transparent;
    border: none;
    border-left: 3px solid var(--border-color);
    border-radius: 0;
    padding: 0px 0px 0px 4px;
    margin-top: 0;
    margin-bottom: 2px;
}

.history-category-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0px 10px 0px 0px;
    margin: 0;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.history-category-title::after {
    content: '▼';
    font-size: 15px;
    display: inline-block;
    transition: transform 0.22s ease;
    transform: rotate(0deg);
    opacity: 0.7;
}

.history-category--collapsed .history-category-title {
    margin-bottom: 0;
    opacity: 0.8;
}

.history-category--collapsed .history-category-title::after {
    transform: rotate(-90deg);
}

.history-category-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 5px 5px 5px 0px;
    overflow: hidden;
    max-height: 800px;
    opacity: 1;
    transition: max-height 0.3s ease, opacity 0.22s ease, padding 0.22s ease;
}

.history-category--collapsed .history-category-items {
    max-height: 0 !important;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
}

/* Button reset when a <button> is used as .dropdown-selected inside .recording-dropdown */
.recording-dropdown > button.dropdown-selected,
.recording-pill-btn {
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    font-family: inherit;
}

/* Recording Dropdown – grading-btn style */
.recording-dropdown {
    position: relative;
    display: inline-flex;
    width: auto;
    max-width: none;
    user-select: none;
}

.recording-dropdown .dropdown-selected {
    width: auto;
    padding: 6px 10px;
    height: auto;
    border-radius: 7px;
    border: 1px solid #fff;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    white-space: nowrap;
}

/* Shared style for the route-property pill buttons in routeMetaRow
   (style/grad/length/bolts) — previously four byte-identical copies of the
   same rules duplicated per-ID. */
.recording-pill-btn {
    width: fit-content;
    min-width: 38px;
    height: 30px;
    line-height: 30px;
    padding: 0 8px;
    border-radius: 4px;
    border: 1.5px solid var(--border-color);
    background: transparent;
    font-size: 13px;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    white-space: nowrap;
}

.recording-dropdown .dropdown-selected[data-has-value="true"],
.dropdown-selected[data-has-value="true"] {
    color: #222 !important;
    border-color: #000 !important;
}

.recording-pill-btn[data-has-value="true"] {
    border-color: transparent;
    color: var(--text-opposite);
}

.recording-pill-btn:not(.is-interactive) {
    cursor: default;
}

.recording-pill-btn:not(.is-interactive):hover {
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

.recording-dropdown .dropdown-selected::after,
.recording-pill-btn::after {
    display: none;
}

.recording-dropdown .dropdown-selected:hover,
.recording-pill-btn:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.recording-dropdown .dropdown-selected:active,
.recording-pill-btn:active {
    transform: translateY(0);
}

.recording-dropdown.not-interactive .dropdown-selected {
    cursor: default;
    pointer-events: none;
    opacity: 0.9;
}

.recording-dropdown.not-interactive .dropdown-selected::after {
    display: none;
}

.recording-dropdown-reset {
    color: var(--text-secondary) !important;
    font-style: italic;
    border-left: 4px solid #666 !important;
}

.recording-dropdown--bucket {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    /* min-width statt fixer width: wächst/schrumpft mit dem umgebenden Flex-Container
       (#climbbuttons: display:flex;flex-wrap:wrap) und füllt so die verfügbare Zeilenbreite
       (inkl. Rändern/Paddings des Containers, die durch dessen eigene Box unberührt bleiben)
       statt bei 120px zu stoppen und Lücken zu lassen. */
    min-width: 100px;
    flex: 1 1 100px;
    height: 90px;
    box-sizing: border-box;
    padding: 6px 8px;
    border-radius: 7px;
    border: 1px solid var(--border-color);
    cursor: pointer;
}
.recording-dropdown--bucket .dropdown-selected {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    width: 100%;
    height: 100%;
    background: transparent !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0;
    color: inherit;
    gap: 2px;
}
.recording-dropdown--bucket .dropdown-selected::after {
    display: none;
}
.recording-dropdown--bucket .rdd-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-secondary);
    line-height: 1;
    white-space: nowrap;
}
.recording-dropdown--bucket .rdd-bar {
    width: 85%;
    height: 8px;
    border-radius: 4px;
    background: var(--border-color);
    opacity: 0.3;
    transition: background 0.2s, opacity 0.2s;
    flex-shrink: 0;
}
.recording-dropdown--bucket .dropdown-selected[data-has-value="true"] .rdd-bar {
    opacity: 1;
}
.recording-dropdown--bucket .dropdown-selected[data-has-value="true"] {
    background: transparent !important;
    color: inherit !important;
    border-color: transparent !important;
}

/* partneruserDropdown trägt .recording-dropdown--bucket nur fuer die Ketten-Zugehoerigkeit
   (_getBucketSiblingChain, siehe renderPartnerUserBtn) — die sichtbare Karten-Box kommt schon vom
   inneren #partneruserBtn (.recording-time-btn--bucket), sonst doppelter Rahmen. Attribut-Selector
   statt #id: Chain-Strip-Klone (_renderBucketChainStrip) verlieren ihre id beim Klonen, das
   data-recording-key-Attribut bleibt aber erhalten (nur id wird gestrippt) — sonst haette der Klon
   in der Leiste wieder den doppelten Rahmen. */
[data-recording-key="partner"].recording-dropdown--bucket {
    border: none;
    padding: 0;
    width: auto;
    height: auto;
    /* stretch statt center: das innere #partneruserBtn (align-items:center würde es sonst auf
       seine intrinsische Inhaltsbreite aufblähen, siehe dortigen Kommentar) soll die tatsächlich
       berechnete Breite dieses Wrappers annehmen, damit die Ellipsis im Label greifen kann. */
    align-items: stretch;
}

/* Siehe Kommentar oben: das Label darin braucht eine echte, von der Karte begrenzte Breite statt
   sich an ihr vorbei auf die volle Textbreite aufzublähen — align-items:stretch statt center
   (Attribut-Selector: gilt auch für Chain-Strip-Klone, siehe Kommentar oben). */
[data-recording-key="partner"] .recording-time-btn--bucket {
    align-items: stretch;
    /* flex:1 1 100px von der Basisregel wirkt hier auf die Hauptachse des Elternelements
       (#partneruserDropdown ist flex-direction:column) — also auf die HÖHE, nicht die Breite,
       und überschreibt damit das explizite height:90px. Breite kommt bei Partner bereits über
       align-items:stretch (Querachse) vom Wrapper, daher hier flex aus und Höhe fix wie bei
       den anderen Karten. */
    flex: 0 0 auto;
    height: 90px;
}

/* Time buttons (Uhrzeit / Stopwatch) in Climb category */
.recording-time-btn {
    -webkit-appearance: none;
    appearance: none;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 14px;
    height: 38px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    user-select: none;
    white-space: nowrap;
    outline: none;
}

.recording-time-btn[data-has-value="true"] {
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.recording-time-btn:hover:not(.not-interactive) {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.recording-time-btn:active:not(.not-interactive) {
    transform: translateY(0);
}

.recording-time-btn.not-interactive {
    cursor: default;
    pointer-events: none;
    opacity: 0.9;
}

#climbbuttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    padding: 4px 0;
}

/* Werte einsehbar, aber nicht editierbar außerhalb sessionEditMode (render.js renderRoute()).
   #climbbuttons selbst bleibt Klick-Ziel (pointer-events:none nur auf den Kindern), damit ein Klick
   dort als "auf climbbuttons geklickt" erkannt wird (render.js _skipItemsToggle) statt an
   .recording-category-items durchgereicht zu werden und ein Kollabieren auszulösen. #climbDesc
   (reiner Text ohne Kind-Steuerelemente) bekommt pointer-events:none direkt auf sich selbst. */
#climbbuttons.climb-fields-readonly * {
    pointer-events: none;
}
#climbDesc.climb-fields-readonly {
    pointer-events: none;
}
.climb-fields-readonly {
    opacity: 0.75;
}

#climbbuttons .custom-dropdown {
    width: auto;
    max-width: none;
}

#climbbuttons .dropdown-selected,
#climbbuttons .recording-time-btn {
    padding: 6px 12px;
    height: auto;
    white-space: nowrap;
}

.recording-time-btn--bucket {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    /* min-width statt fixer width — gleiches Vorgehen wie .recording-dropdown--bucket: wächst/
       schrumpft mit dem umgebenden Flex-Container (#climbbuttons) und füllt die verfügbare
       Zeilenbreite, statt bei 120px zu stoppen. */
    min-width: 100px;
    flex: 1 1 100px;
    height: 90px;
    box-sizing: border-box;
    padding: 6px 8px;
    border-radius: 7px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: inherit;
    gap: 2px;
    cursor: pointer;
}

.recording-time-btn--bucket[data-has-value="true"] {
    border-color: var(--border-color);
    color: inherit;
}

.recording-time-btn--bucket:hover:not(.not-interactive) {
    box-shadow: none;
    transform: none;
    opacity: 0.8;
}

.recording-time-btn--bucket .rdd-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-secondary);
    line-height: 1;
    white-space: nowrap;
}

/* Nur Partner: einziges Bucket-Feld mit variablem, potenziell langem Text (Nutzername) — die
   übrigen Felder (climbed, homogenity, ...) haben feste, kurze Vokabeln und sollen nicht
   pauschal mit-abgeschnitten werden. Attribut-Selector statt #id: Klone im dropdownOverlayHost
   (Vorschau-Zone/Chain-Strip, siehe _buildBucketPreviewZone/_renderBucketChainStrip) verlieren
   ihre id beim Klonen, data-recording-key bleibt aber erhalten (siehe Kommentar bei
   [data-recording-key="partner"].recording-dropdown--bucket oben). */
[data-recording-key="partner"] .rdd-label {
    /* width (nicht nur max-width) + min-width:0 — mit align-items:stretch oben (statt center) ist
       die Karte jetzt eine echte Bezugsgrösse; ohne min-width:0 würde der Flex-Item-Default
       (min-width:auto = nie schmaler als der eigene Inhalt) die Ellipsis weiterhin verhindern. */
    width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recording-time-btn--bucket .rdd-bar {
    width: 85%;
    height: 8px;
    border-radius: 4px;
    background: var(--border-color);
    opacity: 0.3;
    transition: background 0.2s, opacity 0.2s;
    flex-shrink: 0;
}

/* starsRatingContainer: gleiche dynamische Breite wie die übrigen #climbbuttons-Elemente
   (recording-dropdown--bucket/recording-time-btn--bucket/community-stats-bucket-item) — min-width
   statt fixer Breite, wächst/schrumpft mit dem umgebenden Flex-Container. */
#starsRatingContainer {
    min-width: 100px;
    flex: 1 1 100px;
    align-self: center;
}

/* recordTimestampBtn/recordStopwatchBtn: statt der üblichen Bucket-Karte (Icon oben, Label darunter,
   Bar unten) nur Icon + Zeit nebeneinander, teilen sich mit starsRatingContainer/untereinander die
   Zeile — gleiche min-width/flex-Regel wie die anderen #climbbuttons-Elemente statt frei wachsend
   (flex:1 1 auto), damit sie bei mehr Nachbarn nicht auf Kosten der anderen zu breit werden. */
#recordTimestampBtn,
#recordStopwatchBtn {
    min-width: 100px;
    flex: 1 1 100px;
    width: auto;
    height: auto;
    flex-direction: row;
    justify-content: flex-start;
    padding: 8px;
    gap: 6px;
}
#recordTimestampBtn .rdd-bar,
#recordStopwatchBtn .rdd-bar {
    display: none;
}
#recordTimestampBtn .rdd-label,
#recordStopwatchBtn .rdd-label {
    text-transform: none;
    letter-spacing: normal;
    font-size: 14px;
}

/* Tag Container */
.recording-tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
    padding: 5px;
    overflow: clip;
    max-height: 1000px;
    transition: max-height 0.6s ease, opacity 0.2s ease, padding 0.2s ease;
}
.recording-tag-container .recording-dropdown {
    flex-shrink: 0;
}

.recording-tag-group-sep {
    flex-basis: 100%;
    height: 0;
}

.recording-tag-btn {
    -webkit-appearance: none;
    appearance: none;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 5px 13px;
    height: 32px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    user-select: none;
    white-space: nowrap;
    outline: none;
}

.recording-tag-btn:hover:not(.not-interactive) {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.recording-tag-btn:active:not(.not-interactive) {
    transform: translateY(0);
}

.recording-tag-btn.active {
    color: #222 !important;
}

.recording-tag-btn.not-interactive {
    cursor: default;
    pointer-events: none;
}

/* ── Crux Cards ─────────────────────────────────────────────────────────── */
.crux-cards-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 0;
    overflow: clip;
    max-height: 4000px;
    transition: max-height 0.6s ease, opacity 0.2s ease, padding 0.2s ease;
}

.crux-card {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    padding: 10px 5px;
    width: 100%;
    margin: 0;
}

.crux-card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    user-select: none;
}

.crux-card--collapsed .crux-card-header {
    margin-bottom: 0;
}

.crux-card-label::after {
    content: '▼';
    font-size: 9px;
    display: inline-block;
    margin-left: 5px;
    transition: transform 0.22s ease;
    transform: rotate(0deg);
    opacity: 0.55;
    vertical-align: middle;
}

.crux-card--collapsed .crux-card-label::after {
    transform: rotate(-90deg);
}

.crux-card-body {
    overflow: hidden;
    max-height: 3000px;
    opacity: 1;
    transition: max-height 0.3s ease, opacity 0.2s ease;
}

.crux-card--collapsed .crux-card-body {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

.crux-card-label {
    font-size: 16px;
    font-weight: 700;
    color: var(--highlight-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.crux-link-btn,
.crux-remove-btn {
    -webkit-appearance: none;
    appearance: none;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
}

.crux-link-btn {
    margin-left: auto;
    transform: translateX(5px);
}

.crux-remove-btn {
    margin-left: 6px;
}

.crux-link-btn:hover {
    border-color: var(--accent-primary, #5d80a4);
    color: var(--accent-primary, #5d80a4);
}

.crux-link-btn--linked {
    border-color: #d4af37;
    color: #d4af37;
}

.crux-link-btn--readonly {
    cursor: default;
    pointer-events: none;
}

.crux-remove-btn:hover {
    border-color: #e05050;
    color: #e05050;
}

.crux-card-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
    margin-bottom: 6px;
}

.crux-card-row:last-child {
    margin-bottom: 0;
}

.crux-field-label {
    font-size: 11px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.crux-bolt-input {
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    outline: none;
    width: 81px;
}

.crux-bolt-input:focus {
    border-color: var(--accent-primary);
}

.crux-bolt-input[readonly] {
    cursor: default;
    pointer-events: none;
}

.crux-community-stats {
    margin-bottom: 8px;
}

.multipitch-pitch-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 5px;
    margin-right: 5px;
    align-self: center;
    white-space: nowrap;
}

.community-stats-buckets {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: flex-start;
    max-width: 100%;
    margin-bottom: 4px;
}

.community-stats-bucket-item {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    gap: 4px;
    white-space: nowrap;
    /* min-width statt fixer width — gleiches Vorgehen wie .recording-dropdown--bucket (Rate-Tab):
       wächst/schrumpft mit dem umgebenden Flex-Wrap-Container (.community-stats-buckets) und
       füllt die verfügbare Zeilenbreite, statt bei 120px zu stoppen. */
    min-width: 100px;
    flex: 1 1 100px;
    height: 90px;
    box-sizing: border-box;
    padding: 6px 8px;
    border-radius: 7px;
    border: 1px solid var(--border-color);
    background: transparent;
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
    color: inherit;
}

.community-stats-bucket-icon-row,
.community-stats-bucket-label-row,
.community-stats-bucket-dots-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
}

/* Anchor/Bolts (routePropertyBucketItem, render.js): Titel + Mehrheits-Badge sollen bewusst
   untereinander stehen statt nebeneinander (mehr Inhalt als die übrigen, einfacheren Buckets —
   Titel + Badge + schwebender Trust-Kreis) — Titel nimmt die volle Zeile ein, Badge wird dadurch
   auf die nächste Zeile gedrückt. Gilt gleichermassen für den Session-Rate-Tab-Mirror (Beta), da
   beide dieselbe Markup-Erzeugung teilen. */
.community-stats-bucket-item[data-field="anchor"] .community-stats-bucket-label-row,
.community-stats-bucket-item[data-field="bolts"] .community-stats-bucket-label-row {
    flex-wrap: wrap;
}
.community-stats-bucket-item[data-field="anchor"] .community-stats-bucket-title,
.community-stats-bucket-item[data-field="bolts"] .community-stats-bucket-title {
    flex: 1 0 100%;
    text-align: center;
}

/* routeForm (0.44): Bucket-Items zweispaltig statt dreizeilig gestapelt — links das Icon (über
   beide Zeilen vertikal zentriert), rechts Label- und Dots-Zeile übereinander. Bewusst nur für
   routeForm gescoped, NICHT für den Session-Rate-Tab-Mirror (#sessionForm) — der behält die
   bisherige vertikale 3-Zeilen-Anordnung aus der generischen .community-stats-bucket-item-Regel
   oben unverändert (beide teilen sich dieselbe Markup-Erzeugung, render.js, nur die Darstellung
   soll ab jetzt schrittweise auseinanderlaufen). */
#routeForm .community-stats-bucket-item {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    grid-template-areas:
        "icon label"
        "icon dots";
    column-gap: 4px;
    row-gap: 2px;
    /* Höhe/Breite richten sich jetzt nach dem Inhalt statt fixer 90px-Höhe und
       Gleichverteilung über die Zeilenbreite (siehe generische Regel oben, die für den
       Session-Mirror unverändert bleibt) — durch die zweispaltige Anordnung braucht es
       deutlich weniger Höhe als die alte dreizeilige Stapelung. */
    height: auto;
    min-width: 0;
    flex: 0 1 auto;
    padding: 0;
    padding-left: 10px;
    border: none;
}
#routeForm .community-stats-bucket-icon-row {
    grid-area: icon;
    align-self: start;
    padding-top: 5px;
}
#routeForm .community-stats-bucket-label-row {
    grid-area: label;
    justify-content: flex-start;
}
#routeForm .community-stats-bucket-dots-row {
    grid-area: dots;
    justify-content: flex-start;
    height: 37px;
    padding-bottom: 15px;
}
/* Ist ein Mehrheits-Badge da (Wert bereits bestimmt/bevotet), braucht es die Dot-Verteilung
   darunter nicht mehr — beides gleichzeitig wäre redundant. */
#routeForm .community-stats-bucket-item:has(.community-stats-bucket-majority) .community-stats-bucket-dots-row {
    display: none;
}
/* Anchor/Bolts-Titel linksbündig statt zentriert (generische Regel oben, die für den Session-Mirror
   unverändert bleibt) — passt zum linksbündigen Label/Dots-Layout der übrigen routeForm-Buckets. */
#routeForm .community-stats-bucket-item[data-field="anchor"] .community-stats-bucket-title,
#routeForm .community-stats-bucket-item[data-field="bolts"] .community-stats-bucket-title {
    text-align: left;
}

.recording-category--climbed .community-stats-bucket-item {
    cursor: pointer;
}

.recording-category--climbed .community-stats-bucket-item:active {
    opacity: 0.75;
}

.prof-menu-tile:active {
    opacity: 0.65;
}

#setupTopCategoryStats .community-stats-section-label,
#setupBoltsCategoryStats .community-stats-section-label,
#setupBelayCategoryStats .community-stats-section-label {
    width: 55px;
    min-width: 55px;
    max-width: 55px;
}


/* Custom Dropdown Styles */
.custom-dropdown {
    position: relative;
    width: 80%;
    max-width: 350px;
    user-select: none;
}

.dropdown-selected {
    width: 100%;
    padding: 5px 6px;
    border: 1px solid #fff;
    border-radius: 7px;
    background: var(--bg-secondary);
    backdrop-filter: blur(8px);
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dropdown-selected::after {
    content: '▼';
    font-size: 10px;
    transition: transform 0.3s ease;
}

.dropdown-selected:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

#sectorDropdown .sector-label,
#sectorDropdown .dropdown-selected {
    font-weight: 600;
    font-size: 18px;
}

#sectorDropdownRow .dropdown-selected {
    padding-top: 0px;
    padding-bottom: 0px;
    margin-bottom: 5px;
}

/* Spezielles Dropdown für routeForm - fest positioniert */
#routeFormDropdownOptions {
    position: fixed;
    top: 10px;
    left: 5px;
    right: 5px;
    bottom: auto;
    margin: 0;
    width: auto;
    max-width: calc(100% - 10px);
}

.dropdown-options {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(12px);
    max-height: 260px;
    overflow-y: auto;
    display: none;
    z-index: 2000;
}

.dropdown-options.dropdown-options--content-top {
    border-radius: 7px;
    width: 80%;
    /* Leere Fläche der Options-Box (Zwischenräume/Bereich unterhalb der letzten Zeile) soll Touches
       an den darunterliegenden data-bucket-chain-strip durchreichen (dessen natives horizontales
       Scrollen sonst von dieser Box abgefangen wird, siehe dockDropdownToContentTop/
       _renderBucketChainStrip) — pointer-events hier aus, auf den einzelnen Zeilen (.dropdown-option)
       unten gezielt wieder an, damit Tippen/Auswählen unverändert funktioniert. */
    pointer-events: none;
}

.dropdown-options.dropdown-options--content-top .dropdown-option {
    pointer-events: auto;
}
.dropdown-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    backdrop-filter:blur(4px);
    -webkit-backdrop-filter:blur(4px);
    z-index:2000;
    display: none;
    pointer-events: none;
}

.dropdown-backdrop.active {
    display: block;
    pointer-events: auto;
}

/* Inline overlay host (inside forms — partnerUser, sessionUsers, etc.) */
.dropdown-overlay-host {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 10px;
    z-index: 3500;
    pointer-events: none;
}

.dropdown-overlay-host.active {
    display: block;
}

.dropdown-overlay-host > .dropdown-options {
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 65vh;
    pointer-events: auto;
}

/* Top-level global dropdown backdrop (sibling of #bottom-editor in #main-container) */
#dropdownOverlayHost {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3500;
    display: none;
    pointer-events: none;
    background: transparent;
    transition: background 250ms ease, backdrop-filter 250ms ease;
}

#dropdownOverlayHost.active {
    display: block;
    pointer-events: auto;
    /* var(--bg-primary) allein ist voll deckend (kein Alphakanal in beiden Themes) und würde den
       backdrop-filter-Blur darunter komplett verdecken — halbtransparent per color-mix, analog
       zu #areaFormFilterContainer/#sectorFormFilterContainer > .filter-collapse-outer oben. */
    background: color-mix(in srgb, var(--bg-primary) 45%, transparent);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

#dropdownOverlayHost > .dropdown-options {
    position: absolute;
    top: 20%;
    left: 10px;
    right: 10px;
    width: auto;
    max-height: 70vh;
    pointer-events: auto;
    overflow-y: auto;
}

/* When the table-modal is docked into the global overlay host, only its own
   position needs to adapt to the host (which already fills the viewport);
   its own background/backdrop-filter keeps providing the blur (the host's
   blur is neutralized via inline style while docked — see closeTableModal /
   OpenSelectionTable — to avoid stacking two nested backdrop-filters, which
   blurs the host's own flat overlay color instead of the page behind it). */
#dropdownOverlayHost > .table-modal {
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
}

.dropdown-option {
    padding: 1px 6px 1px 1px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid rgba(100, 116, 139, 0.1);
}

.dropdown-option:last-child {
    border-bottom: none;
}

.dropdown-option[data-has-value="true"] {
    background: rgba(68, 54, 72, 0.35);
}

.dropdown-option:hover {
    background: rgba(68, 54, 72, 0.5);
}

.dropdown-option:active {
    background: rgba(68, 54, 72, 0.8);
}

@media (max-width: 768px) {
    .custom-dropdown {
        width: 95%;
    }
    
    .dropdown-selected {
        font-size: 13px;
        padding: 5px;
    }
    
    .dropdown-option {
        font-size: 13px;
        padding: 10px 14px;
    }
}

.route-delete {
    background: transparent;
    border: none;
    color: var(--accent-danger);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.route-delete:hover { 
    color: #dc2626;
    transform: scale(1.1);
}

/* === 7. Gebiete-Liste === */
#areasList {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Platzhalter für BottomBar */
.bottom-bar-spacer {
    display: none;
    height: 80px;
    flex-shrink: 0;
}

html[data-panel-style="flush"] .bottom-bar-spacer {
    display: block;
}

.list-header {
    flex-shrink: 0;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--accent-primary);
    margin-bottom: 10px;
}

#areasList h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 700;
}

.file-actions {
    display: flex;
    gap: 10px;
}

.btn-icon {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

/* Bleibt beim Scrollen der Area-Liste oben im Scroll-Body (#areasListTab1) stehen — Blur-Hintergrund
   analog zu #areaFormFilterContainer, damit darunter scrollende Area-Karten nicht durchscheinen. */
.areas-toolbar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
    padding: 6px 0;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 5;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.areas-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.areas-search {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    padding: 9px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--bg-primary) 60%, transparent);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

/* Map-Edit-Mode-Stift — löst den Map-Edit-Mode-Zweig des ehemals schwebenden #btn_panelsave ab
   (siehe main.js, war vorher nur bei leerem Panel/keiner Area erreichbar, jetzt fest hier). Nicht
   admin-gated, wie das bisherige Verhalten. */
.areas-search-row-btn {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.areas-search-row-btn.edit-active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: rgba(16, 185, 129, 0.5);
    color: #fff;
}

.areas-search:focus {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

/* newForm-Close-Button — newForm hat (anders als areaForm/sectorForm/...) keinen eigenen
   Zurück-Button mehr, seit #btn_panelclose ausserhalb von MenuForm-Forms ausgeblendet ist. */
.new-form-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--bg-card) 90%, transparent);
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 6;
    flex-shrink: 0;
}

/* Sortier-Dropdown rechts neben #areasSearch (#btn_areasSort, Wiring in map.js). */
.areas-sort-wrap {
    position: relative;
    flex-shrink: 0;
}

.areas-sort-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 150px;
    padding: 6px;
    flex-direction: column;
    gap: 4px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 20;
}

.areas-sort-menu.open {
    display: flex;
}

.areas-sort-menu-title {
    padding: 4px 8px 2px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.areas-sort-btn {
    width: 100%;
    padding: 8px 10px;
    text-align: left;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.areas-sort-btn.active {
    background: color-mix(in srgb, var(--highlight-color) 15%, transparent);
    border-color: var(--highlight-color);
    color: var(--highlight-color);
}

.areas-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: 15px;
    padding-bottom: 30px;
    padding-left: 5px;
    padding-right: 5px;
}

.area-item {
    background: linear-gradient(135deg, color-mix(in srgb, var(--bg-card) 65%, transparent) 0%, color-mix(in srgb, var(--bg-tertiary) 65%, transparent) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.area-item.is-selected {
    border-left: 3px solid #ffd700;
}

.area-item:hover, .area-item:active {
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15) 0%, rgba(124, 58, 237, 0.15) 100%);
    box-shadow: var(--shadow-glow);
}

.area-item-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.area-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 16px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.area-dist {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.area-dist-arrow {
    display: inline-flex;
    color: var(--text-primary);
    transform-origin: center;
    line-height: 1;
}

.area-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-top: 2px;
}

.area-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.area-last-session {
    font-size: 12px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.area-grade-range {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0px;
    margin-top: 4px;
}

.area-item .grade-div,
.area-item .length-div {
    min-width: 38px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    font-weight: bold;
    font-size: 12px;
    display: inline-block;
    color: #333;
    border-radius: 4px;
    padding: 0 4px;
}

.empty-message {
    text-align: center;
    color: var(--text-tertiary);
    padding: 30px 20px;
    font-style: italic;
    font-size: 14px;
}

.area-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 8px 0;
    line-height: 1.5;
    max-height: 42px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* === 8. Popups & Marker === */
.custom-marker {
    background: none !important;
    border: none !important;
}

.leaflet-div-icon {
    background: none !important;
    border: none !important;
}

.leaflet-popup-content-wrapper {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(22, 33, 62, 0.95) 100%) !important;
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.leaflet-popup-content {
    min-width: 200px;
    color: var(--text-primary);
    margin: 16px;
}

.leaflet-popup-tip {
    background: var(--bg-card) !important;
}

.leaflet-popup-content .area-description-popup {
    margin: 10px 0;
    padding: 10px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* === 9. Scrollbar Styling === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 15, 35, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: 10px;
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--accent-secondary) 0%, var(--accent-primary) 100%);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

/* === 10. Responsive & Sonstiges === */
@media (max-width: 768px) {
    .area-desc textarea {
        min-height: 60px;
        padding: 10px;
    }
    .area-description {
        font-size: 12px;
        -webkit-line-clamp: 1;
    }
    .contentForm {
        padding: 16px 5px;
    }
}

/* === 11. Stars Rating Container === */
.stars-rating-container {
    display: inline-flex;
    gap: 2px;
    margin-right: 1px;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 2px 4px;
}

.star-rating {
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #ccc;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.star-rating:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.8));
}

/* === 12. Table Selection Modals === */
#btn_panelsave.table-modal-hide-save {
    display: none !important;
}

.table-modal {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 15, 35, 0.9);
    backdrop-filter: blur(12px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.table-modal > div {
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    padding: 28px 10px;
    padding-top: 0px;
    border-radius: 7px;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    max-height: 85vh;
    overflow-y: auto;
    min-width: 320px;
    max-width: 500px;
}


.selection-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 4px;
    /* Own stacking context so the sticky header's z-index is compared only
       against this table's rows, not bled through by ancestor contexts
       (table-modal's backdrop-filter etc.) — avoids body rows painting over
       the sticky header while scrolling on some browsers. */
    isolation: isolate;
}

.selection-table td,
.selection-table th {
    padding: 12px 16px !important;
    color: var(--text-opposite);
    font-size: 14px;
}

.selection-table tr:first-child {
    position: sticky;
    top: 0;
    z-index: 100;
    opacity: 1;
}


.selection-table th {
    background: var(--bg-tertiary) 0%;
    color: var(--text-primary);
    font-weight: 700;
    text-align: left;
    border-bottom: 2px solid var(--accent-primary);
    position: sticky;
    top: 0;
    z-index: 100;
    /* border-spacing leaves a transparent gap below the sticky header through
       which scrolling rows are visible underneath; mask exactly that gap. */
    box-shadow: 0 4px 0 0 var(--bg-tertiary);
}

.selection-table tr {
    position: relative;
    z-index: 1;
    transition: all 0.2s ease;
    border-radius: 8px;
    opacity: 0.6;
}

.selection-table tr:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
    opacity: 0.8;
}

.selection-table-reset-row td {
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border-style: dashed;
}

.selection-table-reset-row:hover td {
    color: #f44336;
    border-color: #f44336;
}

.selection-table td {
    background: inherit;
    border: 1px solid var(--border-color);
}

.selection-table td:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.selection-table td:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* === 13. NoScript Warning === */
.noscript-warning {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, var(--accent-danger) 0%, #dc2626 100%);
    color: white;
    padding: 30px 40px;
    border-radius: 20px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    box-shadow: var(--shadow-lg);
    z-index: 99999;
}

/* === 14. Multi-pitch Toggle === */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: transparent;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 10px;
    width: 10px;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider {
    border-color: var(--bg-secondary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translate(14px, -50%);
    background-color: var(--bg-secondary);
}

.version-container {
    margin: 20px auto 20%;
    padding: 10px 16px;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    max-width: 500px;
}

.version-container span {
    letter-spacing: 0.02em;
}
/* ==========================================
   Touch-optimierter Timepicker
   ========================================== */

.timepicker-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timepicker-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
}

.timepicker-container {
    position: relative;
    background-color: var(--bg-primary);
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.timepicker-header {
    padding: 16px 20px;
    background-color: var(--bg-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.timepicker-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.timepicker-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.timepicker-close:hover {
    color: var(--text-primary);
}

.timepicker-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.timepicker-display {
    text-align: center;
    font-size: 48px;
    font-weight: 300;
    color: var(--text-primary);
    margin-bottom: 20px;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

.timepicker-separator {
    margin: 0 4px;
}

.timepicker-selector {
    margin-top: 20px;
}

.timepicker-options {
    display: grid;
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
    padding: 4px;
}

/* Stunden-Grid: 6 Spalten für 24 Stunden */
#timepickerHours {
    grid-template-columns: repeat(6, 1fr);
}

/* Minuten-Grid: 2 Spalten für 4 Optionen (15min Takt) */
#timepickerMinutes {
    grid-template-columns: repeat(2, 1fr);
    max-height: none;
}

#timepickerMinutes .timepicker-option {
    font-size: 24px;
    min-height: 80px;
}

.timepicker-option {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.timepicker-option:hover {
    background-color: var(--bg-hover);
}

.timepicker-option.selected {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.timepicker-option:active {
    transform: scale(0.95);
}

.timepicker-footer {
    padding: 16px 20px;
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.timepicker-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.timepicker-btn-clear {
    background-color: transparent;
    color: var(--text-secondary);
    margin-right: auto;
}

.timepicker-btn-clear:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.timepicker-btn-cancel {
    background-color: transparent;
    color: var(--text-secondary);
}

.timepicker-btn-cancel:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.timepicker-btn:active {
    transform: scale(0.97);
}

/* Scrollbar für Timepicker-Optionen */
.timepicker-options::-webkit-scrollbar {
    width: 6px;
}

.timepicker-options::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 3px;
}

.timepicker-options::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.timepicker-options::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* === Bottom Bar === */

.bottom-bar {
    height: auto;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    position: fixed;
    bottom: 10px;
    left: 10px;
    right: 10px;
    padding: 0;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    /* flex-end statt space-around: die Items haben feste, viewport-relative Breiten (siehe
       .bottom-bar-item) statt flex:1 — dadurch packen sie sich von rechts nach links, egal wie
       schmal der Container gerade ist (siehe .bottom-bar--collapsed unten). */
    justify-content: flex-end;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
    box-shadow: var(--shadow-md);
    z-index: 100;
    --active-tab: 0;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Kein selectedAreaId: Topo/Session brauchen eine Area und werden ausgeblendet (siehe
   _updateBottomBarAreaState in main.js). Der Container schrumpft dafür von links (right bleibt
   10px fest) — 2 von 5 Slots Breite verschwinden, die restlichen 3 (Map/History/Profil) behalten
   dank fester Item-Breite + flex-end + overflow:hidden exakt Grösse und Position bei; Topo/Session
   laufen dabei einfach über den neuen linken Rand hinaus und werden dort geclippt.
   Zweistufig, siehe .bottom-bar-item[data-tab="topo"/"session"] unten: Schliessen faded die Icons
   zuerst aus (0.2s, kein delay) und schrumpft danach die Bar (delay 0.2s); Öffnen läuft umgekehrt
   — Bar wächst zuerst (kein delay, siehe Basis-Regel oben), Icons faden erst danach ein
   (delay 0.4s = Wachstumsdauer). Die Transition-Delays sitzen dafür bewusst auf den jeweiligen
   Ziel-Zustands-Regeln (CSS nimmt für Transitions immer die Werte des Endzustands). */
#bottomBar.bottom-bar--collapsed {
    left: calc(10px + (100vw - 20px) * 2 / 5);
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.2s;
}

/* Gleitender Tab-Indikator — von rechts verankert (right:0) statt von links, mit fester statt
   prozentualer Breite: passt so unabhängig davon, wie schmal der Container gerade ist (siehe
   .bottom-bar--collapsed). --active-tab zählt entsprechend von rechts (0 = letztes Icon). */
.bottom-bar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: calc((100vw - 20px) / 5);
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0;
    transform: translateX(calc(var(--active-tab) * -100%));
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    pointer-events: none;
}

#bottomBarBG {
    position: absolute;
    background: linear-gradient(180deg, var(--bottombar-bg-start) 0%, var(--bottombar-bg-end) 100%);
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    box-shadow: var(--bottombar-shadow);
}

.bottom-bar-item {
    /* Feste, viewport-relative Breite statt flex:1 — bleibt konstant, egal wie viele Geschwister
       gerade sichtbar sind oder wie schmal der Container ist (siehe .bottom-bar--collapsed). Ohne
       das würden sich beim Ein-/Ausblenden von Topo/Session auch Map/History/Profil mitverschieben. */
    flex: 0 0 calc((100vw - 20px) / 5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 5px 10px;
    gap: 2px;
    color: var(--text-secondary);
    position: relative;
    z-index: 2;
}

.bottom-bar-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.bottom-bar-item.active {
    color: var(--highlight-color);
}

/* Fade-Stufe der zweistufigen Ein-/Ausblend-Animation (siehe #bottomBar.bottom-bar--collapsed
   oben): Öffnen (diese Regel greift, sobald .bottom-bar--collapsed entfernt wird) faded erst nach
   dem Wachsen der Bar ein (delay 0.4s = deren Wachstumsdauer). */
.bottom-bar-item[data-tab="topo"],
.bottom-bar-item[data-tab="session"] {
    opacity: 1;
    transition: all 0.3s ease, opacity 0.2s ease 0.4s;
}

/* Schliessen (diese Regel greift, sobald .bottom-bar--collapsed gesetzt wird) faded sofort aus
   (kein delay) — die Bar schrumpft erst danach (delay 0.2s, siehe oben). */
.bottom-bar--collapsed .bottom-bar-item[data-tab="topo"],
.bottom-bar--collapsed .bottom-bar-item[data-tab="session"] {
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease, opacity 0.2s ease;
}

.bottom-bar-icon {
    width: 28px;
    height: 28px;
    color: inherit;
}

.bottom-bar-item[data-tab="topo"] .bottom-bar-icon {
    width: 30.8px;
    height: 30.8px;
}

.bottom-bar-label {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    color: inherit;
}

/* === Recording-category level-based title sizes === */

/* Level 1: top-level recording-category title */
.recording-category > .recording-category-title {
    font-size: 20px;
}

/* Level 2: nested inside recording-category-items */
.recording-category-items > .recording-category > .recording-category-title {
    font-size: 11px;
}

/* History category level-based title sizes */
.history-category > .history-category-title {
    font-size: 28px;
}

.history-category-items > .history-category > .history-category-title {
    font-size: 17px;
}

/* sectorsCategory / routesCategory / routesCategorySector: flat list style */
#sectorsCategory,
#routesCategory,
#routesCategorySector {
    cursor: pointer;
    padding-left: 0;
    padding-right: 0;
    padding-top: 5px;
    padding-bottom: 0;
    margin-bottom: 15px;
    border: none;
}

#sectorsCategory > .recording-category-title,
#routesCategory > .recording-category-title,
#routesCategorySector > .recording-category-title {
    padding-left: 15px;
}

/* sectorsCategory/routesCategory sind nicht einklappbar verdrahtet — die generische
   .recording-category-items-Grenze (max-height:1000px, fürs Auf-/Zuklapp-Transition
   anderer Kategorien gedacht) schneidet hier nur lange Routen-/Sektorenlisten ab.
   routesCategorySector IST einklappbar (renderSector-Toggle) und bekommt daher nur
   eine grosszügigere Grenze statt komplett ohne Cap, damit die Animation erhalten bleibt. */
#sectorsCategory > .recording-category-items,
#routesCategory > .recording-category-items {
    max-height: none;
}

#routesCategorySector > .recording-category-items {
    max-height: 6000px;
}

/* Sektor-Overlay (dropdownOverlayHost-Klon von #sectorsCategory, siehe
   _showSectorPickerWithTabs in render.js): der Klon wird auf max-height geclippt,
   die generischen 5px padding-bottom reichen nicht damit der letzte Sektor nicht
   knapp abgeschnitten wirkt. */
#dropdownOverlayHost #sectorsCategory > .recording-category-items {
    padding-bottom: 20px;
}

/* Gleiche Farben/Blur wie #historyFilterContainer (.sticky-filter-container: opacity 0.9,
   transparenter Hintergrund; Blur kommt dort von der .form-sticky-header-Ahnenzeile mit
   blur(16px) durch) — .recording-category bringt sonst nur blur(8px) und keine opacity mit. */
#dropdownOverlayHost #sectorsCategory {
    background: transparent;
    opacity: 0.9;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

#mapLoadingOverlay {
    position: absolute;
    inset: 0;
    background: var(--bg-primary);
    /* Höher als .bottom-bar (z-index:100, fixed, liegt als Kind von #map-container im selben
       Stacking-Kontext) — sonst schaut die Bottom-Bar während des Ladens oben durch den Ladecircle
       durch. */
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

#mapLoadingOverlay::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: mapSpinner 0.8s linear infinite;
}

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

/* Ladeanzeige in der areaForm-Tab-Leiste, solange Sektoren/Routen laden (map.js _setAreaFormLoading) */
.form-tab-loading {
    width: 16px;
    height: 16px;
    margin-left: auto;
    margin-right: 12px;
    align-self: center;
    flex-shrink: 0;
    border: 2px solid rgba(128,128,128,0.25);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: mapSpinner 0.8s linear infinite;
}

#deepLinkOverlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

#deepLinkOverlay::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: mapSpinner 0.8s linear infinite;
}

.map-style-control-btn {
    font-size: 15px;
    line-height: 26px !important;
}

.map-style-control-btn svg {
    margin-top: 6px;
}

/* locateBtn hängt jetzt (siehe map.js MapStyleControl.onAdd) im selben .leaflet-bar direkt unter
   map-style-control-btn — hier auf dessen Leaflet-Bar-Optik umgestellt statt der bisherigen
   schwebenden runden Buttons (siehe .locate-btn oben für die Zustands-Farben locating/located/
   tracking-active, die unverändert weiter funktionieren). */
.map-style-control #locateBtn {
    width: 30px;
    height: 29px;
    background-color: #fff;
    background-image: none;
    border: none;
    border-radius: 0 0 4px 4px;
    box-shadow: none;
    backdrop-filter: none;
    padding: 0;
    transform: none;
}

.map-style-control #locateBtn:hover {
    background-color: #f4f4f4;
    box-shadow: none;
    transform: none;
}

.map-style-control #locateBtn svg {
    width: 16px;
    height: 16px;
}

.map-style-control-list {
    position: fixed;
    z-index: 10001;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.65);
    overflow: hidden;
    white-space: nowrap;
}

.map-style-control-list .map-style-control-item {
    display: block;
    padding: 6px 14px;
    font-size: 12px;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #eee;
}

.map-style-control-list .map-style-control-item:last-child {
    border-bottom: none;
}

.map-style-control-list .map-style-control-item:hover {
    background: #f4f4f4;
}

.map-style-control-list .map-style-control-item.active {
    font-weight: 700;
    background: #eef2f7;
}
