/* Custom Styling für App-Feeling */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Marker Styles */
.user-location-arrow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    z-index: 1000;
    transition: transform 0.1s linear;
    pointer-events: none;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f3f4f6;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.3s ease, color 0.3s ease;
    /* Mobile Optimierungen */
    -webkit-text-size-adjust: 100%;
    /* Verhindert automatische Text-Vergrößerung auf iOS */
    text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    /* Bessere Schriftdarstellung */
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    /* min-height: -webkit-fill-available; <-- REMOVED: Causes scroll issues on iOS */
    overscroll-behavior-y: none;
    /* Prevent scroll bounce */
}

/* Dark Mode Styles */
body.dark-mode {
    background-color: #000000;
    color: #e5e5e5;
}

body.dark-mode .bg-gray-50 {
    background-color: #000000 !important;
}

body.dark-mode .bg-white {
    background-color: #0f0f0f;
    /* Removed !important to allow gradient overrides */
}

body.dark-mode .text-gray-800 {
    color: #e5e5e5 !important;
}

body.dark-mode .text-gray-700 {
    color: #d4d4d4 !important;
}

body.dark-mode .text-gray-600 {
    color: #a3a3a3 !important;
}

body.dark-mode .text-gray-500 {
    color: #737373 !important;
}

body.dark-mode .border-gray-100,
body.dark-mode .border-gray-200 {
    border-color: #1a1a1a !important;
}

body.dark-mode .shadow-sm,
body.dark-mode .shadow-lg {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5) !important;
}

/* Input-Felder: Immer schwarzer Text (außer Dark Mode) */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="search"],
textarea,
select {
    color: #000000 !important;
    color: #000000 !important;
    cursor: text !important;
}

/* Ensure canvas (confetti) doesn't block clicks */
canvas {
    pointer-events: none !important;
}

/* Force default cursor on body and sections to prevent disappearing issues */
html,
body,
.page-section {
    cursor: auto !important;
}

/* Ensure inputs always show text cursor */
input,
textarea {
    cursor: text !important;
}

/* Name, Aktivitäten, Scout Reporter: Schwarz im Light Mode (wird im Dark Mode überschrieben) */
#profile-name-display,
#activities h2,
#report h2,
#report label,
#settings h2 {
    color: #000000;
}

#settings h2,
#report .font-bold:not(.bg-red-600):not(.bg-red-700) {
    color: #000000 !important;
}

/* WICHTIG: Dark Mode Override MUSS spezifischer sein als die ID-Regeln oben */
body.dark-mode #profile-name-display,
body.dark-mode #activities h2,
body.dark-mode #report h2,
body.dark-mode #report label,
body.dark-mode #settings h2,
body.dark-mode #report .font-bold:not(.bg-red-600):not(.bg-red-700) {
    color: #ffffff !important;
}

body.dark-mode #report label,
body.dark-mode #settings h2 {
    color: #ffffff !important;
}

#map {
    pointer-events: auto !important;
    touch-action: none !important;
    z-index: 1 !important;
}

/* Ensure overlays don't block map (RELAXED) */
#mobility {
    /* pointer-events: none !important; REMOVED to prevent interaction issues */
    height: 100vh;
    /* Force full height */
    width: 100%;
}

/* Re-enable pointer events for map and controls */
#mobility #map,
#mobility #map-weather-badge,
#mobility .pointer-events-auto {
    pointer-events: auto !important;
}

/* WICHTIG: Mobility Section MUSS Flex sein, damit die Karte wachsen kann */
#mobility.page-section.active {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    /* Allow top/bottom anchors to define height */
    overflow: hidden !important;
    padding-bottom: 0 !important;
    /* No nav padding for map */
    position: fixed !important;
    top: calc(64px + env(safe-area-inset-top, 0px));
    /* Start below header */
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 150 !important;
    /* Unter Nav (200), aber über Rest */
}

#report button[type="submit"],
button.bg-red-600,
button.bg-red-700 {
    color: white !important;
}

body.dark-mode input,
body.dark-mode textarea,
body.dark-mode select {
    background-color: #1a1a1a !important;
    color: #e5e5e5 !important;
    border-color: #2d2d2d !important;
}

body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
    color: #737373 !important;
}

body.dark-mode .mobile-nav {
    background: #0a0a0a !important;
    border-color: #1a1a1a !important;
}

/* Dark Mode für Header - nur Farben ändern, Position/Sichtbarkeit beibehalten */
body.dark-mode #main-header:not(.hidden) {
    background-color: #0f0f0f !important;
    border-bottom: 1px solid #1f1f1f !important;
    /* Position und Sichtbarkeit bleiben unverändert */
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 40 !important;
}

body.dark-mode #main-header:not(.hidden) h1,
body.dark-mode #main-header:not(.hidden) .text-slate-800 {
    color: #e5e5e5 !important;
}

body.dark-mode #main-header:not(.hidden) .text-red-600,
body.dark-mode #main-header:not(.hidden) span.text-red-600 {
    color: #ef4444 !important;
}

body.dark-mode #main-header:not(.hidden) .text-gray-600 {
    color: #d4d4d4 !important;
}

/* Glasmorphism im Dark Mode */
body.dark-mode .glass-panel {
    background: rgba(15, 15, 15, 0.95) !important;
    border-color: rgba(26, 26, 26, 0.2) !important;
}

/* Karten und Container */
body.dark-mode .rounded-2xl,
body.dark-mode .rounded-xl {
    background-color: #0f0f0f;
}

/* Text-Kontraste */
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode .font-bold {
    color: #f5f5f5 !important;
}

/* Buttons behalten ihre Farben (Rot bleibt Rot, Orange bleibt Orange) */
body.dark-mode .bg-red-600 {
    background-color: #dc2626 !important;
}

body.dark-mode .bg-red-700 {
    background-color: #b91c1c !important;
}

body.dark-mode .bg-red-600:hover {
    background-color: #b91c1c !important;
}

body.dark-mode .bg-red-700:hover {
    background-color: #991b1b !important;
}

/* Links und interaktive Elemente */
body.dark-mode .text-red-600 {
    color: #ef4444 !important;
}

body.dark-mode .text-red-700 {
    color: #dc2626 !important;
}

/* Hintergrund-Overlays */
body.dark-mode .bg-red-50 {
    background-color: #1a0a0a !important;
}

body.dark-mode .bg-green-50 {
    background-color: #0a1a0a !important;
}

body.dark-mode .bg-green-100 {
    background-color: #0d2e0d !important;
    /* Dunkles Grün für Umwelt-Held Badge */
}

