        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            -webkit-tap-highlight-color: transparent;
        }

        /* === SYSTÈME DE THÈMES === */
        :root {
            --primary-start: #667eea;
            --primary-end: #764ba2;
            --bg-start: #667eea;
            --bg-end: #764ba2;
            --text-primary: #333;
            --text-secondary: #666;
            --text-light: #999;
            --card-bg: white;
            --card-shadow: rgba(0, 0, 0, 0.2);
            --border-color: #e0e0e0;
        }

        /* Thème Sombre */
        body.theme-dark {
            --primary-start: #667eea;
            --primary-end: #764ba2;
            --bg-start: #1a1a1a;
            --bg-end: #2d2d2d;
            --text-primary: #e0e0e0;
            --text-secondary: #b0b0b0;
            --text-light: #808080;
            --card-bg: #2a2a2a;
            --card-shadow: rgba(0, 0, 0, 0.5);
            --border-color: #404040;
        }

        /* Thème Contraste */
        body.theme-contrast {
            --primary-start: #000000;
            --primary-end: #1a1a1a;
            --bg-start: #ffffff;
            --bg-end: #f0f0f0;
            --text-primary: #000000;
            --text-secondary: #333333;
            --text-light: #666666;
            --card-bg: #ffffff;
            --card-shadow: rgba(0, 0, 0, 0.3);
            --border-color: #000000;
        }

        /* Thème Océan */
        body.theme-ocean {
            --primary-start: #0ea5e9;
            --primary-end: #0284c7;
            --bg-start: #0ea5e9;
            --bg-end: #0369a1;
            --text-primary: #333;
            --text-secondary: #666;
            --text-light: #999;
            --card-bg: white;
            --card-shadow: rgba(0, 0, 0, 0.2);
            --border-color: #e0e0e0;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-end) 100%);
            min-height: 100vh;
            overflow-x: hidden;
        }

        .container {
            max-width: 500px;
            margin: 0 auto;
            padding: 20px;
            padding-bottom: 80px;
        }

        .screen {
            display: none;
            animation: fadeIn 0.3s ease-in;
        }

        .screen.active {
            display: block;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(10px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .header {
            text-align: center;
            color: white;
            margin-bottom: 30px;
        }

        .header h1 {
            font-size: 2.5em;
            margin-bottom: 10px;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
        }

        .header p {
            font-size: 1.1em;
            opacity: 0.9;
        }

        .card {
            background: var(--card-bg);
            border-radius: 20px;
            padding: 25px;
            margin-bottom: 20px;
            box-shadow: 0 10px 30px var(--card-shadow);
        }

        .card h2 {
            color: var(--text-primary);
            margin-bottom: 20px;
            font-size: 1.4em;
        }

        .stats-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
        }

        .stat-box {
            background: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
            color: white;
            padding: 20px;
            border-radius: 15px;
            text-align: center;
            transition: transform 0.3s;
        }

        .stat-box:active {
            transform: scale(0.95);
        }

        .stat-value {
            font-size: 2em;
            font-weight: bold;
            margin-bottom: 5px;
        }

        .stat-label {
            font-size: 0.9em;
            opacity: 0.9;
        }

        .btn {
            width: 100%;
            padding: 18px;
            border: none;
            border-radius: 15px;
            font-size: 1.1em;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            box-shadow: 0 4px 15px var(--card-shadow);
        }

        .btn:active {
            transform: scale(0.98);
        }

        .btn-primary {
            background: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
            color: white;
            margin-bottom: 15px;
            font-size: 1.3em;
            padding: 22px;
        }

        .btn-secondary {
            background: var(--card-bg);
            color: var(--primary-start);
            border: 2px solid var(--border-color);
            font-size: 1em;
        }

        .btn-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
        }

        /* === ÉCRAN DE SUIVI === */
        #map {
            width: 100%;
            height: 60vh;
            border-radius: 0;
            flex: 1;
            min-height: 0;
        }

        .tracking-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100vh;
            background: #1a1a1a;
            z-index: 1000;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        .tracking-stats {
            background: linear-gradient(to top, #2a2a2a 0%, #1a1a1a 100%);
            color: white;
            padding: 20px;
            flex-shrink: 0;
            border-radius: 20px 20px 0 0;
            box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.3);
            max-height: 50vh;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }

        .tracking-grid {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            gap: 15px;
            margin-bottom: 20px;
            text-align: center;
        }

        .tracking-value {
            font-size: 1.8em;
            font-weight: bold;
            color: #667eea;
        }

        .tracking-label {
            font-size: 0.8em;
            color: #999;
            margin-top: 5px;
            text-transform: uppercase;
        }

        .elevation-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
            margin-bottom: 20px;
        }

        .elevation-box {
            background: #3a3a3a;
            padding: 12px;
            border-radius: 10px;
            font-size: 0.95em;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        .btn-pause {
            background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
            color: white;
        }

        .btn-resume {
            background: linear-gradient(135deg, #10b981 0%, #059669 100%);
            color: white;
        }

        .btn-stop {
            background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
            color: white;
        }

        .btn-start {
            background: linear-gradient(135deg, #10b981 0%, #059669 100%);
            color: white;
            font-size: 1.5em;
            padding: 25px;
        }

        .btn-back-tracking {
            background: rgba(255, 255, 255, 0.2);
            color: white;
            border: 2px solid white;
            padding: 12px 20px;
            border-radius: 10px;
            font-size: 1em;
            cursor: pointer;
            margin-bottom: 15px;
            backdrop-filter: blur(10px);
        }

        /* === HISTORIQUE === */
        .run-item {
            background: var(--card-bg);
            border-radius: 15px;
            padding: 20px;
            margin-bottom: 15px;
            cursor: pointer;
            transition: all 0.3s;
            box-shadow: 0 2px 10px var(--card-shadow);
            border: 2px solid transparent;
        }

        .run-item:active {
            transform: scale(0.98);
            border-color: var(--primary-start);
        }

        .run-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
        }

        .run-distance {
            font-size: 1.5em;
            font-weight: bold;
            background: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .run-date {
            font-size: 0.9em;
            color: var(--text-secondary);
            margin-top: 5px;
        }

        .run-stats {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            gap: 10px;
            font-size: 0.9em;
        }

        .run-stat-item {
            background: #f8f9fa;
            padding: 10px;
            border-radius: 8px;
            text-align: center;
        }

        body.theme-dark .run-stat-item {
            background: #3a3a3a;
            color: #e0e0e0;
        }

        .run-details {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s ease;
        }

        .run-details.active {
            max-height: 2000px;
            margin-top: 15px;
            padding-top: 15px;
            border-top: 2px solid var(--border-color);
        }

        .run-map {
            width: 100%;
            height: 300px;
            border-radius: 10px;
            margin-bottom: 15px;
        }

        .speed-legend {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 15px;
            background: #f8f9fa;
            border-radius: 8px;
            margin-bottom: 15px;
            font-size: 0.85em;
        }

        body.theme-dark .speed-legend {
            background: #3a3a3a;
            color: #e0e0e0;
        }

        .legend-item {
            display: flex;
            align-items: center;
            gap: 5px;
        }

        .legend-color {
            width: 20px;
            height: 4px;
            border-radius: 2px;
        }

        .chart-container {
            width: 100%;
            height: 200px;
            margin-bottom: 15px;
            background: var(--card-bg);
            border-radius: 10px;
            padding: 15px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
        }

        .splits-container {
            background: var(--card-bg);
            border-radius: 10px;
            padding: 15px;
            margin-bottom: 15px;
        }

        .split-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px;
            border-bottom: 1px solid var(--border-color);
        }

        .split-item:last-child {
            border-bottom: none;
        }

        .split-km {
            font-weight: bold;
            color: var(--primary-start);
        }

        .split-time {
            font-weight: 600;
            color: var(--text-primary);
        }

        .split-pace {
            color: var(--text-secondary);
            font-size: 0.9em;
        }

        .details-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
            margin-bottom: 15px;
        }

        .detail-item {
            text-align: center;
            padding: 15px;
            background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
            border-radius: 10px;
        }

        body.theme-dark .detail-item {
            background: linear-gradient(135deg, #3a3a3a 0%, #2a2a2a 100%);
        }

        .detail-label {
            color: var(--text-secondary);
            font-size: 0.85em;
            margin-bottom: 8px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .detail-value {
            font-size: 1.3em;
            font-weight: bold;
            color: var(--text-primary);
        }

        .btn-delete {
            background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
            color: white;
        }

        .btn-export {
            background: linear-gradient(135deg, #10b981 0%, #059669 100%);
            color: white;
            margin-bottom: 10px;
        }

        .back-btn {
            background: rgba(255, 255, 255, 0.2);
            color: white;
            border: 2px solid white;
            padding: 12px 25px;
            border-radius: 10px;
            font-size: 1.1em;
            cursor: pointer;
            margin-bottom: 20px;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            backdrop-filter: blur(10px);
            transition: all 0.3s;
        }

        .back-btn:active {
            transform: scale(0.95);
            background: rgba(255, 255, 255, 0.3);
        }

        /* === COMPARAISON === */
        .compare-item {
            background: var(--card-bg);
            border: 2px solid var(--border-color);
            border-radius: 15px;
            padding: 15px;
            margin-bottom: 10px;
            cursor: pointer;
            transition: all 0.3s;
        }

        .compare-item:active {
            transform: scale(0.98);
        }

        .compare-item.selected {
            border-color: var(--primary-start);
            background: linear-gradient(135deg, #f0f4ff 0%, #e8ecff 100%);
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
        }

        body.theme-dark .compare-item.selected {
            background: linear-gradient(135deg, #3a3a5a 0%, #2a2a4a 100%);
        }

        .compare-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .compare-results {
            margin-top: 20px;
        }

        .metric-comparison {
            background: var(--card-bg);
            border-radius: 15px;
            padding: 20px;
            margin-bottom: 15px;
            box-shadow: 0 2px 10px var(--card-shadow);
        }

        .metric-label {
            font-size: 1em;
            color: var(--text-secondary);
            margin-bottom: 15px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .metric-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
        }

        .metric-value {
            padding: 20px;
            border-radius: 10px;
            text-align: center;
            transition: all 0.3s;
        }

        .metric-value.winner {
            background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
            border: 2px solid #10b981;
            box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
        }

        .metric-value.loser {
            background: #f3f4f6;
            border: 2px solid #e5e7eb;
        }

        body.theme-dark .metric-value.loser {
            background: #3a3a3a;
            border-color: #505050;
        }

        .metric-number {
            font-size: 1.4em;
            font-weight: bold;
            margin-bottom: 8px;
            color: var(--text-primary);
        }

        .metric-date {
            font-size: 0.8em;
            color: var(--text-secondary);
        }

        .winner-badge {
            text-align: center;
            color: #10b981;
            font-weight: bold;
            margin-top: 15px;
            font-size: 1em;
            padding: 8px;
            background: rgba(16, 185, 129, 0.1);
            border-radius: 8px;
        }

        .empty-state {
            text-align: center;
            padding: 60px 20px;
            color: var(--text-secondary);
        }

        .empty-state-icon {
            font-size: 5em;
            margin-bottom: 20px;
            opacity: 0.5;
        }

        .empty-state-text {
            font-size: 1.1em;
            color: var(--text-light);
        }

        .speed-indicator {
            background: #3a3a3a;
            padding: 10px;
            border-radius: 10px;
            text-align: center;
            margin-bottom: 15px;
        }

        .speed-value {
            font-size: 1.5em;
            font-weight: bold;
            color: #667eea;
        }

        .chevron {
            transition: transform 0.3s;
            display: inline-block;
        }

        .chevron.rotated {
            transform: rotate(180deg);
        }

        .gps-status {
            background: rgba(16, 185, 129, 0.2);
            color: #10b981;
            padding: 8px 15px;
            border-radius: 8px;
            font-size: 0.85em;
            text-align: center;
            margin-bottom: 15px;
        }

        .gps-status.searching {
            background: rgba(245, 158, 11, 0.2);
            color: #f59e0b;
        }

        /* === POPUP DE CONFIGURATION === */
        .config-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100vh;
            background: rgba(0, 0, 0, 0.5);
            z-index: 9999;
            display: none;
            align-items: center;
            justify-content: center;
            animation: fadeIn 0.3s ease;
        }

        .config-overlay.show {
            display: flex;
        }

        .config-panel {
            background: var(--card-bg);
            border-radius: 20px;
            padding: 30px;
            max-width: 400px;
            width: 90%;
            max-height: 80vh;
            overflow-y: auto;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        }

        .config-panel h2 {
            color: var(--text-primary);
            margin-bottom: 20px;
        }

        .theme-option {
            background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
            border: 3px solid var(--border-color);
            border-radius: 15px;
            padding: 20px;
            margin-bottom: 15px;
            cursor: pointer;
            transition: all 0.3s;
            text-align: center;
        }

        body.theme-dark .theme-option {
            background: linear-gradient(135deg, #3a3a3a 0%, #2a2a2a 100%);
        }

        .theme-option:active {
            transform: scale(0.98);
        }

        .theme-option.selected {
            border-color: var(--primary-start);
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
        }

        .theme-preview {
            width: 100%;
            height: 60px;
            border-radius: 10px;
            margin-bottom: 10px;
        }

        .theme-name {
            font-weight: bold;
            color: var(--text-primary);
        }

        /* === ÉCRAN RÉSUMÉ === */
        .summary-screen {
            background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-end) 100%);
            min-height: 100vh;
            padding: 20px;
        }

        .summary-header {
            text-align: center;
            color: white;
            margin-bottom: 30px;
            animation: fadeIn 0.5s ease-in;
        }

        .summary-header h1 {
            font-size: 2.5em;
            margin-bottom: 10px;
        }

        .summary-main-stat {
            background: var(--card-bg);
            border-radius: 20px;
            padding: 30px;
            text-align: center;
            margin-bottom: 20px;
            box-shadow: 0 10px 30px var(--card-shadow);
        }

        .summary-distance {
            font-size: 4em;
            font-weight: bold;
            background: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .summary-stats-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
            margin-bottom: 20px;
        }

        .summary-stat-card {
            background: var(--card-bg);
            border-radius: 15px;
            padding: 20px;
            text-align: center;
            box-shadow: 0 5px 15px var(--card-shadow);
        }

        .summary-stat-value {
            font-size: 2em;
            font-weight: bold;
            color: var(--text-primary);
            margin-bottom: 5px;
        }

        .summary-stat-label {
            color: var(--text-secondary);
            font-size: 0.9em;
        }

        /* === FORMULAIRE AJOUT MANUEL === */
        .manual-form {
            background: var(--card-bg);
            border-radius: 15px;
            padding: 20px;
            margin-bottom: 20px;
            box-shadow: 0 2px 10px var(--card-shadow);
            display: none;
            /* 🔹 ajouté : formulaire caché par défaut */
        }

        .manual-form h3 {
            color: var(--text-primary);
            margin-bottom: 15px;
            font-size: 1.2em;
        }

        .form-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
        }

        label {
            display: block;
            margin-bottom: 6px;
            font-size: 0.9em;
            color: var(--text-secondary);
        }

        input,
        select {
            width: 100%;
            padding: 10px 12px;
            margin-bottom: 15px;
            border-radius: 10px;
            border: 1px solid var(--border-color);
            font-size: 1em;
            outline: none;
            background: var(--card-bg);
            color: var(--text-primary);
        }

        input:focus,
        select:focus {
            border-color: var(--primary-start);
            box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
        }

        .health-metric {
            font-size: 1.05em;
            margin-bottom: 8px;
            color: var(--text-primary);
        }

        .health-metric span {
            font-weight: bold;
            color: var(--text-primary);
        }

        .evolution-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px;
            background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
            border-radius: 10px;
            margin-bottom: 10px;
        }

        body.theme-dark .evolution-item {
            background: linear-gradient(135deg, #3a3a3a 0%, #2a2a2a 100%);
        }

        .evolution-label {
            font-weight: 600;
            color: var(--text-secondary);
        }

        .evolution-value {
            font-size: 1.3em;
            font-weight: bold;
            color: var(--primary-start);
        }

        /* === CARTE D'INSTALLATION === */
        .install-card {
            background: var(--card-bg);
            border-radius: 15px;
            padding: 20px;
            margin-bottom: 20px;
            box-shadow: 0 5px 15px var(--card-shadow);
            display: none;
            animation: slideUp 0.3s ease;
        }

        .install-card.show {
            display: block;
        }

        .install-card h3 {
            color: var(--text-primary);
            margin-bottom: 10px;
            font-size: 1.2em;
        }

        .install-card p {
            color: var(--text-secondary);
            margin-bottom: 15px;
            font-size: 0.95em;
        }

        .install-card-buttons {
            display: flex;
            gap: 10px;
        }

        .install-card-btn {
            flex: 1;
            padding: 12px;
            border: none;
            border-radius: 10px;
            font-weight: bold;
            cursor: pointer;
            font-size: 1em;
        }

        .install-card-btn.primary {
            background: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
            color: white;
        }

        .install-card-btn.secondary {
            background: #f0f0f0;
            color: #666;
        }

        body.theme-dark .install-card-btn.secondary {
            background: #3a3a3a;
            color: #b0b0b0;
        }

        @keyframes slideUp {
            from {
                transform: translateY(20px);
                opacity: 0;
            }

            to {
                transform: translateY(0);
                opacity: 1;
            }
        }

        @keyframes celebrate {

            0%,
            100% {
                transform: scale(1);
            }

            50% {
                transform: scale(1.1);
            }
        }

        .celebrate {
            animation: celebrate 0.5s ease-in-out;
        }

        /* === COMPTE À REBOURS === */
        .countdown-overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 1001;
        }

        .countdown-overlay.show {
            display: flex;
        }

        .countdown-number {
            font-size: 10em;
            font-weight: bold;
            color: white;
            animation: countdownPulse 1s ease-in-out;
        }

        @keyframes countdownPulse {
            0% {
                transform: scale(0.5);
                opacity: 0;
            }

            50% {
                transform: scale(1.2);
                opacity: 1;
            }

            100% {
                transform: scale(1);
                opacity: 1;
            }
        }

        @media (max-width: 480px) {
            .container {
                padding: 15px;
            }

            .header h1 {
                font-size: 2em;
            }

            .stat-value {
                font-size: 1.8em;
            }

            .tracking-value {
                font-size: 1.5em;
            }

            .countdown-number {
                font-size: 6em;
            }
        }

        .leaflet-control-attribution {
            font-size: 8px;
        }

        canvas {
            max-width: 100%;
        }