body.dark-mode .text-green-700 {
    color: #4ade80 !important;
    /* Helleres Grün für Lesbarkeit auf dunklem Hintergrund */
}

body.dark-mode .text-green-600 {
    color: #22c55e !important;
    /* Grün bleibt grün im Dark Mode (z.B. CO2 eingespart) */
}

body.dark-mode .bg-blue-50 {
    background-color: #0a0f1a !important;
}

/* Border-Styling */
body.dark-mode .border-white {
    border-color: #1a1a1a !important;
}

/* Navigation Active State */
body.dark-mode .nav-item.active {
    background: rgba(220, 38, 38, 0.15) !important;
}

/* Toast im Dark Mode */
body.dark-mode #toast {
    background: #0f0f0f !important;
    border: 1px solid #1a1a1a !important;
}

body.dark-mode #toast-icon.text-red-400 {
    color: #f87171 !important;
    /* Helleres Rot für bessere Sichtbarkeit */
}

body.dark-mode #toast-icon.text-green-400 {
    color: #4ade80 !important;
    /* Helleres Grün für bessere Sichtbarkeit */
}

/* Luftqualitäts-Grid im Dark Mode */
body.dark-mode #airQualityChart .bg-white {
    background-color: #1a1a1a !important;
}

body.dark-mode #airQualityChart .border-gray-200 {
    border-color: #2a2a2a !important;
}

body.dark-mode #airQualityChart .text-gray-500 {
    color: #9ca3af !important;
}

body.dark-mode #airQualityChart .text-gray-400 {
    color: #6b7280 !important;
}

/* Rangliste im Dark Mode */
body.dark-mode #leaderboard-list .bg-gray-50 {
    background-color: #1a1a1a !important;
}

body.dark-mode #leaderboard-list .bg-red-50 {
    background-color: #2a0f0f !important;
}

body.dark-mode #leaderboard-list .border-red-300 {
    border-color: #dc2626 !important;
}

body.dark-mode #leaderboard-list .text-gray-800 {
    color: #e5e7eb !important;
}

body.dark-mode #leaderboard-list .text-gray-600 {
    color: #9ca3af !important;
}

body.dark-mode #leaderboard-list .text-gray-500 {
    color: #6b7280 !important;
}

/* Dark Mode: Buttons mit Border */
body.dark-mode button.border-2 {
    border-color: #2d2d2d !important;
    background-color: #1a1a1a !important;
}

body.dark-mode button.border-2:hover {
    background-color: #0f0f0f !important;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Glassmorphism für Schnellzugriff-Buttons */
.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

.glass-card:hover {
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.25);
}

/* Dark Mode für Glass-Cards */
body.dark-mode .glass-card {
    background: rgba(15, 15, 15, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

body.dark-mode .glass-card:hover {
    background: rgba(15, 15, 15, 0.8);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
}

body.dark-mode .glass-card .text-gray-800 {
    color: #e5e5e5 !important;
}

/* Karte soll den verfügbaren Platz füllen */
#map {
    height: 100%;
    width: 100%;
    z-index: 1;
    min-height: 300px;
    flex: 1 1 auto;
    /* Verhindere Verzerrung auf iPhone */
    max-width: 100vw;
    overflow: hidden;
}

/* Mobile Navigation unten */
.mobile-nav {
    position: fixed !important;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 200 !important;
    padding-bottom: max(env(safe-area-inset-bottom), 8px);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    min-height: 65px;
}

.mobile-nav>div {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-around;
}

.nav-item {
    color: #6b7280;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    min-width: 48px;
    /* Mindest-Touch-Target-Größe für mobile Geräte */
    touch-action: manipulation;
    /* Verhindert Doppel-Tap-Zoom auf iOS */
}

/* Stelle sicher, dass alle Nav-Items auf gleicher Höhe sind */
.nav-item i {
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Stelle sicher, dass alle Nav-Text-Labels auf einer Linie sind */
.nav-item span {
    line-height: 1;
    margin-top: 2px;
}

.nav-item.active {
    color: #dc2626 !important;
    /* Braunschweig Rot */
    transform: translateY(-2px);
    background: rgba(220, 38, 38, 0.05) !important;
    border: 2px solid rgba(220, 38, 38, 0.3) !important;
    border-radius: 12px;
}

/* Stelle sicher, dass aktive Navigation-Elemente immer sichtbar sind */
button.nav-item.active,
div.nav-item.active {
    color: #dc2626 !important;
    background: rgba(220, 38, 38, 0.05) !important;
    border: 2px solid rgba(220, 38, 38, 0.3) !important;
    transform: translateY(-2px);
}

/* Erhöhe Spezifität für Navigation-Buttons */
nav .nav-item.active {
    color: #dc2626 !important;
    background: rgba(220, 38, 38, 0.05) !important;
    border: 2px solid rgba(220, 38, 38, 0.3) !important;
}

.nav-item.active i {
    color: #dc2626 !important;
    background: rgba(220, 38, 38, 0.1) !important;
    padding: 8px;
    border-radius: 12px;
    position: relative;
    z-index: 2;
}

.nav-item.active span {
    color: #dc2626 !important;
    position: relative;
    z-index: 2;
}

/* Action Button (Kamera) */
.action-btn {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.4);
    transition: all 0.3s ease;
}

/* Header Sichtbarkeit sicherstellen - überschreibt Tailwind hidden */
#main-header.hidden {
    display: none !important;
    visibility: hidden !important;
}

/* Header immer fixiert oben */
#main-header:not(.hidden) {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 9999 !important;
    background-color: white !important;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1) !important;
    will-change: transform !important;
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(64px + env(safe-area-inset-top, 0px));
}

/* Dark Mode für Header */
body.dark-mode #main-header:not(.hidden) {
    background-color: #0f0f0f !important;
    border-bottom: 1px solid #1f1f1f !important;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.5) !important;
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(64px + env(safe-area-inset-top, 0px));
}

/* Stelle sicher, dass alle Header-Kinder sichtbar sind */
#main-header:not(.hidden)>* {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#main-header:not(.hidden) h1 {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #1e293b !important;
    /* slate-800 */
}

#main-header:not(.hidden) .text-red-600 {
    color: #dc2626 !important;
}

/* Padding für main-Container, damit Content nicht unter fixed Header verschwindet */
/* Wird bereits im inline style gesetzt: padding-top: calc(64px + env(safe-area-inset-top, 0px)) */

/* Zusätzliche Sicherheit für Mobile */
@media (max-width: 768px) {
    #main-header:not(.hidden) {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 9999 !important;
        padding-top: env(safe-area-inset-top, 0px);
        height: calc(64px + env(safe-area-inset-top, 0px));
    }

    /* Stelle sicher, dass Header-Inhalt sichtbar ist */
    #main-header:not(.hidden) h1 {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        color: #1e293b !important;
    }

    #main-header:not(.hidden) .bg-red-600 {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        background-color: #dc2626 !important;
    }

    #main-header:not(.hidden) #header-avatar-container {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    #main-header:not(.hidden) #header-level,
    #main-header:not(.hidden) #header-points {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    #main-header:not(.hidden) .flex {
        display: flex !important;
        visibility: visible !important;
    }
}

/* Kamera-Button Position anpassen */
@media (max-width: 768px) {

    /* Header auf Mobile immer sichtbar (wenn nicht auf Login/Register) */
    #main-header:not(.hidden) {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Zusätzliche Sicherheit: Überschreibe Tailwind hidden auf Mobile */
    #main-header.hidden {
        display: none !important;
    }

    /* Profilbild auf Mobile ganz rechts positionieren */
    #main-header>div:last-child {
        margin-left: auto;
    }

    /* Profil-Container auf Mobile: nur Avatar, kein Text */
    #main-header>div:last-child>div {
        gap: 0;
    }

    .mobile-nav .relative.-top-4 {
        top: -14px;
        /* Etwas weniger als -top-5 (20px), etwas mehr als -top-3 (12px) */
    }
}

.action-btn:active {
    transform: scale(0.95);
}

.action-btn.nav-item.active {
    background: linear-gradient(135deg, #dc2626, #ef4444) !important;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.3), 0 4px 15px rgba(220, 38, 38, 0.4) !important;
    border-color: rgba(220, 38, 38, 0.3) !important;
}

.action-btn.nav-item.active::before {
    display: none;
    /* Kein zusätzlicher Rahmen für Action-Button */
}

/* Gamification Animation */
@keyframes pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.pop-anim {
    animation: pop 0.3s ease-out;
}

@keyframes breathe {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 15px rgba(220, 38, 38, 0.5);
    }
}

.animate-bounce-slow {
    animation: breathe 4s infinite ease-in-out;
}

/* Loading Button Animation */
.loading-btn {
    pointer-events: none;
    opacity: 0.8;
    position: relative;
    color: transparent !important;
    /* Hide text */
}

.loading-btn::after {
    content: "";
    position: absolute;
    width: 24px;
    height: 24px;
    top: 50%;
    left: 50%;
    margin-top: -12px;
    margin-left: -12px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes shimmer {
    0% {
        transform: translateX(-150%);
    }

    100% {
        transform: translateX(150%);
    }
}

/* Verstecke Scrollbars aber erlaube Scrollen */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.page-section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
    padding-bottom: 80px;
    /* Platz für Nav */
    /* Verhindere horizontales Scrollen auf iPhone */
    overflow-x: hidden;
    max-width: 100vw;
    width: 100%;
}

/* Mehr Platz am Ende für Login/Register/About/Imprint/Settings/Profile/Home auf Mobile */
/* FORCE OVERLAY MODE FOR LOGIN/REGISTER to solve cutoff issues */
#login.page-section,
#register.page-section {
    display: flex;
    flex-direction: column;
    /* Use fixed positioning to overlay everything (Header, Main Padding, etc.) */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    /* Revert to vw to ensure full coverage */
    max-width: none !important;
    /* OVERRIDE Tailwind max-w-md */
    height: 100vh !important;
    height: 100dvh !important;
    /* Mobile Viewport Fix */
    align-items: center !important;
    /* Fix Horizontal Centering on Desktop */
    z-index: 20000 !important;
    /* Above EVERYTHING */
    background-color: #f3f4f6;
    overflow-y: auto !important;
    /* Enable internal scrolling */
    padding: 0 !important;
    /* Ensure minimal distance from top (logo doesn't stick to ceiling) */
    padding-top: max(env(safe-area-inset-top), 90px) !important;
    margin: 0 !important;
}

/* Ensure inner container has proper spacing and clearance */
#login.page-section>div,
#register.page-section>div {
    width: 100%;
    max-width: 28rem;
    /* max-w-md equivalent */
    margin: auto;
    /* my-auto handles centering */
    padding: 1rem;
    /* p-4 equivalent */
    /* Ensure content is never cut off at bottom when scrolling */
    padding-bottom: 100px !important;
}

#about.page-section,
#imprint.page-section,
#settings.page-section,
#profile.page-section,
#report.page-section,
#home.page-section {
    padding-bottom: 120px;
    /* Mehr Platz am Ende */
}

.page-section.active {
    display: block;
}

/* WICHTIG: Home muss auch scrollen können! */
#home.page-section.active {
    display: block !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    height: auto !important;
    max-height: calc(100vh - 60px) !important;
    /* Verstecke Scrollbar */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

/* Verstecke Scrollbar für Chrome/Safari/Opera */
#home.page-section.active::-webkit-scrollbar {
    display: none;
}

/* Login und Register: Zentriert anzeigen */
#login.page-section.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 65px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#register.page-section.active {
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    /* Fix for tall content clipping at top */
    min-height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: max(env(safe-area-inset-top), 40px);
    /* Give it some headroom but not 90px which is huge */
    padding-bottom: 40px;

    /* HIDE SCROLLBAR */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

/* Hide scrollbar for Chrome/Safari/Opera */
#register.page-section.active::-webkit-scrollbar {
    display: none;
}

/* About, Imprint, Settings, Profile, Report und Home sollen den vollen Platz nutzen und scrollen können */
#about.page-section.active,
#imprint.page-section.active,
#settings.page-section.active,
#profile.page-section.active,
#report.page-section.active,
#home.page-section.active {
    display: block !important;
    /* Entferne flex, damit Scrollen besser funktioniert */
    min-height: 100vh;
    /* overflow-y: auto;  <-- REMOVED to let Main scroll */
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling auf iOS */
}

/* Mobile-optimiert: Stelle sicher, dass Login/Register/About/Imprint/Settings/Profile/Report/Home scrollen können */
@media (max-height: 800px) {

    #login.page-section.active,
    #register.page-section.active {
        min-height: calc(100vh - 65px);
        padding-bottom: 2rem !important;
    }

    #about.page-section.active,
    #imprint.page-section.active,
    #settings.page-section.active,
    #profile.page-section.active,
    #report.page-section.active,
    #home.page-section.active {
        min-height: auto;
        padding-bottom: 8rem !important;
        /* Extra Platz am Ende für Mobile */
    }
}

/* Text auf Web-View nach oben verschieben (nur Desktop, nicht Mobile) */
@media (min-width: 768px) {
    #home.page-section {
        padding-top: 2rem !important;
    }

    #profile.page-section {
        padding-top: 2rem !important;
    }

    /* Padding wird durch Tailwind-Klassen pt-36 md:pt-40 gesetzt */
}

/* Reduziere Padding auf sehr kleinen Bildschirmen */
@media (max-height: 700px) {

    #login.page-section,
    #register.page-section {
        min-height: calc(100vh - 65px);
    }

    #about.page-section,
    #imprint.page-section,
    #profile.page-section,
    #report.page-section,
    #home.page-section {
        padding: 1rem !important;
        padding-bottom: 10rem !important;
        /* Noch mehr Platz am Ende */
    }

    /* Activities und Settings haben fixiertes padding-top */
    #activities.page-section,
    #settings.page-section {
        padding: 1rem !important;
        padding-top: 1rem !important;
        /* Fixiert: 16px Abstand nach Header */
        padding-bottom: 10rem !important;
        /* Noch mehr Platz am Ende */
    }

    #login.page-section .bg-white,
    #register.page-section .bg-white,
    #about.page-section .bg-white,
    #imprint.page-section .bg-white,
    #settings.page-section .bg-white,
    #profile.page-section .bg-white {
        padding: 1rem !important;
    }
}

/* Extra Platz für sehr kleine Bildschirme */
@media (max-height: 650px) {

    #register.page-section.active,
    #about.page-section.active,
    #imprint.page-section.active,
    #settings.page-section.active,
    #profile.page-section.active,
    #report.page-section.active,
    #home.page-section.active {
        padding-bottom: 12rem !important;
    }
}

/* Mobility Sektion - Karte soll volle Höhe haben */
#mobility.page-section {
    padding: 0 !important;
    position: relative;
    min-height: 0;
    display: none;
    /* Standard: versteckt */
}

/* Setup-Seite: Leichteres Scrollen (REMOVED: Use main container scrolling)
#settings.page-section {
    /* overflow-y: auto; */
/* -webkit-overflow-scrolling: touch; */
/* scroll-behavior: smooth; */
/* overscroll-behavior: contain; */
/* will-change: scroll-position; */
}

*/ #mobility.page-section.active {
    display: flex !important;
    flex-direction: column;
    height: calc(100vh - 140px);
    min-height: 500px;
}

/* Stelle sicher, dass Filter-Buttons immer sichtbar sind wenn mobility aktiv ist */
#mobility.page-section.active>.absolute {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

@media (max-width: 768px) {
    #mobility.page-section.active {
        height: calc(100vh - 120px);
        padding-top: 0 !important;
    }

    /* Stelle sicher, dass Filter-Buttons auf Mobile sichtbar sind und über der Navigation */
    #mobility.page-section.active>.absolute {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        z-index: 240 !important;
        bottom: 120px !important;
        position: fixed !important;
    }

    /* Alternative: Wenn absolute positioning nicht funktioniert */
    #mobility.page-section.active .absolute[class*="bottom-"] {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 240 !important;
        bottom: 120px !important;
    }
}

/* Mobile Navigation z-index - bereits oben definiert, hier nur z-index erhöhen */
.mobile-nav {
    z-index: 200 !important;
}

/* Chatbot Styles */
/* #chat-button animation removed */

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

#chat-widget {
    max-height: calc(100vh - 100px);
}

#chat-messages {
    scrollbar-width: thin;
    scrollbar-color: #dc2626 #f3f4f6;
}

#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #dc2626;
    border-radius: 3px;
}

/* Dark Mode für Chatbot */
body.dark-mode #chat-widget {
    background: #0f0f0f;
    border-color: #1a1a1a;
}

body.dark-mode #chat-messages {
    background: #1a1a1a;
}

body.dark-mode #chat-input {
    background: #1a1a1a;
    border-color: #2d2d2d;
    color: #e5e5e5;
}

body.dark-mode #chat-input::placeholder {
    color: #737373;
}

/* Mobile Geräte: Bessere Touch-Targets und Lesbarkeit */
@media (max-width: 768px) {

    /* Stelle sicher, dass alle interaktiven Elemente mindestens 44x44px haben */
    button,
    a,
    input[type="button"],
    input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
    }

    /* Verbessere Lesbarkeit auf kleinen Bildschirmen */
    body {
        font-size: 16px;
        /* Verhindert automatisches Zoom auf iOS beim Fokus auf Input-Felder */
    }

    /* Größere Touch-Targets für Navigation */
    .nav-item {
        min-width: 48px;
        min-height: 48px;
        padding: 8px;
    }

    /* Action Button sollte auch auf mobilen Geräten gut erreichbar sein */
    .action-btn {
        min-width: 56px;
        min-height: 56px;
    }
}

/* Sehr kleine Bildschirme (iPhone SE, kleine Android-Geräte) */
@media (max-width: 375px) {

    /* Kompaktere Abstände für sehr kleine Bildschirme */
    .page-section {
        padding: 0.75rem !important;
    }

    /* Header-Text kleiner auf sehr kleinen Bildschirmen */
    #main-header:not(.hidden) h1 {
        font-size: 0.9rem !important;
    }

    /* Navigation kompakter */
    .mobile-nav {
        min-height: 60px;
    }

    .nav-item {
        min-width: 44px;
        min-height: 44px;
        padding: 6px;
        font-size: 0.75rem;
    }

    .nav-item i {
        font-size: 1.1rem;
    }

    /* Karten und Buttons kompakter */
    .glass-card,
    button.bg-white {
        padding: 0.75rem !important;
    }
}

/* Kleine bis mittlere Bildschirme (iPhone 12/13/14, Standard Android) */
@media (min-width: 376px) and (max-width: 480px) {
    .page-section {
        padding: 1rem;
    }

    .nav-item {
        min-width: 48px;
        min-height: 48px;
        padding: 8px;
    }
}

/* Große mobile Bildschirme (iPhone Pro Max, große Android-Geräte) */
@media (min-width: 481px) and (max-width: 768px) {
    .page-section {
        padding: 1.25rem;
    }

    /* Mehr Platz für größere mobile Geräte */
    .mobile-nav {
        min-height: 70px;
    }

    .nav-item {
        min-width: 52px;
        min-height: 52px;
        padding: 10px;
    }
}

/* Tablet und größere Bildschirme */
@media (min-width: 769px) and (max-width: 1024px) {

    /* Tablet-Optimierungen */
    .page-section {
        padding: 1.5rem;
        max-width: 900px;
        margin: 0 auto;
    }

    #main-header:not(.hidden) {
        padding: 1rem 2rem;
    }
}

/* Sehr große Bildschirme */
@media (min-width: 1025px) {
    .page-section {
        max-width: 1200px;
        margin: 0 auto;
    }
}

/* iPhone X und neuer: Safe Area Support */
@supports (padding: max(0px)) {
    .mobile-nav {
        padding-bottom: max(env(safe-area-inset-bottom), 8px);
        padding-left: max(env(safe-area-inset-left), 0px);
        padding-right: max(env(safe-area-inset-right), 0px);
    }

    /* Header berücksichtigt Safe Area */
    #main-header:not(.hidden) {
        padding-top: env(safe-area-inset-top, 0px);
        height: calc(64px + env(safe-area-inset-top, 0px));
    }

    /* Stelle sicher, dass Content nicht unter Notch fällt */
    main {
        padding-top: calc(64px + env(safe-area-inset-top, 0px)) !important;
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
    }
}

/* Allgemeine main-Container Optimierungen für alle Geräte */
main {
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1;
    max-width: 100vw;
    width: 100%;
    position: relative;
    /* Smooth scrolling für alle Geräte */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Verhindere Layout-Verschiebungen auf verschiedenen Geräten */
* {
    box-sizing: border-box;
}

/* Responsive Bilder und Medien */
img,
video,
iframe {
    max-width: 100%;
    height: auto;
}

/* Orientierungs-spezifische Anpassungen */
@media (orientation: landscape) and (max-width: 768px) {

    /* Landscape-Modus auf mobilen Geräten */
    #main-header:not(.hidden) {
        height: calc(56px + env(safe-area-inset-top, 0px));
    }

    main {
        padding-top: calc(56px + env(safe-area-inset-top, 0px)) !important;
    }

    .mobile-nav {
        min-height: 60px;
    }
}

/* Hohe Bildschirme (z.B. iPhone 14 Pro Max) */
@media (min-height: 900px) and (max-width: 768px) {
    .page-section {
        padding-bottom: 100px;
    }
}

/* Sehr hohe Bildschirme */
@media (min-height: 1000px) and (max-width: 768px) {
    .page-section {
        padding-bottom: 120px;
    }
}

/* Pixel-Dichte-Anpassungen für Retina-Displays */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

    /* Schärfere Darstellung auf Retina-Displays */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Touch-Geräte spezifische Optimierungen */
@media (hover: none) and (pointer: coarse) {

    /* Nur für Touch-Geräte */
    button,
    a,
    .nav-item,
    .action-btn {
        -webkit-tap-highlight-color: transparent;
        tap-highlight-color: transparent;
        outline: none;
        /* Optional: Remove default focus outline if undesired */
    }

    /* Größere Touch-Targets auf Touch-Geräten */
    .nav-item {
        min-width: 48px;
        min-height: 48px;
    }
}

/* ============================================
   WEITERE GERÄTE-SPEZIFISCHE OPTIMIERUNGEN
   ============================================ */

/* Foldable Phones (Samsung Galaxy Fold, etc.) - geschlossen */
@media (max-width: 280px) {

    /* Sehr schmale Bildschirme (Foldable geschlossen) */
    .page-section {
        padding: 0.5rem !important;
    }

    #main-header:not(.hidden) h1 {
        font-size: 0.8rem !important;
    }

    .mobile-nav {
        min-height: 55px;
    }

    .nav-item {
        min-width: 40px;
        min-height: 40px;
        padding: 4px;
        font-size: 0.7rem;
    }

    .nav-item i {
        font-size: 1rem;
    }
}

/* Foldable Phones - offen (Tablet-Modus) */
@media (min-width: 768px) and (max-width: 1024px) and (min-height: 600px) {

    /* Tablet-ähnliche Darstellung für geöffnete Foldables */
    .page-section {
        max-width: 800px;
        margin: 0 auto;
        padding: 2rem;
    }

    .mobile-nav {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 20px 20px 0 0;
    }
}

/* Sehr breite Bildschirme (Landscape Tablets, Desktop) */
@media (min-width: 1025px) and (orientation: landscape) {
    .page-section {
        max-width: 1400px;
        margin: 0 auto;
    }

    #main-header:not(.hidden) {
        padding: 1rem 3rem;
    }
}

/* Sehr schmale Bildschirme (Portrait auf sehr kleinen Geräten) */
@media (max-width: 320px) {

    /* Alte kleine Android-Geräte */
    body {
        font-size: 14px;
    }

    .page-section {
        padding: 0.5rem !important;
    }

    h1,
    h2,
    h3 {
        font-size: 1.1rem !important;
    }

    .glass-card,
    button.bg-white {
        padding: 0.5rem !important;
        font-size: 0.875rem;
    }
}

/* Android-Geräte mit verschiedenen DPI */
@media (-webkit-min-device-pixel-ratio: 1.5) {

    /* High-DPI Displays */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Ultra-High-DPI Displays (4K, etc.) */
@media (-webkit-min-device-pixel-ratio: 3) {

    /* Noch schärfere Darstellung */
    body {
        -webkit-font-smoothing: subpixel-antialiased;
    }
}

/* iPad spezifische Optimierungen */
@media (min-width: 768px) and (max-width: 1024px) {

    /* iPad Portrait und Landscape */
    .page-section {
        padding: 2rem;
    }

    #main-header:not(.hidden) {
        padding: 1rem 2rem;
        height: calc(72px + env(safe-area-inset-top, 0px));
    }

    main {
        padding-top: calc(72px + env(safe-area-inset-top, 0px)) !important;
    }

    .mobile-nav {
        min-height: 80px;
    }

    .nav-item {
        min-width: 60px;
        min-height: 60px;
        padding: 12px;
        font-size: 0.9rem;
    }
}

/* iPad Pro (größere Tablets) */
@media (min-width: 1024px) and (max-width: 1366px) {
    .page-section {
        max-width: 1000px;
        padding: 2.5rem;
    }

    #main-header:not(.hidden) {
        padding: 1.25rem 3rem;
    }
}

/* Sehr große Tablets und kleine Laptops */
@media (min-width: 1367px) and (max-width: 1920px) {
    .page-section {
        max-width: 1200px;
        padding: 3rem;
    }
}

/* Sehr kleine Höhe (Landscape auf kleinen Geräten) */
@media (max-height: 500px) and (orientation: landscape) {

    /* Kompakte Darstellung im Landscape-Modus */
    #main-header:not(.hidden) {
        height: calc(48px + env(safe-area-inset-top, 0px));
    }

    main {
        padding-top: calc(48px + env(safe-area-inset-top, 0px)) !important;
    }

    .mobile-nav {
        min-height: 50px;
    }

    .page-section {
        padding: 0.75rem;
    }
}

/* Sehr große Höhe (Portrait auf großen Geräten) */
@media (min-height: 1200px) and (orientation: portrait) {
    .page-section {
        padding-bottom: 140px;
    }
}

/* Aspect Ratio Optimierungen */
@media (min-aspect-ratio: 21/9) {

    /* Ultra-wide Bildschirme */
    .page-section {
        max-width: 1600px;
    }
}

@media (max-aspect-ratio: 3/4) {

    /* Sehr hohe/schmale Bildschirme */
    .page-section {
        padding: 1rem;
    }
}

/* Samsung Galaxy S-Serie spezifische Optimierungen */
@media (min-width: 360px) and (max-width: 412px) and (-webkit-min-device-pixel-ratio: 2) {

    /* Samsung Galaxy S-Serie */
    .page-section {
        padding: 1rem;
    }
}

/* Google Pixel spezifische Optimierungen */
@media (min-width: 411px) and (max-width: 480px) {

    /* Google Pixel Geräte */
    .page-section {
        padding: 1.125rem;
    }
}

/* OnePlus und ähnliche Geräte */
@media (min-width: 390px) and (max-width: 430px) {

    /* OnePlus, Xiaomi, etc. */
    .page-section {
        padding: 1rem;
    }
}

/* Alte iOS-Geräte (iPhone 6, 7, 8) */
@media (max-width: 375px) and (-webkit-min-device-pixel-ratio: 2) {
    .page-section {
        padding: 0.875rem;
    }
}

/* Moderne iPhone-Geräte (iPhone 12/13/14 Standard) */
@media (min-width: 390px) and (max-width: 430px) and (-webkit-min-device-pixel-ratio: 3) {
    .page-section {
        padding: 1rem;
    }
}

/* iPhone Pro Max und Plus Modelle */
@media (min-width: 428px) and (max-width: 480px) {
    .page-section {
        padding: 1.25rem;
    }

    .mobile-nav {
        min-height: 75px;
    }
}

/* ============================================
   SPEZIELLE GERÄTE-KATEGORIEN
   ============================================ */

/* Windows Mobile / Surface Duo */
@media (min-width: 540px) and (max-width: 720px) {
    .page-section {
        padding: 1.5rem;
        max-width: 700px;
        margin: 0 auto;
    }
}

/* Chromebook und ähnliche Geräte */
@media (min-width: 1024px) and (max-width: 1366px) and (min-height: 600px) {
    .page-section {
        max-width: 1100px;
    }
}

/* Sehr alte Geräte (iPhone 5, etc.) */
@media (max-width: 320px) and (max-height: 568px) {
    .page-section {
        padding: 0.5rem !important;
    }

    #main-header:not(.hidden) h1 {
        font-size: 0.75rem !important;
    }

    .mobile-nav {
        min-height: 55px;
    }
}

/* Moderne große Android-Geräte (OnePlus, Xiaomi, etc.) */
@media (min-width: 412px) and (max-width: 480px) and (min-height: 800px) {
    .page-section {
        padding: 1.25rem;
    }
}

/* Samsung Galaxy Note-Serie */
@media (min-width: 412px) and (max-width: 480px) and (min-height: 900px) {
    .page-section {
        padding: 1.5rem;
    }

    .mobile-nav {
        min-height: 80px;
    }
}

/* Sehr breite Landscape-Modi */
@media (orientation: landscape) and (min-width: 900px) and (max-height: 600px) {
    .page-section {
        padding: 1rem;
        max-width: 1400px;
    }

    #main-header:not(.hidden) {
        height: calc(56px + env(safe-area-inset-top, 0px));
    }

    main {
        padding-top: calc(56px + env(safe-area-inset-top, 0px)) !important;
    }
}

/* Dynamische Viewport-Anpassungen für moderne Browser */
@supports (height: 100dvh) {

    /* Verwende dynamische Viewport-Einheiten wenn verfügbar */
    .page-section {
        min-height: 100dvh;
    }

    main {
        min-height: 100dvh;
    }
}

/* Fallback für ältere Browser */
@supports not (height: 100dvh) {
    .page-section {
        min-height: 100vh;
    }

    main {
        min-height: 100vh;
    }
}

/* Container Query Support (für moderne Browser) */
@container (max-width: 400px) {
    .glass-card {
        padding: 0.75rem;
    }
}

/* Dark Mode Optimierungen für verschiedene Geräte */
@media (prefers-color-scheme: dark) {

    /* Automatische Dark Mode Erkennung */
    body:not(.light-mode) {
        background-color: #000000;
        color: #e5e5e5;
    }
}

/* Reduzierte Bewegung für Accessibility */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Hoher Kontrast Modus */
@media (prefers-contrast: high) {
    .nav-item.active {
        border-width: 3px !important;
    }

    button,
    a {
        border: 2px solid currentColor;
    }
}

/* Print-Modus Optimierungen */
@media print {

    .mobile-nav,
    #main-header,
    .action-btn {
        display: none !important;
    }

    .page-section {
        padding: 0;
        page-break-inside: avoid;
    }
}

/* Filter-Buttons auf Karte - über Navigation auf Mobile */
@media (max-width: 768px) {
    #mobility .absolute[class*="bottom-"] {
        bottom: 120px !important;
        z-index: 240 !important;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: fixed !important;
    }
}

/* Route-Profile-Button sollte über den Filtern liegen */
#route-profile-btn {
    z-index: 300 !important;
    position: relative !important;
}

/* Scrollbalken verstecken beim Scrollen */
body {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

body::-webkit-scrollbar {
    width: 8px;
}

body::-webkit-scrollbar-track {
    background: transparent;
}

body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    transition: opacity 0.3s;
}

body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Scrollbalken beim Scrollen verstecken */
body.scrolling::-webkit-scrollbar-thumb {
    opacity: 0;
    background: transparent;
}

body.scrolling {
    scrollbar-width: none;
}

body.scrolling::-webkit-scrollbar {
    width: 0;
}

/* Level-Modal Scrollbar verstecken */
.level-modal-scroll {
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE und Edge */
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling auf iOS */
    max-height: 100%;
    /* Stelle sicher, dass auf mobilen Geräten genug Platz zum Scrollen ist */
    padding-bottom: 1rem;
}

/* Mobile: Mehr Platz für Level-Liste */
@media (max-width: 768px) {
    #level-info-modal .bg-white {
        max-height: 85vh !important;
    }

    .level-modal-scroll {
        max-height: calc(85vh - 200px);
        /* Abzug für Header und Info-Box */
    }
}

.level-modal-scroll::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari, Opera */
    width: 0;
    height: 0;
}

/* Scroll-Begrenzung für Seiten */
.page-section {
    overflow-x: hidden;
}

@media (max-width: 768px) {
    .page-section.active {
        max-height: calc(100vh - 56px);
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* Verhindere zu viel Scrollen nach unten */
    .page-section.active {
        padding-bottom: 6rem !important;
    }

    /* Scroll-Begrenzung: Verhindere zu viel Scrollen - aber erlaube Scrollen für Settings */
    main {
        max-height: 100vh;
        overflow: hidden;
    }

    /* Settings soll scrollbar sein */
    #settings.page-section.active {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        max-height: calc(100vh - 56px) !important;
    }
}

/* Stelle sicher, dass andere Sektionen wirklich versteckt sind */
#login.page-section:not(.active),
#register.page-section:not(.active) {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Konfetti Animation */
@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: #f0f;
    position: absolute;
    animation: confetti-fall 3s linear forwards;
    z-index: 9999;
}

.confetti:nth-child(1) {
    left: 10%;
    background: #ff0000;
    animation-delay: 0s;
}

.confetti:nth-child(2) {
    left: 20%;
    background: #00ff00;
    animation-delay: 0.1s;
}

.confetti:nth-child(3) {
    left: 30%;
    background: #0000ff;
    animation-delay: 0.2s;
}

.confetti:nth-child(4) {
    left: 40%;
    background: #ffff00;
    animation-delay: 0.3s;
}

.confetti:nth-child(5) {
    left: 50%;
    background: #ff00ff;
    animation-delay: 0.4s;
}

.confetti:nth-child(6) {
    left: 60%;
    background: #00ffff;
    animation-delay: 0.5s;
}

.confetti:nth-child(7) {
    left: 70%;
    background: #ff8800;
    animation-delay: 0.6s;
}

.confetti:nth-child(8) {
    left: 80%;
    background: #8800ff;
    animation-delay: 0.7s;
}

.confetti:nth-child(9) {
    left: 90%;
    background: #ff0088;
    animation-delay: 0.8s;
}

.confetti:nth-child(10) {
    left: 15%;
    background: #00ff88;
    animation-delay: 0.9s;
}

.confetti:nth-child(11) {
    left: 25%;
    background: #ff8800;
    animation-delay: 1s;
}

.confetti:nth-child(12) {
    left: 35%;
    background: #0088ff;
    animation-delay: 1.1s;
}

.confetti:nth-child(13) {
    left: 45%;
    background: #88ff00;
    animation-delay: 1.2s;
}

.confetti:nth-child(14) {
    left: 55%;
    background: #ff0088;
    animation-delay: 1.3s;
}

.confetti:nth-child(15) {
    left: 65%;
    background: #00ff88;
    animation-delay: 1.4s;
}

.confetti:nth-child(16) {
    left: 75%;
    background: #8800ff;
    animation-delay: 1.5s;
}

.confetti:nth-child(17) {
    left: 85%;
    background: #ff8800;
    animation-delay: 1.6s;
}

.confetti:nth-child(18) {
    left: 95%;
    background: #00ffff;
    animation-delay: 1.7s;
}

/* Erfolgs-Animation */
@keyframes success-bounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.success-animation {
    animation: success-bounce 0.5s ease-in-out;
}

/* Welcome Card - Bild-Position auf Mobile */
@media (max-width: 768px) {
    .welcome-card-bg {
        background-position: center 65% !important;
    }
}

/* ============================================
   FIXIERTE POSITION FÜR ACTIVITIES UND SETTINGS
   Diese Regel steht am Ende und hat höchste Priorität
   ============================================ */
#activities.page-section,
#settings.page-section {
    padding-top: 1rem !important;
    /* Fixiert: 16px Abstand nach Header - kann nicht überschrieben werden */
}

@media (min-width: 768px) {

    #activities.page-section,
    #settings.page-section {
        padding-top: 2.5rem !important;
        /* Fixiert: 40px Abstand nach Header auf Desktop - kann nicht überschrieben werden */
    }
}

/* Weather Badge Animation */
.weather-badge-visible {
    transform: translateY(0) !important;
    opacity: 1 !important;
}

/* Weather Badge Animation */
@keyframes moveLight {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.weather-badge-visible {
    transform: translateY(0) !important;
    opacity: 1 !important;
}

/* AI Surprise Glowing Border - Redesign */
/* AI Surprise Laser Animation */
.ai-surprise-border {
    position: relative !important;
    /* No border on the element itself, the spans create it */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    /* Soft shadow */
    border: none !important;
    background-clip: border-box !important;
}

/* Spinner Animation for Rounded Border */
@keyframes spin-slow-custom {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* DO NOT CHANGE - FINAL ANIMATION */
.animate-spin-slow-custom {
    animation: spin-slow-custom 4s linear infinite;
    /* Slowed down for smoother effect */
    will-change: transform;
    filter: blur(8px);
    /* Enhance the glow effect from behind */
    opacity: 1;

    /* Original Laser Gradient (Transparent -> White -> Red) */
    background: conic-gradient(from 0deg,
            transparent 70%,
            rgba(255, 255, 255, 0.8) 85%,
            #ff0000 100%);
}

/* Glitter / Sparkle Effect (Aggressive) */
.animate-spin-slow-custom::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* AGGRESSIVE SPARKLES: Using larger dots and precise border coordinates (approx 33% and 67% lines) 
       Laser is Top (Start) to Left (Tail). 
       We place sparkles along the Top Edge (y=33-35%) and Left Edge (x=33-35%).
    */
    background-image:
        /* Top Edge Sparkles */
        radial-gradient(circle at 50% 32%, white, transparent 4px),
        radial-gradient(circle at 45% 33%, #fffdd0, transparent 5px),
        radial-gradient(circle at 40% 34%, white, transparent 3px),

        /* Corner Sparkle */
        radial-gradient(circle at 35% 35%, #ffffeb, transparent 6px),

        /* Left Edge Sparkles */
        radial-gradient(circle at 34% 40%, white, transparent 4px),
        radial-gradient(circle at 33% 45%, #fffdd0, transparent 5px),
        radial-gradient(circle at 32% 50%, white, transparent 4px);

    background-size: 100% 100%;
    /* Strong Glow */
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.8));
    animation: pulse-glitter 0.3s ease-in-out infinite alternate;
    z-index: 10;
}

@keyframes pulse-glitter {
    from {
        opacity: 0.5;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1.4);
    }
}

/* Exit Animations */
@keyframes exit-pop {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(0);
        opacity: 0;
    }
}

@keyframes exit-slide-up {
    0% {
        transform: translateY(0);
        opacity: 1;
    }

    100% {
        transform: translateY(-100px);
        opacity: 0;
    }
}

@keyframes exit-rotate {
    0% {
        transform: rotate(0);
        opacity: 1;
    }

    100% {
        transform: rotate(360deg) scale(0);
        opacity: 0;
    }
}

.exit-anim-pop {
    animation: exit-pop 0.5s forwards ease-in;
}

.exit-anim-slide {
    animation: exit-slide-up 0.5s forwards ease-in;
}

.exit-anim-rotate {
    animation: exit-rotate 0.5s forwards ease-in;
}

@keyframes laser-top {
    0% {
        left: -100%;
    }

    50%,
    100% {
        left: 100%;
    }
}

@keyframes laser-right {
    0% {
        top: -100%;
    }

    50%,
    100% {
        top: 100%;
    }
}

@keyframes laser-bottom {
    0% {
        right: -100%;
    }

    50%,
    100% {
        right: 100%;
    }
}

@keyframes laser-left {
    0% {
        bottom: -100%;
    }

    50%,
    100% {
        bottom: 100%;
    }
}

/* About & Imprint Text Color override */
#about *,
#imprint * {
    color: #000000 !important;
}

/* Page Sections Logic - Critical for Navigation */
.page-section {
    display: none;
    width: 100%;
    animation: fadeIn 0.3s ease-in-out;
}

.page-section.active {
    display: block;
}

/* Mobility Section needs Flex to fill height */
#mobility.page-section.active {
    display: flex;
    flex-direction: column;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Real Gold Palette */
.text-gold-600 {
    color: #d4af37 !important;
}

.text-gold-700 {
    color: #b8860b !important;
}

/* Dark Goldenrod */
.text-gold-800 {
    color: #8b6508 !important;
}

.bg-gold-50 {
    background-color: #fcfbf5 !important;
}

.bg-gold-100 {
    background-color: #f9f1d0 !important;
}

.bg-gold-200 {
    background-color: #f3e5aa !important;
}

.bg-gold-500 {
    background-color: #d4af37 !important;
}

.bg-gold-600 {
    background-color: #c5a028 !important;
}

.border-gold-400 {
    border-color: #eac146 !important;
}

.border-gold-500 {
    border-color: #d4af37 !important;
}

.bg-gradient-gold {
    background: linear-gradient(135deg, #d4af37 0%, #f1c40f 50%, #b8860b 100%) !important;
}

.text-gold-gradient {
    background: linear-gradient(135deg, #d4af37, #f1c40f, #b8860b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

.hover-bg-gold-600:hover {
    background-color: #c5a028 !important;
}

/* User Location Popup Fix */
.user-location-popup .leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
}

.user-location-popup .leaflet-popup-content {
    margin: 0 !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 12px 16px !important;
}

.user-location-popup .leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.95);
}

/* =========================================
   iOS SPECIFIC FIXES (iPhone only)
   Android remains 100% untouched!
   ========================================= */
@supports (-webkit-touch-callout: none) {

    /* 1. Fix Scroll & Layout Issues */
    body {
        min-height: 100dvh;
    }

    /* Fix background image cut-off */
    .welcome-card-bg {
        background-attachment: scroll !important;
        background-size: cover;
    }

    /* 2. Fix Header Logo Dimensions */
    #main-header img.w-10.h-10 {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        /* Prevent shrinking */
        flex: 0 0 40px !important;
        object-fit: contain !important;
    }

    /* 3. ROBUST FIX FOR SQUARE-IN-CIRCLE AVATARS */

    /* FIX: Target ONLY the inner container for the mask/clip */
    /* DO NOT touch the .relative wrapper, or the heart icon will be clipped! */
    #leaderboard-list .w-12.h-12.rounded-full,
    #header-avatar-container {
        /* Force masking on the container itself */
        -webkit-mask-image: -webkit-radial-gradient(white, black);
        mask-image: radial-gradient(white, black);
        transform: translateZ(0);
        /* GPU */
        border-radius: 50% !important;
        overflow: hidden !important;
        isolation: isolate;
        /* Fix for 'Small circle in big circle' - ensure it fills space */
        width: 48px !important;
        /* w-12 = 3rem = 48px */
        height: 48px !important;
        background-color: white;
        /* Ensure base color */
    }

    /* Ensure the wrapper is NOT clipped so the heart can pop out */
    #leaderboard-list .relative.w-12.h-12 {
        overflow: visible !important;
        mask-image: none !important;
        -webkit-mask-image: none !important;
        border-radius: 0 !important;
        transform: none !important;
        isolation: auto !important;
    }

    /* Ensure image fills the masked container */
    #leaderboard-list img,
    #header-avatar-container img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        border-radius: 0 !important;
        /* Let container handle radius */
    }

    /* Heart Icon / Streak Badge - Ensure visibility */
    #leaderboard-list .absolute.-bottom-1.-right-1 {
        z-index: 50 !important;
        /* Force on top */
        transform: translateZ(10px);
        /* Lift up in 3D space */
    }

    /* 4. Reset Form Appearance */
    input:not([type="checkbox"]),
    textarea,
    select {
        -webkit-appearance: none;
        appearance: none;
        background-color: #ffffff;
        opacity: 1;
        border-radius: 0.75rem;
        /* Match Tailwind rounded-xl (12px) manually since we reset appearance */
    }

    /* Preserve Checkboxes */
    input[type="checkbox"] {
        -webkit-appearance: checkbox;
        appearance: checkbox;
    }

    /* 5. Animation Visibility Fallback */
    /* Ensure modal content is visible if animation fails */
    #ai-surprise-modal:not(.hidden) {
        display: flex !important;
    }

    /* Font consistency */
    body {
        font-family: 'Inter', -apple-system, sans-serif;
    }
}